1. 29 11月, 2011 3 次提交
    • J
      lxc: Fix suspend/resume with freezer cgroup · 54bf875a
      Jiri Denemark 提交于
      54bf875a
    • S
      Implement the core API to suspend/resume the host · 4ddb37c3
      Srivatsa S. Bhat 提交于
      Add the core functions that implement the functionality of the API.
      Suspend is done by using an asynchronous mechanism so that we can return
      the status to the caller before the host gets suspended. This asynchronous
      operation is achieved by suspending the host in a separate thread of
      execution. However, returning the status to the caller is only best-effort,
      but not guaranteed.
      
      To resume the host, an RTC alarm is set up (based on how long we want to
      suspend) before suspending the host. When this alarm fires, the host
      gets woken up.
      
      Suspend-to-RAM operation on a host running Linux can take upto more than 20
      seconds, depending on the load of the system. (Freezing of tasks, an operation
      preceding any suspend operation, is given up after a 20 second timeout).
      And Suspend-to-Disk can take even more time, considering the time required
      for compaction, creating the memory image and writing it to disk etc.
      So, we do not allow the user to specify a suspend duration of less than 60
      seconds, to be on the safer side, since we don't want to prematurely declare
      failure when we only had to wait for some more time.
      4ddb37c3
    • S
      Add 'Hybrid-Suspend' power management discovery for the host · 302743f1
      Srivatsa S. Bhat 提交于
      Some systems support a feature known as 'Hybrid-Suspend', apart from the
      usual system-wide sleep states such as Suspend-to-RAM (S3) or Suspend-to-Disk
      (S4). Add the functionality to discover this power management feature and
      export it in the capabilities XML under the <power_management> tag.
      302743f1
  2. 25 11月, 2011 1 次提交
  3. 24 11月, 2011 1 次提交
    • J
      Introduce virConnectSetKeepAlive · 8d6e3edd
      Jiri Denemark 提交于
      virConnectSetKeepAlive public API can be used by a client connecting to
      remote server to start using keepalive protocol. The API is handled
      directly by remote driver and not transmitted over the wire to the
      server.
      8d6e3edd
  4. 23 11月, 2011 1 次提交
  5. 22 11月, 2011 1 次提交
    • S
      Export KVM Host Power Management capabilities · e352b164
      Srivatsa S. Bhat 提交于
      This patch exports KVM Host Power Management capabilities as XML so that
      higher-level systems management software can make use of these features
      available in the host.
      
      The script "pm-is-supported" (from pm-utils package) is run to discover if
      Suspend-to-RAM (S3) or Suspend-to-Disk (S4) is supported by the host.
      If either of them are supported, then a new tag "<power_management>" is
      introduced in the XML under the <host> tag.
      
      However in case the query to check for power management features succeeded,
      but the host does not support any such feature, then the XML will contain
      an empty <power_management/> tag. In the event that the PM query itself
      failed, the XML will not contain any "power_management" tag.
      
      To use this, new APIs could be implemented in libvirt to exploit power
      management features such as S3/S4.
      e352b164
  6. 19 11月, 2011 20 次提交
    • J
      Don't copy sexpr node value that is an empty string · a495365d
      Jim Fehlig 提交于
      Xen4.1 initializes some unspecified sexpr config items to an empty
      string, unlike previous Xen versions that would leave the item unset.
      E.g. the kernel item for an HVM guest (non-direct kernel boot):
      
      Xen4.0 and earlier
        ...
        (image
          (hvm
            (kernel )
        ...
      
      Xen4.1
        ...
        (image
          (hvm
            (kernel '')
        ...
      
      The empty string for kernel causes some grief in subsequent parsing
      where existence of specified kernel is checked, e.g.
      
        if (!def->os.kernel)
        ...
      
      This patch solves the problem in sexpr_node_copy() by not copying
      a node containing an empty string.
      a495365d
    • E
      build: fix compile error with no macvtap · f14b4cb5
      Eric Blake 提交于
      Since commit 6ec8288a, compilation has failed on RHEL 5:
      
      util/virnetdevmacvlan.c:672: error: conflicting types for 'virNetDevMacVLanCreateWithVPortProfile'
      
      * src/util/virnetdevmacvlan.c
      (virNetDevMacVLanCreateWithVPortProfile): Add missing parameter.
      f14b4cb5
    • S
      Add function to get hash table's key/value pairs · e9640b99
      Stefan Berger 提交于
      Add a function to the virHashTable for getting an array of the hash table's
      key-value pairs and have the keys (optionally) sorted.
      Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      e9640b99
    • D
      Allow creation of plain macvlan devices · 6ec8288a
      Daniel P. Berrange 提交于
      Update virNetDevMacVLanCreateWithVPortProfile to allow creation
      of plain macvlan devices, as well as macvtap devices. The former
      is useful for LXC containers
      
      * src/qemu/qemu_command.c: Explicitly request a macvtap device
      * src/util/virnetdevmacvlan.c, src/util/virnetdevmacvlan.h: Add
        new flag to allow switching between macvlan and macvtap
        creation
      6ec8288a
    • D
      Move ifaceMacvtapLinkDump and ifaceGetNthParent functions · 91904106
      Daniel P. Berrange 提交于
      Move the ifaceMacvtapLinkDump and ifaceGetNthParent functions
      into virnetdevvportprofile.c since they are specific to that
      code. This avoids polluting the headers with the Linux specific
      netlink data types
      
      * src/util/interface.c, src/util/interface.h: Move
        ifaceMacvtapLinkDump and ifaceGetNthParent functions and delete
        remaining file
      * src/util/virnetdevvportprofile.c: Add ifaceMacvtapLinkDump
        and ifaceGetNthParent functions
      * src/network/bridge_driver.c, src/nwfilter/nwfilter_gentech_driver.c,
        src/nwfilter/nwfilter_learnipaddr.c, src/util/virnetdevmacvlan.c:
        Remove include of interface.h
      91904106
    • D
      Move functions for dealing with physical/virtual devices · 74b32b62
      Daniel P. Berrange 提交于
      Move virNetDevIsVirtualFunction, virNetDevGetVirtualFunctionIndex
      and virNetDevGetPhysicalFunction to virnetdev.c
      
      * src/util/interface.c, src/util/interface.h, src/util/virnetdev.c,
        src/util/virnetdev.h: Move APIs
      74b32b62
    • D
      Rename APIs for dealing with virtual/physical functions · 8f688c85
      Daniel P. Berrange 提交于
      Rename ifaceIsVirtualFunction to virNetDevIsVirtualFunction,
      ifaceGetVirtualFunctionIndex to virNetDevGetVirtualFunctionIndex
      and ifaceGetPhysicalFunction to virNetDevGetPhysicalFunction
      
      * src/util/interface.c, src/util/interface.h: Rename APIs
      * src/util/virnetdevvportprofile.c: Update for API rename
      8f688c85
    • D
      Move virNetDevValidateConfig to virnetdev.c · 5373cb74
      Daniel P. Berrange 提交于
      * src/util/interface.c, src/util/interface.h: Remove virNetDevValidateConfig
      * src/util/virnetdev.c, src/util/virnetdev.h: Add virNetDevValidateConfig
      5373cb74
    • D
      Rename ifaceCheck to virNetDevValidateConfig · 6e0c4dce
      Daniel P. Berrange 提交于
      Rename the ifaceCheck method to virNetDevValidateConfig and change
      so that it always raises an error and returns -1 on error.
      
      * src/util/interface.c, src/util/interface.h: Rename ifaceCheck
        to virNetDevValidateConfig
      * src/nwfilter/nwfilter_gentech_driver.c,
        src/nwfilter/nwfilter_learnipaddr.c: Update for API rename
      6e0c4dce
    • D
      Move virNetDevGetIPv4Address to virnetdev.c · 8e6cd414
      Daniel P. Berrange 提交于
      Move the virNetDevGetIPv4Address function to virnetdev.c
      
      * util/interface.c, util/interface.h: Remove virNetDevGetIPv4Address
      * util/virnetdev.c, util/virnetdev.h: Add virNetDevGetIPv4Address
      8e6cd414
    • D
      Rename ifaceGetIPAddress to virNetDevGetIPv4Address · 50f19085
      Daniel P. Berrange 提交于
      To match up with the existing virNetDevSetIPv4Address, rename
      ifaceGetIPAddress to virNetDevGetIPv4Address
      
      * util/interface.h, util/interface.c: Rename API
      * network/bridge_driver.c: Update for API rename
      50f19085
    • D
      Move virNetDevGetIndex & virNetDevGetVLanID to virnetdev.c · 00bba08d
      Daniel P. Berrange 提交于
      Move virNetDevGetIndex & virNetDevGetVLanID to virnetdev.c to
      suit their functional purpose
      
      * util/interface.c, util/interface.h: Remove virNetDevGetIndex &
        virNetDevGetVLanID
      * util/virnetdev.c, util/virnetdev.h: Add virNetDevGetIndex &
        virNetDevGetVLanID
      00bba08d
    • D
      Rename ifaceGetIndex and ifaceGetVLAN · ebbb6bd1
      Daniel P. Berrange 提交于
      Rename the ifaceGetIndex method to virNetDevGetIndex and
      ifaceGetVlanID to virNetDevGetVLanID. Also change the error
      reporting behaviour to always raise errors and return -1 on
      failure
      
      * util/interface.c, util/interface.h: Rename ifaceGetIndex
        and ifaceGetVLAN
      * nwfilter/nwfilter_gentech_driver.c, nwfilter/nwfilter_learnipaddr.c,
        nwfilter/nwfilter_learnipaddr.c, util/virnetdevvportprofile.c: Update
        for API renames and error handling changes
      ebbb6bd1
    • D
      Move MAC address replacement functions to virnetdev.c · 255917f5
      Daniel P. Berrange 提交于
      Move virNetDevReplaceMacAddress and virNetDevRestoreMacAddress
      to the virnetdev.c file where they naturally belong
      
      * util/interface.c, util/interface.h: Remove
        virNetDevReplaceMacAddress and virNetDevRestoreMacAddress
      * util/virnetdev.c, util/virnetdev.h: Add
        virNetDevReplaceMacAddress and virNetDevRestoreMacAddress
      255917f5
    • D
      Rename interface MAC address replacement APIs · 10462d5c
      Daniel P. Berrange 提交于
      Rename ifaceReplaceMacAddress to virNetDevReplaceMacAddress
      and ifaceRestoreMacAddress to virNetDevRestoreMacAddress.
      
      * util/interface.c, util/interface.h, util/virnetdevmacvlan.c:
        Rename APIs
      10462d5c
    • D
      Move the low level macvlan creation APIs · d2fed854
      Daniel P. Berrange 提交于
      Move the low level macvlan creation APIs into the
      virnetdevmacvlan.c file where they more naturally
      belong
      
      * util/interface.c, util/interface.h: Remove virNetDevMacVLanCreate
        and virNetDevMacVLanDelete
      * util/virnetdevmacvlan.c, util/virnetdevmacvlan.h: Add
        virNetDevMacVLanCreate and virNetDevMacVLanDelete
      d2fed854
    • D
      Rename low level macvlan creation APIs · 57f0de4c
      Daniel P. Berrange 提交于
      Rename ifaceMacvtapLinkAdd to virNetDevMacVLanCreate and
      ifaceLinkDel to virNetDevMacVLanDelete. Strictly speaking
      the latter isn't restricted to macvlan devices, but that's
      the only use libvirt has for it.
      
      * util/interface.c, util/interface.h,
        util/virnetdevmacvlan.c: Rename APIs
      57f0de4c
    • D
      Rename high level macvlan creation APIs · 191090ae
      Daniel P. Berrange 提交于
      Rename virNetDevMacVLanCreate to virNetDevMacVLanCreateWithVPortProfile
      and virNetDevMacVLanDelete to virNetDevMacVLanDeleteWithVPortProfile
      
      To make way for renaming the other macvlan creation APIs in
      interface.c
      
      * util/virnetdevmacvlan.c, util/virnetdevmacvlan.h,
        qemu/qemu_command.c, qemu/qemu_hotplug.c, qemu/qemu_process.c:
        Rename APIs
      191090ae
    • D
      Rename and split the macvtap.c file · 896104c9
      Daniel P. Berrange 提交于
      Rename the macvtap.c file to virnetdevmacvlan.c to reflect its
      functionality. Move the port profile association code out into
      virnetdevvportprofile.c. Make the APIs available unconditionally
      to callers
      
      * src/util/macvtap.h: rename to src/util/virnetdevmacvlan.h,
      * src/util/macvtap.c: rename to src/util/virnetdevmacvlan.c
      * src/util/virnetdevvportprofile.c, src/util/virnetdevvportprofile.h:
        Pull in vport association code
      * src/Makefile.am, src/conf/domain_conf.h, src/qemu/qemu_conf.c,
        src/qemu/qemu_conf.h, src/qemu/qemu_driver.c: Update include
        paths & remove conditional compilation
      896104c9
    • D
      Rename Macvtap management APIs · 43925db7
      Daniel P. Berrange 提交于
      In preparation for code re-organization, rename the Macvtap
      management APIs to have the following patterns
      
        virNetDevMacVLanXXXXX     - macvlan/macvtap interface management
        virNetDevVPortProfileXXXX - virtual port profile management
      
      * src/util/macvtap.c, src/util/macvtap.h: Rename APIs
      * src/conf/domain_conf.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/qemu/qemu_command.h,
        src/qemu/qemu_driver.c, src/qemu/qemu_hotplug.c,
        src/qemu/qemu_migration.c, src/qemu/qemu_process.c,
        src/qemu/qemu_process.h: Update for renamed APIs
      43925db7
  7. 16 11月, 2011 2 次提交
  8. 15 11月, 2011 6 次提交
    • D
      Remove ifaceSetMac and ifaceGetMac APIs · 5240ad65
      Daniel P. Berrange 提交于
      The ifaceSetMac and ifaceGetMac APIs duplicate the functionality
      of the virNetDevSetMAC and virNetDevGetMAC APIs, but returning
      errno's instead of raising errors.
      
      * src/util/interface.c, src/util/interface.h: Remove
        ifaceSetMac and ifaceGetMac APIs, adjusting callers
        for new error behaviour
      5240ad65
    • D
      Remove ifaceUp, ifaceDown, ifaceCtrl & ifaceIsUp APIs · 268085c3
      Daniel P. Berrange 提交于
      The ifaceUp, ifaceDown, ifaceCtrl & ifaceIsUp APIs can be replaced
      with calls to virNetDevSetOnline and virNetDevIsOnline
      
      * src/util/interface.c, src/util/interface.h: Delete ifaceUp,
        ifaceDown, ifaceCtrl & ifaceIsUp
      * src/nwfilter/nwfilter_gentech_driver.c, src/util/macvtap.c:
        Update to use virNetDevSetOnline and virNetDevIsOnline
      268085c3
    • D
      Move LXC veth.c code into shared utility APIs · 428cffb1
      Daniel P. Berrange 提交于
      Move the virNetDevSetName and virNetDevSetNamespace APIs out
      of LXC's veth.c and into virnetdev.c.
      
      Move the remaining content of the file to src/util/virnetdevveth.c
      
      * src/lxc/veth.c: Rename to src/util/virnetdevveth.c
      * src/lxc/veth.h: Rename to src/util/virnetdevveth.h
      * src/util/virnetdev.c, src/util/virnetdev.h: Add
        virNetDevSetName and virNetDevSetNamespace
      * src/lxc/lxc_container.c, src/lxc/lxc_controller.c,
        src/lxc/lxc_driver.c: Update include paths
      428cffb1
    • D
      Split src/util/network.{c,h} into 5 pieces · d3406045
      Daniel P. Berrange 提交于
      The src/util/network.c file is a dumping ground for many different
      APIs. Split it up into 5 pieces, along functional lines
      
       - src/util/virnetdevbandwidth.c: virNetDevBandwidth type & helper APIs
       - src/util/virnetdevvportprofile.c: virNetDevVPortProfile type & helper APIs
       - src/util/virsocketaddr.c: virSocketAddr and APIs
       - src/conf/netdev_bandwidth_conf.c: XML parsing / formatting
         for virNetDevBandwidth
       - src/conf/netdev_vport_profile_conf.c: XML parsing / formatting
         for virNetDevVPortProfile
      
      * src/util/network.c, src/util/network.h: Split into 5 pieces
      * src/conf/netdev_bandwidth_conf.c, src/conf/netdev_bandwidth_conf.h,
        src/conf/netdev_vport_profile_conf.c, src/conf/netdev_vport_profile_conf.h,
        src/util/virnetdevbandwidth.c, src/util/virnetdevbandwidth.h,
        src/util/virnetdevvportprofile.c, src/util/virnetdevvportprofile.h,
        src/util/virsocketaddr.c, src/util/virsocketaddr.h: New pieces
      * daemon/libvirtd.h, daemon/remote.c, src/conf/domain_conf.c,
        src/conf/domain_conf.h, src/conf/network_conf.c,
        src/conf/network_conf.h, src/conf/nwfilter_conf.h,
        src/esx/esx_util.h, src/network/bridge_driver.c,
        src/qemu/qemu_conf.c, src/rpc/virnetsocket.c,
        src/rpc/virnetsocket.h, src/util/dnsmasq.h, src/util/interface.h,
        src/util/iptables.h, src/util/macvtap.c, src/util/macvtap.h,
        src/util/virnetdev.h, src/util/virnetdevtap.c,
        tools/virsh.c: Update include files
      d3406045
    • D
      Fix error reporting in port profile parsing/formatting APIs · df64f480
      Daniel P. Berrange 提交于
      The virtual port profile parsing/formatting APIs do not
      correctly handle unknown profile type strings/numbers.
      They behave as a no-op, instead of raising an error
      
      * src/util/network.c, src/util/network.h: Fix error
        handling of port profile APIs
      * src/conf/domain_conf.c, src/conf/network_conf.c: Update
        for API changes
      df64f480
    • D
      Rename virVirtualPortProfileParams & APIs · 767e01ce
      Daniel P. Berrange 提交于
      Rename the virVirtualPortProfileParams struct to be
      virNetDevVPortProfile, and rename the APIs to match
      this prefix.
      
      * src/util/network.c, src/util/network.h: Rename port profile
        APIs
      * src/conf/domain_conf.c, src/conf/domain_conf.h,
        src/conf/network_conf.c, src/conf/network_conf.h,
        src/network/bridge_driver.c, src/qemu/qemu_hotplug.c,
        src/util/macvtap.c, src/util/macvtap.h: Update for
        renamed APIs/structs
      767e01ce
  9. 12 11月, 2011 1 次提交
    • E
      API: add VIR_TYPED_PARAM_STRING · a218c81d
      Eric Blake 提交于
      This allows strings to be transported between client and server
      in the context of name-type-value virTypedParameter functions.
      For compatibility,
      
          o new clients will not send strings to old servers, based on
            a feature check
          o new servers will not send strings to old clients without the
            flag VIR_TYPED_PARAM_STRING_OKAY; this will be enforced at
            the RPC layer in the next patch, so that drivers need not
            worry about it in general.  The one exception is that
            virDomainGetSchedulerParameters lacks a flags argument, so
            it must not return a string; drivers that forward that
            function on to virDomainGetSchedulerParametersFlags will
            have to pay attention to the flag.
          o the flag VIR_TYPED_PARAM_STRING_OKAY is set automatically,
            based on a feature check (so far, no driver implements it),
            so clients do not have to worry about it
      
      Future patches can then enable the feature on a per-driver basis.
      
      This patch also ensures that drivers can blindly strdup() field
      names (previously, a malicious client could stuff 80 non-NUL bytes
      into field and cause a read overrun).
      
      * src/libvirt_internal.h (VIR_DRV_FEATURE_TYPED_PARAM_STRING): New
      driver feature.
      * src/libvirt.c (virTypedParameterValidateSet)
      (virTypedParameterSanitizeGet): New helper functions.
      (virDomainSetMemoryParameters, virDomainSetBlkioParameters)
      (virDomainSetSchedulerParameters)
      (virDomainSetSchedulerParametersFlags)
      (virDomainGetMemoryParameters, virDomainGetBlkioParameters)
      (virDomainGetSchedulerParameters)
      (virDomainGetSchedulerParametersFlags, virDomainBlockStatsFlags):
      Use them.
      * src/util/util.h (virTypedParameterArrayClear): New helper
      function.
      * src/util/util.c (virTypedParameterArrayClear): Implement it.
      * src/libvirt_private.syms (util.h): Export it.
      Based on an initial patch by Hu Tao, with feedback from
      Daniel P. Berrange.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a218c81d
  10. 10 11月, 2011 4 次提交
    • D
      Adjust naming of network device bandwidth management APIs · 0eee075d
      Daniel P. Berrange 提交于
      Rename virBandwidth to virNetDevBandwidth, and virRate to
      virNetDevBandwidthRate.
      
      * src/util/network.c, src/util/network.h: Rename bandwidth
        structs and APIs
      * src/conf/domain_conf.c, src/conf/domain_conf.h,
        src/conf/network_conf.c, src/conf/network_conf.h,
        src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/util/macvtap.c,
        src/util/macvtap.h, tools/virsh.c: Update for API changes.
      0eee075d
    • D
      Santize naming of socket address APIs · 4c544e6c
      Daniel P. Berrange 提交于
      The socket address APIs in src/util/network.h either take the
      form  virSocketAddrXXX, virSocketXXX or virSocketXXXAddr.
      
      Sanitize this so everything is virSocketAddrXXXX, and ensure
      that the virSocketAddr parameter is always the first one.
      
      * src/util/network.c, src/util/network.h: Santize socket
        address API naming
      * src/conf/domain_conf.c, src/conf/network_conf.c,
        src/conf/nwfilter_conf.c, src/network/bridge_driver.c,
        src/nwfilter/nwfilter_ebiptables_driver.c,
        src/nwfilter/nwfilter_learnipaddr.c,
        src/qemu/qemu_command.c, src/rpc/virnetsocket.c,
        src/util/dnsmasq.c, src/util/iptables.c,
        src/util/virnetdev.c, src/vbox/vbox_tmpl.c: Update for
        API renaming
      4c544e6c
    • D
      Split bridge.h into three separate files · e49c9bf2
      Daniel P. Berrange 提交于
      Following the renaming of the bridge management APIs, we can now
      split the source file into 3 corresponding pieces
      
       * src/util/virnetdev.c: APIs for any type of network interface
       * src/util/virnetdevbridge.c: APIs for bridge interfaces
       * src/util/virnetdevtap.c: APIs for TAP interfaces
      
      * src/util/virnetdev.c, src/util/virnetdev.h,
        src/util/virnetdevbridge.c, src/util/virnetdevbridge.h,
        src/util/virnetdevtap.c, src/util/virnetdevtap.h: Copied
        from bridge.{c,h}
      * src/util/bridge.c, src/util/bridge.h: Split into 3 pieces
      * src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/openvz/openvz_driver.c, src/qemu/qemu_command.c,
        src/qemu/qemu_conf.h, src/uml/uml_conf.c, src/uml/uml_conf.h,
        src/uml/uml_driver.c: Update #include directives
      e49c9bf2
    • D
      Remove usage of brctl command line tool · c1df2c14
      Daniel P. Berrange 提交于
      Convert the virNetDevBridgeSetSTP and virNetDevBridgeSetSTPDelay
      to use ioctls instead of spawning brctl.
      
      Implement the virNetDevBridgeGetSTP and virNetDevBridgeGetSTPDelay
      methods which were declared in the header but never existed
      
      * src/util/bridge.c: Convert to use bridge ioctls instead of brctl
      c1df2c14