summaryrefslogtreecommitdiff
path: root/openstackclient/compute
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2021-11-02 09:59:27 +0000
committerStephen Finucane <sfinucan@redhat.com>2021-11-03 10:17:37 +0000
commit8cb0a28607e7f8b9eb4bb71a95b39230d43a969c (patch)
treedf2aa5f202b81c86fc05f53468f11f32a97d16f5 /openstackclient/compute
parentf824e13bc5754d3de108d39d62de3d6cfae2670c (diff)
downloadpython-openstackclient-8cb0a28607e7f8b9eb4bb71a95b39230d43a969c.tar.gz
compute: Don't warn if disk overcommit params unset
Due to a small logic error, we were emitting a warning about a deprecated option when the user tried to live migrate an instance using microversion 2.25 even though the user hadn't actually set that option. Correct this. Change-Id: Ib61e817bd4ced9b5533e7c7f9d8f0b45fe81c211 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Story: 2009657 Task: 43836
Diffstat (limited to 'openstackclient/compute')
-rw-r--r--openstackclient/compute/v2/server.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index c11f4b57..d0edaf07 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -2621,7 +2621,7 @@ revert to release the new server and restart the old one.""")
disk_group.add_argument(
'--disk-overcommit',
action='store_true',
- default=False,
+ default=None,
help=_(
'Allow disk over-commit on the destination host'
'(supported with --os-compute-api-version 2.24 or below)'
@@ -2631,7 +2631,6 @@ revert to release the new server and restart the old one.""")
'--no-disk-overcommit',
dest='disk_overcommit',
action='store_false',
- default=False,
help=_(
'Do not over-commit disk on the destination host (default)'
'(supported with --os-compute-api-version 2.24 or below)'
@@ -2693,6 +2692,11 @@ revert to release the new server and restart the old one.""")
if compute_client.api_version < api_versions.APIVersion('2.25'):
kwargs['disk_over_commit'] = parsed_args.disk_overcommit
+ # We can't use an argparse default value because then we can't
+ # distinguish between explicit 'False' and unset for the below
+ # case (microversion >= 2.25)
+ if kwargs['disk_over_commit'] is None:
+ kwargs['disk_over_commit'] = False
elif parsed_args.disk_overcommit is not None:
# TODO(stephenfin): Raise an error here in OSC 7.0
msg = _(