---
 libvirt-gconfig/libvirt-gconfig-domain.c   |   29 ++++++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain.h   |    3 ++
 libvirt-gconfig/libvirt-gconfig.sym        |    2 +
 libvirt-gconfig/tests/test-domain-create.c |    1 +
 4 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c 
b/libvirt-gconfig/libvirt-gconfig-domain.c
index 8fb1c11..3f84b5f 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -47,6 +47,7 @@ enum {
     PROP_0,
     PROP_NAME,
     PROP_MEMORY,
+    PROP_VCPU,
     PROP_FEATURES
 };
 
@@ -64,6 +65,9 @@ static void gvir_config_domain_get_property(GObject *object,
     case PROP_MEMORY:
         g_value_set_uint64(value, gvir_config_domain_get_memory(domain));
         break;
+    case PROP_VCPU:
+        g_value_set_uint64(value, gvir_config_domain_get_vcpus(domain));
+        break;
     case PROP_FEATURES:
         g_value_take_boxed(value, gvir_config_domain_get_features(domain));
         break;
@@ -87,6 +91,9 @@ static void gvir_config_domain_set_property(GObject *object,
     case PROP_MEMORY:
         gvir_config_domain_set_memory(domain, g_value_get_uint64(value));
         break;
+    case PROP_VCPU:
+        gvir_config_domain_set_vcpus(domain, g_value_get_uint64(value));
+        break;
     case PROP_FEATURES:
         gvir_config_domain_set_features(domain, g_value_get_boxed(value));
         break;
@@ -123,6 +130,15 @@ static void 
gvir_config_domain_class_init(GVirConfigDomainClass *klass)
                                                         G_PARAM_READWRITE |
                                                         
G_PARAM_STATIC_STRINGS));
     g_object_class_install_property(object_class,
+                                    PROP_VCPU,
+                                    g_param_spec_uint64("vcpu",
+                                                        "Virtual CPUs",
+                                                        "Maximum Number of 
Guest Virtual CPUs",
+                                                        0, G_MAXUINT64,
+                                                        1,
+                                                        G_PARAM_READWRITE |
+                                                        
G_PARAM_STATIC_STRINGS));
+    g_object_class_install_property(object_class,
                                     PROP_FEATURES,
                                     g_param_spec_boxed("features",
                                                         "Features",
@@ -193,6 +209,19 @@ void gvir_config_domain_set_memory(GVirConfigDomain 
*domain, guint64 memory)
     g_object_notify(G_OBJECT(domain), "memory");
 }
 
+guint64 gvir_config_domain_get_vcpus(GVirConfigDomain *domain)
+{
+    return 
gvir_config_object_get_node_content_uint64(GVIR_CONFIG_OBJECT(domain),
+                                                      "vcpu");
+}
+
+void gvir_config_domain_set_vcpus(GVirConfigDomain *domain, guint64 vcpu_count)
+{
+    gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(domain),
+                                               "vcpu", vcpu_count);
+    g_object_notify(G_OBJECT(domain), "vcpu");
+}
+
 /**
  * gvir_config_domain_get_features:
  * Returns: (transfer full):
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h 
b/libvirt-gconfig/libvirt-gconfig-domain.h
index 2f33988..4989901 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain.h
@@ -69,6 +69,9 @@ char *gvir_config_domain_get_name(GVirConfigDomain *domain);
 void gvir_config_domain_set_name(GVirConfigDomain *domain, const char *name);
 guint64 gvir_config_domain_get_memory(GVirConfigDomain *domain);
 void gvir_config_domain_set_memory(GVirConfigDomain *domain, guint64 memory);
+guint64 gvir_config_domain_get_vcpus(GVirConfigDomain *domain);
+void gvir_config_domain_set_vcpus(GVirConfigDomain *domain,
+                                  guint64 vcpu_count);
 GStrv gvir_config_domain_get_features(GVirConfigDomain *domain);
 void gvir_config_domain_set_features(GVirConfigDomain *domain,
                                      const GStrv features);
diff --git a/libvirt-gconfig/libvirt-gconfig.sym 
b/libvirt-gconfig/libvirt-gconfig.sym
index ba9e051..bb8568b 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -15,6 +15,8 @@ LIBVIRT_GOBJECT_0.0.1 {
        gvir_config_domain_set_memory;
        gvir_config_domain_get_name;
        gvir_config_domain_set_name;
+       gvir_config_domain_get_vcpus;
+       gvir_config_domain_set_vcpus;
 
        gvir_config_domain_clock_get_type;
        gvir_config_domain_clock_offset_get_type;
diff --git a/libvirt-gconfig/tests/test-domain-create.c 
b/libvirt-gconfig/tests/test-domain-create.c
index 6823ebc..6e59f6f 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -49,6 +49,7 @@ int main(void)
     g_free(name);
 
     gvir_config_domain_set_memory(domain, 1234);
+    gvir_config_domain_set_vcpus(domain, 3);
     g_assert(gvir_config_domain_get_memory(domain) == 1234);
 
     gvir_config_domain_set_features(domain, (const GStrv)features);
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to