Allow setting pm_port when importing nodes from a .csv file

This patch is adding support for setting a custom pm_port when importing
the nodes from a .csv file, this is useful for things like VirtualBMC
which shares the same IPMI address but different ports for controlling
the nodes.

Change-Id: I4bbeee7e10bf3b1c82f754d91cc85018a6015098
This commit is contained in:
Lucas Alvares Gomes
2017-02-01 15:08:20 +00:00
parent 8ea289cd39
commit e503fb47c2
2 changed files with 8 additions and 1 deletions

View File

@@ -293,7 +293,7 @@ class TestImportBaremetal(fakes.TestBaremetal):
self.csv_file.write("""\
pxe_ssh,192.168.122.1,stack,"KEY1",00:0b:d0:69:7e:59
pxe_ssh,192.168.122.2,stack,"KEY2",00:0b:d0:69:7e:58""")
pxe_ssh,192.168.122.2,stack,"KEY2",00:0b:d0:69:7e:58,6230""")
self.nodes_list = [{
"pm_user": "stack",
@@ -308,6 +308,7 @@ pxe_ssh,192.168.122.2,stack,"KEY2",00:0b:d0:69:7e:58""")
"pm_addr": "192.168.122.2",
"pm_password": "KEY2",
"pm_type": "pxe_ssh",
"pm_port": "6230",
"mac": [
"00:0b:d0:69:7e:58"
]

View File

@@ -670,6 +670,12 @@ def _csv_to_nodes_dict(nodes_csv):
row[4]
]
}
try:
node['pm_port'] = row[5]
except IndexError:
pass
data.append(node)
return data