1. 25 4月, 2019 1 次提交
  2. 18 4月, 2019 5 次提交
  3. 17 4月, 2019 12 次提交
    • E
      snapshot: Allow for post-parse override · df2ae0d0
      Eric Blake 提交于
      Wire up the accessor functions necessary for the testsuite to install
      an alternative post-parse handler from normal drivers. I could have
      modified the signature for virDomainXMLOptionNew() to take another
      parameter, but thought it was easier to add a new set function rather
      than chase down all existing callers. Until code actually sets the
      override, there is no change in behavior.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      df2ae0d0
    • E
      snapshot: Factor out post-parse code · 5ba4d81c
      Eric Blake 提交于
      Move the non-deterministic code that sets snapshot properties
      independently of what the incoming XML described to instead live in a
      default post-parse function common to virDomainMoment (as checkpoints
      will also reuse it in later patches). This patch is just code motion,
      with no difference to any callers; but the next patch will further
      refactor things to allow for a per-driver override, used by the
      testsuite to perform deterministic post-parse actions for better
      coverage of parser/formatter code.
      
      Note that the post-parse code is intentionally not run during a
      snapshot redefine, since that code path already requires a valid
      snapshot name and creation time from the XML.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      5ba4d81c
    • 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
    • C
      conf: Add VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING · 84a5e89b
      Cole Robinson 提交于
      This requires drivers to opt in to handle the raw modelstr
      network model, all others will error if a passed in XML value
      is not in the model enum.
      
      Enable this feature for libxl/xen/xm and qemu drivers
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      84a5e89b
    • C
      vbox: Convert to net enum model · 17a1bd7e
      Cole Robinson 提交于
      Convert the vbox driver to net model enum, which requires adding
      enum values for Am79C970A, Am79C973, 82540EM, 82545EM, 82543GC. We
      preserve the same casing that vbox historically used for these model
      names.
      
      Remove the now unused virDomainNetStrcaseeqModelString
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      17a1bd7e
    • C
      vmx: convert to net model enum · 848fdabd
      Cole Robinson 提交于
      Convert the vmware/vmx driver to net model enum, which requires
      adding enum values for vlance, vmxnet, vmxnet2, and vmxnet3.
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      848fdabd
    • C
      conf: Make net model enum compare case insensitive · 79c8bc7d
      Cole Robinson 提交于
      vbox and vmx drivers do net case insensitive net model comparisons,
      so for example 'VMXNET3' and 'vmxnet3' and 'VmxNeT3' in the XML will
      translate to the same driver configuration. To convert these drivers
      to use net model enum, we will need to do case insensitive comparisons
      as well.
      
      Essentially we implement virEnumToString, but with case insensitive
      comparison. XML will always be formatted with the enum model string
      we track internally, but we will accept any case insensitive variant.
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      79c8bc7d
    • C
      qemu: Partially convert to net model enum · 41b002f9
      Cole Robinson 提交于
      This converts the qemu driver to the net model enum, for all
      the model values that we have hardcoded for various checks,
      which adds e1000e, virtio-transitional, virtio-non-transitional,
      usb-net, spapr-vlan, lan9118, smc91c111
      
      Because the qemu driver has historically also allowed the raw
      model string onto the qemu command line, this isn't a full
      conversion. Unwinding that will require more thought. However
      for all new driver code we should be adding explicit enum
      values for any model name we have special handling for.
      
      Remove the now unused virDomainNetStreqModelString
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      41b002f9
    • C
      vz: convert to net model enum · 0f835855
      Cole Robinson 提交于
      The vz driver only handles three models: virtio, e1000, and rtl8139.
      Add enum values for those models, and convert the vz driver to
      handling net->model natively
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      0f835855
    • C
      conf: net: Add model enum, and netfront value · d79a2c07
      Cole Robinson 提交于
      This adds a network model enum. The virDomainNetDef property
      is named 'model' like most other devices.
      
      When the XML parser or a driver calls NetSetModelString, if
      the passed string is in the enum, we will set net->model,
      otherwise we copy the string into net->modelstr
      
      Add a single example for the 'netfront' xen model, and wire
      that up, just to verify it's all working
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      d79a2c07
    • C
      conf: net: Rename 'model' to 'modelstr' · aa3c9f34
      Cole Robinson 提交于
      We will be adding a 'model' enum in upcoming patches. Rename
      the existing value to make the differentiation clear
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      aa3c9f34
    • C
      conf: net: Add wrapper functions for <model> value · 6bf7c676
      Cole Robinson 提交于
      To ease converting the net->model value to an enum, add
      the wrapper functions:
      
      virDomainNetGetModelString
      virDomainNetSetModelString
      virDomainNetStreqModelString
      virDomainNetStrcaseeqModelString
      Acked-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      6bf7c676
  4. 16 4月, 2019 7 次提交
  5. 12 4月, 2019 3 次提交
  6. 10 4月, 2019 6 次提交
  7. 09 4月, 2019 1 次提交
    • E
      snapshot: Fix use-after-free during snapshot delete · f66f70ac
      Eric Blake 提交于
      Commit b647d219 introduced a use-after-free situation when the caller
      is trying to delete a snapshot and its children: if the callback
      function deletes the parent, it is no longer safe to query the parent
      to learn which children also need to be deleted (where we previously
      saved deleting the parent for last).  To fix the problem, while still
      maintaining support for topological visits of callback functions, we
      have to stash off any information needed for later traversal prior to
      using a callback function (virDomainMomentForEachChild already does
      this, it is only virDomainMomentActOnDescendant that was running into
      problems).
      
      Sadly, the testsuite did not cover the problem at the time. Worse,
      even though I later added commit 280a2b41 to catch problems like
      this, and even though that test is indeed sufficient to detect the
      problem when run under valgrind or suitable MALLOC_PERTURB_ settings,
      I'm guilty of not running the test in such an environment.  Thus,
      v5.2.0 has a regression that could have been prevented had we used the
      testsuite to its full power. On the bright side, deleting snapshots
      requires ACL domain:snapshot, which is arguably as powerful as
      domain:write, so I don't think this use-after-free forms a security
      hole.
      
      At some point, it would be nice to convert virDomainMomentObj into a
      virObject, at which point, the solution is even simpler: add
      virObjectRef/Unref around the callback. But as that will require
      auditing even more places in the code, I went with the simplest patch
      for the regression fix.
      
      Fixes: b647d219Reported-by: NRoman Bogorodskiy <bogorodskiy@gmail.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Tested-by: NRoman Bogorodskiy <bogorodskiy@gmail.com>
      f66f70ac
  8. 04 4月, 2019 2 次提交
    • M
      virNWFilterBindingObjListAddLocked: Produce better error message than 'Duplicate key' · b701e45b
      Michal Privoznik 提交于
      If there are two concurrent threads, one of which is removing an
      nwfilter from the list and the other is trying to add it back they
      may serialize in the following order:
      
      1) obj->removing is set and @obj is unlocked.
      2) The tread that's trying to add the nwfilter onto the list locks
         the list and tries to find, if the nwfilter already exists.
      3) Our lookup functions say it doesn't, so the thread proceeds to
         virHashAddEntry() which fails with 'Duplicate key' error.
      
      This is obviously not helpful error message at all.
      
      The problem lies in our lookup function
      (virNWFilterBindingObjListFindByPortDevLocked()) which return
      NULL even if the object is still on the list. They do this so
      that the object is not mistakenly looked up by some API. The fix
      consists of moving 'removing' check one level up and thus
      allowing virNWFilterBindingObjListAddLocked() to produce
      meaningful error message.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      b701e45b
    • M
      virDomainObjListAddLocked: Produce better error message than 'Duplicate key' · a5c71129
      Michal Privoznik 提交于
      If there are two concurrent threads, one of which is removing a
      domain from the list and the other is trying to add it back they
      may serialize in the following order:
      
      1) vm->removing is set and @vm is unlocked.
      2) The tread that's trying to add the domain onto the list locks
         the list and tries to find, if the domain already exists.
      3) Our lookup functions say it doesn't, so the thread proceeds to
         virHashAddEntry() which fails with 'Duplicate key' error.
      
      This is obviously not helpful error message at all.
      
      The problem lies in our lookup functions
      (virDomainObjListFindByUUIDLocked() and
      virDomainObjListFindByNameLocked()) which return NULL even if the
      object is still on the list. They do this so that the object is
      not mistakenly looked up by some driver. The fix consists of
      moving 'removing' check one level up and thus allowing
      virDomainObjListAddLocked() to produce meaningful error message.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      a5c71129
  9. 03 4月, 2019 3 次提交