Handle issues with state retrieval
This commit is contained in:
parent
938d67f96b
commit
2ac31e0a14
|
@ -800,7 +800,7 @@ def vm_flush_locks(vm):
|
||||||
retflag, retdata = pvc_vm.get_list(zk_conn, None, None, vm, is_fuzzy=False)
|
retflag, retdata = pvc_vm.get_list(zk_conn, None, None, vm, is_fuzzy=False)
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
|
|
||||||
if retdata['state'] not in ['stop', 'disable']:
|
if retdata[0].get('state') not in ['stop', 'disable']:
|
||||||
return {"message": "VM must be stopped to flush locks"}, 400
|
return {"message": "VM must be stopped to flush locks"}, 400
|
||||||
|
|
||||||
zk_conn = pvc_common.startZKConnection(config['coordinators'])
|
zk_conn = pvc_common.startZKConnection(config['coordinators'])
|
||||||
|
|
Loading…
Reference in New Issue