1. 01 4月, 2011 1 次提交
    • O
      qemu: Fix improper logic of qemuCgroupSetup · 0ca16a78
      Osier Yang 提交于
      It throws errors as long as the cgroup controller is not available,
      regardless of whether we really want to use it to do setup or not,
      which is not what we want, fixing it with throwing error when need
      to use the controller.
      
      And change "VIR_WARN" to "qemuReportError" for memory controller
      incidentally.
      0ca16a78
  2. 29 3月, 2011 1 次提交
    • O
      cputune: Support cputune for qemu driver · 1cc4d025
      Osier Yang 提交于
      When domain startup, setting cpu affinity and cpu shares according
      to the cputune xml specified in domain xml.
      
      Modify "qemudDomainPinVcpu" to update domain config for vcpupin,
      and modify "qemuSetSchedulerParameters" to update domain config
      for cpu shares.
      
      v1 - v2:
         * Use "VIR_ALLOC_N" instead of "VIR_ALLOC_VAR"
         * But keep raising error when it fails on adding vcpupin xml
           entry, as I still don't have a better idea yet.
      1cc4d025
  3. 18 3月, 2011 1 次提交
  4. 10 3月, 2011 4 次提交
    • 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
      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: 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
  5. 01 3月, 2011 1 次提交
    • E
      qemu: only request sound cgroup ACL when required · 7c6b22c4
      Eric Blake 提交于
      When a SPICE or VNC graphics controller is present, and sound is
      piggybacked over a channel to the graphics device rather than
      directly accessing host hardware, then there is no need to grant
      host hardware access to that qemu process.
      
      * src/qemu/qemu_cgroup.c (qemuSetupCgroup): Prevent sound with
      spice, and with vnc when vnc_allow_host_audio is 0.
      Reported by Daniel Berrange.
      7c6b22c4
  6. 25 2月, 2011 3 次提交
    • E
      audit: add qemu hooks for auditing cgroup events · 6bb98d41
      Eric Blake 提交于
      * src/qemu/qemu_audit.h (qemuDomainCgroupAudit): New prototype.
      * src/qemu/qemu_audit.c (qemuDomainCgroupAudit): Implement it.
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Add audit.
      * src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow)
      (qemuSetupChardevCgroup, qemuSetupHostUsbDeviceCgroup)
      (qemuSetupCgroup, qemuTeardownDiskPathDeny): Likewise.
      6bb98d41
    • E
      audit: prepare qemu for listing vm in cgroup audits · b4d3434f
      Eric Blake 提交于
      * src/qemu/qemu_cgroup.h (struct qemuCgroupData): New helper type.
      (qemuSetupDiskPathAllow, qemuSetupChardevCgroup)
      (qemuTeardownDiskPathDeny): Drop unneeded prototypes.
      (qemuSetupDiskCgroup, qemuTeardownDiskCgroup): Adjust prototype.
      * src/qemu/qemu_cgroup.c
      (qemuSetupDiskPathAllow, qemuSetupChardevCgroup)
      (qemuTeardownDiskPathDeny): Mark static and use new type.
      (qemuSetupHostUsbDeviceCgroup): Use new type.
      (qemuSetupDiskCgroup): Alter signature.
      (qemuSetupCgroup): Adjust caller.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachHostUsbDevice)
      (qemuDomainDetachPciDiskDevice, qemuDomainDetachSCSIDiskDevice):
      Likewise.
      * src/qemu/qemu_driver.c (qemudDomainAttachDevice)
      (qemuDomainUpdateDeviceFlags): Likewise.
      b4d3434f
    • E
      cgroup: determine when skipping non-devices · 06173876
      Eric Blake 提交于
      * src/util/cgroup.c (virCgroupAllowDevicePath)
      (virCgroupDenyDevicePath): Don't fail with EINVAL for
      non-devices.
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Update caller.
      * src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow)
      (qemuSetupChardevCgroup, qemuSetupHostUsbDeviceCgroup)
      (qemuSetupCgroup, qemuTeardownDiskPathDeny): Likewise.
      06173876
  7. 09 2月, 2011 1 次提交
  8. 28 1月, 2011 1 次提交
    • E
      qemu: fix error messages · b96b6f47
      Eric Blake 提交于
      Regression in commit caa805ea let a lot of bad messages slip in.
      
      * cfg.mk (msg_gen_function): Fix function name.
      * src/qemu/qemu_cgroup.c (qemuRemoveCgroup): Fix fallout from
      'make syntax-check'.
      * src/qemu/qemu_driver.c (qemudDomainGetInfo)
      (qemuDomainWaitForMigrationComplete, qemudStartVMDaemon)
      (qemudDomainSaveFlag, qemudDomainAttachDevice)
      (qemuDomainUpdateDeviceFlags): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachHostUsbDevice)
      (qemuDomainDetachPciDiskDevice, qemuDomainDetachSCSIDiskDevice):
      Likewise.
      b96b6f47
  9. 15 1月, 2011 1 次提交
    • E
      domain_conf: split source data out from ChrDef · 98334e7c
      Eric Blake 提交于
      This opens up the possibility of reusing the smaller ChrSourceDef
      for both qemu monitor and a passthrough smartcard device.
      
      * src/conf/domain_conf.h (_virDomainChrDef): Factor host
      details...
      (_virDomainChrSourceDef): ...into new struct.
      (virDomainChrSourceDefFree): New prototype.
      * src/conf/domain_conf.c (virDomainChrDefFree)
      (virDomainChrDefParseXML, virDomainChrDefFormat): Split...
      (virDomainChrSourceDefClear, virDomainChrSourceDefFree)
      (virDomainChrSourceDefParseXML, virDomainChrSourceDefFormat):
      ...into new functions.
      (virDomainChrDefParseTargetXML): Update clients to reflect type
      split.
      * src/vmx/vmx.c (virVMXParseSerial, virVMXParseParallel)
      (virVMXFormatSerial, virVMXFormatParallel): Likewise.
      * src/xen/xen_driver.c (xenUnifiedDomainOpenConsole): Likewise.
      * src/xen/xend_internal.c (xenDaemonParseSxprChar)
      (xenDaemonFormatSxprChr): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxAttachSerial)
      (vboxAttachParallel): Likewise.
      * src/security/security_dac.c (virSecurityDACSetChardevLabel)
      (virSecurityDACSetChardevCallback)
      (virSecurityDACRestoreChardevLabel)
      (virSecurityDACRestoreChardevCallback): Likewise.
      * src/security/security_selinux.c (SELinuxSetSecurityChardevLabel)
      (SELinuxSetSecurityChardevCallback)
      (SELinuxRestoreSecurityChardevLabel)
      (SELinuxSetSecurityChardevCallback): Likewise.
      * src/security/virt-aa-helper.c (get_files): Likewise.
      * src/lxc/lxc_driver.c (lxcVmStart, lxcDomainOpenConsole):
      Likewise.
      * src/uml/uml_conf.c (umlBuildCommandLineChr): Likewise.
      * src/uml/uml_driver.c (umlIdentifyOneChrPTY, umlIdentifyChrPTY)
      (umlDomainOpenConsole): Likewise.
      * src/qemu/qemu_command.c (qemuBuildChrChardevStr)
      (qemuBuildChrArgStr, qemuBuildCommandLine)
      (qemuParseCommandLineChr): Likewise.
      * src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLFormat)
      (qemuDomainObjPrivateXMLParse): Likewise.
      * src/qemu/qemu_cgroup.c (qemuSetupChardevCgroup): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
      * src/qemu/qemu_driver.c (qemudFindCharDevicePTYsMonitor)
      (qemudFindCharDevicePTYs, qemuPrepareChardevDevice)
      (qemuPrepareMonitorChr, qemudShutdownVMDaemon)
      (qemuDomainOpenConsole): Likewise.
      * src/qemu/qemu_command.h (qemuBuildChrChardevStr)
      (qemuBuildChrArgStr): Delete, now that they are static.
      * src/libvirt_private.syms (domain_conf.h): New exports.
      * cfg.mk (useless_free_options): Update list.
      * tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Update
      tests.
      98334e7c
  10. 17 12月, 2010 1 次提交
    • D
      Move QEMU cgroup helper code out of the QEMU driver · 52271cfc
      Daniel P. Berrange 提交于
      The QEMU driver file is far too large. Move all the cgroup
      helper code out into a separate file. No functional change.
      
      * src/qemu/qemu_cgroup.c, src/qemu/qemu_cgroup.h,
        src/Makefile.am: Add cgroup helper file
      * src/qemu/qemu_driver.c: Delete cgroup code
      52271cfc