1. 15 10月, 2013 1 次提交
  2. 31 8月, 2013 1 次提交
    • C
      qemu: Only setup vhost if virtType == "kvm" · d962318c
      Cole Robinson 提交于
      vhost only works in KVM mode at the moment, and is infact compiled
      out if the emulator is built for non-native architecture. While it
      may work at some point in the future for plain qemu, for now it's
      just noise on the command line (and which contributes to arm cli
      breakage).
      d962318c
  3. 27 8月, 2013 3 次提交
    • J
      Build QEMU command line for pcihole64 · 63ee776f
      Ján Tomko 提交于
      QEMU commit 3984890 introduced the "pci-hole64-size" property,
      to i440FX-pcihost and q35-pcihost with a default setting of 2 GB.
      
      Translate <pcihole64>x<pcihole64/> to:
      -global q35-pcihost.pci-hole64-size=x for q35 machines and
      -global i440FX-pcihost.pci-hole64-size=x for i440FX-based machines.
      
      Error out on other machine types or if the size was specified
      but the pcihost device lacks 'pci-hole64-size' property.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=990418
      63ee776f
    • A
      Add ftp protocol support for cdrom disk · 796513d7
      Aline Manera 提交于
      The ftp protocol is already recognized by qemu/KVM so add this support to
      libvirt as well.
      The xml should be as following:
      
           <disk type='network' device='cdrom'>
             <source protocol='ftp' name='/url/path'>
               <host name='host.name' port='21'/>
             </source>
           </disk>
      Signed-off-by: NAline Manera <alinefm@br.ibm.com>
      796513d7
    • A
      Add http protocol support for cdrom disk · 3485ce4e
      Aline Manera 提交于
      QEMU/KVM already allows a HTTP URL for the cdrom ISO image so add this support
      to libvirt as well.
      The xml should be as following:
      
          <disk type='network' device='cdrom'>
            <source protocol='http' name='/url/path'>
              <host name='host.name' port='80'/>
            </source>
          </disk>
      Signed-off-by: NAline Manera <alinefm@br.ibm.com>
      3485ce4e
  4. 22 8月, 2013 1 次提交
  5. 21 8月, 2013 1 次提交
    • J
      Report secret usage error message similarly · 1fa7946f
      John Ferlan 提交于
      Each of the modules handled reporting error messages from the secret fetching
      slightly differently with respect to the error. Provide a similar message
      for each error case and provide as much data as possible.
      1fa7946f
  6. 20 8月, 2013 1 次提交
  7. 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
  8. 14 8月, 2013 1 次提交
  9. 07 8月, 2013 2 次提交
    • L
      qemu: improve error reporting during PCI address validation · c033e210
      Laine Stump 提交于
      This patch addresses two concerns with the error reporting when an
      incompatible PCI address is specified for a device:
      
      1) It wasn't always apparent which device had the problem. With this
      patch applied, any error about an incompatible address will always
      contain the full address as given in the config, so it will be easier
      to determine which device's config aused the problem.
      
      2) In some cases when the problem came from bad config, the error
      message was erroneously classified as VIR_ERR_INTERNAL_ERROR. With
      this patch applied, the same error message will be changed to indicate
      either "internal" or "xml" error depending on whether the address came
      from the config, or was automatically generated by libvirt.
      
      Note that in the case of "internal" (due to bad auto-generation)
      errors, the PCI address won't be of much use in finding the location
      in config to change (because it was automatically generated). Of
      course that makes perfect sense, but still the address could provide a
      clue about a bug in libvirt attempting to use a type of pci bus that
      doesn't have its flags set correctly (or something similar). In other
      words, it's not perfect, but it is definitely better.
      c033e210
    • L
      qemu: enable using implicit sata controller in q35 machines · 83718cfe
      Laine Stump 提交于
      q35 machines have an implicit ahci (sata) controller at 00:1F.2 which
      has no "id" associated with it. For this reason, we can't refer to it
      as "ahci0". Instead, we don't give an id on the commandline, which
      qemu interprets as "use the first ahci controller". We then need to
      specify the unit with "unit=%d" rather than adding it onto the bus
      arg.
      83718cfe
  10. 06 8月, 2013 5 次提交
    • L
      qemu: properly set/use device alias for pci controllers · 01b88127
      Laine Stump 提交于
      We had been setting the device alias in the devinceinfo for pci
      controllers to "pci%u", but then hardcoding "pci.%u" when creating the
      device address for other devices using that pci bus. This all worked
      just fine until we encountered the built-in "pcie.0" bus (the PCIe
      root complex) in Q35 machines.
      
      In order to create the correct commandline for this one case, this
      patch:
      
      1) sets the alias for PCI controllers correctly, to "pci.%u" (or
      "pcie.%u" for the pcie-root controller)
      
      2) eliminates the hardcoded "pci.%u" for pci controllers when
      generatuing device address strings, and instead uses the controller's
      alias.
      
      3) plumbs a pointer to the virDomainDef all the way down to
      qemuBuildDeviceAddressStr. This was necessary in order to make the
      aliase of the controller *used by a device* available (previously
      qemuBuildDeviceAddressStr only had the deviceinfo of the device
      itself, *not* of the controller it was connecting to). This made for a
      larger than desired diff, but at least in the future we won't have to
      do it again, since all the information we could possibly ever need for
      future enhancements is in the virDomainDef. (right?)
      
      This should be done for *all* controllers, but for now we just do it
      in the case of PCI controllers, to reduce the likelyhood of
      regression.
      01b88127
    • 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
    • L
      qemu: enable auto-allocate of all PCI addresses · c305783c
      Laine Stump 提交于
      Previous refactoring of the guest PCI address reservation/allocation
      code allowed for slot types other than basic PCI (e.g. PCI express,
      non-hotpluggable slots, etc) but would not auto-allocate a slot for a
      device that required any type other than a basic hot-pluggable
      PCI slot.
      
      This patch refactors the code to be aware of different slot types
      during auto-allocation of addresses as well - as long as there is an
      empty slot of the required type, it will be found and used.
      
      The piece that *wasn't* added is that we don't auto-create a new PCI
      bus when needed for anything except basic PCI devices. This is because
      there are multiple different types of controllers that can provide,
      for example, a PCI express slot (in addition to the pcie-root
      controller, these can also be found on a "root-port" or on a
      "downstream-switch-port"). Since we currently don't support any PCIe
      devices (except pending support for dmi-to-pci-bridge), we can defer
      any decision on what to do about this.
      c305783c
  11. 04 8月, 2013 2 次提交
    • L
      qemu: eliminate almost-duplicate code in qemu_command.c · 3bb01257
      Laine Stump 提交于
      * The functions qemuDomainPCIAddressReserveAddr and
      qemuDomainPCIAddressReserveSlot were very similar (and should have
      been more similar) and were about to get more code added to them which
      would create even more duplicated code, so this patch gives
      qemuDomainPCIAddressReserveAddr a "reserveEntireSlot" arg, then
      replaces the body of qemuDomainPCIAddressReserveSlot with a call to
      qemuDomainPCIAddressReserveAddr.
      
      You will notice that addrs->lastaddr was previously set in
      qemuDomainPCIAddressReserveAddr (but *not* set in
      qemuDomainPCIAddressReserveSlot). For consistency and cleanliness of
      code, that bit was removed and put into the one caller of
      qemuDomainPCIAddressReserveAddr (there is a similar place where the
      caller of qemuDomainPCIAddressReserveSlot sets lastaddr). This does
      guarantee identical functionality to pre-patch code, but in practice
      isn't really critical, because lastaddr is just keeping track of where
      to start when looking for a free slot - if it isn't updated, we will
      just start looking on a slot that's already occupied, then skip up to
      one that isn't.
      
      * qemuCollectPCIAddress was essentially doing the same thing as
      qemuDomainPCIAddressReserveAddr, but with some extra special case
      checking at the beginning. The duplicate code has been replaced with
      a call to qemuDomainPCIAddressReserveAddr. This required adding a
      "fromConfig" boolean, which is only used to change the log error
      code from VIR_ERR_INTERNAL_ERROR (when the address was
      auto-generated by libvirt) to VIR_ERR_XML_ERROR (when the address is
      coming from the config); without this differentiation, it would be
      difficult to tell if an error was caused by something wrong in
      libvirt's auto-allocate code or just bad config.
      
      * the bit of code in qemuDomainPCIAddressValidate that checks the
      connect type flags is going to be used in a couple more places where
      we don't need to also check the slot limits (because we're generating
      the slot number ourselves), so that has been pulled out into a
      separate qemuDomainPCIAddressFlagsCompatible function.
      3bb01257
    • L
      qemu: rename some functions in qemu_command.c · 29e3a1df
      Laine Stump 提交于
      * qemuDomainPCIAddressSetNextAddr
      
      The name of this function was confusing because 1) other functions in
      the file that end in "Addr" are only operating on a single function of
      one PCI slot, not the entire slot, while functions that do something
      with the entire slot end in "Slot", and 2) it didn't contain a verb
      describing what it is doing (the "Set" refers to the set that contains
      all PCI buses in the system, used to keep track of which slots in
      which buses are already reserved for use).
      
      It is now renamed to qemuDomainPCIAddressReserveNextSlot, which more
      clearly describes what it is doing. Arguably, it could have been
      changed to qemuDomainPCIAddressSetReserveNextSlot, but 1) the word
      "set" is confusing in this context because it could be intended as a
      verb or as a noun, and 2) most other functions that operate on a
      single slot or address within this set are also named
      qemuDomainPCIAddress... rather than qemuDomainPCIAddressSet... Only
      the Create, Free, and Grow functions for an address set (which modify the
      entire set, not just one element) use "Set" in their name.
      
      * qemuPCIAddressAsString, qemuPCIAddressValidate
      
      All the other functions in this set are named
      qemuDomainPCIAddressxxxxx, so I renamed these to be consistent.
      29e3a1df
  12. 24 7月, 2013 4 次提交
    • L
      qemu: set/validate slot/connection type when assigning slots for PCI devices · 3ceb4c7d
      Laine Stump 提交于
      Since PCI bridges, PCIe bridges, PCIe switches, and PCIe root ports
      all share the same namespace, they are all defined as controllers of
      type='pci' in libvirt (but with a differing model attribute). Each of
      these controllers has a certain connection type upstream, allows
      certain connection types downstream, and each can either allow a
      single downstream connection at slot 0, or connections from slot 1 -
      31.
      
      Right now, we only support the pci-root and pci-bridge devices, both
      of which only allow PCI devices to connect, and both which have usable
      slots 1 - 31. In preparation for adding other types of controllers
      that have different capabilities, this patch 1) adds info to the
      qemuDomainPCIAddressBus object to indicate the capabilities, 2) sets
      those capabilities appropriately for pci-root and pci-bridge devices,
      and 3) validates that the controller being connected to is the proper
      type when allocating slots or validating that a user-selected slot is
      appropriate for a device..
      
      Having this infrastructure in place will make it much easier to add
      support for the other PCI controller types.
      
      While it would be possible to do all the necessary checking by just
      storing the controller model in the qemyuDomainPCIAddressBus, it
      greatly simplifies all the validation code to also keep a "flags",
      "minSlot" and "maxSlot" for each - that way we can just check those
      attributes rather than requiring a nearly identical switch statement
      everywhere we need to validate compatibility.
      
      You may notice many places where the flags are seemingly hard-coded to
      
        QEMU_PCI_CONNECT_HOTPLUGGABLE | QEMU_PCI_CONNECT_TYPE_PCI
      
      This is currently the correct value for all PCI devices, and in the
      future will be the default, with small bits of code added to change to
      the flags for the few devices which are the exceptions to this rule.
      
      Finally, there are a few places with "FIXME" comments. Note that these
      aren't indicating places that are broken according to the currently
      supported devices, they are places that will need fixing when support
      for new PCI controller models is added.
      
      To assure that there was no regression in the auto-allocation of PCI
      addresses or auto-creation of integrated pci-root, ide, and usb
      controllers, a new test case (pci-bridge-many-disks) has been added to
      both the qemuxml2argv and qemuxml2xml tests. This new test defines a
      domain with several dozen virtio disks but no pci-root or
      pci-bridges. The .args file of the new test case was created using
      libvirt sources from before this patch, and the test still passes
      after this patch has been applied.
      3ceb4c7d
    • L
      qemu: make QEMU_PCI_ADDRESS_(SLOT|FUNCTION)_LAST less misleading · 9adafa08
      Laine Stump 提交于
      Although these two enums are named ..._LAST, they really had the value
      of ..._SIZE. This patch changes their values so that, e.g.,
      QEMU_PCI_ADDRESS_SLOT_LAST really is the slot number of the last slot
      on a PCI bus.
      9adafa08
    • L
      qemu: only check for PIIX3-specific device addrs on pc-* machinetypes · fcbfd584
      Laine Stump 提交于
      The implicit IDE, USB, and video controllers provided by the PIIX3
      chipset in the pc-* machinetypes are not present on other
      machinetypes, so we shouldn't be doing the special checking for
      them. This patch places those validation checks into a separate
      function that is only called for machine types that have a PIIX3 chip
      (which happens to be the i440fx-based pc-* machine types).
      
      One qemuxml2argv test data file had to be changed - the
      pseries-usb-multi test had included a piix3-usb-uhci device, which was
      being placed at a specific address, and also had slot 2 auto reserved
      for a video device, but the pseries virtual machine doesn't actually
      have a PIIX3 chip, so even if there was a piix3-usb-uhci driver for
      it, the device wouldn't need to reside at slot 1 function 2. I just
      changed the .argv file to have the generic slot info for the two
      devices that results when the special PIIX3 code isn't executed.
      fcbfd584
    • L
      qemu: turn qemuDomainPCIAddressBus into a struct · 23cc5352
      Laine Stump 提交于
      qemuDomainPCIAddressBus was an array of QEMU_PCI_ADDRESS_SLOT_LAST
      uint8_t's, which worked fine as long as every PCI bus was
      identical. In the future, some PCI busses will allow connecting PCI
      devices, and some will allow PCIe devices; also some will only allow
      connection of a single device, while others will allow connecting 31
      devices.
      
      In order to keep track of that information for each bus, we need to
      turn qemuDomainPCIAddressBus into a struct, for now with just one
      member:
      
         uint8_t slots[QEMU_PCI_ADDRESS_SLOT_LAST];
      
      Additional members will come in later patches.
      
      The item in qemuDomainPCIAddresSet that contains the array of
      qemuDomainPCIAddressBus is now called "buses" to be more consistent
      with the already existing "nbuses" (and with the new "slots" array).
      23cc5352
  13. 23 7月, 2013 4 次提交
  14. 22 7月, 2013 3 次提交
  15. 18 7月, 2013 3 次提交
    • M
      Add virtio-scsi to fallback models of scsi controller · b7f1c0c3
      Martin Kletzander 提交于
      When user does not specify any model for scsi controller, or worse, no
      controller at all, but libvirt automatically adds scsi controller with
      no model, we are not searching for virtio-scsi and thus this can fail
      for example on qemu which doesn't support lsi logic adapter.
      
      This means that when qemu on x86 doesn't support lsi53c895a and the
      user adds the following to an XML without any scsi controller:
      
      <disk ...>
        ...
        <target dev='sda'>
      </disk>
      
      libvirt fails like this:
       # virsh define asdf.xml
       error: Failed to define domain from asdf.xml
       error: internal error Unable to determine model for scsi controller
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=974943
      b7f1c0c3
    • J
      virAsprintf: correctly check return value · 23e938ee
      Ján Tomko 提交于
      When virAsprintf was changed from a function to a macro
      reporting OOM error in dc6f2dad, it was documented as returning
      0 on success. This is incorrect, it returns the number of bytes
      written as asprintf does.
      
      Some of the functions were converted to use virAsprintf's return
      value directly, changing the return value on success from 0 to >= 0.
      
      For most of these, this is not a problem, but the change in
      virPCIDriverDir breaks PCI passthrough.
      
      The return value check in virhashtest pre-dates virAsprintf OOM
      conversion.
      
      vmwareMakePath seems to be unused.
      23e938ee
    • D
      Merge virCommandPreserveFD / virCommandTransferFD · 040d9963
      Daniel P. Berrange 提交于
      Merge the virCommandPreserveFD / virCommandTransferFD methods
      into a single virCommandPasFD method, and use a new
      VIR_COMMAND_PASS_FD_CLOSE_PARENT to indicate their difference
      in behaviour
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      040d9963
  16. 17 7月, 2013 1 次提交
  17. 16 7月, 2013 1 次提交
  18. 15 7月, 2013 1 次提交
  19. 12 7月, 2013 3 次提交
  20. 11 7月, 2013 1 次提交