1. 14 10月, 2013 7 次提交
  2. 11 10月, 2013 12 次提交
    • H
      nwfilter: fix a typo in nwfilter_gentech_driver.c · 3a49c34a
      Hongwei Bi 提交于
      s/occcurred/occurred
      3a49c34a
    • D
      rpc: Fix getsockopt on Snow Leopard and lower · 2f776d49
      Doug Goldstein 提交于
      Since 5a468b38 we use SOL_LOCAL for the 2nd argument of getsockopt()
      however Lion added the define SOL_LOCAL set to 0, which is the value to
      the 2nd argument of getsockopt() for Unix sockets on Mac OS X. So
      instead of using the define just pass 0 so we restore compatibility
      with Snow Leopard and Leopard.
      
      Reported at https://github.com/mxcl/homebrew/pull/23141
      2f776d49
    • D
      VMware: Do version detection earlier · fa23f9fc
      Doug Goldstein 提交于
      Do VMware version detection earlier as future patches will need the
      version information to populate capabilities correctly.
      fa23f9fc
    • D
      VMware: Simplify array walk for driver type · 9e7cfcb7
      Doug Goldstein 提交于
      Rather than walking the possible driver backends by handle, use a helper
      function. Additionally I've done a bit of refactoring in the code over
      the past few commits so add myself to the copyright line.
      9e7cfcb7
    • M
      qemu: Include listenAddress in debug prints · be651860
      Michal Privoznik 提交于
      After my patches, some functions gained one more argument
      (@listenAddress) which wasn't included in debug printing of
      arguments they were called with. Functions in question are:
      qemuMigrationPrepareDirect and qemuMigrationPerform.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      be651860
    • M
      qemu_migration: Avoid crashing if domain dies too quickly · c7ac2519
      Michal Privoznik 提交于
      I've noticed a SIGSEGV-ing libvirtd on the destination when the qemu
      died too quickly = in Prepare phase. What is happening here is:
      
      1) [Thread 3493] We are in qemuMigrationPrepareAny() and calling
      qemuProcessStart() which subsequently calls qemuProcessWaitForMonitor()
      and qemuConnectMonitor(). So far so good. The qemuMonitorOpen()
      succeeds, however switching monitor to QMP mode fails as qemu died
      meanwhile. That is qemuMonitorSetCapabilities() returns -1.
      
      2013-10-08 15:54:10.629+0000: 3493: debug : qemuMonitorSetCapabilities:1356 : mon=0x14a53da0
      2013-10-08 15:54:10.630+0000: 3493: debug : qemuMonitorJSONCommandWithFd:262 : Send command '{"execute":"qmp_capabilities","id":"libvirt-1"}' for write with FD -1
      2013-10-08 15:54:10.630+0000: 3493: debug : virEventPollUpdateHandle:147 : EVENT_POLL_UPDATE_HANDLE: watch=17 events=13
      ...
      2013-10-08 15:54:10.631+0000: 3493: debug : qemuMonitorSend:956 : QEMU_MONITOR_SEND_MSG: mon=0x14a53da0 msg={"execute":"qmp_capabilities","id":"libvirt-1"}
       fd=-1
      2013-10-08 15:54:10.631+0000: 3262: debug : virEventPollRunOnce:641 : Poll got 1 event(s)
      
      2) [Thread 3262] The event loop is trying to do the talking to monitor.
      However, qemu is dead already, remember?
      
      2013-10-08 15:54:13.436+0000: 3262: error : qemuMonitorIORead:551 : Unable to read from monitor: Connection reset by peer
      2013-10-08 15:54:13.516+0000: 3262: debug : virFileClose:90 : Closed fd 25
      ...
      2013-10-08 15:54:13.533+0000: 3493: debug : qemuMonitorSend:968 : Send command resulted in error internal error: early end of file from monitor: possible problem:
      
      3) [Thread 3493] qemuProcessStart() failed. No big deal. Go to the
      'endjob' label and subsequently to the 'cleanup'. Since the domain is
      not persistent and ret is -1, the qemuDomainRemoveInactive() is called.
      This has an (unpleasant) effect of virObjectUnref()-in the @vm object.
      Unpleasant because the event loop which is about to trigger EOF callback
      still holds a pointer to the @vm (not the reference). See the valgrind
      output below.
      
      4) [Thread 3262] So the event loop starts triggering EOF:
      
      2013-10-08 15:54:13.542+0000: 3262: debug : qemuMonitorIO:729 : Triggering EOF callback
      2013-10-08 15:54:13.543+0000: 3262: debug : qemuProcessHandleMonitorEOF:294 : Received EOF on 0x14549110 'migt10'
      
      And the monitor is cleaned up. This results in calling
      qemuProcessHandleMonitorEOF with the @vm pointer passed. The pointer is
      kept in qemuMonitor struct.
      
      ==3262== Thread 1:
      ==3262== Invalid read of size 4
      ==3262==    at 0x77ECCAA: pthread_mutex_lock (in /lib64/libpthread-2.15.so)
      ==3262==    by 0x52FAA06: virMutexLock (virthreadpthread.c:85)
      ==3262==    by 0x52E3891: virObjectLock (virobject.c:320)
      ==3262==    by 0x11626743: qemuProcessHandleMonitorEOF (qemu_process.c:296)
      ==3262==    by 0x11642593: qemuMonitorIO (qemu_monitor.c:730)
      ==3262==    by 0x52BD526: virEventPollDispatchHandles (vireventpoll.c:501)
      ==3262==    by 0x52BDD49: virEventPollRunOnce (vireventpoll.c:648)
      ==3262==    by 0x52BBC68: virEventRunDefaultImpl (virevent.c:274)
      ==3262==    by 0x542D3D9: virNetServerRun (virnetserver.c:1112)
      ==3262==    by 0x11F368: main (libvirtd.c:1513)
      ==3262==  Address 0x14549128 is 24 bytes inside a block of size 136 free'd
      ==3262==    at 0x4C2AF5C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==3262==    by 0x529B1FF: virFree (viralloc.c:580)
      ==3262==    by 0x52E3703: virObjectUnref (virobject.c:270)
      ==3262==    by 0x531557E: virDomainObjListRemove (domain_conf.c:2355)
      ==3262==    by 0x1160E899: qemuDomainRemoveInactive (qemu_domain.c:2061)
      ==3262==    by 0x1163A0C6: qemuMigrationPrepareAny (qemu_migration.c:2450)
      ==3262==    by 0x1163A923: qemuMigrationPrepareDirect (qemu_migration.c:2626)
      ==3262==    by 0x11682D71: qemuDomainMigratePrepare3Params (qemu_driver.c:10309)
      ==3262==    by 0x53B0976: virDomainMigratePrepare3Params (libvirt.c:7266)
      ==3262==    by 0x1502D3: remoteDispatchDomainMigratePrepare3Params (remote.c:4797)
      ==3262==    by 0x12DECA: remoteDispatchDomainMigratePrepare3ParamsHelper (remote_dispatch.h:5741)
      ==3262==    by 0x54322EB: virNetServerProgramDispatchCall (virnetserverprogram.c:435)
      
      The mon->vm is set in qemuMonitorOpenInternal() which is the correct
      place to increase @vm ref counter. The correct place to decrease the ref
      counter is then qemuMonitorDispose().
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c7ac2519
    • B
      util: fix two virCompareLimitUlong bugs · 19e7c04d
      Bing Bu Cao 提交于
      The helper function virCompareLimitUlong compares limit values,
      where value of 0 is equal to unlimited. If the latter parameter is 0,
      it should return -1 instead of 1, hence the user can only set hard_limit when
      swap_hard_limit currently is unlimited.
      
      Worse, all callers pass 2 64-bit values, but on 32-bit platforms,
      the second argument was silently truncated to 32 bits, which
      could lead to incorrect computations.
      Signed-off-by: NBing Bu Cao <mars@linux.vnet.ibm.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      19e7c04d
    • D
      Move virNetDevVPort enum impl into virnetdevvportprofile.c · 1fb4d892
      Daniel P. Berrange 提交于
      The enum for virNetDevVPort is declared in the header file
      virnetdevvportprofile.h, but for some reason the impl is
      in netdev_vport_profile_conf.c.
      
      This causes a dep from src/util onto src/conf which is not
      allowed. Move the enum impl into virnetdevvportprofile.c
      to break the circle.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1fb4d892
    • M
      qemu_conf: Introduce "migration_address" · 1606d89c
      Michal Privoznik 提交于
      This configuration knob is there to override default listen address for
      -incoming for all qemu domains.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1606d89c
    • M
    • M
      virsocket: Introduce virSocketAddrIsWildcard · 1f9546e3
      Michal Privoznik 提交于
      This function takes exactly one argument: an address to check.
      It returns true, if the address is an IPv4 or IPv6 address in numeric
      format, false otherwise (e.g. for "examplehost").
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1f9546e3
    • M
      qemu: Introduce qemuDomainDefCheckABIStability · 7d704812
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=994364
      
      Whenever we check for ABI stability, we have new xml (e.g. provided by
      user, or obtained from snapshot, whatever) which we compare to old xml
      and see if ABI won't break. However, if the new xml was produced via
      virDomainGetXMLDesc(..., VIR_DOMAIN_XML_MIGRATABLE) it lacks some
      devices, e.g. 'pci-root' controller. Hence, the ABI stability check
      fails even though it is stable. Moreover, we can't simply fix
      virDomainDefCheckABIStability because removing the correct devices is
      task for the driver. For instance, qemu driver wants to remove the usb
      controller too, while LXC driver doesn't. That's why we need special
      qemu wrapper over virDomainDefCheckABIStability which removes the
      correct devices from domain XML, produces MIGRATABLE xml and calls the
      check ABI stability function.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      7d704812
  3. 10 10月, 2013 7 次提交
    • J
      storage_backend: Fix issue with allocation of 0 length volume · 77fb4c4f
      John Ferlan 提交于
      Commit id '532fef36' added a call to fallocate() and some error
      handling based on whether or not the function existed. This new
      call resulted in libvirt-cim/cimtest failures when attempting to
      create a volume with "0" (zero) allocation value. The failure is
      logged as:
      
      Oct  9 07:51:33 localhost libvirtd[8030]: cannot allocate 0 bytes in
      file '/var/lib/libvirt/images/cimtest-vol.img': Invalid argument
      
      This can also be seen with virsh vol-create-as:
      
      error: Failed to create vol test
      error: cannot allocate 0 bytes in file '/home/vm-images/test': Invalid
      argument
      
      error: Failed to create vol test
      error: cannot allocate 0 bytes in file '/home/vm-images/test': Invalid
      argument
      
      It turns out fallocate() will return EINVAL when the incoming 'len'
      (or allocation) value is 0 (or less).
      77fb4c4f
    • M
      qemu: Init @pcidevs in qemuPrepareHostdevPCIDevices · 9c228e08
      Michal Privoznik 提交于
      At the beginning of the function qemuPrepareHostdevPCICheckSupport() is
      called. After that @pcidevs is initialized. However, if the very first
      command fails, we go to 'cleanup' label where virObjectUnref(pcidevs) is
      called. Obviously, it is called before @pcidevs was able to get
      initialized. Compiler warns about it:
      
        CC       qemu/libvirt_driver_qemu_impl_la-qemu_hostdev.lo
      qemu/qemu_hostdev.c: In function 'qemuPrepareHostdevPCIDevices':
      qemu/qemu_hostdev.c:824:19: error: 'pcidevs' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           virObjectUnref(pcidevs);
                         ^
      cc1: all warnings being treated as errors
      9c228e08
    • P
      qemu: Prefer VFIO for PCI device passthrough · f094aaac
      Peter Krempa 提交于
      Prefer using VFIO (if available) to the legacy KVM device passthrough.
      
      With this patch a PCI passthrough device without the driver configured
      will be started with VFIO if it's available on the host. If not legacy
      KVM passthrough is checked and error is reported if it's not available.
      f094aaac
    • P
      qemu: hostdev: Add checks if PCI passthrough is available in the host · 467b561a
      Peter Krempa 提交于
      Add code to check availability of PCI passhthrough using VFIO and the
      legacy KVM passthrough and use it when starting VMs and hotplugging
      devices to live machine.
      467b561a
    • P
      f24150b1
    • P
      qemu: refactor qemuCompressProgramAvailable() · a863b890
      Peter Krempa 提交于
      a863b890
    • P
      qemu: Fix coding style in qemuDomainSaveFlags() · f2b0a533
      Peter Krempa 提交于
      Avoid mixed brace style in an if statement and fix formatting of error
      messages.
      f2b0a533
  4. 09 10月, 2013 4 次提交
    • J
      LXC: Fix handling of RAM filesystem size units · 3f029fb5
      Ján Tomko 提交于
      Since 76b644c3 when the support for RAM filesystems was introduced,
      libvirt accepted the following XML:
      <source usage='1024' unit='KiB'/>
      
      This was parsed correctly and internally stored in bytes, but it
      was formatted as (with an extra 's'):
      <source usage='1024' units='KiB'/>
      When read again, this was treated as if the units were missing,
      meaning libvirt was unable to parse its own XML correctly.
      
      The usage attribute was documented as being in KiB, but it was not
      scaled if the unit was missing. Transient domains still worked,
      because this was balanced by an extra 'k' in the mount options.
      
      This patch:
      Changes the parser to use 'units' instead of 'unit', as the latter
      was never documented (fixing persistent domains) and some programs
      (libvirt-glib, libvirt-sandbox) already parse the 'units' attribute.
      
      Removes the extra 'k' from the tmpfs mount options, which is needed
      because now we parse our own XML correctly.
      
      Changes the default input unit to KiB to match documentation, fixing:
      https://bugzilla.redhat.com/show_bug.cgi?id=1015689
      3f029fb5
    • C
      cgroup: fix a comment typo in vircgroup.c · fc9a416d
      Chen Hanxiao 提交于
      s/shoule/should
      Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com>
      fc9a416d
    • J
      storage: Use bool instead of int · 63b6e59f
      Ján Tomko 提交于
      Commit 532fef36 added two-state 'need_alloc' and exposed
      'want_sparse' which also only has two states.
      
      Change their type from int to bool.
      63b6e59f
    • G
      build: fix linker error on FreeBSD · a90b9778
      Giuseppe Scrivano 提交于
      Commit 2d74822a renamed
      "freebsdNodeGetCPUCount" to "appleFreebsdNodeGetCPUCount", leaving one
      call to "freebsdNodeGetCPUCount".  Fix this other case.
      Signed-off-by: NGiuseppe Scrivano <gscrivan@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a90b9778
  5. 08 10月, 2013 3 次提交
    • P
      qemu: hostdev: Refactor PCI passhrough handling · 9d132989
      Peter Krempa 提交于
      To simplify future patches dealing with this code, simplify and refactor
      some conditions to switch statements.
      9d132989
    • M
      virerror: s/VIR_ERR_STORAGE_VOL_EXISTS/VIR_ERR_STORAGE_VOL_EXISTS/ · 4b744d7d
      Michal Privoznik 提交于
      We currently have other error codes in singular form, e.g.
      VIR_ERR_NETWORK_EXIST. Cleanup the previous patch to match the form.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      4b744d7d
    • H
      fix a ambiguous output of the command:'virsh vol-create-as' · 91875896
      Hongwei Bi 提交于
      I created a storage volume(eg: test) from a storage pool(eg:vg10) using
      the following command:"virsh vol-create-as --pool vg10 --name test --capacity 300M."
      When I re-executed the above command, the output was as the following:
      "error: Failed to create vol test
       error: Storage volume not found: storage vol 'test' already exists"
      
      I think the output "Storage volume not found" is not appropriate. Because in fact storage
      vol test has been found at this time. And then I think virErrorNumber should includes
      VIR_ERR_STORAGE_EXIST which can also be used elsewhere. So I make this patch. The result
      is as following:
      "error: Failed to create vol test
       error: storage volume 'test' exists already"
      91875896
  6. 07 10月, 2013 6 次提交
  7. 05 10月, 2013 1 次提交
    • E
      build: fix build on RHEL 5 · 51c82165
      Eric Blake 提交于
      On RHEL 5, compilation fails with:
      
      storage/storage_backend.c: In function 'createRawFile':
      storage/storage_backend.c:339: warning: implicit declaration of function 'fallocate'
      storage/storage_backend.c:339: warning: nested extern declaration of 'fallocate' [-Wnested-externs]
      
      But:
      
      $ grep HAVE_FALLOCATE config.h
      /* #undef HAVE_FALLOCATE */
      
      Huh? It turns out that in kernels that old, fallocate() is not
      implemented (config.h is correct), but <linux/fs.h> defines
      HAVE_FALLOCATE as an empty witness macro for a completely
      different purpose.  Since storage_backend.c is including
      <linux/fs.h> on RHEL 5, we are hosed by the kernel definition.
      Newer kernels no longer pollute the namespace, and it's fairly
      easy to convert to an expression that works with both the old
      kernel witness and the new-style config.h (undefined or 1).
      
      Problem introduced in commit 532fef36.
      
      * src/storage/storage_backend.c (createRawFile): Avoid namespace
      pollution from kernel, by checking HAVE_FALLOCATE for a value.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      51c82165