Fix double reboot issue during soft reboot
Using the ID of domain in Libvirt to recognize the hard reboot has been implemented or not, if the ID changed, we believe the domain has been rebooted, return True and break from soft reboot. Fixes: bug #1046356 Change-Id: Iec2f9e8225cfe2779f84d2095667f3c0e621e935
This commit is contained in:
@@ -179,6 +179,7 @@ class Domain(object):
|
||||
self._def = self._parse_definition(xml)
|
||||
self._has_saved_state = False
|
||||
self._snapshots = {}
|
||||
self._id = self._connection._id_counter
|
||||
|
||||
def _parse_definition(self, xml):
|
||||
try:
|
||||
@@ -299,6 +300,9 @@ class Domain(object):
|
||||
self._state = VIR_DOMAIN_SHUTOFF
|
||||
self._connection._mark_not_running(self)
|
||||
|
||||
def ID(self):
|
||||
return self._id
|
||||
|
||||
def name(self):
|
||||
return self._def['name']
|
||||
|
||||
@@ -516,6 +520,8 @@ class Connection(object):
|
||||
if dom._transient:
|
||||
self._undefine(dom)
|
||||
|
||||
dom._id = -1
|
||||
|
||||
for (k, v) in self._running_vms.iteritems():
|
||||
if v == dom:
|
||||
del self._running_vms[k]
|
||||
|
||||
Reference in New Issue
Block a user