1. 29 11月, 2011 2 次提交
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 09 11月, 2011 1 次提交
  8. 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
  9. 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
  10. 20 10月, 2011 1 次提交
  11. 19 10月, 2011 1 次提交
  12. 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
  13. 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
  14. 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
  15. 07 10月, 2011 3 次提交
    • T
      virsh: Update the help information for undefine command. · d5c4067d
      tangchen 提交于
      virsh undefine command can now undefine an active guest, but the help information is still the old.
      This patch modifies it and make it coincident to the manpage of virsh.
      Signed-off-by: Ntangchen <tangchen@cn.fujitsu.com>
      d5c4067d
    • E
      snapshot: let virsh edit disk snapshots · 731f9a5e
      Eric Blake 提交于
      It was impossible for 'virsh snapshot-current dom name' to set name
      as the current snapshot, if name is a disk-only snapshot.
      
      Using strstr rather than full-blown xml parsing is safe, since the
      xml is assumed to be well-formed coming from libvirtd rather than
      arbitrary text coming from the user.
      
      * tools/virsh.c (cmdSnapshotCurrent, cmdSnapshotEdit): Pass
      disk_only flag when redefining a disk snapshot.
      731f9a5e
    • E
      snapshot: fix virsh error message typo · 203b361f
      Eric Blake 提交于
      * tools/virsh.c (cmdSnapshotList): Spell exclusive correctly.
      203b361f
  16. 06 10月, 2011 1 次提交
    • E
      snapshot: add REVERT_FORCE to API · 3c797404
      Eric Blake 提交于
      Although reverting to a snapshot is a form of data loss, this is
      normally expected.  However, there are two cases where additional
      surprises (failure to run the reverted state, or a break in
      connectivity to the domain) can come into play.  Requiring extra
      acknowledgment in these cases will make it less likely that
      someone can get into an unrecoverable state due to a default revert.
      
      Also create a new error code, so users can distinguish when forcing
      would make a difference, rather than having to blindly request force.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_SNAPSHOT_REVERT_FORCE):
      New flag.
      * src/libvirt.c (virDomainRevertToSnapshot): Document it.
      * include/libvirt/virterror.h (VIR_ERR_SNAPSHOT_REVERT_RISKY): New
      error value.
      * src/util/virterror.c (virErrorMsg): Implement it.
      * tools/virsh.c (cmdDomainSnapshotRevert): Add --force to virsh.
      * tools/virsh.pod (snapshot-revert): Document it.
      3c797404
  17. 05 10月, 2011 1 次提交
    • E
      snapshot: better virsh handling of missing current, parent · 64703c03
      Eric Blake 提交于
      Previously, virsh 'snapshot-parent' and 'snapshot-current' were
      completely silent in the case where the code conclusively proved
      there was no parent or current snapshot, but differed in exit
      status; this silence caused some confusion on whether the commands
      worked.  Furthermore, commit d1be48f9 introduced a regression where
      snapshot-parent would leak output about an unknown function, but
      only on the first attempt, when talking to an older server that
      lacks virDomainSnapshotGetParent.  This changes things to consistenly
      report an error message and exit with status 1 when no snapshot
      exists, and to avoid leaking unknown function warnings when using
      fallbacks.
      
      * tools/virsh.c (vshGetSnapshotParent): Alter signature, to
      distinguish between real error and missing parent.  Don't pollute
      last_error on success.
      (cmdSnapshotParent): Adjust caller.  Always output message on
      failure.
      (cmdSnapshotList): Adjust caller.
      (cmdSnapshotCurrent): Always output message on failure.
      64703c03
  18. 01 10月, 2011 1 次提交
    • M
      virsh: do not unlink NULL file · 41bf4e72
      Marc-André Lureau 提交于
      error:could not take a screenshot of xp
      ==6216== Syscall param unlink(pathname) points to unaddressable byte(s)
      ==6216==    at 0x373A0D4937: unlink (syscall-template.S:82)
      ==6216==    by 0x40FD73: cmdScreenshot (virsh.c:3070)
      ==6216==    by 0x42BA0D: vshCommandRun (virsh.c:14920)
      ==6216==    by 0x42EC97: main (virsh.c:16379)
      ==6216==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
      ==6216==
      error:Requested operation is not valid: domain is not running
      41bf4e72
  19. 29 9月, 2011 1 次提交
  20. 28 9月, 2011 4 次提交
  21. 22 9月, 2011 3 次提交
    • O
      virsh: Do not ignore the specified flags for cmdSaveImageDefine · f858bcb2
      Osier Yang 提交于
      Introduced by commit 42c52d53, which added the support for new
      flags, but forgot to update the API use to pass the flags.
      f858bcb2
    • E
      virsh: fix regression in argv parsing · 466f9024
      Eric Blake 提交于
      Prior to commit 85d28108, we had an issue where:
      
      snapshot-create-as dom name --diskspec spec --diskspec spec
      
      failed to parse the second spec, because the first spec had marked
      that option as no longer requiring an argument.
      
      In commit 85d28108, I fixed it by making argv options no longer mark
      the option as seen.  But this in turn breaks mandatory argv options,
      which now complain that the argv option is missing.
      
      This patch reverts that part of 85d28108, and instead replaces it with
      fixes to no longer clear opts_need_arg of an argv argument.
      
      * tools/virsh.c (vshCmddefGetOption, vshCmddefGetData)
      (vshCommandParse): Fix option parsing for required argv option.
      (vshCmddefOptParse): Check that argv option is last.
      * tests/virsh-optparse: Enhance test.
      466f9024
    • O
      virsh: More friendly err if no pool is specified for looking up a vol · 2f059524
      Osier Yang 提交于
      There are 3 ways to lookup a volume, only virStorageVolLookupByName
      needs pool object. So if no --pool is specified, it will tries to
      get the volume via virStorageVolLookupByPath/virStorageVolLookupByKey.
      
      But if all 3 ways fails, and no --pool is specified, a friendly
      error might help the user get right way quickly.
      2f059524
  22. 21 9月, 2011 1 次提交
  23. 20 9月, 2011 2 次提交
    • E
      virsh: tweak previous domblkstat patch · 6d1c11e5
      Eric Blake 提交于
      Translators are likely to botch trailing spacing; by doing the
      formatting outside of the translation, we can generally get
      better alignment.  Also, for consistency, use 'bytes read' to
      match 'bytes written'.
      
      * tools/virsh.c (domblkstat_output): Drop trailing space. Tweak
      rd_bytes output.
      (cmdDomblkstat, DOMBLKSTAT_LEGACY_PRINT): Update formatting.
      6d1c11e5
    • P
      virsh: Add more human-friendly output of domblkstat command · 619077b9
      Peter Krempa 提交于
      Users of virsh complain that output of the domblkstat command
      is not intuitive enough. This patch adds explanation of fields
      returned by this command to the help section for domblkstat and
      the man page of virsh. Also a switch --human is added for
      domblkstat that prints the fields with more descriptive
      texts.
      
      This patch also changes sequence of the output fields and their
      names back to the order and spelling established by previous
      versions of virsh to maintain compatibility with scripts.
      
      Example of ordered and "translated" output:
      
      PRE-patch:
      
      virsh # domblkstat 1 vda
      vda wr_bytes 5170176
      vda wr_operations 511
      vda rd_bytes 82815488
      vda rd_operations 3726
      
      POST-patch:
      
      virsh # domblkstat 1 vda
      vda rd_req 3726
      vda rd_bytes 82815488
      vda wr_req 478
      vda wr_bytes 4965376
      
      Example of human readable output:
      
      virsh # domblkstat 1 vda --human
      Device: vda
       number of read operations:      3726
       number of read bytes:           82815488
       number of write operations:     478
       number of bytes written:        4965376
      
      https://bugzilla.redhat.com/show_bug.cgi?id=731656
      619077b9
  24. 16 9月, 2011 2 次提交
    • J
      qemu: Introduce shutdown reason for paused state · d2d67763
      Jiri Denemark 提交于
      Qemu sends STOP event as part of the shutdown process. Detect such STOP
      event and consider shutdown to be reason of emitting such event. That's
      the best we can do until qemu provides us the reason directly in STOP
      event. This allows us to report shutdown reason for paused state so that
      apps can detect domains that failed to finish the shutdown process
      (e.g., because qemu is buggy and doesn't exit on SIGTERM or it is
      blocked in flushing disk buffers).
      d2d67763
    • E
      Revert "virsh: Use old API if remote libvirtd does not support new" · e9f55e46
      Eric Blake 提交于
      This reverts commit 799912fa; now
      that the rpc regression is fixed, virsh no longer needs the special
      case here.
      e9f55e46