Correct actual problem with this_node
This commit is contained in:
parent
d076f9f4eb
commit
080ca3201c
|
@ -417,14 +417,14 @@ def remove_pool(zk_conn, logger, name):
|
||||||
logger.out('Failed to remove RBD pool {}: {}'.format(name, e), state='e')
|
logger.out('Failed to remove RBD pool {}: {}'.format(name, e), state='e')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def run_command(zk_conn, data, d_osd):
|
def run_command(zk_conn, this_node, data, d_osd):
|
||||||
# Get the command and args
|
# Get the command and args
|
||||||
command, args = data.split()
|
command, args = data.split()
|
||||||
|
|
||||||
# Adding a new OSD
|
# Adding a new OSD
|
||||||
if command == 'osd_add':
|
if command == 'osd_add':
|
||||||
node, device, weight = args.split(',')
|
node, device, weight = args.split(',')
|
||||||
if node == self.this_node.name:
|
if node == this_node.name:
|
||||||
# Lock the command queue
|
# Lock the command queue
|
||||||
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
||||||
with zk_lock:
|
with zk_lock:
|
||||||
|
@ -446,7 +446,7 @@ def run_command(zk_conn, data, d_osd):
|
||||||
osd_id = args
|
osd_id = args
|
||||||
|
|
||||||
# Verify osd_id is in the list
|
# Verify osd_id is in the list
|
||||||
if d_osd[osd_id] and d_osd[osd_id].node == self.this_node.name:
|
if d_osd[osd_id] and d_osd[osd_id].node == this_node.name:
|
||||||
# Lock the command queue
|
# Lock the command queue
|
||||||
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
||||||
with zk_lock:
|
with zk_lock:
|
||||||
|
@ -468,7 +468,7 @@ def run_command(zk_conn, data, d_osd):
|
||||||
osd_id = args
|
osd_id = args
|
||||||
|
|
||||||
# Verify osd_id is in the list
|
# Verify osd_id is in the list
|
||||||
if d_osd[osd_id] and d_osd[osd_id].node == self.this_node.name:
|
if d_osd[osd_id] and d_osd[osd_id].node == this_node.name:
|
||||||
# Lock the command queue
|
# Lock the command queue
|
||||||
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
||||||
with zk_lock:
|
with zk_lock:
|
||||||
|
@ -490,7 +490,7 @@ def run_command(zk_conn, data, d_osd):
|
||||||
osd_id = args
|
osd_id = args
|
||||||
|
|
||||||
# Verify osd_id is in the list
|
# Verify osd_id is in the list
|
||||||
if d_osd[osd_id] and d_osd[osd_id].node == self.this_node.name:
|
if d_osd[osd_id] and d_osd[osd_id].node == this_node.name:
|
||||||
# Lock the command queue
|
# Lock the command queue
|
||||||
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
||||||
with zk_lock:
|
with zk_lock:
|
||||||
|
@ -511,7 +511,7 @@ def run_command(zk_conn, data, d_osd):
|
||||||
elif command == 'osd_set':
|
elif command == 'osd_set':
|
||||||
option = args
|
option = args
|
||||||
|
|
||||||
if self.this_node.router_state == 'primary':
|
if this_node.router_state == 'primary':
|
||||||
# Lock the command queue
|
# Lock the command queue
|
||||||
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
||||||
with zk_lock:
|
with zk_lock:
|
||||||
|
@ -532,7 +532,7 @@ def run_command(zk_conn, data, d_osd):
|
||||||
elif command == 'osd_unset':
|
elif command == 'osd_unset':
|
||||||
option = args
|
option = args
|
||||||
|
|
||||||
if self.this_node.router_state == 'primary':
|
if this_node.router_state == 'primary':
|
||||||
# Lock the command queue
|
# Lock the command queue
|
||||||
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
||||||
with zk_lock:
|
with zk_lock:
|
||||||
|
@ -553,7 +553,7 @@ def run_command(zk_conn, data, d_osd):
|
||||||
elif command == 'pool_add':
|
elif command == 'pool_add':
|
||||||
name, pgs = args.split(',')
|
name, pgs = args.split(',')
|
||||||
|
|
||||||
if self.this_node.router_state == 'primary':
|
if this_node.router_state == 'primary':
|
||||||
# Lock the command queue
|
# Lock the command queue
|
||||||
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
||||||
with zk_lock:
|
with zk_lock:
|
||||||
|
@ -574,7 +574,7 @@ def run_command(zk_conn, data, d_osd):
|
||||||
elif command == 'pool_remove':
|
elif command == 'pool_remove':
|
||||||
name = args
|
name = args
|
||||||
|
|
||||||
if self.this_node.router_state == 'primary':
|
if this_node.router_state == 'primary':
|
||||||
# Lock the command queue
|
# Lock the command queue
|
||||||
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
zk_lock = zkhandler.writelock(zk_conn, '/ceph/cmd')
|
||||||
with zk_lock:
|
with zk_lock:
|
||||||
|
|
|
@ -792,7 +792,7 @@ if enable_storage:
|
||||||
@zk_conn.DataWatch('/ceph/cmd')
|
@zk_conn.DataWatch('/ceph/cmd')
|
||||||
def cmd(data, stat, event=''):
|
def cmd(data, stat, event=''):
|
||||||
if data:
|
if data:
|
||||||
CephInstance.run_command(zk_conn, data.decode('ascii'), d_osd)
|
CephInstance.run_command(zk_conn, this_node, data.decode('ascii'), d_osd)
|
||||||
|
|
||||||
# OSD objects
|
# OSD objects
|
||||||
@zk_conn.ChildrenWatch('/ceph/osds')
|
@zk_conn.ChildrenWatch('/ceph/osds')
|
||||||
|
|
Loading…
Reference in New Issue