1. 10 3月, 2011 16 次提交
    • E
      qemu: support vhost in attach-interface · 5d091513
      Eric Blake 提交于
      * src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Honor vhost
      designations, similar to qemu_command code paths.
      * src/qemu/qemu_command.h (qemuOpenVhostNet): New prototype.
      * src/qemu/qemu_command.c (qemuOpenVhostNet): Export.
      5d091513
    • J
      qemu: Stop guest CPUs before creating a snapshot · 346236fe
      Jiri Denemark 提交于
      346236fe
    • J
      qemu: Refactor qemuDomainSnapshotCreateXML · 89e75b01
      Jiri Denemark 提交于
      89e75b01
    • J
      81711cee
    • J
      qemu: Fallback to HMP for snapshot commands · 89241fe0
      Jiri Denemark 提交于
      qemu driver in libvirt gained support for creating domain snapshots
      almost a year ago in libvirt 0.8.0. Since then we enabled QMP support
      for qemu >= 0.13.0 but QMP equivalents of {save,load,del}vm commands are
      not implemented in current qemu (0.14.0) so the domain snapshot support
      is not very useful.
      
      This patch detects when the appropriate QMP command is not implemented
      and tries to use human-monitor-command (aka HMP passthrough) to run
      it's HMP equivalent.
      89241fe0
    • J
      qemu: Rename qemuMonitorCommandWithHandler as qemuMonitorText* · b3c6ec03
      Jiri Denemark 提交于
      To make it more obvious that it is only used for text monitor. The
      naming also matches the style of qemuMonitorTextCommandWithFd.
      b3c6ec03
    • J
      qemu: Rename qemuMonitorCommand{,WithFd} as qemuMonitorHMP* · 39b4f4aa
      Jiri Denemark 提交于
      So that it's obvious that they are supposed to be used with HMP commands.
      39b4f4aa
    • J
      qemu: Setup infrastructure for HMP passthrough · 266265a5
      Jiri Denemark 提交于
      JSON monitor command implementation can now just directly call text
      monitor implementation and it will be automatically encapsulated into
      QMP's human-monitor-command.
      266265a5
    • J
      qemu: Fix warnings in event handlers · 3b8bf4a3
      Jiri Denemark 提交于
      Some qemu monitor event handlers were issuing inadequate warning when
      virDomainSaveStatus() failed. They copied the message from I/O error
      handler without customizing it to provide better information on why
      virDomainSaveStatus() was called.
      3b8bf4a3
    • O
      storage: Update qemu-img flag checking · d9993769
      Osier Yang 提交于
      For newer qemu-img, the help string for "backing file format" is
      "[-F backing_fmt]".
      
      Fix the wrong logic error by commit e997c268.
      
      * src/storage/storage_backend.c
      d9993769
    • O
      qemu: Replace deprecated option of qemu-img · e997c268
      Osier Yang 提交于
      qemu-img silently disable "-e", so we can't use it for volume
      encryption anymore, change it into "-o encryption=on" if qemu
      supports "-o" option.
      e997c268
    • E
      audit: also audit cgroup ACL permissions · 340ab27d
      Eric Blake 提交于
      * src/qemu/qemu_audit.h (qemuAuditCgroupMajor)
      (qemuAuditCgroupPath): Add parameter.
      * src/qemu/qemu_audit.c (qemuAuditCgroupMajor)
      (qemuAuditCgroupPath): Add 'acl=rwm' to cgroup audit entries.
      * src/qemu/qemu_cgroup.c: Update clients.
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Likewise.
      340ab27d
    • E
      cgroup: allow fine-tuning of device ACL permissions · 5564c575
      Eric Blake 提交于
      Adding audit points showed that we were granting too much privilege
      to qemu; it should not need any mknod rights to recreate any
      devices.  On the other hand, lxc should have all device privileges.
      The solution is adding a flag parameter.
      
      This also lets us restrict write access to read-only disks.
      
      * src/util/cgroup.h (virCgroup*Device*): Adjust prototypes.
      * src/util/cgroup.c (virCgroupAllowDevice)
      (virCgroupAllowDeviceMajor, virCgroupAllowDevicePath)
      (virCgroupDenyDevice, virCgroupDenyDeviceMajor)
      (virCgroupDenyDevicePath): Add parameter.
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Update clients.
      * src/lxc/lxc_controller.c (lxcSetContainerResources): Likewise.
      * src/qemu/qemu_cgroup.c: Likewise.
      (qemuSetupDiskPathAllow): Also, honor read-only disks.
      5564c575
    • E
      audit: rename remaining qemu audit functions · 48096a00
      Eric Blake 提交于
      Also add ATTRIBUTE_NONNULL markers.
      
      * src/qemu/qemu_audit.h: The pattern qemuDomainXXXAudit is
      inconsistent; prefer qemuAuditXXX instead.
      * src/qemu/qemu_audit.c: Reflect the renames.
      * src/qemu/qemu_driver.c: Likewise.
      * src/qemu/qemu_hotplug.c: Likewise.
      * src/qemu/qemu_migration.c: Likewise.
      * src/qemu/qemu_process.c: Likewise.
      48096a00
    • E
      audit: also audit cgroup controller path · f2512684
      Eric Blake 提交于
      Although the cgroup device ACL controller path can be worked out
      by researching the code, it is more efficient to include that
      information directly in the audit message.
      
      * src/util/cgroup.h (virCgroupPathOfController): New prototype.
      * src/util/cgroup.c (virCgroupPathOfController): Export.
      * src/libvirt_private.syms: Likewise.
      * src/qemu/qemu_audit.c (qemuAuditCgroup): Use it.
      f2512684
    • E
      audit: split cgroup audit types to allow more information · d04916fa
      Eric Blake 提交于
      Device names can be manipulated, so it is better to also log
      the major/minor device number corresponding to the cgroup ACL
      changes that libvirt made.  This required some refactoring
      of the relatively new qemu cgroup audit code.
      
      Also, qemuSetupChardevCgroup was only auditing on failure, not success.
      
      * src/qemu/qemu_audit.h (qemuDomainCgroupAudit): Delete.
      (qemuAuditCgroup, qemuAuditCgroupMajor, qemuAuditCgroupPath): New
      prototypes.
      * src/qemu/qemu_audit.c (qemuDomainCgroupAudit): Rename...
      (qemuAuditCgroup): ...and drop a parameter.
      (qemuAuditCgroupMajor, qemuAuditCgroupPath): New functions, to
      allow listing device major/minor in audit.
      (qemuAuditGetRdev): New helper function.
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Adjust callers.
      * src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow)
      (qemuSetupHostUsbDeviceCgroup, qemuSetupCgroup)
      (qemuTeardownDiskPathDeny): Likewise.
      (qemuSetupChardevCgroup): Likewise, fixing missing audit.
      d04916fa
  2. 09 3月, 2011 15 次提交
  3. 08 3月, 2011 5 次提交
    • D
      Fix build on cygwin · d299e1d0
      Daniel Veillard 提交于
      Apparently some signals found on Unix are not exposed, this led
      to a compilation failure
      * src/util/logging.c: make code related to each signal dependant
        upon the definition of that signal
      d299e1d0
    • W
      support to detach USB disk · 0e29f711
      Wen Congyang 提交于
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      0e29f711
    • W
      rename qemuDomainDetachSCSIDiskDevice to qemuDomainDetachDiskDevice · 8f338032
      Wen Congyang 提交于
      The way to detach a USB disk is the same as that to detach a SCSI
      disk. Rename this function and we can use it to detach a USB disk.
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      8f338032
    • C
      qemu_hotplug: Reword error if spice password change not available · 56a4d812
      Cole Robinson 提交于
      Currently it sounds like spice is completely unsupported, which is
      confusing.
      56a4d812
    • W
      unlock eventLoop before calling callback function · ac9ee6b5
      Wen Congyang 提交于
      When I use newest libvirt to save a domain, libvirtd will be deadlock.
      Here is the output of gdb:
      (gdb) thread 3
      [Switching to thread 3 (Thread 0x7f972a1fc710 (LWP 30265))]#0  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
      (gdb) bt
          at qemu/qemu_driver.c:2074
          ret=0x7f972a1fbbe0) at remote.c:2273
      (gdb) thread 7
      [Switching to thread 7 (Thread 0x7f9730bcd710 (LWP 30261))]#0  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
      (gdb) bt
      (gdb) p *(virMutexPtr)0x6fdd60
      $2 = {lock = {__data = {__lock = 2, __count = 0, __owner = 30261, __nusers = 1, __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}},
          __size = "\002\000\000\000\000\000\000\000\065v\000\000\001", '\000' <repeats 26 times>, __align = 2}}
      (gdb) p *(virMutexPtr)0x1a63ac0
      $3 = {lock = {__data = {__lock = 2, __count = 0, __owner = 30265, __nusers = 1, __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}},
          __size = "\002\000\000\000\000\000\000\000\071v\000\000\001", '\000' <repeats 26 times>, __align = 2}}
      (gdb) info threads
        7 Thread 0x7f9730bcd710 (LWP 30261)  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
        6 Thread 0x7f972bfff710 (LWP 30262)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
        5 Thread 0x7f972b5fe710 (LWP 30263)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
        4 Thread 0x7f972abfd710 (LWP 30264)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
      * 3 Thread 0x7f972a1fc710 (LWP 30265)  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
        2 Thread 0x7f97297fb710 (LWP 30266)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
        1 Thread 0x7f9737aac800 (LWP 30260)  0x000000351fe0803d in pthread_join () from /lib64/libpthread.so.0
      
      The reason is that we will try to lock some object in callback function, and we may call event API with locking the same object.
      In the function virEventDispatchHandles(), we unlock eventLoop before calling callback function. I think we should
      do the same thing in the function virEventCleanupTimeouts() and virEventCleanupHandles().
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ac9ee6b5
  4. 07 3月, 2011 4 次提交
    • D
      Expose event loop implementation as a public API · 2ed6cc7b
      Daniel P. Berrange 提交于
      Not all applications have an existing event loop they need
      to integrate with. Forcing them to implement the libvirt
      event loop integration APIs is an undue burden. This just
      exposes our simple poll() based implementation for apps
      to use. So instead of calling
      
         virEventRegister(....callbacks...)
      
      The app would call
      
         virEventRegisterDefaultImpl()
      
      And then have a thread somewhere calling
      
          static bool quit = false;
          ....
          while (!quit)
            virEventRunDefaultImpl()
      
      * daemon/libvirtd.c, tools/console.c,
        tools/virsh.c: Convert to public event loop APIs
      * include/libvirt/libvirt.h.in, src/libvirt_private.syms: Add
        virEventRegisterDefaultImpl and virEventRunDefaultImpl
      * src/util/event.c: Implement virEventRegisterDefaultImpl
        and virEventRunDefaultImpl using poll() event loop
      * src/util/event_poll.c: Add full error reporting
      * src/util/virterror.c, include/libvirt/virterror.h: Add
        VIR_FROM_EVENTS
      2ed6cc7b
    • D
      Move event code out of the daemon/ into src/util/ · 343eaa15
      Daniel P. Berrange 提交于
      The event loop implementation is used by more than just the
      daemon, so move it into the shared area.
      
      * daemon/event.c, src/util/event_poll.c: Renamed
      * daemon/event.h, src/util/event_poll.h: Renamed
      * tools/Makefile.am, tools/console.c, tools/virsh.c: Update
        to use new virEventPoll APIs
      * daemon/mdns.c, daemon/mdns.c, daemon/Makefile.am: Update
        to use new virEventPoll APIs
      343eaa15
    • D
      Convert daemon/virsh over to use primary event APIs, rather than impl · 5d2c045c
      Daniel P. Berrange 提交于
      The daemon code calls virEventAddHandleImpl directly instead
      of calling the wrapper virEventAddHandle.
      
      * tools/console.c, daemon/libvirtd.c, daemon/mdns.c: Convert to
        use primary event APIs
      5d2c045c
    • D
      Cleaning up some of the logging code · bcb40b85
      Daniel Veillard 提交于
      * src/util/logging.c: fix virLogDumpAllFD() to avoid snprintf, simplify
        the code and provide more useful signal descriptions. Also remove an
        unused variable.
      bcb40b85