On 04/02/2018 10:18 AM, Brijesh Singh wrote: > From: Xiaogang Chen <Xiaogang.Chen@xxxxxxx> > > Update qemuxml2xmltest, genericxml2xmltest and qemuxml2argvtest to include > sev specific tag, a typical SEV specific tag looks like > > <launch-security type='sev> > <cbitpos>47</cbitpos> > <reduced-phys-bits>1</reduced-phys-bits> > <policy>1</policy> > </launch-security> > > Signed-off-by: Xiaogang Chen <Xiaogang.Chen@xxxxxxx> > Signed-off-by: Brijesh Singh <brijesh.singh@xxxxxxx> > --- > tests/genericxml2xmlindata/sev.xml | 20 +++++++++++++++++++ > tests/genericxml2xmloutdata/sev.xml | 22 +++++++++++++++++++++ > tests/genericxml2xmltest.c | 2 ++ > tests/qemuxml2argvdata/sev.args | 24 +++++++++++++++++++++++ > tests/qemuxml2argvdata/sev.xml | 35 +++++++++++++++++++++++++++++++++ > tests/qemuxml2argvtest.c | 2 ++ > tests/qemuxml2xmloutdata/sev.xml | 39 +++++++++++++++++++++++++++++++++++++ > tests/qemuxml2xmltest.c | 2 ++ > 8 files changed, 146 insertions(+) > create mode 100644 tests/genericxml2xmlindata/sev.xml > create mode 100644 tests/genericxml2xmloutdata/sev.xml > create mode 100644 tests/qemuxml2argvdata/sev.args > create mode 100644 tests/qemuxml2argvdata/sev.xml > create mode 100644 tests/qemuxml2xmloutdata/sev.xml > I think the .args part of this can be merged into patch 5 using the launch-security-sev.args name. Of course you'll have to include the : dh-cert-file=/tmp/lib/domain--1-QEMUGuest1/dh_cert.base64,\ session-file=/tmp/lib/domain--1-QEMUGuest1/session.base64 In the output too, but that'll be obvious... John > diff --git a/tests/genericxml2xmlindata/sev.xml b/tests/genericxml2xmlindata/sev.xml > new file mode 100644 > index 0000000..aeb0c6a > --- /dev/null > +++ b/tests/genericxml2xmlindata/sev.xml > @@ -0,0 +1,20 @@ > +<domain type='kvm'> > + <name>QEMUGuest1</name> > + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> > + <memory unit='KiB'>219100</memory> > + <currentMemory unit='KiB'>219100</currentMemory> > + <vcpu placement='static'>1</vcpu> > + <os> > + <type arch='x86_64' machine='pc-1.0'>hvm</type> > + <boot dev='hd'/> > + </os> > + <clock offset='utc'/> > + <on_poweroff>destroy</on_poweroff> > + <on_reboot>restart</on_reboot> > + <on_crash>destroy</on_crash> > + <launch-security type='sev'> > + <cbitpos>47</cbitpos> > + <reduced-phys-bits>1</reduced-phys-bits> > + <policy>1</policy> > + </launch-security> > +</domain> > diff --git a/tests/genericxml2xmloutdata/sev.xml b/tests/genericxml2xmloutdata/sev.xml > new file mode 100644 > index 0000000..70065b8 > --- /dev/null > +++ b/tests/genericxml2xmloutdata/sev.xml > @@ -0,0 +1,22 @@ > +<domain type='kvm'> > + <name>QEMUGuest1</name> > + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> > + <memory unit='KiB'>219100</memory> > + <currentMemory unit='KiB'>219100</currentMemory> > + <vcpu placement='static'>1</vcpu> > + <os> > + <type arch='x86_64' machine='pc-1.0'>hvm</type> > + <boot dev='hd'/> > + </os> > + <clock offset='utc'/> > + <on_poweroff>destroy</on_poweroff> > + <on_reboot>restart</on_reboot> > + <on_crash>destroy</on_crash> > + <devices> > + </devices> > + <launch-security type='sev'> > + <cbitpos>47</cbitpos> > + <reduced-phys-bits>1</reduced-phys-bits> > + <policy>1</policy> > + </launch-security> > +</domain> > diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c > index d8270a6..3b75b43 100644 > --- a/tests/genericxml2xmltest.c > +++ b/tests/genericxml2xmltest.c > @@ -141,6 +141,8 @@ mymain(void) > DO_TEST_FULL("cachetune-colliding-types", false, true, > TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); > > + DO_TEST_DIFFERENT("sev"); > + > virObjectUnref(caps); > virObjectUnref(xmlopt); > > diff --git a/tests/qemuxml2argvdata/sev.args b/tests/qemuxml2argvdata/sev.args > new file mode 100644 > index 0000000..312dbcf > --- /dev/null > +++ b/tests/qemuxml2argvdata/sev.args > @@ -0,0 +1,24 @@ > +LC_ALL=C \ > +PATH=/bin \ > +HOME=/home/test \ > +USER=test \ > +LOGNAME=test \ > +QEMU_AUDIO_DRV=none \ > +/usr/bin/qemu-system-x86_64 \ > +-name QEMUGuest1 \ > +-S \ > +-machine pc-1.0,accel=kvm,memory-encryption=sev0 \ > +-m 214 \ > +-smp 1,sockets=1,cores=1,threads=1 \ > +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ > +-nographic \ > +-nodefaults \ > +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ > +server,nowait \ > +-mon chardev=charmonitor,id=monitor,mode=readline \ > +-no-acpi \ > +-boot c \ > +-usb \ > +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ > +-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ > +-object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=1,policy=0x1 > diff --git a/tests/qemuxml2argvdata/sev.xml b/tests/qemuxml2argvdata/sev.xml > new file mode 100644 > index 0000000..2476b58 > --- /dev/null > +++ b/tests/qemuxml2argvdata/sev.xml > @@ -0,0 +1,35 @@ > +<domain type='kvm'> > + <name>QEMUGuest1</name> > + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> > + <memory unit='KiB'>219100</memory> > + <currentMemory unit='KiB'>219100</currentMemory> > + <vcpu placement='static'>1</vcpu> > + <os> > + <type arch='x86_64' machine='pc-1.0'>hvm</type> > + <boot dev='hd'/> > + </os> > + <clock offset='utc'/> > + <on_poweroff>destroy</on_poweroff> > + <on_reboot>restart</on_reboot> > + <on_crash>destroy</on_crash> > + <devices> > + <emulator>/usr/bin/qemu-system-x86_64</emulator> > + <disk type='block' device='disk'> > + <driver name='qemu' type='raw'/> > + <source dev='/dev/HostVG/QEMUGuest1'/> > + <target dev='hda' bus='ide'/> > + <address type='drive' controller='0' bus='0' target='0' unit='0'/> > + </disk> > + <controller type='usb' index='0'/> > + <controller type='ide' index='0'/> > + <controller type='pci' index='0' model='pci-root'/> > + <input type='mouse' bus='ps2'/> > + <input type='keyboard' bus='ps2'/> > + <memballoon model='none'/> > + </devices> > + <launch-security type='sev'> > + <cbitpos>47</cbitpos> > + <reduced-phys-bits>1</reduced-phys-bits> > + <policy>1</policy> > + </launch-security> > +</domain> > diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c > index 308d71f..de0ac58 100644 > --- a/tests/qemuxml2argvtest.c > +++ b/tests/qemuxml2argvtest.c > @@ -3023,6 +3023,8 @@ mymain(void) > QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW, > QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW); > > + DO_TEST("sev", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_KVM, QEMU_CAPS_SEV_GUEST); > + > if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL) > virFileDeleteTree(fakerootdir); > > diff --git a/tests/qemuxml2xmloutdata/sev.xml b/tests/qemuxml2xmloutdata/sev.xml > new file mode 100644 > index 0000000..80017fe > --- /dev/null > +++ b/tests/qemuxml2xmloutdata/sev.xml > @@ -0,0 +1,39 @@ > +<domain type='kvm'> > + <name>QEMUGuest1</name> > + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> > + <memory unit='KiB'>219100</memory> > + <currentMemory unit='KiB'>219100</currentMemory> > + <vcpu placement='static'>1</vcpu> > + <os> > + <type arch='x86_64' machine='pc-1.0'>hvm</type> > + <boot dev='hd'/> > + </os> > + <clock offset='utc'/> > + <on_poweroff>destroy</on_poweroff> > + <on_reboot>restart</on_reboot> > + <on_crash>destroy</on_crash> > + <devices> > + <emulator>/usr/bin/qemu-system-x86_64</emulator> > + <disk type='block' device='disk'> > + <driver name='qemu' type='raw'/> > + <source dev='/dev/HostVG/QEMUGuest1'/> > + <target dev='hda' bus='ide'/> > + <address type='drive' controller='0' bus='0' target='0' unit='0'/> > + </disk> > + <controller type='usb' index='0'> > + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> > + </controller> > + <controller type='ide' index='0'> > + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> > + </controller> > + <controller type='pci' index='0' model='pci-root'/> > + <input type='mouse' bus='ps2'/> > + <input type='keyboard' bus='ps2'/> > + <memballoon model='none'/> > + </devices> > + <launch-security type='sev'> > + <cbitpos>47</cbitpos> > + <reduced-phys-bits>1</reduced-phys-bits> > + <policy>1</policy> > + </launch-security> > +</domain> > diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c > index 0f56029..328ef66 100644 > --- a/tests/qemuxml2xmltest.c > +++ b/tests/qemuxml2xmltest.c > @@ -1265,6 +1265,8 @@ mymain(void) > DO_TEST_STATUS("modern"); > DO_TEST_STATUS("migration-out-nbd"); > > + DO_TEST("sev", NONE); > + > if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL) > virFileDeleteTree(fakerootdir); > > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list