diff --git a/cinder/tests/unit/volume/drivers/test_quobyte.py b/cinder/tests/unit/volume/drivers/test_quobyte.py index a4795c1e402..d26aa8cbd50 100644 --- a/cinder/tests/unit/volume/drivers/test_quobyte.py +++ b/cinder/tests/unit/volume/drivers/test_quobyte.py @@ -944,7 +944,7 @@ class QuobyteDriverTestCase(test.TestCase): @mock.patch.object(psutil, "disk_partitions") @mock.patch.object(os, "stat") - def test_validate_volume_all_good(self, stat_mock, part_mock): + def test_validate_volume_all_good_prefix_val(self, stat_mock, part_mock): part_mock.return_value = self.get_mock_partitions() drv = self._driver @@ -961,6 +961,27 @@ class QuobyteDriverTestCase(test.TestCase): stat_mock.assert_called_once_with(self.TEST_MNT_POINT) part_mock.assert_called_once_with(all=True) + @mock.patch.object(psutil, "disk_partitions") + @mock.patch.object(os, "stat") + def test_validate_volume_all_good_subtype_val(self, stat_mock, part_mock): + part_mock.return_value = self.get_mock_partitions() + part_mock.return_value[0].device = "not_quobyte" + part_mock.return_value[0].fstype = "fuse.quobyte" + drv = self._driver + + def statMockCall(*args): + if args[0] == self.TEST_MNT_POINT: + stat_result = mock.Mock() + stat_result.st_size = 0 + return stat_result + return os.stat(args) + stat_mock.side_effect = statMockCall + + drv._validate_volume(self.TEST_MNT_POINT) + + stat_mock.assert_called_once_with(self.TEST_MNT_POINT) + part_mock.assert_called_once_with(all=True) + @mock.patch.object(psutil, "disk_partitions") @mock.patch.object(os, "stat") def test_validate_volume_mount_not_working(self, stat_mock, part_mock): diff --git a/cinder/volume/drivers/quobyte.py b/cinder/volume/drivers/quobyte.py index 995fa4b3901..0423190ba17 100644 --- a/cinder/volume/drivers/quobyte.py +++ b/cinder/volume/drivers/quobyte.py @@ -32,7 +32,7 @@ from cinder import utils from cinder.volume import configuration from cinder.volume.drivers import remotefs as remotefs_drv -VERSION = '1.1.6' +VERSION = '1.1.7' LOG = logging.getLogger(__name__) @@ -86,6 +86,7 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed): 1.1.4 - Fixes capability to configure redundancy in quobyte_volume_url 1.1.5 - Enables extension of volumes with snapshots 1.1.6 - Optimizes volume creation + 1.1.7 - Support fuse subtype based Quobyte mount validation """ @@ -504,7 +505,8 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed): partitions = psutil.disk_partitions(all=True) for p in partitions: if mount_path == p.mountpoint: - if p.device.startswith("quobyte@"): + if (p.device.startswith("quobyte@") or + (p.fstype == "fuse.quobyte")): try: statresult = os.stat(mount_path) if statresult.st_size == 0: diff --git a/releasenotes/notes/bug-1730933-1bb0272e3c51eed3.yaml b/releasenotes/notes/bug-1730933-1bb0272e3c51eed3.yaml new file mode 100644 index 00000000000..ea3a571a18c --- /dev/null +++ b/releasenotes/notes/bug-1730933-1bb0272e3c51eed3.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The Quobyte Cinder driver now supports identifying Quobyte mounts + via the mounts fstype field. \ No newline at end of file