[PATCH 7/8] Add domainGetOSType to libxl driver

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

 



---
 src/libxl/libxl_driver.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index c72a570..4b31197 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1175,6 +1175,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)
 {
@@ -2108,7 +2135,7 @@ static virDriver libxlDriver = {
     libxlDomainShutdown,        /* domainShutdown */
     libxlDomainReboot,          /* domainReboot */
     libxlDomainDestroy,         /* domainDestroy */
-    NULL,                       /* domainGetOSType */
+    libxlDomainGetOSType,       /* domainGetOSType */
     libxlDomainGetMaxMemory,    /* domainGetMaxMemory */
     NULL,                       /* domainSetMaxMemory */
     libxlDomainSetMemory,       /* domainSetMemory */
-- 
1.7.4.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]