Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 51 additions & 31 deletions coriolisclient/cli/deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,37 +161,57 @@ class CreateDeployment(show.ShowOne):
"""Start a new deployment from an existing transfer"""
def get_parser(self, prog_name):
parser = super(CreateDeployment, self).get_parser(prog_name)
parser.add_argument('transfer',
help='The ID of the transfer to migrate')
parser.add_argument('--force',
help='Force the deployment in case of a transfer '
'with failed executions', action='store_true',
default=False)
parser.add_argument('--dont-clone-disks',
help='Retain the transfer disks by cloning them',
action='store_false', dest="clone_disks",
default=True)
parser.add_argument('--skip-os-morphing',
help='Skip the OS morphing process',
action='store_true',
default=False)
parser.add_argument('--user-script-global', action='append',
required=False,
dest="global_scripts",
help='A script that will run for a particular '
'os_type. This option can be used multiple '
'times. Use: linux=/path/to/script.sh or '
'windows=/path/to/script.ps1')
parser.add_argument('--user-script-instance', action='append',
required=False,
dest="instance_scripts",
help='A script that will run for a particular '
'instance specified by the --instance option. '
'This option can be used multiple times. '
'Use: "instance_name"=/path/to/script.sh.'
' This option overwrites any OS specific script '
'specified in --user-script-global for this '
'instance')
parser.add_argument(
'transfer',
help='The ID of the transfer to migrate')
parser.add_argument(
'--force',
help='Force the deployment in case of a transfer '
'with failed executions',
action='store_true',
default=False)
parser.add_argument(
'--dont-clone-disks',
help='Retain the transfer disks by cloning them',
action='store_false',
dest="clone_disks",
default=True)
parser.add_argument(
'--skip-os-morphing',
help='Skip the OS morphing process',
action='store_true',
default=False)
parser.add_argument(
'--user-script-global',
action='append',
required=False,
dest="global_scripts",
type=cli_utils.comma_separated_kv_to_dict,
help='A script that will run for a particular os_type. This '
'option can be used multiple times. '
'Use: linux=/path/to/script.sh or '
'windows=/path/to/script.ps1. '
'Can optionally include a script phase: '
'windows=/path/to/script.ps1,phase=osmorphing_pre_os_mount. '
'Supported phases: osmorphing_post_os_mount (default), '
'osmorphing_pre_os_mount.')
parser.add_argument(
'--user-script-instance',
action='append',
required=False,
dest="instance_scripts",
type=cli_utils.comma_separated_kv_to_dict,
help='A script that will run for a particular '
'instance specified by the --instance option. '
'This option can be used multiple times. '
'Use: "instance_name"=/path/to/script.sh.'
' This option overwrites any OS specific script '
'specified in --user-script-global for this '
'instance. Can optionally include a script phase: '
'instance_name=/path/to/script.ps1,'
'phase=osmorphing_pre_os_mount. '
'Supported phases: osmorphing_post_os_mount (default), '
'osmorphing_pre_os_mount.')
cli_utils.add_minion_pool_args_to_parser(
parser, include_origin_pool_arg=False,
include_destination_pool_arg=False,
Expand Down
163 changes: 102 additions & 61 deletions coriolisclient/cli/transfers.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,48 +170,72 @@ class CreateTransfer(show.ShowOne):
"""Create a new transfer"""
def get_parser(self, prog_name):
parser = super(CreateTransfer, self).get_parser(prog_name)
parser.add_argument('--origin-endpoint', required=True,
help='The origin endpoint id')
parser.add_argument('--destination-endpoint', required=True,
help='The destination endpoint id')
parser.add_argument('--instance', action='append', required=True,
dest="instances", metavar="INSTANCE_IDENTIFIER",
help='The identifier of a source instance to be '
'transferred. Can be specified multiple '
'times')
parser.add_argument('--scenario',
dest="scenario", metavar="SCENARIO",
choices=[
TRANSFER_SCENARIO_REPLICA,
TRANSFER_SCENARIO_LIVE_MIGRATION],
default=TRANSFER_SCENARIO_REPLICA,
help='The type of scenario to use when creating '
'the Transfer. "replica" will create a '
'monthly-billed Replica which can be '
'executed and deployed as many times as '
'desired, while "live_migration" will '
'create a Transfer which can be synced '
'as many times as needed but only '
'deployed once.')
parser.add_argument('--notes', dest='notes',
help='Notes about the transfer')
parser.add_argument('--user-script-global', action='append',
required=False,
dest="global_scripts",
help='A script that will run for a particular '
'os_type. This option can be used multiple '
'times. Use: linux=/path/to/script.sh or '
'windows=/path/to/script.ps1')
parser.add_argument('--user-script-instance', action='append',
required=False,
dest="instance_scripts",
help='A script that will run for a particular '
'instance specified by the --instance option. '
'This option can be used multiple times. '
'Use: "instance_name"=/path/to/script.sh.'
' This option overwrites any OS specific script '
'specified in --user-script-global for this '
'instance')
parser.add_argument(
'--origin-endpoint',
required=True,
help='The origin endpoint id')
parser.add_argument(
'--destination-endpoint',
required=True,
help='The destination endpoint id')
parser.add_argument(
'--instance',
action='append',
required=True,
dest="instances",
metavar="INSTANCE_IDENTIFIER",
help='The identifier of a source instance to be '
'transferred. Can be specified multiple times')
parser.add_argument(
'--scenario',
dest="scenario",
metavar="SCENARIO",
choices=[
TRANSFER_SCENARIO_REPLICA,
TRANSFER_SCENARIO_LIVE_MIGRATION],
default=TRANSFER_SCENARIO_REPLICA,
help='The type of scenario to use when creating '
'the Transfer. "replica" will create a '
'monthly-billed Replica which can be '
'executed and deployed as many times as '
'desired, while "live_migration" will '
'create a Transfer which can be synced '
'as many times as needed but only '
'deployed once.')
parser.add_argument(
'--notes',
dest='notes',
help='Notes about the transfer')
parser.add_argument(
'--user-script-global',
action='append',
required=False,
dest="global_scripts",
type=cli_utils.comma_separated_kv_to_dict,
help='A script that will run for a particular '
'os_type. This option can be used multiple '
'times. Use: linux=/path/to/script.sh or '
'windows=/path/to/script.ps1.'
'Can optionally include a script phase: '
'windows=/path/to/script.ps1,phase=osmorphing_pre_os_mount. '
'Supported phases: osmorphing_post_os_mount (default), '
'osmorphing_pre_os_mount.')
parser.add_argument(
'--user-script-instance', action='append',
required=False,
dest="instance_scripts",
type=cli_utils.comma_separated_kv_to_dict,
help='A script that will run for a particular '
'instance specified by the --instance option. '
'This option can be used multiple times. '
'Use: "instance_name"=/path/to/script.sh.'
' This option overwrites any OS specific script '
'specified in --user-script-global for this '
'instance. Can optionally include a script phase: '
'instance_name=/path/to/script.ps1,'
'phase=osmorphing_pre_os_mount. '
'Supported phases: osmorphing_post_os_mount (default), '
'osmorphing_pre_os_mount.')

cli_utils.add_args_for_json_option_to_parser(
parser, 'destination-environment')
Expand Down Expand Up @@ -349,25 +373,42 @@ class UpdateTransfer(show.ShowOne):
def get_parser(self, prog_name):
parser = super(UpdateTransfer, self).get_parser(prog_name)
parser.add_argument('id', help='The transfer\'s id')
parser.add_argument('--notes', dest='notes',
help='Notes about the transfer.')
parser.add_argument('--user-script-global', action='append',
required=False,
dest="global_scripts",
help='A script that will run for a particular '
'os_type. This option can be used multiple '
'times. Use: linux=/path/to/script.sh or '
'windows=/path/to/script.ps1')
parser.add_argument('--user-script-instance', action='append',
required=False,
dest="instance_scripts",
help='A script that will run for a particular '
'instance specified by the --instance option. '
'This option can be used multiple times. '
'Use: "instance_name"=/path/to/script.sh.'
' This option overwrites any OS specific script '
'specified in --user-script-global for this '
'instance')
parser.add_argument(
'--notes',
dest='notes',
help='Notes about the transfer.')
parser.add_argument(
'--user-script-global',
action='append',
required=False,
dest="global_scripts",
type=cli_utils.comma_separated_kv_to_dict,
help='A script that will run for a particular '
'os_type. This option can be used multiple '
'times. Use: linux=/path/to/script.sh or '
'windows=/path/to/script.ps1. '
'Omit the path to unregister the script, e.g. "linux=".'
'Can optionally include a script phase: '
'windows=/path/to/script.ps1,phase=osmorphing_pre_os_mount. '
'Supported phases: osmorphing_post_os_mount (default), '
'osmorphing_pre_os_mount.')
parser.add_argument(
'--user-script-instance', action='append',
required=False,
dest="instance_scripts",
type=cli_utils.comma_separated_kv_to_dict,
help='A script that will run for a particular '
'instance specified by the --instance option. '
'This option can be used multiple times. '
'Use: "instance_name"=/path/to/script.sh.'
' This option overwrites any OS specific script '
'specified in --user-script-global for this instance.'
'Omit the path to unregister the script, e.g. "linux=".'
'Can optionally include a script phase: '
'instance_name=/path/to/script.ps1,'
'phase=osmorphing_pre_os_mount. '
'Supported phases: osmorphing_post_os_mount (default), '
'osmorphing_pre_os_mount.')

cli_utils.add_args_for_json_option_to_parser(
parser, 'destination-environment')
Expand Down
Loading
Loading