parent
4868625809
commit
cae0de6c0f
|
@ -483,7 +483,7 @@ def update_vm_meta(vm, limit, selector, autostart):
|
||||||
Update metadata of a VM.
|
Update metadata of a VM.
|
||||||
"""
|
"""
|
||||||
zk_conn = pvc_common.startZKConnection(config['coordinators'])
|
zk_conn = pvc_common.startZKConnection(config['coordinators'])
|
||||||
retflag, retdata = pvc_vm.modify_vm_metadata(zk_conn, vm, limit, selector, strtobool(autostart))
|
retflag, retdata = pvc_vm.modify_vm_metadata(zk_conn, vm, limit, selector, bool(strtobool(autostart)))
|
||||||
pvc_common.stopZKConnection(zk_conn)
|
pvc_common.stopZKConnection(zk_conn)
|
||||||
|
|
||||||
if retflag:
|
if retflag:
|
||||||
|
@ -791,7 +791,7 @@ def net_modify(vni, description, domain, name_servers,
|
||||||
"""
|
"""
|
||||||
Modify a virtual client network in the PVC cluster.
|
Modify a virtual client network in the PVC cluster.
|
||||||
"""
|
"""
|
||||||
if dhcp4_flag:
|
if dhcp4_flag is not None:
|
||||||
dhcp4_flag = bool(strtobool(dhcp4_flag))
|
dhcp4_flag = bool(strtobool(dhcp4_flag))
|
||||||
zk_conn = pvc_common.startZKConnection(config['coordinators'])
|
zk_conn = pvc_common.startZKConnection(config['coordinators'])
|
||||||
retflag, retdata = pvc_network.modify_network(zk_conn, vni, description, domain, name_servers,
|
retflag, retdata = pvc_network.modify_network(zk_conn, vni, description, domain, name_servers,
|
||||||
|
|
|
@ -710,9 +710,9 @@ class API_Node_DomainState(Resource):
|
||||||
id: Message
|
id: Message
|
||||||
"""
|
"""
|
||||||
if reqargs['state'] == 'flush':
|
if reqargs['state'] == 'flush':
|
||||||
return api_helper.node_flush(node, strtobool(reqargs.get('wait', 'false')))
|
return api_helper.node_flush(node, bool(strtobool(reqargs.get('wait', 'false'))))
|
||||||
if reqargs['state'] == 'ready':
|
if reqargs['state'] == 'ready':
|
||||||
return api_helper.node_ready(node, strtobool(reqargs.get('wait', 'false')))
|
return api_helper.node_ready(node, bool(strtobool(reqargs.get('wait', 'false'))))
|
||||||
abort(400)
|
abort(400)
|
||||||
api.add_resource(API_Node_DomainState, '/node/<node>/domain-state')
|
api.add_resource(API_Node_DomainState, '/node/<node>/domain-state')
|
||||||
|
|
||||||
|
@ -951,7 +951,7 @@ class API_VM_Root(Resource):
|
||||||
reqargs.get('node', None),
|
reqargs.get('node', None),
|
||||||
reqargs.get('limit', None),
|
reqargs.get('limit', None),
|
||||||
reqargs.get('selector', 'mem'),
|
reqargs.get('selector', 'mem'),
|
||||||
reqargs.get('autostart', False)
|
bool(strtobool(reqargs.get('autostart', 'false')))
|
||||||
)
|
)
|
||||||
api.add_resource(API_VM_Root, '/vm')
|
api.add_resource(API_VM_Root, '/vm')
|
||||||
|
|
||||||
|
@ -1042,7 +1042,7 @@ class API_VM_Element(Resource):
|
||||||
reqargs.get('node', None),
|
reqargs.get('node', None),
|
||||||
reqargs.get('limit', None),
|
reqargs.get('limit', None),
|
||||||
reqargs.get('selector', 'mem'),
|
reqargs.get('selector', 'mem'),
|
||||||
reqargs.get('autostart', False)
|
bool(strtobool(reqargs.get('autostart', 'false')))
|
||||||
)
|
)
|
||||||
|
|
||||||
@RequestParser([
|
@RequestParser([
|
||||||
|
@ -1080,7 +1080,7 @@ class API_VM_Element(Resource):
|
||||||
"""
|
"""
|
||||||
return api_helper.vm_modify(
|
return api_helper.vm_modify(
|
||||||
vm,
|
vm,
|
||||||
reqargs.get('restart', False),
|
bool(strtobool(reqargs.get('restart', 'false'))),
|
||||||
reqargs.get('xml', None)
|
reqargs.get('xml', None)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1117,7 +1117,7 @@ class API_VM_Element(Resource):
|
||||||
type: object
|
type: object
|
||||||
id: Message
|
id: Message
|
||||||
"""
|
"""
|
||||||
if reqargs.get('delete_disks', False):
|
if bool(strtobool(reqargs.get('delete_disks', 'false'))):
|
||||||
return api_helper.vm_remove(vm)
|
return api_helper.vm_remove(vm)
|
||||||
else:
|
else:
|
||||||
return api_helper.vm_undefine(vm)
|
return api_helper.vm_undefine(vm)
|
||||||
|
@ -1370,7 +1370,7 @@ class API_VM_Node(Resource):
|
||||||
"""
|
"""
|
||||||
action = reqargs.get('action', None)
|
action = reqargs.get('action', None)
|
||||||
node = reqargs.get('node', None)
|
node = reqargs.get('node', None)
|
||||||
force = reqargs.get('force', False)
|
force = bool(strtobool(reqargs.get('force', 'false')))
|
||||||
|
|
||||||
if action == 'move':
|
if action == 'move':
|
||||||
return api_helper.vm_move(vm, node)
|
return api_helper.vm_move(vm, node)
|
||||||
|
@ -1640,7 +1640,7 @@ class API_Network_Root(Resource):
|
||||||
reqargs.get('ip4_gateway', None),
|
reqargs.get('ip4_gateway', None),
|
||||||
reqargs.get('ip6_network', None),
|
reqargs.get('ip6_network', None),
|
||||||
reqargs.get('ip6_gateway', None),
|
reqargs.get('ip6_gateway', None),
|
||||||
reqargs.get('dhcp4', None),
|
bool(strtobool(reqargs.get('dhcp4', 'false'))),
|
||||||
reqargs.get('dhcp4_start', None),
|
reqargs.get('dhcp4_start', None),
|
||||||
reqargs.get('dhcp4_end', None),
|
reqargs.get('dhcp4_end', None),
|
||||||
)
|
)
|
||||||
|
@ -1764,7 +1764,7 @@ class API_Network_Element(Resource):
|
||||||
reqargs.get('ip4_gateway', None),
|
reqargs.get('ip4_gateway', None),
|
||||||
reqargs.get('ip6_network', None),
|
reqargs.get('ip6_network', None),
|
||||||
reqargs.get('ip6_gateway', None),
|
reqargs.get('ip6_gateway', None),
|
||||||
reqargs.get('dhcp4', None),
|
bool(strtobool(reqargs.get('dhcp4', 'false'))),
|
||||||
reqargs.get('dhcp4_start', None),
|
reqargs.get('dhcp4_start', None),
|
||||||
reqargs.get('dhcp4_end', None),
|
reqargs.get('dhcp4_end', None),
|
||||||
)
|
)
|
||||||
|
@ -1955,7 +1955,7 @@ class API_Network_Lease_Root(Resource):
|
||||||
return api_helper.net_dhcp_list(
|
return api_helper.net_dhcp_list(
|
||||||
vni,
|
vni,
|
||||||
reqargs.get('limit', None),
|
reqargs.get('limit', None),
|
||||||
reqargs.get('static', False)
|
bool(strtobool(reqargs.get('static', 'false')))
|
||||||
)
|
)
|
||||||
|
|
||||||
@RequestParser([
|
@RequestParser([
|
||||||
|
@ -3784,17 +3784,17 @@ class API_Provisioner_Template_System_Root(Resource):
|
||||||
except:
|
except:
|
||||||
return { "message": "A vram value must be an integer" }, 400
|
return { "message": "A vram value must be an integer" }, 400
|
||||||
# Cast boolean arguments
|
# Cast boolean arguments
|
||||||
if bool(strtobool(reqargs.get('serial', False))):
|
if bool(strtobool(reqargs.get('serial', 'false'))):
|
||||||
serial = True
|
serial = True
|
||||||
else:
|
else:
|
||||||
serial = False
|
serial = False
|
||||||
if bool(strtobool(reqargs.get('vnc', False))):
|
if bool(strtobool(reqargs.get('vnc', 'false'))):
|
||||||
vnc = True
|
vnc = True
|
||||||
vnc_bind = reqargs.get('vnc_bind', None)
|
vnc_bind = reqargs.get('vnc_bind', None)
|
||||||
else:
|
else:
|
||||||
vnc = False
|
vnc = False
|
||||||
vnc_bind = None
|
vnc_bind = None
|
||||||
if reqargs.get('node_autostart', None) and bool(strtobool(reqargs.get('node_autostart', False))):
|
if reqargs.get('node_autostart', None) and bool(strtobool(reqargs.get('node_autostart', 'false'))):
|
||||||
node_autostart = True
|
node_autostart = True
|
||||||
else:
|
else:
|
||||||
node_autostart = False
|
node_autostart = False
|
||||||
|
@ -5488,12 +5488,12 @@ class API_Provisioner_Create_Root(Resource):
|
||||||
if code != 200:
|
if code != 200:
|
||||||
return { 'message': 'Profile "{}" is not valid.'.format(reqargs.get('profile')) }, 400
|
return { 'message': 'Profile "{}" is not valid.'.format(reqargs.get('profile')) }, 400
|
||||||
|
|
||||||
if strtobool(reqargs.get('define_vm', 'True')):
|
if bool(strtobool(reqargs.get('define_vm', 'true'))):
|
||||||
define_vm = True
|
define_vm = True
|
||||||
else:
|
else:
|
||||||
define_vm = False
|
define_vm = False
|
||||||
|
|
||||||
if strtobool(reqargs.get('start_vm', 'True')):
|
if bool(strtobool(reqargs.get('start_vm', 'true'))):
|
||||||
start_vm = True
|
start_vm = True
|
||||||
else:
|
else:
|
||||||
start_vm = False
|
start_vm = False
|
||||||
|
|
Loading…
Reference in New Issue