Update gvir_config_domain_device_new_from_tree to handle
GVirConfigDomainController nodes
---
.../libvirt-gconfig-domain-controller.c | 37 ++++++++++++++++++++
.../libvirt-gconfig-domain-device-private.h | 3 ++
libvirt-gconfig/libvirt-gconfig-domain-device.c | 2 +-
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-controller.c
b/libvirt-gconfig/libvirt-gconfig-domain-controller.c
index 813c934..2024b54 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-controller.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-controller.c
@@ -49,6 +49,43 @@ static void
gvir_config_domain_controller_init(GVirConfigDomainController *contr
controller->priv = GVIR_CONFIG_DOMAIN_CONTROLLER_GET_PRIVATE(controller);
}
+G_GNUC_INTERNAL GVirConfigDomainDevice *
+gvir_config_domain_controller_new_from_tree(GVirConfigXmlDoc *doc,
+ xmlNodePtr tree)
+{
+ const char *type;
+ GType gtype;
+
+ type = gvir_config_xml_get_attribute_content(tree, "type");
+ if (type == NULL)
+ return NULL;
+
+ if (g_str_equal(type, "ide")) {
+ goto unimplemented;
+ } else if (g_str_equal(type, "fdc")) {
+ goto unimplemented;
+ } else if (g_str_equal(type, "scsi")) {
+ goto unimplemented;
+ } else if (g_str_equal(type, "sata")) {
+ goto unimplemented;
+ } else if (g_str_equal(type, "usb")) {
+ gtype = GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB;;
+ } else if (g_str_equal(type, "ccid")) {
+ goto unimplemented;
+ } else if (g_str_equal(type, "virtio-serial")) {
+ goto unimplemented;
+ } else {
+ g_debug("Unknown domain controller node: %s", type);
+ return NULL;
+ }
+
+ return GVIR_CONFIG_DOMAIN_DEVICE(gvir_config_object_new_from_tree(gtype, doc, NULL,
tree));
+
+unimplemented:
+ g_debug("Parsing of '%s' domain controller nodes is unimplemented",
type);
+ return NULL;
+}
+
void gvir_config_domain_controller_set_index(GVirConfigDomainController *controller,
guint index)
{
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device-private.h
b/libvirt-gconfig/libvirt-gconfig-domain-device-private.h
index 7ba7bc6..f50946a 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-device-private.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-device-private.h
@@ -31,6 +31,9 @@ GVirConfigDomainDevice *
gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc *doc,
xmlNodePtr tree);
GVirConfigDomainDevice *
+gvir_config_domain_controller_new_from_tree(GVirConfigXmlDoc *doc,
+ xmlNodePtr tree);
+GVirConfigDomainDevice *
gvir_config_domain_disk_new_from_tree(GVirConfigXmlDoc *doc,
xmlNodePtr tree);
GVirConfigDomainDevice *
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device.c
b/libvirt-gconfig/libvirt-gconfig-domain-device.c
index 82e57e9..2f76c8b 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-device.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-device.c
@@ -64,7 +64,7 @@ gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc *doc,
} else if (xmlStrEqual(tree->name, (xmlChar*)"filesystem")) {
type = GVIR_CONFIG_TYPE_DOMAIN_FILESYS;
} else if (xmlStrEqual(tree->name, (xmlChar*)"controller")) {
- goto unimplemented;
+ return gvir_config_domain_controller_new_from_tree(doc, tree);
} else if (xmlStrEqual(tree->name, (xmlChar*)"lease")) {
goto unimplemented;
} else if (xmlStrEqual(tree->name, (xmlChar*)"hostdev")) {
--
1.7.10
Show replies by date
Update gvir_config_domain_device_new_from_tree to handle
GVirConfigDomainRedirdev nodes
---
libvirt-gconfig/libvirt-gconfig-domain-device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device.c
b/libvirt-gconfig/libvirt-gconfig-domain-device.c
index 2f76c8b..9a7fae5 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-device.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-device.c
@@ -70,7 +70,7 @@ gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc *doc,
} else if (xmlStrEqual(tree->name, (xmlChar*)"hostdev")) {
goto unimplemented;
} else if (xmlStrEqual(tree->name, (xmlChar*)"redirdev")) {
- goto unimplemented;
+ type = GVIR_CONFIG_TYPE_DOMAIN_REDIRDEV;
} else if (xmlStrEqual(tree->name, (xmlChar*)"smartcard")) {
goto unimplemented;
} else if (xmlStrEqual(tree->name, (xmlChar*)"interface")) {
--
1.7.10
On Tue, Apr 17, 2012 at 6:35 PM, Christophe Fergeau <cfergeau(a)redhat.com> wrote:
Update gvir_config_domain_device_new_from_tree to handle
GVirConfigDomainRedirdev nodes
ACK!
--
Regards,
Zeeshan Ali (Khattak)
FSF member#5124
On Tue, Apr 17, 2012 at 6:35 PM, Christophe Fergeau <cfergeau(a)redhat.com> wrote:
Update gvir_config_domain_device_new_from_tree to handle
GVirConfigDomainController nodes
Looks good but please update the commit log to reflect that its only
adding support for USB controller for the moment.
--
Regards,
Zeeshan Ali (Khattak)
FSF member#5124