1. 21 4月, 2017 2 次提交
    • M
      util: Add virNetDevSetCoalesce function · 652ef9bc
      Martin Kletzander 提交于
      That function is able to configure coalesce settings for an interface,
      similarly to 'ethtool -C'.  This function also updates back the
      structure so that it contains actual data on the device (if the device
      doesn't support some settings kernel might just return 0 and not set
      whatever is not supported), so this way we'll have up-to-date
      information in the live domain XML.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      652ef9bc
    • P
      util: check ifa_addr pointer before accessing its elements · 42000bf7
      Pavel Hrdina 提交于
      Reported by Rafał Wojciechowski <it@rafalwojciechowski.pl>.
      
      Thread 1 (Thread 0x7f194b99d700 (LWP 5631)):
      0  virNetDevGetifaddrsAddress (addr=0x7f194b99c7c0, ifname=0x7f193400e2b0 "ovirtmgmt") at util/virnetdevip.c:738
      1  virNetDevIPAddrGet (ifname=0x7f193400e2b0 "ovirtmgmt", addr=addr@entry=0x7f194b99c7c0) at util/virnetdevip.c:795
      2  0x00007f19467800d6 in networkGetNetworkAddress (netname=<optimized out>, netaddr=netaddr@entry=0x7f1924013f18) at network/bridge_driver.c:4780
      3  0x00007f193e43a33c in qemuProcessGraphicsSetupNetworkAddress (listenAddr=0x7f19340f7650 "127.0.0.1", glisten=0x7f1924013f10) at qemu/qemu_process.c:4062
      4  qemuProcessGraphicsSetupListen (vm=<optimized out>, graphics=0x7f1924014f10, cfg=0x7f1934119f00) at qemu/qemu_process.c:4133
      5  qemuProcessSetupGraphics (flags=17, vm=0x7f19240155d0, driver=0x7f193411f1d0) at qemu/qemu_process.c:4196
      6  qemuProcessPrepareDomain (conn=conn@entry=0x7f192c00ab50, driver=driver@entry=0x7f193411f1d0, vm=vm@entry=0x7f19240155d0, flags=flags@entry=17) at qemu/qemu_process.c:4969
      7  0x00007f193e4417c0 in qemuProcessStart (conn=conn@entry=0x7f192c00ab50, driver=driver@entry=0x7f193411f1d0, vm=0x7f19240155d0,asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_START, migrateFrom=migrateFrom@entry=0x0, migrateFd=migrateFd@entry=-1, migratePath=migratePath@entry=0x0,snapshot=snapshot@entry=0x0, vmop=vmop@entry=VIR_NETDEV_VPORT_PROFILE_OP_CREATE, flags=17, flags@entry=1) at qemu/qemu_process.c:5553
      
      Man page for getifaddrs also states that the "ifa_addr" may contain
      a null pointer which happens if there is an existing network interface
      on the host without IP address.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      42000bf7
  2. 20 4月, 2017 5 次提交
    • D
      Fix error reporting when poll returns POLLHUP/POLLERR · 234ac4e1
      Daniel P. Berrange 提交于
      In the RPC client event loop code, if poll() returns only a POLLHUP
      or POLLERR status, then we end up reporting a bogus error message:
      
        error: failed to connect to the hypervisor
        error: An error occurred, but the cause is unknown
      
      We do actually report an error, but we virNetClientMarkClose method
      has already captured the error status before we report it, so the
      real error gets thrown away. The key fix is to report the error
      before calling virNetClientMarkClose(). In changing this, we also
      split out reporting of POLLHUP vs POLLERR to make any future bugs
      easier to diagnose.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      234ac4e1
    • P
      qemu: hotplug: Don't save status XML when monitor is closed · 355f5ab9
      Peter Krempa 提交于
      In the vcpu hotplug code if exit from the monitor failed we would still
      attempt to save the status XML. When the daemon is terminated the
      monitor socket is closed. In such case, the written status XML would not
      contain the monitor path and thus be invalid.
      
      Avoid this issue by only saving status XML on success of the monitor
      command.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1439452
      355f5ab9
    • P
      qemu: hotplug: Unexport qemuDomainHotplugDelVcpu · f24dc5e2
      Peter Krempa 提交于
      The function is used only in the hotplug module.
      f24dc5e2
    • P
      qemu_domain: use correct default USB controller on ppc64 · 90acbc76
      Pavel Hrdina 提交于
      The history of USB controller for ppc64 guest is complex and goes
      back to libvirt 1.3.1 where the fun started.
      
      Prior Libvirt 1.3.1 if no model for USB controller was specified
      we've simply passed "-usb" on QEMU command line.
      
      Since Libvirt 1.3.1 there is a patch (8156493d) that fixes this
      issue by using "-device pci-ohci,..." but it breaks migration with
      older Libvirts which was agreed that's acceptable.  However this
      patch didn't reflect this change in the domain XML and the model
      was still missing.
      
      Since Libvirt 2.2.0 there is a patch (f55eaccb) that fixes the
      issue with not setting the USB model into domain XML which we need
      to know about to not break the migration and since the default
      model was *pci-ohci* it was used as default in this patch as well.
      
      This patch tries to take all the previous changes into account and
      also change the default for newly defined domains that don't specify
      any model for USB controller.
      
      The VIR_DOMAIN_DEF_PARSE_ABI_UPDATE is set only if new domain is
      defined or new device is added into a domain which means that in
      all other cases we will use the old *pci-ohci* model instead of the
      better and not broken *nec-usb-xhci* model.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1373184Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      90acbc76
    • P
      conf: add a new parse flag VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION · 5c7d8808
      Pavel Hrdina 提交于
      So far there is probably no change that is allowed to be done
      by the VIR_DOMAIN_DEF_PARSE_ABI_UPDATE flag that would break
      guest ABI but this may change in the future.
      
      This introduces new VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION
      which should be used only for ABI updates that are "safe" for
      persistent migration.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      5c7d8808
  3. 19 4月, 2017 18 次提交
    • J
      qemu: Use more data for comparing CPUs · 5b4a6adb
      Jiri Denemark 提交于
      With QEMU older than 2.9.0 libvirt uses CPUID instruction to determine
      what CPU features are supported on the host. This was later used when
      checking compatibility of guest CPUs. Since QEMU 2.9.0 we ask QEMU for
      the host CPU data. But the two methods we use usually provide disjoint
      sets of CPU features because QEMU/KVM does not support all features
      provided by the host CPU and on the other hand it can enable some
      feature even if the host CPU does not support them.
      
      So if there is a domain which requires a CPU features disabled by
      QEMU/KVM, libvirt will refuse to start it with QEMU > 2.9.0 as its guest
      CPU is incompatible with the host CPU data we got from QEMU. But such
      domain would happily start on older QEMU (of course, the features would
      be missing the guest CPU). To fix this regression, we need to combine
      both CPU feature sets when checking guest CPU compatibility.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1439933Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      5b4a6adb
    • J
      cpu: Introduce virCPUGetHostIsSupported · bf1a8817
      Jiri Denemark 提交于
      Sometimes we want to call virCPUGetHost only when it is implemented for
      a given architecture to avoid logging expected and possibly misleading
      errors. The new virCPUGetHostIsSupported API may be used to guard such
      calls to virCPUGetHost.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      bf1a8817
    • J
      cpu: Drop feature filtering from virCPUUpdate · 232d87c7
      Jiri Denemark 提交于
      Because of the changes done in the previous commit, @host is already a
      migratable CPU and there's no need to do any additional filtering.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      232d87c7
    • J
      qemu: Pass migratable host CPU model to virCPUUpdate · 56bd7edc
      Jiri Denemark 提交于
      We already know from QEMU which CPU features will block migration. Let's
      use this information to make a migratable copy of the host CPU model and
      use it for updating guest CPU specification. This will allow us to drop
      feature filtering from virCPUUpdate where it was just a hack.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      56bd7edc
    • J
      qemu: Prepare qemuCaps for multiple host CPU defs · 1fe517c6
      Jiri Denemark 提交于
      Soon we will need to store multiple host CPU definitions in
      virQEMUCapsHostCPUData and qemuCaps users will want to request the one
      they need. This patch introduces virQEMUCapsHostCPUType enum which will
      be used for specifying the requested CPU definition.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      1fe517c6
    • J
      qemu: Move qemuCaps host CPU data in a struct · b0a84ffb
      Jiri Denemark 提交于
      We need to store several CPU related data structure for both KVM and
      TCG. So instead of keeping two different copies of everything let's
      make a virQEMUCapsHostCPUData struct and use it twice.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      b0a84ffb
    • J
      qemu: Introduce virQEMUCapsHostCPUDataClear · b0605e84
      Jiri Denemark 提交于
      To keep freeing of host CPU data in one place.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      b0605e84
    • J
      qemu: Move qemuCaps CPU data copying into a separate function · 8be4346c
      Jiri Denemark 提交于
      This introduces virQEMUCapsHostCPUDataCopy which will later be
      refactored a bit and called twice from virQEMUCapsNewCopy.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      8be4346c
    • J
      qemu: Introduce virQEMUCapsSetHostModel · bffc3b9f
      Jiri Denemark 提交于
      A simple helper as a complement to virQEMUCapsGetHostModel.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      bffc3b9f
    • D
      Ignore SASL deprecation warnings on OS-X · f7d7825d
      Daniel P. Berrange 提交于
      Apple have annotated all SASL functions as deprecated for
      unknown reasons. Since they still work, lets just ignore
      the warnings. If Apple finally delete the SASL functions
      our configure check should already catch that
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f7d7825d
    • D
      annotate all mocked functions with noinline · 728cacc8
      Daniel P. Berrange 提交于
      CLang's optimizer is more aggressive at inlining functions than
      gcc and so will often inline functions that our tests want to
      mock-override. This causes the test to fail in bizarre ways.
      
      We don't want to disable inlining completely, but we must at
      least prevent inlining of mocked functions. Fortunately there
      is a 'noinline' attribute that lets us control this per function.
      
      A syntax check rule is added that parses tests/*mock.c to extract
      the list of functions that are mocked (restricted to names starting
      with 'vir' prefix). It then checks that src/*.h header file to
      ensure it has a 'ATTRIBUTE_NOINLINE' annotation. This should prevent
      use from bit-rotting in future.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      728cacc8
    • J
      network: Use consistent function name prefixes for virnetworkobj · bd13b26d
      John Ferlan 提交于
      Use "virNetworkObj" as a prefix for any external API in virnetworkobj.
      
      Also a couple of functions were local to virnetworkobj.c, so remove their
      external defs in virnetworkobj.h.
      bd13b26d
    • J
      network: Rename virNetworkObjAssignDef to virNetworkObjUpdateAssignDef · 4726020b
      John Ferlan 提交于
      Rename the API to be a better description of what it does. Besides, a
      subsequent patch will rename virNetworkAssignDef to virNetworkObjAssignDef
      so rather than make that patch confusing we'll take the intermittent step
      in this patch.
      4726020b
    • J
      network: Alter coding style of network conf function prototypes · 609dac1b
      John Ferlan 提交于
      In an effort to be consistent with the source module, alter the function
      prototypes to follow the similar style of source with the "type" on one
      line followed by the function name and arguments on subsequent lines with
      with argument getting it's own line.
      609dac1b
    • J
      network: Adjust coding style for network conf sources · 0cf145b6
      John Ferlan 提交于
      Alter the format of the code to follow more recent style guidelines of
      two empty lines between functions, function decls with "[static] type"
      on one line followed by function name with arguments to functions each
      on one line.
      0cf145b6
    • J
      network: Introduce virnetworkobj · bddbda99
      John Ferlan 提交于
      Move all the virNetworkObj related API/data structures into their own
      modules virnetworkobj.{c,h} from the network_conf.{c,h}
      
      Purely code motion at this point plus adjustments to cleanly build
      bddbda99
    • D
      hyperv: recognize array property as distinct type. · bb9fca7b
      Dawid Zamirski 提交于
      When hyperv code generator for WMI classes identifies common
      properties, it needs to take into account array type as a distinct
      type, i.e string != string[]. This is the case where v1 of the
      Msvm_VirtualSystemSettingData has Notes property as string whereas v2
      uses Notes[], therefore they have to be treated as different fields and
      cannot be placed in the "common" struct.
      bb9fca7b
    • J
      xenconfig: avoid double free on OOM testing · b2c12f57
      Jim Fehlig 提交于
      Fix xlconfig channel tests when OOM testing is enabled.
      
      TEST: xlconfigtest
      32) Xen XL-2-XML Format channel-unix                                  ... OK
          Test OOM for nalloc=55 ................................................*** Error in `/home/jfehlig/virt/upstream/libvirt/tests/.libs/xlconfigtest': double free or corruption (fasttop): 0x0000000000679550 ***
      ...
      (gdb) bt
      #0  0x00007ffff36875af in raise () from /lib64/libc.so.6
      #1  0x00007ffff36889aa in abort () from /lib64/libc.so.6
      #2  0x00007ffff36c5150 in __libc_message () from /lib64/libc.so.6
      #3  0x00007ffff36cb4f6 in malloc_printerr () from /lib64/libc.so.6
      #4  0x00007ffff36cbcee in _int_free () from /lib64/libc.so.6
      #5  0x00007ffff782babf in virFree (ptrptr=0x7fffffffdca8) at util/viralloc.c:582
      #6  0x000000000042f2f3 in xenParseXLChannel (conf=0x677350, def=0x6815b0) at xenconfig/xen_xl.c:788
      #7  0x000000000042f44e in xenParseXL (conf=0x677350, caps=0x6832b0, xmlopt=0x67f6e0) at xenconfig/xen_xl.c:828
      #8  0x00000000004105a3 in testCompareFormatXML (
          xlcfg=0x6811e0 "/home/jfehlig/virt/upstream/libvirt/tests/xlconfigdata/test-channel-unix.cfg",
          xml=0x681110 "/home/jfehlig/virt/upstream/libvirt/tests/xlconfigdata/test-channel-unix.xml", replaceVars=false)
          at xlconfigtest.c:152
      
      When a channel is successfully parsed and its path and name fields
      assigned from local variables, set the local variables to NULL to
      prevent a double free on error.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      b2c12f57
  4. 18 4月, 2017 6 次提交
  5. 14 4月, 2017 3 次提交
    • S
      pci: recognize/report GEN4 (PCIe 4.0) card 16GT/s Link speed · 8e09663f
      Shivaprasad G Bhat 提交于
      Without this added enum value, nodedev-dumpxml of a GEN4 (PCIe 4.0)
      card will fail (due to the unrecognized link speed), and since
      nodedev-detach and nodedev-reattach internally do a dumpxml+parse,
      they will also fail. With this patch, all those operations succeed.
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      8e09663f
    • W
      xenFormatXLDomainDisks: avoid double free on OOM testing · 2c1a31a3
      Wim ten Have 提交于
      Fix xlconfigtest runs build for --enable-test-oom on
              Xen XL-2-XML Parse  new-disk
      
          #0  0x00007ffff3bd791f in raise () from /lib64/libc.so.6
          #1  0x00007ffff3bd951a in abort () from /lib64/libc.so.6
          #2  0x00007ffff3c1b200 in __libc_message () from /lib64/libc.so.6
          #3  0x00007ffff3c2488a in _int_free () from /lib64/libc.so.6
          #4  0x00007ffff3c282bc in free () from /lib64/libc.so.6
          #5  0x00007ffff7864fcb in virFree (ptrptr=ptrptr@entry=0x7fffffffd868) at util/viralloc.c:582
          #6  0x00007ffff78776e5 in virConfFreeValue (val=<optimized out>) at util/virconf.c:178
      ==> #7  0x0000000000425759 in xenFormatXLDomainDisks (def=0x7fffffffd8c0, def=0x7fffffffd8c0, conf=0x658220)
              at xenconfig/xen_xl.c:1159
          #8  xenFormatXL (def=def@entry=0x66ec20, conn=conn@entry=0x668cf0) at xenconfig/xen_xl.c:1558
          #9  0x000000000040ea1d in testCompareParseXML (replaceVars=<optimized out>,
              xml=0x65f5e0 "/home/wtenhave/WORK/libvirt/history/libvirt/tests/xlconfigdata/test-fullvirt-ovmf.xml",
              xlcfg=0x65f6b0 "/home/wtenhave/WORK/libvirt/history/libvirt/tests/xlconfigdata/test-fullvirt-ovmf.cfg")
              at xlconfigtest.c:105
          #10 testCompareHelper (data=<optimized out>) at xlconfigtest.c:205
          #11 0x000000000041079a in virTestRun (title=title@entry=0x431cf0 "Xen XL-2-XML Parse  fullvirt-ovmf",
              body=body@entry=0x40e720 <testCompareHelper>, data=data@entry=0x7fffffffda50) at testutils.c:247
          #12 0x000000000040ebc2 in mymain () at xlconfigtest.c:256
          #13 0x0000000000411070 in virTestMain (argc=1, argv=0x7fffffffdc08, func=0x40f2c0 <mymain>) at testutils.c:992
          #14 0x00007ffff3bc2401 in __libc_start_main () from /lib64/libc.so.6
          #15 0x000000000040e5da in _start ()
      
      symmetry seems missing its sibbling coded functionality
      demonstrated under functions;
              xenFormatXLUSBController()
              xenFormatXLUSB()
              xenFormatXLDomainChannels()
              xenFormatXMDisks
      Signed-off-by: NWim ten Have <wim.ten.have@oracle.com>
      2c1a31a3
    • W
      virConfSaveValue: protect against a NULL pointer reference · ae5d7582
      Wim ten Have 提交于
      Fix xlconfigtest runs build for --enable-test-oom on
              Xen XL-2-XML Parse  channel-pty
      
      Program received signal SIGSEGV, Segmentation fault.
      
          #0  0x00007ffff3c2b373 in __strchr_sse2 () from /lib64/libc.so.6
      ==> #1  0x00007ffff7875701 in virConfSaveValue (buf=buf@entry=0x7fffffffd8a0, val=val@entry=0x674750) at util/virconf.c:290
          #2  0x00007ffff7875668 in virConfSaveValue (buf=buf@entry=0x7fffffffd8a0, val=<optimized out>) at util/virconf.c:306
          #3  0x00007ffff78757ef in virConfSaveEntry (buf=buf@entry=0x7fffffffd8a0, cur=cur@entry=0x674780) at util/virconf.c:338
          #4  0x00007ffff78783eb in virConfWriteMem (memory=0x665570 "", len=len@entry=0x7fffffffd910, conf=conf@entry=0x65b940)
              at util/virconf.c:1543
          #5  0x000000000040eccb in testCompareParseXML (replaceVars=<optimized out>, xml=<optimized out>,
              xlcfg=0x662c00 "/home/wtenhave/WORK/libvirt/OOMtesting/libvirt-devel/tests/xlconfigdata/test-channel-pty.cfg")
              at xlconfigtest.c:108
          #6  testCompareHelper (data=<optimized out>) at xlconfigtest.c:205
          #7  0x0000000000410b3a in virTestRun (title=title@entry=0x432cc0 "Xen XL-2-XML Parse  channel-pty",
              body=body@entry=0x40e9b0 <testCompareHelper>, data=data@entry=0x7fffffffd9f0) at testutils.c:247
          #8  0x000000000040f322 in mymain () at xlconfigtest.c:278
          #9  0x0000000000411410 in virTestMain (argc=1, argv=0x7fffffffdba8, func=0x40f660 <mymain>) at testutils.c:992
          #10 0x00007ffff3bc0401 in __libc_start_main () from /lib64/libc.so.6
          #11 0x000000000040e86a in _start ()
      
          (gdb) frame 1
          #1  0x00007ffff7875701 in virConfSaveValue (buf=buf@entry=0x7fffffffd8a0, val=val@entry=0x674750) at util/virconf.c:290
          290                 if (strchr(val->str, '\n') != NULL) {
          (gdb) print *val
          $1 = {type = VIR_CONF_STRING, next = 0x0, l = 0, str = 0x0, list = 0x0}
      Signed-off-by: NWim ten Have <wim.ten.have@oracle.com>
      ae5d7582
  6. 13 4月, 2017 6 次提交