[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libvir] PATCH: Added QEMU driver for virDomainGetOSType method



For some reason we never had an impl of the virDomainGetOSType method for
the QEMU driver - and for even more bizarre reason it wasn't failing, because
the old libvirt.c code hardcoded 'linux' if there was no impl. The latter
was fixed by Rich, with the xenUnified driver, so exposing the former bug.
This patch adds a simple impl for QEMU - there's no need to talk to the
daemon in this case because QEMU guests can only ever by of type 'hvm'.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
Index: qemu_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_internal.c,v
retrieving revision 1.20
diff -u -p -r1.20 qemu_internal.c
--- qemu_internal.c	4 Apr 2007 14:19:49 -0000	1.20
+++ qemu_internal.c	15 Apr 2007 21:09:25 -0000
@@ -682,6 +682,17 @@ static int qemuDestroyDomain(virDomainPt
     return 0;
 }
 
+static char *qemuDomainGetOSType(virDomainPtr domain ATTRIBUTE_UNUSED) {
+    char *type = strdup("hvm");
+
+    if (!type) {
+        qemuError (domain->conn, domain, VIR_ERR_NO_MEMORY, __FUNCTION__);
+        return NULL;
+    }
+
+    return type;
+}
+
 static int qemuShutdownDomain(virDomainPtr domain) {
     return qemuDestroyDomain(domain);
 }
@@ -1304,7 +1315,7 @@ static virDriver qemuDriver = {
     qemuShutdownDomain, /* domainShutdown */
     NULL, /* domainReboot */
     qemuDestroyDomain, /* domainDestroy */
-    NULL, /* domainGetOSType */
+    qemuDomainGetOSType, /* domainGetOSType */
     NULL, /* domainGetMaxMemory */
     NULL, /* domainSetMaxMemory */
     NULL, /* domainSetMemory */

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]