• E
    snapshot: Drop virDomainSnapshotDef.current · f1056279
    Eric Blake 提交于
    The only use for the 'current' member of virDomainSnapshotDef was with
    the PARSE/FORMAT_INTERNAL flag for controlling an internal-use
    <active> element marking whether a particular snapshot definition was
    current, and even then, only by the qemu driver on output, and by qemu
    and test driver on input. But this duplicates vm->snapshot_current,
    and gets in the way of potential simplifications to have qemu store a
    single file for all snapshots rather than one file per snapshot.  Get
    rid of the member by adding a bool* parameter during parse (ignored if
    the PARSE_INTERNAL flag is not set), and by adding a new flag during
    format (if FORMAT_INTERNAL is set, the value printed in <active>
    depends on the new FORMAT_CURRENT).
    
    Then update the qemu driver accordingly, which involves hoisting
    assignments to vm->current_snapshot to occur prior to any point where
    a snapshot XML file is written (although qemu kept
    vm->current_snapshot and snapshot->def_current in sync by the end of
    the function, they were not always identical in the middle of
    functions, so the shuffling gets a bit interesting). Later patches
    will clean up some of that confusing churn to vm->current_snapshot.
    
    Note: even if later patches refactor qemu to no longer use
    FORMAT_INTERNAL for output (by storing bulk snapshot XML instead), we
    will always need PARSE_INTERNAL for input (because on upgrade, a new
    libvirt still has to parse XML left from a previous libvirt).
    Signed-off-by: NEric Blake <eblake@redhat.com>
    Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
    f1056279
qemu_domain.c 430.1 KB