]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Add domainGetOSType to libxl driver
authorMarkus Groß <gross@univention.de>
Tue, 29 Mar 2011 12:49:43 +0000 (20:49 +0800)
committerDaniel Veillard <veillard@redhat.com>
Tue, 29 Mar 2011 12:57:02 +0000 (20:57 +0800)
* src/libxl/libxl_driver.c: implements libxlDomainGetOSType

src/libxl/libxl_driver.c

index 1a70f7948fe55481c18cb7a1be25cd5eb308b07b..47b7e5673a492de0f95d5fb8e57fa2a0c5c76629 100644 (file)
@@ -1174,6 +1174,33 @@ cleanup:
     return ret;
 }
 
+static char *
+libxlDomainGetOSType(virDomainPtr dom)
+{
+    libxlDriverPrivatePtr driver = dom->conn->privateData;
+    virDomainObjPtr vm;
+    char *type = NULL;
+
+    libxlDriverLock(driver);
+    vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+    libxlDriverUnlock(driver);
+    if (!vm) {
+        char uuidstr[VIR_UUID_STRING_BUFLEN];
+        virUUIDFormat(dom->uuid, uuidstr);
+        libxlError(VIR_ERR_NO_DOMAIN,
+                   _("No domain with matching uuid '%s'"), uuidstr);
+        goto cleanup;
+    }
+
+    if (!(type = strdup(vm->def->os.type)))
+        virReportOOMError();
+
+cleanup:
+    if (vm)
+        virDomainObjUnlock(vm);
+    return type;
+}
+
 static unsigned long
 libxlDomainGetMaxMemory(virDomainPtr dom)
 {
@@ -2124,7 +2151,7 @@ static virDriver libxlDriver = {
     libxlDomainShutdown,        /* domainShutdown */
     libxlDomainReboot,          /* domainReboot */
     libxlDomainDestroy,         /* domainDestroy */
-    NULL,                       /* domainGetOSType */
+    libxlDomainGetOSType,       /* domainGetOSType */
     libxlDomainGetMaxMemory,    /* domainGetMaxMemory */
     NULL,                       /* domainSetMaxMemory */
     libxlDomainSetMemory,       /* domainSetMemory */