1. 26 11月, 2019 10 次提交
    • M
      all: don't wait for driver lock during startup · c8579871
      Michal Privoznik 提交于
      There are two daemons that wait for acquiring their pid files:
      virtnetworkd and virtstoraged. This is undesirable as the idea
      is to quit early if unable to acquire the pid file.
      
      Fixes: v5.6.0-rc1~207.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      c8579871
    • P
      check-symfile: Use pythonesque string formatting instead of perl · 3b9359cd
      Peter Krempa 提交于
      Commit d30a1ad0 translated the symbol file checker from perl to
      python by doing a literal translation in most cases. Unfortunately one
      string formatting operation was not really translated into python
      leaving users with non-helpful error:
      
      'Symbol $1 is listed twice'
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      3b9359cd
    • L
      net/qemu: move vlan/bandwidth validation out of network driver · 9d6920bd
      Laine Stump 提交于
      In the past the network driver was (mistakenly) being called for all
      interfaces, not just those of type='network', and so it had a chance
      to validate all interface configs after the actual type of the
      interface was known.
      
      But since the network driver has been more completely/properly
      separated from qemu, the network driver isn't called during the
      startup of any interfaces except those with type='network', so this
      validation no longer takes place for, e.g. <interface type='bridge'>
      (or direct, etc). This in turn meant that a config could erroneously
      specify a vlan tag, or bandwidth settings, for a type of interface
      that didn't support it, and the domain would start without complaint,
      just silently ignoring those settings.
      
      This patch moves those validation checks out of the network driver,
      and into virDomainActualNetDefValidate() so they will be done for all
      interfaces, not just type='network'.
      
      https://bugzilla.redhat.com/1741121Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      9d6920bd
    • 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
    • L
      conf: change args/return values of remaining virDomainNetGetActual*() to const · 01262421
      Laine Stump 提交于
      These all just return a scalar value, so there's no daisy-chained
      fallout from changing them, and they can easily be combined in a
      single patch.
      Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      01262421
    • L
      conf: return a const from virDomainNetGetActualVirtPortProfile · fdcd273b
      Laine Stump 提交于
      This also isn't required (due to the vportprofile being stored in the
      NetDef as a pointer rather than being directly contained), but it
      seemed dishonest to not mark it as const (and thus permit users to
      modify its contents)
      Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      fdcd273b
    • L
      conf: make virDomainNetGetActualBandwidth arg/return value const · 583ac17f
      Laine Stump 提交于
      In this case, the virNetDevBandwidthPtr that is returned is not to a
      region within the virDomainNetDef arg, but points elsewhere (the
      NetDef has the pointer, not the entire object), so technically it's
      not necessary to make the return value a const, but it's a bit
      disingenuous to *not* do it.
      Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      583ac17f
    • L
      conf: make virDomainNetGetActualVlan arg/return val const · 12207fcf
      Laine Stump 提交于
      This is needed if we want to call the function when the
      virDomainNetDef* we have is a const.
      
      Since virDomainNetGetActualVlan returns a pointer to memory that is
      within the virDomainNetDefPtr arg, the returned pointer must also be
      made const. This leads to a cascade of other virNetDevVlanPtr's that
      must be changed to "const virNetDevVlan *".
      Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      12207fcf
    • L
      qemu: add mac address to error messages in qemuDomainValidateActualNetDef · 1b029a92
      Laine Stump 提交于
      This makes it easier to understand which interface's config caused the
      error.
      Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      1b029a92
    • M
      qemu_capabilities: Use proper free function for caps->cpuModels · 9b1d53d4
      Michal Privoznik 提交于
      The cpuModels member of _virQEMUCapsAccel struct is not a
      virObject but regular struct with a free function defined:
      qemuMonitorCPUDefsFree(). Use that when clearing parent structure
      instead of virObjectUnref() to avoid a memleak:
      
      ==212322== 57,275 (48 direct, 57,227 indirect) bytes in 3 blocks are definitely lost in loss record 623 of 627
      ==212322==    at 0x4838B86: calloc (vg_replace_malloc.c:762)
      ==212322==    by 0x554A158: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.6000.6)
      ==212322==    by 0x17B14BF5: qemuMonitorCPUDefsNew (qemu_monitor.c:3587)
      ==212322==    by 0x17B27BA7: qemuMonitorJSONGetCPUDefinitions (qemu_monitor_json.c:5616)
      ==212322==    by 0x17B14B0B: qemuMonitorGetCPUDefinitions (qemu_monitor.c:3559)
      ==212322==    by 0x17A6AFBB: virQEMUCapsFetchCPUDefinitions (qemu_capabilities.c:2571)
      ==212322==    by 0x17A6B2CC: virQEMUCapsProbeQMPCPUDefinitions (qemu_capabilities.c:2629)
      ==212322==    by 0x17A70C00: virQEMUCapsInitQMPMonitorTCG (qemu_capabilities.c:4769)
      ==212322==    by 0x17A70DDF: virQEMUCapsInitQMPSingle (qemu_capabilities.c:4820)
      ==212322==    by 0x17A70E99: virQEMUCapsInitQMP (qemu_capabilities.c:4848)
      ==212322==    by 0x17A71044: virQEMUCapsNewForBinaryInternal (qemu_capabilities.c:4891)
      ==212322==    by 0x17A7119C: virQEMUCapsNewData (qemu_capabilities.c:4923)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
      9b1d53d4
  2. 25 11月, 2019 10 次提交
  3. 22 11月, 2019 20 次提交