1. 20 6月, 2012 1 次提交
    • M
      domain_conf: fix possible memory leak · 830d035f
      Martin Kletzander 提交于
      Until now, it was possible to crash libvirtd when defining domain with
      channel device with missing source element.
      
      When creating new virDomainChrDef, target.port is set to -1, but
      unfortunately it is an union with addresses that virDomainChrDefFree
      tries to free in case the deviceType is channel. Having the port set
      to -1 is intended, however the cleanest way to get around the problems
      with the crash seems to be renumbering the VIR_DOMAIN_CHR_CHANNEL_
      target types to cover new NONE type (with value 0) being the default
      (no target type yet).
      830d035f
  2. 19 6月, 2012 17 次提交
    • P
      error: Fix typos in argument checking macros · fbc72a1d
      Peter Krempa 提交于
      Macro virCheckNullArgGoto is supposed to check for NULL argument but
      checks non-NULL instead.
      
      Macro virCheckNonNullArgReturn reports error as if the argument should
      be NULL when it shouldn't.
      fbc72a1d
    • M
      virsh: make domiftune interface help string consistent · 4b227307
      Martin Kletzander 提交于
      Append '(MAC Address)' after the help string of domiftune virsh
      command as it takes the same type of argument as domif-{get,set}link
      which have it specified.
      4b227307
    • G
      LXC: avoid useless duplicate memory free · 00828beb
      Gao feng 提交于
      when lxcContainerIdentifyCGroups failed, the memory it allocated
      has been freed, so we should not free this memory again in
      lxcContainerSetupPivortRoot and lxcContainerSetupExtraMounts.
      Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
      00828beb
    • P
      driver: Clean up driver header to space indentation · cd639ec5
      Peter Krempa 提交于
      cd639ec5
    • E
      snapshot: merge count and name collection · ec83c716
      Eric Blake 提交于
      Another case where we can do the same amount of work with fewer
      lines of redundant code, which will make adding new filters easier.
      
      * src/conf/domain_conf.c (virDomainSnapshotNameData): Adjust
      struct.
      (virDomainSnapshotObjListCount): Delete, now taken care of...
      (virDomainSnapshotObjListCopyNames): ...here.
      (virDomainSnapshotObjListGetNames): Adjust caller to handle
      counting.
      (virDomainSnapshotObjListNum): Simplify.
      ec83c716
    • E
      snapshot: merge domain and snapshot computation · 7e111c6f
      Eric Blake 提交于
      Now that domain listing is a thin wrapper around child listing,
      it's easier to have a common entry point.  This restores the
      hashForEach optimization lost in the previous patch when there
      are no snapshots being filtered out of the entire list.
      
      * src/conf/domain_conf.h (virDomainSnapshotObjListGetNames)
      (virDomainSnapshotObjListNum): Add parameter.
      (virDomainSnapshotObjListGetNamesFrom)
      (virDomainSnapshotObjListNumFrom): Delete.
      * src/libvirt_private.syms (domain_conf.h): Drop deleted functions.
      * src/conf/domain_conf.c (virDomainSnapshotObjListGetNames):
      Merge, and (re)add an optimization.
      * src/qemu/qemu_driver.c (qemuDomainUndefineFlags)
      (qemuDomainSnapshotListNames, qemuDomainSnapshotNum)
      (qemuDomainSnapshotListChildrenNames)
      (qemuDomainSnapshotNumChildren): Update callers.
      * src/qemu/qemu_migration.c (qemuMigrationIsAllowed): Likewise.
      * src/conf/virdomainlist.c (virDomainListPopulate): Likewise.
      7e111c6f
    • E
      snapshot: use metaroot node to simplify management · 06d4a1e4
      Eric Blake 提交于
      This idea was first suggested by Daniel Veillard here:
      https://www.redhat.com/archives/libvir-list/2011-October/msg00353.html
      
      Now that I am about to add more complexity to snapshot listing, it
      makes sense to avoid code duplication and special casing for domain
      listing (all snapshots) vs. snapshot listing (descendants); adding
      a metaroot reduces the number of code lines by having the domain
      listing turn into a descendant listing of the metaroot.
      
      Note that this has one minor pessimization - if we are going to list
      ALL snapshots without filtering, then virHashForeach is more efficient
      than recursing through the child relationships; restoring that minor
      optimization will occur in the next patch.
      
      * src/conf/domain_conf.h (_virDomainSnapshotObj)
      (_virDomainSnapshotObjList): Repurpose some fields.
      (virDomainSnapshotDropParent): Drop unused parameter.
      * src/conf/domain_conf.c (virDomainSnapshotObjListGetNames)
      (virDomainSnapshotObjListCount): Simplify.
      (virDomainSnapshotFindByName, virDomainSnapshotSetRelations)
      (virDomainSnapshotDropParent): Match new field semantics.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML)
      (qemuDomainSnapshotReparentChildren, qemuDomainSnapshotDelete):
      Adjust clients.
      06d4a1e4
    • G
      openvz: Fix wordsize on 64 bit architectures · 7dcee3f9
      Guido Günther 提交于
      The word size there is 64 bit not 8.
      7dcee3f9
    • P
      conf: Add helper for listing domains on drivers supporting virDomainObj · 2c680804
      Peter Krempa 提交于
      This patch adds common code to list domains in fashion used by
      virListAllDomains with all currently supported flags. The header file
      also contains macros that group filters together that are used to
      shorten filter conditions.
      2c680804
    • P
      conf: Store managed save image existence in virDomainObj · bc8e1559
      Peter Krempa 提交于
      This patch stores existence of the image in the object. At start of the
      daemon the state is checked and then updated in key moments in domain
      lifecycle.
      bc8e1559
    • P
      remote: implement remote protocol for virConnectListAllDomains() · 9c9de4e6
      Peter Krempa 提交于
      This patch wires up the RPC protocol handlers for
      virConnectListAllDomains(). The RPC generator has no support for the way
      how virConnectListAllDomains() returns the results so the handler code
      had to be done manually.
      
      The new api is handled by REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS, with
      number 273 and marked with high priority.
      9c9de4e6
    • P
      python: add API exports for virConnectListAllDomains() · bd34cc8c
      Peter Krempa 提交于
      This patch adds export of the new API function
      virConnectListAllDomains() to the libvirt-python bindings. The
      virConnect object now has method "listAllDomains" that takes only the
      flags parameter and returns a python list of virDomain object
      corresponding to virDomainPtrs returned by the underlying api.
      
      The implementation is done manually as the generator does not support
      wrapping list of virDomainPtrs into virDomain objects.
      bd34cc8c
    • P
      lib: Add public api to enable atomic listing of guest · 747f64ee
      Peter Krempa 提交于
      This patch adds a new public api that lists domains. The new approach is
      different from those used before. There are key points to this:
      
      1) The list is acquired atomically and contains both active and inactive
      domains (guests). This eliminates the need to call two different list
      APIs, where the state might change in between the calls.
      
      2) The returned list consists of virDomainPtrs instead of names or ID's
      that have to be converted to virDomainPtrs anyways using separate calls
      for each one of them. This is more convenient and saves hypervisor calls.
      
      3) The returned list is auto-allocated. This saves a lot of hassle for
      the users.
      
      4) Built in support for filtering. The API call supports various
      filtering flags that modify the output list according to user needs.
      
      Available filter groups:
          Domain status:
          VIR_CONNECT_LIST_DOMAINS_ACTIVE, VIR_CONNECT_LIST_DOMAINS_INACTIVE
      
          Domain persistence:
          VIR_CONNECT_LIST_DOMAINS_PERSISTENT,
          VIR_CONNECT_LIST_DOMAINS_TRANSIENT
      
          Domain state:
          VIR_CONNECT_LIST_DOMAINS_RUNNING, VIR_CONNECT_LIST_DOMAINS_PAUSED,
          VIR_CONNECT_LIST_DOMAINS_SHUTOFF, VIR_CONNECT_LIST_DOMAINS_OTHER
      
          Existence of managed save image:
          VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE,
          VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE
      
          Auto-start option:
          VIR_CONNECT_LIST_DOMAINS_AUTOSTART,
          VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART
      
          Existence of snapshot:
          VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT,
          VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT
      
      5) The python binding returns a list of domain objects that is very neat
      to work with.
      
      The only problem with this approach is no support from code generators
      so both RPC code and python bindings had to be written manually.
      
      *include/libvirt/libvirt.h.in: - add API prototype
                                     - clean up whitespace mistakes nearby
      *python/generator.py: - inhibit generation of the bindings for the new
                              api
      *src/driver.h: - add driver prototype
                     - clean up some whitespace mistakes nearby
      *src/libvirt.c: - add public implementation
      *src/libvirt_public.syms: - export the new symbol
      747f64ee
    • D
      Add a custom 404 error page for the website · 72099c5b
      Daniel P. Berrange 提交于
      72099c5b
    • G
      LXC: fix incorrect DEBUG info · 3477e6b0
      Gao feng 提交于
      print debug info "container support is enabled"
      when host support the user or net namespace.
      Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
      3477e6b0
    • G
      LXC: fix memory leak in lxcContainerSetupExtraMounts · 0896265c
      Gao feng 提交于
      kill the "return 0;" code, it will cause memory leak.
      Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
      0896265c
    • E
      build: fix whitespace damage · 3c42abe6
      Eric Blake 提交于
      Introduced in commit 1f8c33b6.
      
      * src/lxc/lxc_container.c (lxcContainerGetSubtree): Avoid TAB.
      3c42abe6
  3. 18 6月, 2012 4 次提交
  4. 16 6月, 2012 7 次提交
    • M
      qemu_agent: Wait for events instead of agent response · d97a234c
      Michal Privoznik 提交于
      With latest changes to qemu-ga success on some commands is not reported
      anymore, e.g. guest-shutdown or guest-suspend-*. However, errors are
      still being reported. Therefore, we need to find different source of
      indication if operation was successful. Events.
      d97a234c
    • M
      qemu_agent: Add some more debug prints · c12d787e
      Michal Privoznik 提交于
      for agent ref count and qemuProcessHandleAgentDestroy
      c12d787e
    • E
      snapshot: use new virsh function for snapshot-list · 90a61b39
      Eric Blake 提交于
      Operating on a list of snapshot objects looks so much simpler.
      In particular, since the helper function already trimmed out
      irrelevant entries, we no longer have quite so many special cases
      on finding the first snapshot to operate on.  Also, vshTreePrint
      no longer has a generic callback struct; both clients now pass
      something different according to their own needs.
      
      * tools/virsh.c (cmdSnapshotList): Use previous patches.
      (vshTreeArrayLookup): Rename...
      (vshNodeListLookup): ...now that it only has one client.
      (cmdNodeListDevices): Adjust caller.
      90a61b39
    • E
      snapshot: new virsh function factored from snapshot-list · 76d397b0
      Eric Blake 提交于
      This patch is based on the fallback code out of cmdSnapshotList,
      with tweaks to keep the snapshot objects around rather than just
      their name, and to remove unwanted elements before returning.
      It looks forward to a future patch when we add a way to list all
      snapshot objects at once, and the next patch will simplify
      cmdSnapshotList to take advantage of this factorization.
      
      * tools/virsh.c (vshSnapshotList, vshSnapshotListFree): New functions.
      76d397b0
    • E
      build: hoist qemu dependence on yajl to configure · 350583c8
      Eric Blake 提交于
      Commit 6e769eba made it a runtime error if libvirt was compiled
      without yajl support but targets a new enough qemu.  But enough
      users are hitting this on self-compiled libvirt that it is worth
      erroring out at compilation time, rather than an obscure failure
      when trying to use the built executable.
      
      * configure.ac: If qemu is requested and -version works, require
      yajl when qemu version is new enough.
      * src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags): Add
      comment.
      350583c8
    • C
      autogen: Always abide --system · 2cd29c31
      Cole Robinson 提交于
      If we do ./autogen.sh && ./configure, then later try ./autogen.sh --system,
      configure isn't invoked with the requested params. Instead
      config.status --recheck is run.
      2cd29c31
    • J
      Check for errors when parsing bridge interface XML · cc004a66
      Jim Fehlig 提交于
      The return status of virInterfaceDefParseBridge() was not being
      checked, potentially resulting in the creation of a broken
      interface.
      cc004a66
  5. 15 6月, 2012 11 次提交
    • D
      Fix launch of libvirtd when DHCP snooping support is not available. · b9852862
      Daniel P. Berrange 提交于
      When libpcap is not available, the NWFilter driver provides a
      no-op stub for the DHCP snooping initialization. This was
      mistakenly returning '-1' instead of '0', so the entire driver
      initialization failed
      b9852862
    • D
      Add more debug logging for libvirtd startup · 50312d4b
      Daniel P. Berrange 提交于
      To facilitate future troubleshooting add a bunch more debugging
      statements into important startup parts of libvirt
      50312d4b
    • O
      schema: Update domain XML schema · b34324fb
      Osier Yang 提交于
      'boot' tag shouldn't be exclusive with 'kernel', 'initrd', and 'cmdline',
      though the boot sequence doesn't make sense when the guest boots from
      kernel directly. But it's useful if booting from kernel is to install
      a newguest, even if it's not to install a guest, there is no hurt. And
      on the other hand, we allow 'boot' and the kernel tags when parsing.
      b34324fb
    • W
      virsh: allow the user to specify vmcore's format · 440b8ad1
      Wen Congyang 提交于
      Add a new parameter --memory-only for 'virsh dump' command. So
      the user can decide the vmcore's format.
      440b8ad1
    • W
      qemu: allow the client to choose the vmcore's format · cdef31c5
      Wen Congyang 提交于
      This patch updates qemu driver to allow the client to choose the
      vmcore's format: memory only or including device state.
      cdef31c5
    • W
      qemu: implement qemu's dump-guest-memory · 6fe26d89
      Wen Congyang 提交于
      dump-guest-memory is a new dump mechanism, and it can work when the
      guest uses host devices. This patch adds a API to use this new
      monitor command.
      We will always use json mode if qemu's version is >= 0.15, so I
      don't implement the API for text mode.
      6fe26d89
    • W
      qemu: fix potential dead lock · 5136c579
      Wen Congyang 提交于
      If we lock the qemu_driver, we should call qemuDomainObjBeginJobWithDriver()
      not qemuDomainObjBeginJob().
      5136c579
    • O
      virsh: Null terminated the string memcpy from buffer explicitly · e3843d7f
      Osier Yang 提交于
      Detected by valgrind:
      
      ==16217== 1 errors in context 1 of 12:
      ==16217== Invalid read of size 1
      ==16217==    at 0x4A07804: __GI_strlen (mc_replace_strmem.c:284)
      ==16217==    by 0x3019F167F6: xdr_string (in /lib64/libc-2.12.so)
      ==16217==    by 0x3033709E8D: xdr_remote_nonnull_string (remote_protocol.c:31)
      ==16217==    by 0x303370E5CB: xdr_remote_domain_update_device_flags_args (remote_protocol.c:2028)
      ==16217==    by 0x30337197D1: virNetMessageEncodePayload (virnetmessage.c:341)
      ==16217==    by 0x30337135E1: virNetClientProgramCall (virnetclientprogram.c:327)
      ==16217==    by 0x30336F1EFD: callWithFD (remote_driver.c:4586)
      ==16217==    by 0x30336F1F7B: call (remote_driver.c:4607)
      ==16217==    by 0x30336F42F2: remoteDomainUpdateDeviceFlags (remote_client_bodies.h:2865)
      ==16217==    by 0x30336D46E5: virDomainUpdateDeviceFlags (libvirt.c:9457)
      ==16217==    by 0x41AEE8: cmdChangeMedia (virsh.c:15249)
      ==16217==    by 0x413CB4: vshCommandRun (virsh.c:18669)
      ==16217==  Address 0x4ec5e25 is 0 bytes after a block of size 293 alloc'd
      ==16217==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
      ==16217==    by 0x303364F1DB: virAllocN (memory.c:129)
      ==16217==    by 0x41A844: vshPrepareDiskXML (virsh.c:15043)
      ==16217==    by 0x41AECC: cmdChangeMedia (virsh.c:15246)
      ==16217==    by 0x413CB4: vshCommandRun (virsh.c:18669)
      ==16217==    by 0x423973: main (virsh.c:20261)
      e3843d7f
    • L
      docs: small typo in formatdomain.html · 8b36e32c
      Laine Stump 提交于
      8b36e32c
    • D
      Always pivot_root event if the new root source is '/' · e9d8861e
      Daniel P. Berrange 提交于
      This reverts
      
        commit c16b4c43
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Fri May 11 15:09:27 2012 +0100
      
          Avoid LXC pivot root in the root source is still /
      
      This commit broke setup of /dev, because the code which
      deals with setting up a private /dev and /dev/pts only
      works if you do a pivotroot.
      
      The original intent of avoiding the pivot root was to
      try and ensure the new root has a minimumal mount
      tree. The better way todo this is to just unmount the
      bits we don't want (ie old /proc & /sys subtrees.
      So apply the logic from
      
        commit c529b47a
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Fri May 11 11:35:28 2012 +0100
      
          Trim /proc & /sys subtrees before mounting new instances
      
      to the pivot_root codepath as well
      e9d8861e
    • D
      Improve error message diagnosing incorrect XML CPU mode · 92cbe7ae
      Daniel P. Berrange 提交于
      Tell the user what CPU mode value is wrong
      92cbe7ae