1. 08 3月, 2010 1 次提交
    • E
      build: consistently use C99 varargs macros · 2e56fb2b
      Eric Blake 提交于
      Prior to this patch, there was an inconsistent mix between GNU and C99.
      
      For consistency, and potential portability to other compilers, stick
      with the C99 vararg macro syntax.
      
      * src/conf/cpu_conf.c (virCPUReportError): Use C99 rather than GNU
        vararg macro syntax.
      * src/conf/domain_conf.c (virDomainReportError): Likewise.
      * src/conf/domain_event.c (eventReportError): Likewise.
      * src/conf/interface_conf.c (virInterfaceReportError): Likewise.
      * src/conf/network_conf.c (virNetworkReportError): Likewise.
      * src/conf/node_device_conf.h (virNodeDeviceReportError): Likewise.
      * src/conf/secret_conf.h (virSecretReportError): Likewise.
      * src/conf/storage_conf.h (virStorageReportError): Likewise.
      * src/esx/esx_device_monitor.c (ESX_ERROR): Use C99 rather than
        GNU vararg macro syntax.
      * src/esx/esx_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_interface_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_network_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_secret_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_storage_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_util.c (ESX_ERROR): Likewise.
      * src/esx/esx_vi.c (ESX_VI_ERROR): Likewise.
      * src/esx/esx_vi_methods.c (ESX_VI_ERROR): Likewise.
      * src/esx/esx_vi_types.c (ESX_VI_ERROR): Likewise.
      * src/esx/esx_vmx.c (ESX_ERROR): Likewise.
      * src/util/hostusb.c (usbReportError): Use C99 rather than GNU
        vararg macro syntax.
      * src/util/json.c (virJSONError): Likewise.
      * src/util/macvtap.c (ReportError): Likewise.
      * src/util/pci.c (pciReportError): Likewise.
      * src/util/stats_linux.c (virStatsError): Likewise.
      * src/util/util.c (virUtilError): Likewise.
      * src/util/xml.c (virXMLError): Likewise.
      * src/xen/proxy_internal.c (virProxyError): Use C99 rather than
        GNU vararg macro syntax.
      * src/xen/sexpr.c (virSexprError): Likewise.
      * src/xen/xen_driver.c (xenUnifiedError): Likewise.
      * src/xen/xen_hypervisor.c (virXenError): Likewise.
      * src/xen/xen_inotify.c (virXenInotifyError): Likewise.
      * src/xen/xend_internal.c (virXendError): Likewise.
      * src/xen/xm_internal.c (xenXMError): Likewise.
      * src/xen/xs_internal.c (virXenStoreError): Likewise.
      * src/cpu/cpu.h (virCPUReportError): Use C99 rather than GNU
        vararg macro syntax.
      * src/datatypes.c (virLibConnError): Likewise.
      * src/interface/netcf_driver.c (interfaceReportError): Likewise.
      * src/libvirt.c (virLibStreamError): Likewise.
      * src/lxc/lxc_conf.h (lxcError): Likewise.
      * src/network/bridge_driver.c (networkReportError): Likewise.
      * src/nodeinfo.c (nodeReportError): Likewise.
      * src/opennebula/one_conf.h (oneError): Likewise.
      * src/openvz/openvz_conf.h (openvzError): Likewise.
      * src/phyp/phyp_driver.c (PHYP_ERROR): Likewise.
      * src/qemu/qemu_conf.h (qemuReportError): Likewise.
      * src/remote/remote_driver.c (errorf): Likewise.
      * src/security/security_driver.h (virSecurityReportError): Likewise.
      * src/test/test_driver.c (testError): Likewise.
      * src/uml/uml_conf.h (umlReportError): Likewise.
      * src/vbox/vbox_driver.c (vboxError): Likewise.
      * src/vbox/vbox_tmpl.c (vboxError): Likewise.
      2e56fb2b
  2. 06 3月, 2010 9 次提交
    • J
      ebtablesAddRemoveRule: avoid dead store · 4dbed7d9
      Jim Meyering 提交于
      * src/util/ebtables.c (ebtablesAddRemoveRule): Avoid dead store
      to local, "s".
      4dbed7d9
    • J
      virInterfaceDefParseBond: avoid dead stores · c101092a
      Jim Meyering 提交于
      * src/conf/interface_conf.c (virInterfaceDefParseBond): Avoid dead stores
      to local, "node".  Remove declaration, too.
      c101092a
    • J
      xenXMDomainConfigParse: avoid dead store · fbe65e5e
      Jim Meyering 提交于
      * src/xen/xm_internal.c (xenXMDomainConfigParse): Avoid dead store
      to local, "data".  Remove declaration, too.
      fbe65e5e
    • J
      qemudDomainAttachSCSIDisk: handle empty controller list · f5a6ce44
      Jim Meyering 提交于
      * src/qemu/qemu_driver.c (qemudDomainAttachSCSIDisk): Handle
      the (theoretical) case of an empty controller list, so that
      clang does not think the subsequent dereference of "cont"
      would dereference an undefined variable (due to preceding
      loop not iterating even once).
      f5a6ce44
    • J
      qemu restore: don't let corrupt input provoke unwarranted OOM · 1a4d5c95
      Jim Meyering 提交于
      * src/qemu/qemu_driver.c (qemudDomainRestore): A corrupt save file
      (in particular, a too-large header.xml_len value) would cause an
      unwarranted out-of-memory error.  Do not trust the just-read
      header.xml_len.  Instead, merely use that as a hint, and
      read/allocate up to that number of bytes from the file.
      Also verify that header.xml_len is positive; if it were negative,
      passing it to virFileReadLimFD could cause trouble.
      1a4d5c95
    • J
      virFileReadLimFD: diagnose maxlen <= 0, rather than passing it on... · 32884a7e
      Jim Meyering 提交于
      to saferead_lim, which interprets it as a size_t.
      * src/util/util.c (virFileReadLimFD): Do not malfunction when
      maxlen < -1.  Return -1,EINVAL in that case.  Handle maxlen==0
      in the same manner.
      32884a7e
    • J
      xen: don't let bogus packets trigger over-allocation and segfault · ba918ac1
      Jim Meyering 提交于
      * src/xen/proxy_internal.c (xenProxyDomainDumpXML): An invalid packet
      could include a too-large "ans.len" value, which would make us allocate
      too much memory and then copy data from beyond the end of "ans",
      possibly evoking a segfault.  Ensure that the value we use is no
      larger than the remaining portion of "ans".
      Also, change unnecessary memmove to memcpy (src and dest obviously
      do not overlap, so no need to use memmove).
      (xenProxyDomainGetOSType): Likewise.
      (xenProxyGetCapabilities): Likewise.
      ba918ac1
    • J
      qemuMonitorTextGetMemoryStats: decrease risk of false positive in parsing · 4697def6
      Jim Meyering 提交于
      The code erroneously searched the entire "reply" for a comma, when
      its intent was to search only that portion after "balloon: actual="
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextGetMemoryStats):
      Search for "," only starting *after* the BALLOON_PREFIX string.
      Otherwise, we'd be more prone to false positives.
      4697def6
    • D
      Release of libvirt-0.7.7 · 703c1651
      Daniel Veillard 提交于
      * configure.ac libvirt.spec.in: update with new version
      * docs/news.html.in: add list of changes in 0.7.7
      * po/*po*: updated spanish and russian localisations, rebuilt
      703c1651
  3. 05 3月, 2010 10 次提交
    • D
      Fix USB passthrough based on product/vendor · 09ed0729
      Daniel P. Berrange 提交于
      Changeset
      
        commit 5073aa99
        Author: Cole Robinson <crobinso@redhat.com>
        Date:   Mon Jan 11 11:40:46 2010 -0500
      
      Added support for product/vendor based passthrough, but it only
      worked at the security driver layer. The main guest XML config
      was not updated with the resolved bus/device ID. When the QEMU
      argv refactoring removed use of product/vendor, this then broke
      launching guests.
      
      THe solution is to move the product/vendor resolution up a layer
      into the QEMU driver. So the first thing QEMU does is resolve
      the product/vendor to a bus/device and updates the XML config
      with this info. The rest of the code, including security drivers
      and QEMU argv generated can now rely on bus/device always being
      set.
      
      * src/util/hostusb.c, src/util/hostusb.h: Split vendor/product
        resolution code out of usbGetDevice and into usbFindDevice.
        Add accessors for bus/device ID
      * src/security/virt-aa-helper.c, src/security/security_selinux.c,
        src/qemu/qemu_security_dac.c: Remove vendor/product from the
        usbGetDevice() calls
      * src/qemu/qemu_driver.c: Use usbFindDevice to resolve vendor/product
        into a bus/device ID
      09ed0729
    • D
      Convert QEMU driver all hotunplug code from pci_del to device_del · 84a25570
      Daniel P. Berrange 提交于
      The pci_del command is not being ported to QMP. Convert all the
      QEMU hotplug code over to use device_del whenever it is available
      to avoid the pci_del problem
      
      * src/qemu/qemu_driver.c: Convert unplug code to device_del
      84a25570
    • D
      Support hot-unplug for USB devices in QEMU · 8c82479d
      Daniel P. Berrange 提交于
      Previously hot-unplug could not be supported for USB devices
      in QEMU, since usb_del required the guest visible address
      which libvirt never knows. With 'device_del' command we can
      now unplug based on device alias, so support that.
      
      * src/qemu/qemu_driver.c: Use device_del to remove USB devices
      8c82479d
    • D
      Tweak container initialization to make upstart/init happier · b70a1f45
      Daniel P. Berrange 提交于
      Upstart crashes & burns in a heap if $TERM environment variable
      is missing. Presumably the kernel always sets this when booting
      init on a real machine, so libvirt should set it for containers
      too.
      
      To make a typical inittab / mingetty setup happier, we need to
      symlink the primary console /dev/pts/0 to /dev/tty1.
      
      Improve logging in certain scenarios to make troubleshooting
      easier
      
      * src/lxc/lxc_container.c: Create /dev/tty1 and set $TERM
      b70a1f45
    • D
      Misc fixes for LXC cgroups setup · 57db02e8
      Daniel P. Berrange 提交于
      When using the 'ns' cgroup controller, the moment a process calls
      'unshare(CLONE_NEWNS)', it will be given a private cgroup tree
      under its current location. This really messages up the LXC
      controller process, because it ends up creating the containers'
      cgroup in the wrong place. The fix is fairly easy, just move
      the cgroup setup before the code which calls unshare(). The
      'ns' controller will still create extra undesired cgroups, but
      they at least won't break libvirt's setup now.
      
      The patch also adds a missing cgroups allow rule for /dev/tty
      device node
      57db02e8
    • D
      Avoid creating top level cgroups if just querying for existance · ede3bc11
      Daniel P. Berrange 提交于
      When getting the driver/domain cgroup it is possible to specify
      whether it should be auto created. If auto-creation was turned
      off, libvirt still mistakenly created its own top level cgroup
      
      * src/util/cgroup.c: Honour autocreate flag for top level cgroup
      ede3bc11
    • S
      web docs -- macvtap mode explanation · 5c0e525c
      Stefan Berger 提交于
      This adds more information about the different macvtap device modes,
      spells out VEPA and adds a link to a pdf at the ieee site.
      5c0e525c
    • L
      Change default for storage uid/gid from getuid()/getgid() to -1/-1 · 219305df
      Laine Stump 提交于
      This allows the config to have a setting that means "leave it alone",
      eg when building a pool where the directory already exists the user
      may want the current uid/gid of the directory left intact. This
      actually gets us back to older behavior - before recent changes to the
      pool building code, we weren't as insistent about honoring the uid/gid
      settings in the XML, and virt-manager was taking advantage of this
      behavior.
      
      As a side benefit, removing calls to getuid/getgid from the XML
      parsing functions also seems like a good idea. And having a default
      that is different from a common/useful value (0 == root) is a good
      thing in general, as it removes ambiguity from decisions (at least one
      place in the code was checking for (perms.uid == 0) to see if a
      special uid was requested).
      
      Note that this will only affect newly created pools and volumes. Due
      to the way that the XML is parsed, then formatted for newly created
      volumes, all existing pools/volumes already have an explicit uid and
      gid set.
      
      src/conf/storage_conf.c: Remove calls to setuid/setgid for default values
                               of uid/gid, and set them to -1 instead
      
      src/storage/storage_backend.c:
      src/storage/storage_backend_fs.c:
              Make account for the new default values of perms.uid
              and perms.gid.
      219305df
    • D
      build: vbox: avoid build failure when linking with --no-add-needed · c7434706
      Diego Elio Pettenò 提交于
      With the recent changes to the linking defaults in Fedora 13 (namely
      enabling --no-add-needed behaviour by default), we have to pass the
      dlopen()-providing libraries directly at the link of the module; use the
      same AC_SEARCH_LIBS function as used before to look for it and add it to
      the Makefile.
      c7434706
    • D
      build: avoid dlopen-related link failure on rawhide/F13 · fd04fbaa
      Diego Elio Pettenò 提交于
      Instead of using AC_CHECK_LIB and hardcoding -ldl, search for the library
      needed to get dlopen() and then use the cached value.
      fd04fbaa
  4. 04 3月, 2010 8 次提交
    • D
      Support VCPU hotplug in QEMU guests · e8d6c289
      Daniel P. Berrange 提交于
      QEMU has a monitor command 'set_cpu' which allows a specific
      CPU to be toggled between online& offline state. libvirt CPU
      hotplug does not work in terms of individual indexes CPUs.
      Thus to support this, we iteratively toggle the online state
      when the total number of vCPUs is adjusted via libvirt
      
      NB, currently untested since QEMU segvs when running this!
      
      * src/qemu/qemu_driver.c: Toggle online state for CPUs when
        doing hotplug
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
        monitor API for toggling a CPU's online status via 'set_cpu
      e8d6c289
    • D
      Fix parser checking of storage pool device · ce5ced1d
      Daniel P. Berrange 提交于
      The storage backend implementations all presume that the XML parser
      is validating correctness of the source specification. The check for
      a source device was lost at some point. This allowed for a potential
      crash in the disk backend. Re-introduce the sanity check
      
      * src/conf/storage_conf.c: Re-add check for source device
      ce5ced1d
    • D
      Fix mis-leading error message in pool delete API · e609aae6
      Daniel P. Berrange 提交于
      When trying to delete a pool the error message claimed the volume
      could not be deleted.
      
      * src/storage/storage_driver.c: Error message referred to
        volumes instead of pools
      e609aae6
    • D
      Fix typo in QEMU migration command name · 1227d086
      Daniel P. Berrange 提交于
      The QMP code was running query-migration instead of query-migrate.
      This doesn't work so well
      
      * src/qemu/qemu_monitor_json.c: s/query-migration/query-migrate/
      1227d086
    • D
      Don't raise error message from cgroups if QEMU fails to start · b50d48b1
      Daniel P. Berrange 提交于
      The code to remove the cgroup after QEMU failed to startup could
      be obscuring a real error from earlier on. It is not neccessary
      to raise an error in this case, so tell cgroups to keep quiet
      
      * src/qemu/qemu_driver.c: Don't raise cgroups error in QEMU start
        cleanup code.
      b50d48b1
    • D
      Add missing device type check in QEMU PCI hotunplug · badfe6c7
      Daniel P. Berrange 提交于
      The QEMU hotunplug code for PCI devices was looking at host
      devices in the guest config without first filtering non
      PCI devices. This means it was reading garbage
      
      * src/qemu/qemu_driver.c: Filter out non-PCI devices
      badfe6c7
    • C
      Add a define for NFS_SUPER_MAGIC · 6ef5a5be
      Chris Lalancette 提交于
      Commit 3c12a67b added
      a dependency on the NFS_SUPER_MAGIC macro, which is
      defined in linux/magic.h.  Unfortunately linux/magic.h
      is not available in RHEL-5, and causes a compile error.
      Just define it locally, since this is something that
      can't change.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      6ef5a5be
    • L
      Make domain save work on root-squash NFS · 3c12a67b
      Laine Stump 提交于
      Move *all* file operations related to creation and writing of libvirt
      header to the domain save file into a hook function that is called by
      virFileOperation. First try to call virFileOperation as root. If that
      fails with EACCESS, and (in the case of Linux) statfs says that we're
      trying to save the file on an NFS share, rerun virFileOperation,
      telling it to fork a child process and setuid to the qemu user. This
      is the only way we can successfully create a file on a root-squashed
      NFS server.
      
      This patch (along with setting dynamic_ownership=0 in qemu.conf)
      makes qemudDomainSave work on root-squashed NFS.
      
      * src/qemu/qemu_driver.c: provide new qemudDomainSaveFileOpHook()
        utility, use it in qemudDomainSave() if normal creation of the
        file as root failed, and after checking the filesystem type for
        the storage is NFS. In that case we also bypass the security
        driver, as this would fail on NFS.
      3c12a67b
  5. 03 3月, 2010 12 次提交
    • L
      Fix domain restore for files on root-squash NFS · a03121bc
      Laine Stump 提交于
      If qemudDomainRestore fails to open the domain save file, create a
      pipe, then fork a process that does setuid(qemu_user) and opens the
      file, then reads this file and stuffs it into the pipe. the parent
      libvirtd process will use the other end of the pipe as its fd, then
      reap the child process after it's done reading.
      
      This makes domain restore work on a root-squash NFS share that is only
      visible to the qemu user.
      
      * src/qemu/qemu_driver.c: add new qemudOpenAsUID() helper function,
        and use it in qemudDomainRestore() if reading as root directly failed.
      a03121bc
    • D
      Fix USB/PCI device address aliases in QEMU hotplug driver · 9882123d
      Daniel P. Berrange 提交于
      The USB/PCI device hotplug code for the QEMU driver was forgetting
      to allocate a unique device alias.
      
      * src/qemu/qemu_driver.c: Fill in device alias for USB/PCI devices
      9882123d
    • D
      Fix detection of errors in QEMU device_add command · 44f68729
      Daniel P. Berrange 提交于
      The code assumed that 'device_add' returned an empty string upon
      success. This is not true, it sometimes prints random debug info.
      THus we need to check for an explicit fail string
      
      * src/qemu/qemu_monitor_text.c: Fix error checking of the device_add
        monitor command
      44f68729
    • E
      esx: don't ignore failure on close · a8464c51
      Eric Blake 提交于
      Another warning caught by coverity.  Continue to perform best-effort
      closing and resource release, but warn the caller about the failure.
      
      * src/esx/esx_driver.c (esxClose): Return an error on failure to close.
      a8464c51
    • E
      uml: avoid crash on partial read · 4acbb298
      Eric Blake 提交于
      Coverity detected a potential dereference of uninitialized memory
      if recvfrom got cut short.
      
      * src/uml/uml_driver.c (umlMonitorCommand): Validate complete read
      prior to dereferencing res.
      4acbb298
    • E
      virsh: silence compiler warning · 2103d87c
      Eric Blake 提交于
      gcc warns:
      virsh.c:1879: warning: '0' flag ignored with '-' flag in gnu_printf format
      
      * tools/virsh.c (cmdDomjobinfo): Delete useless flag.
      2103d87c
    • J
      Fix safezero() · a64e3b3e
      Jiri Denemark 提交于
      Various safezero() implementations used either -1, errno or -errno
      return values. This patch fixes them all to return -1 and set errno
      appropriately.
      
      There was also a bug in size parameter passed to safewrite() which could
      result in an attempt to write gigabytes out of a megabyte buffer.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      a64e3b3e
    • D
      Fix QEMU domain state after a save attempt fails · cf104533
      Daniel P. Berrange 提交于
      When a VM save attempt failed, the VM would be left in a paused
      state. It is neccessary to resume CPU execution upon failure
      if it was running originally
      
      * src/qemu/qemu_driver.c: Resume CPUs upon save failure
      cf104533
    • D
      Support job cancellation in QEMU driver · 04c7abd9
      Daniel P. Berrange 提交于
      This supports cancellation of jobs for the QEMU driver against
      the virDomainMigrate, virDomainSave and virDomainCoreDump APIs.
      It is not yet supported for the virDomainRestore API, although
      it is desirable.
      
      * src/qemu/qemu_driver.c: Issue 'migrate_cancel' command if
        virDomainAbortJob is issued during a migration operation
      * tools/virsh.c: Add a domjobabort command
      04c7abd9
    • D
      Remote driver implementation for the virDomainAbortJob APi · b1a7ebfd
      Daniel P. Berrange 提交于
      This defines the wire protocol for the new API
      
      * src/remote/remote_protocol.x: Wire protocol definition
      * src/remote/remote_driver.c,daemon/remote.c: Client and server
        side implementation
      * daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
        daemon/remote_dispatch_table.h, src/remote/remote_protocol.c,
        src/remote/remote_protocol.h: Re-generate from remote_protocol.x
      b1a7ebfd
    • D
      Wire up internal entry points for virDomainAbortJob API · 0d8aa35f
      Daniel P. Berrange 提交于
      This provides the internal glue for the driver API
      
      * src/driver.h: Internal API contract
      * src/libvirt.c, src/libvirt_public.syms: Connect public API
        to driver API
      * src/esx/esx_driver.c, src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
        src/openvz/openvz_driver.c, src/phyp/phyp_driver.c,
        src/qemu/qemu_driver.c, src/remote/remote_driver.c,
        src/test/test_driver.c src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
        src/xen/xen_driver.c: Stub out entry points
      0d8aa35f
    • D
      Introduce public API for cancelling async domain jobs · 4fee63fe
      Daniel P. Berrange 提交于
      The new virDomainAbortJob() method provides a way for a second
      thread to abort an ongoing job run by another thread. This
      extends to any API with  which the virDomainGetJobInfo() API
      is intended to work. Cancellation is not guarenteed, rather best
      effort on part of the hypervisor and not required to be implmented.
      
      * include/libvirt/libvirt.h.in: Define virDomainAbortJob()
      4fee63fe