From eec0fe59ff08285181ac6c74ffcc36348b692b69 Mon Sep 17 00:00:00 2001 From: Bob Ball Date: Mon, 14 May 2018 16:27:56 +0100 Subject: [PATCH] XenAPI: Pass expected return codes to resize2fs None is not tolerated by ProcessUtils, therefore make sure that [0] is passed as the expected return code Change-Id: I7d6335633479dfd7715444ef4aefc85ed41b8fa3 Closes-Bug: #1771137 --- nova/tests/unit/virt/xenapi/test_vm_utils.py | 4 ++-- nova/virt/xenapi/vm_utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nova/tests/unit/virt/xenapi/test_vm_utils.py b/nova/tests/unit/virt/xenapi/test_vm_utils.py index 3bec9f9a3d..5774cddd6c 100644 --- a/nova/tests/unit/virt/xenapi/test_vm_utils.py +++ b/nova/tests/unit/virt/xenapi/test_vm_utils.py @@ -353,7 +353,7 @@ class ResizeHelpersTestCase(VMUtilsTestBase): mock_fsck.assert_has_calls([ mock.call(partition_path)]) mock_resize2fs.assert_has_calls([ - mock.call(partition_path, None, size='10s')]) + mock.call(partition_path, [0], size='10s')]) mock_resize.assert_has_calls([ mock.call(dev_path, 0, 9, True)]) mock_disable_journal.assert_has_calls([ @@ -408,7 +408,7 @@ class ResizeHelpersTestCase(VMUtilsTestBase): mock_fsck.assert_has_calls([ mock.call(partition_path)]) mock_resize2fs.assert_has_calls([ - mock.call(partition_path, None)]) + mock.call(partition_path, [0])]) mock_resize.assert_has_calls([ mock.call(dev_path, 0, 29, False)]) mock_disable_journal.assert_has_calls([ diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py index 4110e9135c..9bad2cdc70 100644 --- a/nova/virt/xenapi/vm_utils.py +++ b/nova/virt/xenapi/vm_utils.py @@ -2294,7 +2294,7 @@ def _resize_part_and_fs(dev, start, old_sectors, new_sectors, flags): if new_sectors < old_sectors: # Resizing down, resize filesystem before partition resize try: - nova.privsep.fs.resize2fs(partition_path, None, size='%ds' % size) + nova.privsep.fs.resize2fs(partition_path, [0], size='%ds' % size) except processutils.ProcessExecutionError as exc: LOG.error(six.text_type(exc)) reason = _("Shrinking the filesystem down with resize2fs " @@ -2307,7 +2307,7 @@ def _resize_part_and_fs(dev, start, old_sectors, new_sectors, flags): if new_sectors > old_sectors: # Resizing up, resize filesystem after partition resize - nova.privsep.fs.resize2fs(partition_path, None) + nova.privsep.fs.resize2fs(partition_path, [0]) # Add back journal nova.privsep.fs.ext_journal_enable(partition_path)