コード例 #1
0
    def test_delete_missing_volume(self, mock_execute, mock_log):
        mock_execute.side_effect = processutils.ProcessExecutionError(exit_code=4)

        dmcrypt.delete_volume(self.TARGET)

        self.assertEqual(1, mock_log.debug.call_count)
        self.assertEqual(0, mock_log.error.call_count)
コード例 #2
0
    def test_delete_missing_volume(self, mock_execute, mock_log):
        mock_execute.side_effect = \
                processutils.ProcessExecutionError(exit_code=4)

        dmcrypt.delete_volume(self.TARGET)

        self.assertEqual(1, mock_log.debug.call_count)
        self.assertEqual(0, mock_log.error.call_count)
コード例 #3
0
 def remove_volume_on_error(self, path):
     try:
         yield
     except Exception:
         with excutils.save_and_reraise_exception():
             if self.ephemeral_key_uuid is None:
                 lvm.remove_volumes([path])
             else:
                 dmcrypt.delete_volume(path.rpartition('/')[2])
                 lvm.remove_volumes([self.lv_path])
コード例 #4
0
ファイル: imagebackend.py プロジェクト: 375670450/nova
 def remove_volume_on_error(self, path):
     try:
         yield
     except Exception:
         with excutils.save_and_reraise_exception():
             if self.ephemeral_key_uuid is None:
                 lvm.remove_volumes([path])
             else:
                 dmcrypt.delete_volume(path.rpartition('/')[2])
                 lvm.remove_volumes([self.lv_path])
コード例 #5
0
    def test_delete_volume(self, mock_execute):
        dmcrypt.delete_volume(self.TARGET)

        mock_execute.assert_has_calls([
            mock.call('cryptsetup', 'remove', self.TARGET, run_as_root=True),
        ])
コード例 #6
0
    def test_delete_volume(self, mock_execute):
        dmcrypt.delete_volume(self.TARGET)

        mock_execute.assert_has_calls([
            mock.call(self.TARGET),
        ])
コード例 #7
0
    def test_delete_volume(self, mock_execute):
        dmcrypt.delete_volume(self.TARGET)

        mock_execute.assert_has_calls([
            mock.call('cryptsetup', 'remove', self.TARGET, run_as_root=True),
        ])
コード例 #8
0
ファイル: test_dmcrypt.py プロジェクト: nuistchh/nova
    def test_delete_volume(self):
        expected_commands = [('cryptsetup', 'remove', self.TARGET)]
        dmcrypt.delete_volume(self.TARGET)

        self.assertEqual(expected_commands, self.executes)
コード例 #9
0
    def test_delete_volume(self):
        expected_commands = [('cryptsetup', 'remove', self.TARGET)]
        dmcrypt.delete_volume(self.TARGET)

        self.assertEqual(expected_commands, self.executes)