Skip to content

Commit 47e49e5

Browse files
author
Rajarajan
committed
added warning message and summary for disaster-recover-failover
1 parent bf8c308 commit 47e49e5

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

SoftLayer/CLI/block/replication/disaster_recovery_failover.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,22 @@
88
from SoftLayer.CLI import exceptions
99

1010

11-
@click.command()
11+
@click.command(epilog="""Failover an inaccessible block/file volume to its available replicant volume.
12+
If a volume (with replication) becomes inaccessible due to a disaster event, this method can be used to immediately failover to an available replica in another location.
13+
This method does not allow for fail back via the API. To fail back to the original volume after using this method, open a support ticket.
14+
To test failover, use SoftLayer_Network_Storage::failoverToReplicant instead.""")
1215
@click.argument('volume-id')
1316
@click.option('--replicant-id', help="ID of the replicant volume")
1417
@environment.pass_env
1518
def cli(env, volume_id, replicant_id):
1619
"""Failover an inaccessible file volume to its available replicant volume."""
1720
block_storage_manager = SoftLayer.BlockStorageManager(env.client)
1821

19-
click.secho("""WARNING:Disaster Recovery Failover a block volume to the given replicant volume.\n"""
20-
"""* This action cannot be undone\n"""
21-
"""* You will not be able to perform failback to the original\n"""
22-
"""* You cannot failover without replica""",fg = 'red' )
22+
click.secho("""WARNING : Failover an inaccessible block/file volume to its available replicant volume."""
23+
"""If a volume (with replication) becomes inaccessible due to a disaster event, this method can be used to immediately failover to an available replica in another location."""
24+
"""This method does not allow for fail back via the API."""
25+
"""To fail back to the original volume after using this method, open a support ticket."""
26+
"""To test failover, use SoftLayer_Network_Storage::failoverToReplicant instead.""",fg = 'red' )
2327

2428
if not (formatting.confirm('Are you sure you want to continue?')):
2529
raise exceptions.CLIAbort('Aborted.')
@@ -29,4 +33,4 @@ def cli(env, volume_id, replicant_id):
2933
replicant_id
3034
)
3135

32-
click.echo("Disaster Recovery Failover to replicant is now in progress.")
36+
click.echo("Disaster Recovery Failover to replicant is now in progress.")

SoftLayer/CLI/file/replication/disaster_recovery_failover.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,22 @@
88
from SoftLayer.CLI import exceptions
99

1010

11-
@click.command()
11+
@click.command(epilog="""Failover an inaccessible block/file volume to its available replicant volume.
12+
If a volume (with replication) becomes inaccessible due to a disaster event, this method can be used to immediately failover to an available replica in another location.
13+
This method does not allow for fail back via API. If you wish to test failover, please use SoftLayer_Network_Storage::failoverToReplicant.
14+
After using this method, to fail back to the original volume, please open a support ticket""")
1215
@click.argument('volume-id')
1316
@click.option('--replicant-id', help="ID of the replicant volume")
1417
@environment.pass_env
1518
def cli(env, volume_id, replicant_id):
1619
"""Failover an inaccessible file volume to its available replicant volume."""
1720
file_storage_manager = SoftLayer.FileStorageManager(env.client)
1821

19-
click.secho("""WARNING : Disaster Recovery Failover should not be performed unless data center for the primary volume is unreachable.\n"""
20-
"""* This action cannot be undone\n"""
21-
"""* You will not be able to perform failback to the original without support intervention\n"""
22-
"""* You cannot failover without replica""",fg = 'red' )
22+
click.secho("""WARNING : Failover an inaccessible block/file volume to its available replicant volume."""
23+
"""If a volume (with replication) becomes inaccessible due to a disaster event, this method can be used to immediately failover to an available replica in another location."""
24+
"""This method does not allow for fail back via the API."""
25+
"""To fail back to the original volume after using this method, open a support ticket."""
26+
"""To test failover, use SoftLayer_Network_Storage::failoverToReplicant instead.""",fg = 'red' )
2327

2428
if not (formatting.confirm('Are you sure you want to continue?')):
2529
raise exceptions.CLIAbort('Aborted.')

tests/CLI/modules/file_tests.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -503,19 +503,7 @@ def test_disaster_recovery_failover(self, disaster_recovery_failover_mock, confi
503503
'--replicant-id=5678'])
504504

505505
self.assert_no_fail(result)
506-
self.assertEqual('Disaster Recovery Failover to replicant is now in progress.\n',
507-
result.output)
508-
509-
@mock.patch('SoftLayer.CLI.formatting.confirm')
510-
@mock.patch('SoftLayer.FileStorageManager.disaster_recovery_failover_to_replicant')
511-
def test_disaster_recovery_failover_unsuccesful(self, disaster_recovery_failover_mock, confirm_mock):
512-
confirm_mock.return_value = True
513-
disaster_recovery_failover_mock.return_value = False
514-
515-
result = self.run_command(['file', 'disaster-recovery-failover', '12345678',
516-
'--replicant-id=5678'])
517-
518-
self.assertEqual('Disaster Recovery Failover operation could not be initiated.\n',
506+
self.assertIn('Disaster Recovery Failover to replicant is now in progress.\n',
519507
result.output)
520508

521509
@mock.patch('SoftLayer.CLI.formatting.confirm')

0 commit comments

Comments
 (0)