• E
    snapshot: Don't expose testsuite-only state in snapshot XML · a007fcab
    Eric Blake 提交于
    None of the existing drivers actually use the 0-valued 'nostate'
    snapshot state; rather, it was a fluke of implementation. In fact,
    some drivers, like qemu, actively reject 'nostate' as invalid during a
    snapshot redefine. Normally, a driver computes the state post-parse
    from the current domain, and thus virDomainSnapshotGetXMLDesc() will
    never expose the state. However, since the testsuite lacks any
    associated domain to copy state from, and lacks post-parse processing
    that normal drivers have, the testsuite output had several spots with
    the state, coupled with a regex filter to ignore the oddity.
    
    It is better to follow the lead of other XML defaults, by not
    outputting anything during format if post-parse defaults have not been
    applied, and rejecting the default value during parsing. The testsuite
    needs a bit of an update, by adding another flag for when to simulate
    a post-parse action of setting a snapshot state, but none of the
    drivers are impacted other than rejecting XML that was previously
    already suspicious in nature.
    
    Similarly, don't expose creation time 0 (for now, only possible if a
    user redefined a snapshot to claim creation at the Epoch, but also
    happens once setting the creation time is deferred to a post-parse
    handler).
    
    This is also a step towards cleaning up snapshot_conf.c to separate
    its existing post-parse work (namely, setting the creationTime and
    default snapshot name) from the pure parsing work, so that we can get
    rid of the testsuite hack of regex filtering of the XML and instead
    have more accurate testing of our parser/formatter code.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    Reviewed-by: NCole Robinson <crobinso@redhat.com>
    a007fcab
snapshot_conf.c 33.2 KB