Add virCapabilities*EmulatorRequired.

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.*
This commit is contained in:
Cole Robinson 2009-06-16 15:27:33 +00:00
parent 659bd66529
commit 3f63c44d12
6 changed files with 31 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Tue Jun 16 11:18:00 EDT 2009 Cole Robinson <crobinso@redhat.com>
* src/capabilities.c src/capabilities.h src/libvirt_private.syms
src/lxc_conf.c src/qemu_conf.c: Add virCapabilities*EmulatorRequired.
Tue Jun 16 11:16:17 EDT 2009 Cole Robinson <crobinso@redhat.com>
* src/qemu_conf.c src/qemu_conf.h tests/qemuhelptest.c

View File

@ -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;
}

View File

@ -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);

View File

@ -27,6 +27,8 @@ virCapabilitiesFree;
virCapabilitiesNew;
virCapabilitiesSetMacPrefix;
virCapabilitiesGenerateMac;
virCapabilitiesSetEmulatorRequired;
virCapabilitiesIsEmulatorRequired;
# conf.h

View File

@ -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:

View File

@ -405,6 +405,9 @@ virCapsPtr qemudCapsInit(void) {
}
}
/* QEMU Requires an emulator in the XML */
virCapabilitiesSetEmulatorRequired(caps);
return caps;
no_memory: