1. 05 4月, 2010 2 次提交
  2. 04 4月, 2010 2 次提交
    • D
      Implement managed save operations for qemu driver · 6e41f30e
      Daniel Veillard 提交于
      The images are saved in /var/lib/libvirt/qemu/save/
      and named $domainname.save . The directory is created appropriately
      at daemon startup. When a domain is started while a saved image is
      available, libvirt will try to load this saved image, and start the
      domain as usual in case of failure. In any case the saved image is
      discarded once the domain is created.
      
      * src/qemu/qemu_conf.h: adds an extra save path to the driver config
      * src/qemu/qemu_driver.c: implement the 3 new operations and handling
        of the image directory
      6e41f30e
    • D
      Add managed save API entry points · 15c647a9
      Daniel Veillard 提交于
      virDomainManagedSave() is to be run on a running domain. Once the call
      complete, as in virDomainSave() the domain is stopped upon completion,
      but there is no restore counterpart as any order to start the domain
      from the API would load the state from the managed file, similary if
      the domain is autostarted when libvirtd starts.
      Once a domain has restarted his managed save image is destroyed,
      basically managed save image can only exist for a stopped domain,
      for a running domain that would be by definition outdated data.
      
      * include/libvirt/libvirt.h.in src/libvirt.c src/libvirt_public.syms:
        adds the new entry points virDomainManagedSave(),
        virDomainHasManagedSaveImage() and virDomainManagedSaveRemove()
      * src/driver.h 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/vbox/vbox_tmpl.c
        src/remote/remote_driver.c src/test/test_driver.c src/uml/uml_driver.c
        src/xen/xen_driver.c: add corresponding new internal drivers entry
        points
      15c647a9
  3. 02 4月, 2010 2 次提交
    • L
      Changes to clock timer XML to match final design. · 4ee2b318
      Laine Stump 提交于
      The clock timer XML is being updated in the following ways (based on
      further off-list discussion that was missed during the initial
      implementation):
      
      1) 'wallclock' is changed to 'track', and the possible values are 'boot'
       (corresponds to old 'host'), 'guest', and 'wall'.
      
      2) 'mode' has an additional value 'smpsafe'
      
      3) when tickpolicy='catchup', there can be an optional sub-element of
         timer called 'catchup':
      
         <catchup threshold=123 slew=120 limit=10000/>
      
      Those three values are all longs, always optional, and if they are present,
      they are positive. Internally, 0 indicates "unspecified".
      
      * docs/schemas/domain.rng: updated RNG definition to account for changes
      
      * src/conf/domain_conf.h: change the C struct and enums to match changes.
      
      * src/conf/domain_conf.c: timer parse and format functions changed to
                                handle the new selections and new element.
      
      * src/libvirt_private.syms: *TimerWallclock* changes to *TimerTrack*
      
      * src/qemu/qemu_conf.c: again, account for Wallclock --> Track change.
      4ee2b318
    • C
      Don't use virFileReadLimFD in qemuDomainRestore. · d62f4c36
      Chris Lalancette 提交于
      virFileReadLimFD is a poor fit for reading the header
      of the restore file.  The problem is that virFileReadLimFD
      returns an error when there is more data after the amount
      you ask to read, but that is *expected* in this case.
      
      This patch is essentially a revert of
      1a4d5c95, but I don't think
      that commit does what it says anyway.  It purports to prevent
      an unwarranted OOM error, but since virFileReadLimFD will
      allocate memory up to the maximum anyway, the upper limit
      on the total amount of memory allocated is the same for either
      the old version or the new version.  Since the old saferead
      actually works and virFileReadLimFD does not, revert to
      using saferead.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      d62f4c36
  4. 01 4月, 2010 1 次提交
    • D
      Keep track of guest paused state after disk IO / watchdog events · cd2404a3
      Daniel P. Berrange 提交于
      When a watchdog/IO error occurs, one of the possible actions that
      QEMU might take is to pause the guest. In this scenario libvirt
      needs to update its internal state for the VM, and emit a
      lifecycle event:
      
        VIR_DOMAIN_EVENT_SUSPENDED
      
      with a detail being one of:
      
        VIR_DOMAIN_EVENT_SUSPENDED_IOERROR
        VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG
      
      To future proof against possible QEMU support for multiple monitor
      consoles, this patch also hooks into the 'STOPPED' event in QEMU
      and emits a generic VIR_DOMAIN_EVENT_SUSPENDED_PAUSED event
      
      * include/libvirt/libvirt.h.in: Add VIR_DOMAIN_EVENT_SUSPENDED_IOERROR
      * src/qemu/qemu_driver.c: Update VM state to paused when IO error
        or watchdog events occurrs
      * src/qemu/qemu_monitor_json.c: Fix typo in disk IO event name
      cd2404a3
  5. 31 3月, 2010 1 次提交
    • E
      maint: remove redundant tests after virStrToLong · 9d6614df
      Eric Blake 提交于
      virStrToLong* guarantees (via strtol) that the end pointer will be set
      to the point at which parsing stopped (even on failure, this point is
      the start of the input string).
      
      * src/esx/esx_driver.c (esxGetVersion): Remove pointless
      conditional.
      * src/qemu/qemu_conf.c (qemuParseCommandLinePCI)
      (qemuParseCommandLineUSB, qemuParseCommandLineSmp): Likewise.
      * src/qemu/qemu_monitor_text.c
      (qemuMonitorTextGetMigrationStatus): Likewise.
      9d6614df
  6. 30 3月, 2010 4 次提交
    • L
      Implement the qemu-kvm backend of clock timer elements · 8bf6799b
      Laine Stump 提交于
      Since the timers are defined to cover all possible config cases for
      several different hypervisors, many of these possibilities generate an
      error on qemu. Here is what is currently supported:
      
      RTC: If the -rtc commandline option is available, allow setting
      "clock=host"
           or "clock=vm" based on the rtc timer clock='host|guest' value. Also
           add "driftfix=slew" if the tickpolicy is 'catchup', or add nothing
      if
           tickpolicy is 'delay'. (Other tickpolicies will raise an error).
      
           If -rtc isn't available, but -rtc-td-hack is, add that option
           if the tickpolicy is 'catchup', add -rtc-td-hack, if it is 'delay'
           add nothing, and if it's anything else, raise an error.
      
      PIT: If -no-kvm-pit-reinjection is available, and tickpolicy is
           'delay', add that option. if tickpolicy is 'catchup', do
           nothing. Anything else --> raise an error.
      
           If -no-kvm-pit-reinjection *isn't* available, but -tdf is, when
           tickpolicy is 'catchup' add -tdf. If it's 'delay', do
           nothing. Anything else --> raise an error.
      
           If neither of those commandline options is available, and
           tickpolicy is anything other than 'delay' (or unspecified), raise
           an error.
      
      HPET: If -no-hpet flag is available and present='no', add -no-hpet.
            If -no-hpet is not available, and present='yes', raise an error.
            If present is unspecified, the default is to do whatever this
            particular qemu does by default, so don't raise an error.
      
      All other timer types are unsupported by QEMU, so they will raise an
      error.
      
      * src/qemu/qemu_conf.c: extend qemuBuildClockArgStr() to generate the
        command line arguments for the new options
      8bf6799b
    • L
      Add flags to indicate presence of timekeeping-related qemu options · 0fdf6496
      Laine Stump 提交于
      * src/qemu/qemu_conf.h: define 4 new flags
      * src/qemu/qemu_conf.c: check the help text of qemu for presence of
                              features indicated by each flag.
      * tests/qemuhelptest.c: add appropriate flags into the masks for each test
      0fdf6496
    • D
      Fix QEMU cpu affinity at startup to include all threads · 99123ba0
      Daniel P. Berrange 提交于
      The QEMU cpu affinity is used in NUMA scenarios to ensure that
      guest memory is allocated from a specific node. Normally memory
      is allocate on demand in vCPU threads, but when using hugepages
      the initial thread leader allocates memory upfront. libvirt was
      not setting affinity of the thread leader, or I/O threads. This
      patch changes the code to set the process affinity in between
      the fork()/exec() of QEMU. This ensures that every single QEMU
      thread gets the affinity
      
      * src/qemu/qemu_driver.c: Set affinity on entire QEMU process
        at startup
      99123ba0
    • D
      Add script hook support to the QEmu driver · 668150fc
      Daniel Veillard 提交于
      Right now this implements only 2 basic hooks:
      - before the qemu process is being launched
      - after the qemu process is terminated
      the XML description of the domain is passed to the hook script stdin
      /etc/libvirt/hook/qemu
      
      * src/qemu/qemu_driver.c: implement synchronous script hooks for QEmu
        at domain startup and end
      668150fc
  7. 27 3月, 2010 6 次提交
    • J
      Introduce UPDATE_CPU flag for virDomainGetXMLDesc · e455b221
      Jiri Denemark 提交于
      This flag is used in migration prepare step to send updated XML
      definition of a guest.
      
      Also ``virsh dumpxml --update-cpu [--inactive] guest'' command can be
      used to see the updated CPU requirements.
      e455b221
    • J
      Don't replace persistent domain config with migrated config · 59821682
      Jiri Denemark 提交于
      When a domain is defined on host1, migrated to host2 and then migrated
      back to host1, its current configuration would overwrite the libvirtd's
      in-memory copy of persistent configuration of that domain. This is not
      desired as we want to preserve the persistent configuration untouched.
      
      This patch introduces new 'live' parameter to virDomainAssignDef.
      Passing 'true' for 'live' means the configuration passed to
      virDomainAssignDef describes a configuration of live instance of the
      domain. This applies for saved domains which are being restored or for
      incoming domains during migration.
      
      All callers have been changed to pass the appropriate value.
      59821682
    • D
      Add disk error policy to domain XML · 447c586a
      David Allan 提交于
      * Fixes per feedback from Dan and Daniel
      * Added test datafiles
      * Re-disabled JSON flags
      * Added code to print the error policy attribute when generating XML
      * Re-add empty tag
      447c586a
    • S
      Add qemu support · d498175a
      Stefan Berger 提交于
      Add support for Qemu to have firewall rules applied and removed on VM
      startup and shutdown respectively. This  patch also provides support for
      the updating of a filter that causes all VMs that reference the filter
      to have their ebtables/iptables rules updated.
      Signed-off-by: NStefan Berger <stefanb@us.ibm.com>
      d498175a
    • S
      Use enum of virDomainNetType · 9bcad690
      Stefan Berger 提交于
      To find out where the net type 'direct' needs to be handled I introduced
      the 'enum virDomainNetType' in the virDomainNetDef structure and let the
      compiler tell me where the case statement is missing. Then I added the
      unhandled device statement to the UML driver.
      
      * src/conf/domain_conf.h: change _virDomainNetDef type from int to
        virDomainNetType enum
      * src/conf/domain_conf.c src/lxc/lxc_driver.c src/qemu/qemu_conf.c
        src/uml/uml_conf.c: make sure all enum cases are properly handled
        in switches
      9bcad690
    • D
      Silence cppi syntax-check warning · 67203f67
      Daniel Veillard 提交于
      67203f67
  8. 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
  9. 23 3月, 2010 1 次提交
    • J
      virDomainDiskDefAssignAddress: return int, not void · c390bcfe
      Jim Meyering 提交于
      Before, this function would blindly accept an invalid def->dst
      and then abuse the idx=-1 it would get from virDiskNameToIndex,
      when passing it invalid strings like "xvda:disk" and "sda1".
      Now, this function returns -1 upon failure.
      * src/conf/domain_conf.c (virDomainDiskDefAssignAddress): as above.
      Update callers.
      * src/conf/domain_conf.h: Update prototype.
      * src/qemu/qemu_conf.c: Update callers.
      c390bcfe
  10. 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
  11. 20 3月, 2010 2 次提交
  12. 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
  13. 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
  14. 16 3月, 2010 4 次提交