1. 01 5月, 2014 1 次提交
  2. 29 4月, 2014 1 次提交
  3. 24 4月, 2014 5 次提交
  4. 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
  5. 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
  6. 24 3月, 2014 1 次提交
    • M
      qemuDomainGetImageIds: Skip <seclabel/> without label · 0d93526f
      Michal Privoznik 提交于
      It's easy to shed the daemon these days. With this XML snippet:
      
          <disk type='file' device='disk'>
            <driver name='qemu' type='raw'/>
            <source file='/some/dummy/path/test.bin'>
              <seclabel model='dac' relabel='no'/>
            </source>
            <target dev='vdb' bus='virtio'/>
            <readonly/>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
          </disk>
      
      I get the SIGSEGV when starting the domain. The thing is, when
      starting a domain, we check for its disk presence. For some reason,
      when determining the disk chain, we parse the <seclabel/> (don't ask
      me why). However, there's no label attribute in the XML, so we end up
      calling virParseOwnershipIds() over NULL string:
      
       [Switching to Thread 0x7ffff10c4700 (LWP 30956)]
       __strchr_sse42 () at ../sysdeps/x86_64/multiarch/strchr.S:136
       136     ../sysdeps/x86_64/multiarch/strchr.S: No such file or directory.
       (gdb) bt
       #0  __strchr_sse42 () at ../sysdeps/x86_64/multiarch/strchr.S:136
       #1  0x00007ffff749f800 in virParseOwnershipIds (label=0x0, uidPtr=uidPtr@entry=0x7ffff10c2df0, gidPtr=gidPtr@entry=0x7ffff10c2df4) at util/virutil.c:2115
       #2  0x00007fffe929f006 in qemuDomainGetImageIds (gid=0x7ffff10c2df4, uid=0x7ffff10c2df0, disk=0x7fffe40cb000, vm=0x7fffe40a6410, cfg=0x7fffe409ae00) at qemu/qemu_domain.c:2385
       #3  qemuDomainDetermineDiskChain (driver=driver@entry=0x7fffe40120e0, vm=vm@entry=0x7fffe40a6410, disk=disk@entry=0x7fffe40cb000, force=force@entry=false) at qemu/qemu_domain.c:2414
       #4  0x00007fffe929f128 in qemuDomainCheckDiskPresence (driver=driver@entry=0x7fffe40120e0, vm=vm@entry=0x7fffe40a6410, cold_boot=cold_boot@entry=true) at qemu/qemu_domain.c:2250
       #5  0x00007fffe92b6fc8 in qemuProcessStart (conn=conn@entry=0x7fffd4000b60, driver=driver@entry=0x7fffe40120e0, vm=vm@entry=0x7fffe40a6410, migrateFrom=migrateFrom@entry=0x0, stdin_fd=stdin_fd@entry=-1, stdin_path=stdin_path@entry=0x0, snapshot=snapshot@entry=0x0,
           vmop=vmop@entry=VIR_NETDEV_VPORT_PROFILE_OP_CREATE, flags=flags@entry=1) at qemu/qemu_process.c:3813
       #6  0x00007fffe93087e8 in qemuDomainObjStart (conn=0x7fffd4000b60, driver=driver@entry=0x7fffe40120e0, vm=vm@entry=0x7fffe40a6410, flags=flags@entry=0) at qemu/qemu_driver.c:6051
       #7  0x00007fffe9308e32 in qemuDomainCreateWithFlags (dom=0x7fffcc000d50, flags=0) at qemu/qemu_driver.c:6105
       #8  0x00007ffff753c5cc in virDomainCreate (domain=domain@entry=0x7fffcc000d50) at libvirt.c:8861
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      0d93526f
  7. 18 3月, 2014 2 次提交
  8. 14 3月, 2014 1 次提交
    • L
      conf: eliminate hardcoded indent from domain xml · ca6dc7b5
      Laine Stump 提交于
      Many of the domain xml format functions (including all of the device
      format functions) had hard-coded spaces, which made for incorrect
      indentation when those functions were called in a different context
      (for example, commit 2122cf39 added <interface> XML into the document
      provided to a network hook script, and in this case it should have
      been indented by 2 spaces, but was instead indented by 6 spaces).
      
      To make it possible to insert a properly indented device anywhere into
      an XML document, this patch removes hardcoded spaces from the
      formatting functions, and calls virBufferAdjustIndent() at appropriate
      places instead. (a regex search of domain_conf.c was done to assure
      that all occurrences of hardcoded spaces were removed).
      
      virDomainDiskSourceDefFormatInternal() is also called from
      snapshot_conf.c, so two virBufferAdjustIndent() calls were temporarily
      added around that call - those functions will have hardcoded spaces
      removed in a separate patch.
      
      This could cause some conflicts when backporting future changes to the
      formatting functions to older branches, but fortunately the changes
      are almost all trivial, so conflict resolution will be obvious.
      ca6dc7b5
  9. 10 3月, 2014 1 次提交
  10. 19 2月, 2014 2 次提交
  11. 17 2月, 2014 1 次提交
    • M
      qemu: Implement VIR_DOMAIN_TAINT_HOOK · 3b2c2794
      Michal Privoznik 提交于
      Currently, there's just one place where we care if hook script is
      changing the domain XML: migration hook for incoming migration. In
      all other places where a hook script is executed, we don't read the
      XML back from the script.
      
      Anyway, the hook script can alter domain XML and hence we should taint
      it if the script did.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3b2c2794
  12. 10 2月, 2014 1 次提交
  13. 07 1月, 2014 1 次提交
  14. 10 12月, 2013 2 次提交
  15. 21 11月, 2013 1 次提交
  16. 01 11月, 2013 1 次提交
  17. 17 10月, 2013 1 次提交
  18. 15 10月, 2013 1 次提交
    • E
      maint: avoid 'const fooPtr' in domain_conf · d2467709
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in src/conf/domain_conf, and their fallout.
      
      Several things to note: virObjectLock() requires a non-const
      argument; if this were C++, we could treat the locking field
      as 'mutable' and allow locking an otherwise 'const' object, but
      that is a more invasive change, so I instead dropped attempts
      to be const-correct on domain lookup.  virXMLPropString and
      friends require a non-const xmlNodePtr - this is because libxml2
      is not a const-correct library.  We could make the src/util/virxml
      wrappers cast away const, but I figured it was easier to not
      try to mark xmlNodePtr as const.  Finally, virDomainDeviceDefCopy
      was a rather hard conversion - it calls virDomainDeviceDefPostParse,
      which in turn in the xen driver was actually modifying the domain
      outside of the current device being visited.  We should not be
      adding a device on the first per-device callback, but waiting until
      after all per-device callbacks are complete.
      
      * src/conf/domain_conf.h (virDomainObjListFindByID)
      (virDomainObjListFindByUUID, virDomainObjListFindByName)
      (virDomainObjAssignDef, virDomainObjListAdd): Drop attempt at
      const.
      (virDomainDeviceDefCopy): Use intended type.
      (virDomainDeviceDefParse, virDomainDeviceDefPostParseCallback)
      (virDomainVideoDefaultType, virDomainVideoDefaultRAM)
      (virDomainChrGetDomainPtrs): Make const-correct.
      * src/conf/domain_conf.c (virDomainObjListFindByID)
      (virDomainObjListFindByUUID, virDomainObjListFindByName)
      (virDomainDeviceDefCopy, virDomainObjListAdd)
      (virDomainObjAssignDef, virDomainHostdevSubsysUsbDefParseXML)
      (virDomainHostdevSubsysPciOrigStatesDefParseXML)
      (virDomainHostdevSubsysPciDefParseXML)
      (virDomainHostdevSubsysScsiDefParseXML)
      (virDomainControllerModelTypeFromString)
      (virDomainTPMDefParseXML, virDomainTimerDefParseXML)
      (virDomainSoundCodecDefParseXML, virDomainSoundDefParseXML)
      (virDomainWatchdogDefParseXML, virDomainRNGDefParseXML)
      (virDomainMemballoonDefParseXML, virDomainNVRAMDefParseXML)
      (virSysinfoParseXML, virDomainVideoAccelDefParseXML)
      (virDomainVideoDefParseXML, virDomainHostdevDefParseXML)
      (virDomainRedirdevDefParseXML)
      (virDomainRedirFilterUsbDevDefParseXML)
      (virDomainRedirFilterDefParseXML, virDomainIdMapEntrySort)
      (virDomainIdmapDefParseXML, virDomainVcpuPinDefParseXML)
      (virDiskNameToBusDeviceIndex, virDomainDeviceDefCopy)
      (virDomainVideoDefaultType, virDomainHostdevAssignAddress)
      (virDomainDeviceDefPostParseInternal, virDomainDeviceDefPostParse)
      (virDomainChrGetDomainPtrs, virDomainControllerSCSINextUnit)
      (virDomainSCSIDriveAddressIsUsed)
      (virDomainDriveAddressIsUsedByDisk)
      (virDomainDriveAddressIsUsedByHostdev): Fix fallout.
      * src/openvz/openvz_driver.c (openvzDomainDeviceDefPostParse):
      Likewise.
      * src/libxl/libxl_domain.c (libxlDomainDeviceDefPostParse):
      Likewise.
      * src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse)
      (qemuDomainDefaultNetModel): Likewise.
      * src/lxc/lxc_domain.c (virLXCDomainDeviceDefPostParse):
      Likewise.
      * src/uml/uml_driver.c (umlDomainDeviceDefPostParse): Likewise.
      * src/xen/xen_driver.c (xenDomainDeviceDefPostParse): Split...
      (xenDomainDefPostParse): ...since per-device callback is not the
      time to be adding a device.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d2467709
  19. 11 10月, 2013 1 次提交
    • M
      qemu: Introduce qemuDomainDefCheckABIStability · 7d704812
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=994364
      
      Whenever we check for ABI stability, we have new xml (e.g. provided by
      user, or obtained from snapshot, whatever) which we compare to old xml
      and see if ABI won't break. However, if the new xml was produced via
      virDomainGetXMLDesc(..., VIR_DOMAIN_XML_MIGRATABLE) it lacks some
      devices, e.g. 'pci-root' controller. Hence, the ABI stability check
      fails even though it is stable. Moreover, we can't simply fix
      virDomainDefCheckABIStability because removing the correct devices is
      task for the driver. For instance, qemu driver wants to remove the usb
      controller too, while LXC driver doesn't. That's why we need special
      qemu wrapper over virDomainDefCheckABIStability which removes the
      correct devices from domain XML, produces MIGRATABLE xml and calls the
      check ABI stability function.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      7d704812
  20. 25 9月, 2013 1 次提交
  21. 05 9月, 2013 1 次提交
  22. 03 9月, 2013 3 次提交
  23. 19 8月, 2013 1 次提交
    • M
      qemu: Drop qemuDomainMemoryLimit · 16bcb3b6
      Michal Privoznik 提交于
      This function is to guess the correct limit for maximal memory
      usage by qemu for given domain. This can never be guessed
      correctly, not to mention all the pains and sleepless nights this
      code has caused. Once somebody discovers algorithm to solve the
      Halting Problem, we can compute the limit algorithmically. But
      till then, this code should never see the light of the release
      again.
      16bcb3b6
  24. 07 8月, 2013 1 次提交
    • G
      qemu: support to drop disk with 'optional' startupPolicy · 8a160f11
      Guannan Ren 提交于
      Go through disks of guest, if one disk doesn't exist or its backing
      chain is broken, with 'optional' startupPolicy, for CDROM and Floppy
      we only discard its source path definition in xml, for disks we drop
      it from disk list and free it.
      8a160f11
  25. 06 8月, 2013 3 次提交
    • L
      qemu: fix handling of default/implicit devices for q35 · c27b0bb1
      Laine Stump 提交于
      This patch adds in special handling for a few devices that need to be
      treated differently for q35 domains:
      
      usb - there is no implicit/default usb controller for the q35
      machinetype. This is done because normally the default usb controller
      is added to a domain by just adding "-usb" to the qemu commandline,
      and it's assumed that this will add a single piix3 usb1 controller at
      slot 1 function 2. That's not what happens when the machinetype is
      q35, though. Instead, adding -usb to the commandline adds 3 usb
      (version 2) controllers to the domain at slot 0x1D.{1,2,7}. Rather
      than having
      
        <controller type='usb' index='0'/>
      
      translate into 3 separate devices on the PCI bus, it's cleaner to not
      automatically add a default usb device; one can always be added
      explicitly if desired. Or we may decide that on q35 machines, 3 usb
      controllers will be automatically added when none is given. But for
      this initial commit, at least we aren't locking ourselves into
      something we later won't want.
      
      video - qemu always initializes the primary video device immediately
      after any integrated devices for the machinetype. Unless instructed
      otherwise (by using "-device vga..." instead of "-vga" which libvirt
      uses in many cases to work around deficiencies and bugs in various
      qemu versions) qemu will always pick the first unused slot. In the
      case of the "pc" machinetype and its derivatives, this is always slot
      2, but on q35 machinetypes, the first free slot is slot 1 (since the
      q35's integrated peripheral devices are placed in other slots,
      e.g. slot 0x1f). In order to make the PCI address of the video device
      predictable, that slot (1 or 2, depending on machinetype) is reserved
      even when no video device has been specified.
      
      sata - a q35 machine always has a sata controller implicitly added at
      slot 0x1F, function 2. There is no way to avoid this controller, so we
      always add it. Note that the xml2xml tests for the pcie-root and q35
      cases were changed to use DO_TEST_DIFFERENT() so that we can check for
      the sata controller being automatically added. This is especially
      important because we can't check for it in the xml2argv output (it has
      no effect on that output since it's an implicit device).
      
      ide - q35 has no ide controllers.
      
      isa and smbus controllers - these two are always present in a q35 (at
      slot 0x1F functions 0 and 3) but we have no way of modelling them in
      our config. We do need to reserve those functions so that the user
      doesn't attempt to put anything else there though. (note that the "pc"
      machine type also has an ISA controller, which we also ignore).
      c27b0bb1
    • L
      qemu: add dmi-to-pci-bridge controller · 62ac6b43
      Laine Stump 提交于
      This PCI controller, named "dmi-to-pci-bridge" in the libvirt config,
      and implemented with qemu's "i82801b11-bridge" device, connects to a
      PCI Express slot (e.g. one of the slots provided by the pcie-root
      controller, aka "pcie.0" on the qemu commandline), and provides 31
      *non-hot-pluggable* PCI (*not* PCIe) slots, numbered 1-31.
      
      Any time a machine is defined which has a pcie-root controller
      (i.e. any q35-based machinetype), libvirt will automatically add a
      dmi-to-pci-bridge controller if one doesn't exist, and also add a
      pci-bridge controller. The reasoning here is that any useful domain
      will have either an immediate (startup time) or eventual (subsequent
      hot-plug) need for a standard PCI slot; since the pcie-root controller
      only provides PCIe slots, we need to connect a dmi-to-pci-bridge
      controller to it in order to get a non-hot-plug PCI slot that we can
      then use to connect a pci-bridge - the slots provided by the
      pci-bridge will be both standard PCI and hot-pluggable.
      
      Since pci-bridge devices themselves can not be hot-plugged into a
      running system (although you can hot-plug other devices into a
      pci-bridge's slots), any new pci-bridge controller that is added can
      (and will) be plugged into the dmi-to-pci-bridge as long as it has
      empty slots available.
      
      This patch is also changing the qemuxml2xml-pcie test from a "DO_TEST"
      to a "DO_DIFFERENT_TEST". This is so that the "before" xml can omit
      the automatically added dmi-to-pci-bridge and pci-bridge devices, and
      the "after" xml can include it - this way we are testing if libvirt is
      properly adding these devices.
      62ac6b43
    • L
      qemu: add pcie-root controller · 48a3f48a
      Laine Stump 提交于
      This controller is implicit on q35 machinetypes. It provides 31 PCIe
      (*not* PCI) slots as controller 0.
      
      Currently there are no devices that can connect to pcie-root, and no
      implicit pci controller on a q35 machine, so q35 is still
      unusable. For a usable q35 system, we need to add a
      "dmi-to-pci-bridge" pci controller, which can connect to pcie-root,
      and provides standard pci slots that can be used to connect other
      devices.
      48a3f48a
  26. 04 8月, 2013 1 次提交
    • L
      conf: add default USB controller in qemu post-parse callback · c66da9d2
      Laine Stump 提交于
      The parser shouldn't be doing arch-specific things like adding in
      implicit controllers to the config. This should instead be done in the
      hypervisor's post-parse callback.
      
      This patch removes the auto-add of a usb controller from the domain
      parser, and puts it into the qemu driver's post-parse callback (just
      as is already done with the auto-add of the pci-root controller). In
      the future, any machine/arch that shouldn't have a default usb
      controller added should just set addDefaultUSB = false in this
      function.
      
      We've recently seen that q35 and ARMV7L domains shouldn't get a default USB
      controller, so I've set addDefaultUSB to false for both of those.
      c66da9d2
  27. 01 8月, 2013 2 次提交