Certain drivers always need an 'emulator' specified in the XML (qemu and lxc at least). Store this info in capabilities. We will eventually use this to move default emulator handling out of drivers and into domain_conf.* Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx> --- src/capabilities.c | 10 ++++++++++ src/capabilities.h | 7 +++++++ src/libvirt_private.syms | 2 ++ src/lxc_conf.c | 4 ++++ src/qemu_conf.c | 3 +++ 5 files changed, 26 insertions(+), 0 deletions(-) diff --git a/src/capabilities.c b/src/capabilities.c index d6e3478..00a4407 100644 --- a/src/capabilities.c +++ b/src/capabilities.c @@ -707,3 +707,13 @@ virCapabilitiesGenerateMac(virCapsPtr caps, { virGenerateMacAddr(caps->macPrefix, mac); } + +extern void +virCapabilitiesSetEmulatorRequired(virCapsPtr caps) { + caps->emulatorRequired = 1; +} + +extern unsigned int +virCapabilitiesIsEmulatorRequired(virCapsPtr caps) { + return caps->emulatorRequired; +} diff --git a/src/capabilities.h b/src/capabilities.h index 5b0bbab..0d476d1 100644 --- a/src/capabilities.h +++ b/src/capabilities.h @@ -106,6 +106,7 @@ struct _virCaps { int nguests; virCapsGuestPtr *guests; unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN]; + unsigned int emulatorRequired : 1; }; @@ -125,6 +126,12 @@ extern void virCapabilitiesGenerateMac(virCapsPtr caps, unsigned char *mac); +extern void +virCapabilitiesSetEmulatorRequired(virCapsPtr caps); + +extern unsigned int +virCapabilitiesIsEmulatorRequired(virCapsPtr caps); + extern int virCapabilitiesAddHostFeature(virCapsPtr caps, const char *name); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6af8432..5ac904f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -27,6 +27,8 @@ virCapabilitiesFree; virCapabilitiesNew; virCapabilitiesSetMacPrefix; virCapabilitiesGenerateMac; +virCapabilitiesSetEmulatorRequired; +virCapabilitiesIsEmulatorRequired; # conf.h diff --git a/src/lxc_conf.c b/src/lxc_conf.c index 8a29c25..d06a024 100644 --- a/src/lxc_conf.c +++ b/src/lxc_conf.c @@ -69,6 +69,10 @@ virCapsPtr lxcCapsInit(void) 0, NULL) == NULL) goto no_memory; + + /* LXC Requires an emulator in the XML */ + virCapabilitiesSetEmulatorRequired(caps); + return caps; no_memory: diff --git a/src/qemu_conf.c b/src/qemu_conf.c index 0c6221d..8c657be 100644 --- a/src/qemu_conf.c +++ b/src/qemu_conf.c @@ -405,6 +405,9 @@ virCapsPtr qemudCapsInit(void) { } } + /* QEMU Requires an emulator in the XML */ + virCapabilitiesSetEmulatorRequired(caps); + return caps; no_memory: -- 1.6.0.6 -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list