Skip to content

Commit

Permalink
Provide patches for stripped packaged installations
Browse files Browse the repository at this point in the history
In this change we provide patches for stripped package based
installation as well as for full source based installations.
This is updated for all applicable patches and the corresponding
Readme files have been updated accordingly.
  • Loading branch information
casusbelli committed Oct 18, 2017
1 parent 70c1fe8 commit a9b8571
Show file tree
Hide file tree
Showing 24 changed files with 1,517 additions and 689 deletions.
369 changes: 0 additions & 369 deletions full_quobyte_patch/Ocata/full_quobyte_ocata_cinder.patch

Large diffs are not rendered by default.

Large diffs are not rendered by default.

306 changes: 1 addition & 305 deletions full_quobyte_patch/Ocata/full_quobyte_ocata_nova.patch
Original file line number Diff line number Diff line change
@@ -1,295 +1,3 @@
diff --git nova/tests/unit/virt/libvirt/test_imagebackend.py nova/tests/unit/virt/libvirt/test_imagebackend.py
index b3cc277..2c6dff9 100644
--- nova/tests/unit/virt/libvirt/test_imagebackend.py
+++ nova/tests/unit/virt/libvirt/test_imagebackend.py
@@ -120,9 +120,8 @@ class _ImageTestCase(object):
image.cache(fake_fetch, self.TEMPLATE_PATH, self.SIZE)

self.assertEqual(fake_processutils.fake_execute_get_log(),
- ['fallocate -l 1 %s.fallocate_test' % self.PATH,
- 'fallocate -n -l %s %s' % (self.SIZE, self.PATH),
- 'fallocate -n -l %s %s' % (self.SIZE, self.PATH)])
+ ['truncate -s %s %s' % (self.SIZE, self.PATH),
+ 'truncate -s %s %s' % (self.SIZE, self.PATH)])

def test_prealloc_image_without_write_access(self):
CONF.set_override('preallocate_images', 'space')
diff --git nova/tests/unit/virt/libvirt/volume/test_quobyte.py nova/tests/unit/virt/libvirt/volume/test_quobyte.py
index a43a79a..7f867fa 100644
--- nova/tests/unit/virt/libvirt/volume/test_quobyte.py
+++ nova/tests/unit/virt/libvirt/volume/test_quobyte.py
@@ -15,12 +15,15 @@
"""Unit tests for the Quobyte volume driver module."""

import os
+import traceback

import mock
from oslo_concurrency import processutils
from oslo_utils import fileutils
+import psutil
+import six

-from nova import exception
+from nova import exception as nova_exception
from nova import test
from nova.tests.unit.virt.libvirt.volume import test_volume
from nova import utils
@@ -31,9 +34,37 @@ from nova.virt.libvirt.volume import quobyte
class QuobyteTestCase(test.NoDBTestCase):
"""Tests the nova.virt.libvirt.volume.quobyte module utilities."""

+ TEST_MNT_POINT = mock.sentinel.TEST_MNT_POINT
+
+ def assertRaisesAndMessageMatches(
+ self, excClass, msg, callableObj, *args, **kwargs):
+ """Ensure that the specified exception was raised. """
+
+ caught = False
+ try:
+ callableObj(*args, **kwargs)
+ except Exception as exc:
+ caught = True
+ self.assertIsInstance(exc, excClass,
+ 'Wrong exception caught: %s Stacktrace: %s' %
+ (exc, traceback.format_exc()))
+ self.assertIn(msg, six.text_type(exc))
+
+ if not caught:
+ self.fail('Expected raised exception but nothing caught.')
+
+ def get_mock_partitions(self):
+ mypart = mock.Mock()
+ mypart.device = "quobyte@"
+ mypart.mountpoint = self.TEST_MNT_POINT
+ return [mypart]
+
+ @mock.patch.object(os.path, "exists", return_value=False)
@mock.patch.object(fileutils, "ensure_tree")
@mock.patch.object(utils, "execute")
- def test_quobyte_mount_volume(self, mock_execute, mock_ensure_tree):
+ def test_quobyte_mount_volume_not_systemd(self, mock_execute,
+ mock_ensure_tree,
+ mock_exists):
mnt_base = '/mnt'
quobyte_volume = '192.168.1.1/volume-00001'
export_mnt_base = os.path.join(mnt_base,
@@ -43,17 +74,45 @@ class QuobyteTestCase(test.NoDBTestCase):

mock_ensure_tree.assert_called_once_with(export_mnt_base)
expected_commands = [mock.call('mount.quobyte',
+ '--disable-xattrs',
quobyte_volume,
- export_mnt_base,
- check_exit_code=[0, 4])
+ export_mnt_base)
+ ]
+ mock_execute.assert_has_calls(expected_commands)
+ mock_exists.assert_called_once_with(" /run/systemd/system")
+
+ @mock.patch.object(os.path, "exists", return_value=True)
+ @mock.patch.object(fileutils, "ensure_tree")
+ @mock.patch.object(utils, "execute")
+ def test_quobyte_mount_volume_systemd(self, mock_execute,
+ mock_ensure_tree,
+ mock_exists):
+ 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.mount_volume(quobyte_volume, export_mnt_base)
+
+ mock_ensure_tree.assert_called_once_with(export_mnt_base)
+ expected_commands = [mock.call('systemd-run',
+ '--scope',
+ '--user',
+ 'mount.quobyte',
+ '--disable-xattrs',
+ quobyte_volume,
+ export_mnt_base)
]
mock_execute.assert_has_calls(expected_commands)
+ mock_exists.assert_called_once_with(" /run/systemd/system")

+ @mock.patch.object(os.path, "exists", return_value=False)
@mock.patch.object(fileutils, "ensure_tree")
@mock.patch.object(utils, "execute")
def test_quobyte_mount_volume_with_config(self,
mock_execute,
- mock_ensure_tree):
+ mock_ensure_tree,
+ mock_exists):
mnt_base = '/mnt'
quobyte_volume = '192.168.1.1/volume-00001'
export_mnt_base = os.path.join(mnt_base,
@@ -66,13 +125,14 @@ class QuobyteTestCase(test.NoDBTestCase):

mock_ensure_tree.assert_called_once_with(export_mnt_base)
expected_commands = [mock.call('mount.quobyte',
+ '--disable-xattrs',
quobyte_volume,
export_mnt_base,
'-c',
- config_file_dummy,
- check_exit_code=[0, 4])
+ config_file_dummy)
]
mock_execute.assert_has_calls(expected_commands)
+ mock_exists.assert_called_once_with(" /run/systemd/system")

@mock.patch.object(fileutils, "ensure_tree")
@mock.patch.object(utils, "execute",
@@ -141,49 +201,91 @@ class QuobyteTestCase(test.NoDBTestCase):
"the Quobyte Volume at %s",
export_mnt_base))

- @mock.patch.object(os, "access", return_value=True)
- @mock.patch.object(utils, "execute")
- def test_quobyte_is_valid_volume(self, mock_execute, mock_access):
- 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.validate_volume(export_mnt_base)
-
- mock_execute.assert_called_once_with('getfattr',
- '-n',
- 'quobyte.info',
- export_mnt_base)
-
- @mock.patch.object(utils, "execute",
- side_effect=(processutils.
- ProcessExecutionError))
- def test_quobyte_is_valid_volume_vol_not_valid_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))
-
- self.assertRaises(exception.NovaException,
- quobyte.validate_volume,
- export_mnt_base)
-
- @mock.patch.object(os, "access", return_value=False)
- @mock.patch.object(utils, "execute",
- side_effect=(processutils.
- ProcessExecutionError))
- def test_quobyte_is_valid_volume_vol_no_valid_access(self,
- mock_execute,
- mock_access):
- 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))
-
- self.assertRaises(exception.NovaException,
- quobyte.validate_volume,
- export_mnt_base)
+ @mock.patch.object(psutil, "disk_partitions")
+ @mock.patch.object(os, "stat")
+ def test_validate_volume_all_good(self, stat_mock, part_mock):
+ part_mock.return_value = self.get_mock_partitions()
+ drv = quobyte
+
+ 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):
+ part_mock.return_value = self.get_mock_partitions()
+ drv = quobyte
+
+ def statMockCall(*args):
+ print (args)
+ if args[0] == self.TEST_MNT_POINT:
+ raise nova_exception.InvalidVolume()
+ stat_mock.side_effect = [os.stat, statMockCall]
+
+ self.assertRaises(
+ excClass=nova_exception.InvalidVolume,
+ callableObj=drv.validate_volume,
+ mount_path=self.TEST_MNT_POINT)
+ stat_mock.assert_called_with(self.TEST_MNT_POINT)
+ part_mock.assert_called_once_with(all=True)
+
+ def test_validate_volume_no_mtab_entry(self):
+ msg = ("No matching Quobyte mount entry for %(mpt)s"
+ " could be found for validation in partition list."
+ % {'mpt': self.TEST_MNT_POINT})
+
+ self.assertRaisesAndMessageMatches(
+ nova_exception.InvalidVolume,
+ msg,
+ quobyte.validate_volume,
+ self.TEST_MNT_POINT)
+
+ @mock.patch.object(psutil, "disk_partitions")
+ def test_validate_volume_wrong_mount_type(self, part_mock):
+ mypart = mock.Mock()
+ mypart.device = "not-quobyte"
+ mypart.mountpoint = self.TEST_MNT_POINT
+ part_mock.return_value = [mypart]
+ msg = ("The mount %(mpt)s is not a valid"
+ " Quobyte volume according to partition list."
+ % {'mpt': self.TEST_MNT_POINT})
+
+ self.assertRaisesAndMessageMatches(
+ nova_exception.InvalidVolume,
+ msg,
+ quobyte.validate_volume,
+ self.TEST_MNT_POINT)
+ part_mock.assert_called_once_with(all=True)
+
+ @mock.patch.object(os, "stat")
+ @mock.patch.object(psutil, "disk_partitions")
+ def test_validate_volume_stale_mount(self, part_mock, stat_mock):
+ part_mock.return_value = self.get_mock_partitions()
+
+ def statMockCall(*args):
+ if args[0] == self.TEST_MNT_POINT:
+ stat_result = mock.Mock()
+ stat_result.st_size = 1
+ return stat_result
+ return os.stat(args)
+ stat_mock.side_effect = statMockCall
+
+ # As this uses a dir size >0, it raises an exception
+ self.assertRaises(
+ nova_exception.InvalidVolume,
+ quobyte.validate_volume,
+ self.TEST_MNT_POINT)
+ part_mock.assert_called_once_with(all=True)


class LibvirtQuobyteVolumeDriverTestCase(
@@ -332,12 +434,12 @@ class LibvirtQuobyteVolumeDriverTestCase(

def exe_side_effect(*cmd, **kwargs):
if cmd == mock.ANY:
- raise exception.NovaException()
+ raise nova_exception.NovaException()

with mock.patch.object(quobyte,
'validate_volume') as mock_execute:
mock_execute.side_effect = exe_side_effect
- self.assertRaises(exception.NovaException,
+ self.assertRaises(nova_exception.NovaException,
libvirt_driver.connect_volume,
connection_info,
self.disk_info)
diff --git nova/virt/libvirt/imagebackend.py nova/virt/libvirt/imagebackend.py
index 8dd227e..eaf5c81 100644
--- nova/virt/libvirt/imagebackend.py
Expand Down Expand Up @@ -419,16 +127,4 @@ index 284a084..f36aacb 100644
+ @utils.synchronized('connect_qb_volume')
def disconnect_volume(self, connection_info, disk_dev):
"""Disconnect the volume."""

diff --git releasenotes/notes/bug_1659328-73686be497f5f85a.yaml releasenotes/notes/bug_1659328-73686be497f5f85a.yaml
new file mode 100644
index 0000000..e55248e
--- /dev/null
+++ releasenotes/notes/bug_1659328-73686be497f5f85a.yaml
@@ -0,0 +1,6 @@
+---
+
+fixes:
+ - |
+ The i/o performance for Quobyte volumes has been increased significantly
+ by disabling xattrs.

Loading

0 comments on commit a9b8571

Please sign in to comment.