1. 26 8月, 2013 1 次提交
  2. 21 8月, 2013 1 次提交
    • E
      migration: do not restore labels on failed migration · e4ddcf09
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=822052
      
      When doing a live migration, if the destination fails for any
      reason after the point in which files should be labeled, then
      the cleanup of the destination would restore the labels to their
      defaults, even though the source is still trying to continue
      running with the image open.  Bug 822052 mentioned one source
      of live migration failure - a mismatch in SELinux virt_use_nfs
      settings (on for source, off for destination); but I found other
      situations that would also trigger it (for example, having a
      graphics device tied to port 5999 on the source, and a different
      domain on the destination already using that port, so that the
      destination cannot reuse the port).
      
      In short, just as cleanup of the source on a successful migration
      must not relabel files (because the destination would be crippled
      by the relabel), cleanup of the destination on a failed migration
      must not relabel files (because the source would be crippled).
      
      * src/qemu/qemu_process.c (qemuProcessStart): Set flag to avoid
      label restoration when cleaning up on failed migration.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e4ddcf09
  3. 15 8月, 2013 1 次提交
  4. 01 8月, 2013 1 次提交
  5. 30 7月, 2013 1 次提交
  6. 24 7月, 2013 2 次提交
    • D
      Create + setup cgroups atomically for QEMU process · 2049ef99
      Daniel P. Berrange 提交于
      Currently the QEMU driver creates the VM's cgroup prior to
      forking, and then uses a virCommand hook to move the child
      into the cgroup. This won't work with systemd whose APIs
      do the creation of cgroups + attachment of processes atomically.
      
      Fortunately we have a handshake taking place between the
      QEMU driver and the child process prior to QEMU being exec()d,
      which was introduced to allow setup of disk locking. By good
      fortune this synchronization point can be used to enable the
      QEMU driver to do atomic setup of cgroups removing the use
      of the hook script.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2049ef99
    • D
      Auto-detect existing cgroup placement · 87b2e6fa
      Daniel P. Berrange 提交于
      Use the new virCgroupNewDetect function to determine cgroup
      placement of existing running VMs. This will allow the legacy
      cgroups creation APIs to be removed entirely
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      87b2e6fa
  7. 23 7月, 2013 1 次提交
  8. 20 7月, 2013 1 次提交
  9. 19 7月, 2013 2 次提交
    • J
      d327ac53
    • E
      security: framework for driver PreFork handler · fdb3bde3
      Eric Blake 提交于
      A future patch wants the DAC security manager to be able to safely
      get the supplemental group list for a given uid, but at the time
      of a fork rather than during initialization so as to pick up on
      live changes to the system's group database.  This patch adds the
      framework, including the possibility of a pre-fork callback
      failing.
      
      For now, any driver that implements a prefork callback must be
      robust against the possibility of being part of a security stack
      where a later element in the chain fails prefork.  This means
      that drivers cannot do any action that requires a call to postfork
      for proper cleanup (no grabbing a mutex, for example).  If this
      is too prohibitive in the future, we would have to switch to a
      transactioning sequence, where each driver has (up to) 3 callbacks:
      PreForkPrepare, PreForkCommit, and PreForkAbort, to either clean
      up or commit changes made during prepare.
      
      * src/security/security_driver.h (virSecurityDriverPreFork): New
      callback.
      * src/security/security_manager.h (virSecurityManagerPreFork):
      Change signature.
      * src/security/security_manager.c (virSecurityManagerPreFork):
      Optionally call into driver, and allow returning failure.
      * src/security/security_stack.c (virSecurityDriverStack):
      Wrap the handler for the stack driver.
      * src/qemu/qemu_process.c (qemuProcessStart): Adjust caller.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      fdb3bde3
  10. 18 7月, 2013 3 次提交
  11. 16 7月, 2013 1 次提交
    • J
      Determine whether to start balloon memory stats gathering. · ffdf82a9
      John Ferlan 提交于
      At vm startup and attach attempt to set the balloon driver statistics
      collection period based on the value found in the domain xml file. This
      is not done at reconnect since it's possible that a collection period
      was set on the live guest and making the set period call would reset to
      whatever value is stored in the config file.
      
      Setting the stats collection period has a side effect of searching through
      the qom-list output for the virtio balloon driver and making sure that it
      has the right properties in order to allow setting of a collection period
      and eventually fetching of statistics.
      
      The walk through the qom-list is expensive and thus the balloonpath will
      be saved in the monitor private structure as well as a flag indicating
      that the initialization has already been attempted (in the event that a
      path is not found, no sense to keep checking).
      
      This processing model conforms to the qom object model model which
      requires setting object properties after device startup. That is, it's
      not possible to pass the period along via the startup code as it won't
      be recognized.
      ffdf82a9
  12. 11 7月, 2013 1 次提交
  13. 10 7月, 2013 1 次提交
  14. 08 7月, 2013 2 次提交
  15. 03 7月, 2013 4 次提交
  16. 01 7月, 2013 1 次提交
  17. 11 6月, 2013 1 次提交
    • M
      qemu_migrate: Dispose listen address if set from config · 6546017c
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=971485
      
      As of d7f9d827 we copy the listen
      address from the qemu.conf config file in case none has been provided
      via XML. But later, when migrating, we should not include such listen
      address in the migratable XML as it is something autogenerated, not
      requested by user. Moreover, the binding to the listen address will
      likely fail, unless the address is '0.0.0.0' or its IPv6 equivalent.
      This patch introduces a new boolean attribute to virDomainGraphicsListenDef
      to distinguish autofilled listen addresses. However, we must keep the
      attribute over libvirtd restarts, so it must be kept within status XML.
      6546017c
  18. 07 6月, 2013 1 次提交
    • O
      qemu: Report the offset from host UTC for RTC_CHANGE event · e31b5cf3
      Osier Yang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=964177
      
      Though both libvirt and QEMU's document say RTC_CHANGE returns
      the offset from the host UTC, qemu actually returns the offset
      from the specified date instead when specific date is provided
      (-rtc base=$date).
      
      It's not safe for qemu to fix it in code, it worked like that
      for 3 years, changing it now may break other QEMU use cases.
      What qemu tries to do is to fix the document:
      
      http://lists.gnu.org/archive/html/qemu-devel/2013-05/msg04782.html
      
      And in libvirt side, instead of replying on the value from qemu,
      this converts the offset returned from qemu to the offset from
      host UTC, by:
      
        /*
         * a: the offset from qemu RTC_CHANGE event
         * b: The specified date (-rtc base=$date)
         * c: the host date when libvirt gets the RTC_CHANGE event
         * offset: What libvirt will report
         */
      
        offset = a + (b - c);
      
      The specified date (-rtc base=$date) is recorded in clock's def as
      an internal only member (may be useful to exposed outside?).
      
      Internal only XML tag "basetime" is introduced to not lose the
      guest's basetime after libvirt restarting/reloading:
      
      <clock offset='variable' adjustment='304' basis='utc' basetime='1370423588'/>
      e31b5cf3
  19. 06 6月, 2013 2 次提交
  20. 25 5月, 2013 1 次提交
    • S
      qemu: save domain state to XML after reboot · 2697c8a1
      Sergey Fionov 提交于
      Currently qemuDomainReboot() does reboot in two phases:
      qemuMonitorSystemPowerdown() and qemuProcessFakeReboot().
      
      qemuMonitorSystemPowerdown() shutdowns the domain and saves domain
      state/reason as VIR_DOMAIN_SHUTDOWN_UNKNOWN.
      
      qemuProcessFakeReboot() sets domain state/reason to
      VIR_DOMAIN_RESUMED_UNPAUSED but does not save domain state changes.
      
      Subsequent restart of libvirtd leads to restoring domain state/reason to
      saved that is VIR_DOMAIN_SHUTDOWN_UNKNOWN and to automatic shutdown of
      the domain. This commit adds virDomainSaveStatus() into
      qemuProcessFakeReboot() to avoid unexpected shutdowns.
      2697c8a1
  21. 23 5月, 2013 1 次提交
  22. 21 5月, 2013 1 次提交
  23. 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
  24. 17 5月, 2013 5 次提交
    • G
      qemu: report useful error failling to destroy domain gracefully · 6459af6a
      Guannan Ren 提交于
      Resolves:https://bugzilla.redhat.com/show_bug.cgi?id=927620
      
       #kill -STOP `pidof qemu-kvm`
       #virsh destroy $guest --graceful
       error: Failed to destroy domain testVM
       error: An error occurred, but the cause is unknown
      
      With --graceful, SIGTERM always is emitted to kill driver
      process, but it won't success till burning out waiting time
      in case of process being stopped.
      But domain destroy without --graceful can work, SIGKILL will
      be emitted to the stopped process after 10 secs which always
      kills a process even one that is currently stopped.
      So report an error after burning out waiting time in this case.
      6459af6a
    • O
      qemu: Refactor qemuSetUnprivSGIO to support scsi host device · 0453bcdf
      Osier Yang 提交于
      Just like what previous patches do, it refactors qemuSetUnprivSGIO
      to take the virDomainDeviceDefPtr as argument instead.
      0453bcdf
    • O
      qemu: Move qemuSetUnprivSGIO into qemu_conf.c · 99fdd434
      Osier Yang 提交于
      unpriv_sgio setting is tight with the shared device helpers, let's
      put them together in qemu_conf.c
      99fdd434
    • O
      Rename virDomainDiskSGIO to virDomainDeviceSGIO · ead43915
      Osier Yang 提交于
      SCSI host device will also support "sgio", and perhaps we could
      use "sgio" in other places too in future, renaming the enum to
      reuse.
      ead43915
    • O
      qemu: Refactor the helpers to track shared scsi host device · aeda1ff1
      Osier Yang 提交于
      This changes the helpers qemu{Add,Remove}SharedDisk into
      qemu{Add,Remove}SharedDevice, as most of the code in the helpers
      can be reused for scsi host device.
      
      To track the shared scsi host device, first it finds out the
      device path (e.g. /dev/s[dr]*) which is mapped to the sg device,
      and use device ID of the found device path (/dev/s[dr]*) as the
      hash key. This is because of the device ID is not unique between
      between /dev/s[dr]* and /dev/sg*, e.g.
      
      % sg_map
      /dev/sg0  /dev/sda
      /dev/sg1  /dev/sr0
      
      % ls -l /dev/sda
      brw-rw----. 1 root disk 8, 0 May  2 19:26 /dev/sda
      
      %ls -l /dev/sg0
      crw-rw----. 1 root disk 21, 0 May  2 19:26 /dev/sg0
      aeda1ff1
  25. 16 5月, 2013 1 次提交
    • O
      qemu: Rename qemu_driver->sharedDisks to qemu_driver->sharedDevices · 539d0e19
      Osier Yang 提交于
      "Shared disk" is not only the thing we should care about after "scsi
      hostdev" is introduced. A same scsi device can be used as "disk" for
      one domain, and as "scsi hostdev" for another domain at the same time.
      That's why this patch renames qemu_driver->sharedDisks. Related functions
      and structs are also renamed.
      539d0e19
  26. 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
  27. 14 5月, 2013 1 次提交
    • E
      qemu: use bool in monitor struct · 764bb5e5
      Eric Blake 提交于
      Follows on the heels of other bool cleanups, such as commit 93002b98.
      
      * src/qemu/qemu_monitor.h (qemuMonitorOpen, qemuMonitorOpenFD):
      Update json parameter type.
      * src/qemu/qemu_monitor.c (qemuMonitorOpen, qemuMonitorOpenFD):
      Likewise.
      (_qemuMonitor): Adjust field type.
      * src/qemu/qemu_domain.h (_qemuDomainObjPrivate): Likewise.
      * src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLParse): Adjust
      client.
      * src/qemu/qemu_process.c (qemuProcessStart): Likewise.
      * tests/qemumonitortestutils.c (qemuMonitorTestNew): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      764bb5e5