bnr CLI enable the conf. of ReaR with ironic on nodes
Let the CLI configure ReaR on the overcloud nodes with ironic. Change-Id: I9ecb18c713addbafbb004a57439b99aa9aab7520 Depends-On: I958439e017efa45f316750a61fd7dfdee5afdc8e
This commit is contained in:
parent
d21d177320
commit
dc26adb0a5
|
@ -182,6 +182,35 @@ class TestOvercloudBackup(utils.TestCommand):
|
||||||
extra_vars={}
|
extra_vars={}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@mock.patch('os.path.isfile')
|
||||||
|
@mock.patch('os.access')
|
||||||
|
@mock.patch('tripleoclient.utils.run_ansible_playbook',
|
||||||
|
autospec=True)
|
||||||
|
def test_overcloud_backup_setup_rear_ironic(self,
|
||||||
|
mock_playbook,
|
||||||
|
mock_access,
|
||||||
|
mock_isfile):
|
||||||
|
arglist = [
|
||||||
|
'--setup-ironic',
|
||||||
|
]
|
||||||
|
verifylist = []
|
||||||
|
mock_isfile.return_value = True
|
||||||
|
mock_access.return_value = True
|
||||||
|
|
||||||
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
|
self.cmd.take_action(parsed_args)
|
||||||
|
mock_playbook.assert_called_once_with(
|
||||||
|
workdir=mock.ANY,
|
||||||
|
playbook='cli-overcloud-conf-ironic.yaml',
|
||||||
|
inventory=parsed_args.inventory,
|
||||||
|
tags='bar_setup_rear',
|
||||||
|
skip_tags=None,
|
||||||
|
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
|
||||||
|
verbosity=3,
|
||||||
|
extra_vars={}
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('tripleoclient.utils.run_ansible_playbook', autospec=True)
|
@mock.patch('tripleoclient.utils.run_ansible_playbook', autospec=True)
|
||||||
def test_overcloud_backup_setup_nfs_rear_with_inventory(self,
|
def test_overcloud_backup_setup_nfs_rear_with_inventory(self,
|
||||||
mock_playbook):
|
mock_playbook):
|
||||||
|
|
|
@ -43,14 +43,14 @@ class BackupOvercloud(command.Command):
|
||||||
nargs='?',
|
nargs='?',
|
||||||
action='store',
|
action='store',
|
||||||
help=_("Initialize environment for backup, "
|
help=_("Initialize environment for backup, "
|
||||||
"using 'rear' or 'nfs' as args "
|
"using 'rear', 'nfs' or 'ironic' as args "
|
||||||
"which will check for package install "
|
"which will check for package install "
|
||||||
"and configured ReaR or NFS server. "
|
"and configured ReaR or NFS server. "
|
||||||
"Defaults to: rear. "
|
"Defaults to: rear. "
|
||||||
"i.e. --init rear. "
|
"i.e. --init rear. "
|
||||||
"WARNING: This flag will be deprecated "
|
"WARNING: This flag will be deprecated "
|
||||||
"and replaced by '--setup-rear' and "
|
"and replaced by '--setup-rear' ,"
|
||||||
"'--setup-nfs'.")
|
"'--setup-nfs' and '--setup-ironic'.")
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -71,6 +71,14 @@ class BackupOvercloud(command.Command):
|
||||||
"install and configure ReaR.")
|
"install and configure ReaR.")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'--setup-ironic',
|
||||||
|
default=False,
|
||||||
|
action='store_true',
|
||||||
|
help=_("Setup ReaR on the overcloud 'Controller' hosts which will "
|
||||||
|
"install and configure ReaR with ironic")
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--cron',
|
'--cron',
|
||||||
default=False,
|
default=False,
|
||||||
|
@ -175,6 +183,17 @@ class BackupOvercloud(command.Command):
|
||||||
extra_vars=extra_vars
|
extra_vars=extra_vars
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if parsed_args.setup_ironic is True or parsed_args.init == 'ironic':
|
||||||
|
|
||||||
|
LOG.debug(_('Installing and configuring Rear/Ironic on nodes'))
|
||||||
|
self._run_ansible_playbook(
|
||||||
|
playbook='cli-overcloud-conf-ironic.yaml',
|
||||||
|
inventory=parsed_args.inventory,
|
||||||
|
tags='bar_setup_rear',
|
||||||
|
skip_tags=None,
|
||||||
|
extra_vars=extra_vars
|
||||||
|
)
|
||||||
|
|
||||||
if parsed_args.cron is True:
|
if parsed_args.cron is True:
|
||||||
|
|
||||||
LOG.debug(_('Programming cron backup'))
|
LOG.debug(_('Programming cron backup'))
|
||||||
|
@ -188,6 +207,7 @@ class BackupOvercloud(command.Command):
|
||||||
|
|
||||||
if (parsed_args.setup_nfs is False and
|
if (parsed_args.setup_nfs is False and
|
||||||
parsed_args.setup_rear is False and
|
parsed_args.setup_rear is False and
|
||||||
|
parsed_args.setup_ironic is False and
|
||||||
parsed_args.cron is False and
|
parsed_args.cron is False and
|
||||||
parsed_args.init is None):
|
parsed_args.init is None):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue