Skip to content

Commit

Permalink
Backslash continuations (nova.virt.baremetal)
Browse files Browse the repository at this point in the history
Fixes bug #929998

Backslash continuations removal for package nova.virt.baremetal

Change-Id: I74beb27b5f5f13fbd6a391a2dc8acf2834846066
  • Loading branch information
Zhongyue Luo committed Feb 10, 2012
1 parent 5ad9718 commit 8dabc7b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion nova/virt/baremetal/fake.py
Expand Up @@ -127,7 +127,7 @@ def ssh_set(self, node_ip):
"""
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.
Expand Down
12 changes: 6 additions & 6 deletions nova/virt/baremetal/proxy.py
Expand Up @@ -124,8 +124,8 @@ def list_instances(self):

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)

Expand Down Expand Up @@ -544,8 +544,8 @@ def get_info(self, instance_name):
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,
Expand Down Expand Up @@ -792,8 +792,8 @@ def update_status(self):
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
46 changes: 23 additions & 23 deletions nova/virt/baremetal/tilera.py
Expand Up @@ -202,8 +202,8 @@ def power_mgr(self, node_id, mode):
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):
"""
Expand All @@ -213,9 +213,9 @@ def deactivate_node(self, node_id):
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"))
Expand All @@ -237,11 +237,11 @@ def network_set(self, node_ip, mac_address, ip_address):
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)
Expand All @@ -263,22 +263,22 @@ def check_activated(self, node_id, node_ip):
"""
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)

file = open(tile_output, "r")
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
Expand All @@ -303,13 +303,13 @@ def ssh_set(self, node_ip):
"""
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.
Expand All @@ -336,9 +336,9 @@ def get_console_output(self, console_log, node_id):
"""
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)
Expand Down

0 comments on commit 8dabc7b

Please sign in to comment.