1. 19 12月, 2019 2 次提交
  2. 18 12月, 2019 4 次提交
    • D
      qemu_command: tidy up qemuBuildHostdevCommandLine loop · aed9bcd1
      Daniel Henrique Barboza 提交于
      The current 'for' loop with 5 consecutive 'ifs' inside
      qemuBuildHostdevCommandLine can be a bit smarter:
      
      - all 5 'ifs' fails if hostdev->mode is not equal to
      VIR_DOMAIN_HOSTDEV_MODE_SUBSYS. This check can be moved to the
      start of the loop, failing to the next element immediately
      in case it fails;
      
      - all 5 'ifs' checks for a specific subsys->type to build the proper
      command line argument (virHostdevIsSCSIDevice and virHostdevIsMdevDevice
      do that but within a helper). Problem is that the code will keep
      checking for matches even if one was already found, and there is
      no way a hostdev will fit more than one 'if' (i.e. a hostdev can't
      have 2+ different types). This means that a SUBSYS_TYPE_USB will
      create its command line argument in the first 'if', then all other
      conditionals will surely fail but will end up being checked anyway.
      
      All of this can be avoided by moving the hostdev->mode comparing
      to the start of the loop and using a switch statement with
      subsys->type to execute the proper code for a given hostdev
      type.
      Suggested-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      aed9bcd1
    • M
      qemu: Don't leak hostcpu or hostnuma on driver cleanup · 39a7dff7
      Michal Privoznik 提交于
      When freeing qemu driver struct members, we forgot to free
      @hostcpu and @hostnuma members.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      39a7dff7
    • M
      qemu: Reorder cleanup in qemuStateCleanup() · 7cf76d4e
      Michal Privoznik 提交于
      This function is supposed to clean up virQEMUDriver structure and
      free individual members. However, it's doing that in random order
      which makes it hard to track which members are being freed and
      which are not. Do the free in reverse order than the structure
      definition - assuming that the most important members (like
      mutex) are declared first and freed last.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      7cf76d4e
    • L
      qemu: homogenize MAC address in live & config when hotplugging a netdev · 6c17606b
      Laine Stump 提交于
      Prior to commit 55ce6564 (first in libvirt 4.6.0), the XML sent to
      virDomainAttachDeviceFlags() was parsed only once, and the results of
      that parse were inserted into both the live object of the running
      domain and into the persistent config. Thus, if MAC address was
      omitted from in XML for a network device (<interface>), both the live
      and config object would have the same MAC address.
      
      Commit 55ce6564 changed the code to parse the incoming XML twice -
      once for live and once for config. This does eliminate the problem of
      PCI (/scsi/sata) address conflicts caused by allocating an address
      based on existing devices in live object, but then inserting the
      result into the config (which may already have a device using that
      address), BUT it also means that when the MAC address of a network
      device hasn't been specified in the XML, each copy will get a
      different auto-generated MAC address.
      
      This results in the MAC address of the device changing the next time
      the domain is shutdown and restarted, which creates havoc with the
      guest OS's network config.
      
      There have been several discussions about this in the last > 1 year,
      attempting to find the ideal solution to this problem that makes MAC
      addresses consistent and accounts for all sorts of corner cases with
      PCI/scsi/sata addresses. All of these discussions fizzled out because
      every proposal was either too difficult to implement or failed to fix
      some esoteric case someone thought up.
      
      So, in the interest of solving the MAC address problem while not
      making the "other address" situation any worse than before, this patch
      simply adds a qemuDomainAttachDeviceLiveAndConfigHomogenize() function
      that (for now) copies the MAC address from the config object to the
      live object (if the original xml had <mac address='blah'/> then this
      will be an effective NOP (as the macs already match)).
      
      Any downstream libvirt containing upstream commit
      55ce6564 should have this patch as well.
      
      https://bugzilla.redhat.com/1783411Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      6c17606b
  3. 17 12月, 2019 34 次提交