summaryrefslogtreecommitdiffstats
path: root/tests/acceptance/avocado_qemu
diff options
context:
space:
mode:
authorCleber Rosa2021-04-12 06:46:38 +0200
committerJohn Snow2021-06-01 22:21:20 +0200
commit54914114aff5008b58d3cf01bf9e2274144875ca (patch)
treed18591721aa2905a94ec36dcb9e62089b2a967bb /tests/acceptance/avocado_qemu
parentAcceptance Tests: move useful ssh methods to base class (diff)
downloadqemu-54914114aff5008b58d3cf01bf9e2274144875ca.tar.gz
qemu-54914114aff5008b58d3cf01bf9e2274144875ca.tar.xz
qemu-54914114aff5008b58d3cf01bf9e2274144875ca.zip
Acceptance Tests: add port redirection for ssh by default
For users of the LinuxTest class, let's set up the VM with the port redirection for SSH, instead of requiring each test to set the same arguments. It also sets the network device, by default, to virtio-net. Signed-off-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Message-Id: <20210412044644.55083-6-crosa@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'tests/acceptance/avocado_qemu')
-rw-r--r--tests/acceptance/avocado_qemu/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 67f75f66e5..0856880000 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -309,10 +309,13 @@ class LinuxTest(Test, LinuxSSHMixIn):
timeout = 900
chksum = None
- def setUp(self, ssh_pubkey=None):
+ def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
super(LinuxTest, self).setUp()
self.vm.add_args('-smp', '2')
self.vm.add_args('-m', '1024')
+ # The following network device allows for SSH connections
+ self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22',
+ '-device', '%s,netdev=vnet' % network_device_type)
self.set_up_boot()
if ssh_pubkey is None:
ssh_pubkey, self.ssh_key = self.set_up_existing_ssh_keys()