Re: [libvirt] [PATCH 1/3] Make startmode optional in toplevel interface definitions.

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

 



On Fri, Oct 16, 2009 at 10:56:17AM -0400, laine@xxxxxxxxx wrote:
> From: Laine Stump <laine@xxxxxxxxx>
> 
> The minimal XML returned from ncf_if_xml_state() doesn't contain this
> attribute (which makes no sense in the case of reporting current
> status of the interface), and it was preventing it from passing
> through the parse/format step.
> ---
>  src/conf/interface_conf.c |   11 +++++------
>  src/conf/interface_conf.h |    3 ++-
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
> index e646351..540c931 100644
> --- a/src/conf/interface_conf.c
> +++ b/src/conf/interface_conf.c
> @@ -128,12 +128,9 @@ virInterfaceDefParseStartMode(virConnectPtr conn, virInterfaceDefPtr def,
>      char *tmp;
>  
>      tmp = virXPathString(conn, "string(./start/@mode)", ctxt);
> -    if (tmp == NULL) {
> -        virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
> -                        "%s", _("interface misses the start mode attribute"));
> -        return(-1);
> -    }
> -    if (STREQ(tmp, "onboot"))
> +    if (tmp == NULL)
> +        def->startmode = VIR_INTERFACE_START_UNSPECIFIED;
> +    else if (STREQ(tmp, "onboot"))
>          def->startmode = VIR_INTERFACE_START_ONBOOT;
>      else if (STREQ(tmp, "hotplug"))
>          def->startmode = VIR_INTERFACE_START_HOTPLUG;
> @@ -1039,6 +1036,8 @@ virInterfaceStartmodeDefFormat(virConnectPtr conn, virBufferPtr buf,
>                                 enum virInterfaceStartMode startmode) {
>      const char *mode;
>      switch (startmode) {
> +        case VIR_INTERFACE_START_UNSPECIFIED:
> +            return 0;
>          case VIR_INTERFACE_START_NONE:
>              mode = "none";
>              break;
> diff --git a/src/conf/interface_conf.h b/src/conf/interface_conf.h
> index bb9dce4..20d9771 100644
> --- a/src/conf/interface_conf.h
> +++ b/src/conf/interface_conf.h
> @@ -48,7 +48,8 @@ VIR_ENUM_DECL(virInterface)
>  /* types of start mode */
>  
>  enum virInterfaceStartMode {
> -    VIR_INTERFACE_START_NONE = 0, /* not defined */
> +    VIR_INTERFACE_START_UNSPECIFIED = 0, /* not given in config */
> +    VIR_INTERFACE_START_NONE,     /* specified as not defined */
>      VIR_INTERFACE_START_ONBOOT,   /* startup at boot */
>      VIR_INTERFACE_START_HOTPLUG,  /* on hotplug */
>  };

  Okay, I usually prefer when enum numbering is not shuffled in patches,
  but in that case that should have no consequence, so ACK,
  I'm pushing this, thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
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]