From 3e655eeab0ab24d45eeb779f4b872d0d8fbc3228 Mon Sep 17 00:00:00 2001 From: Zhongyue Luo <lzyeval@gmail.com> Date: Fri, 10 Feb 2012 02:44:22 -0500 Subject: [PATCH] Backslash continuations (nova.virt.baremetal) Fixes bug #929998 Backslash continuations removal for package nova.virt.baremetal Change-Id: I74beb27b5f5f13fbd6a391a2dc8acf2834846066 --- nova/virt/baremetal/fake.py | 2 +- nova/virt/baremetal/proxy.py | 12 ++++----- nova/virt/baremetal/tilera.py | 46 +++++++++++++++++------------------ 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/nova/virt/baremetal/fake.py b/nova/virt/baremetal/fake.py index c849104b3b..635089366c 100644 --- a/nova/virt/baremetal/fake.py +++ b/nova/virt/baremetal/fake.py @@ -127,7 +127,7 @@ class BareMetalNodes(object): """ pass - def activate_node(self, node_id, node_ip, name, mac_address, \ + def activate_node(self, node_id, node_ip, name, mac_address, ip_address): """ Activates the given node using ID, IP, and MAC address. diff --git a/nova/virt/baremetal/proxy.py b/nova/virt/baremetal/proxy.py index 45142ea443..5b70b6a90a 100644 --- a/nova/virt/baremetal/proxy.py +++ b/nova/virt/baremetal/proxy.py @@ -124,8 +124,8 @@ class ProxyConnection(driver.ComputeDriver): def _map_to_instance_info(self, domain_name): """Gets info from a virsh domain object into an InstanceInfo""" - (state, _max_mem, _mem, _num_cpu, _cpu_time) \ - = self._conn.get_domain_info(domain_name) + _domain_info = self._conn.get_domain_info(domain_name) + state, _max_mem, _mem, _num_cpu, _cpu_time = _domain_info name = domain_name return driver.InstanceInfo(name, state) @@ -544,8 +544,8 @@ class ProxyConnection(driver.ComputeDriver): baremetal error is. """ - (state, max_mem, mem, num_cpu, cpu_time) \ - = self._conn.get_domain_info(instance_name) + _domain_info = self._conn.get_domain_info(instance_name) + state, max_mem, mem, num_cpu, cpu_time = _domain_info return {'state': state, 'max_mem': max_mem, 'mem': mem, @@ -792,8 +792,8 @@ class HostState(object): data["disk_used"] = connection.get_local_gb_used() data["disk_available"] = data["disk_total"] - data["disk_used"] data["host_memory_total"] = connection.get_memory_mb_total() - data["host_memory_free"] = data["host_memory_total"] - \ - connection.get_memory_mb_used() + data["host_memory_free"] = (data["host_memory_total"] - + connection.get_memory_mb_used()) data["hypervisor_type"] = connection.get_hypervisor_type() data["hypervisor_version"] = connection.get_hypervisor_version() self._stats = data diff --git a/nova/virt/baremetal/tilera.py b/nova/virt/baremetal/tilera.py index ee711988b3..d308bba307 100644 --- a/nova/virt/baremetal/tilera.py +++ b/nova/virt/baremetal/tilera.py @@ -202,8 +202,8 @@ class BareMetalNodes(object): pdu_num = 2 pdu_outlet_num = node_id path1 = "10.0.100." + str(pdu_num) - utils.execute('/tftpboot/pdu_mgr', path1, str(pdu_outlet_num), \ - str(mode), '>>', 'pdu_output') + utils.execute('/tftpboot/pdu_mgr', path1, str(pdu_outlet_num), + str(mode), '>>', 'pdu_output') def deactivate_node(self, node_id): """ @@ -213,9 +213,9 @@ class BareMetalNodes(object): and /tftpboot/root_x file is an file system image of node#x. """ node_ip = self.get_ip_by_id(node_id) - LOG.debug(_("deactivate_node is called for \ - node_id = %(id)s node_ip = %(ip)s"), - {'id': str(node_id), 'ip': node_ip}) + LOG.debug(_("deactivate_node is called for " + "node_id = %(id)s node_ip = %(ip)s"), + {'id': str(node_id), 'ip': node_ip}) for item in self.nodes: if item['node_id'] == node_id: LOG.debug(_("status of node is set to 0")) @@ -237,11 +237,11 @@ class BareMetalNodes(object): User can access the bare-metal node using ssh. """ - cmd = FLAGS.tile_monitor + \ - " --resume --net " + node_ip + " --run - " + \ - "ifconfig xgbe0 hw ether " + mac_address + \ - " - --wait --run - ifconfig xgbe0 " + ip_address + \ - " - --wait --quit" + cmd = (FLAGS.tile_monitor + + " --resume --net " + node_ip + " --run - " + + "ifconfig xgbe0 hw ether " + mac_address + + " - --wait --run - ifconfig xgbe0 " + ip_address + + " - --wait --quit") subprocess.Popen(cmd, shell=True) #utils.execute(cmd, shell=True) self.sleep_mgr(5) @@ -263,8 +263,8 @@ class BareMetalNodes(object): """ LOG.debug(_("Before ping to the bare-metal node")) tile_output = "/tftpboot/tile_output_" + str(node_id) - grep_cmd = "ping -c1 " + node_ip + " | grep Unreachable > " \ - + tile_output + grep_cmd = ("ping -c1 " + node_ip + " | grep Unreachable > " + + tile_output) subprocess.Popen(grep_cmd, shell=True) self.sleep_mgr(5) @@ -272,13 +272,13 @@ class BareMetalNodes(object): out_msg = file.readline().find("Unreachable") utils.execute('sudo', 'rm', tile_output) if out_msg == -1: - cmd = "TILERA_BOARD_#" + str(node_id) + " " + node_ip \ - + " is ready" + cmd = ("TILERA_BOARD_#" + str(node_id) + " " + node_ip + + " is ready") LOG.debug(_(cmd)) return True else: - cmd = "TILERA_BOARD_#" + str(node_id) + " " \ - + node_ip + " is not ready, out_msg=" + out_msg + cmd = ("TILERA_BOARD_#" + str(node_id) + " " + + node_ip + " is not ready, out_msg=" + out_msg) LOG.debug(_(cmd)) self.power_mgr(node_id, 2) return False @@ -303,13 +303,13 @@ class BareMetalNodes(object): """ Sets and Runs sshd in the node. """ - cmd = FLAGS.tile_monitor + \ - " --resume --net " + node_ip + " --run - " + \ - "/usr/sbin/sshd - --wait --quit" + cmd = (FLAGS.tile_monitor + + " --resume --net " + node_ip + " --run - " + + "/usr/sbin/sshd - --wait --quit") subprocess.Popen(cmd, shell=True) self.sleep_mgr(5) - def activate_node(self, node_id, node_ip, name, mac_address, \ + def activate_node(self, node_id, node_ip, name, mac_address, ip_address, user_data): """ Activates the given node using ID, IP, and MAC address. @@ -336,9 +336,9 @@ class BareMetalNodes(object): """ node_ip = self.get_ip_by_id(node_id) log_path = "/tftpboot/log_" + str(node_id) - kmsg_cmd = FLAGS.tile_monitor + \ - " --resume --net " + node_ip + \ - " -- dmesg > " + log_path + kmsg_cmd = (FLAGS.tile_monitor + + " --resume --net " + node_ip + + " -- dmesg > " + log_path) subprocess.Popen(kmsg_cmd, shell=True) self.sleep_mgr(5) utils.execute('cp', log_path, console_log)