render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
982648
From f10c3ad87c56db9f22cb8c1155d9355b48eebaf9 Mon Sep 17 00:00:00 2001
982648
Message-Id: <f10c3ad87c56db9f22cb8c1155d9355b48eebaf9@dist-git>
982648
From: Erik Skultety <eskultet@redhat.com>
982648
Date: Mon, 20 Aug 2018 17:18:51 +0200
982648
Subject: [PATCH] tests: sev: Test launch-security with specific QEMU version
982648
MIME-Version: 1.0
982648
Content-Type: text/plain; charset=UTF-8
982648
Content-Transfer-Encoding: 8bit
982648
982648
In order to test SEV we need real QEMU capabilities. Ideally, this would
982648
be tested with -latest capabilities, however, our capabilities are
982648
currently tied to Intel HW, even the 2.12.0 containing SEV were edited by
982648
hand, so we can only use that one for now, as splitting the capabilities
982648
according to the vendor is a refactor for another day. The need for real
982648
capabilities comes from the extended SEV platform data (PDH, cbitpos,
982648
etc.) we'll need to cache/parse.
982648
982648
Signed-off-by: Erik Skultety <eskultet@redhat.com>
982648
Acked-by: Peter Krempa <pkrempa@redhat.com>
982648
(cherry picked from commit 6c50cef8a3e4e3407fb42a713a353e42ae3f2bc6)
982648
982648
https://bugzilla.redhat.com/show_bug.cgi?id=1612009
982648
https://bugzilla.redhat.com/show_bug.cgi?id=1619150
982648
982648
Signed-off-by: Erik Skultety <eskultet@redhat.com>
982648
982648
 Conflicts:
982648
	tests/qemuxml2argvdata/launch-security-sev.x86_64-2.12.0.args
982648
            - this wasn't a 100% clean file rename and git doesn't like
982648
            that
982648
982648
Reviewed-by: Ján Tomko <jtomko@redhat.com>
982648
---
982648
 ...=> launch-security-sev.x86_64-2.12.0.args} | 19 ++++++++++++-------
982648
 tests/qemuxml2argvtest.c                      |  4 +---
982648
 2 files changed, 13 insertions(+), 10 deletions(-)
982648
 rename tests/qemuxml2argvdata/{launch-security-sev.args => launch-security-sev.x86_64-2.12.0.args} (54%)
982648
982648
diff --git a/tests/qemuxml2argvdata/launch-security-sev.args b/tests/qemuxml2argvdata/launch-security-sev.x86_64-2.12.0.args
982648
similarity index 54%
982648
rename from tests/qemuxml2argvdata/launch-security-sev.args
982648
rename to tests/qemuxml2argvdata/launch-security-sev.x86_64-2.12.0.args
982648
index db0be1a27d..6da068e1a5 100644
982648
--- a/tests/qemuxml2argvdata/launch-security-sev.args
982648
+++ b/tests/qemuxml2argvdata/launch-security-sev.x86_64-2.12.0.args
982648
@@ -5,25 +5,30 @@ USER=test \
982648
 LOGNAME=test \
982648
 QEMU_AUDIO_DRV=none \
982648
 /usr/bin/qemu-system-x86_64 \
982648
--name QEMUGuest1 \
982648
+-name guest=QEMUGuest1,debug-threads=on \
982648
 -S \
982648
+-object secret,id=masterKey0,format=raw,\
982648
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
982648
 -machine pc-1.0,accel=kvm,usb=off,dump-guest-core=off,memory-encryption=sev0 \
982648
 -m 214 \
982648
+-realtime mlock=off \
982648
 -smp 1,sockets=1,cores=1,threads=1 \
982648
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
982648
 -display none \
982648
 -no-user-config \
982648
 -nodefaults \
982648
--chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
982648
-server,nowait \
982648
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
982648
 -mon chardev=charmonitor,id=monitor,mode=control \
982648
 -rtc base=utc \
982648
 -no-shutdown \
982648
 -no-acpi \
982648
--boot c \
982648
--usb \
982648
+-boot strict=on \
982648
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
982648
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
982648
--device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
982648
+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
982648
 -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=1,policy=0x1,\
982648
 dh-cert-file=/tmp/lib/domain--1-QEMUGuest1/dh_cert.base64,\
982648
-session-file=/tmp/lib/domain--1-QEMUGuest1/session.base64
982648
+session-file=/tmp/lib/domain--1-QEMUGuest1/session.base64 \
982648
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
982648
+resourcecontrol=deny \
982648
+-msg timestamp=on
982648
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
982648
index e6c0120670..02bb9889ee 100644
982648
--- a/tests/qemuxml2argvtest.c
982648
+++ b/tests/qemuxml2argvtest.c
982648
@@ -2950,9 +2950,7 @@ mymain(void)
982648
     DO_TEST_CAPS_LATEST("vhost-vsock");
982648
     DO_TEST_CAPS_LATEST("vhost-vsock-auto");
982648
 
982648
-    DO_TEST("launch-security-sev",
982648
-            QEMU_CAPS_KVM,
982648
-            QEMU_CAPS_SEV_GUEST);
982648
+    DO_TEST_CAPS_VER("launch-security-sev", "2.12.0");
982648
 
982648
     if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
982648
         virFileDeleteTree(fakerootdir);
982648
-- 
982648
2.18.0
982648