1. 19 10月, 2011 1 次提交
    • E
      snapshot: detect when qemu lacks disk-snapshot support · dad15a2e
      Eric Blake 提交于
      Noticed when testing new libvirt against old qemu that lacked the
      snapshot_blkdev HMP command.  Libvirt was mistakenly treating the
      command as successful, and re-writing the domain XML to use the
      just-created 0-byte file, rendering the domain broken on restart.
      
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextDiskSnapshot):
      Notice another possible error message.
      * src/qemu/qemu_driver.c
      (qemuDomainSnapshotCreateSingleDiskActive): Don't keep 0-byte file
      on failure.
      dad15a2e
  2. 18 10月, 2011 6 次提交
    • G
      virBufferEscapeShell: Fix escaping of single quotes. · 94f776e7
      Guido Günther 提交于
      When checking if we need to escape a single quote we were looking at the
      character after the quote instead of at the quote itself.
      94f776e7
    • X
      compile: Add a missing function 'pciDeviceListFind' to libvirt_private.syms · de12bee7
      Xu He Jie 提交于
      compile error:
      ./src/.libs/libvirt_driver_qemu.a(libvirt_driver_qemu_la-qemu_hostdev.o): In function `qemuPrepareHostdevPCIDevices':
      /home/soulxu/data/work-code/libvirt/src/qemu/qemu_hostdev.c:183: undefined reference to `pciDeviceListFind'
      /home/soulxu/data/work-code/libvirt/src/qemu/qemu_hostdev.c:230: undefined reference to `pciDeviceListFind'
      ./src/.libs/libvirt_driver_qemu.a(libvirt_driver_qemu_la-qemu_hostdev.o): In function `qemuGetActivePciHostDeviceList':
      /home/soulxu/data/work-code/libvirt/src/qemu/qemu_hostdev.c:102: undefined reference to `pciDeviceListFind'
      ./src/.libs/libvirt_driver_qemu.a(libvirt_driver_qemu_la-qemu_hostdev.o): In function `qemuDomainReAttachHostdevDevices':
      /home/soulxu/data/work-code/libvirt/src/qemu/qemu_hostdev.c:370: undefined reference to `pciDeviceListFind'
      Signed-off-by: NXu He Jie <xuhj@linux.vnet.ibm.com>
      de12bee7
    • O
      qemu: Do not wait if the PCI device is not managed when reattaching · 7fb50e30
      Osier Yang 提交于
      Waiting for qemu-kvm cleaning up the PCI bar(s) mapping with long time
      while the device is not managed is just waste of time.
      7fb50e30
    • J
      Add AHCI support to qemu driver · c1bc3d89
      Jim Fehlig 提交于
      Tested with multiple AHCI controllers and multiple disks attached
      to a controller. E.g.,
      
          <disk type='file' device='disk'>
            <driver name='qemu' type='raw'/>
            <source file='/var/lib/libvirt/images/test/disk0.raw'/>
            <target dev='sda' bus='sata'/>
            <address type='drive' controller='0' bus='0' unit='0'/>
          </disk>
          <disk type='file' device='disk'>
            <driver name='qemu' type='raw'/>
            <source file='/var/lib/libvirt/images/test/disk1.raw'/>
            <target dev='sdb' bus='sata'/>
            <address type='drive' controller='0' bus='0' unit='1'/>
          </disk>
          <disk type='file' device='disk'>
            <driver name='qemu' type='raw'/>
            <source file='/var/lib/libvirt/images/test/disk2.raw'/>
            <target dev='sdc' bus='sata'/>
            <address type='drive' controller='1' bus='0' unit='0'/>
          </disk>
          <controller type='sata' index='0'>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
          </controller>
          <controller type='sata' index='1'>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
          </controller>
      c1bc3d89
    • E
      snapshot: implement LIST_LEAVES flag in esx · e570d7c4
      Eric Blake 提交于
      Relatively straight-forward filtering.
      
      * src/esx/esx_vi.h (esxVI_GetNumberOfSnapshotTrees)
      (esxVI_GetSnapshotTreeNames): Add parameter.
      * src/esx/esx_vi.c (esxVI_GetNumberOfSnapshotTrees)
      (esxVI_GetSnapshotTreeNames): Allow leaf filtering.
      * src/esx/esx_driver.c (esxDomainSnapshotNum)
      (esxDomainSnapshotListNames, esxDomainSnapshotNumChildren)
      (esxDomainSnapshotListChildrenNames): Pass new flag through.
      e570d7c4
    • P
      Fix virt-sanlock-cleanup documentation · 9f4b49cd
      Philipp Hahn 提交于
      The referenced page does not exist, but locking.html has a section about
      sanlock.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      9f4b49cd
  3. 17 10月, 2011 3 次提交
  4. 15 10月, 2011 7 次提交
    • W
      build: fix 'make dist' error · 1afcfbdd
      Wen Congyang 提交于
      When I run 'make dist', I receive the following error messages:
      make[1]: Entering directory `/home/wency/source/libvirt/src'
        GEN    remote/remote_protocol.h
        GEN    remote/remote_protocol.c
        GEN    remote/qemu_protocol.h
        GEN    remote/qemu_protocol.c
        GEN    remote/qemu_client_bodies.h
        CC     libvirt_driver_remote_la-remote_protocol.lo
      In file included from ./remote/remote_protocol.h:16,
                       from ./remote/remote_protocol.c:7:
      /internal.h:249:23: error: probes.h: No such file or directory
      make[1]: *** [libvirt_driver_remote_la-remote_protocol.lo] Error 1
      make[1]: Leaving directory `/home/wency/source/libvirt/src'
      make: *** [distdir] Error 1
      
      The reason is that we use probes.h before generating it.
      1afcfbdd
    • R
      Add missing strdup return value check · 7c23c34d
      Roopa Prabhu 提交于
      Check strdup return value and fail if error
      Signed-off-by: NRoopa Prabhu <roprabhu@cisco.com>
      7c23c34d
    • O
      qemu: Honor the orginal PCI dev properties when reattaching · d0935478
      Osier Yang 提交于
      BZ# https://bugzilla.redhat.com/show_bug.cgi?id=736214
      
      The problem is caused by the original info of domain's PCI dev is
      maintained by qemu_driver->activePciHostdevs list, (E.g. dev->reprobe,
      which stands for whether need to reprobe driver for the dev when do
      reattachment). The fields (dev->reprobe, dev->unbind_from_stub, and
      dev->remove_slot) are initialized properly when preparing the PCI
      device for managed attachment. However, when do reattachment, it
      construct a complete new "pciDevice" without honoring the original
      dev info, and thus the dev won't get the original driver or can get
      other problem.
      
      This patch is to fix the problem by get the devs from list
      driver->activePciHostdevs.
      
      Tested with following 3 scenarios:
        * the PCI was bound to some driver not pci-stub before attaching
      
          result: the device will be bound to the original driver
      
        * the PCI was bound to pci-stub before attaching
      
          result: no driver reprobing, and still bound to pci-stub
      
        * The PCI was not bound to any driver
      
          result: no driver reprobing, and still not bound to any driver.
      d0935478
    • R
      macvtap: avoid invalid free · 80b077ee
      Roopa Prabhu 提交于
      Commit 0472f39f plugged a leak, but introduced another bug:
      
      Actually looks like physfndev is conditionally allocated in getPhysfnDev
      Its better to modify getPhysfnDev to allocate physfndev every time.
      80b077ee
    • L
      docs: fix network XML documentation · 4040ff66
      Laine Stump 提交于
      A few people have attempted to use the new forwarding modes with older
      versions of libvirt. The docs where the modes are described have
      always stated the minimum required libvirt version, but the examples
      at the end didn't, which I believe is what has caused the confusion.
      
      Similarly, the section on portgroups now has a version tag added at
      the beginning.
      
      I also noticed that there was no example of defining a <dns> hostname,
      so I added one, as well as making the domain name example more
      recognizable (by adding ".com" to the domain).
      4040ff66
    • J
      Clarify semantics of virDomainMigrate2 · 5d784bd6
      Jiri Denemark 提交于
      Explicitly disallow conflicts between domain name from dxml and dname.
      5d784bd6
    • O
      qemu: Do not reattach PCI device used by other domain when shutdown · 24b8be89
      Osier Yang 提交于
      When failing on starting a domain, it tries to reattach all the PCI
      devices defined in the domain conf, regardless of whether the devices
      are still used by other domain. This will cause the devices to be deleted
      from the list qemu_driver->activePciHostdevs, thus the devices will be
      thought as usable even if it's not true. And following commands
      nodedev-{reattach,reset} will be successful.
      
      How to reproduce:
        1) Define two domains with same PCI device defined in the confs.
        2) # virsh start domain1
        3) # virsh start domain2
        4) # virsh nodedev-reattach $pci_device
      
      You will see the device will be reattached to host successfully.
      As pciDeviceReattach just check if the device is still used by
      other domain via checking if the device is in list driver->activePciHostdevs,
      however, the device is deleted from the list by step 2).
      
      This patch is to prohibit the bug by:
        1) Prohibit a domain starting or device attachment right at
           preparation period (qemuPrepareHostdevPCIDevices) if the
           device is in list driver->activePciHostdevs, which means
           it's used by other domain.
      
        2) Introduces a new field for struct _pciDevice, (const char *used_by),
           it will be set as the domain name at preparation period,
           (qemuPrepareHostdevPCIDevices). Thus we can prohibit deleting
           the device from driver->activePciHostdevs if it's still used by
           other domain when stopping the domain process.
      
      * src/pci.h (define two internal functions, pciDeviceSetUsedBy and
          pciDevceGetUsedBy)
      * src/pci.c (new field "const char *used_by" for struct _pciDevice,
          implementations for the two new functions)
      * src/libvirt_private.syms (Add the two new internal functions)
      * src/qemu_hostdev.h (Modify the definition of functions
          qemuPrepareHostdevPCIDevices, and qemuDomainReAttachHostdevDevices)
      * src/qemu_hostdev.c (Prohibit preparation and don't delete the
          device from activePciHostdevs list if it's still used by other domain)
      * src/qemu_hotplug.c (Update function usage, as the definitions are
          changed)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      24b8be89
  5. 14 10月, 2011 21 次提交
    • P
      Xen: Fake versions in xencapstest · 435b9d99
      Philipp Hahn 提交于
      virInitialize() → xenRegister() → xenhypervisorInit() determines the
      version of the Hypervisor. This breaks xencapstest when building as root
      on a dom0 system, since xenHypervisorBuildCapabilities() adds the "hap"
      and "viridian" features based on the detected version.
      
      Add an optional parameter to xenhypervisorInit() to disable automatic
      detection of the Hypervisor version. The passed in arguments are used
      instead.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      435b9d99
    • P
      Xen: move versions to struct · 618758c9
      Philipp Hahn 提交于
      Calling virInitialize() → xenRegister() → xenhypervisorInit() directly
      opens a connection to the Xen Hypervisor, which breaks some unit tests.
      
      Move all static variables into a struct to make it easier to override
      them when testing.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      618758c9
    • E
      esx: drop dead code to silence Coverity · 1518042b
      Eric Blake 提交于
      Coverity detected that the only way to get to the cleanup label
      is if objectSpec had been successfully allocated, so the null
      check was dead code.
      
      * src/esx/esx_vi.c (esxVI_LookupObjectContentByType): Drop
      redundant null check.
      1518042b
    • J
      util: Fix typo in virGetHostname description · 57d91fca
      Jiri Denemark 提交于
      57d91fca
    • D
      Fix syntax problem in mingw32-libvirt.spec.in · aaa937c0
      Daniel P. Berrange 提交于
      When defining macros, you can't put comments on the end of the
      line because they will get included in the macro definition
      
      * mingw32-libvirt.spec.in: Fix comment about hyperv
      aaa937c0
    • E
      macvtap: plug memory leak for 802.1Qbh · 0472f39f
      Eric Blake 提交于
      Detected by Coverity.  Leak present since commit ca3b22bb.
      
      * src/util/macvtap.c (doPortProfileOp8021Qbh): Release device name.
      0472f39f
    • E
      qemu: plug memory leak on migration · 16e7b5fa
      Eric Blake 提交于
      Detected by Coverity.  Leak introduced in commit 72de0d28.
      
      * src/qemu/qemu_migration.c (qemuMigrationCookieGraphicsXMLParse):
      Clean up on success.
      16e7b5fa
    • E
      conf: plug memory leak on error · 5fa3d775
      Eric Blake 提交于
      Detected by Coverity.  Leak present since commit 874e65aa; and
      while commit d50bb45b tried to fix the issue, it missed a path.
      
      * src/conf/domain_conf.c (virDomainDefParseBootXML): Always clean
      up useserial.
      5fa3d775
    • G
      Use virBufferEscapeShell in virNetSocketNewConnectSSH · 6ac6238d
      Guido Günther 提交于
      to escape the netcat command since it's passed to the shell. Adjust
      expected test case output accordingly.
      6ac6238d
    • G
      Add virBufferEscapeShell · 920487b3
      Guido Günther 提交于
      Escape strings so they're safe to pass to the shell. It's based on
      virsh's cmdEcho.
      920487b3
    • G
    • E
      storage: plug memory leak on error · 8f8258e1
      Eric Blake 提交于
      Detected by Coverity.  Present since commit 82c1740a.
      
      * src/storage/storage_backend_logical.c
      (virStorageBackendLogicalMakeVol): Fix leak.
      8f8258e1
    • J
      util: Make getaddrinfo failure nonfatal in virGetHostname · f1409fa7
      Jiri Denemark 提交于
      Setting a hostname that cannot be resolved is not the best configuration
      but since virGetHostname only calls getaddrinfo to get host's canonical
      name and we do not fail if the returned canonical name is NULL or
      "localhost", there is no reason why we should fail if getaddrinfo itself
      fails.
      f1409fa7
    • J
      qemu: Make sure BeginJob is always followed by EndJob · bf7676af
      Jiri Denemark 提交于
      Otherwise we can end up with a dangling job that can only be cleared by
      restarting libvirtd.
      bf7676af
    • J
      qemu: Log debug messages when changing job · dddbfcf6
      Jiri Denemark 提交于
      Log debug messages anytime we call *BeginJob* or *EndJob* so that it's
      easier to spot incorrect usage of domain job APIs.
      dddbfcf6
    • E
      qemu: fix text block info parsing · f043ff63
      Eric Blake 提交于
      Detected by Coverity.  p (the pointer to the string) is always true;
      when in reality, we wanted to know whether the integer value of the
      just-parsed string is '0' or '1'.  Logic bug since commit b1b5b51a.
      
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextGetBlockInfo): Set
      results to proper value.
      f043ff63
    • E
      qemu: avoid text monitor null deref · 60be9e8c
      Eric Blake 提交于
      Detected by Coverity.  If, for some reason, our text monitor input
      does not match our assumptions, we end up incrementing p while it
      is NULL, then dereferencing the pointer 0x1, which will fault.
      
      * src/qemu/qemu_monitor_text.c
      (qemuMonitorTextGetBlockStatsParamsNumber): Rewrite to avoid
      deref of strchr failure.  Fix indentation.
      60be9e8c
    • E
      qemu: check for json allocation failure · ce521f24
      Eric Blake 提交于
      Detected by Coverity.  Introduced in commit b1b5b51a.
      
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONGetBlockInfo):
      Avoid null dereference.
      ce521f24
    • E
      build: add compiler attributes to virUUIDParse · 430156cf
      Eric Blake 提交于
      Coverity complained that most, but not all, clients of virUUIDParse
      were checking for errors.  Silence those coverity warnings by
      explicitly marking the cases where we trust the input, and fixing
      one instance that really should have been checking.  In particular,
      this silences a rather large percentage of the warnings I saw on my
      most recent Coverity analysis run.
      
      * src/util/uuid.h (virUUIDParse): Enforce rules.
      * src/util/uuid.c (virUUIDParse): Drop impossible check; at least
      Coverity will detect if we break rules and pass NULL.
      * src/xenapi/xenapi_driver.c (xenapiDomainCreateXML)
      (xenapiDomainLookupByID, xenapiDomainLookupByName)
      (xenapiDomainDefineXML): Ignore return when we trust data source.
      * src/vbox/vbox_tmpl.c (nsIDtoChar, vboxIIDToUUID_v3_x)
      (vboxCallbackOnMachineStateChange)
      (vboxCallbackOnMachineRegistered, vboxStoragePoolLookupByName):
      Likewise.
      * src/node_device/node_device_hal.c (gather_system_cap): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxpr): Check for errors.
      430156cf
    • M
      virFDStream: close also given errfd (fd leak) · 72851bb9
      Marc-André Lureau 提交于
      In virFDStreamOpenFileInternal(), a errfd pipe is opened by
      virCommandRunAsync() and given to virFDStreamOpenInternal().
      
      It seems virFDStream should close errfd, just like the other
      fd it is given.
      
      This fixes screenshots leaking FDs:
      http://bugzilla.redhat.com/show_bug.cgi?id=745761
      72851bb9
    • E
      command: avoid fd leak on failure · 219600c9
      Eric Blake 提交于
      virCommandTransferFD promises that the fd is no longer owned by
      the caller.  Normally, we want the fd to remain open until the
      child runs, but in error situations, we must close it earlier.
      
      * src/util/command.c (virCommandTransferFD): Close fd now if we
      can't track it to close later.
      (virCommandKeepFD): Adjust helper to make this easier.
      219600c9
  6. 13 10月, 2011 2 次提交
    • S
      Fix typo in lxc_controller · d60299c3
      Serge E. Hallyn 提交于
      s/Mouting/Mounting.
      Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com>
      d60299c3
    • E
      spec: mingw cleanups · df92bab4
      Eric Blake 提交于
      * libvirt.spec.in (%configure): Drop unused %{one} macro.
      * mingw32-libvirt.spec.in (%{rhel}): Compile ESX but not HyperV on
      mingw build for RHEL.
      (%build): Make configure honor spec conditionals.  Reorder to
      match libvirt.spec.
      * autobuild.sh (mingw): Update list to match.
      Suggested by Daniel P. Berrange.
      df92bab4