1. 11 7月, 2019 1 次提交
    • E
      snapshot: Add VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE flag · 95f8e323
      Eric Blake 提交于
      We've been doing a terrible job of performing XML validation in our
      various API that parse XML with a corresponding schema (we started
      with domains back in commit dd69a14f, v1.2.12, but didn't catch all
      domain-related APIs, didn't document the use of the flag, and didn't
      cover other XML). New APIs (like checkpoints) should do the validation
      unconditionally, but it doesn't hurt to continue retrofitting existing
      APIs to at least allow the option.
      
      While there are many APIs that could be improved, this patch focuses
      on wiring up a new snapshot XML creation flag through all the
      hypervisors that support snapshots, as well as exposing it in 'virsh
      snapshot-create'.  For 'virsh snapshot-create-as', we blindly set the
      flag without a command-line option, since the XML we create from the
      command line should generally always comply (note that validation
      might cause failures where it used to succeed, such as if we tighten
      the RNG to reject a name of '../\n'); but blindly passing the flag
      means we also have to add in fallback code to disable validation if
      the server is too old to understand the flag.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Acked-by: NPeter Krempa <pkrempa@redhat.com>
      95f8e323
  2. 27 3月, 2019 1 次提交
    • E
      snapshot: Various doc tweaks · 1c6b6c0b
      Eric Blake 提交于
      Since I was copying this text to form checkpoint XML and API
      documentation, I might as well make improvements along the way. Most
      of these changes are based on reviews of the checkpoint docs.
      
      Among other things: grammar tweaks, point to a single source of
      documentation rather than repeating verbosity, reword things for
      easier legibility.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      1c6b6c0b
  3. 15 3月, 2019 1 次提交
    • E
      snapshot: More clarification about REDEFINE · a6a25d5c
      Eric Blake 提交于
      Based on recent list questions about the proposed addition of
      virDomainCheckpointCreateXML(REDEFINE), it is worth adding some
      clarification to the existing snapshot redefine documentation that is
      serving as the basis for checkpoints.
      
      Normal snapshot creation requires very few elements from the user XML
      (libvirt can pick sane defaults for items that are omitted, and many
      fields, including <domain>, are documented as readonly output fields
      ignored on input, produced by drivers that track it). But during
      REDEFINE, the API wants the complete XML produced by an earlier
      virDomainSnapshotGetXMLDesc; as the domain definition has likely
      changed since the snapshot was first created, libvirt is unable to
      recreate a <domain> sub-element that matches the original output
      representing the domain state at the time the snapshot was first
      created. In fact, reverting without a <domain> sub-element is risky
      enough that we had to add a FORCE flag for virDomainSnapshotRevert().
      In short, we only support omitting domain for qemu because of
      backwards-compatibility to snapshots created before 0.9.5 started
      capturing <domain>; even though there are other drivers like vbox that
      do not output <domain> because they have other reliable ways to
      revert.
      
      And based on the confusion caused when omitting <domain> from snapshot
      XML, the initial design for checkpoints in later patches will make
      <domain> a mandatory element during its REDEFINE.
      
      [Side note: the fact that <domain> can appear in <domainsnapshot> is a
      reason we cannot add a new API for a bulk listing or redefine of all
      snapshots of a single domain in one XML call (for example, a 1M
      <domain> XML * 16 snapshots explodes into 16M in a bulk form, which
      gets difficult to send over RPC). Perhaps we could add a flag to
      request that the <domain> sub-element be omitted on output, but such
      output is no longer suitable for sane REDEFINE input.]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      a6a25d5c
  4. 14 3月, 2019 1 次提交
  5. 13 3月, 2019 1 次提交
    • E
      snapshots: Add flag to guarantee topological sort · d16e5b15
      Eric Blake 提交于
      When using virDomainSnapshotCreateXML with the REDEFINE flag on
      multiple snapshot metadata XML descriptions, we require that a child
      cannot be redefined before its parent.  Since libvirt already tracks a
      DAG, it is more convenient if we can ensure that
      virDomainListAllSnapshots() and friends have a way to return data in
      an order that we can directly reuse, rather than having to
      post-process the data ourselves to reconstruct the DAG.
      
      Add VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL as our new guarantee (well, a
      guarantee at the time of the API call conclusion; there's always a
      possible TOCTTOU race where someone redefining snapshots in between
      the API results and the client actually using the list might render
      the list out-of-date). Four listing APIs are directly benefitted by
      the new flag; additionally, since we document that the older racy
      ListNames interfaces should be sized by using the same flags on their
      Num counterparts, the Num interfaces must document when they accept
      (and ignore) the flag.
      
      We could have supported the new flag just for the ListAll APIs (to
      discourage people from using the older racy Num/ListNames APIs), but
      it feels weird to special-case this flag value as being applicable to
      only a subset of the API while all other List-related flags are
      trivially applicable to all 6.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      d16e5b15
  6. 08 3月, 2019 1 次提交
  7. 27 2月, 2019 1 次提交
  8. 20 2月, 2019 1 次提交
    • E
      snapshot: Define explicit flags for snapshot xml · a27031c4
      Eric Blake 提交于
      Commit f609cb85 (0.9.5) introduced virDomainSnapshotGetXMLDesc()'s use
      of @flags as a subset of virDomainXMLFlags, documenting that 2 of the
      3 flags defined at the time would never be valid.  Later, commit
      28f8dfdc (1.0.0) introduced a new flag, VIR_DOMAIN_XML_MIGRATABLE, but
      did not adjust the snapshot documentation to declare it as invalid.
      However, since the flag is not accepted as valid by any of the
      drivers (remote is just passthrough; esx and vbox don't support flags;
      qemu, test, and vz only support VIR_DOMAIN_XML_SECURE), and it is
      unlikely that the domain state saved off during a snapshot creation
      needs to be migration-friendly (as the snapshot is not the source of
      a migration), it is easier to just define an explicit set of supported
      flags directly related to the snapshot API rather than trying to
      borrow from domain API, and risking confusion if even more domain
      flags are added later (in fact, I have an upcoming patch that plans to
      add a new flag to virDomainGetXMLDesc that makes no sense for
      snapshots).
      
      There is no API or ABI impact (since we purposefully used unsigned int
      rather than an enum type in public API, and since the new flag name
      carries the same value as the reused name).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      a27031c4
  9. 18 4月, 2018 1 次提交
  10. 25 9月, 2017 1 次提交
  11. 07 8月, 2017 1 次提交
    • D
      Remove bogus warning about vir$OBJECTGetConnect functions · 10e277a4
      Daniel P. Berrange 提交于
      The API docs for the various vir$OBJECTGetConnect functions
      contain a warning
      
        WARNING: When writing libvirt bindings in other languages, do
        not use this function.  Instead, store the connection and
        the domain object together.
      
      There is no reason why language bindings should not use this
      method, and indeed the Perl, Python, and Go bindings all use
      these methods.
      
      This warning was originally added back in
      
        commit 3edb4bc9
        Author: Daniel Veillard <veillard@redhat.com>
        Date:   Tue Jul 24 15:32:55 2007 +0000
      
          * libvirt.spec.in NEWS docs/* po/*: preparing release 0.3.1
          * src/libvirt.c python/generator.py: some cleanup and warnings
            from Richard W.M. Jones
      
      IIUC, the rational was that these APIs do not need to be
      directly exposed to the non-C language, as the language
      can expose the same concept itself by storing the original
      virConnectPtr object alongside the virDomainPtr.  There's
      no reason to mandate such an approach though - it is valid
      for languages to expose this directly if that suits their
      needs better.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      10e277a4
  12. 30 6月, 2015 1 次提交
  13. 04 5月, 2015 2 次提交
  14. 14 4月, 2015 1 次提交
    • P
      lib: snapshot: Explain that only one layer of images is inserted · d5670776
      Peter Krempa 提交于
      When creating a snapshot with _REUSE_EXTERNAL when the pre-created image
      does not directly link to the current active layer libvirt would
      re-detect the backing chain incorrectly and it would not match with
      qemu's view. Since the configuration is an operator mistake, document
      that only the top layer image gets inserted.
      d5670776
  15. 03 4月, 2015 1 次提交
  16. 24 10月, 2014 1 次提交