def worker_upgrade_node(q): while True: node = q.get() # copy ivs pkg to node Helper.copy_pkg_scripts_to_remote(node) # deploy node safe_print("Start to deploy %(fqdn)s\n" % {'fqdn': node.fqdn}) start_time = datetime.datetime.now() Helper.run_command_on_remote(node, (r'''sudo bash %(dst_dir)s/%(hostname)s_upgrade.sh''' % {'dst_dir': node.dst_dir, 'hostname': node.hostname, 'log': node.log})) end_time = datetime.datetime.now() # parse setup log diff = Helper.timedelta_total_seconds(end_time - start_time) node.set_time_diff(diff) node = Helper.update_last_log(node) node_dict[node.fqdn] = node time_dict[node.fqdn] = diff safe_print("Finish upgrading %(fqdn)s, cost time: %(diff).2f\n" % {'fqdn': node.fqdn, 'diff': node.time_diff}) q.task_done()
def worker_setup_node(q): while True: node = q.get() # copy ivs pkg to node Helper.copy_pkg_scripts_to_remote(node) # deploy node safe_print("Start to deploy %(fqdn)s\n" % {'fqdn': node.fqdn}) if node.cleanup and node.role == const.ROLE_NEUTRON_SERVER: Helper.run_command_on_remote( node, (r'''sudo bash %(dst_dir)s/%(hostname)s_ospurge.sh''' % { 'dst_dir': node.dst_dir, 'hostname': node.hostname, 'log': node.log })) # a random delay to smooth apt-get/yum delay = random.random() * 10.0 time.sleep(delay) start_time = datetime.datetime.now() Helper.run_command_on_remote( node, (r'''sudo bash %(dst_dir)s/%(hostname)s.sh''' % { 'dst_dir': node.dst_dir, 'hostname': node.hostname, 'log': node.log })) end_time = datetime.datetime.now() # parse setup log diff = Helper.timedelta_total_seconds(end_time - start_time) node.set_time_diff(diff) node = Helper.update_last_log(node) node_dict[node.fqdn] = node time_dict[node.fqdn] = diff # when deploying T5 on UBUNTU, reboot compute nodes Helper.reboot_if_necessary(node) safe_print("Finish deploying %(fqdn)s, cost time: %(diff).2f\n" % { 'fqdn': node.fqdn, 'diff': node.time_diff }) q.task_done()
def worker_upgrade_or_sriov_node(q): while True: node = q.get() # copy ivs pkg to node Helper.copy_pkg_scripts_to_remote(node) # deploy node safe_print("Start to deploy %(fqdn)s\n" % {'fqdn': node.fqdn}) start_time = datetime.datetime.now() if node.role == const.ROLE_SRIOV: Helper.run_command_on_remote(node, (r'''sudo bash %(dst_dir)s/%(hostname)s_sriov.sh''' % {'dst_dir': node.dst_dir, 'hostname': node.hostname, 'log': node.log})) elif node.role in const.DPDK_ROLES: Helper.run_command_on_remote(node, (r'''sudo bash %(dst_dir)s/%(hostname)s_dpdk.sh''' % {'dst_dir': node.dst_dir, 'hostname': node.hostname, 'log': node.log})) else: Helper.run_command_on_remote(node, (r'''sudo bash %(dst_dir)s/%(hostname)s_upgrade.sh''' % {'dst_dir': node.dst_dir, 'hostname': node.hostname, 'log': node.log})) end_time = datetime.datetime.now() # parse setup log diff = Helper.timedelta_total_seconds(end_time - start_time) node.set_time_diff(diff) node = Helper.update_last_log(node) node_dict[node.fqdn] = node time_dict[node.fqdn] = diff safe_print("Finish executing script for node %(fqdn)s, " "cost time: %(diff).2f\n" % {'fqdn': node.fqdn, 'diff': node.time_diff}) q.task_done()
def worker_setup_node(q): while True: node = q.get() # copy ivs pkg to node Helper.copy_pkg_scripts_to_remote(node) # deploy node safe_print("Start to deploy %(fqdn)s\n" % {'fqdn': node.fqdn}) if node.cleanup and node.role == const.ROLE_NEUTRON_SERVER: Helper.run_command_on_remote(node, (r'''sudo bash %(dst_dir)s/%(hostname)s_ospurge.sh''' % {'dst_dir': node.dst_dir, 'hostname': node.hostname, 'log': node.log})) # a random delay to smooth apt-get/yum delay = random.random() * 10.0 time.sleep(delay) start_time = datetime.datetime.now() Helper.run_command_on_remote(node, (r'''sudo bash %(dst_dir)s/%(hostname)s.sh''' % {'dst_dir': node.dst_dir, 'hostname': node.hostname, 'log': node.log})) end_time = datetime.datetime.now() # parse setup log diff = Helper.timedelta_total_seconds(end_time - start_time) node.set_time_diff(diff) node = Helper.update_last_log(node) node_dict[node.fqdn] = node time_dict[node.fqdn] = diff # when deploying T5 on UBUNTU, reboot compute nodes Helper.reboot_if_necessary(node) safe_print("Finish deploying %(fqdn)s, cost time: %(diff).2f\n" % {'fqdn': node.fqdn, 'diff': node.time_diff}) q.task_done()