1. 29 3月, 2011 6 次提交
    • E
      qemu: consolidate migration to file code · 6034ddd5
      Eric Blake 提交于
      This points out that core dumps (still) don't work for root-squash
      NFS, since the fd is not opened correctly.  This patch should not
      introduce any functionality change, it is just a refactoring to
      avoid duplicated code.
      
      * src/qemu/qemu_migration.h (qemuMigrationToFile): New prototype.
      * src/qemu/qemu_migration.c (qemuMigrationToFile): New function.
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag, doCoreDump): Use
      it.
      6034ddd5
    • E
      qemu: use common API for reading difficult files · 80449b32
      Eric Blake 提交于
      Direct access to an open file is so much simpler than passing
      everything through a pipe!
      
      * src/qemu/qemu_driver.c (qemudOpenAsUID)
      (qemudDomainSaveImageClose): Delete.
      (qemudDomainSaveImageOpen): Rename...
      (qemuDomainSaveImageOpen): ...and drop read_pid argument.  Use
      virFileOpenAs instead of qemudOpenAsUID.
      (qemudDomainSaveImageStartVM, qemudDomainRestore)
      (qemudDomainObjRestore): Rename...
      (qemuDomainSaveImageStartVM, qemuDomainRestore)
      (qemDomainObjRestore): ...and simplify accordingly.
      (qemudDomainObjStart, qemuDriver): Update callers.
      80449b32
    • E
      qemu, storage: improve type safety · 1a369dfb
      Eric Blake 提交于
      * src/storage/storage_backend.c (createRawFileOpHook): Change
      signature.
      (struct createRawFileOpHookData): Delete unused struct.
      (virStorageBackendCreateRaw): Adjust caller.
      * src/qemu/qemu_driver.c (struct fileOpHookData): Delete unused
      struct.
      (qemudDomainSaveFileOpHook): Rename...
      (qemuDomainSaveFileOpHook): ...and change signature.
      (qemudDomainSaveFlag): Adjust caller.
      1a369dfb
    • E
      util: rename virFileOperation to virFileOpenAs · 1fdd50f9
      Eric Blake 提交于
      This patch intentionally doesn't change indentation, in order to
      make it easier to review the real changes.
      
      * src/util/util.h (VIR_FILE_OP_RETURN_FD, virFileOperationHook):
      Delete.
      (virFileOperation): Rename...
      (virFileOpenAs): ...and reduce parameters.
      * src/util/util.c (virFileOperationNoFork, virFileOperation):
      Rename and simplify.
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Adjust caller.
      * src/storage/storage_backend.c (virStorageBackendCreateRaw):
      Likewise.
      * src/libvirt_private.syms: Reflect rename.
      1fdd50f9
    • E
      qemu: simplify domain save fd handling · 3eede281
      Eric Blake 提交于
      This makes root-squash NFS saves more efficient.
      
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Use new
      virFileOperation flag to open fd only once.
      3eede281
    • E
      qemu: allow simple domain save to use fd: protocol · 9497506f
      Eric Blake 提交于
      This allows direct saves (no compression, no root-squash NFS) to use
      the more efficient fd: migration, which in turn avoids a race where
      qemu exec: migration can sometimes fail because qemu does a generic
      waitpid() that conflicts with the pclose() used by exec:.  Further
      patches will solve compression and root-squash NFS.
      
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Use new function
      when there is no compression.
      9497506f
  2. 28 3月, 2011 1 次提交
    • E
      qemu: don't restore state label twice · 96d56786
      Eric Blake 提交于
      Otherwise, if something like doStopVcpus fails after the first
      restore, a second restore is attempted and throws a useless
      warning.
      
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Avoid second
      restore of state label.
      96d56786
  3. 25 3月, 2011 1 次提交
  4. 24 3月, 2011 1 次提交
    • W
      update domain status forcibly even if attach a device failed · 9450a7cb
      Wen Congyang 提交于
      Steps to reproduce this bug:
      1. virsh attach-disk domain --source diskimage --target sdb --sourcetype file --driver qemu --subdriver qcow2
         error: Failed to attach disk
         error: operation failed: adding scsi-disk,bus=scsi0.0,scsi-id=1,drive=drive-scsi0-0-1,id=scsi0-0-1 device failed: Property 'scsi-disk.drive' can't find value 'drive-scsi0-0-1'
      2. service libvirtd restart
         Stopping libvirtd daemon:                                  [  OK  ]
         Starting libvirtd daemon:                                  [  OK  ]
      3. virsh attach-disk domain --source diskimage --target sdb --sourcetype file --driver qemu --subdriver raw
         error: Failed to attach disk
         error: operation failed: adding lsi,id=scsi0,bus=pci.0,addr=0x6 device failed: Duplicate ID 'scsi0' for device
      
      The reason is that we create a new scsi controller but we do not update
      /var/run/libvirt/qemu/domain.xml.
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      9450a7cb
  5. 22 3月, 2011 2 次提交
    • D
      Wire up virDomainMigrateSetSpeed into QEMU driver · 83cc3d1d
      Daniel P. Berrange 提交于
      Enhance the QEMU migration monitoring loop, so that it can get
      a signal to change migration speed on the fly
      
      * src/qemu/qemu_domain.h: Add signal for changing speed on the fly
      * src/qemu/qemu_driver.c: Wire up virDomainMigrateSetSpeed driver
      * src/qemu/qemu_migration.c: Support signal for changing speed
      83cc3d1d
    • D
      Add public API for setting migration speed on the fly · cb4aba9b
      Daniel P. Berrange 提交于
      It is possible to set a migration speed limit when starting
      migration. This new API allows the speed limit to be changed
      on the fly to adjust to changing conditions
      
      * src/driver.h, src/libvirt.c, src/libvirt_public.syms,
        include/libvirt/libvirt.h.in: Add virDomainMigrateSetMaxSpeed
      * 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/remote/remote_driver.c, src/test/test_driver.c,
        src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
        src/vmware/vmware_driver.c, src/xen/xen_driver.c,
        src/libxl/libxl_driver.c: Stub new API
      cb4aba9b
  6. 19 3月, 2011 1 次提交
    • E
      qemu: respect locking rules · 49608417
      Eric Blake 提交于
      THREADS.txt states that the contents of vm should not be read or
      modified while the vm lock is not held, but that the lock must not
      be held while performing a monitor command.  This fixes all the
      offenders that I could find.
      
      * src/qemu/qemu_process.c (qemuProcessStartCPUs)
      (qemuProcessInitPasswords, qemuProcessStart): Don't modify or
      refer to vm state outside lock.
      * src/qemu/qemu_driver.c (qemudDomainHotplugVcpus): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainChangeGraphicsPasswords):
      Likewise.
      49608417
  7. 18 3月, 2011 2 次提交
    • W
      qemu: check driver name while attaching disk · e2aec53b
      Wen Congyang 提交于
      This bug was reported by Shi Jin(jinzishuai@gmail.com):
      =============
      # virsh attach-disk RHEL6RC /var/lib/libvirt/images/test3.img vdb \
              --driver file --subdriver qcow2
      Disk attached successfully
      
      # virsh save RHEL6RC /var/lib/libvirt/images/memory.save
      Domain RHEL6RC saved to /var/lib/libvirt/images/memory.save
      
      # virsh restore /var/lib/libvirt/images/memory.save
      error: Failed to restore domain from /var/lib/libvirt/images/memory.save
      error: internal error unsupported driver name 'file'
             for disk '/var/lib/libvirt/images/test3.img'
      =============
      
      We check the driver name when we start or restore VM, but we do
      not check it while attaching a disk. This adds the same check on disk
      driverName used in qemuBuildCommandLine to qemudDomainAttachDevice.
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      e2aec53b
    • N
      virsh: fix memtune's help message for swap_hard_limit · 78ba748e
      Nikunj A. Dadhania 提交于
      * Correct the documentation for cgroup: the swap_hard_limit indicates
        mem+swap_hard_limit.
      * Change cgroup private apis to: virCgroupGet/SetMemSwapHardLimit
      Signed-off-by: NNikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
      78ba748e
  8. 11 3月, 2011 4 次提交
  9. 10 3月, 2011 6 次提交
    • J
      qemu: Stop guest CPUs before creating a snapshot · 346236fe
      Jiri Denemark 提交于
      346236fe
    • J
      qemu: Refactor qemuDomainSnapshotCreateXML · 89e75b01
      Jiri Denemark 提交于
      89e75b01
    • 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: 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
  10. 09 3月, 2011 2 次提交
    • C
      Don't overwrite virRun error messages · 91893014
      Cole Robinson 提交于
      virRun gives pretty useful error output, let's not overwrite it unless there
      is a good reason. Some places were providing more information about what
      the commands were _attempting_ to do, however that's usually less useful from
      a debugging POV than what actually happened.
      91893014
    • H
      Fix a wrong error message thrown to user · 83d35233
      Hu Tao 提交于
      * src/qemu/qemu_driver.c: qemuDomainUpdateDeviceFlags() is not disk
        specific as the message suggests
      83d35233
  11. 08 3月, 2011 2 次提交
  12. 02 3月, 2011 1 次提交
    • E
      qemu: avoid double close on domain restore · 4f805dcd
      Eric Blake 提交于
      qemudDomainSaveImageStartVM was evil - it closed the incoming fd
      argument on some, but not all, code paths, without informing the
      caller about that action.  No wonder that this resulted in
      double-closes: https://bugzilla.redhat.com/show_bug.cgi?id=672725
      
      * src/qemu/qemu_driver.c (qemudDomainSaveImageStartVM): Alter
      signature, to avoid double-close.
      (qemudDomainRestore, qemudDomainObjRestore): Update callers.
      4f805dcd
  13. 25 2月, 2011 5 次提交
    • D
      Allow hash tables to use generic pointers as keys · 16ba2aaf
      Daniel P. Berrange 提交于
      Relax the restriction that the hash table key must be a string
      by allowing an arbitrary hash code generator + comparison func
      to be provided
      
      * util/hash.c, util/hash.h: Allow any pointer as a key
      * internal.h: Include stdbool.h as standard.
      * conf/domain_conf.c, conf/domain_conf.c,
        conf/nwfilter_params.c, nwfilter/nwfilter_gentech_driver.c,
        nwfilter/nwfilter_gentech_driver.h, nwfilter/nwfilter_learnipaddr.c,
        qemu/qemu_command.c, qemu/qemu_driver.c,
        qemu/qemu_process.c, uml/uml_driver.c,
        xen/xm_internal.c: s/char */void */ in hash callbacks
      16ba2aaf
    • E
      audit: audit qemu memory and vcpu adjusments · e25f2c74
      Eric Blake 提交于
      * src/qemu/qemu_audit.h (qemuDomainMemoryAudit)
      (qemuDomainVcpuAudit): New prototypes.
      * src/qemu/qemu_audit.c (qemuDomainResourceAudit)
      (qemuDomainMemoryAudit, qemuDomainVcpuAudit): New functions.
      (qemuDomainStartAudit): Call as appropriate.
      * src/qemu/qemu_driver.c (qemudDomainSetMemory)
      (qemudDomainHotplugVcpus): Likewise.
      e25f2c74
    • 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
  14. 24 2月, 2011 3 次提交
  15. 23 2月, 2011 1 次提交
    • E
      security: avoid memory leak · 009fce98
      Eric Blake 提交于
      Leak introduced in commit d6623003.
      
      * src/qemu/qemu_driver.c (qemuSecurityInit): Avoid leak on failure.
      * src/security/security_stack.c (virSecurityStackClose): Avoid
      leaking component drivers.
      009fce98
  16. 17 2月, 2011 2 次提交
    • D
      Move all the QEMU migration code to a new file · 766de435
      Daniel P. Berrange 提交于
      The introduction of the v3 migration protocol, along with
      support for migration cookies, will significantly expand
      the size of the migration code. Move it all to a separate
      file to make it more manageable
      
      The functions are not moved 100%. The API entry points
      remain in the main QEMU driver, but once the public
      virDomainPtr is resolved to the internal virDomainObjPtr,
      all following code is moved.
      
      This will allow the new v3 API entry points to call into the
      same shared internal migration functions
      
      * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add
        qemuDomainFormatXML helper method
      * src/qemu/qemu_driver.c: Remove all migration code
      * src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Add
        all migration code.
      766de435
    • D
      Split all QEMU process mangement code into separate file · 48c2d6c6
      Daniel P. Berrange 提交于
      Move the qemudStartVMDaemon and qemudShutdownVMDaemon
      methods into a separate file, renaming them to
      qemuProcessStart, qemuProcessStop. All helper methods
      called by these are also moved & renamed to match
      
      * src/Makefile.am: Add qemu_process.c/.h
      * src/qemu/qemu_command.c: Add qemuDomainAssignPCIAddresses
      * src/qemu/qemu_command.h: Add VNC port min/max
      * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add
        domain event queue helpers
      * src/qemu/qemu_driver.c, src/qemu/qemu_driver.h: Remove
        all QEMU process startup/shutdown functions
      * src/qemu/qemu_process.c, src/qemu/qemu_process.h: Add
        all QEMU process startup/shutdown functions
      48c2d6c6