1. 29 3月, 2011 40 次提交
    • O
      cputune: Support cputune for xend driver · 01692bb1
      Osier Yang 提交于
      Not sure if it's the correct way to add cputune xml for xend driver,
      and besides, seems "xm driver" and "xen hypervisor" also support
      vcpu affinity, do we need to add support for them too?
      01692bb1
    • O
      cputune: Support cputune for lxc driver · e98eb7f4
      Osier Yang 提交于
      LXC driver doesn't support vcpu affinity yet, so just need
      to modify it to support cpu shares.
      e98eb7f4
    • 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
    • O
      cputune: Implementations of parsing and formating cputune xml · b8853925
      Osier Yang 提交于
      Implementations of following functions:
        virDomainVcpupinIsDuplicate
        virDomainVcpupinFindByVcpu
        virDomainVcpupinAdd
      
      Update "virDomainDefParseXML" to parse, and "virDomainDefFormatXML"
      to build cputune xml, also implementations of new internal helper
      functions.
      
      v1 - v2:
        * Resolve potential crash bug of "virDomainVcpupinAdd"
      b8853925
    • O
      cputune: Add data structures presenting cputune XML · 853f0fdf
      Osier Yang 提交于
      Also related new functions' declaration, and expose the new introduced
      functions in libvirt_private.syms.
      
      v1 - v2:
        Don't expose "virAllocVar" in libvirt_private.syms
      853f0fdf
    • O
      cputune: Add document for cputune XML · 6b364420
      Osier Yang 提交于
      v1 - v3:
        * More clear document for "cpu shares", adopted suggestions from
          Matthias Bottle and Daniel Veillard.
      6b364420
    • O
      cputune: Add XML schema for cputune xml · e3ea8828
      Osier Yang 提交于
      v1 - v2:
        * Remove upper limit of cpu shares. (Suggested by Matthias Bottle)
      e3ea8828
    • E
      qemu: fix regression with fd labeling on migration · daa6aa68
      Eric Blake 提交于
      My earlier testing for commit 34fa0de0 was done while starting
      just-built libvirt from an unconfined_t shell, where the fds happened
      to work when transferring to qemu.  But when installed and run under
      virtd_t, failure to label the raw file (with no compression) or the
      pipe (with compression) triggers SELinux failures when passing fds
      over SCM_RIGHTS to svirt_t qemu.
      
      * src/qemu/qemu_migration.c (qemuMigrationToFile): When passing
      FDs, make sure they are labeled.
      daa6aa68
    • E
      qemu: improve error message on failed fd transfer · 285e8a17
      Eric Blake 提交于
      First fallout of fd: migration - it looks like SELinux enforcing
      _does_ require fd labeling (running uninstalled libvirtd from an
      unconstrained shell had no problems, but once faked out by doing
       chcon `stat -c %C /usr/sbin/libvirtd` daemon/libvirtd
       run_init $PWD/daemon/libvirtd
      to run it with the same context as an init script service, and with
      SELinux enforcing, I got a rather confusing failure:
      error: Failed to save domain fedora_12 to fed12.img
      error: internal error unable to send TAP file handle: No file descriptor supplied via SCM_RIGHTS
      
      This fixes the error message, then I need to figure out a subsequent
      patch that does the fsetfilecon() necessary to keep things happy.
      It also appears that libvirtd hangs on a failed fd transfer; I don't
      know if that needs an independent fix.
      
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextSendFileHandle):
      Improve message, since TAP is no longer only client.
      285e8a17
    • E
      maint: ignore new built file · e54a2f93
      Eric Blake 提交于
      * .gitignore: Exclude libvirt_iohelper.
      e54a2f93
    • M
      Add domainSuspend/Resume to libxl driver · 6ebcb0c7
      Markus Groß 提交于
      * src/libxl/libxl_driver.c: implements libxlDomainSuspend and
        libxlDomainResume
      6ebcb0c7
    • M
      Add domainGetOSType to libxl driver · f367a1df
      Markus Groß 提交于
      * src/libxl/libxl_driver.c: implements libxlDomainGetOSType
      f367a1df
    • M
      Add domainGetSchedulerType to libxl driver · d53bca48
      Markus Groß 提交于
      * src/libxl/libxl_driver.c: implements libxlDomainGetSchedulerType
      d53bca48
    • M
      Implements domainXMLTo/FromNative in libxl driver · 02449771
      Markus Groß 提交于
      * src/Makefile.am src/libvirt_private.syms configure.ac: share and
        reuse the sexpr routines from sexpr.h of the old xen driver
      * src/libxl/libxl_driver.c: implements libxlDomainXMLFromNative and
        libxlDomainXMLToNative
      02449771
    • M
      Add vcpu functions to libxl driver · 3d6fe99c
      Markus Groß 提交于
      Hook the virtual cpu functions to their libxenlight counterparts
      
      * src/libxl/libxl_driver.c: implements libxlDomainSetVcpus,
        libxlDomainGetVcpus, libxlDomainSetVcpusFlags,
        libxlDomainGetVcpusFlags and libxlDomainPinVcpu
      3d6fe99c
    • M
      List authors in copyright headers · cbf2717c
      Markus Groß 提交于
      * src/libxl/libxl_conf.[ch] src/libxl/libxl_driver.[ch]: add authors
        after the licence template
      cbf2717c
    • M
      Add event callbacks to libxl driver · 68e10323
      Markus Groß 提交于
      * src/libxl/libxl_conf.h: add the necessary fields to the driver
        private structure
      * src/libxl/libxl_driver.c: add lifecycle event support and entry
        points for event(de)register(any)
      68e10323
    • M
      Ignore return value of virDomainObjUnref · 6d60ca5d
      Markus Groß 提交于
      * src/libxl/libxl_driver.c: use ignore_value() in libxlDomainObjUnref
        and libxlCreateDomEvents
      6d60ca5d
    • D
      Fix infinite loop in daemon if client quits with multiple streams open · 88416593
      Daniel P. Berrange 提交于
      The daemon loops over the linked list of streams when a client
      quits, closing any that the client hadn't already closed. Except
      it didn't ever move to the next element in the list!
      
      * daemon/stream.c: Fix loop over linked list of streams
      88416593
    • D
      Remote protocol support for storage vol upload/download APIs · 230a5d8b
      Daniel P. Berrange 提交于
      * daemon/remote.c, src/remote/remote_driver.c: Implementation
        of storage vol upload/download APIs
      * src/remote/remote_protocol.x: Wire protocol definition for
        upload/download
      * daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
        daemon/remote_dispatch_table.h, src/remote/remote_protocol.h,
        src/remote/remote_protocol.c: Re-generate
      230a5d8b
    • D
      Support volume data upload/download APIs in storage driver · 92563962
      Daniel P. Berrange 提交于
      Use generic FD streams to allow data upload/download to/from
      any storage volume
      
      * src/storage/storage_driver.c: Wire up upload/download APIs
      92563962
    • D
      Add vol-upload and vol-download commands to virsh · 6299ca71
      Daniel P. Berrange 提交于
      The new commands vol-upload and vol-download, allow a local file
      to be transferred to/from a storage volume.
      
      * tools/virsh.c: Add vol-upload and vol-download commands
      * tools/virsh.pod: Document new commands
      6299ca71
    • D
      Add public APIs for storage volume upload/download · 7300f68d
      Daniel P. Berrange 提交于
      New APIs are added allowing streaming of content to/from
      storage volumes.
      
      * include/libvirt/libvirt.h.in: Add virStorageVolUpload and
        virStorageVolDownload APIs
      * src/driver.h, src/libvirt.c, src/libvirt_public.syms: Stub
        code for new APIs
      * src/storage/storage_driver.c, src/esx/esx_storage_driver.c:
        Add dummy entries in driver table for new APIs
      7300f68d
    • 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
    • D
      Update event loop example programs to demonstrate best practice · 0c97e70b
      Daniel P. Berrange 提交于
      The example C event loop code is a nasty hack and not compliant
      with the require API semantics. Delete this, so that developers
      don't mistakenly copy it. Instead call the new public event loop
      APIs.
      
      Update the python event loop example, so that it can optionally
      use the public event APIs, as an alternative to the pure python
      code. The pure python event code is a good working example, so
      don't delete it.
      
      Also make the python example use a read only connection to avoid
      authentication prompts
      
      * examples/domain-events/events-c/event-test.c: Replace event
        loop code with use of public APIs
      * examples/domain-events/events-python/event-test.py: Allow
        optional use of new public event APIs
      0c97e70b
    • 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
      build: fix compilation on mingw · 16a4243c
      Eric Blake 提交于
      * src/util/command.c (virCommandAbort) [WIN32]: Provide stub.
      Reported by Daniel P. Berrange's autobuilder.
      16a4243c
    • E
      qemu: support fd: migration with compression · 15d757ac
      Eric Blake 提交于
      Spawn the compressor ourselves, instead of requiring the shell.
      
      * src/qemu/qemu_migration.c (qemuMigrationToFile): Spawn
      compression helper process when needed.
      15d757ac
    • E
      qemu: skip granting access during fd migration · 34fa0de0
      Eric Blake 提交于
      SELinux labeling and cgroup ACLs aren't required if we hand a
      pre-opened fd to qemu.  All the more reason to love fd: migration.
      
      * src/qemu/qemu_migration.c (qemuMigrationToFile): Skip steps
      that are irrelevant in fd migration.
      34fa0de0
    • 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: adjust indentation in previous patch · fa3e1e35
      Eric Blake 提交于
      Separating the indentation from the real patch made review easier.
      
      * src/util/util.c (virFileOpenAs): Whitespace changes.
      fa3e1e35
    • 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
      storage: simplify fd handling · fe303a42
      Eric Blake 提交于
      * src/storage/storage_backend.c (virStorageBackendCreateRaw): Use
      new virFileOperation flag.
      fe303a42
    • 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
      util: use SCM_RIGHTS in virFileOperation when needed · 055d4ff8
      Eric Blake 提交于
      Currently, the hook function in virFileOperation is extremely limited:
      it must be async-signal-safe, and cannot modify any memory in the
      parent process.  It is much handier to return a valid fd and operate
      on it in the parent than to deal with hook restrictions.
      
      * src/util/util.h (VIR_FILE_OP_RETURN_FD): New flag.
      * src/util/util.c (virFileOperationNoFork, virFileOperation):
      Honor new flag.
      055d4ff8
    • 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
    • E
      qemu: fix restoring a compressed save image · d51023d4
      Eric Blake 提交于
      Latent bug introduced in commit 2d6a5819 (Aug 2009), but not exposed
      until commit 1859939a (Jan 2011).  Basically, when virExec creates a
      pipe, it always marks libvirt's side as cloexec.  If libvirt then
      wants to hand that pipe to another child process, things work great if
      the fd is dup2()'d onto stdin or stdout (as with stdin: or exec:
      migration), but if the pipe is instead used as-is (such as with fd:
      migration) then qemu sees EBADF because the fd was closed at exec().
      
      This is a minimal fix for the problem at hand; it is slightly racy,
      but no more racy than the rest of libvirt fd handling, including the
      case of uncompressed save images.  A more invasive fix, but ultimately
      safer at avoiding leaking unintended fds, would be to _always and
      atomically_ open all fds as cloexec in libvirt (thanks to primitives
      like open(O_CLOEXEC), pipe2(), accept4(), ...), then teach virExec to
      clear that bit for all fds explicitly marked to be handed to the child
      only after forking.
      
      * src/qemu/qemu_command.c (qemuBuildCommandLine): Clear cloexec
      flag.
      * tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Tweak test.
      d51023d4
    • E
      util: allow clearing cloexec bit · 296eb0bb
      Eric Blake 提交于
      * src/util/util.h (virSetInherit): New prototype.
      * src/util/util.c (virSetCloseExec): Move guts...
      (virSetInherit): ...to new function, and allow clearing.
      * src/libvirt_private.syms (util.h): Export it.
      296eb0bb