Fix indentation problem in scheduler.solvers.utils

This fixes an indentation mistake.

Change-Id: I7ae220f0a93c39e05b6b63cc0fb5fbfc4f0263c0
This commit is contained in:
Xinyuan Huang 2015-07-31 17:14:27 +08:00
parent ea6bbd10b8
commit 78d9a7f643
1 changed files with 36 additions and 36 deletions

View File

@ -47,46 +47,46 @@ LOG = logging.getLogger(__name__)
def get_host_racks_config():
"""Read the rack config file to get physical rack configurations."""
# Example section in the file:
# [ml2_mech_cisco_nexus:1.1.1.1]
# compute1=1/1
# compute2=1/2
# ...
"""Read the rack config file to get physical rack configurations."""
# Example section in the file:
# [ml2_mech_cisco_nexus:1.1.1.1]
# compute1=1/1
# compute2=1/2
# ...
host_racks_map = {}
sections = {}
filepath = CONF.rack_config
if not filepath:
return host_racks_map
if not os.path.exists(filepath):
LOG.error(_LE("The rack config file is not found: %s"), filepath)
return host_racks_map
prefix = CONF.rack_config_prefix
if not prefix:
LOG.error(_LE("Rack config prefix is not set."))
return host_racks_map
try:
rack_config_parser = cfg.ConfigParser(filepath, sections)
rack_config_parser.parse()
for section_name in sections.keys():
if section_name.startswith(prefix):
# section_name: rack id
for key, value in sections[section_name].items():
# key: host name, value: port id
host_racks_map.setdefault(key, set([]))
host_racks_map[key].add(section_name)
except Exception as e:
LOG.error(_LE("The rack config file is not parsed properly: %s"),
str(e))
host_racks_map = {}
sections = {}
filepath = CONF.rack_config
if not filepath:
return host_racks_map
if not os.path.exists(filepath):
LOG.error(_LE("The rack config file is not found: %s"), filepath)
return host_racks_map
prefix = CONF.rack_config_prefix
if not prefix:
LOG.error(_LE("Rack config prefix is not set."))
return host_racks_map
try:
rack_config_parser = cfg.ConfigParser(filepath, sections)
rack_config_parser.parse()
for section_name in sections.keys():
if section_name.startswith(prefix):
# section_name: rack id
for key, value in sections[section_name].items():
# key: host name, value: port id
host_racks_map.setdefault(key, set([]))
host_racks_map[key].add(section_name)
except Exception as e:
LOG.error(_LE("The rack config file is not parsed properly: %s"),
str(e))
return host_racks_map
def get_host_racks_map(hosts):
"""Return a dict where keys are host names and values are names of racks