1. 09 4月, 2011 1 次提交
  2. 08 4月, 2011 2 次提交
  3. 07 4月, 2011 1 次提交
    • O
      qemu: Remove the managed state file only if restoring succeeded · a73bbfc8
      Osier Yang 提交于
      1) Both "qemuDomainStartWithFlags" and "qemuAutostartDomain" try to
      restore the domain from managedsave'ed image if it exists (by
      invoking "qemuDomainObjRestore"), but it unlinks the image even
      if restoring fails, which causes data loss. (This problem exists
      for "virsh managedsave dom; virsh start dom").
      
      The fix for is to unlink the managed state file only if restoring
      succeeded.
      
      2) For "virsh save dom; virsh restore dom;", it can cause data
      corruption if one reuse the saved state file for restoring. Add
      doc to tell user about it.
      
      3) In "qemuDomainObjStart", if "managed_save" is NULL, we shouldn't
      fallback to start the domain, skipping it to cleanup as a incidental
      fix. Discovered by Eric.
      a73bbfc8
  4. 05 4月, 2011 1 次提交
    • E
      build: detect potentential uninitialized variables · 0d166c6b
      Eric Blake 提交于
      Even with -Wuninitialized (which is part of autobuild.sh
      --enable-compile-warnings=error), gcc does NOT catch this
      use of an uninitialized variable:
      
      {
        if (cond)
          goto error;
        int a = 1;
      error:
        printf("%d", a);
      }
      
      which prints 0 (supposing the stack started life wiped) if
      cond was true.  Clang will catch it, but we don't use clang
      as often.  Using gcc -Wjump-misses-init catches it, but also
      gives false positives:
      
      {
        if (cond)
          goto error;
        int a = 1;
        return a;
      error:
        return 0;
      }
      
      Here, a was never used in the scope of the error block, so
      declaring it after goto is technically fine (and clang agrees).
      However, given that our HACKING already documents a preference
      to C89 decl-before-statement, the false positive warning is
      enough of a prod to comply with HACKING.
      
      [Personally, I'd _really_ rather use C99 decl-after-statement
      to minimize scope, but until gcc can efficiently and reliably
      catch scoping and uninitialized usage bugs, I'll settle with
      the compromise of enforcing a coding standard that happens to
      reject false positives if it can also detect real bugs.]
      
      * acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Add -Wjump-misses-init.
      * src/util/util.c (__virExec): Adjust offenders.
      * src/conf/domain_conf.c (virDomainTimerDefParseXML): Likewise.
      * src/remote/remote_driver.c (doRemoteOpen): Likewise.
      * src/phyp/phyp_driver.c (phypGetLparNAME, phypGetLparProfile)
      (phypGetVIOSFreeSCSIAdapter, phypVolumeGetKey)
      (phypGetStoragePoolDevice)
      (phypVolumeGetPhysicalVolumeByStoragePool)
      (phypVolumeGetPath): Likewise.
      * src/vbox/vbox_tmpl.c (vboxNetworkUndefineDestroy)
      (vboxNetworkCreate, vboxNetworkDumpXML)
      (vboxNetworkDefineCreateXML): Likewise.
      * src/xenapi/xenapi_driver.c (getCapsObject)
      (xenapiDomainDumpXML): Likewise.
      * src/xenapi/xenapi_utils.c (createVMRecordFromXml): Likewise.
      * src/security/security_selinux.c (SELinuxGenNewContext):
      Likewise.
      * src/qemu/qemu_command.c (qemuBuildCommandLine): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextGetPtyPaths):
      Likewise.
      * src/qemu/qemu_driver.c (qemudDomainShutdown)
      (qemudDomainBlockStats, qemudDomainMemoryPeek): Likewise.
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendCreateIfaceIQN): Likewise.
      * src/node_device/node_device_udev.c (udevProcessPCI): Likewise.
      0d166c6b
  5. 01 4月, 2011 1 次提交
    • W
      free tmp after unlinking it · e206946d
      Wen Congyang 提交于
      We create a temporary file to save memory, and we will remove it after reading
      memory to buffer. But we free the variable that contains the temporary filename
      before we remove it. So we should free tmp after unlinking it.
      e206946d
  6. 30 3月, 2011 2 次提交
    • H
      qemu: unlock qemu driver before return from domain save · 025e1998
      Hu Tao 提交于
      qemuDriverUnlock() wasn't called on 2 exit paths
      * src/qemu/qemu_driver.c: fix qemudDomainSave() to always unlock
        the driver before exiting on error
      025e1998
    • N
      extend logging to record configuration-related changes · 343a27af
      Naoya Horiguchi 提交于
      Currently libvirt's default logging is limited and it is difficult to
      determine what was happening when a proglem occurred (especially on a
      machines where one don't know the detail.)  This patch helps to do that
      by making additional logging available for the following events:
      
        creating/defining/undefining domains
        creating/defining/undefining/starting/stopping networks
        creating/defining/undefining/starting/stopping storage pools
        creating/defining/undefining/starting/stopping storage volumes.
      
      * AUTHORS: add Naoya Horiguchi
      * src/network/bridge_driver.c src/qemu/qemu_driver.c
        src/storage/storage_driver.c: provide more VIR_INFO logging
      343a27af
  7. 29 3月, 2011 9 次提交
    • 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
    • D
      Enhance the streams helper to support plain file I/O · e886237a
      Daniel P. Berrange 提交于
      The O_NONBLOCK flag doesn't work as desired on plain files
      or block devices. Introduce an I/O helper program that does
      the blocking I/O operations, communicating over a pipe that
      can support O_NONBLOCK
      
      * src/fdstream.c, src/fdstream.h: Add non-blocking I/O
        on plain files/block devices
      * src/Makefile.am, src/util/iohelper.c: I/O helper program
      * src/qemu/qemu_driver.c, src/lxc/lxc_driver.c,
        src/uml/uml_driver.c, src/xen/xen_driver.c: Update for
        streams API change
      e886237a
    • E
      qemu: fix regression that hangs on save failure · 83b77fa5
      Eric Blake 提交于
      Regression introduced in commit 6034ddd5.
      
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Jump to correct
      label.
      83b77fa5
    • 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
  8. 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
  9. 25 3月, 2011 1 次提交
  10. 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
  11. 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
  12. 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
  13. 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
  14. 11 3月, 2011 4 次提交
  15. 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
  16. 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
  17. 08 3月, 2011 2 次提交
  18. 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