1. 26 5月, 2010 2 次提交
    • 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
  2. 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
  3. 24 5月, 2010 1 次提交
  4. 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
  5. 21 5月, 2010 8 次提交
  6. 20 5月, 2010 5 次提交
  7. 19 5月, 2010 5 次提交
    • 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
    • J
      do not ignore qemuMonitorAddDrive failure; make uses identical · 49ed0a2e
      Jim Meyering 提交于
      There were three very similar uses of qemuMonitorAddDrive.
      This change makes the three 17-line sequences identical.
      * src/qemu/qemu_driver.c (qemudDomainAttachPciDiskDevice): Detect
      failure.  Add VIR_WARN and braces.
      (qemudDomainAttachSCSIDisk): Add VIR_WARN and braces.
      (qemudDomainAttachUsbMassstorageDevice): Likewise.
      49ed0a2e
    • J
      qemudDomainRestore: handle a case of virDomainSaveStatus failure · 11eeabd7
      Jim Meyering 提交于
      * src/qemu/qemu_driver.c (qemudDomainRestore): Don't ignore
      virDomainSaveStatus failure.
      11eeabd7
  8. 18 5月, 2010 3 次提交
    • D
      Fix multiple potential NULL pointer references in monitor usage · c4b2a939
      Daniel P. Berrange 提交于
      Any method which intends to invoke a monitor command must have
      a check for virDomainObjIsActive() before using the monitor to
      ensure that priv->mon != NULL.
      
      There is one subtle edge case in this though. If a method invokes
      multiple monitor commands, and calls qemuDomainObjExitMonitor()
      in between two of these commands then there is no guarentee that
      priv->mon != NULL anymore. This is because the QEMU process may
      exit or die at any time, and because qemuDomainObjEnterMonitor()
      releases the lock on virDomainObj, it is possible for the background
      thread to close the monitor handle and thus qemuDomainObjExitMonitor
      will release the last reference allowing priv->mon to become NULL.
      
      This affects several methods, most notably migration but also some
      hotplug methods. This patch takes a variety of approaches to solve
      the problem, depending on the particular usage scenario. Generally
      though it suffices to add an extra virDomainObjIsActive() check
      if qemuDomainObjExitMonitor() was called during the method.
      
      * src/qemu/qemu_driver.c: Fix multiple potential NULL pointer flaws
        in usage of the monitor
      c4b2a939
    • J
      qemudDomainSetVcpus: avoid NULL-deref on failed uuid look-up · 20701b17
      Jim Meyering 提交于
      * src/qemu/qemu_driver.c (qemudDomainSetVcpus): Upon look-up failure,
      i.e., vm==NULL, goto cleanup, rather than to "endjob", superficially
      since the latter would dereference vm, but more fundamentally because
      we certainly don't want to call qemuDomainObjEndJob before we've
      even attempted qemuDomainObjBeginJob.
      20701b17
    • C
      qemu: Clarify a couple error messages · 07c621d0
      Cole Robinson 提交于
      A fedora translator filed:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=580816
      
      Pointing out these two error messages as unclear: "write save" sounds
      like a typo without context, and lack of a colon made the second message
      difficult to parse.
      07c621d0
  9. 17 5月, 2010 4 次提交
  10. 15 5月, 2010 3 次提交
  11. 14 5月, 2010 1 次提交
    • D
      Don't reset user/group/security label on shared filesystems during migrate · 02ddaddf
      Daniel P. Berrange 提交于
      When QEMU runs with its disk on NFS, and as a non-root user, the
      disk is chownd to that non-root user. When migration completes
      the last step is shutting down the QEMU on the source host. THis
      normally resets user/group/security label. This is bad when the
      VM was just migrated because the file is still in use on the dest
      host. It is thus neccessary to skip the reset step for any files
      found to be on a shared filesystem
      
      * src/libvirt_private.syms: Export virStorageFileIsSharedFS
      * src/util/storage_file.c, src/util/storage_file.h: Add a new
        method virStorageFileIsSharedFS() to determine if a file is
        on a shared filesystem (NFS, GFS, OCFS2, etc)
      * src/qemu/qemu_driver.c: Tell security driver not to reset
        disk labels on migration completion
      * src/qemu/qemu_security_dac.c, src/qemu/qemu_security_stacked.c,
        src/security/security_selinux.c, src/security/security_driver.h,
        src/security/security_apparmor.c: Add ability to skip disk
        restore step for files on shared filesystems.
      02ddaddf