1. 30 4月, 2010 2 次提交
    • D
      Implement virDomainGetBlockInfo in QEMU driver · db57a7be
      Daniel P. Berrange 提交于
      * src/qemu/qemu_driver.c: Implementation of virDomainGetBlockInfo
      * src/util/storage_file.h: Add DEV_BSIZE
      * src/storage/storage_backend.c: Remove DEV_BSIZE
      db57a7be
    • D
      Internal driver API infrastructure for virDomainGetBlockInfo · 46bad512
      Daniel P. Berrange 提交于
      This defines the internal driver API and stubs out each driver
      
      * src/driver.h: Define virDrvDomainGetBlockInfo signature
      * src/libvirt.c, src/libvirt_public.syms: Glue public API to drivers
      * src/esx/esx_driver.c, src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
        src/openvz/openvz_driver.c, src/phyp/phyp_driver.c,
        src/test/test_driver.c, src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
        src/xen/xen_driver.c, src/xenapi/xenapi_driver.c: Stub out driver
      46bad512
  2. 29 4月, 2010 4 次提交
  3. 28 4月, 2010 5 次提交
    • D
      Fix handling of security driver restore failures in QEMU domain save · 51cd0196
      Daniel P. Berrange 提交于
      In cases where the security driver failed to restore a label after a
      guest has saved, we mistakenly jumped to the error cleanup paths.
      This is not good, because the operation has in fact completed and
      cannot be rolled back completely. Label restore is non-critical, so
      just log the problem instead. Also add a missing restore call in
      the error cleanup path
      
      * src/qemu/qemu_driver.c: Fix handling of security driver
        restore failures in QEMU domain save
      51cd0196
    • D
      Fix QEMU domain save to block devices with cgroups enabled · 712048bd
      Daniel P. Berrange 提交于
      When cgroups is enabled, access to block devices is likely to be
      restricted to a whitelist. Prior to saving a guest to a block device,
      it is necessary to add the block device to the whitelist. This is
      not required upon restore, since QEMU reads from stdin
      
      * src/qemu/qemu_driver.c: Add block device to cgroups whitelist
        if neccessary during domain save.
      712048bd
    • D
      Fix QEMU save/restore with block devices · 93e0b3c8
      Daniel P. Berrange 提交于
      The save process was relying on use of the shell >> append
      operator to ensure the save data was placed after the libvirt
      header + XML. This doesn't work for block devices though.
      Replace this code with use of 'dd' and its 'seek' parameter.
      This means that we need to pad the header + XML out to a
      multiple of dd block size (in this case we choose 512).
      
      The qemuMonitorMigateToCommand() monitor API is used for both
      save/coredump, and migration via UNIX socket. We can't simply
      switch this to use 'dd' since this causes problems with the
      migration usage. Thus, create a dedicated qemuMonitorMigateToFile
      which can accept an filename + offset, and remove the filename
      from the current qemuMonitorMigateToCommand() API
      
      * src/qemu/qemu_driver.c: Switch to qemuMonitorMigateToFile
        for save and core dump
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Create
        a new qemuMonitorMigateToFile, separate from the existing
        qemuMonitorMigateToCommand to allow handling file offsets
      93e0b3c8
    • D
      Avoid create/unlink with block devs used for QEMU save · ae42979a
      Daniel P. Berrange 提交于
      It is possible to use block devices with domain save/restore. Upon
      failure QEMU unlinks the path being saved to. This isn't good when
      it is a block device !
      
      * src/qemu/qemu_driver.c: Don't unlink block devices if save fails
      ae42979a
    • D
      Fix crash when cleaning up from failed save attempt · d7e0fe6e
      Daniel P. Berrange 提交于
      If a transient QEMU crashes during save attempt, then the virDomainPtr
      object may be freed. If a persistent QEMU crashes during save, then
      the 'priv->mon' field is no longer valid since it will be inactive.
      
      * src/qemu/qemu_driver.c: Fix two crashes when QEMU exits
        during a save attempt
      d7e0fe6e
  4. 27 4月, 2010 2 次提交
    • C
      Fix up the locking in the snapshot code. · b69bbebb
      Chris Lalancette 提交于
      In particular I was forgetting to take the qemuMonitorPrivatePtr
      lock (via qemuDomainObjBeginJob), which would cause problems
      if two users tried to access the same domain at the same time.
      This patch also fixes a problem where I was forgetting to remove
      a transient domain from the list of domains.
      
      Thanks to Stephen Shaw for pointing out the problem and testing
      out the initial patch.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      b69bbebb
    • J
      Ignore qemu STOP event when stopping CPUs · 35b61376
      Jiri Denemark 提交于
      With JSON qemu monitor, we get a STOP event from qemu whenever qemu
      stops guests CPUs. The downside of it is that vm->state is changed to
      PAUSED and a new generic paused event is send to applications. However,
      when we ask qemu to stop the CPUs we are not really interested in qemu
      event and we usually want to issue a more specific event.
      
      By setting vm->status to PAUSED before actually sending the request to
      qemu (and resetting it back if the request fails) we can ignore the
      event since the event handler does nothing when the guest is already
      paused. This solution is quite hacky but unfortunately it's the best
      solution which I was able to come up with and it doesn't introduce a
      race condition.
      35b61376
  5. 24 4月, 2010 1 次提交
  6. 23 4月, 2010 2 次提交
    • J
      Fix locking in qemudDomainCoreDump · 96ac1859
      Jiri Denemark 提交于
      The hang fix in d376b7d6 was incomplete
      since it left quite a few {Enter,Exit}Monitor calls which require driver
      to be unlocked. Since the driver is locked throughout the whole
      function, {Enter,Exit}MonitorWithDriver need to be used instead to
      ensure driver is not locked when issuing monitor commands.
      96ac1859
    • J
      Poll for migration end every 50ms instead of 50us · e2c05948
      Jiri Denemark 提交于
      The comment in qemuDomainWaitForMigrationComplete says we are polling
      every 50ms but the code sleeps only for 50us. This was already discussed
      during review but apparently forgotten when the series was pushed.
      e2c05948
  7. 22 4月, 2010 1 次提交
    • J
      Fix initial VCPU pinning in qemu driver · 9fbb810c
      Jiri Denemark 提交于
      First, inital VCPU pinning is set correctly but then it is reset by
      assigning qemu process to a new cgroup (which contains all CPUs). It's
      easily fixed by swapping these two actions.
      9fbb810c
  8. 19 4月, 2010 1 次提交
    • D
      Fix network hotplug to use device_add in QEMU · f3e098f3
      Daniel P. Berrange 提交于
      The initial boot of VMs uses -device for NICs where available. The
      corresponding monitor command is device_add, but the network hotplug
      code was still using device_del by mistake.
      
      * src/qemu/qemu_driver.c: Use device_add for NIC hotplug where
        available
      f3e098f3
  9. 16 4月, 2010 3 次提交
    • J
      Use virCheckFlags for APIs added in 0.8.0 · 7a2c6222
      Jiri Denemark 提交于
      7a2c6222
    • D
      Fix CDROM media change for QEMU when using -device syntax · c4896d37
      Daniel P. Berrange 提交于
      Disk devices in QEMU have two parts, the guest device and the host
      backend driver. Historically these two parts have had the same
      "unique" name. With the switch to using -device though, they now
      have separate names. Thus when changing CDROM media, for guests
      using -device syntax, we need to prepend the QEMU_DRIVE_HOST_PREFIX
      constant
      
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add helper function
        qemuDeviceDriveHostAlias() for building a host backend alias
      * src/qemu/qemu_driver.c: Use qemuDeviceDriveHostAlias() to determine
        the host backend alias for performing eject/change commands in the
        monitor
      c4896d37
    • D
      Fix QEMU memory stats JSON mode · 4f81919a
      Daniel P. Berrange 提交于
      The QEMU driver is mistakenly calling directly into the text
      mode monitor for the domain memory stats query.
      
      * src/qemu/qemu_driver.c: Replace qemuMonitorTextGetMemoryStats with
        qemuMonitorGetMemoryStats
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add the new
        wrapper for qemuMonitorGetMemoryStats
      * src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h: Add
        qemuMonitorJSONGetMemoryStats implementation
      4f81919a
  10. 15 4月, 2010 2 次提交
    • S
      nwfilter: fix tear down order and consolidate functions · 41b08719
      Stefan Berger 提交于
      To avoid race-conditions, the tear down of a filter has to happen before
      the tap interface disappears and another tap interface with the same
      name can re-appear. This patch tries to fix this. In one place, where
      communication with the qemu monitor may fail, I am only tearing the
      filters down after knowing that the function did not fail.
      
      I am also moving the tear down functions into an include file for other
      drivers to reuse.
      41b08719
    • J
      qemudDomainAttachSCSIDisk: avoid FP NULL-ptr-deref from clang · a0dc4521
      Jim Meyering 提交于
      * src/qemu/qemu_driver.c (qemudDomainAttachSCSIDisk):
      Initialize "cont" to NULL, so clang knows it's set.
      Add an sa_assert so it knows it's non-NULL when dereferenced.
      a0dc4521
  11. 08 4月, 2010 2 次提交
  12. 07 4月, 2010 1 次提交
  13. 06 4月, 2010 2 次提交
  14. 05 4月, 2010 2 次提交
  15. 04 4月, 2010 2 次提交
    • D
      Implement managed save operations for qemu driver · 6e41f30e
      Daniel Veillard 提交于
      The images are saved in /var/lib/libvirt/qemu/save/
      and named $domainname.save . The directory is created appropriately
      at daemon startup. When a domain is started while a saved image is
      available, libvirt will try to load this saved image, and start the
      domain as usual in case of failure. In any case the saved image is
      discarded once the domain is created.
      
      * src/qemu/qemu_conf.h: adds an extra save path to the driver config
      * src/qemu/qemu_driver.c: implement the 3 new operations and handling
        of the image directory
      6e41f30e
    • D
      Add managed save API entry points · 15c647a9
      Daniel Veillard 提交于
      virDomainManagedSave() is to be run on a running domain. Once the call
      complete, as in virDomainSave() the domain is stopped upon completion,
      but there is no restore counterpart as any order to start the domain
      from the API would load the state from the managed file, similary if
      the domain is autostarted when libvirtd starts.
      Once a domain has restarted his managed save image is destroyed,
      basically managed save image can only exist for a stopped domain,
      for a running domain that would be by definition outdated data.
      
      * include/libvirt/libvirt.h.in src/libvirt.c src/libvirt_public.syms:
        adds the new entry points virDomainManagedSave(),
        virDomainHasManagedSaveImage() and virDomainManagedSaveRemove()
      * src/driver.h src/esx/esx_driver.c src/lxc/lxc_driver.c
        src/opennebula/one_driver.c  src/openvz/openvz_driver.c
        src/phyp/phyp_driver.c src/qemu/qemu_driver.c src/vbox/vbox_tmpl.c
        src/remote/remote_driver.c src/test/test_driver.c src/uml/uml_driver.c
        src/xen/xen_driver.c: add corresponding new internal drivers entry
        points
      15c647a9
  16. 02 4月, 2010 1 次提交
    • C
      Don't use virFileReadLimFD in qemuDomainRestore. · d62f4c36
      Chris Lalancette 提交于
      virFileReadLimFD is a poor fit for reading the header
      of the restore file.  The problem is that virFileReadLimFD
      returns an error when there is more data after the amount
      you ask to read, but that is *expected* in this case.
      
      This patch is essentially a revert of
      1a4d5c95, but I don't think
      that commit does what it says anyway.  It purports to prevent
      an unwarranted OOM error, but since virFileReadLimFD will
      allocate memory up to the maximum anyway, the upper limit
      on the total amount of memory allocated is the same for either
      the old version or the new version.  Since the old saferead
      actually works and virFileReadLimFD does not, revert to
      using saferead.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      d62f4c36
  17. 01 4月, 2010 1 次提交
    • D
      Keep track of guest paused state after disk IO / watchdog events · cd2404a3
      Daniel P. Berrange 提交于
      When a watchdog/IO error occurs, one of the possible actions that
      QEMU might take is to pause the guest. In this scenario libvirt
      needs to update its internal state for the VM, and emit a
      lifecycle event:
      
        VIR_DOMAIN_EVENT_SUSPENDED
      
      with a detail being one of:
      
        VIR_DOMAIN_EVENT_SUSPENDED_IOERROR
        VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG
      
      To future proof against possible QEMU support for multiple monitor
      consoles, this patch also hooks into the 'STOPPED' event in QEMU
      and emits a generic VIR_DOMAIN_EVENT_SUSPENDED_PAUSED event
      
      * include/libvirt/libvirt.h.in: Add VIR_DOMAIN_EVENT_SUSPENDED_IOERROR
      * src/qemu/qemu_driver.c: Update VM state to paused when IO error
        or watchdog events occurrs
      * src/qemu/qemu_monitor_json.c: Fix typo in disk IO event name
      cd2404a3
  18. 30 3月, 2010 2 次提交
    • D
      Fix QEMU cpu affinity at startup to include all threads · 99123ba0
      Daniel P. Berrange 提交于
      The QEMU cpu affinity is used in NUMA scenarios to ensure that
      guest memory is allocated from a specific node. Normally memory
      is allocate on demand in vCPU threads, but when using hugepages
      the initial thread leader allocates memory upfront. libvirt was
      not setting affinity of the thread leader, or I/O threads. This
      patch changes the code to set the process affinity in between
      the fork()/exec() of QEMU. This ensures that every single QEMU
      thread gets the affinity
      
      * src/qemu/qemu_driver.c: Set affinity on entire QEMU process
        at startup
      99123ba0
    • D
      Add script hook support to the QEmu driver · 668150fc
      Daniel Veillard 提交于
      Right now this implements only 2 basic hooks:
      - before the qemu process is being launched
      - after the qemu process is terminated
      the XML description of the domain is passed to the hook script stdin
      /etc/libvirt/hook/qemu
      
      * src/qemu/qemu_driver.c: implement synchronous script hooks for QEmu
        at domain startup and end
      668150fc
  19. 27 3月, 2010 3 次提交
    • J
      Introduce UPDATE_CPU flag for virDomainGetXMLDesc · e455b221
      Jiri Denemark 提交于
      This flag is used in migration prepare step to send updated XML
      definition of a guest.
      
      Also ``virsh dumpxml --update-cpu [--inactive] guest'' command can be
      used to see the updated CPU requirements.
      e455b221
    • J
      Don't replace persistent domain config with migrated config · 59821682
      Jiri Denemark 提交于
      When a domain is defined on host1, migrated to host2 and then migrated
      back to host1, its current configuration would overwrite the libvirtd's
      in-memory copy of persistent configuration of that domain. This is not
      desired as we want to preserve the persistent configuration untouched.
      
      This patch introduces new 'live' parameter to virDomainAssignDef.
      Passing 'true' for 'live' means the configuration passed to
      virDomainAssignDef describes a configuration of live instance of the
      domain. This applies for saved domains which are being restored or for
      incoming domains during migration.
      
      All callers have been changed to pass the appropriate value.
      59821682
    • S
      Add qemu support · d498175a
      Stefan Berger 提交于
      Add support for Qemu to have firewall rules applied and removed on VM
      startup and shutdown respectively. This  patch also provides support for
      the updating of a filter that causes all VMs that reference the filter
      to have their ebtables/iptables rules updated.
      Signed-off-by: NStefan Berger <stefanb@us.ibm.com>
      d498175a
  20. 26 3月, 2010 1 次提交
    • D
      Implement VNC password change in QEMU · ab952024
      Daniel P. Berrange 提交于
      Use the new virDomainUpdateDeviceFlags API to allow the VNC password
      to be changed on the fly
      
      * src/internal.h: Define STREQ_NULLABLE() which is like STREQ()
        but does not crash if either argument is NULL, and treats two
        NULLs as equal.
      * src/libvirt_private.syms: Export virDomainGraphicsTypeToString
      * src/qemu/qemu_driver.c: Support VNC password change on a live
        machine
      * src/qemu/qemu_monitor.c: Disable crazy debugging info. Treat a
        NULL password as "" (empty string), allowing passwords to be
        disabled in the monitor
      ab952024