Re: [PATCHv3 26/27] virCaps: get rid of emulatorRequired

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

 



On Mon, Mar 11, 2013 at 04:06:37PM +0100, Peter Krempa wrote:
> This patch removes the emulatorRequired field and associated
> infrastructure from the virCaps object. Instead the driver specific
> callbacks are used as this field isn't enforced by all drivers.
> 
> This patch implements the appropriate callbacks in the qemu and lxc
> driver and moves to check to that location.
> ---
>  src/conf/capabilities.c              | 10 ----------
>  src/conf/capabilities.h              |  7 -------
>  src/conf/domain_conf.c               | 16 ++++++----------
>  src/conf/domain_conf.h               |  2 ++
>  src/libvirt_private.syms             |  3 +--
>  src/lxc/lxc_conf.c                   |  7 +++----
>  src/lxc/lxc_domain.c                 | 17 +++++++++++++++++
>  src/lxc/lxc_domain.h                 |  1 +
>  src/qemu/qemu_capabilities.c         |  3 ---
>  src/qemu/qemu_domain.c               | 15 +++++++++++++++
>  tests/lxcxml2xmldata/lxc-hostdev.xml |  1 +
>  tests/lxcxml2xmldata/lxc-systemd.xml |  1 +
>  12 files changed, 47 insertions(+), 36 deletions(-)
> 
> diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
> index d53d5a3..1d29ce6 100644
> --- a/src/conf/capabilities.c
> +++ b/src/conf/capabilities.c
> @@ -935,13 +935,3 @@ virCapabilitiesGenerateMac(virCapsPtr caps,
>  {
>      virMacAddrGenerate(caps->macPrefix, mac);
>  }
> -
> -extern void
> -virCapabilitiesSetEmulatorRequired(virCapsPtr caps) {
> -    caps->emulatorRequired = 1;
> -}
> -
> -extern unsigned int
> -virCapabilitiesIsEmulatorRequired(virCapsPtr caps) {
> -    return caps->emulatorRequired;
> -}
> diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
> index 5fd1bb5..dcf38a8 100644
> --- a/src/conf/capabilities.h
> +++ b/src/conf/capabilities.h
> @@ -163,7 +163,6 @@ struct _virCaps {
> 
>      /* Move to virDomainXMLConf later */
>      unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN];
> -    unsigned int emulatorRequired : 1;
>      int defaultDiskDriverType; /* enum virStorageFileFormat */
>      int (*defaultConsoleTargetType)(const char *ostype, virArch guestarch);
>      bool hasWideScsiBus;
> @@ -186,12 +185,6 @@ extern void
>  virCapabilitiesGenerateMac(virCapsPtr caps,
>                             virMacAddrPtr mac);
> 
> -extern void
> -virCapabilitiesSetEmulatorRequired(virCapsPtr caps);
> -
> -extern unsigned int
> -virCapabilitiesIsEmulatorRequired(virCapsPtr caps);
> -
>  extern int
>  virCapabilitiesAddHostFeature(virCapsPtr caps,
>                                const char *name);
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 1cdd9e5..fbdab9a 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -9079,8 +9079,9 @@ virDomainLeaseRemove(virDomainDefPtr def,
>  }
> 
> 
> -static char *virDomainDefDefaultEmulator(virDomainDefPtr def,
> -                                         virCapsPtr caps) {
> +char *
> +virDomainDefDefaultEmulator(virDomainDefPtr def,
> +                            virCapsPtr caps) {
>      const char *type;
>      const char *emulator;
>      char *retemu;
> @@ -9099,13 +9100,13 @@ static char *virDomainDefDefaultEmulator(virDomainDefPtr def,
> 
>      if (!emulator) {
>          virReportError(VIR_ERR_INTERNAL_ERROR,
> -                       _("no emulator for domain %s os type %s on architecture %s"),
> +                       _("no emulator for domain %s os type %s "
> +                         "on architecture %s"),
>                         type, def->os.type, virArchToString(def->os.arch));
>          return NULL;
>      }
> 
> -    retemu = strdup(emulator);
> -    if (!retemu)
> +    if (!(retemu = strdup(emulator)))
>          virReportOOMError();
> 
>      return retemu;
> @@ -10263,11 +10264,6 @@ virDomainDefParseXML(virCapsPtr caps,
>      }
> 
>      def->emulator = virXPathString("string(./devices/emulator[1])", ctxt);
> -    if (!def->emulator && virCapabilitiesIsEmulatorRequired(caps)) {
> -        def->emulator = virDomainDefDefaultEmulator(def, caps);
> -        if (!def->emulator)
> -            goto error;
> -    }
> 
>      /* analysis of the disk devices */
>      if ((n = virXPathNodeSet("./devices/disk", ctxt, &nodes)) < 0)
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index ab66707..0dac95e 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -2471,4 +2471,6 @@ int virDomainObjListExport(virDomainObjListPtr doms,
>  virDomainVcpuPinDefPtr virDomainLookupVcpuPin(virDomainDefPtr def,
>                                                int vcpuid);
> 
> +char *virDomainDefDefaultEmulator(virDomainDefPtr def, virCapsPtr caps);

s/virDomainDefDefaultEmulator/virDomainDefSetDefaultEmulator) to make it
clear that this is a setter function.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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