1. 06 8月, 2013 2 次提交
    • 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: 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
  2. 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
  3. 24 7月, 2013 1 次提交
    • 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
  4. 17 7月, 2013 1 次提交
  5. 12 7月, 2013 2 次提交
    • M
      qemu: Introduce qemuBuildChrDeviceStr · f293d763
      Michal Privoznik 提交于
      The function being introduced is responsible for creating command
      line argument for '-device' for given character device. Based on
      the chardev type, it calls appropriate qemuBuild.*ChrDeviceStr(),
      e.g.  qemuBuildSerialChrDeviceStr() for serial chardev and so on.
      f293d763
    • M
      qemu_command: Honour chardev alias assignment with a function · 2a9a5bef
      Michal Privoznik 提交于
      The chardev alias assignment is going to be needed in a separate
      places, so it should be moved into a separate function rather
      than copying code randomly around.
      2a9a5bef
  6. 22 5月, 2013 1 次提交
    • M
      qemu: Adapt qemuBuildInterfaceCommandLine to to multiqueue net · 1f24f682
      Michal Privoznik 提交于
      In order to learn libvirt multiqueue several things must be done:
      
      1) The '/dev/net/tun' device needs to be opened multiple times with
      IFF_MULTI_QUEUE flag passed to ioctl(fd, TUNSETIFF, &ifr);
      
      2) Similarly, '/dev/vhost-net' must be opened as many times as in 1)
      in order to keep 1:1 ratio recommended by qemu and kernel folks.
      
      3) The command line construction code needs to switch from 'fd=X' to
      'fds=X:Y:...:Z' and from 'vhostfd=X' to 'vhostfds=X:Y:...:Z'.
      
      4) The monitor handling code needs to learn to pass multiple FDs.
      1f24f682
  7. 20 5月, 2013 1 次提交
    • O
      qemu: Add callback struct for qemuBuildCommandLine · 3a6204cb
      Osier Yang 提交于
      Since 0d70656a, it starts to access the sysfs files to build
      the qemu command line (by virSCSIDeviceGetSgName, which is to find
      out the scsi generic device name by adpater:bus:target:unit), there
      is no way to work around, qemu wants to see the scsi generic device
      like "/dev/sg6" anyway.
      
      And there might be other places which need to access sysfs files
      when building qemu command line in future.
      
      Instead of increasing the arguments of qemuBuildCommandLine, this
      introduces a new callback for qemuBuildCommandLine, and thus tests
      can register their own callbacks for sysfs test input files accessing.
      
      * src/qemu/qemu_command.h: (New callback struct
                                  qemuBuildCommandLineCallbacks;
                                  extern buildCommandLineCallbacks)
      * src/qemu/qemu_command.c: (wire up the callback struct)
      * src/qemu/qemu_driver.c: (Use the new syntax of qemuBuildCommandLine)
      * src/qemu/qemu_hotplug.c: Likewise
      * src/qemu/qemu_process.c: Likewise
      * tests/testutilsqemu.[ch]: (Helper testSCSIDeviceGetSgName;
                                   callback struct testCallbacks;)
      * tests/qemuxml2argvtest.c: (Use testCallbacks)
      * src/tests/qemuxmlnstest.c: (Like above)
      3a6204cb
  8. 15 5月, 2013 1 次提交
    • M
      qemu: Add VNC WebSocket support · 85ec7ff6
      Martin Kletzander 提交于
      Adding a VNC WebSocket support for QEMU driver.  This functionality is
      in upstream qemu from commit described as v1.3.0-982-g7536ee4, so the
      capability is being recognized based on QEMU version for now.
      85ec7ff6
  9. 13 5月, 2013 1 次提交
    • H
      qemu: Build qemu command line for scsi host device · 0d70656a
      Han Cheng 提交于
      Except the scsi host device's controller is "lsilogic", mapping
      between the libvirt attributes and scsi-generic properties is:
      
        libvirt     qemu
      -----------------------------------------
        controller  bus ($libvirt_controller.0)
        bus         channel
        target      scsi-id
        unit        lun
      
      For scsi host device with "lsilogic" controller, the mapping is:
      ('target (libvirt)' must be 0, as it's not used; 'unit (libvirt)
      must <= 7).
      
        libvirt            qemu
      ----------------------------------------------------------
        controller && bus  bus ($libvirt_controller.$libvirt_bus)
        unit               scsi-id
      
      It's not good to hardcode/hard-check limits of these attributes,
      and even worse, these limits are not documented, one has to find
      out by either testing or reading the qemu code, I'm looking forward
      to qemu expose limits like these one day). For example, exposing
      "max_target", "max_lun" for megasas:
      
      static const struct SCSIBusInfo megasas_scsi_info = {
          .tcq = true,
          .max_target = MFI_MAX_LD,
          .max_lun = 255,
      
          .transfer_data = megasas_xfer_complete,
          .get_sg_list = megasas_get_sg_list,
          .complete = megasas_command_complete,
          .cancel = megasas_command_cancel,
      };
      
      Example of the qemu command line (lsilogic controller):
      
        -drive file=/dev/sg2,if=none,id=drive-hostdev-scsi_host7-0-0-0 \
        -device scsi-generic,bus=scsi0.0,scsi-id=8,\
        drive=drive-hostdev-scsi_host7-0-0-0,id=hostdev-scsi_host7-0-0-0
      
      Example of the qemu command line (virtio-scsi controller):
      
        -drive file=/dev/sg2,if=none,id=drive-hostdev-scsi_host7-0-0-0 \
        -device scsi-generic,bus=scsi0.0,channel=0,scsi-id=128,lun=128,\
        drive=drive-hostdev-scsi_host7-0-0-0,id=hostdev-scsi_host7-0-0-0
      Signed-off-by: NHan Cheng <hanc.fnst@cn.fujitsu.com>
      Signed-off-by: NOsier Yang <jyang@redhat.com>
      0d70656a
  10. 07 5月, 2013 1 次提交
    • L
      qemu: allocate network connections sooner during domain startup · 8cd40e7e
      Laine Stump 提交于
      VFIO device assignment requires a cgroup ACL to be setup for access to
      the /dev/vfio/nn "group" device for any devices that will be assigned
      to a guest. In the case of a host device that is allocated from a
      pool, it was being allocated during qemuBuildCommandLine(), which is
      called by qemuProcessStart() *after* the all-encompassing
      qemuSetupCgroup() was called, meaning that the standard Cgroup ACL
      setup wasn't creating ACLs for these devices allocated from pools.
      
      One possible solution was to manually add a single ACL down inside
      qemuBuildCommandLine() when networkAllocateActualDevice() is called,
      but that has two problems: 1) the function that adds the cgroup ACL
      requires a virDomainObjPtr, which isn't available in
      qemuBuildCommandLine(), and 2) we really shouldn't be doing network
      device setup inside qemuBuildCommandLine() anyway.
      
      Instead, I've created a new function called
      qemuNetworkPrepareDevices() which is called just before
      qemuPrepareHostDevices() during qemuProcessStart() (explanation of
      ordering in the comments), i.e. well before the call to
      qemuSetupCgroup(). To minimize code churn in a patch that will be
      backported to 1.0.5-maint, qemuNetworkPrepareDevices only does
      networkAllocateActualDevice() and the bare amount of setup required
      for type='hostdev network devices, but it eventually should do *all*
      device setup for guest network devices.
      
      Note that some of the code that was previously needed in
      qemuBuildCommandLine() is no longer required when
      networkAllocateActualDevice() is called earlier:
      
       * qemuAssignDeviceHostdevAlias() is already done further down in
         qemuProcessStart().
      
       * qemuPrepareHostdevPCIDevices() is called by
         qemuPrepareHostDevices() which is called after
         qemuNetworkPrepareDevices() in qemuProcessStart().
      
      As hinted above, this new function should be moved into a separate
      qemu_network.c (or similarly named) file along with
      qemuPhysIfaceConnect(), qemuNetworkIfaceConnect(), and
      qemuOpenVhostNet(), and expanded to call those functions as well, then
      the nnets loop in qemuBuildCommandLine() should be reduced to only
      build the commandline string (which itself can be in a separate
      qemuInterfaceBuilldCommandLine() function as suggested by
      Michal). However, this will require storing away an array of tapfd and
      vhostfd that are needed for the commandline, so I would rather do that
      in a separate patch and leave this patch at the minimum to fix the
      bug.
      8cd40e7e
  11. 27 4月, 2013 1 次提交
    • P
      qemu: launch bridge helper from libvirtd · 2d80fbb1
      Paolo Bonzini 提交于
      <source type='bridge'> uses a helper application to do the necessary
      TUN/TAP setup to use an existing network bridge, thus letting
      unprivileged users use TUN/TAP interfaces.
      
      However, libvirt should be preventing QEMU from running any setuid
      programs at all, which would include this helper program.  From
      a security POV, any setuid helper needs to be run by libvirtd itself,
      not QEMU.
      
      This is what this patch does.  libvirt now invokes the setuid helper,
      gets the TAP fd and then passes it to QEMU in the normal manner.
      The path to the helper is specified in qemu.conf.
      
      As a small advantage, this adds a <target dev='tap0'/> element to the
      XML of an active domain using <interface type='bridge'>.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2d80fbb1
  12. 25 4月, 2013 2 次提交
    • J
      qemu: auto-add bridges and allow using them · 9d6e56db
      Ján Tomko 提交于
      Add a "dry run" address allocation to figure out how many bridges
      will be needed for all the devices without explicit addresses.
      
      Auto-add just enough bridges to put all the devices on, or up to the
      bridge with the largest specified index.
      9d6e56db
    • J
      qemu: auto-add pci-root controller for pc machine types · b33eb0dc
      Ján Tomko 提交于
      <controller type='pci' index='0' model='pci-root'/>
      is auto-added to pc* machine types.
      Without this controller PCI bus 0 is not available and
      no PCI addresses are assigned by default.
      
      Since older libvirt supported PCI bus 0 even without
      this controller, it is removed from the XML when migrating.
      b33eb0dc
  13. 08 4月, 2013 1 次提交
    • O
      qemu: Translate the pool disk source earlier · 60b78b33
      Osier Yang 提交于
      To support "shareable" for volume type disk, we have to translate
      the source before trying to add the shared disk entry. To achieve
      the goal, this moves the helper qemuTranslateDiskSourcePool into
      src/qemu/qemu_conf.c, and introduce an internal only member (voltype)
      for struct _virDomainDiskSourcePoolDef, to record the underlying
      volume type for use when building the drive string.
      
      Later patch will support "shareable" volume type disk.
      60b78b33
  14. 05 4月, 2013 1 次提交
  15. 14 3月, 2013 1 次提交
    • V
      S390: QEMU driver support for CCW addresses · 608512b2
      Viktor Mihajlovski 提交于
      This commit adds the QEMU driver support for CCW addresses. The
      current QEMU only allows virtio devices to be attached to the
      CCW bus. We named the new capability indicating that support
      QEMU_CAPS_VIRTIO_CCW accordingly.
      
      The fact that CCW devices can only be assigned to domains with a
      machine type of s390-ccw-virtio requires a few extra checks for
      machine type in qemu_command.c on top of querying
      QEMU_CAPS_VIRTIO_{CCW|S390}.
      
      The majority of the new functions deals with CCW address generation
      and management.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      608512b2
  16. 13 3月, 2013 1 次提交
    • P
      virCaps: conf: start splitting out irrelevat data · 27cf98e2
      Peter Krempa 提交于
      The virCaps structure gathered a ton of irrelevant data over time that.
      The original reason is that it was propagated to the XML parser
      functions.
      
      This patch aims to create a new data structure virDomainXMLConf that
      will contain immutable data that are used by the XML parser. This will
      allow two things we need:
      
      1) Get rid of the stuff from virCaps
      
      2) Allow us to add callbacks to check and add driver specific stuff
      after domain XML is parsed.
      
      This first attempt removes pointers to private data allocation functions
      to this new structure and update all callers and function that require
      them.
      27cf98e2
  17. 20 2月, 2013 1 次提交
    • J
      qemu: switch PCI address alocation to use virDevicePCIAddress · bc28e56b
      Ján Tomko 提交于
      Some functions were using virDomainDeviceInfo where virDevicePCIAddress
      would suffice. Some were only using integers for slots and functions,
      assuming the bus numbers are always 0.
      
      Switch from virDomainDeviceInfoPtr to virDevicePCIAddressPtr:
      qemuPCIAddressAsString
      qemuDomainPCIAddressCheckSlot
      qemuDomainPCIAddressReserveAddr
      qemuDomainPCIAddressReleaseAddr
      
      Switch from int slot to virDevicePCIAddressPtr:
      qemuDomainPCIAddressReserveSlot
      qemuDomainPCIAddressReleaseSlot
      qemuDomainPCIAddressGetNextSlot
      
      Deleted functions (they would take the same parameters
      as ReserveAddr/ReleaseAddr do now.)
      qemuDomainPCIAddressReserveFunction
      qemuDomainPCIAddressReleaseFunction
      bc28e56b
  18. 08 2月, 2013 1 次提交
  19. 21 12月, 2012 1 次提交
  20. 19 12月, 2012 1 次提交
  21. 17 12月, 2012 1 次提交
    • G
      qemu: use newer -device video device in qemu commandline · aa51202b
      Guannan Ren 提交于
      '-device VGA' maps to '-vga std'
      '-device cirrus-vga' maps to '-vga cirrus'
      '-device qxl-vga' maps to '-vga qxl'
                   (there is also '-device qxl' for secondary devices)
      '-device vmware-svga' maps to '-vga vmware'
      
      For qemu(>=1.2), we can use -device to replace -vga for video
      device. For the primary video device, the patch tries to use 0x2
      slot for matching old qemu. If the 0x2 slot is allocated already,
      the addr property could help for using any available slot.
      For qemu(< 1.2), we keep using -vga for primary device.
      aa51202b
  22. 29 11月, 2012 1 次提交
  23. 27 9月, 2012 2 次提交
  24. 21 9月, 2012 1 次提交
  25. 13 9月, 2012 2 次提交
    • D
      Turn QEMU capabilities object into a full virObjectPtr · beac09fd
      Daniel P. Berrange 提交于
      The current qemu capabilities are stored in a virBitmapPtr
      object, whose type is exposed to callers. We want to store
      more data besides just the flags, so we need to move to a
      struct type. This object will also need to be reference
      counted, since we'll be maintaining a cache of data per
      binary. This change introduces a 'qemuCapsPtr' virObject
      class. Most of the change is just renaming types and
      variables in all the callers
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      beac09fd
    • G
      qemu: build USB redirection filter qemu command line · 2d46f88d
      Guannan Ren 提交于
      Input XML snip:
      <redirdev bus='usb' type='spicevmc'>
         <address type='usb' bus='0' port='4'/>
       </redirdev>
      <redirfilter>
        <usbdev class='0x08' vendor='0x1234' product='0xbeef' \
                version='2.00' allow='yes'/>
        <usbdev class='-1' vendor='-1' product='-1' version='-1' allow='no'/>
      </redirfilter>
      
      will be converted to:
      -device usb-redir,chardev=charredir0,id=redir0,\
      filter=0x08:0x1234:0xBEEF:0x2000:1|-1:-1:-1:-1:0,bus=usb.0,port=4
      2d46f88d
  26. 21 8月, 2012 2 次提交
    • M
      qemu: configurable remote display port boundaries · 29226bee
      Martin Kletzander 提交于
      The defines QEMU_REMOTE_PORT_MIN and QEMU_REMOTE_PORT_MAX were used to
      find free port when starting domains. As this was hard-coded to the
      same ports as default VNC servers, there were races with these other
      programs. This patch includes the possibility to change the default
      starting port as well as the maximum port (mostly for completeness) in
      qemu config file.
      
      Support for two new config options in qemu.conf is added:
       - remote_port_min (defaults to QEMU_REMOTE_PORT_MIN and
         must be >= than this value)
       - remote_port_max (defaults to QEMU_REMOTE_PORT_MAX and
         must be <= than this value)
      29226bee
    • M
      qemu: Unify port-wise SPICE and VNC behavior · a14b4aea
      Martin Kletzander 提交于
      Port allocations for SPICE and VNC behave almost the same (with
      default ports), but there is some mess in the code. This patch clears
      these inconsistencies and makes sure the same behavior will be used
      when ports for remote displays are changed.
      
      Changes:
       - hard-coded number 5900 removed (handled elsewhere like with VNC)
       - reservedVNCPorts renamed to reservedRemotePorts (it's not just for
         VNC anymore)
       - QEMU_VNC_PORT_{MIN,MAX} renamed to QEMU_REMOTE_PORT_{MIN,MAX}
       - port allocation unified for VNC and SPICE
      a14b4aea
  27. 08 8月, 2012 1 次提交
    • G
      qemu: add two qemu caps for lsi and virtio-scsi SCSI controllers · 015c603b
      Guannan Ren 提交于
      Rename qemuDefaultScsiControllerModel to qemuCheckScsiControllerModel.
      When scsi model is given explicitly in XML(model > 0) checking if the
      underlying QEMU supports it or not first, raise an error on checking
      failure.
      When the model is not given(mode <= 0), return LSI by default, if
      the QEMU doesn't support it, raise an error.
      015c603b
  28. 06 8月, 2012 1 次提交
  29. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  30. 11 7月, 2012 1 次提交
    • V
      qemu: Extended qemuDomainAssignAddresses to be callable from everywhere. · f5dd58a6
      Viktor Mihajlovski 提交于
      This is in preparation of the enablement of s390 guests with virtio devices.
      
      The assignment of device addresses happens in different places, i.e. the
      qemu driver and process modules as well as in the unit tests in slightly
      different flavors. Currently, these are PPC spapr-vio and PCI
      devices, virtio-s390 (not PCI based) will follow.
      
      By optionally passing to qemuDomainAssignAddresses the domain
      object and the capabilities it is now possible to call the function
      from most of the places (except for hotplug) where address assignment
      is done.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      f5dd58a6
  31. 02 3月, 2012 1 次提交
    • E
      build: use correct type for pid and similar types · 3e2c3d8f
      Eric Blake 提交于
      No thanks to 64-bit windows, with 64-bit pid_t, we have to avoid
      constructs like 'int pid'.  Our API in libvirt-qemu cannot be
      changed without breaking ABI; but then again, libvirt-qemu can
      only be used on systems that support UNIX sockets, which rules
      out Windows (even if qemu could be compiled there) - so for all
      points on the call chain that interact with this API decision,
      we require a different variable name to make it clear that we
      audited the use for safety.
      
      Adding a syntax-check rule only solves half the battle; anywhere
      that uses printf on a pid_t still needs to be converted, but that
      will be a separate patch.
      
      * cfg.mk (sc_correct_id_types): New syntax check.
      * src/libvirt-qemu.c (virDomainQemuAttach): Document why we didn't
      use pid_t for pid, and validate for overflow.
      * include/libvirt/libvirt-qemu.h (virDomainQemuAttach): Tweak name
      for syntax check.
      * src/vmware/vmware_conf.c (vmwareExtractPid): Likewise.
      * src/driver.h (virDrvDomainQemuAttach): Likewise.
      * tools/virsh.c (cmdQemuAttach): Likewise.
      * src/remote/qemu_protocol.x (qemu_domain_attach_args): Likewise.
      * src/qemu_protocol-structs (qemu_domain_attach_args): Likewise.
      * src/util/cgroup.c (virCgroupPidCode, virCgroupKillInternal):
      Likewise.
      * src/qemu/qemu_command.c(qemuParseProcFileStrings): Likewise.
      (qemuParseCommandLinePid): Use pid_t for pid.
      * daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
      * src/conf/domain_conf.h (_virDomainObj): Likewise.
      * src/probes.d (rpc_socket_new): Likewise.
      * src/qemu/qemu_command.h (qemuParseCommandLinePid): Likewise.
      * src/qemu/qemu_driver.c (qemudGetProcessInfo, qemuDomainAttach):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessAttach): Likewise.
      * src/qemu/qemu_process.h (qemuProcessAttach): Likewise.
      * src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
      * src/util/virnetdev.h (virNetDevSetNamespace): Likewise.
      * src/util/virnetdev.c (virNetDevSetNamespace): Likewise.
      * tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
      * src/conf/storage_conf.h (_virStoragePerms): Use mode_t, uid_t,
      and gid_t rather than int.
      * src/security/security_dac.c (virSecurityDACSetOwnership): Likewise.
      * src/conf/storage_conf.c (virStorageDefParsePerms): Avoid
      compiler warning.
      3e2c3d8f
  32. 28 2月, 2012 1 次提交
    • O
      qemu: Build command line for the new address format · c56fe7f1
      Osier Yang 提交于
      For any disk controller model which is not "lsilogic", the command
      line will be like:
      
        -drive file=/dev/sda,if=none,id=drive-scsi0-0-3-0,format=raw \
        -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=3,lun=0,i\
        drive=drive-scsi0-0-3-0,id=scsi0-0-3-0
      
      The relationship between the libvirt address attrs and the qdev
      properties are (controller model is not "lsilogic"; strings
      inside <> represent libvirt adress attrs):
        bus=scsi<controller>.0
        channel=<bus>
        scsi-id=<target>
        lun=<unit>
      
      * src/qemu/qemu_command.h: (New param "virDomainDefPtr def"
        for function qemuBuildDriveDevStr; new param "virDomainDefPtr
        vmdef" for function qemuAssignDeviceDiskAlias. Both for
        virDomainDiskFindControllerModel's use).
      
      * src/qemu/qemu_command.c:
        - New param "virDomainDefPtr def" for qemuAssignDeviceDiskAliasCustom.
          For virDomainDiskFindControllerModel's use, if the disk bus is "scsi"
          and the controller model is not "lsilogic", "target" is one part of
          the alias name.
        - According change on qemuAssignDeviceDiskAlias and qemuBuildDriveDevStr
      
      * src/qemu/qemu_hotplug.c:
        - Changes to be consistent with declarations of qemuAssignDeviceDiskAlias
          qemuBuildDriveDevStr, and qemuBuildControllerDevStr.
      
      * tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args,
        tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args: Update the
        generated command line.
      c56fe7f1
  33. 14 1月, 2012 1 次提交
    • M
      tests: Teach qemuxml2argvtest about spapr-vio addresses · 69dde2e6
      Michael Ellerman 提交于
      We can't call qemuCapsExtractVersionInfo() from test code, because it
      expects to be able to call the emulator, and for testing we have fake
      emulators that can't be executed. For that reason qemuxml2argvtest.c
      doesn't call qemuDomainAssignPCIAddresses(), instead it open codes its
      own version.
      
      That means we can't call qemuDomainAssignAddresses() from the test code,
      instead we need to manually call qemuDomainAssignSpaprVioAddresses().
      
      Also add logic to cope with qemuDomainAssignSpaprVioAddresses() failing,
      so that we can write a test that checks for a known failure in there.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      69dde2e6