From 83b1fc6c589b9791a90b1a5256cb3ac2debf8bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 10 May 2020 03:39:10 +0200 Subject: [PATCH] tools/qvm-volume import: do not retrieve old size anymore Since admin.vm.volume.ImportWithSize method is used now, there is no need to retrieve old size anymore (to decide whether to resize or not). --- qubesadmin/tests/tools/qvm_volume.py | 55 ---------------------------- qubesadmin/tools/qvm_volume.py | 1 - 2 files changed, 56 deletions(-) diff --git a/qubesadmin/tests/tools/qvm_volume.py b/qubesadmin/tests/tools/qvm_volume.py index a73f50c..feefe5d 100644 --- a/qubesadmin/tests/tools/qvm_volume.py +++ b/qubesadmin/tests/tools/qvm_volume.py @@ -496,17 +496,6 @@ class TC_00_qvm_volume(qubesadmin.tests.QubesTestCase): self.app.expected_calls[ ('testvm', 'admin.vm.volume.List', None, None)] = \ b'0\x00root\nprivate\n' - self.app.expected_calls[ - ('testvm', 'admin.vm.volume.Info', 'private', None)] = \ - b'0\x00pool=lvm\n' \ - b'vid=qubes_dom0/vm-testvm-private\n' \ - b'size=2147483648\n' \ - b'usage=10000000\n' \ - b'rw=True\n' \ - b'save_on_stop=True\n' \ - b'snap_on_start=False\n' \ - b'revisions_to_keep=0\n' \ - b'is_outdated=False\n' self.app.expected_calls[ ('testvm', 'admin.vm.volume.ImportWithSize', 'private', b'9\ntest-data')] = \ b'0\x00' @@ -526,17 +515,6 @@ class TC_00_qvm_volume(qubesadmin.tests.QubesTestCase): self.app.expected_calls[ ('testvm', 'admin.vm.volume.List', None, None)] = \ b'0\x00root\nprivate\n' - self.app.expected_calls[ - ('testvm', 'admin.vm.volume.Info', 'private', None)] = \ - b'0\x00pool=lvm\n' \ - b'vid=qubes_dom0/vm-testvm-private\n' \ - b'size=2147483648\n' \ - b'usage=10000000\n' \ - b'rw=True\n' \ - b'save_on_stop=True\n' \ - b'snap_on_start=False\n' \ - b'revisions_to_keep=0\n' \ - b'is_outdated=False\n' self.app.expected_calls[ ('testvm', 'admin.vm.volume.ImportWithSize', 'private', b'9\ntest-data')] = \ b'0\x00' @@ -557,17 +535,6 @@ class TC_00_qvm_volume(qubesadmin.tests.QubesTestCase): self.app.expected_calls[ ('testvm', 'admin.vm.volume.List', None, None)] = \ b'0\x00root\nprivate\n' - self.app.expected_calls[ - ('testvm', 'admin.vm.volume.Info', 'private', None)] = \ - b'0\x00pool=lvm\n' \ - b'vid=qubes_dom0/vm-testvm-private\n' \ - b'size=2147483648\n' \ - b'usage=10000000\n' \ - b'rw=True\n' \ - b'save_on_stop=True\n' \ - b'snap_on_start=False\n' \ - b'revisions_to_keep=0\n' \ - b'is_outdated=False\n' self.app.expected_calls[ ('testvm', 'admin.vm.volume.ImportWithSize', 'private', b'512\ntest-data')] = \ b'0\x00' @@ -587,17 +554,6 @@ class TC_00_qvm_volume(qubesadmin.tests.QubesTestCase): self.app.expected_calls[ ('testvm', 'admin.vm.volume.List', None, None)] = \ b'0\x00root\nprivate\n' - self.app.expected_calls[ - ('testvm', 'admin.vm.volume.Info', 'private', None)] = \ - b'0\x00pool=lvm\n' \ - b'vid=qubes_dom0/vm-testvm-private\n' \ - b'size=2147483648\n' \ - b'usage=10000000\n' \ - b'rw=True\n' \ - b'save_on_stop=True\n' \ - b'snap_on_start=False\n' \ - b'revisions_to_keep=0\n' \ - b'is_outdated=False\n' self.app.expected_calls[ ('testvm', 'admin.vm.volume.Import', 'private', b'test-data')] = \ b'0\x00' @@ -617,17 +573,6 @@ class TC_00_qvm_volume(qubesadmin.tests.QubesTestCase): self.app.expected_calls[ ('testvm', 'admin.vm.volume.List', None, None)] = \ b'0\x00root\nprivate\n' - self.app.expected_calls[ - ('testvm', 'admin.vm.volume.Info', 'private', None)] = \ - b'0\x00pool=lvm\n' \ - b'vid=qubes_dom0/vm-testvm-private\n' \ - b'size=9\n' \ - b'usage=1\n' \ - b'rw=True\n' \ - b'save_on_stop=True\n' \ - b'snap_on_start=False\n' \ - b'revisions_to_keep=0\n' \ - b'is_outdated=False\n' self.app.expected_calls[ ('testvm', 'admin.vm.volume.ImportWithSize', 'private', b'9\ntest-data')] = \ b'0\x00' diff --git a/qubesadmin/tools/qvm_volume.py b/qubesadmin/tools/qvm_volume.py index 5ed77d1..ef10ab2 100644 --- a/qubesadmin/tools/qvm_volume.py +++ b/qubesadmin/tools/qvm_volume.py @@ -137,7 +137,6 @@ def import_volume(args): ''' Import a file into volume ''' volume = args.volume - old_size = volume.size input_path = args.input_path if input_path == '-': input_file = sys.stdin.buffer