Fix bugs in command pipeline for VMs
This commit is contained in:
parent
0ff2d7d537
commit
b7546e3711
|
@ -28,9 +28,11 @@ import time
|
||||||
import threading
|
import threading
|
||||||
import libvirt
|
import libvirt
|
||||||
import kazoo.client
|
import kazoo.client
|
||||||
|
import json
|
||||||
|
|
||||||
import pvcd.log as log
|
import pvcd.log as log
|
||||||
import pvcd.zkhandler as zkhandler
|
import pvcd.zkhandler as zkhandler
|
||||||
|
import pvcd.common as common
|
||||||
|
|
||||||
import pvcd.VMConsoleWatcherInstance as VMConsoleWatcherInstance
|
import pvcd.VMConsoleWatcherInstance as VMConsoleWatcherInstance
|
||||||
|
|
||||||
|
@ -51,8 +53,6 @@ def flush_locks(zk_conn, logger, dom_uuid):
|
||||||
logger.out('Failed to parse lock list for volume "{}": {}'.format(rbd, e), state='e')
|
logger.out('Failed to parse lock list for volume "{}": {}'.format(rbd, e), state='e')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
logger.out('Lock list for volume "{}": {}'.format(rbd, lock_list), state='i')
|
|
||||||
|
|
||||||
# If there's at least one lock
|
# If there's at least one lock
|
||||||
if lock_list:
|
if lock_list:
|
||||||
# Loop through the locks
|
# Loop through the locks
|
||||||
|
@ -60,10 +60,12 @@ def flush_locks(zk_conn, logger, dom_uuid):
|
||||||
# Free the lock
|
# Free the lock
|
||||||
lock_remove_retcode, lock_remove_stdout, lock_remove_stderr = common.run_os_command('rbd lock remove {} "{}" "{}"'.format(rbd, lock, detail['locker']))
|
lock_remove_retcode, lock_remove_stdout, lock_remove_stderr = common.run_os_command('rbd lock remove {} "{}" "{}"'.format(rbd, lock, detail['locker']))
|
||||||
if lock_remove_retcode != 0:
|
if lock_remove_retcode != 0:
|
||||||
logger.out('Failed to free RBD lock "{}" on volume "{}"'.format(lock, rbd), state='e')
|
logger.out('Failed to free RBD lock "{}" on volume "{}"\n{}'.format(lock, rbd, lock_remove_stderr), state='e')
|
||||||
continue
|
continue
|
||||||
logger.out('Freed RBD lock "{}" on volume "{}"'.format(lock, rbd), state='o')
|
logger.out('Freed RBD lock "{}" on volume "{}"'.format(lock, rbd), state='o')
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
# Primary command function
|
# Primary command function
|
||||||
def run_command(zk_conn, logger, this_node, data):
|
def run_command(zk_conn, logger, this_node, data):
|
||||||
# Get the command and args
|
# Get the command and args
|
||||||
|
|
Loading…
Reference in New Issue