The bus type is actually an enum, let's reflect that in
libvirt-gconfig API
---
libvirt-gconfig/libvirt-gconfig-domain-disk.c | 8 ++++++--
libvirt-gconfig/libvirt-gconfig-domain-disk.h | 13 ++++++++++++-
libvirt-gconfig/libvirt-gconfig.sym | 1 +
libvirt-gconfig/tests/test-domain-create.c | 2 +-
4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.c
b/libvirt-gconfig/libvirt-gconfig-domain-disk.c
index 502cf43..b52f4a5 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-disk.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.c
@@ -159,14 +159,18 @@ void gvir_config_domain_disk_set_driver_type(GVirConfigDomainDisk
*disk,
}
void gvir_config_domain_disk_set_target_bus(GVirConfigDomainDisk *disk,
- const char *bus)
+ GVirConfigDomainDiskBus bus)
{
GVirConfigObject *node;
g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_DISK(disk));
node = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(disk), "target");
g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node));
- gvir_config_object_set_attribute(node, "bus", bus, NULL);
+ gvir_config_object_set_attribute_with_type(node,
+ "bus",
+ GVIR_TYPE_CONFIG_DOMAIN_DISK_BUS,
+ bus,
+ NULL);
g_object_unref(G_OBJECT(node));
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.h
b/libvirt-gconfig/libvirt-gconfig-domain-disk.h
index b90b2bc..bc63dfe 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-disk.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.h
@@ -64,6 +64,17 @@ typedef enum {
} GVirConfigDomainDiskType;
typedef enum {
+ GVIR_CONFIG_DOMAIN_DISK_BUS_IDE,
+ GVIR_CONFIG_DOMAIN_DISK_BUS_FDC,
+ GVIR_CONFIG_DOMAIN_DISK_BUS_SCSI,
+ GVIR_CONFIG_DOMAIN_DISK_BUS_VIRTIO,
+ GVIR_CONFIG_DOMAIN_DISK_BUS_XEN,
+ GVIR_CONFIG_DOMAIN_DISK_BUS_USB,
+ GVIR_CONFIG_DOMAIN_DISK_BUS_UML,
+ GVIR_CONFIG_DOMAIN_DISK_BUS_SATA
+} GVirConfigDomainDiskBus;
+
+typedef enum {
GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_DISK,
GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_FLOPPY,
GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_CDROM
@@ -94,7 +105,7 @@ void gvir_config_domain_disk_set_driver_name(GVirConfigDomainDisk
*disk,
void gvir_config_domain_disk_set_driver_type(GVirConfigDomainDisk *disk,
const char *driver_type);
void gvir_config_domain_disk_set_target_bus(GVirConfigDomainDisk *disk,
- const char *bus);
+ GVirConfigDomainDiskBus bus);
void gvir_config_domain_disk_set_target_dev(GVirConfigDomainDisk *disk,
const char *dev);
G_END_DECLS
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 6adc2c2..d0c35d2 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -54,6 +54,7 @@ LIBVIRT_GCONFIG_0.0.1 {
gvir_config_domain_device_get_type;
gvir_config_domain_disk_get_type;
+ gvir_config_domain_disk_bus_get_type;
gvir_config_domain_disk_guest_device_type_get_type;
gvir_config_domain_disk_snapshot_type_get_type;
gvir_config_domain_disk_type_get_type;
diff --git a/libvirt-gconfig/tests/test-domain-create.c
b/libvirt-gconfig/tests/test-domain-create.c
index 42aa09b..ea3a3ea 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -100,7 +100,7 @@ int main(void)
gvir_config_domain_disk_set_source(disk, "/tmp/foo/bar");
gvir_config_domain_disk_set_driver_name(disk, "qemu");
gvir_config_domain_disk_set_driver_type(disk, "qcow2");
- gvir_config_domain_disk_set_target_bus(disk, "ide");
+ gvir_config_domain_disk_set_target_bus(disk, GVIR_CONFIG_DOMAIN_DISK_BUS_IDE);
gvir_config_domain_disk_set_target_dev(disk, "hda");
devices = g_list_append(devices, GVIR_CONFIG_DOMAIN_DEVICE(disk));
--
1.7.7.3