summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-01-30 19:57:20 +0000
committerJim Meyering <meyering@redhat.com>2009-01-30 19:57:20 +0000
commita119a98081e04fa7443ff86b8a5ac5501e870d70 (patch)
tree30b2cce8dcd29e459819272fa3d6935f175629f5
parentFix ifname= passing to QEMU for type=ethernet network config (diff)
downloadlibvirt-a119a98081e04fa7443ff86b8a5ac5501e870d70.tar.gz
libvirt-a119a98081e04fa7443ff86b8a5ac5501e870d70.tar.bz2
libvirt-a119a98081e04fa7443ff86b8a5ac5501e870d70.zip
fix qemud version reporting when qemu is not installed
* src/qemu_conf.c (uname_normalize): New function, factored out of... (qemudBuildCommandLine): ...here. Use the new function. (qemudExtractVersion): Use it here, rather than hard-coding "i686".
-rw-r--r--ChangeLog7
-rw-r--r--src/qemu_conf.c27
2 files changed, 25 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index fac7ab593..fada8d18d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Jan 30 20:55:57 +0100 2009 Jim Meyering <meyering@redhat.com>
+
+ fix qemud version reporting when qemu is not installed
+ * src/qemu_conf.c (uname_normalize): New function, factored out of...
+ (qemudBuildCommandLine): ...here. Use the new function.
+ (qemudExtractVersion): Use it here, rather than hard-coding "i686".
+
Fri Jan 30 17:16:22 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_conf.c: Fix ifname= handling for type=ethernet
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index d86b18946..ef45b12df 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -486,17 +486,33 @@ rewait:
return ret;
}
+static void
+uname_normalize (struct utsname *ut)
+{
+ uname(ut);
+
+ /* Map i386, i486, i586 to i686. */
+ if (ut->machine[0] == 'i' &&
+ ut->machine[1] != '\0' &&
+ ut->machine[2] == '8' &&
+ ut->machine[3] == '6' &&
+ ut->machine[4] == '\0')
+ ut->machine[1] = '6';
+}
+
int qemudExtractVersion(virConnectPtr conn,
struct qemud_driver *driver) {
const char *binary;
struct stat sb;
+ struct utsname ut;
if (driver->qemuVersion > 0)
return 0;
+ uname_normalize(&ut);
if ((binary = virCapabilitiesDefaultGuestEmulator(driver->caps,
"hvm",
- "i686",
+ ut.machine,
"qemu")) == NULL)
return -1;
@@ -718,14 +734,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
char domid[50];
char *pidfile;
- uname(&ut);
-
- /* Nasty hack make i?86 look like i686 to simplify next comparison */
- if (ut.machine[0] == 'i' &&
- ut.machine[2] == '8' &&
- ut.machine[3] == '6' &&
- !ut.machine[4])
- ut.machine[1] = '6';
+ uname_normalize(&ut);
virUUIDFormat(vm->def->uuid, uuid);