1. 16 12月, 2011 1 次提交
    • P
      virsh: Add option to undefine storage with domains · 3bb6bcfc
      Peter Krempa 提交于
      Add an option for virsh undefine command, to remove associated storage
      volumes while undefining a domain. This patch allows the user to remove
      associated (libvirt managed ) storage volumes while undefining a domain.
      
      The new option --storage for the undefine command takes a string
      argument that consists of comma separated list of target or source path
      of volumes to be undefined. Volumes are removed after the domain has
      been successfully undefined,
      
      If a volume is not part of a storage pool, the user is warned to remove
      the volume in question himself.
      
      Option --wipe-storage may be specified along with this, that ensures
      the image is wiped before removing.
      
      Option --remove-all-storage enables the user to remove all storage. The
      name is chosen long as the users should be aware what they're about to
      do.
      3bb6bcfc
  2. 14 12月, 2011 1 次提交
  3. 13 12月, 2011 1 次提交
  4. 12 12月, 2011 1 次提交
  5. 10 12月, 2011 1 次提交
    • A
      virsh: plug memory leak on cmdDomblklist · 9707c2a8
      Alex Jia 提交于
      Detected by valgrind. Leak introduced in commit 88a993b1:
      
      * tools/virsh.c: fix memory leak on cmdDomblklist.
      
      * how to reproduce?
        % valgrind -v --leak-check=full virsh domblklist <domain name>
      
      * actual valgrind result:
      
      ==6573== 1,836 bytes in 1 blocks are definitely lost in loss record 110 of 124
      ==6573==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
      ==6573==    by 0x330D71497D: xdr_string (in /lib64/libc-2.12.so)
      ==6573==    by 0x4D26CED: xdr_remote_nonnull_string (remote_protocol.c:30)
      ==6573==    by 0x4D28138: xdr_remote_domain_get_xml_desc_ret (remote_protocol.c:1418)
      ==6573==    by 0x4D3C0C2: virNetMessageDecodePayload (virnetmessage.c:382)
      ==6573==    by 0x4D3279F: virNetClientProgramCall (virnetclientprogram.c:382)
      ==6573==    by 0x4D0D50B: callWithFD (remote_driver.c:4339)
      ==6573==    by 0x4D0D5AB: call (remote_driver.c:4360)
      ==6573==    by 0x4D16EAF: remoteDomainGetXMLDesc (remote_client_bodies.h:861)
      ==6573==    by 0x4CF9F4F: virDomainGetXMLDesc (libvirt.c:4098)
      ==6573==    by 0x4154D9: cmdDomblklist (virsh.c:1722)
      ==6573==    by 0x4149E2: vshCommandRun (virsh.c:16365)
      ==6573==
      ==6573== 46,009 (352 direct, 45,657 indirect) bytes in 1 blocks are definitely lost in loss record 123 of 124
      ==6573==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
      ==6573==    by 0x3318286DC6: xmlXPathNewContext (in /usr/lib64/libxml2.so.2.7.6)
      ==6573==    by 0x4C79AE2: virXMLParseHelper (xml.c:779)
      ==6573==    by 0x415512: cmdDomblklist (virsh.c:1726)
      ==6573==    by 0x4149E2: vshCommandRun (virsh.c:16365)
      ==6573==    by 0x427743: main (virsh.c:17867)
      ==6573==
      ==6573== LEAK SUMMARY:
      ==6573==    definitely lost: 2,188 bytes in 2 blocks
      ==6573==    indirectly lost: 45,657 bytes in 332 blocks
      ==6573==      possibly lost: 0 bytes in 0 blocks
      ==6573==    still reachable: 128,034 bytes in 1,364 blocks
      ==6573==         suppressed: 0 bytes in 0 blocks
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      9707c2a8
  6. 09 12月, 2011 3 次提交
    • P
      virsh: return correct value from cmdDomIfGetLink · 62356296
      Peter Krempa 提交于
      Reported by Alex Jia <ajia@redhat.com>. Function cmdDomIfGetLink did not
      set a success return value on success path.
      
      Signed-off-by: Alex Jia<ajia@redhat.com>
      62356296
    • A
      virsh: plug memory leak on cmdDomIfGetLink() sucessful path · f582199e
      Alex Jia 提交于
      Detected by valgrind. Leak introduced in commit dc675f37:
      
      * tools/virsh.c: fix memory leak on cmdDomIfGetLink.
      
      * how to reproduce?
        % valgrind -v --leak-check=full virsh domif-getlink <domain name> 0
      
      * actual valgrind result:
      
      ==13102== 18 bytes in 1 blocks are definitely lost in loss record 9 of 47
      ==13102==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
      ==13102==    by 0x322A6A67DD: xmlStrndup (in /usr/lib64/libxml2.so.2.7.6)
      ==13102==    by 0x414892: cmdDomIfGetLink (virsh.c:1538)
      ==13102==    by 0x4136A2: vshCommandRun (virsh.c:16363)
      ==13102==    by 0x4253FB: main (virsh.c:17865)
      ==13102==
      ==13102== LEAK SUMMARY:
      ==13102==    definitely lost: 18 bytes in 1 blocks
      ==13102==    indirectly lost: 0 bytes in 0 blocks
      ==13102==      possibly lost: 0 bytes in 0 blocks
      ==13102==    still reachable: 127,888 bytes in 1,361 blocks
      ==13102==         suppressed: 0 bytes in 0 blocks
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      f582199e
    • A
      virsh: plug memory leak on cmdBlkdeviotune() sucessful path · ecf75f83
      Alex Jia 提交于
      Detected by valgrind. Leak introduced in commit e9bd9a08:
      
      * tools/virsh.c: fix memory leak on cmdBlkdeviotune.
      
      * how to reproduce?
        % valgrind -v --leak-check=full virsh blkdeviotune <domain name> <block device>
      
      * actual valgrind result:
      
      ==12759== 576 bytes in 1 blocks are definitely lost in loss record 18 of 29
      ==12759==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
      ==12759==    by 0x42134E: _vshCalloc.clone.2 (virsh.c:422)
      ==12759==    by 0x4217CB: cmdBlkdeviotune (virsh.c:6364)
      ==12759==    by 0x4136A2: vshCommandRun (virsh.c:16363)
      ==12759==    by 0x4253FB: main (virsh.c:17865)
      ==12759==
      ==12759== LEAK SUMMARY:
      ==12759==    definitely lost: 576 bytes in 1 blocks
      ==12759==    indirectly lost: 0 bytes in 0 blocks
      ==12759==      possibly lost: 0 bytes in 0 blocks
      ==12759==    still reachable: 126,964 bytes in 1,342 blocks
      ==12759==         suppressed: 0 bytes in 0 blocks
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      ecf75f83
  7. 08 12月, 2011 1 次提交
    • E
      build: fix build with older libxml2 · f59a9417
      Eric Blake 提交于
      On RHEL 5, with libxml2-2.6.26, the build failed with:
      virsh.c: In function 'vshNodeIsSuperset':
      virsh.c:11951: warning: implicit declaration of function 'xmlChildElementCount'
      
      (or if warnings aren't errors, a link failure later on).
      
      * src/util/xml.h (virXMLChildElementCount): New prototype.
      * src/util/xml.c (virXMLChildElementCount): New function.
      * src/libvirt_private.syms (xml.h): Export it.
      * tools/virsh.c (vshNodeIsSuperset): Use it.
      f59a9417
  8. 04 12月, 2011 1 次提交
    • E
      maint: fix improper use of 'an' · 3a9ce767
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=648855 mentioned a
      misuse of 'an' where 'a' is proper; that has since been fixed,
      but a search found other problems (some were a spelling error for
      'and', while most were fixed by 'a').
      
      * daemon/stream.c: Fix grammar.
      * src/conf/domain_conf.c: Likewise.
      * src/conf/domain_event.c: Likewise.
      * src/esx/esx_driver.c: Likewise.
      * src/esx/esx_vi.c: Likewise.
      * src/rpc/virnetclient.c: Likewise.
      * src/rpc/virnetserverprogram.c: Likewise.
      * src/storage/storage_backend_fs.c: Likewise.
      * src/util/conf.c: Likewise.
      * src/util/dnsmasq.c: Likewise.
      * src/util/iptables.c: Likewise.
      * src/xen/xen_hypervisor.c: Likewise.
      * src/xen/xend_internal.c: Likewise.
      * src/xen/xs_internal.c: Likewise.
      * tools/virsh.c: Likewise.
      3a9ce767
  9. 02 12月, 2011 1 次提交
  10. 01 12月, 2011 4 次提交
  11. 30 11月, 2011 2 次提交
  12. 29 11月, 2011 3 次提交
  13. 24 11月, 2011 1 次提交
    • J
      virsh: Always run event loop · fd7e85ac
      Jiri Denemark 提交于
      Since virsh already implements event loop, it has to also run it. So far
      the event loop was only running during virsh console command.
      fd7e85ac
  14. 23 11月, 2011 1 次提交
    • M
      virsh: Increase device-detach intelligence · ea7182c2
      Michal Prívozník 提交于
      Up to now users have to give a full XML description on input when
      device-detaching. If they omitted something it lead to unclear
      error messages (like generated MAC wasn't found, etc.).
      With this patch users can specify only those information which
      specify one device sufficiently precise. Remaining information is
      completed from domain.
      ea7182c2
  15. 17 11月, 2011 1 次提交
    • L
      virsh: add iface-bridge and iface-unbridge commands · 1ae8eed1
      Laine Stump 提交于
      One of the top questions by libvirt users is how to create a host
      bridge device so that guests can be directly on the physical
      network. There are several example documents that explain how to do
      this manually, but following them often results in confusion and
      failure. virt-manager does a good job of creating a bridge based on an
      existing network device, but not everyone wants to use virt-manager.
      
      This patch adds a new command, iface-bridge that makes it just about
      as simple as possible to create a new bridge device based on an
      existing ethernet/vlan/bond device (including associating IP
      configuration with the bridge rather than the now-attached device),
      and start that new bridge up ready for action, eg:
      
          virsh iface-bridge eth0 br0
      
      For symmetry's sake, it also adds a command to remove a device from a
      bridge, restoring the IP config to the now-unattached device:
      
          virsh iface-unbridge br0
      
      (I had a short debate about whether to do "iface-unbridge eth0"
      instead, but that would involve searching through all bridge devices
      for the one that contained eth0, which seems like a bit too much
      trouble).
      
      NOTE: These two commands require that the netcf library be available
      on the host. Hopefully this will provide some extra incentive for
      people using suse, debian, ubuntu, and other similar systems to polish
      up (and push downstream) the ports to those distros recently pushed to
      the upstream netcf repo by Dan Berrange. Anyone interested in helping
      with that effort in any way should join the netcf-devel mailing list
      (subscription info at
      https://fedorahosted.org/mailman/listinfo/netcf-devel)
      
      During creation of the bridge, it's possible to specify whether or not
      the STP protocol should be started up on the bridge and, if so, how
      many seconds the bridge should squelch traffic from newly added
      devices while learning new topology (defaults are stp='on' and
      delay='0', which seems to usually work best for bridges used in the
      context of libvirt guests).
      
      There is also an option to not immediately start the bridge (and a
      similar option to not immediately start the un-attached device after
      destroying the bridge. Default is to start the new device, because in
      the case of iface-unbridge not starting is strongly discouraged as it
      will leave the system with no network connectivity on that interface
      (because it's necessary to destroy/undefine the bridge device before
      the unattached device can be defined), and it seemed better to make
      the option for iface-bridge behave consistently.
      
      NOTE TO THOSE TRYING THESE COMMANDS FOR THE FIRST TIME: to guard
      against any "unexpected" change to configuration, it is advisable to
      issue an "virsh iface-begin" command before starting any interface
      config changes, and "virsh iface-commit" only after you've verified
      that everything is working as you expect. If something goes wrong,
      you can always run "virsh iface-rollback" or reboot the system (which
      should automatically do iface-rollback).
      
      Aside from adding the code for these two functions, and the two
      entries into the command table, the only other change to virsh.c was
      to add the option name to vshCommandOptInterfaceBy(), because the
      iface-unbridge command names its interface option as "bridge".
      
      virsh.pod has also been updated with short descriptions of these two
      new commands.
      1ae8eed1
  16. 15 11月, 2011 1 次提交
    • 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
  17. 10 11月, 2011 1 次提交
    • 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
  18. 09 11月, 2011 1 次提交
  19. 28 10月, 2011 1 次提交
    • R
      virsh: Fix error message on vol-create-from failure · 6b5c9936
      Ryota Ozaki 提交于
      If vol-create-from is failed due to 'input volume not found',
      virsh outputs like this:
        $ sudo virsh vol-create-from testpool test-vol.xml test.img
        error: failed to get vol 'test.img', specifying --pool might help
        error: Storage volume not found: no storage vol with matching path
      However, '--pool' is incorrect because it is already specified as
      second argument ('testpool' in this case). It should be "--inputpool".
      
      The patch fixes this by using pooloptname, which will be "inputpool"
      in this case and "pool" in other cases, as error message.
      6b5c9936
  20. 24 10月, 2011 1 次提交
    • R
      virsh: Fix vol-info's 'Type' output · 9981fc58
      Ryota Ozaki 提交于
      We have a new vol type "dir" in addition to "file" and "block", but
      virsh doesn't know it. Fix it.
      
      Additionally, the patch lets virsh output "unknown" if not matched
      any of them.
      9981fc58
  21. 20 10月, 2011 1 次提交
  22. 19 10月, 2011 1 次提交
  23. 13 10月, 2011 2 次提交
    • M
      virDomainCoreDump: Introduce VIR_DUMP_RESET flag · 4dadfe59
      Michal Privoznik 提交于
      This flag is intended to allow user to do so called system reset
      after dump, instead of sending ACPI reboot event.
      4dadfe59
    • E
      snapshot: add API for filtering by leaves · 8b6d1a20
      Eric Blake 提交于
      Counterpart to --roots.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_SNAPSHOT_LIST_LEAVES):
      New flag.
      * src/libvirt.c (virDomainSnapshotNum, virDomainSnapshotListNames)
      (virDomainSnapshotNumChildren)
      (virDomainSnapshotListChildrenNames): Document it.
      * tools/virsh.c (cmdSnapshotList): Expose it.
      * tools/virsh.pod (snapshot-list): Document --leaves.
      8b6d1a20
  24. 12 10月, 2011 1 次提交
    • E
      snapshot: virsh shorthand for operating on current snap · b77b203c
      Eric Blake 提交于
      Rather than having to do:
      
      $ virsh snapshot-revert dom $(virsh snapshot-current dom --name)
      
      I thought it would be nice to do:
      
      $ virsh snapshot-revert dom --current
      
      I didn't add 'virsh snapshot-dumpxml --current' since we already have
      'virsh snapshot-current' for the same task.  snapshot-list accepted
      a name but did not require it, and that remains the case, with
      --current serving in place of that name.  For all other commands,
      name used to be required, and can now be replaced by --current;
      I intentionally made it so that omitting both --current and a name
      is an error (having the absence of a name imply --current seems
      just a bit too magic, so --current must be explicit).  I also had
      to keep snapshot-edit backwards-compatible, as the only command
      that already had a --current argument alongside a name, which still
      works to both edit a named snapshot and make it current.
      
      * tools/virsh.c (vshLookupSnapshot): New helper function.
      (cmdSnapshotEdit, cmdSnapshotList, cmdSnapshotParent)
      (cmdSnapshotDelete, cmdDomainSnapshotRevert): Use it, adding an
      option where needed.
      * tools/virsh.pod (snapshot-delete, snapshot-edit)
      (snapshot-list, snapshot-parent, snapshot-revert): Document
      use of --current.
      (snapshot-dumpxml): Mention alternative.
      b77b203c
  25. 11 10月, 2011 6 次提交
    • E
      snapshot: virsh fallback for snapshot-list --descendants --from · 521cc447
      Eric Blake 提交于
      Given a list of snapshots and their parents, finding all descendants
      requires a hairy traversal.  This code is O(n^3); it could maybe be
      made to scale O(n^2) with the use of a hash table, but that costs more
      memory.  Hopefully there aren't too many people with a hierarchy
      so large as to approach REMOTE_DOMAIN_SNAPSHOT_LIST_NAMES_MAX (1024).
      
      * tools/virsh.c (cmdSnapshotList): Add final fallback.
      521cc447
    • E
      snapshot: virsh fallback for snapshot-list --from children · 16d7b390
      Eric Blake 提交于
      Iterating over one level of children requires parsing all snapshots
      and their parents; a bit of code shuffling makes it pretty easy
      to do this as well.
      
      * tools/virsh.c (cmdSnapshotList): Add another fallback.
      16d7b390
    • E
      snapshot: virsh fallback for snapshot-list --tree --from · 51082301
      Eric Blake 提交于
      Emulating --from requires grabbing the entire list of snapshots
      and their parents, and recursively iterating over the list from
      the point of interest - but we already do that for --tree.  This
      turns on emulation for that situation.
      
      * tools/virsh.c (__vshControl): Rename member.
      (vshReconnect, cmdConnect, vshGetSnapshotParent): Update clients.
      (cmdSnapshotList): Add fallback.
      51082301
    • E
      snapshot: virsh snapshot-list and children · fe383bb5
      Eric Blake 提交于
      Sometimes, we only care about one branch of the snapshot hierarchy.
      Make it easier to list a single branch, by using the new APIs.
      
      Technically, I could emulate these new virsh options on old servers
      by doing a complete dump, then scraping xml to filter out just the
      snapshots that I care about, but I didn't want to do that in this patch.
      
      * tools/virsh.c (cmdSnapshotList): Add --from, --descendants.
      * tools/virsh.pod (snapshot-list): Document them.
      fe383bb5
    • E
      snapshot: avoid accidental renames with snapshot-edit · bab4f31c
      Eric Blake 提交于
      I was a bit surprised that 'virsh snapshot-edit dom name' silently
      allowed me to clone things, while still telling me the old name,
      especially since other commands like 'virsh edit dom' reject rename
      attempts (*).  This fixes things to be more explicit (**).
      
      (*) Technically, 'virsh edit dom' relies on virDomainDefineXML
      behavior, which rejects attempts to mix a new name with existing
      uuid or new uuid with existing name, but you can create a new
      domain by changing both uuid and name.  On the other hand, while
      snapshot-edit --clone is a true clone, creating a new domain
      would also have to decide whether to clone snapshot metadata,
      managed save, and any other secondary data related to the domain.
      Domain renames are not trivial either.
      
      (**) Renaming or creating a clone is still a risky proposition -
      for offline snapshots and system checkpoints, if the new name
      does not match an actual name recorded in the qcow2 internal
      snapshots, then you cannot revert to the new checkpoint.  But it
      is assumed that anyone using the new virsh flags knows what they
      are doing, and can deal with the fallout caused by a rename/clone;
      that is, we can't completely prevent a user from shooting
      themselves in the foot, so much as we are making the default
      action less risky.
      
      * tools/virsh.c (cmdSnapshotEdit): Add --rename, --clone.
      * tools/virsh.pod (snapshot-edit): Document them.
      bab4f31c
    • E
      snapshot: sort snapshot-list --tree · 40baa1c8
      Eric Blake 提交于
      Otherwise, the results are not repeatable.
      
      * tools/virsh.c (cmdSnapshotList): Print tree in predictable order.
      40baa1c8
  26. 07 10月, 2011 1 次提交