Ejemplo n.º 1
0
    def test_action_snapshot_failure_retry(self):
        PORTAL = 'localhost'

        status_output = (255, """
Error: command failed: Snapshot operation not allowed due to clones backed by
snapshots. Try again after sometime""")

        CommandRunner.CommandRunner._getStatusOutput = Mock(return_value=status_output)

        from stratuslab.pdiskbackend.LUN import LUN
        lun = LUN('123', proxy=NetAppCluster(PORTAL, 'jay', '/foo/bar',
                                             '/netapp/volume', 'namespace',
                                             'initiatorGroup', 'snapshotPrefix'))
        lun.associatedLUN = Mock()
        lun.associatedLUN.getUuid = Mock(return_value='foo')
        assert (255, '') == lun._execute_action('snapshot')
        assert (NUMBER_OF_RETRIES + 1) == CommandRunner.CommandRunner._getStatusOutput.call_count
Ejemplo n.º 2
0
    def test_action_snapshot_failure(self):
        PORTAL = 'localhost'

        def side_effect(action):
            if action == 'snapshot':
                return (255, """Error: command failed: The Snapshot(tm) copy name already exists""")
            elif action == 'clone':
                return (255, """Error: command failed: Clone start failed: Clone operation failed to start:
Clone file exists.""")

        CommandRunner.CommandRunner._getStatusOutputOrRetry = Mock(side_effect=side_effect)

        from stratuslab.pdiskbackend.LUN import LUN
        lun = LUN('123', proxy=NetAppCluster(PORTAL, 'jay', '/foo/bar',
                                             '/netapp/volume', 'namespace',
                                             'initiatorGroup', 'snapshotPrefix'))
        lun.associatedLUN = Mock()
        lun.associatedLUN.getUuid = Mock(return_value='foo')
        assert (255, '') == lun._execute_action('snapshot')