[libvirt] [PATCH 5/5] snapshot: Add tests of virsh -c test:///default snapshot*

Eric Blake eblake at redhat.com
Wed Mar 27 15:11:34 UTC 2019


On 3/27/19 10:02 AM, Daniel P. Berrangé wrote:
> On Sat, Mar 23, 2019 at 11:02:03PM -0500, Eric Blake wrote:
>> Had this been in place earlier, I would have avoided the bugs in
>> commit 0baf6945 and 55c2ab3e. Writing the test required me to extend
>> the power of virsh - creating enough snapshots to cause fanout
>> requires enough input in a single session that adding comments and
>> markers makes it easier to check that output is correct. It's still a
>> bit odd that with test:///default, reverting to a snapshot changes the
>> domain from running to paused (possibly a bug in how the test driver
>> copied from the qemu driver) - but the important part is that the test
>> is reproducible, and any future tweaks we make to snapshot code have
>> less chance of breaking successful command sequences.
>>
>> Signed-off-by: Eric Blake <eblake at redhat.com>
>> ---
>>  tests/Makefile.am    |   3 +-
>>  tests/virsh-snapshot | 212 +++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 214 insertions(+), 1 deletion(-)
>>  create mode 100755 tests/virsh-snapshot
> 
> This has an unfortunate side-effect. When run it will try to create
> $HOME/.cache/libvirt/virsh
> 
> This fails if $HOME is not writable - eg running in docker, where
> only the VPATH build dir is writable, nothing else:
> 
> FAIL: virsh-snapshot
> ====================
> --- exp	2019-03-27 13:27:56.956469010 +0000
> +++ err	2019-03-27 13:27:56.952467010 +0000
> @@ -1,2 +1,3 @@
>  error: invalid argument: parent s3 for snapshot s2 not found
>  error: marker
> +error: Failed to create '/home/travis/.cache/libvirt/virsh': Permission denied
> FAIL virsh-snapshot (exit status: 1)
> 
> I'm not sure the right answer for this
> 
>  - Require $HOME to be writable

I don't want to force this on our docker and other CI environments, but
we can do it via:

>  - Set a fake $HOME under $VPATH (but this won't match /etc/passwd)

This seems reasonable enough; could even be done as part of the
virsh-snapshot test in isolation rather than globally in the Makefile
for all tests.  POSIX does not require HOME to stay constant, or to
always match getent output (of course, when HOME and getent disagree,
it's easier to get confused - but as long as we document it, we should
be okay).

>  - Don't treat this as fatal

This also seems nice - a cache is just that, after all; and failure to
have a cache just means slower performance, but shouldn't mean extra
noise.  Since my test broke it, I'll play with ways to get rid of it
before DV cuts the -rc2 build later this week.

What is virsh trying to store in the cache, anyway? Is there a way to
run virsh with a command line flag that says no caching is desired, so
we don't even have to worry about where HOME points or whether it is
writable?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190327/116818f0/attachment-0001.sig>


More information about the libvir-list mailing list