diff options
Diffstat (limited to 'novaclient/v2/shell.py')
-rw-r--r-- | novaclient/v2/shell.py | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index ac6c5ea1..e0498df8 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -2730,22 +2730,44 @@ def do_volume_attach(cs, args): help=_('Name or ID of server.')) @utils.arg( 'src_volume', - metavar='<src_volid>', + metavar='<src_volume>', help=_('ID of the source (original) volume.')) @utils.arg( 'dest_volume', - metavar='<dest_volid>', + metavar='<dest_volume>', help=_('ID of the destination volume.')) +@utils.arg( + '--delete-on-termination', + default=None, + group='delete_on_termination', + action='store_true', + help=_('Specify that the volume should be deleted ' + 'when the server is destroyed.'), + start_version='2.85') +@utils.arg( + '--no-delete-on-termination', + group='delete_on_termination', + action='store_false', + help=_('Specify that the volume should not be deleted ' + 'when the server is destroyed.'), + start_version='2.85') def do_volume_update(cs, args): """Update the attachment on the server. - Migrates the data from an attached volume to the - specified available volume and swaps out the active - attachment to the new volume. + If dest_volume is the same as the src_volume then the command migrates + the data from the attached volume to the specified available volume + and swaps out the active attachment to the new volume. Otherwise it + only updates the parameters of the existing attachment. """ + kwargs = dict() + if (cs.api_version >= api_versions.APIVersion('2.85') and + args.delete_on_termination is not None): + kwargs['delete_on_termination'] = args.delete_on_termination + cs.volumes.update_server_volume(_find_server(cs, args.server).id, args.src_volume, - args.dest_volume) + args.dest_volume, + **kwargs) @utils.arg( |