@ -1001,6 +1001,200 @@ def do_migration_get_progress(cs, args):
cliutils . print_dict ( result [ 1 ] )
@cliutils.arg (
' share_server_id ' ,
metavar = ' <share_server_id> ' ,
help = ' ID of the share server to check if the migration is possible. ' )
@cliutils.arg (
' host ' ,
metavar = ' <host@backend> ' ,
help = " Destination to migrate the share server to. Use the format "
" ' <node_hostname>@<backend_name> ' . " )
@cliutils.arg (
' --preserve-snapshots ' ,
' --preserve_snapshots ' ,
action = ' single_alias ' ,
metavar = ' <True|False> ' ,
choices = [ ' True ' , ' False ' ] ,
required = True ,
help = " Set to True if snapshots must be preserved at the migration "
" destination. " )
@cliutils.arg (
' --writable ' ,
metavar = ' <True|False> ' ,
choices = [ ' True ' , ' False ' ] ,
required = True ,
help = " Set to True if shares associated with the share server must be "
" writable through the first phase of the migration. " )
@cliutils.arg (
' --nondisruptive ' ,
metavar = ' <True|False> ' ,
choices = [ ' True ' , ' False ' ] ,
required = True ,
help = " Set to True if migration must be non disruptive to clients that are "
" using the shares associated with the share server through both "
" phases of the migration. " )
@cliutils.arg (
' --new_share_network ' ,
' --new-share-network ' ,
metavar = ' <new_share_network> ' ,
action = ' single_alias ' ,
required = False ,
help = " New share network to migrate to. Optional, default=None. " ,
default = None )
@api_versions.wraps ( " 2.57 " )
@api_versions.experimental_api
def do_share_server_migration_check ( cs , args ) :
""" Check migration compatibility for a share server with desired properties
( Admin only , Experimental ) .
"""
share_server = _find_share_server ( cs , args . share_server_id )
new_share_net_id = None
if args . new_share_network :
share_net = _find_share_network ( cs , args . new_share_network )
new_share_net_id = share_net . id
result = share_server . migration_check (
args . host , args . writable , args . nondisruptive , args . preserve_snapshots ,
new_share_net_id )
cliutils . print_dict ( result )
@cliutils.arg (
' share_server_id ' ,
metavar = ' <share_server_id> ' ,
help = ' ID of the share server to migrate. ' )
@cliutils.arg (
' host ' ,
metavar = ' <host@backend> ' ,
help = " Destination to migrate the share server to. Use the format "
" ' <node_hostname>@<backend_name> ' . " )
@cliutils.arg (
' --preserve-snapshots ' ,
' --preserve_snapshots ' ,
action = ' single_alias ' ,
metavar = ' <True|False> ' ,
choices = [ ' True ' , ' False ' ] ,
required = True ,
help = " Set to True if snapshots must be preserved at the migration "
" destination. " )
@cliutils.arg (
' --writable ' ,
metavar = ' <True|False> ' ,
choices = [ ' True ' , ' False ' ] ,
required = True ,
help = " Enforces migration to keep all its shares writable while contents "
" are being moved. " )
@cliutils.arg (
' --nondisruptive ' ,
metavar = ' <True|False> ' ,
choices = [ ' True ' , ' False ' ] ,
required = True ,
help = " Enforces migration to be nondisruptive. " )
@cliutils.arg (
' --new_share_network ' ,
' --new-share-network ' ,
metavar = ' <new_share_network> ' ,
action = ' single_alias ' ,
required = False ,
help = ' Specify a new share network for the share server. Do not '
' specify this parameter if the migrating share server has '
' to be retained within its current share network. ' ,
default = None )
@api_versions.wraps ( " 2.57 " )
@api_versions.experimental_api
def do_share_server_migration_start ( cs , args ) :
""" Migrates share server to a new host (Admin only, Experimental). """
share_server = _find_share_server ( cs , args . share_server_id )
new_share_net_id = None
if args . new_share_network :
share_net = _find_share_network ( cs , args . new_share_network )
new_share_net_id = share_net . id
share_server . migration_start ( args . host , args . writable , args . nondisruptive ,
args . preserve_snapshots , new_share_net_id )
@cliutils.arg (
' share_server_id ' ,
metavar = ' <share_server_id> ' ,
help = ' ID of share server to complete migration. ' )
@api_versions.wraps ( " 2.57 " )
@api_versions.experimental_api
def do_share_server_migration_complete ( cs , args ) :
""" Completes migration for a given share server
( Admin only , Experimental ) .
"""
share_server = _find_share_server ( cs , args . share_server_id )
result = share_server . migration_complete ( )
cliutils . print_dict ( result )
@cliutils.arg (
' share_server_id ' ,
metavar = ' <share_server_id> ' ,
help = ' ID of share server to complete migration. ' )
@api_versions.wraps ( " 2.57 " )
@api_versions.experimental_api
def do_share_server_migration_cancel ( cs , args ) :
""" Cancels migration of a given share server when copying
( Admin only , Experimental ) .
"""
share_server = _find_share_server ( cs , args . share_server_id )
share_server . migration_cancel ( )
@cliutils.arg (
' share_server_id ' ,
metavar = ' <share_server_id> ' ,
help = ' ID of share server to complete migration. ' )
@cliutils.arg (
' --task-state ' ,
' --task_state ' ,
' --state ' ,
metavar = ' <task_state> ' ,
default = ' None ' ,
action = ' single_alias ' ,
required = False ,
help = ( ' Indicate which task state to assign the share server. Options: '
' migration_starting, migration_in_progress, migration_completing, '
' migration_success, migration_error, migration_cancel_in_progress, '
' migration_cancelled, migration_driver_in_progress, '
' migration_driver_phase1_done. If no value is provided, None will '
' be used. ' ) )
@api_versions.wraps ( " 2.57 " )
@api_versions.experimental_api
def do_share_server_reset_task_state ( cs , args ) :
""" Explicitly update the task state of a share
( Admin only , Experimental ) .
"""
state = args . task_state
if args . task_state == ' None ' :
state = None
share_server = _find_share_server ( cs , args . share_server_id )
share_server . reset_task_state ( state )
@cliutils.arg (
' share_server_id ' ,
metavar = ' <share_server_id> ' ,
help = ' ID of share server to complete migration. ' )
@api_versions.wraps ( " 2.57 " )
@api_versions.experimental_api
def do_share_server_migration_get_progress ( cs , args ) :
""" Gets migration progress of a given share server when copying
( Admin only , Experimental ) .
"""
share_server = _find_share_server ( cs , args . share_server_id )
result = share_server . migration_get_progress ( )
cliutils . print_dict ( result )
@cliutils.arg (
' share ' ,
metavar = ' <share> ' ,