On Tue, Dec 29, 2020 at 15:21:29 -0600, Ryan Gahagan wrote: > Signed-off-by: Ryan Gahagan <rgahagan@xxxxxxxxxxxxx> > --- > tests/qemuxml2argvdata/disk-network-nfs.args | 1 + > .../disk-network-nfs.x86_64-latest.args | 56 +++++++++++++++++++ > tests/qemuxml2argvdata/disk-network-nfs.xml | 48 ++++++++++++++++ > tests/qemuxml2argvtest.c | 1 + > ...isk-network-nfs-inactive.x86_64-latest.xml | 54 ++++++++++++++++++ > .../disk-network-nfs.x86_64-latest.xml | 54 ++++++++++++++++++ > tests/qemuxml2xmltest.c | 1 + > tests/virstoragetest.c | 13 +++++ > 8 files changed, 228 insertions(+) > create mode 100644 tests/qemuxml2argvdata/disk-network-nfs.args > create mode 100644 tests/qemuxml2argvdata/disk-network-nfs.x86_64-latest.args > create mode 100644 tests/qemuxml2argvdata/disk-network-nfs.xml > create mode 100644 tests/qemuxml2xmloutdata/disk-network-nfs-inactive.x86_64-latest.xml > create mode 100644 tests/qemuxml2xmloutdata/disk-network-nfs.x86_64-latest.xml > > diff --git a/tests/qemuxml2argvdata/disk-network-nfs.args b/tests/qemuxml2argvdata/disk-network-nfs.args > new file mode 100644 > index 0000000000..fdc2941925 > --- /dev/null > +++ b/tests/qemuxml2argvdata/disk-network-nfs.args > @@ -0,0 +1 @@ > +qemu_nfs This file is not used by the tests, drop it. [...] > diff --git a/tests/qemuxml2argvdata/disk-network-nfs.xml b/tests/qemuxml2argvdata/disk-network-nfs.xml > new file mode 100644 > index 0000000000..67d2843e01 > --- /dev/null > +++ b/tests/qemuxml2argvdata/disk-network-nfs.xml > @@ -0,0 +1,48 @@ > +<domain type='qemu'> > + <name>QEMUGuest1</name> > + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> > + <memory unit='KiB'>219136</memory> > + <currentMemory unit='KiB'>219136</currentMemory> > + <vcpu placement='static'>1</vcpu> > + <os> > + <type arch='i686' machine='pc'>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='network' device='disk'> > + <driver name='qemu' type='raw' cache='none'/> > + <source protocol='nfs' name='/foo/bar/baz'> > + <host name='example.com' port='2049'/> 'port' can't be controlled so you shouldn't add it into the XML. > + <nfs user='+6234' group='+12354'/> > + </source> > + <target dev='vda' bus='virtio'/> > + <serial>eb90327c-8302-4725-9e1b-4e85ed4dc251</serial> > + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> > + </disk> > + <disk type='network' device='disk'> > + <driver name='qemu' type='qcow2'/> > + <source protocol='gluster' name='Volume2/Image'> > + <host transport='unix' socket='/path/to/sock'/> > + </source> > + <backingStore type='network' index='1'> > + <format type='qcow2'/> > + <source protocol='nfs' name='/backing/store/nfs'> > + <host name='example.org'/> > + <nfs user='+1234' group='+5678'/> > + </source> > + <backingStore/> > + </backingStore> > + <target dev='vdb' bus='virtio'/> > + </disk> > + <controller type='usb' index='0'/> > + <controller type='pci' index='0' model='pci-root'/> > + <input type='mouse' bus='ps2'/> > + <input type='keyboard' bus='ps2'/> > + <memballoon model='none'/> > + </devices> > +</domain> [...] > diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c > index 2e466ecb99..08e2723235 100644 > --- a/tests/virstoragetest.c > +++ b/tests/virstoragetest.c > @@ -1630,6 +1630,19 @@ mymain(void) > "<source protocol='vxhs' name='c6718f6b-0401-441d-a8c3-1f0064d75ee0'>\n" > " <host name='example.com' port='9999'/>\n" > "</source>\n"); > + TEST_BACKING_PARSE("json:{\"file\":{\"driver\":\"nfs\"," > + "\"user\":2," > + "\"group\":9," > + "\"path\":\"/foo/bar/baz\"," > + "\"server\": { \"host\":\"example.com\"," > + "\"port\":\"2049\"" 'port' contradicts the QMP schema, so this snippet is wrong. Also the transporrt type is missing. As noted in the patch adding the backing store parser code, this also belongs to that patch. > + "}" > + "}" > + "}", > + "<source protocol='nfs' name='/foo/bar/baz'>\n" > + " <host name='example.com' port='2049'/>\n" > + " <nfs user='+2' group='+9'/>\n" > + "</source>\n"); > TEST_BACKING_PARSE_FULL("json:{ \"driver\": \"raw\"," > "\"offset\": 10752," > "\"size\": 4063232," > -- > 2.29.2 >