Re: [libvirt-glib] Getter/setter for disk source's startupPolicy attribute

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

 



On Fri, Apr 13, 2012 at 04:41:32PM +0300, Zeeshan Ali (Khattak) wrote:
> On Fri, Apr 13, 2012 at 2:26 PM, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote:
> > On Thu, Apr 12, 2012 at 11:50:30PM +0300, Zeeshan Ali (Khattak) wrote:
> >> 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           |    5 +++-
> >>  libvirt-gconfig/tests/test-domain-create.c    |    2 +
> >>  4 files changed, 41 insertions(+), 1 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..8dac83a 100644
> >> --- a/libvirt-gconfig/libvirt-gconfig.sym
> >> +++ b/libvirt-gconfig/libvirt-gconfig.sym
> >> @@ -1,4 +1,4 @@
> >> -LIBVIRT_GCONFIG_0.0.7 {
> >> +LIBVIRT_GCONFIG_0.0.8 {
> >
> > Just wondering over raising the version number of the whole section VS
> > adding a new 0.0.8 one,
> 
> Yeah, i think thats better but this patch doesn't need to wait on that
> decision since we'd want to apply that change on all symbols (old and
> new) like I did for libosinfo (check commit d5426f1 in there).

I don't think it's strictly necessary to redo that for all symbols, I was
thinking of just starting doing it from a given release. Anyway, after
saying that I've starting working on a patch which would break ABI once
again, so let's just apply this as is.

Christophe

Attachment: pgpTnZoOd6Zas.pgp
Description: PGP signature

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]