1. 26 3月, 2010 11 次提交
    • D
      Implement VNC password change in QEMU · ab952024
      Daniel P. Berrange 提交于
      Use the new virDomainUpdateDeviceFlags API to allow the VNC password
      to be changed on the fly
      
      * src/internal.h: Define STREQ_NULLABLE() which is like STREQ()
        but does not crash if either argument is NULL, and treats two
        NULLs as equal.
      * src/libvirt_private.syms: Export virDomainGraphicsTypeToString
      * src/qemu/qemu_driver.c: Support VNC password change on a live
        machine
      * src/qemu/qemu_monitor.c: Disable crazy debugging info. Treat a
        NULL password as "" (empty string), allowing passwords to be
        disabled in the monitor
      ab952024
    • D
      Implement virDomainUpdateDeviceFlags API in all drivers with media change · 6bb4986b
      Daniel P. Berrange 提交于
      To allow the new virDomainUpdateDeviceFlags() API to be universally
      used with all drivers, this patch adds an impl to all the current
      drivers which support CDROM or Floppy disk media change via the
      current virDomainAttachDeviceFlags API
      
      * src/qemu/qemu_driver.c, src/vbox/vbox_tmpl.c,
        src/xen/proxy_internal.c, src/xen/xen_driver.c,
        src/xen/xend_internal.c: Implement media change via the
        virDomainUpdateDeviceFlags API
      * src/xen/xen_driver.h, src/xen/xen_hypervisor.c,
        src/xen/xen_inotify.c, src/xen/xm_internal.c,
        src/xen/xs_internal.c: Stubs for Xen driver entry points
      6bb4986b
    • D
      Introduce a new virDomainUpdateDeviceFlags public API · 46a2ea36
      Daniel P. Berrange 提交于
      The current virDomainAttachDevice API can be (ab)used to change
      the media of an existing CDROM/Floppy device. Going forward there
      will be more devices that can be configured on the fly and overloading
      virDomainAttachDevice for this is not too pleasant. This patch adds
      a new virDomainUpdateDeviceFlags() explicitly just for modifying
      existing devices.
      
      * include/libvirt/libvirt.h.in: Add virDomainUpdateDeviceFlags
      * src/driver.h: Internal API for virDomainUpdateDeviceFlags
      * src/libvirt.c, src/libvirt_public.syms: Glue public API to
        driver API
      * 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/xen/xen_driver.c, src/xenapi/xenapi_driver.c: Add
        stubs for new driver entry point
      46a2ea36
    • D
      Add domain events for graphics network clients · 987e31ed
      Daniel P. Berrange 提交于
      This introduces a new event type
      
         VIR_DOMAIN_EVENT_ID_GRAPHICS
      
      The same event can be emitted in 3 scenarios
      
        typedef enum {
            VIR_DOMAIN_EVENT_GRAPHICS_CONNECT = 0,
            VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE,
            VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT,
        } virDomainEventGraphicsPhase;
      
      Connect/disconnect are triggered at socket accept/close.
      The initialize phase is immediately after the protocol
      setup and authentication has completed. ie when the
      client is authorized and about to start interacting with
      the graphical desktop
      
      This event comes with *a lot* of potential information
      
       - IP address, port & address family of client
       - IP address, port & address family of server
       - Authentication scheme (arbitrary string)
       - Authenticated subject identity. A subject may have
         multiple identities with some authentication schemes.
         For example, vencrypt+sasl results in a x509dname
         and saslUsername identities.
      
      This results in a very complicated callback :-(
      
         typedef enum {
            VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4,
            VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6,
         } virDomainEventGraphicsAddressType;
      
         struct _virDomainEventGraphicsAddress {
             int family;
             const char *node;
             const char *service;
         };
         typedef struct _virDomainEventGraphicsAddress virDomainEventGraphicsAddress;
         typedef virDomainEventGraphicsAddress *virDomainEventGraphicsAddressPtr;
      
         struct _virDomainEventGraphicsSubject {
            int nidentity;
            struct {
                const char *type;
                const char *name;
            } *identities;
         };
         typedef struct _virDomainEventGraphicsSubject virDomainEventGraphicsSubject;
         typedef virDomainEventGraphicsSubject *virDomainEventGraphicsSubjectPtr;
      
         typedef void (*virConnectDomainEventGraphicsCallback)(virConnectPtr conn,
                                                               virDomainPtr dom,
                                                               int phase,
                                                               virDomainEventGraphicsAddressPtr local,
                                                               virDomainEventGraphicsAddressPtr remote,
                                                               const char *authScheme,
                                                               virDomainEventGraphicsSubjectPtr subject,
                                                               void *opaque);
      
      The wire protocol is similarly complex
      
         struct remote_domain_event_graphics_address {
           int family;
           remote_nonnull_string node;
           remote_nonnull_string service;
         };
      
         const REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX = 20;
      
         struct remote_domain_event_graphics_identity {
           remote_nonnull_string type;
           remote_nonnull_string name;
         };
      
         struct remote_domain_event_graphics_msg {
           remote_nonnull_domain dom;
           int phase;
           remote_domain_event_graphics_address local;
           remote_domain_event_graphics_address remote;
           remote_nonnull_string authScheme;
           remote_domain_event_graphics_identity subject<REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX>;
         };
      
      This is currently implemented in QEMU for the VNC graphics
      protocol, but designed to be usable with SPICE graphics in
      the future too.
      
      * daemon/remote.c: Dispatch graphics events to client
      * examples/domain-events/events-c/event-test.c: Watch for
        graphics events
      * include/libvirt/libvirt.h.in: Define new graphics event ID
        and callback signature
      * src/conf/domain_event.c, src/conf/domain_event.h,
        src/libvirt_private.syms: Extend API to handle graphics events
      * src/qemu/qemu_driver.c: Connect to the QEMU monitor event
        for VNC events and emit a libvirt graphics event
      * src/remote/remote_driver.c: Receive and dispatch graphics
        events to application
      * src/remote/remote_protocol.x: Wire protocol definition for
        graphics events
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c: Watch for VNC_CONNECTED,
        VNC_INITIALIZED & VNC_DISCONNETED events from QEMU monitor
      987e31ed
    • D
      Add support for an explicit IO error event · 71d793fa
      Daniel P. Berrange 提交于
      This introduces a new event type
      
         VIR_DOMAIN_EVENT_ID_IO_ERROR
      
      This event includes the action that is about to be taken
      as a result of the watchdog triggering
      
        typedef enum {
           VIR_DOMAIN_EVENT_IO_ERROR_NONE = 0,
           VIR_DOMAIN_EVENT_IO_ERROR_PAUSE,
           VIR_DOMAIN_EVENT_IO_ERROR_REPORT,
        } virDomainEventIOErrorAction;
      
      In addition it has the source path of the disk that had the
      error and its unique device alias. It does not include the
      target device name (/dev/sda), since this would preclude
      triggering IO errors from other file backed devices (eg
      serial ports connected to a file)
      
      Thus there is a new callback definition for this event type
      
      typedef void (*virConnectDomainEventIOErrorCallback)(virConnectPtr conn,
                                                           virDomainPtr dom,
                                                           const char *srcPath,
                                                           const char *devAlias,
                                                           int action,
                                                           void *opaque);
      
      This is currently wired up to the QEMU block IO error events
      
      * daemon/remote.c: Dispatch IO error events to client
      * examples/domain-events/events-c/event-test.c: Watch for
        IO error events
      * include/libvirt/libvirt.h.in: Define new IO error event ID
        and callback signature
      * src/conf/domain_event.c, src/conf/domain_event.h,
        src/libvirt_private.syms: Extend API to handle IO error events
      * src/qemu/qemu_driver.c: Connect to the QEMU monitor event
        for block IO errors and emit a libvirt IO error event
      * src/remote/remote_driver.c: Receive and dispatch IO error
        events to application
      * src/remote/remote_protocol.x: Wire protocol definition for
        IO error events
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c: Watch for BLOCK_IO_ERROR event
        from QEMU monitor
      71d793fa
    • D
      Add support for an explicit watchdog event · c5728cd6
      Daniel P. Berrange 提交于
      This introduces a new event type
      
         VIR_DOMAIN_EVENT_ID_WATCHDOG
      
      This event includes the action that is about to be taken
      as a result of the watchdog triggering
      
       typedef enum {
           VIR_DOMAIN_EVENT_WATCHDOG_NONE = 0,
           VIR_DOMAIN_EVENT_WATCHDOG_PAUSE,
           VIR_DOMAIN_EVENT_WATCHDOG_RESET,
           VIR_DOMAIN_EVENT_WATCHDOG_POWEROFF,
           VIR_DOMAIN_EVENT_WATCHDOG_SHUTDOWN,
           VIR_DOMAIN_EVENT_WATCHDOG_DEBUG,
       } virDomainEventWatchdogAction;
      
      Thus there is a new callback definition for this event type
      
       typedef void (*virConnectDomainEventWatchdogCallback)(virConnectPtr conn,
                                                             virDomainPtr dom,
                                                             int action,
                                                             void *opaque);
      
      * daemon/remote.c: Dispatch watchdog events to client
      * examples/domain-events/events-c/event-test.c: Watch for
        watchdog events
      * include/libvirt/libvirt.h.in: Define new watchdg event ID
        and callback signature
      * src/conf/domain_event.c, src/conf/domain_event.h,
        src/libvirt_private.syms: Extend API to handle watchdog events
      * src/qemu/qemu_driver.c: Connect to the QEMU monitor event
        for watchdogs and emit a libvirt watchdog event
      * src/remote/remote_driver.c: Receive and dispatch watchdog
        events to application
      * src/remote/remote_protocol.x: Wire protocol definition for
        watchdog events
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c: Watch for WATCHDOG event
        from QEMU monitor
      c5728cd6
    • D
      Add support for an explicit RTC change event · 32e6ac9c
      Daniel P. Berrange 提交于
      This introduces a new event type
      
         VIR_DOMAIN_EVENT_ID_RTC_CHANGE
      
      This event includes the new UTC offset measured in seconds.
      Thus there is a new callback definition for this event type
      
       typedef void (*virConnectDomainEventRTCChangeCallback)(virConnectPtr conn,
                                                              virDomainPtr dom,
                                                              long long utcoffset,
                                                              void *opaque);
      
      If the guest XML configuration for the <clock> is set to
      offset='variable', then the XML will automatically be
      updated with the new UTC offset value. This ensures that
      during migration/save/restore the new offset is preserved.
      
      * daemon/remote.c: Dispatch RTC change events to client
      * examples/domain-events/events-c/event-test.c: Watch for
        RTC change events
      * include/libvirt/libvirt.h.in: Define new RTC change event ID
        and callback signature
      * src/conf/domain_event.c, src/conf/domain_event.h,
        src/libvirt_private.syms: Extend API to handle RTC change events
      * src/qemu/qemu_driver.c: Connect to the QEMU monitor event
        for RTC changes and emit a libvirt RTC change event
      * src/remote/remote_driver.c: Receive and dispatch RTC change
        events to application
      * src/remote/remote_protocol.x: Wire protocol definition for
        RTC change events
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c: Watch for RTC_CHANGE event
        from QEMU monitor
      32e6ac9c
    • D
      Add support for an explicit guest reboot event · 86132734
      Daniel P. Berrange 提交于
      The reboot event is not a normal lifecycle event, since the
      virtual machine on the host does not change state. Rather the
      guest OS is resetting the virtual CPUs. ie, the QEMU process
      does not restart. Thus, this does not belong in the current
      lifecycle events callback.
      
      This introduces a new event type
      
          VIR_DOMAIN_EVENT_ID_REBOOT
      
      It takes no parameters, besides the virDomainPtr, so it can
      use the generic callback signature.
      
      * daemon/remote.c: Dispatch reboot events to client
      * examples/domain-events/events-c/event-test.c: Watch for
        reboot events
      * include/libvirt/libvirt.h.in: Define new reboot event ID
      * src/conf/domain_event.c, src/conf/domain_event.h,
        src/libvirt_private.syms: Extend API to handle reboot events
      * src/qemu/qemu_driver.c: Connect to the QEMU monitor event
        for reboots and emit a libvirt reboot event
      * src/remote/remote_driver.c: Receive and dispatch reboot
        events to application
      * src/remote/remote_protocol.x: Wire protocol definition for
        reboot events
      86132734
    • D
      Support new event register/deregister APis in all drivers except remote · cef0967e
      Daniel P. Berrange 提交于
      The libvirtd daemon impl will need to switch over to using the
      new event APIs. To make this simpler, ensure all drivers currently
      providing events support both the new APIs and old APIs.
      
      * src/lxc/lxc_driver.c, src/qemu/qemu_driver.c, src/test/test_driver.c,
        src/vbox/vbox_tmpl.c, src/xen/xen_driver.c: Implement the new
        virConnectDomainEvent(Dereg|Reg)isterAny driver entry points
      cef0967e
    • D
      Refactor domain events to handle multiple event types · 747c5363
      Daniel P. Berrange 提交于
      The internal domain events APIs are designed to handle the lifecycle
      events. This needs to be refactored to allow arbitrary new event
      types to be handled.
      
       * The signature of virDomainEventDispatchFunc changes to use
         virConnectDomainEventGenericCallback instead of the lifecycle
         event specific virConnectDomainEventCallback
       * Every registered callback gains a unique ID to allow its
         removal based on ID, instead of function pointer
       * Every registered callback gains an 'eventID' to allow callbacks
         for different types of events to be distinguished
       * virDomainEventDispatch is adapted to filter out callbacks
         whose eventID does not match the eventID of the event being
         dispatched
       * virDomainEventDispatch is adapted to filter based on the
         domain name and uuid, if this filter is set for a callback.
       * virDomainEvent type/detail fields are moved into a union to
         allow different data fields for other types of events to be
         added later
      
      * src/conf/domain_event.h, src/conf/domain_event.c: Refactor
        to allow handling of different types of events
      * src/lxc/lxc_driver.c, src/qemu/qemu_driver.c,
        src/remote/remote_driver.c, src/test/test_driver.c,
        src/xen/xen_driver.c: Change dispatch function signature
        to use virConnectDomainEventGenericCallback
      747c5363
    • D
      Introduce a new public API for domain events · 44457238
      Daniel P. Berrange 提交于
      The current API for domain events has a number of problems
      
       - Only allows for domain lifecycle change events
       - Does not allow the same callback to be registered multiple times
       - Does not allow filtering of events to a specific domain
      
      This introduces a new more general purpose domain events API
      
        typedef enum {
           VIR_DOMAIN_EVENT_ID_LIFECYCLE = 0,       /* virConnectDomainEventCallback */
            ...more events later..
        }
      
        int virConnectDomainEventRegisterAny(virConnectPtr conn,
                                             virDomainPtr dom, /* Optional, to filter */
                                             int eventID,
                                             virConnectDomainEventGenericCallback cb,
                                             void *opaque,
                                             virFreeCallback freecb);
      
        int virConnectDomainEventDeregisterAny(virConnectPtr conn,
                                               int callbackID);
      
      Since different event types can received different data in the callback,
      the API is defined with a generic callback. Specific events will each
      have a custom signature for their callback. Thus when registering an
      event it is neccessary to cast the callback to the generic signature
      
      eg
      
        int myDomainEventCallback(virConnectPtr conn,
                                  virDomainPtr dom,
                                  int event,
                                  int detail,
                                  void *opaque)
        {
          ...
        }
      
        virConnectDomainEventRegisterAny(conn, NULL,
                                         VIR_DOMAIN_EVENT_ID_LIFECYCLE,
                                         VIR_DOMAIN_EVENT_CALLBACK(myDomainEventCallback)
                                         NULL, NULL);
      
      The VIR_DOMAIN_EVENT_CALLBACK() macro simply does a "bad" cast
      to the generic signature
      
      * include/libvirt/libvirt.h.in: Define new APIs for registering
        domain events
      * src/driver.h: Internal driver entry points for new events APIs
      * src/libvirt.c: Wire up public API to driver API for events APIs
      * src/libvirt_public.syms: Export new APIs
      * 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/xen/xen_driver.c,
        src/xenapi/xenapi_driver.c: Stub out new API entries
      44457238
  2. 22 3月, 2010 1 次提交
    • G
      Don't crash without a security driver · b7a7b336
      Guido Günther 提交于
      "virsh dominfo <vm>" crashes if there's no primary security driver set
      since we only intialize the secmodel.model and secmodel.doi if we have
      one. Attached patch checks for securityPrimaryDriver instead of
      securityDriver since the later is always set in qemudSecurityInit().
      
      Closes: http://bugs.debian.org/574359
      b7a7b336
  3. 20 3月, 2010 2 次提交
  4. 19 3月, 2010 2 次提交
    • L
      Support vhost-net mode at qemu startup for virtio network devices · 598a0c00
      Laine Stump 提交于
      Attempt to turn on vhost-net mode for devices of type NETWORK, BRIDGE,
      and DIRECT (macvtap).
      
      * src/qemu/qemu_conf.h: add vhostfd to qemuBuildHostNetStr prototype
        add qemudOpenVhostNet prototype new flag to set when :,vhost=" found in
        qemu help
      * src/qemu/qemu_conf.c: * set QEMUD_CMD_FLAG_VNET_HOST is ",vhost=" found
        in qemu help
         - qemudOpenVhostNet - opens /dev/vhost-net to pass to qemu if everything
           is in place to use it.
         - qemuBuildHostNetStr - add vhostfd to commandline if it's not empty
           (higher levels decide whether or not to fill it in)
         - qemudBuildCommandLine - if /dev/vhost-net is successfully opened, add
           its fd to tapfds array so it isn't closed on qemu exec, and populate
           vhostfd_name to be passed in to commandline builder.
      * src/qemu/qemu_driver.c: add filler 0 for new arg to qemuBuildHostNetStr,
        along with a note that this must be implemented in order for hot-plug of
        vhost-net virtio devices to work properly (once qemu "netdev_add" monitor
        command is implemented).
      598a0c00
    • M
      qemu: Fix FD leak in qemudStartVMDaemon · caad0a87
      Matthias Bolte 提交于
      The logfile FD is dup2'ed in __virExec in the child. The FD needs to
      be closed in the parent, otherwise it leaks.
      caad0a87
  5. 17 3月, 2010 1 次提交
    • J
      Allow suspend during live migration · 0c842417
      Jiri Denemark 提交于
      Currently no command can be sent to a qemu process while another job is
      active. This patch adds support for signaling long-running jobs (such as
      migration) so that other threads may request predefined operations to be
      done during such jobs. Two signals are defined so far:
          - QEMU_JOB_SIGNAL_CANCEL
          - QEMU_JOB_SIGNAL_SUSPEND
      
      The first one is used by qemuDomainAbortJob.
      
      The second one is used by qemudDomainSuspend for suspending a domain
      during migration, which allows for changing live migration into offline
      migration. However, there is a small issue in the way qemudDomainSuspend
      is currently implemented for migrating domains. The API calls returns
      immediately after signaling migration job which means it is asynchronous
      in this specific case.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      0c842417
  6. 16 3月, 2010 3 次提交
  7. 12 3月, 2010 2 次提交
    • C
      Fix hang in qemudDomainCoreDump. · d376b7d6
      Chris Lalancette 提交于
      Currently if you dump the core of a qemu guest with
      qemudDomainCoreDump, subsequent commands will hang
      up libvirtd.  This is because qemudDomainCoreDump
      uses qemuDomainWaitForMigrationComplete, which expects
      the qemuDriverLock to be held when it's called.  This
      patch does the simple thing and moves the qemuDriveUnlock
      to the end of the qemudDomainCoreDump so that the driver
      lock is held for the entirety of the call (as it is done
      in qemudDomainSave).  We will probably want to make the
      lock more fine-grained than that in the future, but
      we can fix both qemudDomainCoreDump and qemudDomainSave
      at the same time.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      d376b7d6
    • C
      Make sure qemudDomainSetVcpus doesn't hang. · 2c555d87
      Chris Lalancette 提交于
      The code to add job support into libvirtd caused a problem
      in qemudDomainSetVcpus.  In particular, a qemuDomainObjEndJob()
      call was added at the end of the function, but a
      corresponding qemuDomainObjBeginJob() was not.  Additionally,
      a call to qemuDomainObj{Enter,Exit}Monitor() was also missed
      in qemudDomainHotplugVcpus().  These missing calls conspired to
      cause a hang in the libvirtd process after the command was
      finished.  Fix this by adding the missing calls.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      2c555d87
  8. 11 3月, 2010 1 次提交
  9. 10 3月, 2010 1 次提交
  10. 08 3月, 2010 2 次提交
    • A
      Fix locking in qemudDomainMemoryStats · 5140a2f6
      Adam Litke 提交于
      When adding domainMemoryStats API support for the qemu driver, I didn't
      follow the locking rules exactly.  The job condition must be held when
      executing monitor commands.  This corrects the segfaults I was seeing
      when calling domainMemoryStats in a multi-threaded environment.
      
      * src/qemu/qemu_driver.c: in qemudDomainMemoryStats() add missing
        calls to qemuDomainObjBeginJob/qemuDomainObjEndJob
      5140a2f6
    • L
      Eliminate large stack buffer in doTunnelSendAll · ecb5cf7c
      Laine Stump 提交于
      doTunnelSendAll function (used by QEMU migration) uses a 64k buffer on
      the stack, which could be problematic. This patch replaces that with a
      buffer from the heap.
      
      While in the neighborhood, this patch also improves error reporting in
      the case that saferead fails - previously, virStreamAbort() was called
      (resetting errno) before reporting the error. It's been changed to
      report the error first.
      
      * src/qemu/qemu_driver.c: fix doTunnelSendAll() to use a malloc'ed
        buffer
      ecb5cf7c
  11. 06 3月, 2010 2 次提交
    • J
      qemudDomainAttachSCSIDisk: handle empty controller list · f5a6ce44
      Jim Meyering 提交于
      * src/qemu/qemu_driver.c (qemudDomainAttachSCSIDisk): Handle
      the (theoretical) case of an empty controller list, so that
      clang does not think the subsequent dereference of "cont"
      would dereference an undefined variable (due to preceding
      loop not iterating even once).
      f5a6ce44
    • J
      qemu restore: don't let corrupt input provoke unwarranted OOM · 1a4d5c95
      Jim Meyering 提交于
      * src/qemu/qemu_driver.c (qemudDomainRestore): A corrupt save file
      (in particular, a too-large header.xml_len value) would cause an
      unwarranted out-of-memory error.  Do not trust the just-read
      header.xml_len.  Instead, merely use that as a hint, and
      read/allocate up to that number of bytes from the file.
      Also verify that header.xml_len is positive; if it were negative,
      passing it to virFileReadLimFD could cause trouble.
      1a4d5c95
  12. 05 3月, 2010 3 次提交
    • D
      Fix USB passthrough based on product/vendor · 09ed0729
      Daniel P. Berrange 提交于
      Changeset
      
        commit 5073aa99
        Author: Cole Robinson <crobinso@redhat.com>
        Date:   Mon Jan 11 11:40:46 2010 -0500
      
      Added support for product/vendor based passthrough, but it only
      worked at the security driver layer. The main guest XML config
      was not updated with the resolved bus/device ID. When the QEMU
      argv refactoring removed use of product/vendor, this then broke
      launching guests.
      
      THe solution is to move the product/vendor resolution up a layer
      into the QEMU driver. So the first thing QEMU does is resolve
      the product/vendor to a bus/device and updates the XML config
      with this info. The rest of the code, including security drivers
      and QEMU argv generated can now rely on bus/device always being
      set.
      
      * src/util/hostusb.c, src/util/hostusb.h: Split vendor/product
        resolution code out of usbGetDevice and into usbFindDevice.
        Add accessors for bus/device ID
      * src/security/virt-aa-helper.c, src/security/security_selinux.c,
        src/qemu/qemu_security_dac.c: Remove vendor/product from the
        usbGetDevice() calls
      * src/qemu/qemu_driver.c: Use usbFindDevice to resolve vendor/product
        into a bus/device ID
      09ed0729
    • D
      Convert QEMU driver all hotunplug code from pci_del to device_del · 84a25570
      Daniel P. Berrange 提交于
      The pci_del command is not being ported to QMP. Convert all the
      QEMU hotplug code over to use device_del whenever it is available
      to avoid the pci_del problem
      
      * src/qemu/qemu_driver.c: Convert unplug code to device_del
      84a25570
    • D
      Support hot-unplug for USB devices in QEMU · 8c82479d
      Daniel P. Berrange 提交于
      Previously hot-unplug could not be supported for USB devices
      in QEMU, since usb_del required the guest visible address
      which libvirt never knows. With 'device_del' command we can
      now unplug based on device alias, so support that.
      
      * src/qemu/qemu_driver.c: Use device_del to remove USB devices
      8c82479d
  13. 04 3月, 2010 5 次提交
    • D
      Support VCPU hotplug in QEMU guests · e8d6c289
      Daniel P. Berrange 提交于
      QEMU has a monitor command 'set_cpu' which allows a specific
      CPU to be toggled between online& offline state. libvirt CPU
      hotplug does not work in terms of individual indexes CPUs.
      Thus to support this, we iteratively toggle the online state
      when the total number of vCPUs is adjusted via libvirt
      
      NB, currently untested since QEMU segvs when running this!
      
      * src/qemu/qemu_driver.c: Toggle online state for CPUs when
        doing hotplug
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
        monitor API for toggling a CPU's online status via 'set_cpu
      e8d6c289
    • D
      Don't raise error message from cgroups if QEMU fails to start · b50d48b1
      Daniel P. Berrange 提交于
      The code to remove the cgroup after QEMU failed to startup could
      be obscuring a real error from earlier on. It is not neccessary
      to raise an error in this case, so tell cgroups to keep quiet
      
      * src/qemu/qemu_driver.c: Don't raise cgroups error in QEMU start
        cleanup code.
      b50d48b1
    • D
      Add missing device type check in QEMU PCI hotunplug · badfe6c7
      Daniel P. Berrange 提交于
      The QEMU hotunplug code for PCI devices was looking at host
      devices in the guest config without first filtering non
      PCI devices. This means it was reading garbage
      
      * src/qemu/qemu_driver.c: Filter out non-PCI devices
      badfe6c7
    • C
      Add a define for NFS_SUPER_MAGIC · 6ef5a5be
      Chris Lalancette 提交于
      Commit 3c12a67b added
      a dependency on the NFS_SUPER_MAGIC macro, which is
      defined in linux/magic.h.  Unfortunately linux/magic.h
      is not available in RHEL-5, and causes a compile error.
      Just define it locally, since this is something that
      can't change.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      6ef5a5be
    • L
      Make domain save work on root-squash NFS · 3c12a67b
      Laine Stump 提交于
      Move *all* file operations related to creation and writing of libvirt
      header to the domain save file into a hook function that is called by
      virFileOperation. First try to call virFileOperation as root. If that
      fails with EACCESS, and (in the case of Linux) statfs says that we're
      trying to save the file on an NFS share, rerun virFileOperation,
      telling it to fork a child process and setuid to the qemu user. This
      is the only way we can successfully create a file on a root-squashed
      NFS server.
      
      This patch (along with setting dynamic_ownership=0 in qemu.conf)
      makes qemudDomainSave work on root-squashed NFS.
      
      * src/qemu/qemu_driver.c: provide new qemudDomainSaveFileOpHook()
        utility, use it in qemudDomainSave() if normal creation of the
        file as root failed, and after checking the filesystem type for
        the storage is NFS. In that case we also bypass the security
        driver, as this would fail on NFS.
      3c12a67b
  14. 03 3月, 2010 4 次提交
    • L
      Fix domain restore for files on root-squash NFS · a03121bc
      Laine Stump 提交于
      If qemudDomainRestore fails to open the domain save file, create a
      pipe, then fork a process that does setuid(qemu_user) and opens the
      file, then reads this file and stuffs it into the pipe. the parent
      libvirtd process will use the other end of the pipe as its fd, then
      reap the child process after it's done reading.
      
      This makes domain restore work on a root-squash NFS share that is only
      visible to the qemu user.
      
      * src/qemu/qemu_driver.c: add new qemudOpenAsUID() helper function,
        and use it in qemudDomainRestore() if reading as root directly failed.
      a03121bc
    • D
      Fix USB/PCI device address aliases in QEMU hotplug driver · 9882123d
      Daniel P. Berrange 提交于
      The USB/PCI device hotplug code for the QEMU driver was forgetting
      to allocate a unique device alias.
      
      * src/qemu/qemu_driver.c: Fill in device alias for USB/PCI devices
      9882123d
    • D
      Fix QEMU domain state after a save attempt fails · cf104533
      Daniel P. Berrange 提交于
      When a VM save attempt failed, the VM would be left in a paused
      state. It is neccessary to resume CPU execution upon failure
      if it was running originally
      
      * src/qemu/qemu_driver.c: Resume CPUs upon save failure
      cf104533
    • D
      Support job cancellation in QEMU driver · 04c7abd9
      Daniel P. Berrange 提交于
      This supports cancellation of jobs for the QEMU driver against
      the virDomainMigrate, virDomainSave and virDomainCoreDump APIs.
      It is not yet supported for the virDomainRestore API, although
      it is desirable.
      
      * src/qemu/qemu_driver.c: Issue 'migrate_cancel' command if
        virDomainAbortJob is issued during a migration operation
      * tools/virsh.c: Add a domjobabort command
      04c7abd9