1. 09 6月, 2010 2 次提交
    • 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
  2. 08 6月, 2010 3 次提交
    • 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
      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
    • 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
  3. 05 6月, 2010 2 次提交
  4. 03 6月, 2010 1 次提交
    • 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
  5. 02 6月, 2010 1 次提交
  6. 29 5月, 2010 1 次提交
    • S
      macvtap: cannot support target device name · ca1b7cc8
      Stefan Berger 提交于
      Since the macvtap device needs active tear-down and the teardown logic
      is based on the interface name, it can happen that if for example 1 out
      of 3 interfaces was successfully created, that during the failure path
      the macvtap's target device name is used to tear down an interface that
      is doesn't own (owned by another VM).
      
      So, in this patch, the target interface name is reset so that there is
      no target interface name and the interface name is always cleared after
      a tear down.
      ca1b7cc8
  7. 27 5月, 2010 2 次提交
    • D
      Fix integer overflow in hotplug methods · bbe29be9
      Daniel P. Berrange 提交于
      The hotplug methods still had the qemuCmdFlags variable declared
      as an int, instead of unsigned long long. This caused flag checks
      to be incorrect for flags > 31
      
      * src/qemu/qemu_driver.c: Fix integer overflow in hotplug
      bbe29be9
    • A
      Pass pre-opened PCI device sysfs config file to QEMU · c444af1a
      Alex Williamson 提交于
      This allows libvirt to open the PCI device sysfs config file prior
      to dropping privileges so qemu can access the full config space.
      Without this, a de-privileged qemu can only access the first 64
      bytes of config space.
      
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Detect support
        for pci-assign.configfd option. Use this option when formatting
        PCI device string if possible
      * src/qemu/qemu_driver.c: Pre-open PCI sysfs config file and pass
        to QEMU
      c444af1a
  8. 26 5月, 2010 3 次提交
    • C
      Fix failing virGetHostname. · 0117b7da
      Chris Lalancette 提交于
      We've been running into a lot of situations where
      virGetHostname() is returning "localhost", where a plain
      gethostname() would have returned the correct thing.  This
      is because virGetHostname() is *always* trying to canonicalize
      the name returned from gethostname(), even when it doesn't
      have to.
      
      This patch changes virGetHostname so that if the value returned
      from gethostname() is already FQDN or localhost, it returns
      that string directly.  If the value returned from gethostname()
      is a shortened hostname, then we try to canonicalize it.  If
      that succeeds, we returned the canonicalized hostname.  If
      that fails, and/or returns "localhost", then we just return
      the original string we got from gethostname() and hope for
      the best.
      
      Note that after this patch it is up to clients to check whether
      "localhost" is an allowed return value.  The only place
      where it's currently not is in qemu migration.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      0117b7da
    • S
      vepa: parsing for 802.1Qb{g|h} XML · a8f75d2c
      Stefan Berger 提交于
      This patch parses the following two XML descriptions, one for
      802.1Qbg and one for 802.1Qbh, and stores the data internally.
      The actual triggering of the switch setup protocol has not been
      implemented here but the relevant code to do that should go into
      the functions associatePortProfileId() and disassociatePortProfileId().
      
         <interface type='direct'>
            <source dev='eth0.100' mode='vepa'/>
            <model type='virtio'/>
            <virtualport type='802.1Qbg'>
              <parameters managerid='12' typeid='0x123456' typeidversion='1'
               instanceid='fa9b7fff-b0a0-4893-8e0e-beef4ff18f8f'/>
            </virtualport>
            <filterref filter='clean-traffic'/>
          </interface>
      
          <interface type='direct'>
            <source dev='eth0.100' mode='vepa'/>
            <model type='virtio'/>
            <virtualport type='802.1Qbh'>
              <parameters profileid='my_profile'/>
            </virtualport>
          </interface>
      
      I'd suggest to use this patch as a base for triggering the setup
      protocol with the 802.1Qb{g|h} switch.
      
      Several rounds of changes were made to this patch. The
      following is a list of these changes.
      - Renamed structure virVirtualPortProfileDef to virVirtualPortProfileParams
        as per Daniel Berrange's request
      - Addressing Daniel Berrange's comments:
       - removing macvtap.h's dependency on domain_conf.h by
         moving the virVirtualPortProfileDef structure into macvtap.h
         and not passing virtDomainNetDefPtr to any functions in
         macvtap.c
      - Addressed most of Chris Wright's comments:
        - indicating error in case virtualport XML node cannot be parsed
          properly
        - parsing hex and decimal numbers using virStrToLong_ui() with
          parameter '0' for base
        - tgifname (target interface name) variable wasn't necessary
          to pass to openMacvtapTap function anymore
      - assigning the virtual port data structure to the virDomainNetDef
        only if it was previously parsed
      - make sure that the error code returned by openMacvtapTap() is a negative n
        in case the associatePortProfileId() function failed.
      - renaming vsi in the XML to virtualport
      - replace all occurrences of vsi in the source as well
      - removing mode and MAC address parameters from the functions that
        will communicate with the hareware diretctly or indirectly
      - moving the associate and disassociate functions to the end of the
        file for subsequent patches to easier make them generally available
        for export
      - passing the macvtap interface name rather than the link device since
        this otherwise gives funny side effects when using netlink messages
        where IFLA_IFNAME and IFLA_ADDRESS are specified and the link dev
        all of a sudden gets the MAC address of the macvtap interface.
      - Removing rc = -1 error indications in the case of 802.1Qbg|h setup in case
        we wanted to use hook scripts for the setup and so the setup doesn't fail
        here.
      - if instance ID UUID is not supplied it will automatically be generated
        - adapted schema to make instance ID UUID optional
        - added test case
      - parser and XML generator have been separated into their own
        functions so they can be re-used elsewhere (passthrough case
        for example)
      - Adapted XML parser and generator support the above shown type
        (802.1Qbg, 802.1Qbh).
      - Adapted schema to above XML
      - Adapted test XML to above XML
      - Passing through the VM's UUID which seems to be necessary for
        802.1Qbh -- sorry no host UUID
      - adding virtual function ID to association function, in case it's
        necessary to use (for SR-IOV)
      a8f75d2c
    • D
      Expose a host UUID in the capabilities XML · 60881161
      Daniel P. Berrange 提交于
      Allow for a host UUID in the capabilities XML. Local drivers
      will initialize this from the SMBIOS data. If a sanity check
      shows SMBIOS uuid is invalid, allow an override from the
      libvirtd.conf configuration file
      
      * daemon/libvirtd.c, daemon/libvirtd.conf: Support a host_uuid
        configuration option
      * docs/schemas/capability.rng: Add optional host uuid field
      * src/conf/capabilities.c, src/conf/capabilities.h: Include
        host UUID in XML
      * src/libvirt_private.syms: Export new uuid.h functions
      * src/lxc/lxc_conf.c, src/qemu/qemu_driver.c,
        src/uml/uml_conf.c: Set host UUID in capabilities
      * src/util/uuid.c, src/util/uuid.h: Support for host UUIDs
      * src/node_device/node_device_udev.c: Use the host UUID functions
      * tests/confdata/libvirtd.conf, tests/confdata/libvirtd.out: Add
        new host_uuid config option to test
      60881161
  9. 25 5月, 2010 6 次提交
    • D
      Fix handling of disk backing stores with cgroups · e596dbb3
      Daniel P. Berrange 提交于
      The cgroups ACL code was only allowing the primary disk image.
      It is possible to chain images together, so we need to search
      for backing stores and add them to the ACL too. Since the ACL
      only handles block devices, we ignore the EINVAL we get from
      plain files. In addition it was missing code to teardown the
      cgroup when hot-unplugging a disk
      
      * src/qemu/qemu_driver.c: Allow backing stores in cgroup ACLs
        and add missing teardown code in unplug path
      e596dbb3
    • C
      Fix up basic migration. · 93500040
      Chris Lalancette 提交于
      Basic live migration was broken by the commit that added
      non-shared block support in two ways:
      
      1)  It added a virCheckFlags() to doNativeMigrate().  Besides
      the fact that typical usage of virCheckFlags() is in driver
      entry points, and doNativeMigrate() is not an entry point,
      it was missing important flags like VIR_MIGRATE_LIVE.  Move
      the virCheckFlags to the top-level qemuDomainMigratePrepare2
      and friends.
      
      2)  It also added a memory leak in qemuMonitorTextMigrate()
      by not freeing the memory used by virBufferContentAndReset().
      This is fixed by storing the pointer in a temporary variable
      and freeing it at the end.
      
      With this patch in place, normal live migration works again.
      
      v3: Instead of the churn for virCheckFlagsUI and UL, instead
      always promote flags to an unsigned long and always use %lx
      for the fprintf.
      v2: Add back flags check, which required adding virCheckFlagsUI
      and virCheckFlagsUL
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      93500040
    • A
    • A
      qemu: avoid corrupting guest info struct on host device PCI hot add · ddfd4dba
      Alex Williamson 提交于
      The device path doesn't make use of guestAddr, so the memcpy corrupts
      the guest info struct.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      ddfd4dba
    • D
      Query block allocation extent from QEMU monitor · ebb0c19c
      Daniel P. Berrange 提交于
      The virDomainGetBlockInfo API allows query physical block
      extent and allocated block extent. These are normally the
      same value unless storing a special format like qcow2
      inside a block device. In this scenario we can query QEMU
      to get the actual allocated extent.
      
      Since last time:
      
       - Return fatal error in text monitor
       - Only invoke monitor command for block devices
       - Fix error handling JSON code
      
      * src/qemu/qemu_driver.c: Fill in block aloction extent when VM
        is running
      * 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
        API to query the highest block extent via info blockstats
      ebb0c19c
    • C
      fff6be0c
  10. 24 5月, 2010 1 次提交
  11. 22 5月, 2010 2 次提交
    • J
      Fix race in finding available vnc port · ba196952
      Jim Fehlig 提交于
      The qemu driver contains a subtle race in the logic to find next
      available vnc port.  Currently it iterates through all available ports
      and returns the first for which bind(2) succeeds.  However it is possible
      that a previously issued port has not yet been bound by qemu, resulting
      in the same port used for a subsequent domain.
      
      This patch addresses the race by using a simple bitmap to "reserve" the
      ports allocated by libvirt.
      
      V2:
        - Put port bitmap in struct qemud_driver
        - Initialize bitmap in qemudStartup
      
      V3:
        - Check for failure of virBitmapGetBit
        - Additional check for port != -1 before calling virbitmapClearBit
      
      V4:
        - Check for failure of virBitmap{Set,Clear}Bit
      ba196952
    • J
      Add defines for QEMU_VNC_PORT_{MIN,MAX} and use them · c020f620
      Jim Fehlig 提交于
      c020f620
  12. 21 5月, 2010 8 次提交
  13. 20 5月, 2010 5 次提交
  14. 19 5月, 2010 3 次提交
    • J
      initialize "meta" in virStorageFileGetMetadata, not in each caller · dcf30d9c
      Jim Meyering 提交于
      Do not require each caller of virStorageFileGetMetadata and
      virStorageFileGetMetadataFromFD to first clear the storage of the
      "meta" buffer.  Instead, initialize that storage in
      virStorageFileGetMetadataFromFD.
      * src/util/storage_file.c (virStorageFileGetMetadataFromFD): Clear
      "meta" here, not before each of the following callers.
      * src/qemu/qemu_driver.c (qemuSetupDiskCgroup): Don't clear "meta" here.
      (qemuTeardownDiskCgroup): Likewise.
      * src/qemu/qemu_security_dac.c (qemuSecurityDACSetSecurityImageLabel):
      Likewise.
      * src/security/security_selinux.c (SELinuxSetSecurityImageLabel):
      Likewise.
      * src/security/virt-aa-helper.c (get_files): Likewise.
      dcf30d9c
    • J
      (qemu*DiskCgroup): avoid dead code · e638a246
      Jim Meyering 提交于
      * src/qemu/qemu_driver.c (qemuTeardownDiskCgroup): Remove
      bogus empty-body while-loop.
      (qemuSetupDiskCgroup): Likewise.
      e638a246
    • J
      maint: don't mark VIR_WARN or VIR_WARN0 diagnostics for translation · c5a2fe24
      Jim Meyering 提交于
      Approximately 60 messages were marked.  Since these diagnostics are
      intended solely for developers and maintainers, encouraging translation
      is deemed to be counterproductive:
      http://thread.gmane.org/gmane.comp.emulators.libvirt/25050/focus=25052
      
      Run this command:
        git grep -l VIR_WARN|xargs perl -pi -e \
          's/(VIR_WARN0?)\s*\(_\((".*?")\)/$1($2/'
      c5a2fe24