[libvirt] [PATCH] fix lookup

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

 



I am often catching error related with that stoped VM has ID = -1.

1. If I create/define VM with existing ID of stoped VM. Creation failed, but error message is wrong. Detection is fixed. 2. Dominfo command may show info about some another VM. And report error that can't get autostart state.

Current patch shoud fix problems.
Index: src/openvz_driver.c
===================================================================
RCS file: /data/cvs/libvirt/src/openvz_driver.c,v
retrieving revision 1.31
diff -u -p -r1.31 openvz_driver.c
--- src/openvz_driver.c	16 Jul 2008 20:42:38 -0000	1.31
+++ src/openvz_driver.c	18 Jul 2008 14:41:44 -0000
@@ -289,7 +289,7 @@ static int openvzDomainGetInfo(virDomain
 
 static int openvzDomainShutdown(virDomainPtr dom) {
     struct openvz_driver *driver = (struct openvz_driver *)dom->conn->privateData;
-    struct openvz_vm *vm = openvzFindVMByID(driver, dom->id);
+    struct openvz_vm *vm = openvzFindVMByUUID(driver, dom->uuid);
     const char *prog[] = {VZCTL, "--quiet", "stop", vm->vmdef->name, NULL};
 
     if (!vm) {
@@ -321,7 +321,7 @@ static int openvzDomainShutdown(virDomai
 static int openvzDomainReboot(virDomainPtr dom,
                               unsigned int flags ATTRIBUTE_UNUSED) {
     struct openvz_driver *driver = (struct openvz_driver *)dom->conn->privateData;
-    struct openvz_vm *vm = openvzFindVMByID(driver, dom->id);
+    struct openvz_vm *vm = openvzFindVMByUUID(driver, dom->uuid);
     const char *prog[] = {VZCTL, "--quiet", "restart", vm->vmdef->name, NULL};
 
     if (!vm) {
@@ -358,7 +358,7 @@ openvzDomainDefineXML(virConnectPtr conn
     if ((vmdef = openvzParseVMDef(conn, xml, NULL)) == NULL)
         return NULL;
 
-    vm = openvzFindVMByID(driver, strtoI(vmdef->name));
+    vm = openvzFindVMByName(driver, vmdef->name);
     if (vm) {
         openvzLog(OPENVZ_ERR, _("Already an OPENVZ VM active with the id '%s'"),
                   vmdef->name);
@@ -404,7 +404,7 @@ openvzDomainCreateLinux(virConnectPtr co
     if (!(vmdef = openvzParseVMDef(conn, xml, NULL)))
         return NULL;
 
-    vm = openvzFindVMByID(driver, strtoI(vmdef->name));
+    vm = openvzFindVMByName(driver, vmdef->name);
     if (vm) {
         openvzFreeVMDef(vmdef);
         openvzLog(OPENVZ_ERR,
@@ -547,7 +547,7 @@ openvzDomainGetAutostart(virDomainPtr do
         return -1;
     }
 
-    if (openvzReadConfigParam(vm->vpsid , "ONBOOT", value, sizeof(value)) < 0) {
+    if (openvzReadConfigParam(strtoI(vm->vmdef->name), "ONBOOT", value, sizeof(value)) < 0) {
         openvzError(conn, VIR_ERR_INTERNAL_ERROR, _("Cound not read container config"));
         return -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]