Browse Source

Merge "Use compression by default for 'SshDriver'"

changes/42/724842/7
Zuul 1 week ago
committed by Gerrit Code Review
parent
commit
49c3ac7dfa
2 changed files with 16 additions and 3 deletions
  1. +10
    -0
      nova/tests/unit/virt/libvirt/volume/test_remotefs.py
  2. +6
    -3
      nova/virt/libvirt/volume/remotefs.py

+ 10
- 0
nova/tests/unit/virt/libvirt/volume/test_remotefs.py View File

@@ -171,6 +171,16 @@ class RemoteFSTestCase(test.NoDBTestCase):
def test_remote_copy_file_ssh(self, mock_execute):
remotefs.SshDriver().copy_file('1.2.3.4:/home/SpaceOdyssey',
'/home/favourite', None, None, True)
mock_execute.assert_called_once_with('scp', '-C', '-r',
'1.2.3.4:/home/SpaceOdyssey',
'/home/favourite',
on_completion=None,
on_execute=None)

@mock.patch('oslo_concurrency.processutils.execute')
def test_remote_copy_file_ssh__without_compression(self, mock_execute):
remotefs.SshDriver().copy_file('1.2.3.4:/home/SpaceOdyssey',
'/home/favourite', None, None, False)
mock_execute.assert_called_once_with('scp', '-r',
'1.2.3.4:/home/SpaceOdyssey',
'/home/favourite',


+ 6
- 3
nova/virt/libvirt/volume/remotefs.py View File

@@ -190,10 +190,13 @@ class SshDriver(RemoteFilesystemDriver):
on_execute=on_execute, on_completion=on_completion)

def copy_file(self, src, dst, on_execute, on_completion, compression):
args = ['scp']
if compression:
args.append('-C')
# As far as ploop disks are in fact directories we add '-r' argument
processutils.execute('scp', '-r', src, dst,
on_execute=on_execute,
on_completion=on_completion)
args.extend(['-r', src, dst])
processutils.execute(
*args, on_execute=on_execute, on_completion=on_completion)


class RsyncDriver(RemoteFilesystemDriver):


Loading…
Cancel
Save