1. 17 1月, 2020 2 次提交
  2. 09 12月, 2019 12 次提交
  3. 26 11月, 2019 1 次提交
    • L
      conf: add hypervisor agnostic, domain start-time, validation function for NetDef · b03d9e95
      Laine Stump 提交于
      <interface> devices (virDomainNetDef) are a bit different from other
      types of devices in that their actual type may come from a network (in
      the form of a port connection), and that doesn't happen until the
      domain is started. This means that any validation of an <interface> at
      parse time needs to be a bit liberal in what it accepts - when
      type='network', you could think that something is/isn't allowed, but
      once the domain is started and a port is created by the configured
      network, the opposite might be true.
      
      To solve this problem hypervisor drivers need to do an extra
      validation step when the domain is being started. I recently (commit
      3cff23f7, libvirt 5.7.0) added a function to peform such validation
      for all interfaces to the QEMU driver -
      qemuDomainValidateActualNetDef() - but while that function is a good
      single point to call for the multiple places that need to "start" an
      interface (domain startup, device hotplug, device update), it can't be
      called by the other hypervisor drivers, since 1) it's in the QEMU
      driver, and 2) it contains some checks specific to QEMU. For
      validation that applies to network devices on *all* hypervisors, we
      need yet another interface validation function that can be called by
      any hypervisor driver (not just QEMU) right after its network port has
      been created during domain startup or hotplug. This patch adds that
      function - virDomainActualNetDefValidate(), in the conf directory,
      and calls it in appropriate places in the QEMU, lxc, and libxl
      drivers.
      
      This new function is the place to put all network device validation
      that 1) is hypervisor agnostic, and 2) can't be done until we know the
      "actual type" of an interface.
      
      There is no framework for validation at domain startup as there is for
      post-parse validation, but I don't want to create a whole elaborate
      system that will only be used by one type of device. For that reason,
      I just made a single function that should be called directly from the
      hypervisors, when they are initializing interfaces to start a domain,
      right after conditionally allocating the network port (and regardless
      of whether or not that was actually needed). In the case of the QEMU
      driver, qemuDomainValidateActualNetDef() is already called in all the
      appropriate places, so we can just call the new function from
      there. In the case of the other hypervisors, we search for
      virDomainNetAllocateActualDevice() (which is the hypervisor-agnostic
      function that calls virNetworkPortCreateXML()), and add the call to our
      new function right after that.
      
      The new function itself could be plunked down into many places in the
      code, but we already have 3 validation functions for network devices
      in 2 different places (not counting any basic validation done in
      virDomainNetDefParseXML() itself):
      
      1) post-parse hypervisor-agnostic
         (virDomainNetDefValidate() - domain_conf.c:6145)
      2) post-parse hypervisor-specific
         (qemuDomainDeviceDefValidateNetwork() - qemu_domain.c:5498)
      3) domain-start hypervisor-specific
         (qemuDomainValidateActualNetDef() - qemu_domain.c:5390)
      
      I placed (3) right next to (2) when I added it, specifically to avoid
      spreading validation all over the code. For the same reason, I decided
      to put this new function right next to (1) - this way if someone needs
      to add validation specific to qemu, they go to one location, and if
      they need to add validation applying to everyone, they go to the
      other. It looks a bit strange to have a public function in between a
      bunch of statics, but I think it's better than the alternative of
      further fragmentation. (I'm open to other ideas though, of course.)
      Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      b03d9e95
  4. 15 11月, 2019 1 次提交
    • J
      libxl: Fix lock manager lock ordering · 2552752f
      Jim Fehlig 提交于
      The ordering of lock manager locks in the libxl driver has a flaw that was
      uncovered by a migration error path. In the perform phase of migration, the
      source host calls virDomainLockProcessPause to release the lock before
      sending the VM to the destination host. If the send fails an attempt is made
      to reacquire the lock with virDomainLockProcessResume, but that too can fail
      if the destination host has not finished cleaning up the failed VM and
      releasing the lock it acquired when starting to receive the VM.
      
      This change delays calling virDomainLockProcessResume in libxlDomainStart
      until the VM is successfully created, but before it is unpaused. A similar
      approach is used by the qemu driver, avoiding the need to release the lock
      if VM creation fails. In the migration perform phase, releasing the lock
      with virDomainLockProcessPause is delayed until the VM is successfully
      sent to the destination, which avoids reacquiring the lock if the send
      fails.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      2552752f
  5. 12 11月, 2019 1 次提交
  6. 22 10月, 2019 1 次提交
  7. 21 10月, 2019 1 次提交
  8. 15 10月, 2019 1 次提交
  9. 21 8月, 2019 1 次提交
    • J
      Revert "libxl: send lifecycle event on suspend" · 18d47d61
      Jim Fehlig 提交于
      A libxl event with shutdown reason LIBXL_SHUTDOWN_REASON_SUSPEND
      is sent after a domain is successfully suspended, which could result
      from suspending the domain to file (virDomainSave), suspending it to
      socket (virDomainMigrate), or suspending it to memory
      (virDomainPMSuspendForDuration). Commit d00c77ae changed the event
      handler to always set domain state to VIR_DOMAIN_PMSUSPENDED when
      LIBXL_SHUTDOWN_REASON_SUSPEND is received. The causes a persistent
      domain to show state "pmsuspended" after a successful migrate or save
      operation. Revert the commit and ignore the suspend event as before.
      
      This reverts commit d00c77ae.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      18d47d61
  10. 09 8月, 2019 1 次提交
    • J
      qemu: Pass correct qemuCaps to virDomainDefCopy · bbcfa07b
      Jiri Denemark 提交于
      Since qemuDomainDefPostParse callback requires qemuCaps, we need to make
      sure it gets the capabilities stored in the domain's private data if the
      domain is running. Passing NULL may cause QEMU capabilities probing to
      be triggered in case QEMU binary changed in the meantime. When this
      happens while a running domain object is locked, QMP event delivered to
      the domain before QEMU capabilities probing finishes will deadlock the
      event loop.
      
      Several general functions from domain_conf.c were lazily passing NULL as
      the parseOpaque pointer instead of letting their callers pass the right
      data. This patch fixes all paths leading to virDomainDefCopy to do the
      right thing.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      bbcfa07b
  11. 17 4月, 2019 1 次提交
  12. 16 4月, 2019 2 次提交
  13. 12 4月, 2019 1 次提交
  14. 10 4月, 2019 2 次提交
  15. 14 3月, 2019 1 次提交
  16. 04 2月, 2019 1 次提交
  17. 14 12月, 2018 1 次提交
    • D
      Remove all Author(s): lines from source file headers · 60046283
      Daniel P. Berrangé 提交于
      In many files there are header comments that contain an Author:
      statement, supposedly reflecting who originally wrote the code.
      In a large collaborative project like libvirt, any non-trivial
      file will have been modified by a large number of different
      contributors. IOW, the Author: comments are quickly out of date,
      omitting people who have made significant contribitions.
      
      In some places Author: lines have been added despite the person
      merely being responsible for creating the file by moving existing
      code out of another file. IOW, the Author: lines give an incorrect
      record of authorship.
      
      With this all in mind, the comments are useless as a means to identify
      who to talk to about code in a particular file. Contributors will always
      be better off using 'git log' and 'git blame' if they need to  find the
      author of a particular bit of code.
      
      This commit thus deletes all Author: comments from the source and adds
      a rule to prevent them reappearing.
      
      The Copyright headers are similarly misleading and inaccurate, however,
      we cannot delete these as they have legal meaning, despite being largely
      inaccurate. In addition only the copyright holder is permitted to change
      their respective copyright statement.
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      60046283
  18. 11 12月, 2018 1 次提交
    • M
      libxl: handle external domain destroy · fa30ee04
      Marek Marczykowski-Górecki 提交于
      If domain is killed with `xl destroy`, libvirt will not notice it and
      still report the domain as running. Also trying to destroy the domain
      through libvirt will fail. The only way to recover from such a situation
      is to restart libvirt daemon. The problem is that even though libxl
      report LIBXL_EVENT_TYPE_DOMAIN_DEATH, libvirt ignore it as all the
      domain cleanup is done in a function actually destroying the domain. If
      destroy is done outside of libvirt, there is no place where it would be
      handled.
      
      Fix this by doing domain cleanup in LIBXL_EVENT_TYPE_DOMAIN_DEATH too.
      To avoid doing it twice, add a ignoreDeathEvent flag
      libxlDomainObjPrivate, set when the domain death is triggered by libvirt
      itself.
      Signed-off-by: NMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
      Reviewed-by: NJim Fehlig <jfehlig@suse.com>
      fa30ee04
  19. 07 11月, 2018 4 次提交
  20. 15 9月, 2018 1 次提交
    • J
      libxl: drop support for Xen < 4.6 · 5bdcef13
      Jim Fehlig 提交于
      Currently the libxl driver claims support for Xen >= 4.4, but
      Xen 4.4 and 4.5 are no longer supported upstream. Let's increase
      the minimum supported Xen version to 4.6 and change the defined
      LIBXL_API_VERSION to 0x040500, which is the API version defined
      when Xen 4.6 was released.
      
      Since Xen 4.6 contains a pkgconfig file, drop the now unused code
      that falls back to using LIBVIRT_CHECK_LIB in the absence of
      pkgconfig file. In addition, bumping the LIBXL_API_VERSION
      required adjusting the calls to libxl_set_vcpuaffinity to account
      for the extra parameter in the 0x040500 version of the API.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      5bdcef13
  21. 10 9月, 2018 1 次提交
  22. 13 6月, 2018 1 次提交
  23. 05 6月, 2018 1 次提交
    • J
      libxl: fix leaking logfile fds · 67c56f6e
      Jim Fehlig 提交于
      Per-domain log files were introduced in commit a30b08b7. The FILE
      objects associated with these log files are stored in a hash table
      using domid as a key. When a domain is shutdown, destroyed, or
      otherwise powered-off, the FILE object is removed from the hash table,
      where the free function will close the FILE.
      
      Unfortunately the call to remove the FILE from the hash table occurs
      after setting domid=-1 in the libxlDomainCleanup() function. The
      object is never removed from the hash table, the free function is
      never called, and the underlying fd is leaked. Fix by removing the
      FILE object from the hash table before setting domid=-1.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      67c56f6e