1. 17 9月, 2013 11 次提交
  2. 11 9月, 2013 1 次提交
  3. 06 9月, 2013 1 次提交
    • E
      qemu: only parse basename when determining emulator properties · 6a373fb2
      Eric Blake 提交于
      'virsh domxml-from-native' and 'virsh qemu-attach' could misbehave
      for an emulator installed in (a somewhat unlikely) location
      such as /usr/local/qemu-1.6/qemu-system-x86_64 or (an even less
      likely) /opt/notxen/qemu-system-x86_64.  Limit the strstr seach
      to just the basename of the file where we are assuming details
      about the binary based on its name.
      
      While testing, I accidentally triggered a core dump during strcmp
      when I forgot to set os.type on one of my code paths; this patch
      changes such a coding error to raise a nicer internal error instead.
      
      * src/qemu/qemu_command.c (qemuParseCommandLine): Compute basename
      earlier.
      * src/conf/domain_conf.c (virDomainDefPostParseInternal): Avoid
      NULL deref.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6a373fb2
  4. 05 9月, 2013 3 次提交
    • L
      virDomainDeviceIsUSB: Drop check for USB controller · ce78098e
      Liuji (Jeremy) 提交于
      Delete the USB controller check from the USB Device checklist in
      virDomainDeviceIsUSB as USB controller is a PCI device rather than
      a USB one.
      Signed-off-by: NLiu Ji <jeremy.liu@huawei.com>
      ce78098e
    • D
      Stop free'ing 'const char *' strings · bbcdd9b5
      Daniel P. Berrange 提交于
      The VIR_FREE() macro will cast away any const-ness. This masked a
      number of places where we passed a 'const char *' string to
      VIR_FREE. Fortunately in all of these cases, the variable was not
      in fact const data, but a heap allocated string. Fix all the
      variable declarations to reflect this.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      bbcdd9b5
    • P
      conf: Don't deref NULL actual network in virDomainNetGetActualHostdev() · a3d24862
      Peter Krempa 提交于
      In commit 991270db I've used virDomainNetGetActualHostdev() to get
      the actual hostdev from a network when removing the network from the
      list to avoid leaving the hostdev in the list. I didn't notice that this
      function doesn't check if the actual network is allocated and
      dereferences it. This crashes the daemon when cleaning up a domain
      object in early startup phases when the actual network definition isn't
      allocated. When the actual definition isn't present, the hostdev that
      might correspond to it won't be present anyways so it's safe to return
      NULL.
      
      Thanks to Cole Robinson for noticing this problem.
      a3d24862
  5. 04 9月, 2013 1 次提交
    • P
      conf: Remove the actual hostdev when removing a network · 991270db
      Peter Krempa 提交于
      Commit 50348e6e reused the code to remove the hostdev portion of a
      network definition on multiple places but forgot to take into account
      that sometimes the "actual" network is passed and in some cases the
      parent of that.
      
      This patch uses the virDomainNetGetActualHostdev() helper to acquire the
      correct pointer all the time while removing the hostdev portion from the
      list.
      991270db
  6. 03 9月, 2013 3 次提交
    • C
      qemu: Support virtio-mmio transport for virtio on ARM · 4fa17221
      Cole Robinson 提交于
      Starting with qemu 1.6, the qemu-system-arm vexpress-a9 model has a
      hardcoded virtio-mmio transport which enables attaching all virtio
      devices.
      
      On the command line, we have to use virtio-XXX-device rather than
      virtio-XXX-pci, thankfully s390 already set the precedent here so
      it's fairly straight forward.
      
      At the XML level, this adds a new device address type virtio-mmio.
      The controller and addressing don't have any subelements at the
      moment because we they aren't needed for this usecase, but could
      be added later if needed.
      
      Add a test case for an ARM guest with one of every virtio device
      enabled.
      4fa17221
    • C
      domain_conf: Add disk bus=sd, wire it up for qemu · 3730353f
      Cole Robinson 提交于
      This corresponds to '-sd' and '-drive if=sd' on the qemu command line.
      Needed for many ARM boards which don't provide any other way to
      pass in storage.
      3730353f
    • C
      domain_conf: Add default memballoon in PostParse callbacks · d40cde31
      Cole Robinson 提交于
      This should be a no-op change for now.
      d40cde31
  7. 02 9月, 2013 1 次提交
    • F
      qemu: Support setting the 'removable' flag for USB disks · feba2feb
      Fred A. Kemp 提交于
      Add an attribute named 'removable' to the 'target' element of disks,
      which controls the removable flag. For instance, on a Linux guest it
      controls the value of /sys/block/$dev/removable. This option is only
      valid for USB disks (i.e. bus='usb'), and its default value is 'off',
      which is the same behaviour as before.
      
      To achieve this, 'removable=on' (or 'off') is appended to the '-device
      usb-storage' parameter sent to qemu when adding a USB disk via
      '-disk'. A capability flag QEMU_CAPS_USB_STORAGE_REMOVABLE was added
      to keep track if this option is supported by the qemu version used.
      
      Bug: https://bugzilla.redhat.com/show_bug.cgi?id=922495Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      feba2feb
  8. 29 8月, 2013 1 次提交
    • P
      qemu: Remove hostdev entry when freeing the depending network entry · 50348e6e
      Peter Krempa 提交于
      When using a <interface type="network"> that points to a network with
      hostdev forwarding mode a hostdev alias is created for the network. This
      allias is inserted into the hostdev list, but is backed with a part of
      the network object that it is connected to.
      
      When a VM is being stopped qemuProcessStop() calls
      networkReleaseActualDevice() which eventually frees the memory for the
      hostdev object. Afterwards when the domain definition is being freed by
      virDomainDefFree() an invalid pointer is accessed by
      virDomainHostdevDefFree() and may cause a crash of the daemon.
      
      This patch removes the entry in the hostdev list before freeing the
      depending memory to avoid this issue.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1000973
      50348e6e
  9. 27 8月, 2013 5 次提交
  10. 22 8月, 2013 1 次提交
  11. 21 8月, 2013 1 次提交
    • E
      selinux: distinguish failure to label from request to avoid label · 0f082e69
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=924153
      
      Commit 904e05a2 (v0.9.9) added a per-<disk> seclabel element with
      an attribute relabel='no' in order to try and minimize the
      impact of shutdown delays when an NFS server disappears.  The idea
      was that if a disk is on NFS and can't be labeled in the first
      place, there is no need to attempt the (no-op) relabel on domain
      shutdown.  Unfortunately, the way this was implemented was by
      modifying the domain XML so that the optimization would survive
      libvirtd restart, but in a way that is indistinguishable from an
      explicit user setting.  Furthermore, once the setting is turned
      on, libvirt avoids attempts at labeling, even for operations like
      snapshot or blockcopy where the chain is being extended or pivoted
      onto non-NFS, where SELinux labeling is once again possible.  As
      a result, it was impossible to do a blockcopy to pivot from an
      NFS image file onto a local file.
      
      The solution is to separate the semantics of a chain that must
      not be labeled (which the user can set even on persistent domains)
      vs. the optimization of not attempting a relabel on cleanup (a
      live-only annotation), and using only the user's explicit notation
      rather than the optimization as the decision on whether to skip
      a label attempt in the first place.  When upgrading an older
      libvirtd to a newer, an NFS volume will still attempt the relabel;
      but as the avoidance of a relabel was only an optimization, this
      shouldn't cause any problems.
      
      In the ideal future, libvirt will eventually have XML describing
      EVERY file in the backing chain, with each file having a separate
      <seclabel> element.  At that point, libvirt will be able to track
      more closely which files need a relabel attempt at shutdown.  But
      until we reach that point, the single <seclabel> for the entire
      <disk> chain is treated as a hint - when a chain has only one
      file, then we know it is accurate; but if the chain has more than
      one file, we have to attempt relabel in spite of the attribute,
      in case part of the chain is local and SELinux mattered for that
      portion of the chain.
      
      * src/conf/domain_conf.h (_virSecurityDeviceLabelDef): Add new
      member.
      * src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML):
      Parse it, for live images only.
      (virSecurityDeviceLabelDefFormat): Output it.
      (virDomainDiskDefParseXML, virDomainChrSourceDefParseXML)
      (virDomainDiskSourceDefFormat, virDomainChrDefFormat)
      (virDomainDiskDefFormat): Pass flags on through.
      * src/security/security_selinux.c
      (virSecuritySELinuxRestoreSecurityImageLabelInt): Honor labelskip
      when possible.
      (virSecuritySELinuxSetSecurityFileLabel): Set labelskip, not
      norelabel, if labeling fails.
      (virSecuritySELinuxSetFileconHelper): Fix indentation.
      * docs/formatdomain.html.in (seclabel): Document new xml.
      * docs/schemas/domaincommon.rng (devSeclabel): Allow it in RNG.
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.xml:
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.args:
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-*-labelskip.xml:
      New test files.
      * tests/qemuxml2argvtest.c (mymain): Run the new tests.
      * tests/qemuxml2xmltest.c (mymain): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0f082e69
  12. 16 8月, 2013 1 次提交
  13. 07 8月, 2013 1 次提交
  14. 06 8月, 2013 2 次提交
    • 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
  15. 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
  16. 31 7月, 2013 1 次提交
  17. 30 7月, 2013 1 次提交
  18. 27 7月, 2013 1 次提交
    • E
      build: avoid uninitialized use warning · c86c3c32
      Eric Blake 提交于
      Otherwise, with new enough gcc compiling at -O2, the build fails with:
      ../../src/conf/domain_conf.c: In function ‘virDomainDeviceDefPostParse’:
      ../../src/conf/domain_conf.c:2821:29: error: ‘cnt’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
                   for (i = 0; i < *cnt; i++) {
                                   ^
      ../../src/conf/domain_conf.c:2795:20: note: ‘cnt’ was declared here
               size_t i, *cnt;
                          ^
      ../../src/conf/domain_conf.c:2794:30: error: ‘arrPtr’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
               virDomainChrDefPtr **arrPtr;
                                    ^
      
      * src/conf/domain_conf.c (virDomainChrGetDomainPtrs): Always
      assign into output parameters.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c86c3c32
  19. 26 7月, 2013 1 次提交
  20. 23 7月, 2013 2 次提交
    • O
      conf: Ignore the volume type disk if its mode is "direct" · 98584358
      Osier Yang 提交于
      virDomainDiskDefForeachPath is not only used by the security
      setting helpers, also used by cgroup setting helpers, so this
      is to ignore the volume type disk with mode="direct" for cgroup
      setting.
      98584358
    • J
      qemu: Translate the iscsi pool/volume disk source · 1b4eaa61
      John Ferlan 提交于
      The difference with already supported pool types (dir, fs, block)
      is: there are two modes for iscsi pool (or network pools in future),
      one can specify it either to use the volume target path (the path
      showed up on host) with mode='host', or to use the remote URI qemu
      supports (e.g. file=iscsi://example.org:6000/iqn.1992-01.com.example/1)
      with mode='direct'.
      
      For 'host' mode, it copies the volume target path into disk->src. For
      'direct' mode, the corresponding info in the *one* pool source host def
      is copied to disk->hosts[0].
      1b4eaa61