Use coordinators list like node daemon

This commit is contained in:
Joshua Boniface 2019-07-06 02:35:37 -04:00
parent e6012965f1
commit 837b47c366
3 changed files with 51 additions and 50 deletions

View File

@ -36,7 +36,7 @@ def node_list(limit=None):
""" """
Return a list of nodes with limit LIMIT. Return a list of nodes with limit LIMIT.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_node.get_list(zk_conn, limit) retflag, retdata = pvc_node.get_list(zk_conn, limit)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -50,7 +50,7 @@ def node_secondary(node):
""" """
Take NODE out of primary router mode. Take NODE out of primary router mode.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_node.secondary_node(zk_conn, node) retflag, retmsg = pvc_node.secondary_node(zk_conn, node)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -67,7 +67,7 @@ def node_primary(node):
""" """
Set NODE to primary router mode. Set NODE to primary router mode.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_node.primary_node(zk_conn, node) retflag, retmsg = pvc_node.primary_node(zk_conn, node)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -84,7 +84,7 @@ def node_flush(node):
""" """
Flush NODE of running VMs. Flush NODE of running VMs.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_node.flush_node(zk_conn, node, False) retflag, retmsg = pvc_node.flush_node(zk_conn, node, False)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -101,7 +101,7 @@ def node_ready(node):
""" """
Restore NODE to active service. Restore NODE to active service.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_node.ready_node(zk_conn, node) retflag, retmsg = pvc_node.ready_node(zk_conn, node)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -121,7 +121,7 @@ def vm_list(node=None, state=None, limit=None, is_fuzzy=True):
""" """
Return a list of VMs with limit LIMIT. Return a list of VMs with limit LIMIT.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_vm.get_list(zk_conn, node, state, limit, is_fuzzy) retflag, retdata = pvc_vm.get_list(zk_conn, node, state, limit, is_fuzzy)
if retflag: if retflag:
if retdata: if retdata:
@ -148,7 +148,7 @@ def vm_define(name, xml, node, selector):
""" """
Define a VM from Libvirt XML in the PVC cluster. Define a VM from Libvirt XML in the PVC cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_vm.define_vm(zk_conn, xml, node, selector) retflag, retmsg = pvc_vm.define_vm(zk_conn, xml, node, selector)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -165,7 +165,7 @@ def vm_modify(name, restart, xml):
""" """
Modify a VM Libvirt XML in the PVC cluster. Modify a VM Libvirt XML in the PVC cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_vm.modify_vm(zk_conn, name, restart, xml) retflag, retmsg = pvc_vm.modify_vm(zk_conn, name, restart, xml)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -182,7 +182,7 @@ def vm_undefine(name):
""" """
Undefine a VM from the PVC cluster. Undefine a VM from the PVC cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_vm.undefine_vm(zk_conn, name) retflag, retmsg = pvc_vm.undefine_vm(zk_conn, name)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -199,7 +199,7 @@ def vm_remove(name):
""" """
Remove a VM from the PVC cluster. Remove a VM from the PVC cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_vm.remove_vm(zk_conn, name) retflag, retmsg = pvc_vm.remove_vm(zk_conn, name)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -216,7 +216,7 @@ def vm_dump(name):
""" """
Dump a VM Libvirt XML configuration. Dump a VM Libvirt XML configuration.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_vm.dump_vm(zk_conn, name) retflag, retdata = pvc_vm.dump_vm(zk_conn, name)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -230,7 +230,7 @@ def vm_start(name):
""" """
Start a VM in the PVC cluster. Start a VM in the PVC cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_vm.start_vm(zk_conn, name) retflag, retmsg = pvc_vm.start_vm(zk_conn, name)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -247,7 +247,7 @@ def vm_restart(name):
""" """
Restart a VM in the PVC cluster. Restart a VM in the PVC cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_vm.restart_vm(zk_conn, name) retflag, retmsg = pvc_vm.restart_vm(zk_conn, name)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -264,7 +264,7 @@ def vm_shutdown(name):
""" """
Shutdown a VM in the PVC cluster. Shutdown a VM in the PVC cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_vm.shutdown_vm(zk_conn, name) retflag, retmsg = pvc_vm.shutdown_vm(zk_conn, name)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -281,7 +281,7 @@ def vm_stop(name):
""" """
Forcibly stop a VM in the PVC cluster. Forcibly stop a VM in the PVC cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_vm.stop_vm(zk_conn, name) retflag, retmsg = pvc_vm.stop_vm(zk_conn, name)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -298,7 +298,7 @@ def vm_move(name, node, selector):
""" """
Move a VM to another node. Move a VM to another node.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_vm.move_vm(zk_conn, name, node, selector) retflag, retmsg = pvc_vm.move_vm(zk_conn, name, node, selector)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -315,7 +315,7 @@ def vm_migrate(name, node, selector, flag_force):
""" """
Temporarily migrate a VM to another node. Temporarily migrate a VM to another node.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_vm.migrate_vm(zk_conn, name, node, selector, flag_force) retflag, retmsg = pvc_vm.migrate_vm(zk_conn, name, node, selector, flag_force)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -332,7 +332,7 @@ def vm_unmigrate(name):
""" """
Unmigrate a migrated VM. Unmigrate a migrated VM.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_vm.unmigrate_vm(zk_conn, name) retflag, retmsg = pvc_vm.unmigrate_vm(zk_conn, name)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -352,7 +352,7 @@ def net_list(limit=None):
""" """
Return a list of client networks with limit LIMIT. Return a list of client networks with limit LIMIT.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_network.get_list(zk_conn, limit) retflag, retdata = pvc_network.get_list(zk_conn, limit)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -368,7 +368,7 @@ def net_add(vni, description, nettype, domain,
""" """
Add a virtual client network to the PVC cluster. Add a virtual client network to the PVC cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_network.add_network(zk_conn, vni, description, nettype, domain, retflag, retmsg = pvc_network.add_network(zk_conn, vni, description, nettype, domain,
ip4_network, ip4_gateway, ip6_network, ip6_gateway, ip4_network, ip4_gateway, ip6_network, ip6_gateway,
dhcp4_flag, dhcp4_start, dhcp4_end) dhcp4_flag, dhcp4_start, dhcp4_end)
@ -389,7 +389,7 @@ def net_modify(vni, description, nettype, domain,
""" """
Modify a virtual client network in the PVC cluster. Modify a virtual client network in the PVC cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_network.add_network(zk_conn, vni, description, nettype, domain, retflag, retmsg = pvc_network.add_network(zk_conn, vni, description, nettype, domain,
ip4_network, ip4_gateway, ip6_network, ip6_gateway, ip4_network, ip4_gateway, ip6_network, ip6_gateway,
dhcp4_flag, dhcp4_start, dhcp4_end) dhcp4_flag, dhcp4_start, dhcp4_end)
@ -408,7 +408,7 @@ def net_remove(description):
""" """
Remove a virtual client network from the PVC cluster. Remove a virtual client network from the PVC cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_network.remove_network(zk_conn, description) retflag, retmsg = pvc_network.remove_network(zk_conn, description)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -425,7 +425,7 @@ def net_dhcp_list(network, limit=None, static=False):
""" """
Return a list of DHCP leases in network NETWORK with limit LIMIT. Return a list of DHCP leases in network NETWORK with limit LIMIT.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_network.get_list_dhcp(zk_conn, network, limit, static) retflag, retdata = pvc_network.get_list_dhcp(zk_conn, network, limit, static)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -439,7 +439,7 @@ def net_dhcp_add(network, ipaddress, macaddress, hostname):
""" """
Add a static DHCP lease to a virtual client network. Add a static DHCP lease to a virtual client network.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_network.add_dhcp_reservation(zk_conn, network, ipaddress, macaddress, hostname) retflag, retmsg = pvc_network.add_dhcp_reservation(zk_conn, network, ipaddress, macaddress, hostname)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -456,7 +456,7 @@ def net_dhcp_remove(network, macaddress):
""" """
Remove a static DHCP lease from a virtual client network. Remove a static DHCP lease from a virtual client network.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_network.remove_dhcp_reservation(zk_conn, network, macaddress) retflag, retmsg = pvc_network.remove_dhcp_reservation(zk_conn, network, macaddress)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -473,7 +473,7 @@ def net_acl_list(network, limit=None, direction=None):
""" """
Return a list of network ACLs in network NETWORK with limit LIMIT. Return a list of network ACLs in network NETWORK with limit LIMIT.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_network.get_list_acl(zk_conn, network, limit, direction) retflag, retmsg = pvc_network.get_list_acl(zk_conn, network, limit, direction)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -490,7 +490,7 @@ def net_acl_add(network, direction, description, rule, order):
""" """
Add an ACL to a virtual client network. Add an ACL to a virtual client network.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_network.add_acl(zk_conn, network, direction, description, rule, order) retflag, retmsg = pvc_network.add_acl(zk_conn, network, direction, description, rule, order)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -507,7 +507,7 @@ def net_acl_remove(network, direction, description):
""" """
Remove an ACL from a virtual client network. Remove an ACL from a virtual client network.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_network.remove_acl(zk_conn, network, description, direction) retflag, retmsg = pvc_network.remove_acl(zk_conn, network, description, direction)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -527,7 +527,7 @@ def ceph_status():
""" """
Get the current Ceph cluster status. Get the current Ceph cluster status.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_ceph.get_status(zk_conn) retflag, retdata = pvc_ceph.get_status(zk_conn)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -541,7 +541,7 @@ def ceph_osd_list(limit=None):
""" """
Get the list of OSDs in the Ceph storage cluster. Get the list of OSDs in the Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_ceph.get_list_osd(zk_conn, limit) retflag, retdata = pvc_ceph.get_list_osd(zk_conn, limit)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -555,7 +555,7 @@ def ceph_osd_add(node, device, weight):
""" """
Add a Ceph OSD to the PVC Ceph storage cluster. Add a Ceph OSD to the PVC Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_ceph.add_osd(zk_conn, node, device, weight) retflag, retmsg = pvc_ceph.add_osd(zk_conn, node, device, weight)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -572,7 +572,7 @@ def ceph_osd_remove(osd_id):
""" """
Remove a Ceph OSD from the PVC Ceph storage cluster. Remove a Ceph OSD from the PVC Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_ceph.remove_osd(zk_conn, osd_id) retflag, retmsg = pvc_ceph.remove_osd(zk_conn, osd_id)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -589,7 +589,7 @@ def ceph_osd_in(osd_id):
""" """
Set in a Ceph OSD in the PVC Ceph storage cluster. Set in a Ceph OSD in the PVC Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_ceph.in_osd(zk_conn, osd_id) retflag, retmsg = pvc_ceph.in_osd(zk_conn, osd_id)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -606,7 +606,7 @@ def ceph_osd_out(osd_id):
""" """
Set out a Ceph OSD in the PVC Ceph storage cluster. Set out a Ceph OSD in the PVC Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_ceph.out_osd(zk_conn, osd_id) retflag, retmsg = pvc_ceph.out_osd(zk_conn, osd_id)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -623,7 +623,7 @@ def ceph_osd_set(option):
""" """
Set options on a Ceph OSD in the PVC Ceph storage cluster. Set options on a Ceph OSD in the PVC Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_ceph.set_osd(zk_conn, option) retflag, retmsg = pvc_ceph.set_osd(zk_conn, option)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -640,7 +640,7 @@ def ceph_osd_unset(option):
""" """
Unset options on a Ceph OSD in the PVC Ceph storage cluster. Unset options on a Ceph OSD in the PVC Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_ceph.unset_osd(zk_conn, option) retflag, retmsg = pvc_ceph.unset_osd(zk_conn, option)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -657,7 +657,7 @@ def ceph_pool_list(limit=None):
""" """
Get the list of RBD pools in the Ceph storage cluster. Get the list of RBD pools in the Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_ceph.get_list_pool(zk_conn, limit) retflag, retdata = pvc_ceph.get_list_pool(zk_conn, limit)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -671,7 +671,7 @@ def ceph_pool_add(name, pgs):
""" """
Add a Ceph RBD pool to the PVC Ceph storage cluster. Add a Ceph RBD pool to the PVC Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_ceph.add_pool(zk_conn, name, pgs) retflag, retmsg = pvc_ceph.add_pool(zk_conn, name, pgs)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -688,7 +688,7 @@ def ceph_pool_remove(name):
""" """
Remove a Ceph RBD pool to the PVC Ceph storage cluster. Remove a Ceph RBD pool to the PVC Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_ceph.remove_pool(zk_conn, name) retflag, retmsg = pvc_ceph.remove_pool(zk_conn, name)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -705,7 +705,7 @@ def ceph_volume_list(pool=None, limit=None):
""" """
Get the list of RBD volumes in the Ceph storage cluster. Get the list of RBD volumes in the Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_ceph.get_list_volume(zk_conn, pool, limit) retflag, retdata = pvc_ceph.get_list_volume(zk_conn, pool, limit)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -719,7 +719,7 @@ def ceph_volume_add(pool, name, size):
""" """
Add a Ceph RBD volume to the PVC Ceph storage cluster. Add a Ceph RBD volume to the PVC Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_ceph.add_volume(zk_conn, pool, name, size) retflag, retmsg = pvc_ceph.add_volume(zk_conn, pool, name, size)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -736,7 +736,7 @@ def ceph_volume_remove(pool, name):
""" """
Remove a Ceph RBD volume to the PVC Ceph storage cluster. Remove a Ceph RBD volume to the PVC Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_ceph.remove_volume(zk_conn, pool, name) retflag, retmsg = pvc_ceph.remove_volume(zk_conn, pool, name)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -753,7 +753,7 @@ def ceph_volume_snapshot_list(pool=None, volume=None, limit=None):
""" """
Get the list of RBD volume snapshots in the Ceph storage cluster. Get the list of RBD volume snapshots in the Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_ceph.get_list_snapshot(zk_conn, pool, volume, limit) retflag, retdata = pvc_ceph.get_list_snapshot(zk_conn, pool, volume, limit)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -768,7 +768,7 @@ def ceph_volume_snapshot_add(pool, volume, name):
Add a Ceph RBD volume snapshot to the PVC Ceph storage cluster. Add a Ceph RBD volume snapshot to the PVC Ceph storage cluster.
""" """
return '', 200 return '', 200
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_ceph.add_snapshot(zk_conn, pool, volume, name) retflag, retmsg = pvc_ceph.add_snapshot(zk_conn, pool, volume, name)
if retflag: if retflag:
retcode = 200 retcode = 200
@ -785,7 +785,7 @@ def ceph_volume_snapshot_remove(pool, volume, name):
""" """
Remove a Ceph RBD volume snapshot from the PVC Ceph storage cluster. Remove a Ceph RBD volume snapshot from the PVC Ceph storage cluster.
""" """
zk_conn = pvc_common.startZKConnection(config['zookeeper_uri']) zk_conn = pvc_common.startZKConnection(config['coordinators'])
retflag, retmsg = pvc_ceph.remove_snapshot(zk_conn, pool, volume, name) retflag, retmsg = pvc_ceph.remove_snapshot(zk_conn, pool, volume, name)
if retflag: if retflag:
retcode = 200 retcode = 200

View File

@ -50,7 +50,7 @@ except Exception as e:
try: try:
# Create the config object # Create the config object
config = { config = {
'zookeeper_uri': o_config['pvc']['zookeeper']['uri'], 'coordinators': o_config['pvc']['coordinators'],
'listen_address': o_config['pvc']['api']['listen_address'], 'listen_address': o_config['pvc']['api']['listen_address'],
'listen_port': int(o_config['pvc']['api']['listen_port']), 'listen_port': int(o_config['pvc']['api']['listen_port']),
'authentication_key': o_config['pvc']['api']['authentication']['key'] 'authentication_key': o_config['pvc']['api']['authentication']['key']

View File

@ -8,10 +8,11 @@
# Copy this example to /etc/pvc/pvc-api.conf and edit to your needs # Copy this example to /etc/pvc/pvc-api.conf and edit to your needs
pvc: pvc:
# zookeeper: Configuration of the zookeeper connection # coordinators: The list of cluster coordinator hostnames
zookeeper: coordinators:
# uri: Zookeeper URI specifying the PVCD coordinators to connect to - pvc-hv1
uri: "pvchv1:2181,pvchv2:2181,pvchv3:2181" - pvc-hv2
- pvc-hv3
# api: Configuration of the API listener # api: Configuration of the API listener
api: api:
# listen_address: IP address(es) to listen on; use 0.0.0.0 for all interfaces # listen_address: IP address(es) to listen on; use 0.0.0.0 for all interfaces