fix reboot vm, then attached disk is lost

This commit is contained in:
Edison Su 2011-12-06 11:09:24 -08:00
parent d43cb5cc8c
commit dfa9ae51bc
1 changed files with 5 additions and 6 deletions

View File

@ -3011,14 +3011,14 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
}
protected String rebootVM(Connect conn, String vmName) {
String msg = stopVM(conn, vmName, defineOps.DEFINE_VM);
if (msg == null) {
Domain dm = null;
String msg = null;
try {
dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName.getBytes()));
dm.create();
String vmDef = dm.getXMLDesc(0);
s_logger.debug(vmDef);
msg = stopVM(conn, vmName, defineOps.UNDEFINE_VM);
msg = startDomain(conn, vmName, vmDef);
return null;
} catch (LibvirtException e) {
s_logger.warn("Failed to create vm", e);
@ -3035,7 +3035,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
}
}
}
return msg;
}