From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx> --- libvirt-gconfig/libvirt-gconfig-domain-disk.c | 26 +++++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-disk.h | 9 ++++++++ libvirt-gconfig/libvirt-gconfig.sym | 3 ++ 3 files changed, 38 insertions(+), 0 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.c b/libvirt-gconfig/libvirt-gconfig-domain-disk.c index 5d0acb5..a29ea47 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-disk.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.c @@ -127,6 +127,18 @@ void gvir_config_domain_disk_set_snapshot_type(GVirConfigDomainDisk *disk, type, NULL); } +void gvir_config_domain_disk_set_startup_policy(GVirConfigDomainDisk *disk, + GVirConfigDomainDiskStartupPolicy policy) +{ + const char *str; + + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_DISK(disk)); + str = gvir_config_genum_get_nick(GVIR_CONFIG_TYPE_DOMAIN_DISK_STARTUP_POLICY, policy); + g_return_if_fail(str != NULL); + gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(disk), + "source", "startupPolicy", str); +} + void gvir_config_domain_disk_set_source(GVirConfigDomainDisk *disk, const char *source) { @@ -235,6 +247,19 @@ gvir_config_domain_disk_get_snapshot_type(GVirConfigDomainDisk *disk) GVIR_CONFIG_DOMAIN_DISK_SNAPSHOT_NO); } +GVirConfigDomainDiskStartupPolicy +gvir_config_domain_disk_get_startup_policy(GVirConfigDomainDisk *disk) +{ + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_DISK(disk), + GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_MANDATORY); + + return gvir_config_object_get_attribute_genum + (GVIR_CONFIG_OBJECT(disk), + "source", "startupPolicy", + GVIR_CONFIG_TYPE_DOMAIN_DISK_STARTUP_POLICY, + GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_MANDATORY); +} + const char * gvir_config_domain_disk_get_source(GVirConfigDomainDisk *disk) { @@ -291,6 +316,7 @@ gvir_config_domain_disk_get_driver_cache(GVirConfigDomainDisk *disk) GVIR_CONFIG_TYPE_DOMAIN_DISK_CACHE_TYPE, GVIR_CONFIG_DOMAIN_DISK_CACHE_DEFAULT); } + GVirConfigDomainDiskBus gvir_config_domain_disk_get_target_bus(GVirConfigDomainDisk *disk) { diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.h b/libvirt-gconfig/libvirt-gconfig-domain-disk.h index 916421d..7e85d75 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-disk.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.h @@ -95,6 +95,12 @@ typedef enum { GVIR_CONFIG_DOMAIN_DISK_SNAPSHOT_EXTERNAL } GVirConfigDomainDiskSnapshotType; +typedef enum { + GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_MANDATORY, + GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_REQUISITE, + GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_OPTIONAL +} GVirConfigDomainDiskStartupPolicy; + GType gvir_config_domain_disk_get_type(void); GVirConfigDomainDisk *gvir_config_domain_disk_new(void); @@ -107,6 +113,8 @@ void gvir_config_domain_disk_set_guest_device_type(GVirConfigDomainDisk *disk, GVirConfigDomainDiskGuestDeviceType type); void gvir_config_domain_disk_set_snapshot_type(GVirConfigDomainDisk *disk, GVirConfigDomainDiskSnapshotType type); +void gvir_config_domain_disk_set_startup_policy(GVirConfigDomainDisk *disk, + GVirConfigDomainDiskStartupPolicy policy); void gvir_config_domain_disk_set_source(GVirConfigDomainDisk *disk, const char *source); void gvir_config_domain_disk_set_driver_cache(GVirConfigDomainDisk *disk, @@ -123,6 +131,7 @@ void gvir_config_domain_disk_set_target_dev(GVirConfigDomainDisk *disk, GVirConfigDomainDiskType gvir_config_domain_disk_get_disk_type(GVirConfigDomainDisk *disk); GVirConfigDomainDiskGuestDeviceType gvir_config_domain_disk_get_guest_device_type(GVirConfigDomainDisk *disk); GVirConfigDomainDiskSnapshotType gvir_config_domain_disk_get_snapshot_type(GVirConfigDomainDisk *disk); +GVirConfigDomainDiskStartupPolicy gvir_config_domain_disk_get_startup_policy(GVirConfigDomainDisk *disk); const char *gvir_config_domain_disk_get_source(GVirConfigDomainDisk *disk); GVirConfigDomainDiskCacheType gvir_config_domain_disk_get_driver_cache(GVirConfigDomainDisk *disk); const char *gvir_config_domain_disk_get_driver_name(GVirConfigDomainDisk *disk); diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 2378a3c..f4e5fa3 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -76,6 +76,7 @@ LIBVIRT_GCONFIG_0.0.7 { gvir_config_domain_disk_cache_type_get_type; gvir_config_domain_disk_guest_device_type_get_type; gvir_config_domain_disk_snapshot_type_get_type; + gvir_config_domain_disk_startup_policy_get_type; gvir_config_domain_disk_type_get_type; gvir_config_domain_disk_new; gvir_config_domain_disk_new_from_xml; @@ -91,6 +92,8 @@ LIBVIRT_GCONFIG_0.0.7 { gvir_config_domain_disk_set_snapshot_type; gvir_config_domain_disk_get_source; gvir_config_domain_disk_set_source; + gvir_config_domain_disk_get_startup_policy; + gvir_config_domain_disk_set_startup_policy; gvir_config_domain_disk_get_target_bus; gvir_config_domain_disk_set_target_bus; gvir_config_domain_disk_get_target_dev; -- 1.7.7.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list