Merge "Ensure root_gb always in patch params to avoid ValidationError"

This commit is contained in:
Zuul 2017-11-20 09:29:00 +00:00 committed by Gerrit Code Review
commit 47ab4b37fe
1 changed files with 10 additions and 2 deletions

View File

@ -162,12 +162,13 @@ class IronicDriver(base_driver.BaseEngineDriver):
# Add the required fields to deploy a node.
patch.append({'path': '/instance_info/image_source', 'op': 'add',
'value': server.image_uuid})
root_gb = node.properties.get('local_gb', 0)
if preserve_ephemeral is not None:
patch.append({'path': '/instance_info/preserve_ephemeral',
'op': 'add', 'value': str(preserve_ephemeral)})
if partitions:
patch.append({'path': '/instance_info/root_gb', 'op': 'add',
'value': str(partitions.get('root_gb', 0))})
patch.append({'path': '/instance_info/ephemeral_gb', 'op': 'add',
'value': str(partitions.get('ephemeral_gb', 0))})
patch.append({'path': '/instance_info/swap_mb', 'op': 'add',
@ -177,6 +178,13 @@ class IronicDriver(base_driver.BaseEngineDriver):
patch.append({'path': '/instance_info/capabilities',
'op': 'add', 'value': '{"boot_option": "local"}'})
# If partitions is not None, use the root_gb in partitions instead
root_gb = partitions.get('root_gb', root_gb)
# root_gb is required not optional
patch.append({'path': '/instance_info/root_gb', 'op': 'add',
'value': str(root_gb)})
try:
# FIXME(lucasagomes): The "retry_on_conflict" parameter was added
# to basically causes the deployment to fail faster in case the