1. 19 5月, 2015 1 次提交
  2. 18 5月, 2015 2 次提交
    • L
      conf: make virNodeDevCapData an official type · ffc40b63
      Laine Stump 提交于
      For some reason a union (_virNodeDevCapData) that had only been
      declared inside the toplevel struct virNodeDevCapsDef was being used
      as an argument to functions all over the place. Since it was only a
      union, the "type" attribute wasn't necessarily sent with it. While
      this works, it just seems wrong.
      
      This patch creates a toplevel typedef for virNodeDevCapData and
      virNodeDevCapDataPtr, making it a struct that has the type attribute
      as a member, along with an anonymous union of everything that used to
      be in union _virNodeDevCapData. This way we only have to change the
      following:
      
        s/union _virNodeDevCapData */virNodeDevCapDataPtr /
      
      and
      
        s/caps->type/caps->data.type/
      
      This will make me feel less guilty when adding functions that need a
      pointer to one of these.
      ffc40b63
    • T
      libvirt: qemu: enable/disable protected key management ops · 740c83f5
      Tony Krowiak 提交于
      Introduces two new -machine option parameters to the QEMU command to
      enable/disable the CPACF protected key management operations for a guest:
      
          aes-key-wrap='on|off'
          dea-key-wrap='on|off'
      
      The QEMU code maps the corresponding domain configuration elements to the
      QEMU -machine option parameters to create the QEMU command:
      
          <cipher name='aes' state='on'>   --> aes-key-wrap=on
          <cipher name='aes' state='off'>  --> aes-key-wrap=off
          <cipher name='dea' state='on'>   --> dea-key-wrap=on
          <cipher name='dea' state='off'>  --> dea-key-wrap=off
      Signed-off-by: NTony Krowiak <akrowiak@linux.vnet.ibm.com>
      Signed-off-by: NDaniel Hansel <daniel.hansel@linux.vnet.ibm.com>
      Signed-off-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      Reviewed-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      740c83f5
  3. 16 5月, 2015 4 次提交
    • L
      qemu: log error when domain has an unsupported IDE controller · eadd757c
      Laine Stump 提交于
      We have previously effectively ignored all <controller type='ide'>
      elements in a domain definition.
      
      On the i440fx-based machinetypes there is an IDE controller that is
      included in the chipset and can't be removed (which is the ide
      controller with index='0'>), so it makes sense to ignore that one
      controller. However, if an i440fx domain definition has a 2nd
      controller, nothing catches this error (unless you also have a disk
      attached to it, in which case qemu will complain that you're trying to
      use the ide controller named "ide1", which doesn't exist), and if any
      other type of domain has even a single controller defined, it will be
      incorrectly ignored.
      
      Ignoring a bogus controller definition isn't such a big problem, as
      long as an error is logged when any disk is attached to that
      non-existent controller. But in the case of q35-based machinetypes,
      the hardcoded id ("alias" in libvirt terms) of its builtin SATA
      controller is "ide", which happens to be the same id as the builtin
      IDE controller on i440fx machinetypes. So libvirt creates a
      commandline believing that it is connecting the disk to the builtin
      (but actually nonexistent) IDE controller, qemu thinks that libvirt
      wanted that disk connected to the builtin SATA controller, and
      everybody is happy.
      
      Until you try to connect a 2nd disk to the IDE controller. Then qemu
      will complain that you're trying to set unit=1 on a controller that
      requires unit=0 (SATA controllers are organized differently than IDE
      controllers).
      
      After this patch, if a domain has an IDE controller defined for a
      machinetype that has no IDE controllers, libvirt will log an error
      about the controller itself as it is building the qemu commandline
      (rather than a (possible) error from qemu about disks attached to that
      controller). This is done by adding IDE to the list of controller
      types that are handled in the loop that creates controller command
      strings in qemuBuildCommandline() (previously it would *always* skip
      IDE controllers). Then qemuBuildControllerDevStr() is modified to log
      an appropriate error in the case of IDE controllers.
      
      In the future, if we add support for extra IDE controllers (piix3-ide
      and/or piix4-ide) we can just add it into the IDE case in
      qemuBuildControllerDevStr(). For now, nobody seems anxious to add
      extra support for an aging and very slow controller, when there are so
      many better options available.
      
      Resolves:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1176071 (Fedora)
      eadd757c
    • L
      qemu: clean up qemuBuildCommandline loop that builds controller args · b8f345b4
      Laine Stump 提交于
      Reorganize the loop that builds controller args to remove unnecessary
      duplicated code and superfluous else clauses. No functional change.
      b8f345b4
    • L
      qemu: use controller alias when constructing device/controller args · 0260506c
      Laine Stump 提交于
      This makes sure that that the commandlines generated for devices and
      controller devices are all using the alias that has been set in the
      controller's object as the id of the controller, rather than
      hardcoding a printf (or worse, encoding exceptions to the standard
      ${controller}${index} into the logic)
      
      Since this "fixes" the controller name used for the sata controller,
      the commandline arg for the sata controller in the sata test case had
      to be adjusted to be "sata0" instead of "ahci0". All other tests
      remain unchanged, verifying that the patch causes no other functional
      change.
      
      Because the function that finds a controller alias based on a device
      def requires a pointer to the full domainDef in order to get the list
      of controllers, the arglist of a few functions had to have this added.
      0260506c
    • L
      qemu: fix exceptions in qemuAssignDeviceControllerAlias · 75cd7d9b
      Laine Stump 提交于
      There are a few extra exceptions that weren't being accounted for when
      creating the alias for a controller. This resulted in 1) incorrect
      status XML, and 2) exceptions/printfs of what *should* have been
      directly available in the controller alias when constructing device
      commandline arguments:
      
      1) The primary (and only) IDE controller on a 440FX machinetype is
      hardcoded to be "ide" in qemu.
      
      2) The primary SATA controller on a 440FX machinetype is also
      hardcoded to be "ide" in qemu.
      
      3) On machinetypes that don't support multiple PCI buses, the PCI bus
      is hardcoded in qemu to have the name "pci".
      
      4) The first usb master controller is "usb", all others are the normal
      "usb%d". (note that usb controllers that are not a "master" will have
      the same index, and thus alias, as the master).
      
      We needed to pass in the full domainDef and qemuCaps in order to
      properly make the decisions about these exceptions.
      75cd7d9b
  4. 15 5月, 2015 5 次提交
  5. 14 5月, 2015 1 次提交
  6. 13 5月, 2015 3 次提交
  7. 12 5月, 2015 3 次提交
    • L
      qemu: fix double free when RNG cold-plug fails · 5f6fe84d
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1220809
      
      When cold-plugging an RNG device but something fails in
      qemuDomainAssignAddresses, we will double free the RNG device.
      Once a device is plugged into the domain, we should set the
      device pointer to NULL to fix this issue.
      
      ...
      5  0x00007fb7d180ac8a in virFree at util/viralloc.c:582
      6  0x00007fb7d1895cdd in virDomainRNGDefFree at conf/domain_conf.c:19786
      7  0x00007fb7d1895d99 in virDomainDeviceDefFree at conf/domain_conf.c:2022
      8  0x00007fb7b92b8baf in qemuDomainAttachDeviceFlags at qemu/qemu_driver.c:8785
      9  0x00007fb7d190c5d7 in virDomainAttachDeviceFlags at libvirt-domain.c:8488
      10 0x00007fb7d23af9d2 in remoteDispatchDomainAttachDeviceFlags at remote_dispatch.h:2842
      ...
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      5f6fe84d
    • L
      qemu: eliminate duplicated code in qemuBuildDriveDevStr() · e27c5c8f
      Laine Stump 提交于
      The code to add device type to the commandline was identical for lsi
      and other models of SCSI controllers, but was duplicated (with the
      exception of a minor ordering difference of the if-else clauses) for
      the two cases. This patch replaces those two with a single instance of
      the code just before the if().
      e27c5c8f
    • L
      qemu: use qemuDomainMachineIsI440FX() in appropriate place · da558e72
      Laine Stump 提交于
      This patch makes qemuValideDevicePCISlotsChipsets() more consistent in
      appearance by replacing several clauses of an if with the equivalent
      call to qemuDomainMachineIsI440FX. The if was checking exactly the
      same items, just in a slightly different order.
      da558e72
  8. 11 5月, 2015 3 次提交
  9. 07 5月, 2015 2 次提交
    • M
      processSerialChangedEvent: Close agent monitor early · 2af51483
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=890648
      
      So, imagine you've issued an API that involves guest agent. For
      instance, you want to query guest's IP addresses. So the API acquires
      QUERY_JOB, locks the guest agent and issues the agent command.
      However, for some reason, guest agent replies to initial ping
      correctly, but then crashes tragically while executing real command
      (in this case guest-network-get-interfaces). Since initial ping went
      well, libvirt thinks guest agent is accessible and awaits reply to the
      real command. But it will never come. What will is a monitor event.
      Our handler (processSerialChangedEvent) will try to acquire
      MODIFY_JOB, which will fail obviously because the other thread that's
      executing the API already holds a job. So the event handler exits
      early, and the QUERY_JOB is never released nor ended.
      
      The way how to solve this is to put flag somewhere in the monitor
      internals. The flag is called @running and agent commands are issued
      iff the flag is set. The flag itself is set when we connect to the
      agent socket. And unset whenever we see DISCONNECT event from the
      agent. Moreover, we must wake up all the threads waiting for the
      agent. This is done by signalizing the condition they're waiting on.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      2af51483
    • M
      qemuDomainShutdownFlags: check for domain activeness prior to guest presence · 21e8fc36
      Michal Privoznik 提交于
      Running shutdown with mode agent on a shutoff domain gives cryptic
      error message:
      
          virsh # shutdown --mode agent gentoo
          error: Failed to shutdown domain gentoo
          error: Guest agent is not responding: QEMU guest agent is not connected
      
      After this patch, the error is more clear:
      
          virsh # shutdown --mode agent gentoo
          error: Failed to shutdown domain gentoo
          error: Requested operation is not valid: domain is not running
      Reported-by: NMartin Kletzander <mkletzan@redhat.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      21e8fc36
  10. 06 5月, 2015 6 次提交
  11. 05 5月, 2015 2 次提交
  12. 04 5月, 2015 8 次提交