1. 07 12月, 2012 1 次提交
  2. 05 12月, 2012 6 次提交
    • J
      qemu: Fix memory (and FD) leak on PCI device detach · 69103187
      Jiri Denemark 提交于
      Unmanaged PCI devices were only leaked if pciDeviceListAdd failed but
      managed devices were always leaked. And leaking PCI device is likely to
      leave PCI config file descriptor open. This patch fixes
      qemuReattachPciDevice to either free the PCI device or add it to the
      inactivePciHostdevs list.
      69103187
    • J
      qemu: Don't free PCI device if adding it to activePciHostdevs fails · ea1a9b5f
      Jiri Denemark 提交于
      The device is still referenced from pcidevs and freeing it would leave
      an invalid pointer there.
      ea1a9b5f
    • J
      qemu: Fix error code when attaching existing device · 935550c6
      Jiri Denemark 提交于
      An attempt to attach device that is already attached to a domain results
      in the following error:
      
      virsh # attach-device rhel6 pci2 --persistent
      error: Failed to attach device from pci2
      error: invalid argument: device is already in the domain configuration
      
      The "invalid argument" error code looks wrong, we usually use "operation
      invalid" when the action cannot be done in current state.
      935550c6
    • O
      qemu: Simplify the code · 9ee809d6
      Osier Yang 提交于
      "disk" is initialized to "dev->data.disk" in the beginning of the
      function.
      9ee809d6
    • E
      qemu: improve error for failed JSON commands · 149fa591
      Eric Blake 提交于
      Only one error in qemu_monitor was already using the relatively
      new OPERATION_UNSUPPORTED error, even though it is a better fit
      for all of the messages related to options that are unsupported
      due to the version of qemu in use rather than due to a user's
      XML or .conf file choice.  Suggested by Osier Yang.
      
      * src/qemu/qemu_monitor.c (qemuMonitorSendFileHandle)
      (qemuMonitorAddHostNetwork, qemuMonitorRemoveHostNetwork)
      (qemuMonitorAttachDrive, qemuMonitorDiskSnapshot)
      (qemuMonitorDriveMirror, qemuMonitorTransaction)
      (qemuMonitorBlockCommit, qemuMonitorDrivePivot)
      (qemuMonitorBlockJob, qemuMonitorSystemWakeup)
      (qemuMonitorGetVersion, qemuMonitorGetMachines)
      (qemuMonitorGetCPUDefinitions, qemuMonitorGetCommands)
      (qemuMonitorGetEvents, qemuMonitorGetKVMState)
      (qemuMonitorGetObjectTypes, qemuMonitorGetObjectProps)
      (qemuMonitorGetTargetArch): Use better error category.
      149fa591
    • E
      qemu: nicer error message if live disk snapshot unsupported · 3bef4adf
      Eric Blake 提交于
      Without this patch, attempts to create a disk snapshot when qemu
      is too old results in a cryptic message:
      
      virsh # snapshot-create 23 --disk-only
      error: operation failed: Failed to take snapshot: unknown command: 'snapshot_blkdev'
      
      Now it reports:
      
      virsh # snapshot-create 23 --disk-only
      error: unsupported configuration: live disk snapshot not supported with this QEMU binary
      
      All versions of qemu that support live disk snapshot also support
      QMP (basically upstream qemu 1.1 and later, and backports to RHEL 6.2).
      
      * src/qemu/qemu_capabilities.h (QEMU_CAPS_DISK_SNAPSHOT): New
      capability.
      * src/qemu/qemu_capabilities.c (qemuCaps): Track it.
      (qemuCapsProbeQMPCommands): Set it.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateDiskActive): Use
      it.
      * src/qemu/qemu_monitor.c (qemuMonitorDiskSnapshot): Simplify.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDiskSnapshot):
      Likewise.
      * src/qemu/qemu_monitor_text.h (qemuMonitorTextDiskSnapshot):
      Delete.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextDiskSnapshot):
      Likewise.
      3bef4adf
  3. 04 12月, 2012 3 次提交
    • D
      Replace polling for active VMs with signalling by drivers · 79b8a569
      Daniel P. Berrange 提交于
      Currently to deal with auto-shutdown libvirtd must periodically
      poll all stateful drivers. Thus sucks because it requires
      acquiring both the driver lock and locks on every single virtual
      machine. Instead pass in a "inhibit" callback to virStateInitialize
      which drivers can invoke whenever they want to inhibit shutdown
      due to existance of active VMs.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      79b8a569
    • D
      Make QEMU perform managed save of all VMs on stop of libvirtd · 8f9a6931
      Daniel P. Berrange 提交于
      When the virStateStop() method is invoked, perform a managed
      save of all VMs currently running
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      8f9a6931
    • L
      qemu: support live update of an interface's filter · 258fb278
      Laine Stump 提交于
      Since we can't (currently) rely on the ability to provide blanket
      support for all possible network changes by calling the toplevel
      netdev hostside disconnect/connect functions (due to qemu only
      supporting a lockstep between initialization of host side and guest
      side of devices), in order to support live change of an interface's
      nwfilter we need to make a special purpose function to only call the
      nwfilter teardown and setup functions if the filter for an interface
      (or its parameters) changes. The pattern is nearly identical to that
      used to change the bridge that an interface is connected to.
      
      This patch was inspired by a request from Guido Winkelmann
      <guido@sagersystems.de>, who tested an earlier version.
      258fb278
  4. 01 12月, 2012 4 次提交
    • D
      Move reboot/shutdown flags combination check into QEMU driver · dff4a753
      Daniel P. Berrange 提交于
      The fact that only the guest agent, or ACPI flag can be used
      when requesting reboot/shutdown is merely a limitation of the
      QEMU driver impl at this time. Thus it should not be in
      libvirt.c code
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      dff4a753
    • V
      qemu: Fix up the default machine type for QMP probing · 3c465728
      Viktor Mihajlovski 提交于
      The default machine type must be stored in the first element of
      the caps->machineTypes array. This was done for help output
      parsing but not for QMP probing.
      
      Added a helper function qemuSetDefaultMachine to apply the same
      fix up for both probing methods.
      
      Further, it was necessary to set caps->nmachineTypes after QMP
      probing.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      3c465728
    • G
    • E
      qemu: don't attempt undefined QMP commands · 3d7f6649
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=872292
      
      Libvirt should not attempt to call a QMP command that has not been
      documented in qemu.git - if future qemu introduces a command by the
      same name but with subtly different semantics, then libvirt will be
      broken when trying to use that command.
      
      We also had some code that could never be reached - some of our
      commands have an alternate for new vs. old qemu HMP commands; but
      if we are new enough to support QMP, we only need a fallback to
      the new HMP counterpart, and don't need to try for a QMP counterpart
      for the old HMP version.
      
      See also this attempt to convert the three snapshot commands to QMP:
      https://lists.gnu.org/archive/html/qemu-devel/2012-07/msg01597.html
      although it looks like that will still not happen before qemu 1.3.
      That thread eventually decided that qemu would use the name
      'save-vm' rather than 'savevm', which mitigates the fact that
      libvirt's attempt to use a QMP 'savevm' would be broken, but we
      might not be as lucky on the other commands.
      
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONSetCPU)
      (qemuMonitorJSONAddDrive, qemuMonitorJSONDriveDel)
      (qemuMonitorJSONCreateSnapshot, qemuMonitorJSONLoadSnapshot)
      (qemuMonitorJSONDeleteSnapshot): Use only HMP fallback for now.
      (qemuMonitorJSONAddHostNetwork, qemuMonitorJSONRemoveHostNetwork)
      (qemuMonitorJSONAttachDrive, qemuMonitorJSONGetGuestDriveAddress):
      Delete; QMP implies QEMU_CAPS_DEVICE, which prefers AddNetdev,
      RemoveNetdev, and AddDrive anyways (qemu_hotplug.c has all callers).
      * src/qemu/qemu_monitor.c (qemuMonitorAddHostNetwork)
      (qemuMonitorRemoveHostNetwork, qemuMonitorAttachDrive): Reflect
      deleted commands.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONAddHostNetwork)
      (qemuMonitorJSONRemoveHostNetwork, qemuMonitorJSONAttachDrive):
      Likewise.
      3d7f6649
  5. 30 11月, 2012 4 次提交
  6. 29 11月, 2012 6 次提交
  7. 28 11月, 2012 8 次提交
  8. 27 11月, 2012 4 次提交
    • E
      storage: fix device detach regression with cgroup ACLs · 1b2ebf95
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=876828
      
      Commit 38c4a9cc introduced a regression in hot unplugging of disks
      from qemu, where cgroup device ACLs were no longer being revoked
      (thankfully not a security hole: cgroup ACLs only prevent open()
      of the disk; so reverting the ACL prevents future abuse but doesn't
      stop abuse from an fd that was already opened before the ACL change).
      
      The actual regression is due to a latent bug.  The hot unplug code
      was computing the set of files needing cgroup ACL revocation based
      on the XML passed in by the user, rather than based on the domain's
      details on which disk was being deleted.  As long as the revoke
      path was always recomputing the backing chain, this didn't really
      matter; but now that we want to compute the chain exactly once and
      remember that computation, we need to hang on to the backing chain
      until after the revoke has happened.
      
      * src/qemu/qemu_hotplug.c (qemuDomainDetachPciDiskDevice):
      Transfer backing chain before deletion.
      1b2ebf95
    • H
      qemu: Add support for gluster protocol based network storage backend. · c33c36d2
      Harsh Prateek Bora 提交于
      Qemu accepts gluster protocol as supported storage backend beside others.
      Signed-off-by: NHarsh Prateek Bora <harsh@linux.vnet.ibm.com>
      c33c36d2
    • H
      Add Gluster protocol as supported network disk backend · a2d2b80f
      Harsh Prateek Bora 提交于
      This patch introduces the RNG schema and updates necessary data strucutures
      to allow various hypervisors to make use of Gluster protocol as one of the
      supported network disk backend. Next patch will add support to make use of
      this feature in Qemu since it now supports Gluster protocol as one of the
      network based storage backend.
      
      Two new optional attributes for <host> element are introduced - 'transport'
      and 'socket'. Valid transport values are tcp, unix or rdma. If none specified,
      tcp is assumed. If transport is unix, socket specifies path to unix socket.
      
      This patch allows users to specify disks on gluster backends like this:
      
          <disk type='network' device='disk'>
            <driver name='qemu' type='raw'/>
            <source protocol='gluster' name='Volume1/image'>
              <host name='example.org' port='6000' transport='tcp'/>
            </source>
            <target dev='vda' bus='virtio'/>
          </disk>
      
          <disk type='network' device='disk'>
            <driver name='qemu' type='raw'/>
            <source protocol='gluster' name='Volume2/image'>
              <host transport='unix' socket='/path/to/sock'/>
            </source>
            <target dev='vdb' bus='virtio'/>
          </disk>
      Signed-off-by: NHarsh Prateek Bora <harsh@linux.vnet.ibm.com>
      a2d2b80f
    • E
      build: avoid C99 for loop · 7e5aa78d
      Eric Blake 提交于
      Although we require various C99 features, we don't yet require a
      complete C99 compiler.  On RHEL 5, compilation complained:
      
      qemu/qemu_command.c: In function 'qemuBuildGraphicsCommandLine':
      qemu/qemu_command.c:4688: error: 'for' loop initial declaration used outside C99 mode
      
      * src/qemu/qemu_command.c (qemuBuildGraphicsCommandLine): Declare
      variable sooner.
      * src/qemu/qemu_process.c (qemuProcessInitPasswords): Likewise.
      7e5aa78d
  9. 22 11月, 2012 2 次提交
    • M
      conf: Report sensible error for invalid disk name · 03cd6e4a
      Martin Kletzander 提交于
      The error "... but the cause is unknown" appeared for XMLs similar to
      this:
      
       <disk type='file' device='cdrom'>
         <driver name='qemu' type='raw'/>
         <source file='/dev/zero'/>
         <target dev='sr0'/>
       </disk>
      
      Notice unsupported disk type (for the driver), but also no address
      specified. The first part is not a problem and we should not abort
      immediately because of that, but the combination with the address
      unknown was causing an unspecified error.
      
      While fixing this, I added an error to one place where this return
      value was not managed properly.
      03cd6e4a
    • S
      qemu: fix RBD attach regression · f0e72b2f
      Scott Sullivan 提交于
      I have been testing libvirt v1.0.0 for deployment within my
      organization, and in the process discovered what appears to be a bug
      that breaks virsh attach-device, when attaching an RBD volume to an
      instance. First, here is the error presented, with v1.0.0 (this worked
      in v0.10.2):
      
      [root@host ~]# virsh attach-device W5APQ8  G84VV1.xml
      error: Failed to attach device from G84VV1.xml
      error: cannot open file 'dc3-1-test/G84VV1': No such file or directory
      
      Using git bisect, I narrowed the problem down to this as the first
      commit to break this setup:
      
      4d34c929 is the first bad commit
      f0e72b2f
  10. 21 11月, 2012 2 次提交