+Fri Sep 21 17:14:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
+
+ * src/qemu_conf.c, src/qemu_conf.h: Detect QEMU flags per-VM,
+ not per driver, since different QEMU binaries have their own
+ requirements.
+ * tests/qemuxml2xmltest.c, tests/qemuxml2argvtets.c: Update
+ to changed internal QEMU api/structs.
+
Fri Sep 21 16:22:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/remote_internal.c: Add a no_tty flag to stop SSH prompting
Fri Sep 21 15:06:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
- * acinclude.m4: Check all compiler flags link successfully
+ * acinclude.m4: Check all compiler flags link successfully
instead of just compiling, to deal with broken debian linker
with stack protector
* configure.in: Remove redundant -fno-stack-protector workaround
-
+
Fri Sep 21 15:06:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_driver.c: Use libxml for parsing & checking URIs
/* Find the fully qualified path to the binary for an architecture */
static char *qemudLocateBinaryForArch(virConnectPtr conn,
- struct qemud_driver *driver ATTRIBUTE_UNUSED,
int virtType, const char *arch) {
const char *name;
char *path;
}
int qemudExtractVersion(virConnectPtr conn,
- struct qemud_driver *driver) {
+ struct qemud_driver *driver ATTRIBUTE_UNUSED) {
char *binary = NULL;
struct stat sb;
+ int ignored;
if (driver->qemuVersion > 0)
return 0;
- if (!(binary = qemudLocateBinaryForArch(conn, driver, QEMUD_VIRT_QEMU, "i686")))
+ if (!(binary = qemudLocateBinaryForArch(conn, QEMUD_VIRT_QEMU, "i686")))
return -1;
if (stat(binary, &sb) < 0) {
return -1;
}
- if (qemudExtractVersionInfo(binary, &driver->qemuVersion, &driver->qemuCmdFlags) < 0) {
+ if (qemudExtractVersionInfo(binary, &driver->qemuVersion, &ignored) < 0) {
free(binary);
return -1;
}
obj = xmlXPathEval(BAD_CAST "string(/domain/devices/emulator[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) ||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
- char *tmp = qemudLocateBinaryForArch(conn, driver, def->virtType, def->os.arch);
+ char *tmp = qemudLocateBinaryForArch(conn, def->virtType, def->os.arch);
if (!tmp) {
goto error;
}
struct utsname ut;
int disableKQEMU = 0;
- if (qemudExtractVersion(conn, driver) < 0)
+ /* Make sure the binary we are about to try exec'ing exists.
+ * Technically we could catch the exec() failure, but that's
+ * in a sub-process so its hard to feed back a useful error
+ */
+ if (stat(vm->def->os.binary, &sb) < 0) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "Cannot find QEMU binary %s: %s", vm->def->os.binary,
+ strerror(errno));
return -1;
+ }
+
+ if (vm->qemuVersion == 0) {
+ if (qemudExtractVersionInfo(vm->def->os.binary,
+ &(vm->qemuVersion),
+ &(vm->qemuCmdFlags)) < 0)
+ return -1;
+ }
uname(&ut);
* 2. Guest is 'qemu'
* 3. The qemu binary has the -no-kqemu flag
*/
- if ((driver->qemuCmdFlags & QEMUD_CMD_FLAG_KQEMU) &&
+ if ((vm->qemuCmdFlags & QEMUD_CMD_FLAG_KQEMU) &&
!strcmp(ut.machine, vm->def->os.arch) &&
vm->def->virtType == QEMUD_VIRT_QEMU)
disableKQEMU = 1;
- /* Make sure the binary we are about to try exec'ing exists.
- * Technically we could catch the exec() failure, but that's
- * in a sub-process so its hard to feed back a useful error
- */
- if (stat(vm->def->os.binary, &sb) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Cannot find QEMU binary %s: %s", vm->def->os.binary,
- strerror(errno));
- return -1;
- }
-
len = 1 + /* qemu */
2 + /* machine type */
disableKQEMU + /* Disable kqemu */
2 + /* boot device */
2 + /* monitor */
(vm->def->localtime ? 1 : 0) + /* localtime */
- (driver->qemuCmdFlags & QEMUD_CMD_FLAG_NO_REBOOT &&
+ (vm->qemuCmdFlags & QEMUD_CMD_FLAG_NO_REBOOT &&
vm->def->noReboot ? 1 : 0) + /* no-reboot */
(vm->def->features & QEMUD_FEATURE_ACPI ? 0 : 1) + /* acpi */
(vm->def->os.kernel[0] ? 2 : 0) + /* kernel */
goto no_memory;
}
- if (driver->qemuCmdFlags & QEMUD_CMD_FLAG_NO_REBOOT &&
+ if (vm->qemuCmdFlags & QEMUD_CMD_FLAG_NO_REBOOT &&
vm->def->noReboot) {
if (!((*argv)[++n] = strdup("-no-reboot")))
goto no_memory;
if (vm->def->graphicsType == QEMUD_GRAPHICS_VNC) {
char vncdisplay[BR_INET_ADDR_MAXLEN+20];
int ret;
- if (driver->qemuCmdFlags & QEMUD_CMD_FLAG_VNC_COLON)
+ if (vm->qemuCmdFlags & QEMUD_CMD_FLAG_VNC_COLON)
ret = snprintf(vncdisplay, sizeof(vncdisplay), "%s:%d",
vm->def->vncListen,
vm->def->vncActivePort - 5900);
qemudFreeVMDef(vm->newDef);
vm->newDef = def;
}
-
+ /* Reset version, because the emulator path might have changed */
+ vm->qemuVersion = 0;
+ vm->qemuCmdFlags = 0;
return vm;
}