1. 11 3月, 2011 4 次提交
  2. 10 3月, 2011 18 次提交
    • E
      audit: audit use of /dev/net/tun, /dev/tapN, /dev/vhost-net · 9516a0ec
      Eric Blake 提交于
      Opening raw network devices with the intent of passing those fds to
      qemu is worth an audit point.  This makes a multi-part audit: first,
      we audit the device(s) that libvirt opens on behalf of the MAC address
      of a to-be-created interface (which can independently succeed or
      fail), then we audit whether qemu actually started the network device
      with the same MAC (so searching backwards for successful audits with
      the same MAC will show which fd(s) qemu is actually using).  Note that
      it is possible for the fd to be successfully opened but no attempt
      made to pass the fd to qemu (for example, because intermediate
      nwfilter operations failed) - no interface start audit will occur in
      that case; so the audit for a successful opened fd does not imply
      rights given to qemu unless there is a followup audit about the
      attempt to start a new interface.
      
      Likewise, when a network device is hot-unplugged, there is only one
      audit message about the MAC being discontinued; again, searching back
      to the earlier device open audits will show which fds that qemu quits
      using (and yes, I checked via /proc/<qemu-pid>/fd that qemu _does_
      close out the fds associated with an interface on hot-unplug).  The
      code would require much more refactoring to be able to definitively
      state which device(s) were discontinued at that point, since we
      currently don't record anywhere in the XML whether /dev/vhost-net was
      opened for a given interface.
      
      * src/qemu/qemu_audit.h (qemuAuditNetDevice): New prototype.
      * src/qemu/qemu_audit.c (qemuAuditNetDevice): New function.
      * src/qemu/qemu_command.h (qemuNetworkIfaceConnect)
      (qemuPhysIfaceConnect, qemuOpenVhostNet): Adjust prototype.
      * src/qemu/qemu_command.c (qemuNetworkIfaceConnect)
      (qemuPhysIfaceConnect, qemuOpenVhostNet): Add audit points and
      adjust parameters.
      (qemuBuildCommandLine): Adjust caller.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
      9516a0ec
    • E
      qemu: don't request cgroup ACL access for /dev/net/tun · c52cbe48
      Eric Blake 提交于
      Since libvirt always passes /dev/net/tun to qemu via fd, we should
      never trigger the cases where qemu tries to directly open the
      device.  Therefore, it is safer to deny the cgroup device ACL.
      
      * src/qemu/qemu_cgroup.c (defaultDeviceACL): Remove /dev/net/tun.
      * src/qemu/qemu.conf (cgroup_device_acl): Reflect this change.
      c52cbe48
    • 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
  3. 09 3月, 2011 15 次提交
  4. 08 3月, 2011 3 次提交