1. 16 4月, 2019 6 次提交
  2. 12 4月, 2019 1 次提交
  3. 22 3月, 2019 3 次提交
    • E
      snapshot: Factor out virDomainMomentDef class · ffc0fbeb
      Eric Blake 提交于
      Pull out the common parts of virDomainSnapshotDef that will be reused
      for virDomainCheckpointDef into a new base class.  Adjust all callers
      that use the direct fields (some of it is churn that disappears when
      the next patch refactors virDomainSnapshotObj; oh well...).
      
      Someday, I hope to switch this type to be a subclass of virObject, but
      that requires a more thorough audit of cleanup paths, and besides
      minimal incremental changes are easier to review.
      
      As for the choice of naming:
      I promised my teenage daughter Evelyn that I'd give her credit for her
      contribution to this commit. I asked her "What would be a good name
      for a base class for DomainSnapshot and DomainCheckpoint". After
      explaining what a base class was (using the classic OOB Square and
      Circle inherit from Shape), she came up with "DomainMoment", which is
      way better than my initial thought of "DomainPointInTime" or
      "DomainPIT".
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      ffc0fbeb
    • 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
    • E
      vbox: Clean up some snapshot usage · 063042c7
      Eric Blake 提交于
      An upcoming patch will be reworking virDomainSnapshotDef to have a
      base class; minimize the churn by using a local variable to reduce the
      number of dereferences required when acessing the domain definition
      associated with the snapshot.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      063042c7
  4. 14 3月, 2019 1 次提交
  5. 08 3月, 2019 2 次提交
    • E
      snapshot: Give virDomainSnapshotDefFormat its own flags · c5029559
      Eric Blake 提交于
      virDomainSnapshotDefFormat currently takes two sets of knobs:
      an 'unsigned int flags' argument that can currently just be
      VIR_DOMAIN_DEF_FORMAT_SECURE, and an 'int internal' argument used as
      a bool to determine whether to output an additional element.  It
      then reuses the 'flags' knob to call into virDomainDefFormatInternal(),
      which takes a different set of flags. In fact, prior to commit 0ecd6851
      (1.2.12), the 'flags' argument actually took the public
      VIR_DOMAIN_XML_SECURE, which was even more confusing.  Let's borrow
      from the style of that earlier commit, by introducing a function
      for translating from the public flags (VIR_DOMAIN_SNAPSHOT_XML_SECURE
      was just recently introduced) into a new enum specific to snapshot
      formatting, and adjust all callers to use snapshot-specific enum
      values when formatting, and where the formatter now uses a new
      variable 'domainflags' to make it obvious when we are translating
      from snapshot flags back to domain flags.  We don't even have to
      use the conversion function for drivers that don't accept the
      public VIR_DOMAIN_SNAPSHOT_XML_SECURE flag.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      c5029559
    • E
      snapshot: Rework virDomainSnapshotState enum · f43eb680
      Eric Blake 提交于
      The existing virDomainSnapshotState is a superset of virDomainState,
      adding one more state (disk-snapshot) on top of valid domain states.
      But as written, the enum cannot be used for gcc validation that all
      enum values are covered in a strongly-typed switch condition, because
      the enum does not explicitly include the values it is adding to.
      
      Copy the style used in qemu_blockjob.h of creating new enum names
      for every inherited value, and update most clients to use the new
      enum names anywhere snapshot state is referenced. The exception is
      two switch statements in qemu code, which instead gain a fixme
      comment about odd type usage (which will be cleaned up in the next
      patch). The rest of the patch is fairly mechanical (I actually did
      it by temporarily s/state/xstate/ in snapshot_conf.h to let the
      compiler find which spots in the code used the field, did the
      obvious search and replace in those functions, then undid the rename).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      f43eb680
  6. 05 3月, 2019 1 次提交
    • C
      qemu: Support scsi controller model=virtio-{non-}transitional · 448a0947
      Cole Robinson 提交于
      Add <controller type='scsi' model handling for virtio transitional
      devices. Ex:
      
        <controller type='scsi' model='virtio-transitional'/>
      
      * "virtio-transitional" maps to qemu "virtio-scsi-pci-transitional"
      * "virtio-non-transitional" maps to qemu "virtio-scsi-non-transitional"
      
      The naming here doesn't match the pre-existing model=virtio-scsi.
      The prescence of '-scsi' there seems kind of redundant as we have
      type='scsi' already, so I decided to follow the pattern of other
      patches and use virtio-transitional etc.
      Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      448a0947
  7. 20 2月, 2019 1 次提交
    • E
      domain: Fix unknown flags diagnosis in virDomainGetXMLDesc · 27c8fd74
      Eric Blake 提交于
      Many drivers had a comment that they did not validate the incoming
      'flags' to virDomainGetXMLDesc() because they were relying on
      virDomainDefFormat() to do it instead. This used to be the case
      (at least since 461e0f1a and friends in 0.9.4 added unknown flag
      checking in general), but regressed in commit 0ecd6851 (1.2.12),
      when all of the drivers were changed to pass 'flags' through the
      new helper virDomainDefFormatConvertXMLFlags(). Since this helper
      silently ignores unknown flags, we need to implement flag checking
      in each driver instead.
      
      Annoyingly, this means that any new flag values added will silently
      be ignored when targeting an older libvirt, rather than our usual
      practice of loudly diagnosing an unsupported flag.  Add comments
      in domain_conf.[ch] to remind us to be extra vigilant about the
      impact when adding flags (a new flag to add data is safe if the
      older server omitting the requested data doesn't break things in
      the newer client; a new flag to suppress data rather than enhancing
      the existing VIR_DOMAIN_XML_SECURE may form a data leak or even a
      security hole).
      
      In the qemu driver, there are multiple callers all funnelling to
      qemuDomainDefFormatBufInternal(); many of them already validated
      flags (and often only a subset of the full set of possible flags),
      but for ease of maintenance, we can also check flags at the common
      helper function.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      27c8fd74
  8. 12 2月, 2019 1 次提交
  9. 09 1月, 2019 1 次提交
  10. 14 12月, 2018 2 次提交
  11. 05 12月, 2018 1 次提交
  12. 20 9月, 2018 1 次提交
  13. 17 9月, 2018 2 次提交
  14. 12 6月, 2018 2 次提交
  15. 18 4月, 2018 1 次提交
    • M
      virobject: Introduce VIR_CLASS_NEW() macro · 10f94828
      Michal Privoznik 提交于
      So far we are repeating the following lines over and over:
      
        if (!(virSomeObjectClass = virClassNew(virClassForObject(),
                                   "virSomeObject",
                                   sizeof(virSomeObject),
                                   virSomeObjectDispose)))
            return -1;
      
      While this works, it is impossible to do some checking. Firstly,
      the class name (the 2nd argument) doesn't match the name in the
      code in all cases (the 3rd argument). Secondly, the current style
      is needlessly verbose. This commit turns example into following:
      
        if (!(VIR_CLASS_NEW(virSomeObject,
                            virClassForObject)))
            return -1;
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      10f94828
  16. 12 4月, 2018 6 次提交
  17. 05 3月, 2018 8 次提交