1. 18 9月, 2012 35 次提交
    • J
      virBitmap: fix build without HAVE_NUMACTL · 2a72e54c
      Ján Tomko 提交于
      Commit 75b198b3 forgot to change
      arguments of dummy qemuProcessInitNumaMemoryPolicy from char* to
      virBitmapPtr.
      2a72e54c
    • R
      daemon: Fix error message when libvirtd is missing. · 0e13136a
      Richard W.M. Jones 提交于
      Currently we search along the hard-coded names:
        SBINDIR "/libvirtd"
        SBINDIR "/libvirtd_dbg"
      but if the environment variable $LIBVIRTD_PATH is set to the
      name of the libvirtd binary, that is used instead.  Fix the
      error message so it accurately reflects current behaviour
      ($PATH is NOT searched).
      0e13136a
    • D
      Fix the augea test for qemu libvirtd options · b1ba47ec
      Daniel Veillard 提交于
      Commit 1ccf2227 forgot to
      add the output to the augeas test
      b1ba47ec
    • L
      network: implement backend of virNetworkUpdate(IP_DHCP_HOST) · e3b6b2be
      Laine Stump 提交于
      This patch fills in the first implementation for one of the
      virNetworkUpdate sections. With this code, you can now add/delete/edit
      <host> entries in a network's <ip> address <dhcp> element (by
      specifying a section of VIR_NETWORK_SECTION_IP_DHCP_HOST).
      
      If you pass in a parentIndex of -1, the code will automatically find
      the one ip element that has a <dhcp> section and make the updates
      there. Otherwise, you can specify an index >= 0, and libvirt will look
      for that particular instance of <ip> in the network, and modify its
      <dhcp> element. (This currently isn't very useful, because libvirt
      only supports having dhcp information on a single IP address, but that
      could change in the future).
      
      When adding a new host entry
      (VIR_NETWORK_UPDATE_COMMAND_ADD_(FIRST|LAST)), the existing entries
      will be compared to the new entry, and if any non-empty attribute
      matches, the add will fail. When updating an existing entry
      (VIR_NETWORK_UPDATE_COMMAND_MODIFY), the mac address or name will be
      used to find the existing entry, and other fields will only be updated
      (note there is some potential for ambiguity here if you specify the
      mac address from one entry and the name from another).  When deleting
      an existing entry (VIR_NETWORK_UPDATE_COMMAND_DELETE), all non-empty
      attributes in the supplied xml arg will be compared - all of them must
      match before libvirt will delete the host.
      
      The xml should be a fully formed <host> element as it would appear in
      a network definition, e.g. "<host mac=00:11:22:33:44:55 ip=10.1.23.22
      name='testbox'/>" (when adding/updating, ip and one of mac|name is
      required; when deleting, you can specify any one, two, or all
      attributes, but they all must match the target element).
      
      As with the update of any other section, you can choose to affect the
      live config (with flag VIR_NETWORK_UPDATE_AFFECT_LIVE), the persistent
      config (VIR_NETWORK_UPDATE_AFFECT_CONFIG), or both. If you've chosen
      to affect the live config, those changes will take effect immediately,
      with no need to destroy/restart the network.
      
      An example of adding a host entry:
      
         virNetworkUpdate(net, VIR_NETWORK_UPDATE_COMMAND_ADD_LAST,
                           VIR_NETWORK_SECTION_IP_DHCP_HOST, -1,
                          "<host mac='00:11:22:33:44:55' ip='192.168.122.5'/>",
                          VIR_NETWORK_UPDATE_AFFECT_LIVE
                          | VIR_NETWORK_UPDATE_AFFECT_CONFIG);
      
      To delete that same entry:
      
         virNetworkUpdate(net, VIR_NETWORK_UPDATE_COMMAND_DELETE,
                          VIR_NETWORK_SECTION_IP_DHCP_HOST, -1,
                          "<host mac='00:11:22:33:44:55'/>",
                          VIR_NETWORK_UPDATE_AFFECT_LIVE
                          | VIR_NETWORK_UPDATE_AFFECT_CONFIG);
      
      (you could also delete it by replacing "mac='00:11:22:33:44:55'" with
      "ip='192.168.122.5'".)
      e3b6b2be
    • L
      network: restart radvd/dnsmasq if needed when libvirtd is restarted · 4cf974b6
      Laine Stump 提交于
      A user on IRC had accidentally killed all of his libvirt-started
      dnsmasq instances (due to a buggy dnsmasq service script in Fedora
      16), and had hoped that libvirtd would notice this on restart and
      reload all the dnsmasq daemons (as it does with iptables
      rules). Unfortunately this was not the case - as long as the network
      object had a pid registered for dnsmasq and/or radvd, it assumed that
      the processes were running.
      
      This patch takes advantage of the new utility functions in
      bridge_driver.c to do a "refresh" of all radvd and dnsmasq processes
      started by libvirt each time libvirtd is restarted - this function
      attempts to do a SIGHUP of each existing process, and if that fails,
      it restarts the process, rebuilding all the associated config files
      and commandline parameters in the process. This normally has no
      effect, but will be useful in solving the occasional "odd situation"
      without needing to take the drastic step of destroying/re-starting the
      network.
      4cf974b6
    • L
      network: implement virNetworkUpdate for test_driver · 6bdcef11
      Laine Stump 提交于
      The test driver does nothing outside of keeping track of each
      network's config/state in the in-memory database maintained by
      network_conf functions, so all we have to do is call the function that
      updates the network's entry in the in-memory database.
      6bdcef11
    • L
      network: implement virNetworkUpdate for bridge_driver · cd331650
      Laine Stump 提交于
      Call the network_conf function that modifies the live/persistent/both
      config, then refresh/restart dnsmasq/radvd if necessary, and finally
      save the config in the proper place(s).
      
      This patch also needed to uncomment a few utility functions that were
      added inside #if 0 in the previous commit (to avoid compiler errors
      due to unreferenced static functions).
      cd331650
    • L
      network: reorganize dnsmasq and radvd config file / startup · 1ce4922e
      Laine Stump 提交于
      This patch splits the starting of dnsmasq and radvd into multiple
      files, and adds new networkRefreshXX() and networkRestartXX()
      functions for each. These new functions are currently commented out
      because they won't be used until the next commit, and the compile options
      require all static functions to be used.
      
      networkRefreshXX() - rewrites any file-based config for dnsmasq/radvd,
      and sends SIGHUP to the process to make it reread its config. If the
      program isn't already running, it's just started.
      
      networkRestartXX() - kills the given program, waits for it to exit
      (see the comments in the function networkKillDaemon()), then calls
      networkStartXX().
      
      This commit is here mostly as a checkpoint to verify no change in
      functional behavior after refactoring networkStartXX() functions to
      fit in with these new functions.
      1ce4922e
    • L
      conf: implement NetworkObj backend of virNetworkUpdate API · d22f4bad
      Laine Stump 提交于
      virNetworkObjUpdate takes care of all virNetworkUpdate-related changes
      to the data stored in the in-memory virNetworkObj list. It should be
      called by network drivers that use this in-memory list.
      
      virNetworkObjUpdate *does not* take care of updating any disk-based
      copies of the config, nor does it perform any other operations
      necessary to have the new config data take effect (e.g. it won't
      re-write dnsmasq host files, nor will it send a SIGHUP to dnsmasq) -
      those things should all be taken care of in the network driver
      function that calls virNetworkObjUpdate (assuming that it returns
      success).
      d22f4bad
    • L
      network: utility functions for updating network config · f36309d6
      Laine Stump 提交于
      These new functions are highly inspired by those in domain_conf.c (but
      not identical), and are intended to make it simpler to update the
      various combinations of live/persistent network configs.
      
      The network driver wasn't previously as careful about the separation
      between the live "status" in network->def and the persistent "config"
      in network->newDef (or sometimes in network->def). This series
      attempts to remedy some of that, but probably doesn't go all the way
      (enough to get these functions working and enable continued work on
      virNetworkUpdate though).
      
      bridge_driver.c and test_driver.c were updated in a few places to take
      advantage of the new functions and/or account for changes in argument
      lists.
      f36309d6
    • L
      network: implement RPC calls for virNetworkUpdate · 7a99b0ab
      Laine Stump 提交于
      This is very short, because almost everything is autogenerated. All
      that's needed are:
      
      * src/remote/remote_driver.c: add pointer to autogenerated
          remoteNetworkUpdate to the function table for the remote
          network driver.
      
      * src/remote/remote_protocol.x: add the "args" struct and add one more
          item to the remote_procedure enum for this function.
      
      * src/remote_protocol-struct: update to match remote_protocol.x
      7a99b0ab
    • L
      network: define new API virNetworkUpdate · 574b9bc6
      Laine Stump 提交于
      This patch adds a new public API virNetworkUpdate that will permit
      updating an existing network configuration without requiring that the
      network be destroyed/restarted for the changes to take effect.
      574b9bc6
    • J
      qemu: add -sandbox to command line if requested · 5f7861ca
      Ján Tomko 提交于
      5f7861ca
    • J
      qemu: conf: add seccomp_sandbox option · 1ccf2227
      Ján Tomko 提交于
      1ccf2227
    • J
      qemu: add capability flag for seccomp sandbox · ede22e58
      Ján Tomko 提交于
      This series adds support to run QEMU with seccomp sandbox enabled. It can be
      configured in qemu.conf to on, off, or the QEMU default, which is off in 1.2.
      Default value is the QEMU default.
      ede22e58
    • M
      qemu: Avoid deadlock on HandleAgentEOF · 1020a504
      Michal Privoznik 提交于
      On agent EOF the qemuProcessHandleAgentEOF() callback is called
      which locks virDomainObjPtr. Then qemuAgentClose() is called
      (with domain object locked) which eventually calls qemuAgentDispose()
      and qemuProcessHandleAgentDestroy(). This tries to lock the
      domain object again. Hence the deadlock.
      1020a504
    • O
      qemu: Use disk wwn in qemu command line · 6e73850b
      Osier Yang 提交于
      All of ide-drive, ide-hd, ide-cd, scsi-disk, scsi-hd, and scsi-cd
      supports wwn property. (NB, scsi-block doesn't support to set wwn).
      
      * src/qemu/qemu_command.c: Error out if underlying QEMU doesn't
      support wwn property for the device; Set wwn for the device otherwise.
      
      * tests/qemuxml2argvdata/qemuxml2argv-disk-ide-wwn.args: New test
      * tests/qemuxml2argvdata/qemuxml2argv-disk-ide-wwn.xml: Likewise
      * tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-wwn.args: Likewise
      * tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-wwn.xml: Likewise
      * tests/qemuxml2argvtest.c: Add the new tests.
      6e73850b
    • O
      qemu: Add caps to indentify if setting wwn is supported by qemu · 331934b2
      Osier Yang 提交于
      This assumes ide-drive.wwn, ide-hd.wwn, ide-cd.wwn were supported
      at the same time, similar for scsi-disk.wwn, scsi-hd.wwn, and
      scsi-cd.wwn. So only two new caps (QEMU_CAPS_IDE_DRIVE_WWN,
      and QEMU_CAPS_SCSI_DISK_WWN) are introduced.
      331934b2
    • O
      conf: Parse and format disk <wwn> · facc1c00
      Osier Yang 提交于
      Validates the wwn while parsing, error out if it's malformed.
      
      * src/util/util.h: Declare virValidateWWN
      * src/util/util.c: Implement virValidateWWN
      * src/libvirt_private.syms: Export virValidateWWN.
      * src/conf/domain_conf.h: New member 'wwn' for disk def.
      * src/conf/domain_conf.c: Parse and format disk <wwn>
      facc1c00
    • E
      blockjob: add blockcommit support to rpc · 85edb0c8
      Eric Blake 提交于
      Relatively straightforward.  Our decision to make block job
      speed a long keeps haunting us on new API.
      
      * src/remote/remote_protocol.x (remote_domain_block_commit_args):
      New struct.
      * src/remote/remote_driver.c (remote_driver): Enable it.
      * src/remote_protocol-structs: Regenerate.
      * src/rpc/gendispatch.pl (long_legacy): Exempt another bandwidth.
      85edb0c8
    • E
      blockjob: add virDomainBlockCommit · ef1e024d
      Eric Blake 提交于
      A block commit moves data in the opposite direction of block pull.
      Block pull reduces the chain length by dropping backing files after
      data has been pulled into the top overlay, and is always safe; block
      commit reduces the chain length by dropping overlays after data has
      been committed into the backing file, and any files that depended
      on base but not on top are invalidated at any point where they have
      unallocated data that is now pointing to changed contents in base.
      Both directions are useful, however: a qcow2 layer that is more than
      50% allocated will typically be faster with a pull operation, while
      a qcow2 layer with less than 50% allocation will be faster as a
      commit operation.  Committing across multiple layers can be more
      efficient than repeatedly committing one layer at a time, but
      requires extra support from the hypervisor.
      
      This API matches Jeff Cody's proposed qemu command 'block-commit':
      https://lists.gnu.org/archive/html/qemu-devel/2012-09/msg02226.html
      
      Jeff's command is still in the works for qemu 1.3, and may gain
      further enhancements, such as the ability to control on-error
      handling (it will be comparable to the error handling Paolo is
      adding to 'drive-mirror', so a similar solution will be needed
      when I finally propose virDomainBlockCopy with more functionality
      than the basics supported by virDomainBlockRebase).  However, even
      without qemu support, this API will be useful for _offline_ block
      commits, by wrapping qemu-img calls and turning them into a block
      job, so this API is worth committing now.
      
      For some examples of how this will be implemented, all starting
      with the chain: base <- snap1 <- snap2 <- active
      
      + These are equivalent:
       virDomainBlockCommit(dom, disk, NULL, NULL, 0, 0)
       virDomainBlockCommit(dom, disk, NULL, "active", 0, 0)
       virDomainBlockCommit(dom, disk, "base", NULL, 0, 0)
       virDomainBlockCommit(dom, disk, "base", "active", 0, 0)
      but cannot be implemented for online qemu with round 1 of
      Jeff's patches; and for offline images, it would require
      three back-to-back qemu-img invocations unless qemu-img
      is patched to allow more efficient multi-layer commits;
      the end result would be 'base' as the active disk with
      contents from all three other files, where 'snap1' and
      'snap2' are invalid right away, and 'active' is invalid
      once any further changes to 'base' are made.
      
      + These are equivalent:
       virDomainBlockCommit(dom, disk, "snap2", NULL, 0, 0)
       virDomainBlockCommit(dom, disk, NULL, NULL, 0, _SHALLOW)
      they cannot be implemented for online qemu, but for offline,
      it is a matter of 'qemu-img commit active', so that 'snap2'
      is now the active disk with contents formerly in 'active'.
      
      + Similarly:
       virDomainBlockCommit(dom, disk, "snap2", NULL, 0, _DELETE)
      for an offline domain will merge 'active' into 'snap2', then
      delete 'active' to avoid leaving a potentially invalid file
      around.
      
      + This version:
       virDomainBlockCommit(dom, disk, NULL, "snap2", 0, _SHALLOW)
      can be implemented online with 'block-commit' passing a base of
      snap1 and a top of snap2; and can be implemented offline by
      'qemu-img commit snap2' followed by 'qemu-img rebase -u
      -b snap1 active'
      
      * include/libvirt/libvirt.h.in (virDomainBlockCommit): New API.
      * src/libvirt.c (virDomainBlockCommit): Implement it.
      * src/libvirt_public.syms (LIBVIRT_0.10.2): Export it.
      * src/driver.h (virDrvDomainBlockCommit): New driver callback.
      * docs/apibuild.py (CParser.parseSignature): Add exception.
      ef1e024d
    • E
      qemu: drop unused arguments for dump-guest-memory · d239085e
      Eric Blake 提交于
      Upstream qemu has raised a concern about whether dumping guest
      memory by reading guest paging tables is a security hole:
      https://lists.gnu.org/archive/html/qemu-devel/2012-09/msg02607.html
      
      While auditing libvirt to see if we would be impacted, I noticed
      that we had some dead code.  It is simpler to nuke the dead code
      and limit our monitor code to just the subset we make use of.
      
      * src/qemu/qemu_monitor.h (QEMU_MONITOR_DUMP): Drop poorly named
      and mostly-unused enum.
      * src/qemu/qemu_monitor.c (qemuMonitorDumpToFd): Drop arguments.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONDump): Likewise.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDump): Likewise.
      * src/qemu/qemu_driver.c (qemuDumpToFd): Update caller.
      d239085e
    • O
      build: Fix build failure on non-linux platform · 22acfdc7
      Osier Yang 提交于
      22acfdc7
    • L
      conf: avoid freeing network object with undestroyed mutex · 16d9a3df
      Laine Stump 提交于
      virNetworkAssignDef was allocating a new network object, initing and
      grabbing its lock, then potentially freeing it without unlocking or
      destroying the lock. In practice 1) this will probably never happen,
      and 2) even if it did, the lock implementation used on most (all?)
      platforms doesn't actually hold any resources for an initialized or
      held lock, but it still bothered me, so I moved the realloc that could
      lead to this bad situation earlier in the function, and now the mutex
      isn't inited or locked until we are assured of complete success.
      16d9a3df
    • L
      conf: separate functions to parse DHCPHostDef and DHCPRangeDef · 764bd853
      Laine Stump 提交于
      These two objects were previously always parsed as a part of an IpDef,
      but we will now need to be able to parse them on their own for
      virNetworkUpdate(). Split the parsing functions out, with no
      functional changes.
      764bd853
    • H
      remove virDomainCpuSetFormat and virDomainCpuSetParse · afe86981
      Hu Tao 提交于
      virBitmap is recommanded to store cpuset info, and
      virBitmapFormat/virBitmapParse can do the format/parse
      jobs.
      afe86981
    • L
      xen: eliminate remaining uses of virDomainCpuSetParse · 58d372d4
      Laine Stump 提交于
      The final patch in Hu Tao's series to enhance virBitmap actually
      removes virDomainCpuSetParse and virDomainCpuSetFormat as "no longer
      used", and the rest of the series hadn't taken care of two uses of
      virDomainCpuSetParse in the xen code.
      
      This patch replaces those with appropriate virBitmap functions. It
      should be pushed prior to the patch removing virDomainCpuSetParse.
      58d372d4
    • H
      use virBitmap to store nodeinfo. · fe2a0b02
      Hu Tao 提交于
      fe2a0b02
    • H
      use virBitmap to store cells' cpumask info. · f4b2dcf5
      Hu Tao 提交于
      f4b2dcf5
    • H
      use virBitmap to store cpumask info. · ee7d23ba
      Hu Tao 提交于
      ee7d23ba
    • H
      use virBitmap to store numa nodemask info. · 75b198b3
      Hu Tao 提交于
      75b198b3
    • H
      use virBitmap to store cpu affinity info · f1a43a8e
      Hu Tao 提交于
      f1a43a8e
    • H
      use virBitmap to store cpupin info · f970d848
      Hu Tao 提交于
      f970d848
    • H
      New functions for virBitmap · 0fc89098
      Hu Tao 提交于
      In many places we store bitmap info in a chunk of data
      (pointed to by a char *), and have redundant codes to
      set/unset bits. This patch extends virBitmap, and convert
      those codes to use virBitmap in subsequent patches.
      0fc89098
    • H
      bitmap: new member variable and function renaming · 0831a5ba
      Hu Tao 提交于
      Add a new member variable map_len to store map len of bitmap.
      and rename size to max_bit accordingly.
      
      rename virBitmapAlloc to virBitmapNew.
      0831a5ba
  2. 17 9月, 2012 5 次提交
    • O
      Build: Fix typos which cause build failure · 4ed43d62
      Osier Yang 提交于
      Pushed under build-breaker rules.
      4ed43d62
    • O
      node_memory: Support get/set memory parameters for drivers · 8268a245
      Osier Yang 提交于
      Including QEMU, LXC, UML, XEN drivers.
      8268a245
    • O
      node_memory: Implement the internal APIs · aaa8ab3e
      Osier Yang 提交于
      Only implemented for linux platform.
      
      * src/nodeinfo.h: (Declare node{Get,Set}MemoryParameters)
      * src/nodeinfo.c: (Implement node{Get,Set}MemoryParameters)
      * src/libvirt_private.syms: (Export those two new internal APIs to
        private symbols)
      aaa8ab3e
    • O
      node_memory: Wire up the RPC protocol · 00792722
      Osier Yang 提交于
      * src/rpc/gendispatch.pl: (virNodeSetMemoryParameters is the
        the special one which needs a connection object as the first
        argument, improve the generator to support it).
      * daemon/remote.c: (Implement the server side handler for
        virDomainGetMemoryParameters)
      * src/remote/remote_driver.c: (Implement the client side handler
        for virDomainGetMemoryParameters)
      * src/remote/remote_protocol.x: (New RPC procedures for the two
        new APIs and structs to represent the args and ret for it)
      * src/remote_protocol-structs: Likewise
      00792722
    • O
      node_memory: Define the APIs to get/set memory parameters · 12ad7435
      Osier Yang 提交于
      * include/libvirt/libvirt.h.in: (Add macros for the param fields,
        declare the APIs).
      * src/driver.h: (New methods for the driver struct)
      * src/libvirt.c: (Implement the public APIs)
      * src/libvirt_public.syms: (Export the public symbols)
      12ad7435