[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [libvirt-glib PATCHv2 3/3] Implement gvir_config_domain_graphics_spice_get_port



---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 8 ++++++++
 libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h | 1 +
 libvirt-gconfig/libvirt-gconfig.sym                     | 2 ++
 libvirt-gconfig/tests/test-domain-create.c              | 1 +
 4 files changed, 12 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
index 61d3f5b..d090a3a 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
@@ -95,6 +95,14 @@ void gvir_config_domain_graphics_spice_set_password(GVirConfigDomainGraphicsSpic
                                      NULL);
 }
 
+int gvir_config_domain_graphics_spice_get_port(GVirConfigDomainGraphicsSpice *graphics)
+{
+    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics), 0);
+
+    return gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(graphics),
+                                                   NULL, "port", 0);
+}
+
 void gvir_config_domain_graphics_spice_set_port(GVirConfigDomainGraphicsSpice *graphics,
                                                 int port)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
index d198813..c82615b 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
@@ -68,6 +68,7 @@ void gvir_config_domain_graphics_spice_set_autoport(GVirConfigDomainGraphicsSpic
 void gvir_config_domain_graphics_spice_set_password(GVirConfigDomainGraphicsSpice *graphics,
                                                     const char *password);
 
+int gvir_config_domain_graphics_spice_get_port(GVirConfigDomainGraphicsSpice *graphics);
 void gvir_config_domain_graphics_spice_set_port(GVirConfigDomainGraphicsSpice *graphics,
                                                 int port);
 
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 17a8e11..2ec2e80 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -465,6 +465,8 @@ LIBVIRT_GCONFIG_0.1.3 {
 	gvir_config_domain_get_current_memory;
 	gvir_config_domain_set_current_memory;
 
+	gvir_config_domain_graphics_spice_get_port;
+
 	gvir_config_domain_graphics_vnc_get_port;
 	gvir_config_domain_graphics_vnc_get_socket;
 	gvir_config_domain_graphics_vnc_set_socket;
diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index c3e627b..4c94b2a 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -287,6 +287,7 @@ int main(int argc, char **argv)
 
     graphics = gvir_config_domain_graphics_spice_new();
     gvir_config_domain_graphics_spice_set_port(graphics, 1234);
+    g_assert(gvir_config_domain_graphics_spice_get_port(graphics) == 1234);
     devices = g_list_append(devices, GVIR_CONFIG_DOMAIN_DEVICE(graphics));
 
     /* video node */
-- 
1.7.11.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]