1. 15 6月, 2010 4 次提交
    • E
      remote: protocol implementation for virDomainCreateWithFlags · 6c83e7ca
      Eric Blake 提交于
      Define the wire format for the new virDomainCreateWithFlags
      API, and implement client and server side of marshaling code.
      
      * daemon/remote.c (remoteDispatchDomainCreateWithFlags): Add
      server side dispatch for virDomainCreateWithFlags.
      * src/remote/remote_driver.c (remoteDomainCreateWithFlags)
      (remote_driver): Client side serialization.
      * src/remote/remote_protocol.x
      (remote_domain_create_with_flags_args)
      (remote_domain_create_with_flags_ret)
      (REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS): Define wire format.
      * daemon/remote_dispatch_args.h: Regenerate.
      * daemon/remote_dispatch_prototypes.h: Likewise.
      * daemon/remote_dispatch_table.h: Likewise.
      * src/remote/remote_protocol.c: Likewise.
      * src/remote/remote_protocol.h: Likewise.
      * src/remote_protocol-structs: Likewise.
      6c83e7ca
    • E
      libvirt: introduce domainCreateWithFlags API · 460ca88b
      Eric Blake 提交于
      Persistent domain creation needs the same features as transient
      domains, but virDomainCreate lacks the flags argument present in
      virDomainCreateXML.  virDomainCreateFlags is already claimed as
      a public enum, so we have to break convention and expose
      virDomainCreateWithFlags.
      
      * include/libvirt/libvirt.h.in (virDomainCreateWithFlags): Add.
      * src/driver.h (virDrvDomainCreateWithFlags): Internal API.
      * src/libvirt.c (virDomainCreateWithFlags): Glue public API to
      driver API.
      * src/libvirt_public.syms (LIBVIRT_0.8.2): Expose public API.
      * src/esx/esx_driver.c (esxDriver): Add stub for driver.
      * src/lxc/lxc_driver.c (lxcDriver): Likewise.
      * src/opennebula/one_driver.c (oneDriver): Likewise.
      * src/openvz/openvz_driver.c (openvzDriver): Likewise.
      * src/phyp/phyp_driver.c (phypDriver): Likewise.
      * src/qemu/qemu_driver.c (qemuDriver): Likewise.
      * src/remote/remote_driver.c (remote_driver): Likewise.
      * src/test/test_driver.c (testDriver): Likewise.
      * src/uml/uml_driver.c (umlDriver): Likewise.
      * src/vbox/vbox_tmpl.c (Driver): Likewise.
      * src/xen/xen_driver.c (xenUnifiedDriver): Likewise.
      * src/xenapi/xenapi_driver.c (xenapiDriver): Likewise.
      460ca88b
    • E
      parthelper: fix compilation without optimization · 352b6df3
      Eric Blake 提交于
      Daniel's patch works with gcc and CFLAGS containing -O (the
      autoconf default), but fails with non-gcc or with other
      CFLAGS (such as -g), since c-ctype.h declares c_isdigit as
      a macro only for certain compilation settings.
      
      * src/Makefile.am (libvirt_parthelper_LDFLAGS): Add gnulib
      library, for when c_isdigit is not a macro.
      * src/storage/parthelper.c (main): Avoid out-of-bounds
      dereference, noticed by Jim Meyering.
      352b6df3
    • D
      Fix enumeration of partitions in disks with a trailing digit in path · bc8d9f20
      Daniel P. Berrange 提交于
      Disks with a trailing digit in their path (eg /dev/loop0 or
      /dev/dm0) have an extra 'p' appended before the partition
      number (eg, to form /dev/loop0p1 not /dev/loop01). Fix the
      partition lookup to append this extra 'p' when required
      
      * src/storage/parthelper.c: Add a 'p' before partition
        number if required
      bc8d9f20
  2. 12 6月, 2010 2 次提交
    • E
      uml: sanity check external data before using it · 582c75ec
      Eric Blake 提交于
      Otherwise, a malicious packet could cause a DoS via spurious
      out-of-memory failure.
      
      * src/uml/uml_driver.c (umlMonitorCommand): Validate that incoming
      data is reliable before using it to allocate/dereference memory.
      Don't report bogus errno on short read.
      Reported by Jim Meyering.
      582c75ec
    • M
      Improve error message for disabled client-side drivers · d0dabc2b
      Matthias Bolte 提交于
      Report that libvirt was built without that driver instead of
      trying to connect to a libvirtd, when we know that this is
      going to fail.
      d0dabc2b
  3. 11 6月, 2010 2 次提交
  4. 10 6月, 2010 1 次提交
    • E
      build: avoid pthreads-win32 on mingw · 6e5a04f0
      Eric Blake 提交于
      * src/util/threads.c (includes) [WIN32]: On mingw, favor native
      threading over pthreads-win32 library.
      * src/util/thread.h [WIN32] Likewise.
      Suggested by Daniel P. Berrange.
      6e5a04f0
  5. 09 6月, 2010 7 次提交
    • D
      Fix cgroup setup code to cope with root squashing NFS · c37c321c
      Daniel P. Berrange 提交于
      When a disk is on a root squashed NFS server, it may not be
      possible to stat() the disk file in virCgroupAllowDevice.
      The virStorageFileGetMeta method may also fail to extract
      the parent backing store. Both of these errors have to be
      ignored to avoid breaking NFS deployments
      
      * src/qemu/qemu_driver.c: Ignore errors in cgroup setup to
         keep root squash NFS happy
      c37c321c
    • M
      esx: Add proxy query parameter · 46c14d20
      Matthias Bolte 提交于
      Allow to specify a proxy to be used by libcurl.
      46c14d20
    • M
      esx: Refactor esxUtil_ParseQuery's parameter handling · 070f6100
      Matthias Bolte 提交于
      Pass a struct containing the parameters instead of passing each
      one individually. This make future extensions a bit simpler.
      070f6100
    • E
      qemu: allow creation of a paused domain · 68e4793a
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=589465
      
      Some guests (eg with badly configured grub, or Windows' installation cd)
      require quick response from the console user. That's why we have a
      "launchPaused" option in vdsm.
      
      To implement it via libvirt, we need to ask libvirt not to call
      qemuMonitorStartCPUs() after starting qemu.  Calling virDomainStop
      immediately after the domain is up is inherently raceful.
      
      * src/qemu/qemu_driver.c (qemudStartVMDaemon): Add new parameter;
      all callers adjusted.
      (qemudDomainCreate): Implement support for new flag.
      68e4793a
    • E
      virDomainCreateXML: support new flag · 2502ebb3
      Eric Blake 提交于
      * include/libvirt/libvirt.h.in (virDomainCreateFlags): Add
      VIR_DOMAIN_START_PAUSED.
      * src/libvirt.c (virDomainCreateXML): Update documentation.
      * src/lxc/lxc_driver.c (lxcDomainCreateAndStart): Reject new flag
      as unimplemented.
      * src/opennebula/one_driver.c (oneDomainCreateAndStart):
      Likewise.
      * src/openvz/openvz_driver.c (openvzDomainCreateXML): Likewise.
      * src/phyp/phyp_driver.c (phypDomainCreateAndStart): Likewise.
      * src/qemu/qemu_driver.c (qemudDomainCreate): Likewise.
      * src/test/test_driver.c (testDomainCreateXML): Likewise.
      * src/uml/uml_driver.c (umlDomainCreate): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainCreateXML): Likewise.
      * src/xen/xend_internal.c (xenDaemonCreateXML): Likewise.
      * src/xenapi/xenapi_driver.c (xenapiDomainCreateXML): Likewise.
      2502ebb3
    • D
      Fix leaks in udev device add/remove v3 · e7f3bad4
      David Allan 提交于
      * This patch is a modification of a patch submitted by Nigel Jones.
        It fixes several memory leaks on device addition/removal:
      
      1. Free the virNodeDeviceDefPtr in udevAddOneDevice if the return
         value is non-zero
      
      2. Always release the node device reference after the device has been
         processed.
      
      * Refactored for better readability per the suggestion of clalance
      e7f3bad4
    • D
      Add multiiqn XML dump · 98fafb0c
      David Allan 提交于
      * Use virBufferEscapeString() per Dan B.
      98fafb0c
  6. 08 6月, 2010 14 次提交
    • D
      Enable probing of VPC disk format type · f4365c73
      Daniel P. Berrange 提交于
      A look at the QEMU source revealed the missing bits of info about
      the VPC file format, so we can enable this now
      
      * src/util/storage_file.c: Enable VPC format, providing version
        and disk size offset fields
      f4365c73
    • D
      Ensure that PCI device is reattached to host if hotadd fails · 1c72695c
      Daniel P. Berrange 提交于
      When an attempt to hotplug a PCI device to a guest fails,
      the device was left attached to pci-stub. It is neccessary
      to reset the device and then attach it to the host driver
      again.
      
      * src/qemu/qemu_driver.c: Reattach PCI device to host if
        hotadd fails
      1c72695c
    • D
      Don't raise errors in the selinux restore code · f43dc26a
      Daniel P. Berrange 提交于
      The restore code is done in places where errors cannot be
      raised, since they will overwrite over pre-existing errors.
      
      * src/security/security_selinux.c: Only warn about failures
        in label restore, don't report errors
      f43dc26a
    • D
      Fix check for errors in device_add command in QEMU text monitor · c833efd3
      Daniel P. Berrange 提交于
      Any output at all from device_add indicates an error in the
      command execution. Thus it needs to check for reply != ""
      
      * src/qemu/qemu_monitor_text.c: Fix reply check for errors
        to treat any output as an error
      c833efd3
    • D
      Prefer UDEV to HAL drivers if both a compiled · 345ff369
      Daniel P. Berrange 提交于
      HAL is deprecated and UDEV is the future. Thus if both
      options are compiled, we should prefer use of UDEV over
      HAL
      
      * src/node_device/node_device_driver.c: Switch init
        order to try UDEV first, then HAL
      345ff369
    • D
      Add support for setting socket MLS level in SELinux driver · e72cc3c1
      Daniel J Walsh 提交于
      When SELinux is running in MLS mode, libvirtd will have a
      different security level to the VMs. For libvirtd to be
      able to connect to the monitor console, the client end of
      the UNIX domain socket needs a different label. This adds
      infrastructure to set the socket label via the security
      driver framework
      
      * src/qemu/qemu_driver.c: Call out to socket label APIs in
        security driver
      * src/qemu/qemu_security_stacked.c: Wire up socket label
        drivers
      * src/security/security_driver.h: Define security driver
        entry points for socket labelling
      * src/security/security_selinux.c: Set socket label based on
        VM label
      e72cc3c1
    • D
      Network duplicate UUID/name checking · 3bb37439
      Daniel P. Berrange 提交于
      The network driver is not doing correct checking for
      duplicate UUID/name values. This introduces a new method
      virNetworkObjIsDuplicate, based on the previously
      written virDomainObjIsDuplicate.
      
      * src/conf/network_conf.c, src/conf/network_conf.c,
        src/libvirt_private.syms: Add virNetworkObjIsDuplicate,
      * src/network/bridge_driver.c: Call virNetworkObjIsDuplicate
        for checking uniqueness of uuid/names
      3bb37439
    • D
      Fix error codes for missing storage pools · 627409d1
      Daniel P. Berrange 提交于
      The storage pool driver is mistakenly using the error code
      VIR_ERR_INVALID_STORAGE_POOL which is for diagnosing invalid
      pointers. This patch switches it to use VIR_ERR_NO_STORAGE_POOL
      which is the correct code for cases where the storage pool does
      not exist
      
      * src/storage/storage_driver.c: Replace VIR_ERR_INVALID_STORAGE_POOL
        with VIR_ERR_NO_STORAGE_POOL
      627409d1
    • D
      Storage pool duplicate UUID/name checking · e9364d9f
      Daniel P. Berrange 提交于
      The storage pool driver is not doing correct checking for
      duplicate UUID/name values. This introduces a new method
      virStoragePoolObjIsDuplicate, based on the previously
      written virDomainObjIsDuplicate.
      
      * src/conf/storage_conf.c, src/conf/storage_conf.c,
        src/libvirt_private.syms: Add virStoragePoolObjIsDuplicate,
      * src/storage/storage_driver.c: Call virStoragePoolObjIsDuplicate
        for checking uniqueness of uuid/names
      e9364d9f
    • D
      Fix auto-adding of virtio serial controllers · f4f91e7b
      Daniel P. Berrange 提交于
      The domain parsing code would auto-add a virtio serial controller
      if it saw any virtio serial channel defined. Unfortunately it
      always added a controller with index=0, even if the channel address
      specified an index != 0. It only added one controller, even if
      multiple controllers were referenced by channels. Finally, it let
      the ports+vectors parameters initialize to zero instead of -1, which
      prevented the controllers accepting any ports.
      
      * src/conf/domain_conf.c: Initialize ports+vectors when adding
        virtio serial controllers. Add all neccessary virtio serial
        controllers, instead of hardcoding controller 0
      * qemuxml2argvdata/qemuxml2argv-channel-virtio.args,
        qemuxml2argvdata/qemuxml2argv-channel-virtio.xml: Expand to
        test controller auto-add behaviour
      f4f91e7b
    • D
      Include port number with virtio serial devices · 2e56cfa7
      Daniel P. Berrange 提交于
      To ensure that the device addressing scheme is stable across
      hotplug/unplug, all virtio serial channels needs to have an
      associated port number in their address. This is then specified
      to QEMU using the nr=NNN parameter
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Parsing
        for port number in vioserial address types.
      * src/qemu/qemu_conf.c: Set 'nr=NNN' parameter with virtio
        serial port number
      * tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args,
        tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml: Expand
        data set to ensure coverage of port addressing
      2e56cfa7
    • D
      Disable use of 'reason' field in block IO event in QEMU · b490f2c1
      Daniel P. Berrange 提交于
      QEMU upstream decided against adding a 'reason' field to
      the block IO event in QMP. Disable this code to remove a
      annoying warning message. It will be renabled when the
      error string reason is re-introduced in QEMU
      b490f2c1
    • J
      Fix AppArmor save/restore.Add stdin_path to qemudStartVMDaemon() args. · 97b68a49
      Jamie Strandboge 提交于
      Refactor to update AppArmor security driver to adjust profile for
      save/restore. This addresses the following bugs:
      
       https://bugzilla.redhat.com/show_bug.cgi?id=529363
       https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/457716
      97b68a49
    • J
      Add stdin_path to qemudStartVMDaemon() args. · 2b57478e
      Jamie Strandboge 提交于
      Adjust args to qemudStartVMDaemon() to also specify path to stdin_fd,
      so this can be passed to the AppArmor driver via SetSecurityAllLabel().
      
      This updates all calls to qemudStartVMDaemon() as well as setting up
      the non-AppArmor security driver *SetSecurityAllLabel() declarations
      for the above. This is required for the following
      "apparmor-fix-save-restore" patch since AppArmor resolves the passed
      file descriptor to the pathname given to open().
      2b57478e
  7. 05 6月, 2010 3 次提交
    • L
      Adjust block size used by dd to speed QEMU domain save operations. · 20206a4b
      Laine Stump 提交于
      See https://bugzilla.redhat.com/show_bug.cgi?id=599091
      
      Saving a paused 512MB domain took 3m47s with the old block size of 512
      bytes. Changing the block size to 1024*1024 decreased the time to 56
      seconds. (Doubling again to 2048*1024 yielded 0 improvement; lowering
      to 512k increased the save time to 1m10s, about 20%)
      20206a4b
    • L
      Fix dereference of potentially freed pointer in qemudDomainSaveFlags · 1d45e1b6
      Laine Stump 提交于
      The pointer to the xml describing the domain is saved into an object
      prior to calling VIR_REALLOC_N() to make the size of the memory it
      points to a multiple of QEMU_MONITOR_MIGRATE_TO_FILE_BS. If that
      operation needs to allocate new memory, the pointer that was saved is
      no longer valid.
      
      To avoid this situation, adjust the size *before* saving the pointer.
      
      (This showed up when experimenting with very large values of
      QEMU_MONITOR_MIGRATE_TO_FILE_BS).
      1d45e1b6
    • J
      Fixes for commit 211dd1e9 · b1eb7f2e
      Jim Fehlig 提交于
      Fixes for issues in commit 211dd1e9 noted by by Jim Meyering.
      
      1. Allocate content buffer of size content_length + 1 to ensure
         NUL-termination.
      2. Limit content buffer size to 64k
      3. Fix whitespace issue
      
      V2:
        - Add comment to clarify allocation of content buffer
        - Add ATTRIBUTE_NONNULL where appropriate
        - User NULLSTR macro
      b1eb7f2e
  8. 04 6月, 2010 1 次提交
    • J
      Allocate buffer to hold xend response · 211dd1e9
      Jim Fehlig 提交于
      There are cases when a response from xend can exceed 4096 bytes, in
      which case anything beyond 4096 is ignored. This patch changes the
      current fixed-size, stack-allocated buffer to a dynamically allocated
      buffer based on Content-Length in HTTP header.
      211dd1e9
  9. 03 6月, 2010 4 次提交
    • D
      Update nodedev scsi_host data before use · 2874a683
      David Allan 提交于
      * It appears that the udev event for HBA creation arrives before the
        associated sysfs data is fully populated, resulting in bogus data
        for the nodedev entry until the entry is refreshed.  This problem is
        particularly troublesome when creating NPIV vHBAs because it results
        in libvirt failing to find the newly created adapter and waiting for
        the full timeout period before erroneously failing the create
        operation.  This patch forces an update before any attempt to use
        any scsi_host nodedev entry.
      2874a683
    • D
      Fix device destroy return value · d3e43bad
      David Allan 提交于
      * Set return value in error cases
      * Clarify error message when parent device is not vport capable
      d3e43bad
    • E
      phyp: Strict check when listing domains · a5b7965a
      Eduardo Otubo 提交于
      a5b7965a
    • S
      add 802.1Qbh and 802.1Qbg handling · ca3b22bb
      Stefan Berger 提交于
      This patch that adds support for configuring 802.1Qbg and 802.1Qbh
      switches. The 802.1Qbh part has been successfully tested with real
      hardware. The 802.1Qbg part has only been tested with a (dummy)
      server that 'behaves' similarly to how we expect lldpad to 'behave'.
      
      The following changes were made during the development of this patch:
      
       - Merging Scott's v13-pre1 patch
       - Fixing endptr related bug while using virStrToLong_ui() pointed out
         by Jim Meyering
       - Addressing Jim Meyering's comments to v11
       - requiring mac address to the vpDisassociateProfileId() function to
         pass it further to the 802.1Qbg disassociate part (802.1Qbh untouched)
       - determining pid of lldpad daemon by reading it from /var/run/libvirt.pid
         (hardcode as is hardcode alson in lldpad sources)
       - merging netlink send code for kernel target and user space target
         (lldpad) using one function nlComm() to send the messages
       - adding a select() after the sending and before the reading of the
         netlink response in case lldpad doesn't respond and so we don't hang
       - when reading the port status, in case of 802.1Qbg, no status may be
         received while things are 'in progress' and only at the end a status
         will be there.
       - when reading the port status, use the given instanceId and vf to pick
         the right IFLA_VF_PORT among those nested under IFLA_VF_PORTS.
       - never sending nor parsing IFLA_PORT_SELF type of messages in the
         802.1Qbg case
       - iterating over the elements in a IFLA_VF_PORTS to pick the right
         IFLA_VF_PORT by either IFLA_PORT_PROFILE and given profileId
         (802.1Qbh) or IFLA_PORT_INSTANCE_UUID and given instanceId (802.1Qbg)
         and reading the current status in IFLA_PORT_RESPONSE.
       - recycling a previous patch that adds functionality to interface.c to
         - get the vlan identifier on an interface
         - get the flags of an interface and some convenience function to
           check whether an interface is 'up' or not (not currently used here)
       - adding function to determine the root physical interface of an
         interface. For example if a macvtap is linked to eth0.100, it will
         find eth0. Also adding a function that finds the vlan on the 'way to
         the root physical interface'
       - conveying the root physical interface name and index in case of 802.1Qbg
       - conveying mac address of macvlan device and vlan identifier in
         IFLA_VFINFO_LIST[ IFLA_VF_INFO[ IFLA_VF_MAC(mac), IFLA_VF_VLAN(vlan) ] ]
         to (future) lldpad via netlink
        - To enable build with --without-macvtap rename the
          [dis|]associatePortProfileId functions, prepend 'vp' before their
          name and make them non-static functions.
        - Renaming variable multicast to nltarget_kernel and inverting
          the logic
        - Addressing Jim Meyering's comments; this also touches existing
          code for example for correcting indentation of break statements or
          simplification of switch statements.
        - Renamed occurrencvirVirtualPortProfileDef to virVirtualPortProfileParamses
        - 802.1Qbg part prepared for sending a RTM_SETLINK and getting
          processing status back plus a subsequent RTM_GETLINK to
          get IFLA_PORT_RESPONSE.
          Note: This interface for 802.1Qbg may still change
        - [David Allan] move getPhysfn inside IFLA_VF_PORT_MAX to avoid
      compiler
          warning when latest if_link.h isn't available
        - move from Stefan's 802.1Qb{g|h} XML v8 to v9
        - move hostuuid and vf index calcs to inside doPortProfileOp8021Qbh
        - remove debug fprintfs
        - use virGetHostUUID (thanks Stefan!)
        - fix compile issue when latest if_link.h isn't available
        - change poll timeout to 10s, at 1/8 intervals
           - if polling times out, log msg and return -ETIMEDOUT
        - Add Stefan's code for getPortProfileStatus
        - Poll for up to 2 secs for port-profile status, at 1/8 sec intervals:
           - if status indicates error, abort openMacvtapTap
           - if status indicates success, exit polling
           - if status is "in-progress" after 2 secs of polling, exit
             polling loop silently, without error
      
      My patch finishes out the 802.1Qbh parts, which Stefan had mostly complete.
      I've tested using the recent kernel updates for VF_PORT netlink msgs and
      enic for Cisco's 10G Ethernet NIC.  I tested many VMs, each with several
      direct interfaces, each configured with a port-profile per the XML.  VM-to-VM,
      and VM-to-external work as expected.  VM-to-VM on same host (using same NIC)
      works same as VM-to-VM where VMs are on diff hosts.  I'm able to change
      settings on the port-profile while the VM is running to change the virtual
      port behaviour.  For example, adjusting a QoS setting like rate limit.  All
      VMs with interfaces using that port-profile immediatly see the effect of the
      change to the port-profile.
      
      I don't have a SR-IOV device to test so source dev is a non-SR-IOV device,
      but most of the code paths include support for specifing the source dev and
      VF index.  We'll need to complete this by discovering the PF given the VF
      linkdev.  Once we have the PF, we'll also have the VF index.  All this info-
      mation is available from sysfs.
      ca3b22bb
  10. 02 6月, 2010 2 次提交