+Tue Jun 16 11:33:54 EDT 2009 Cole Robinson <crobinso@redhat.com>
+
+ * src/domain_conf.c src/domain_conf.h src/libvirt_private.syms
+ src/lxc_driver.c src/qemu_conf.c src/qemu_driver.c:
+ Set default emulator in domain_conf.*, rather than the driver.
+
Tue Jun 16 11:18:00 EDT 2009 Cole Robinson <crobinso@redhat.com>
* src/capabilities.c src/capabilities.h src/libvirt_private.syms
}
#ifndef PROXY
+static char *virDomainDefDefaultEmulator(virConnectPtr conn,
+ virDomainDefPtr def,
+ virCapsPtr caps) {
+ const char *type;
+ const char *emulator;
+ char *retemu;
+
+ type = virDomainVirtTypeToString(def->virtType);
+ if (!type) {
+ virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("unknown virt type"));
+ return NULL;
+ }
+
+ emulator = virCapabilitiesDefaultGuestEmulator(caps,
+ def->os.type,
+ def->os.arch,
+ type);
+
+ if (!emulator) {
+ virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("no emulator for domain %s os type %s on architecture %s"),
+ type, def->os.type, def->os.arch);
+ return NULL;
+ }
+
+ retemu = strdup(emulator);
+ if (!retemu)
+ virReportOOMError(conn);
+
+ return retemu;
+}
+
static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
virCapsPtr caps,
xmlXPathContextPtr ctxt, int flags)
}
def->emulator = virXPathString(conn, "string(./devices/emulator[1])", ctxt);
+ if (!def->emulator && virCapabilitiesIsEmulatorRequired(caps)) {
+ def->emulator = virDomainDefDefaultEmulator(conn, def, caps);
+ if (!def->emulator)
+ goto error;
+ }
/* analysis of the disk devices */
if ((n = virXPathNodeSet(conn, "./devices/disk", ctxt, &nodes)) < 0) {
return 0;
}
-const char *virDomainDefDefaultEmulator(virConnectPtr conn,
- virDomainDefPtr def,
- virCapsPtr caps) {
- const char *type;
- const char *emulator;
-
- type = virDomainVirtTypeToString(def->virtType);
- if (!type) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("unknown virt type"));
- return NULL;
- }
-
- emulator = virCapabilitiesDefaultGuestEmulator(caps,
- def->os.type,
- def->os.arch,
- type);
-
- if (!emulator) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
- _("no emulator for domain %s os type %s on architecture %s"),
- type, def->os.type, def->os.arch);
- return NULL;
- }
-
- return emulator;
-}
-
virDomainFSDefPtr virDomainGetRootFilesystem(virDomainDefPtr def)
{
int i;
goto cleanup;
emulator = vm->def->emulator;
- if (!emulator)
- emulator = virDomainDefDefaultEmulator(conn, vm->def, driver->caps);
- if (!emulator)
- goto cleanup;
/* Make sure the binary we are about to try exec'ing exists.
* Technically we could catch the exec() failure, but that's
def->graphics[i]->data.vnc.port = 5900;
}
emulator = def->emulator;
- if (!emulator)
- emulator = virDomainDefDefaultEmulator(conn, def, driver->caps);
- if (!emulator)
- goto cleanup;
/* Make sure the binary we are about to try exec'ing exists.
* Technically we could catch the exec() failure, but that's