[libvirt] [PATCH v2 5/9] test: Implement snapshot create/delete/revert APIs

Eric Blake eblake at redhat.com
Fri Aug 30 19:17:18 UTC 2013


On 08/30/2013 10:03 AM, Cole Robinson wrote:
> Again stolen from qemu_driver.c, but dropping all the unneeded bits.
> This aims to copy all the current qemu validation checks since that's
> the most commonly used real driver, but some of the checks are
> completely artificial in the test driver.
> 
> This only supports creation of internal snapshots for initial
> simplicity.
> ---
>  src/conf/domain_conf.c |   3 +-
>  src/test/test_driver.c | 504 ++++++++++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 505 insertions(+), 2 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index f8fbf79..c67d14d 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -13408,7 +13408,8 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
>                         virArchToString(src->os.arch));
>          return false;
>      }
> -    if (STRNEQ(src->os.machine, dst->os.machine)) {
> +    if (src->os.machine && dst->os.machine &&
> +        STRNEQ(src->os.machine, dst->os.machine)) {

Wouldn't STRNEQ_NULLABLE() work better here (to make sure that if
os.machine is omitted in one place, it is omitted in both)?

> +
> +    /*
> +     * REDEFINE + CURRENT: Not implemented yet
> +     * DISK_ONLY: Not implemented yet
> +     * REUSE_EXT: Not implemented yet
> +     *
> +     * NO_METADATA: Explicitly not implemented
> +     *
> +     * HALT: Implemented
> +     * QUIESCE: Nothing to do
> +     * ATOMIC: Nothing to do
> +     * LIVE: Nothing to do
> +     */
> +    virCheckFlags(
> +        VIR_DOMAIN_SNAPSHOT_CREATE_HALT |
> +        VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE |
> +        VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC |
> +        VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, NULL);

Very handy breakdown explaining your choices.  It sounds like your
intent is that test:/// snapshots _always_ have metadata (since there is
no side effects of modifying disk images, so metadata is the only thing
that actually tracks a test snapshot).

Looks like a decent skimmed down version of qemu, and should be very
useful for testing purposes.  ACK post-1.1.2 (with appropriate touchups
to the list of when things are added).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list