Prefix volume names with node name
Each volume needs its own volume, so to ensure separate volumes are created for every node, give each volume a unique name comprising the parent node's name and the volume's index within the node's volume list.
This commit is contained in:
parent
157d433bde
commit
1f4127c184
@ -173,6 +173,11 @@ class ActionModule(ActionBase):
|
|||||||
hostname, idx = scheduler.choose_host(node)
|
hostname, idx = scheduler.choose_host(node)
|
||||||
# Set node name based on its index.
|
# Set node name based on its index.
|
||||||
node['name'] = "%s%d" % (self.args['node_name_prefix'], idx)
|
node['name'] = "%s%d" % (self.args['node_name_prefix'], idx)
|
||||||
|
# Sequentially number the volume names.
|
||||||
|
for vol_idx, vol in enumerate(node['volumes']):
|
||||||
|
vol['name'] = ("%s%s%d"
|
||||||
|
% (node['name'],
|
||||||
|
self.args['vol_name_prefix'], vol_idx))
|
||||||
# Set IPMI port using its index as an offset from the lowest
|
# Set IPMI port using its index as an offset from the lowest
|
||||||
# port.
|
# port.
|
||||||
node['ipmi_port'] = (
|
node['ipmi_port'] = (
|
||||||
@ -196,10 +201,6 @@ class ActionModule(ActionBase):
|
|||||||
)
|
)
|
||||||
# Set the type name, for future reference.
|
# Set the type name, for future reference.
|
||||||
node['type'] = type_name
|
node['type'] = type_name
|
||||||
# Sequentially number the volume names.
|
|
||||||
for vol_idx, vol in enumerate(node['volumes']):
|
|
||||||
vol['name'] = (
|
|
||||||
"%s%d" % (self.args['vol_name_prefix'], vol_idx))
|
|
||||||
# Ironic config is not mandatory.
|
# Ironic config is not mandatory.
|
||||||
if ironic_config:
|
if ironic_config:
|
||||||
node['ironic_config'] = ironic_config
|
node['ironic_config'] = ironic_config
|
||||||
|
@ -173,7 +173,7 @@ class TestTenksUpdateState(unittest.TestCase):
|
|||||||
for node in nodes:
|
for node in nodes:
|
||||||
self.assertEqual(len(node['volumes']), 2)
|
self.assertEqual(len(node['volumes']), 2)
|
||||||
for n in {'0', '1'}:
|
for n in {'0', '1'}:
|
||||||
self.assertIn('test_vol_pfx' + n,
|
self.assertIn(node['name'] + 'test_vol_pfx' + n,
|
||||||
[vol['name'] for vol in node['volumes']])
|
[vol['name'] for vol in node['volumes']])
|
||||||
for c in {'10GB', '20GB'}:
|
for c in {'10GB', '20GB'}:
|
||||||
self.assertIn(c, [vol['capacity'] for vol in node['volumes']])
|
self.assertIn(c, [vol['capacity'] for vol in node['volumes']])
|
||||||
|
Loading…
Reference in New Issue
Block a user