1. 08 4月, 2014 1 次提交
  2. 03 4月, 2014 1 次提交
    • J
      Move error reporting into virDomainNetFindIdx · 2fbae1b2
      Ján Tomko 提交于
      Every caller checked the return value and logged an error
      - one if no device with the specified MAC was found,
      other if there were multiple devices matching the MAC address
      (except for qemuDomainUpdateDeviceConfig which logged the same
       message in both cases).
      
      Move the error reporting into virDomainNetFindIdx, since in both cases,
      we couldn't find one single match - it's just the error messages that
      differ.
      2fbae1b2
  3. 02 4月, 2014 1 次提交
    • E
      conf: move host disk type to util/ · 16ac4c9d
      Eric Blake 提交于
      A continuation of the migration of disk details to virstoragefile.
      This patch moves a single enum, but converting the name has quite
      a bit of fallout.
      
      * src/conf/domain_conf.h (virDomainDiskType): Move...
      * src/util/virstoragefile.h (virStorageType): ...and rename.
      * src/bhyve/bhyve_command.c (bhyveBuildDiskArgStr)
      (virBhyveProcessBuildLoadCmd): Update clients.
      * src/conf/domain_conf.c (virDomainDiskSourceDefParse)
      (virDomainDiskDefParseXML, virDomainDiskSourceDefFormatInternal)
      (virDomainDiskDefFormat, virDomainDiskGetActualType)
      (virDomainDiskDefForeachPath, virDomainDiskSourceIsBlockType):
      Likewise.
      * src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Likewise.
      * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefParseXML)
      (virDomainSnapshotAlignDisks, virDomainSnapshotDiskDefFormat):
      Likewise.
      * src/esx/esx_driver.c (esxAutodetectSCSIControllerModel)
      (esxDomainDefineXML): Likewise.
      * src/locking/domain_lock.c (virDomainLockManagerAddDisk):
      Likewise.
      * src/lxc/lxc_controller.c
      (virLXCControllerSetupLoopDeviceDisk)
      (virLXCControllerSetupNBDDeviceDisk)
      (virLXCControllerSetupLoopDevices, virLXCControllerSetupDisk):
      Likewise.
      * src/parallels/parallels_driver.c (parallelsGetHddInfo):
      Likewise.
      * src/phyp/phyp_driver.c (phypDiskType): Likewise.
      * src/qemu/qemu_command.c (qemuGetDriveSourceString)
      (qemuDomainDiskGetSourceString, qemuBuildDriveStr)
      (qemuBuildCommandLine, qemuParseCommandLineDisk)
      (qemuParseCommandLine): Likewise.
      * src/qemu/qemu_conf.c (qemuCheckSharedDevice)
      (qemuTranslateDiskSourcePool)
      (qemuTranslateSnapshotDiskSourcePool): Likewise.
      * src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse)
      (qemuDomainDetermineDiskChain): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo)
      (qemuDomainSnapshotPrepareDiskExternalBackingInactive)
      (qemuDomainSnapshotPrepareDiskExternalBackingActive)
      (qemuDomainSnapshotPrepareDiskExternalOverlayActive)
      (qemuDomainSnapshotPrepareDiskExternalOverlayInactive)
      (qemuDomainSnapshotPrepareDiskInternal)
      (qemuDomainSnapshotPrepare)
      (qemuDomainSnapshotCreateSingleDiskActive): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia):
      Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationIsSafe): Likewise.
      * src/security/security_apparmor.c
      (AppArmorRestoreSecurityImageLabel)
      (AppArmorSetSecurityImageLabel): Likewise.
      * src/security/security_dac.c (virSecurityDACSetSecurityImageLabel)
      (virSecurityDACRestoreSecurityImageLabelInt)
      (virSecurityDACSetSecurityAllLabel): Likewise.
      * src/security/security_selinux.c
      (virSecuritySELinuxRestoreSecurityImageLabelInt)
      (virSecuritySELinuxSetSecurityImageLabel)
      (virSecuritySELinuxSetSecurityAllLabel): Likewise.
      * src/storage/storage_backend.c (virStorageFileBackendForType):
      Likewise.
      * src/storage/storage_backend_fs.c (virStorageFileBackendFile)
      (virStorageFileBackendBlock): Likewise.
      * src/storage/storage_backend_gluster.c
      (virStorageFileBackendGluster): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc, vboxAttachDrives)
      (vboxDomainAttachDeviceImpl, vboxDomainDetachDevice): Likewise.
      * src/vmware/vmware_conf.c (vmwareVmxPath): Likewise.
      * src/vmx/vmx.c (virVMXParseDisk, virVMXFormatDisk)
      (virVMXFormatFloppy): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenParseSxpr)
      (xenFormatSxprDisk): Likewise.
      * src/xenxs/xen_xm.c (xenParseXM, xenFormatXMDisk): Likewise.
      * tests/securityselinuxlabeltest.c (testSELinuxLoadDef):
      Likewise.
      * src/libvirt_private.syms (domain_conf.h): Move symbols...
      (virstoragefile.h): ...as appropriate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      16ac4c9d
  4. 25 3月, 2014 2 次提交
    • J
      Indent top-level labels by one space in src/qemu/ · 5922d05a
      Ján Tomko 提交于
      5922d05a
    • E
      conf: use disk source accessors in qemu/ · cd01d2ad
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      * src/qemu/qemu_conf.c (qemuCheckSharedDevice)
      (qemuAddSharedDevice, qemuRemoveSharedDevice, qemuSetUnprivSGIO):
      Use accessors.
      * src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse)
      (qemuDomainObjCheckDiskTaint, qemuDomainSnapshotForEachQcow2Raw)
      (qemuDomainCheckRemoveOptionalDisk, qemuDomainCheckDiskPresence)
      (qemuDiskChainCheckBroken, qemuDomainDetermineDiskChain):
      Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia)
      (qemuDomainCheckEjectableMedia)
      (qemuDomainAttachVirtioDiskDevice, qemuDomainAttachSCSIDisk)
      (qemuDomainAttachUSBMassstorageDevice)
      (qemuDomainAttachDeviceDiskLive, qemuDomainRemoveDiskDevice)
      (qemuDomainDetachVirtioDiskDevice, qemuDomainDetachDiskDevice):
      Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationStartNBDServer)
      (qemuMigrationDriveMirror, qemuMigrationCancelDriveMirror)
      (qemuMigrationIsSafe): Likewise.
      * src/qemu/qemu_process.c (qemuProcessGetVolumeQcowPassphrase)
      (qemuProcessHandleIOError, qemuProcessHandleBlockJob)
      (qemuProcessInitPasswords): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainChangeDiskMediaLive)
      (qemuDomainGetBlockInfo, qemuDiskPathToAlias): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      cd01d2ad
  5. 18 3月, 2014 1 次提交
  6. 13 3月, 2014 4 次提交
  7. 11 3月, 2014 2 次提交
  8. 10 3月, 2014 1 次提交
  9. 18 2月, 2014 1 次提交
    • M
      network: Introduce network hooks · f1ab06e4
      Michal Privoznik 提交于
      There might be some use cases, where user wants to prepare the host or
      its environment prior to starting a network and do some cleanup after
      the network has been shut down. Consider all the functionality that
      libvirt doesn't currently have as an example what a hook script can
      possibly do.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f1ab06e4
  10. 10 2月, 2014 1 次提交
  11. 04 2月, 2014 1 次提交
    • L
      qemu: be sure we're using the updated value of backend during hotplug · 0d0a7bf4
      Laine Stump 提交于
      commit f094aaac changed qemuPrepareHostdevPCIDevices() such that it
      may modify the "backend" (vfio vs. legacy kvm) setting in the
      virHostdevDef. However, qemuDomainAttachHostPciDevice() (used by
      hotplug) copies the backend setting into a local *before* calling
      qemuPrepareHostdevPCIDevices(), and then later makes a decision based
      on that pre-change value.
      
      The result is that, if the backend had been set to "default" (i.e. not
      specified in the config) and was later updated to "VFIO" by
      qemuPrepareHostdevPCIDevices(), the qemu process' MacMemLock is not
      increased (as is required for VFIO device assignment).
      
      This patch delays making the local copy of backend until after its
      potential modification.
      0d0a7bf4
  12. 09 1月, 2014 1 次提交
  13. 23 12月, 2013 2 次提交
    • L
      qemu: avoid duplicate security label restore on hostdev attach failure · c0f511ee
      Laine Stump 提交于
      This eliminates the misleading error message that was being logged
      when a vfio hostdev hotplug failed:
      
        error: unable to set user and group to '107:107' on '/dev/vfio/22':
               No such file or directory
      
      as documented in:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1035490
      
      Commit ee414b5d (pushed as a fix for Bug 1016511 and part of Bug
      1025108) replaced the single call to
      virSecurityManagerSetHostdevLabel() in qemuDomainAttachHostDevice()
      with individual calls to that same function in each
      device-type-specific attach function (for PCI, USB, and SCSI). It also
      added a corresponding call to virSecurityManagerRestoreHostdevLabel()
      in the error handling of the device-type-specific functions, but
      forgot to remove the common call to that from
      qemuDomainAttachHostDevice() - this resulted in a duplicate call to
      virSecurityManagerRestoreHostdevLabel(), with the second occurrence
      being after (e.g.) a PCI device has already been re-attached to the
      host driver, thus destroying some of the device nodes / links that we
      then attempted to re-label (e.f. /dev/vfio/22) and generating an error
      log that obscured the original error.
      c0f511ee
    • L
      qemu: properly set MaxMemLock when hotplugging with VFIO · 6d867f72
      Laine Stump 提交于
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1035490
      
      virProcessSetMaxMemLock() (which is a wrapper over prlimit(3)) expects
      the memory size in bytes, but libvirt's domain definition (which was
      being used by qemuDomainAttachHostPciDevice()) stores all memory
      tuning parameters in KiB. This was being accounted for when setting
      MaxMemLock at domain startup time (so cold-plugged devices would
      work), but not for hotplug.
      
      This patch simplifies the few lines that call
      virProcessSetMemMaxLock(), and multiply the amount * 1024 so that
      we're locking the correct amount of memory.
      
      What remains a mystery to me is why hot-plug of a managed='no' device
      would succeed (at least on my system) while managed='yes' would
      fail. I guess in one case the memory was coincidentally already
      resident and in the other it wasn't.
      6d867f72
  14. 10 12月, 2013 4 次提交
  15. 06 12月, 2013 1 次提交
  16. 03 12月, 2013 1 次提交
    • L
      qemu: report error on attempt to live change virtio-net queues · 5e12641e
      Laine Stump 提交于
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1029732
      
      The BZ asked for the capability to change the number of queues used by
      a virtio-net device while the device is in use. Because the number of
      queues can only be set at the time the device is created, that isn't
      possible. However, libvirt also shouldn't be silently reporting
      success when someone tries to change the number of queues. So this
      patch flags that as an error (just as attempts to change any of the
      other virtio-specific parameters already do).
      5e12641e
  17. 21 11月, 2013 3 次提交
    • E
      qemu: Auto-generate controller for hotplugged hostdev · 881eb780
      Eric Farman 提交于
      If a SCSI hostdev is included in an initial domain XML, without a
      corresponding controller statement, one is created silently when the
      guest is booted.
      
      When hotplugging a SCSI hostdev, a presumption is that the controller
      is already present in the domain either from the original XML, or via
      an earlier hotplug.
      
        [root@xxxxxxxx ~]# cat disk.xml
        <hostdev mode='subsystem' type='scsi'>
          <source>
            <adapter name='scsi_host0'/>
            <address bus='0' target='3' unit='1088438288'/>
          </source>
        </hostdev>
        [root@xxxxxxxx ~]# virsh attach-device guest01 disk.xml
        error: Failed to attach device from disk.xml
        error: internal error: unable to execute QEMU command 'device_add': Bus 'scsi0.0' not found
      
      Since the infrastructure is in place, we can also create a controller
      silently for use by the hotplugged hostdev device.
      Signed-off-by: NEric Farman <farman@linux.vnet.ibm.com>
      881eb780
    • E
      qemu: Separate calls based on controller bus type · 6f22f95f
      Eric Farman 提交于
      For systems without a PCI bus, attaching a SCSI controller fails:
      
        [root@xxxxxxxx ~]# cat controller.xml
        <controller type='scsi' model='virtio-scsi' index='0' />
        [root@xxxxxxxx ~]# virsh attach-device guest01 controller.xml
        error: Failed to attach device from controller.xml
        error: XML error: No PCI buses available
      
      A similar problem occurs with the detach of a controller:
      
        [root@xxxxxxxx ~]# virsh detach-device guest01 controller.xml
        error: Failed to detach device from controller.xml
        error: operation failed: controller scsi:0 not found
      
      The qemuDomainXXtachPciControllerDevice routines made assumptions
      that any caller had a PCI bus.  These routines now selectively calls
      PCI functions where necessary, and assigns the device information
      type to one appropriate for the bus in use.
      Signed-off-by: NEric Farman <farman@linux.vnet.ibm.com>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      6f22f95f
    • E
      qemu: Rename controller hotplug functions to not be PCI-specific · 271eb058
      Eric Farman 提交于
      For attach/detach of controller devices, we rename the functions to
      remove 'PCI' from their title.  The actual separation of PCI-specific
      operations will be handled in the next patch.
      Signed-off-by: NEric Farman <farman@linux.vnet.ibm.com>
      271eb058
  18. 15 11月, 2013 1 次提交
    • J
      qemu: Call qemuSetupHostdevCGroup later during hotplug · 05e149f9
      Jiri Denemark 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1025108
      
      So far qemuSetupHostdevCGroup was called very early during hotplug, even
      before we knew the device we were about to hotplug was actually
      available. By calling the function later, we make sure QEMU won't be
      allowed to access devices used by other domains.
      
      Another important effect of this change is that hopluging USB devices
      specified by vendor and product (but not by their USB address) works
      again. This was broken since v1.0.5-171-g7d763aca, when the call to
      qemuFindHostdevUSBDevice was moved after the call to
      qemuSetupHostdevCGroup, which then used an uninitialized USB address.
      05e149f9
  19. 08 11月, 2013 1 次提交
    • V
      qemu: Fix SCSI hotplug on pseries guests · efdd591d
      Vitor de Lima 提交于
      This patch moves some code in the qemuDomainAttachSCSIDisk
      function. The check for the existence of a PCI address assigned
      to the SCSI controller was moved in order to be executed only
      when needed. The PCI address of a controller is not necessary
      if QEMU_CAPS_DEVICE is supported.
      
      This fixes issues with the hotplug of SCSI disks on pseries guests.
      efdd591d
  20. 21 10月, 2013 3 次提交
    • L
      qemu: fix removal of <interface type='hostdev'> · 69e047ae
      Laine Stump 提交于
      This patch (and the two patches that precede it) resolve:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1005682
      
      When libvirt was changed to delay the final cleanup of device removal
      until the qemu process had signaled it with a DEVICE_DELETED event for
      that device, the hostdev removal function
      (qemuDomainRemoveHostDevice()) was written to properly handle the
      removal of a hostdev that was actually an SRIOV virtual function
      (defined with <interface type='hostdev'>). However, the function used
      to search for a device matching the alias name provided in the
      DEVICE_DELETED message (virDomainDefFindDevice()) would search through
      the list of netdevs before hostdevs, so qemuDomainRemoveHostDevice()
      was never called; instead the netdev function,
      qemuDomainRemoveNetDevice() (which *doesn't* properly cleanup after
      removal of <interface type='hostdev'>), was called.
      
      (As a reminder - each <interface type='hostdev'> results in a
      virDomainNetDef which contains a virDomainHostdevDef having a parent
      type of VIR_DOMAIN_DEVICE_NET, and parent.data.net pointing back to
      the virDomainNetDef; both Defs point to the same device info object
      (and the info contains the device's "alias", which is used by qemu to
      identify the device). The virDomainHostdevDef is added to the domain's
      hostdevs list *and* the virDomainNetDef is added to the domain's nets
      list, so searching either list for a particular alias will yield a
      positive result.)
      
      This function modifies the qemuDomainRemoveNetDevice() to short
      circuit itself and call qemu DomainRemoveHostDevice() instead when the
      actual device is a VIR_DOMAIN_NET_TYPE_HOSTDEV (similar logic to what
      is done in the higher level qemuDomainDetachNetDevice())
      
      Note that even if virDomainDefFindDevice() changes in the future so
      that it finds the hostdev entry first, the current code will continue
      to work properly.
      69e047ae
    • L
      qemu: move qemuDomainRemoveNetDevice to avoid forward reference · c5561644
      Laine Stump 提交于
      pure code movement to setup for next patch.
      c5561644
    • L
      qemu: simplify calling qemuDomainHostdevNetConfigRestore · 7a600cf7
      Laine Stump 提交于
      This function was called in three places, and in each the call was
      qualified by a slightly different conditional. In reality, this
      function should only be called for a hostdev if all of the following
      are true:
      
        1) mode='subsystem'
        2) type='pci'
        3) there is a parent device definition which is an <interface>
           (VIR_DOMAIN_DEVICE_NET)
      
      We can simplify the callers and make them more consistent by checking
      these conditions at the top ov qemuDomainHostdevNetConfigRestore and
      returning 0 if one of them isn't satisfied.
      
      The location of the call to qemuDomainHostdevNetConfigRestore() has
      also been changed in the hot-plug case - it is moved into the caller
      of its previous location (i.e. from qemuDomainRemovePCIHostDevice() to
      qemuDomainRemoveHostDevice()). This was done to be more consistent
      about which functions pay attention to whether or not this is one of
      the special <interface> hostdevs or just a normal hostdev -
      qemuDomainRemoveHostDevice() already contained a call to
      networkReleaseActualDevice() and virDomainNetDefFree(), so it makes
      sense for it to also handle the resetting of the device's MAC address
      and vlan tag (which is what's done by
      qemuDomainHostdevNetConfigRestore()).
      7a600cf7
  21. 10 10月, 2013 1 次提交
    • P
      qemu: Prefer VFIO for PCI device passthrough · f094aaac
      Peter Krempa 提交于
      Prefer using VFIO (if available) to the legacy KVM device passthrough.
      
      With this patch a PCI passthrough device without the driver configured
      will be started with VFIO if it's available on the host. If not legacy
      KVM passthrough is checked and error is reported if it's not available.
      f094aaac
  22. 08 10月, 2013 1 次提交
  23. 02 10月, 2013 1 次提交
  24. 26 9月, 2013 1 次提交
  25. 02 9月, 2013 1 次提交
  26. 29 8月, 2013 2 次提交