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

[libvirt] [PATCH libvirt-glib v2 3/8] Add API for setting virt type



From: "Daniel P. Berrange" <berrange redhat com>

Add gvir_config_domain_set_virt_type and
gvir_config_domain_virt_type_get_type

* libvirt-gconfig-domain.c, libvirt-gconfig-domain.h,
  libvirt-gconfig.h, libvirt-gconfig.sym: Add new APIs
---
 libvirt-gconfig/libvirt-gconfig-domain.c |   11 +++++++++++
 libvirt-gconfig/libvirt-gconfig-domain.h |    8 ++++++++
 libvirt-gconfig/libvirt-gconfig.sym      |    2 ++
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index b54d12c..0ceb5d5 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -175,6 +175,17 @@ GVirConfigDomain *gvir_config_domain_new(void)
     return GVIR_CONFIG_DOMAIN(object);
 }
 
+
+void gvir_config_domain_set_virt_type(GVirConfigDomain *domain, GVirConfigDomainVirtType type)
+{
+    g_return_if_fail(GVIR_IS_CONFIG_DOMAIN(domain));
+    gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(domain),
+                                               "type",
+                                               GVIR_TYPE_CONFIG_DOMAIN_VIRT_TYPE,
+                                               type, NULL);
+}
+
+
 char *gvir_config_domain_get_name(GVirConfigDomain *domain)
 {
     return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain),
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h
index 08682aa..459c308 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain.h
@@ -59,12 +59,20 @@ struct _GVirConfigDomainClass
     gpointer padding[20];
 };
 
+typedef enum {
+    GVIR_CONFIG_DOMAIN_VIRT_XEN,
+    GVIR_CONFIG_DOMAIN_VIRT_QEMU,
+    GVIR_CONFIG_DOMAIN_VIRT_KVM,
+    GVIR_CONFIG_DOMAIN_VIRT_KQEMU,
+    GVIR_CONFIG_DOMAIN_VIRT_LXC,
+} GVirConfigDomainVirtType;
 
 GType gvir_config_domain_get_type(void);
 
 GVirConfigDomain *gvir_config_domain_new_from_xml(const gchar *xml, GError **error);
 GVirConfigDomain *gvir_config_domain_new(void);
 
+void gvir_config_domain_set_virt_type(GVirConfigDomain *domain, GVirConfigDomainVirtType type);
 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);
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index e895cb0..c637a9e 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -21,6 +21,8 @@ LIBVIRT_GCONFIG_0.0.1 {
 	gvir_config_domain_set_os;
 	gvir_config_domain_get_vcpus;
 	gvir_config_domain_set_vcpus;
+	gvir_config_domain_set_virt_type;
+	gvir_config_domain_virt_type_get_type;
 
 	gvir_config_domain_clock_get_type;
 	gvir_config_domain_clock_offset_get_type;
-- 
1.7.6.4


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