Track status of VM state thread
This commit is contained in:
parent
2a4f38e933
commit
febef2e406
|
@ -67,6 +67,9 @@ class VMInstance(object):
|
||||||
self.inshutdown = False
|
self.inshutdown = False
|
||||||
self.instop = False
|
self.instop = False
|
||||||
|
|
||||||
|
# State thread
|
||||||
|
self.state_thread = None
|
||||||
|
|
||||||
# Libvirt domuuid
|
# Libvirt domuuid
|
||||||
self.dom = self.lookupByUUID(self.domuuid)
|
self.dom = self.lookupByUUID(self.domuuid)
|
||||||
|
|
||||||
|
@ -83,8 +86,8 @@ class VMInstance(object):
|
||||||
|
|
||||||
# Perform a management command
|
# Perform a management command
|
||||||
self.logger.out('Updating state of VM {}'.format(self.domuuid), state='i')
|
self.logger.out('Updating state of VM {}'.format(self.domuuid), state='i')
|
||||||
state_thread = Thread(target=self.manage_vm_state, args=(), kwargs={})
|
self.state_thread = Thread(target=self.manage_vm_state, args=(), kwargs={})
|
||||||
state_thread.start()
|
self.state_thread.start()
|
||||||
|
|
||||||
# Get data functions
|
# Get data functions
|
||||||
def getstate(self):
|
def getstate(self):
|
||||||
|
@ -716,6 +719,9 @@ class VMInstance(object):
|
||||||
else:
|
else:
|
||||||
self.terminate_vm()
|
self.terminate_vm()
|
||||||
|
|
||||||
|
self.state_thread = None
|
||||||
|
return
|
||||||
|
|
||||||
# This function is a wrapper for libvirt.lookupByUUID which fixes some problems
|
# This function is a wrapper for libvirt.lookupByUUID which fixes some problems
|
||||||
# 1. Takes a text UUID and handles converting it to bytes
|
# 1. Takes a text UUID and handles converting it to bytes
|
||||||
# 2. Try's it and returns a sensible value if not
|
# 2. Try's it and returns a sensible value if not
|
||||||
|
|
Loading…
Reference in New Issue