示例#1
0
    def test_quobyte_umount_volume(self, mock_execute):
        mnt_base = '/mnt'
        quobyte_volume = '192.168.1.1/volume-00001'
        export_mnt_base = os.path.join(mnt_base,
                                       utils.get_hash_str(quobyte_volume))

        quobyte.umount_volume(export_mnt_base)

        mock_execute.assert_called_once_with('umount.quobyte', export_mnt_base)
示例#2
0
    def test_quobyte_umount_volume_non_sysd(self, mock_lv_umount):
        mnt_base = '/mnt'
        quobyte_volume = '192.168.1.1/volume-00001'
        export_mnt_base = os.path.join(mnt_base,
                                       utils.get_hash_str(quobyte_volume))

        quobyte.umount_volume(export_mnt_base)

        mock_lv_umount.assert_called_once_with(export_mnt_base)
示例#3
0
    def test_quobyte_umount_volume(self, mock_execute):
        mnt_base = '/mnt'
        quobyte_volume = '192.168.1.1/volume-00001'
        export_mnt_base = os.path.join(mnt_base,
                                       utils.get_hash_str(quobyte_volume))

        quobyte.umount_volume(export_mnt_base)

        mock_execute.assert_called_once_with('umount.quobyte',
                                             export_mnt_base)
示例#4
0
    def test_quobyte_umount_volume_sysd(self, mock_lv_umount):
        mnt_base = '/mnt'
        quobyte_volume = '192.168.1.1/volume-00001'
        export_mnt_base = os.path.join(mnt_base,
                                       utils.get_hash_str(quobyte_volume))
        quobyte._is_systemd = True

        quobyte.umount_volume(export_mnt_base)

        mock_lv_umount.assert_called_once_with(export_mnt_base)
示例#5
0
    def test_quobyte_umount_volume_fails(self, mock_execute, mock_exception):
        mnt_base = '/mnt'
        quobyte_volume = '192.168.1.1/volume-00001'
        export_mnt_base = os.path.join(mnt_base,
                                       utils.get_hash_str(quobyte_volume))

        quobyte.umount_volume(export_mnt_base)

        (mock_exception.assert_called_once_with(
            "Couldn't unmount "
            "the Quobyte Volume at %s", export_mnt_base))
示例#6
0
    def test_quobyte_umount_volume_fails(self,
                                         mock_execute,
                                         mock_exception):
        mnt_base = '/mnt'
        quobyte_volume = '192.168.1.1/volume-00001'
        export_mnt_base = os.path.join(mnt_base,
                                       utils.get_hash_str(quobyte_volume))

        quobyte.umount_volume(export_mnt_base)

        (mock_exception.
         assert_called_once_with("Couldn't unmount "
                                 "the Quobyte Volume at %s",
                                 export_mnt_base))
示例#7
0
    def test_quobyte_umount_volume_warns(self, mock_execute, mock_debug):
        mnt_base = '/mnt'
        quobyte_volume = '192.168.1.1/volume-00001'
        export_mnt_base = os.path.join(mnt_base,
                                       utils.get_hash_str(quobyte_volume))

        def exec_side_effect(*cmd, **kwargs):
            exerror = processutils.ProcessExecutionError(
                "Device or resource busy")
            raise exerror

        mock_execute.side_effect = exec_side_effect

        quobyte.umount_volume(export_mnt_base)

        (mock_debug.assert_called_once_with(
            "The Quobyte volume at %s is still in use.", export_mnt_base))
示例#8
0
    def test_quobyte_umount_volume_warns(self, mock_execute, mock_debug):
        mnt_base = '/mnt'
        quobyte_volume = '192.168.1.1/volume-00001'
        export_mnt_base = os.path.join(mnt_base,
                                       utils.get_hash_str(quobyte_volume))
        quobyte._is_systemd = True

        def exec_side_effect(*cmd, **kwargs):
            exerror = processutils.ProcessExecutionError(
                                       "Device or resource busy")
            raise exerror
        mock_execute.side_effect = exec_side_effect

        quobyte.umount_volume(export_mnt_base)

        (mock_debug.
         assert_called_once_with("The Quobyte volume at %s is still in use.",
                                 export_mnt_base))