Commit Graph

273 Commits

Author SHA1 Message Date
Jiri Denemark
61299a1c98 virsh: Fix POD syntax
The first two hunks fix "Unterminated I<...> sequence" error and the
last one fixes "’=item’ outside of any ’=over’" error.
2012-10-26 12:25:14 +02:00
Jiri Denemark
ab54581549 virsh: Remove --flags from nodesuspend
We always expose individual bits from flags as separate options rather
than exposing a raw flags options. Since virNodeSuspendForDuration does
not currently support any flags, the only way of using this --flags
options that would not fail is "--flags 0", which is equivalent to
omitting the option. Thus it is highly unlikely anyone would actually be
using it and removing it should be safe.
2012-10-26 12:18:31 +02:00
Eric Blake
3cdf4dd49a snapshot: improve snapshot-list error message
https://bugzilla.redhat.com/show_bug.cgi?id=869100 mentioned some
confusion about 'virsh snapshot-list' errors.  Clean up a
misleading error message, and add some documentation.

* tools/virsh-snapshot.c (cmdSnapshotList): Mention --current
rather than --from when appropriate.
* tools/virsh.pod (snapshot-list): Mention that the named starting
point is NOT part of the list except under --tree.
2012-10-25 16:48:08 -06:00
Viktor Mihajlovski
08842171d4 virNodeGetCPUMap: Implement virsh support.
- Added a new host command nodecpumap
- Added documentation

Example:
$ virsh nodecpumap
CPUs present:  8
CPUs online:   3
CPU map:       y-y-y---

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2012-10-23 18:48:06 -06:00
Cole Robinson
2143ced7f5 docs: virsh: clarify behavior of send-key
https://bugzilla.redhat.com/show_bug.cgi?id=860004
2012-10-21 13:21:50 -04:00
Osier Yang
f81f0f2f1d node_memory: Add new parameter field to tune the new sysfs knob
Upstream kernel introduced new sysfs knob "merge_across_nodes" to
specify if pages from different numa nodes can be merged. When set
to 0, only pages which physically reside in the memory area of
same NUMA node can be merged. When set to 1, pages from all nodes
can be merged.

This patch supports the tuning by adding new param field
"shm_merge_across_nodes".
2012-10-15 17:35:54 +08:00
Ján Tomko
149c87b49d Various typos and misspellings 2012-10-12 00:03:43 +02:00
Jiri Denemark
28f8dfdccc Add MIGRATABLE flag for virDomainGetXMLDesc
Using VIR_DOMAIN_XML_MIGRATABLE flag, one can request domain's XML
configuration that is suitable for migration or save/restore. Such XML
may contain extra run-time stuff internal to libvirt and some default
configuration may be removed for better compatibility of the XML with
older libvirt releases.

This flag may serve as an easy way to get the XML that can be passed
(after desired modifications) to APIs that accept custom XMLs, such as
virDomainMigrate{,ToURI}2 or virDomainSaveFlags.
2012-10-11 15:11:42 +02:00
Eric Blake
2a1aaa609e virsh: add qemu-monitor-command --pretty
I was using qemu-monitor-command during development, and found it quite
hard to use.  Compare the results of this patch on ease of reading:

$ virsh qemu-monitor-command          dom '{"execute":"query-version"}'
{"return":{"qemu":{"micro":1,"minor":12,"major":0},"package":"(qemu-kvm-0.12.1.2)"},"id":"libvirt-7683"}

$ virsh qemu-monitor-command --pretty dom '{"execute":"query-version"}'
{
    "return": {
        "qemu": {
            "micro": 1,
            "minor": 12,
            "major": 0
        },
        "package": "(qemu-kvm-0.12.1.2)"
    },
    "id": "libvirt-7674"
}

* tools/virsh-host.c (cmdQemuMonitorCommand): New option.
* tools/virsh.pod (qemu-monitor-command): Document it.
2012-10-08 15:47:06 -06:00
Dave Allan
13c69cd0b4 Add note about numeric domain names to manpage
Clarify that domains with numeric names can only be identified by
their domain id.
2012-10-01 15:00:13 -06:00
Laine Stump
fe7872827f virsh: new net-update command
This command uses the new virNetworkUpdate() API to modify an existing
network definition, and optionally have those modifications take
effect immediately without restarting the network.

An example usage:

  virsh net-update mynet add-last ip-dhcp-host \
   "<host mac='00:11:22:33:44:55' ip='192.168.122.45'/>" \
   --live --config

If you like, you can instead put the xml into a file, and call like
this:

  virsh net-update mynet add ip-dhcp-host /tmp/myxml.xml
   --live --config

virsh will autodetect whether the argument is itself an xml element,
or if it's a file, by looking at the first character - the first
character of an xml element is always "<", and the first character of
a file is almost always *not* "<" (in the rare case that it is, the
user could specify "./<filename...").

A --parent-index option is also available (to give the index within a
list of parent objects, e.g. the index of the parent <ip> element when
updating ip-dhcp-host elements), but is optional and at least for now
will probably be used rarely.

--live, --config, and --current options - if you specify --live, only
the live state of the network will be updated. If you also specify
--config, then the persistent configuration will also be updated;
these two commands can be given separately, or both together. If you
don't specify either (you can optionally specify "--current" for the
same effect), then the "current" config will be updated (i.e. if the
network is active, then only its live config is affected, but if the
network is inactive, only the persistent config is affected).
2012-09-20 22:20:22 -04:00
Eric Blake
ed23b10660 blockjob: add virsh blockcommit
The new command 'virsh blockcommit $dom $disk' requests the start
of an asynchronous commit operation across the entire chain of
$disk.  Further arguments can fine-tune which portion of the
chain is committed.  Existing 'virsh blockjob' commands can then
track the status, change the bandwidth, or abort the commit job.

With a bit more on the command line, 'virsh blockcommit $dom $disk
--wait --verbose' can be used for blocking behavior, with visual
feedback on the overall status, and can be canceled with Ctrl-C.

The overall design, including the wait loop logic, borrows heavily
from the existing blockpull command.

* tools/virsh-domain.c (cmdBlockCommit): New function.
* tools/virsh.pod (blockcommit): Document it.
2012-09-17 21:44:49 -06:00
Peter Krempa
60b0284f24 virsh: Clarify behavior of domain list filtering.
Some combinations of filtering flags produce no result. This patch tries
to clarify this.
2012-09-17 16:35:24 +02:00
Osier Yang
0e96fa5489 node_memory: Expose the APIs to virsh
New command node-memory-tune to get/set the node memory parameters,
only two parameters are allowed to set (pages_to_scan, and sleep_millisecs,
see documents in this patch for more details).

Example of node-memory-tune's output:

Shared memory:
	pages_to_scan   100
	sleep_millisecs 20
	pages_shared    0
	pages_sharing   0
	pages_unshared  0
	pages_volatile  0
	full_scans      0
2012-09-17 13:55:35 +08:00
Osier Yang
d15d092cda list: Use virConnectListAllSecrets in virsh
This introduces four new options for secret-list, to filter the
returned secrets by whether it's ephemeral or not, and/or by
whether it's private or not.

* tools/virsh-secret.c: (New helper vshSecretSorter,
  vshSecretListFree, and vshCollectSecretList; Use the new
  API for secret-list; error out if flags are specified,
  because there is no way to filter the results when using
  old APIs (no APIs to get the properties (ephemeral, private)
  of a secret yet).

* tools/virsh.pod: Document the 4 new options.
2012-09-17 13:23:19 +08:00
Osier Yang
aa20e97578 list: Use virConnectListAllNodeDevices in virsh
tools/virsh-nodedev.c:
  * vshNodeDeviceSorter to sort node devices by name

  * vshNodeDeviceListFree to free the node device objects list.

  * vshNodeDeviceListCollect to collect the node device objects, trying
    to use new API first, fall back to older APIs if it's not supported.

  * Change option --cap to accept multiple capability types.

tools/virsh.pod
  * Update document for --cap
2012-09-17 11:32:53 +08:00
Osier Yang
895913dd59 list: Use virConnectListAllNetworks in virsh
tools/virsh-network.c:
  * vshNetworkSorter to sort networks by name

  * vshNetworkListFree to free the network objects list.

  * vshNetworkListCollect to collect the network objects, trying
    to use new API first, fall back to older APIs if it's not supported.

  * New options --persistent, --transient, --autostart, --no-autostart,
    for net-list, and new field 'Persistent' for its output.

tools/virsh.pod:
  * Add documents for the new options.
2012-09-11 18:35:06 +08:00
Osier Yang
6cdf0aafc8 virsh: Improve the document for pool-list
Which is lost by commit 93a346d353.
2012-09-07 11:10:48 +08:00
Osier Yang
93a346d353 list: Use virConnectListAllStoragePools in virsh
tools/virsh-pool.c:
  * vshStoragePoolSorter to sort the pool list by pool name.

  * struct vshStoragePoolList to present the pool list, pool info
    is collected by list->poolinfo if 'details' is specified by
    user.

  * vshStoragePoolListFree to free the pool list

  * vshStoragePoolListCollect to collect the pool list, new API
    virStorageListAllPools is tried first, if it's not supported,
    fall back to older APIs.

  * New options --persistent, --transient, --autostart, --no-autostart
    and --type for pool-list. --persistent or --transient is to filter
    the returned pool list by whether the pool is persistent or not.
    --autostart or --no-autostart is to filter the returned pool list
    by whether the pool is autostarting or not. --type is to filter
    the pools by pool types. E.g.

    % virsh pool-list --all --persistent --type dir,disk

tools/virsh.pod:
   * Add documentations for the new options.
2012-09-06 22:09:49 +08:00
Osier Yang
974a63305e virsh: Fix the wrong doc for pool-list
The storage pool's management doesn't relate with a domain, it
probably was an intention, but not achieved yet. And the fact
is only active pools are listed by default.
2012-09-06 22:04:56 +08:00
Martin Kletzander
aa698a49dd docs: correct dompmwakeup description 2012-09-05 06:36:55 +02:00
Jiri Denemark
eac1ab053c virsh: Document subdriver option of attach-disk 2012-08-31 13:30:19 +02:00
MATSUDA Daiki
bf51299d57 agent: add qemu-agent-command to virsh
Add qemu-agent-command to virsh to support virDomainQemuAgentCommand().

Signed-off-by: MATSUDA Daiki <matsudadik@intellilink.co.jp>
2012-08-23 19:11:03 +08:00
Stefan Hajnoczi
5b7f5a049c docs: fix blockpull/blockcopy bandwidth Mbps -> MiB/s
The bandwidth units for blockpull and blockcopy are in Megabytes per
Second, not Megabits per Second.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-08-22 17:15:56 +02:00
Hu Tao
e051c482aa new interface to control emulator_period/emulator_quota
This patch adds two macros: VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD,
VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA for controlling cpu bandwidth
for emulator activities not tied to vcpus
2012-08-22 16:56:41 +08:00
Hu Tao
4860596044 new command emulatorpin 2012-08-22 16:38:13 +08:00
Guannan Ren
7aea9b8cf7 util: set minimum value of nodesuspend duration to 60 seconds
Change the permissible minimum value of nodesuspend duration time
to 60 seconds. If option is less than the value, reports error.
Update virsh help and manpage the infomation.
2012-07-26 15:29:03 +08:00
Jan Tomko
aa03b1471c virsh man page - domain-id consistency
Using 'domain' to represent domain name, domain id or uuid all over
the man page, to be consistent with virsh help.
2012-07-25 12:03:28 -06:00
Jan Tomko
d9bbf217b1 virsh: Clarify that memtune parameters may be rounded in the man page 2012-07-24 15:34:49 -06:00
Guido Günther
0429e5f0c8 virsh: Add domhostname
to query the guest's hostname.
2012-07-20 21:54:35 +02:00
Jiri Denemark
3189dfb163 Clarify direct migration
When --direct is used when migrating a domain running on a hypervisor
that does not support direct migration (such as QEMU), the caller would
get the following error message:

    this function is not supported by the connection driver:
    virDomainMigrateToURI2

which is a complete nonsense since qemu driver implements
virDomainMigrateToURI2. This patch would emit a more sensible error in
this case:

    Requested operation is not valid: direct migration is not supported
    by the connection driver
2012-07-13 09:15:18 +02:00
Peter Krempa
e16d434da7 virsh: Clarify documentation for virsh dompmsuspend command
Clarify the docs to make more clear what this command does and that it
requires a guest agent running in the guest.
2012-07-09 19:38:22 +02:00
Doug Goldstein
421a200987 virsh: Add domdisplay cmd for VNC, SPICE and RDP
v2:
- Refactored to use virBuffer
- Refactored to use virXPath wrappers
- Added support for tls-port and password for SPICE
- Added optional flag to disable SPICE password to the URI
- Added support for RDP
- Fixed code reviews

Add a new 'domdisplay' command that provides a URI for VNC, SPICE and
RDP connections. Presently the 'vncdisplay' command provides you with
the port info that QEMU is listening on but there is no counterpart for
SPICE and RDP. Additionally this provides you with the bind address as
specified in the XML, which the existing 'vncdisplay' lacks. For SPICE
connections it supports secure and unsecure channels and optionally
providing the password for the SPICE channel.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2012-06-27 16:17:00 +02:00
Michal Privoznik
8d27005b50 storage: Introduce --inactive for pool-dumpxml
Storage is one of the last domains in libvirt where we don't fully
utilize inactive and live XML. Okay, it might be because we don't
have support for that. So implement such support. However, we need
to fallback when talking to old daemon which doesn't support this
new flag called VIR_STORAGE_XML_INACTIVE.
2012-06-25 13:23:28 +02:00
Peter Krempa
d62e51f86b virsh: add support for virConnectListAllDomains and clean up cmdList
This patch makes use of the newly added api virConnectListAllDomains()
to list domains in virsh.

Virsh now represents lists of domains using an internal structure
vshDomainList. This structure contains the virDomainPtr list as provided
by virConnectListAllDomains() and the count of domains in the list.

For backwards compatibility, the function vshDomainListCollect was added
that tries to enumerate the domains using the new API and if the API is
not supported falls back to the older approach with the two list
functions.  The helper function also simulates filtering by all
currently supported flags added with virConnectListAllDomains().

This patch also cleans up the "list" command handler to use the new
helpers and adds new command line flags to make use of filtering.
2012-06-21 16:07:06 +02:00
Eric Blake
35ae18f3c6 snapshot: expose new flags in virsh
Previously, to get the name of all snapshots with children, it was
necessary to get the name of all snapshots and then remove the
name of leaf snapshots.  This is racy, and somewhat inefficient
compared to planned API additions.  We can emulate --no-metadata on
0.9.5-0.9.12, but for now, there is no emulation of --no-leaves.

* tools/virsh.c (cmdSnapshotList): Add new options --no-leaves and
--no-metadata.
(vshSnapshotList): Emulate where possible.
* tools/virsh.pod (snapshot-list): Document them.
2012-06-19 13:50:03 -06:00
Martin Kletzander
3dc733bb01 virsh: fix few typos on desc command
virsh help fix:
 - <--title> can also /get/ the title

virsh man page:
 - missing <domain-id>
 - <new_desc> should be <new-desc>
2012-06-19 18:20:44 +02:00
Michal Privoznik
2872155bfe virsh: Update vol-create-as manpage
as we support qed format as well.
2012-06-18 14:40:32 +02:00
Michal Privoznik
cc75fcc90f virsh: Tweak attach-* documentation
as we are missing:
attach-disk: --type can accept 'lun' too, not just cdrom or floppy.
attach-disk: --target specify logical device name, not path
attach-interface: --target silently drops strings with vnet* prefix
2012-06-18 13:14:49 +02:00
Wen Congyang
440b8ad181 virsh: allow the user to specify vmcore's format
Add a new parameter --memory-only for 'virsh dump' command. So
the user can decide the vmcore's format.
2012-06-15 20:36:14 +08:00
Laine Stump
1f145b2f0f network: fully support/use VIR_NETWORK_XML_INACTIVE flag
commit 52d064f42d added
VIR_NETWORK_XML_INACTIVE in order to allow suppressing the
auto-generated list of VFs in network definitions, and a --inactive
flag to virsh net-dumpxml to take advantage of the flag. However, it
missed out on two opportunities:

1) Use INACTIVE to get the current config of the network as it
   exists on disk, rather than the currently active config.

2) Add INACTIVE to the flags used for the virsh net-edit command, so
   that it won't include the forward-pool interfaces that were
   autogenerated, and so that a re-edit of the network prior to
   restarting it will show any other edits made since the last restart
   of the network. (prior to this patch, if you edited a network a 2nd
   time without restarting, all of the previous edits would magically
   disappear).

In order to fit with the new #define-based generic edit function in
virsh.c, a new function vshNetworkGetXMLDesc() was added. This
function first tries to call virNetworkGetXMLDesc with the INACTIVE
flag added, then retries without if the first attempt fails (in the
manner expected when the server doesn't support it).
2012-06-13 14:53:35 -04:00
Eric Blake
757c47635d snapshot: add 'virsh snapshot-info'
Expose the recent API additions in virsh.  Borrows ideas from 'dominfo'
for the general type of information to display.

Output looks like:

$ tools/virsh snapshot-info fedora-local tmp
Name:           tmp
Domain:         fedora-local
Current:        no
State:          disk-snapshot
Parent:         -
Children:       1
Descendants:    2
Metadata:       yes

possibly with fewer lines when talking to older servers.

* tools/virsh.c (cmdSnapshotInfo): New command.
* tools/virsh.pod (snapshot-info): Document it.
2012-06-11 11:55:00 -06:00
Eric Blake
1f06c007fe blockjob: add 'blockcopy' to virsh
Rather than further overloading 'blockpull', I decided to create a
new virsh command to expose the new flags of virDomainBlockRebase.

Blocking until the command completes naturally is pointless, since
the block copy job is intended to run indefinitely.  Instead, I
made the command support three --wait modes: by default, it runs until
mirroring is started; with --pivot, it pivots as soon as mirroring
is started; and with --finish, it aborts (for a clean copy) as
soon as mirroring is started.

* tools/virsh.c (VSH_CMD_BLOCK_JOB_COPY): New mode.
(blockJobImpl): Support new flags.
(cmdBlockCopy): New command.
(cmdBlockJob): Support new job info, new abort flag.
* tools/virsh.pod (blockcopy, blockjob): Document the new command
and flags.
2012-04-23 07:44:30 -06:00
Peter Krempa
b83d76d40e virsh: Fix and clarify the --title flag for the list command in man page 2012-04-19 14:19:58 +02:00
Eric Blake
3b96a89242 blockjob: add virsh blockpull --wait
I'm tired of shell-scripting to wait for completion of a block pull,
when virsh can be taught to do the same.  I couldn't quite reuse
vshWatchJob, as this is not a case of a long-running command where
a second thread must be used to probe job status (at least, not unless
I make virsh start doing blocking waits for an event to fire), but it
served as inspiration for my simpler single-threaded loop.  There is
up to a half-second delay between sending SIGINT and the job being
aborted, but I didn't think it worth the complexity of a second thread
and use of poll() just to minimize that delay.

* tools/virsh.c (cmdBlockPull): Add new options to wait for
completion.
(blockJobImpl): Add argument.
(cmdBlockJob): Adjust caller.
* tools/virsh.pod (blockjob): Document new mode.
2012-04-17 11:11:47 -06:00
Adam Litke
a696f8b71a blockjob: add API for async virDomainBlockJobAbort
Block job cancellation can take a while.  Now that upstream qemu 1.1
has asynchronous block cancellation, we want to expose that to the user.
Therefore, the following updates are made to the virDomainBlockJob API:

A new block job event type VIR_DOMAIN_BLOCK_JOB_CANCELED is managed by
libvirt.  Regardless of the flags used with virDomainBlockJobAbort, this
event will be raised: 1. when using synchronous block_job_cancel (the
event will be synthesized by libvirt), and 2. whenever it is received
from qemu (via asynchronous block-job-cancel).  Note that the event
may be detected by libvirt even before the virDomainBlockJobAbort
completes (always true when it is synthesized, but also possible if
cancellation was fast).

A new extension flag VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC is added to the
virDomainBlockJobAbort API.  When enabled, this function will allow
(but not require) asynchronous operation (ie, it returns as soon as
possible, which might be before the job has actually been canceled).
When the API is used in this mode, it is the responsibility of the
caller to wait for a VIR_DOMAIN_BLOCK_JOB_CANCELED event or poll via
the virDomainGetBlockJobInfo API to check the cancellation status.

This patch also exposes the new flag through virsh, and makes virsh
slightly easier to use (--async implies --abort, and lack of any options
implies --info), although it leaves the qemu implementation for later
patches.

Signed-off-by: Adam Litke <agl@us.ibm.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2012-04-11 20:52:18 -06:00
Peter Krempa
cc5100654b virsh: Clarify use of the --managed-save flag for the list command
The documentation for the flag doesn't clearly state that the flag only
enhances the output and the user needs to specify other flags to list
inactive domains, that are enhanced by this flag.
2012-04-10 15:48:45 +02:00
Michal Privoznik
7960ce842b virsh: Clarify escape sequence
Currently, we put no strains on escape sequence possibly leaving users
with console that cannot be terminated. However, not all ASCII
characters can be used as escape sequence. Only those falling in
@ - _ can be; implement and document this constraint.
2012-04-03 17:03:53 +02:00
Eric Blake
3ff4b06968 snapshot: fix virsh docs
Commit d42a2ff forgot to touch up virsh documentation, and commit
4e9953a mis-spelled the option name.

* tools/virsh.pod (snapshot-create, snapshot-create-as): Fix typo
and match recent change in flag meaning.
2012-03-27 22:03:20 -06:00
Eric Blake
4d5533ca87 snapshot: add atomic create flag
Right now, it is appallingly easy to cause qemu disk snapshots
to alter a domain then fail; for example, by requesting a two-disk
snapshot where the second disk name resides on read-only storage.
In this failure scenario, libvirt reports failure, but modifies
the live domain XML in-place to record that the first disk snapshot
was taken; and places a difficult burden on the management app
to grab the XML and reparse it to see which disks, if any, were
altered by the partial snapshot.

This patch adds a new flag where implementations can request that
the hypervisor make snapshots atomically; either no changes to
XML occur, or all disks were altered as a group.  If you request
the flag, you either get outright failure up front, or you take
advantage of hypervisor abilities to make an atomic snapshot. Of
course, drivers should prefer the atomic means even without the
flag explicitly requested.

There's no way to make snapshots 100% bulletproof - even if the
hypervisor does it perfectly atomic, we could run out of memory
during the followup tasks of updating our in-memory XML, and report
a failure.  However, these sorts of catastrophic failures are rare
and unlikely, and it is still nicer to know that either all
snapshots happened or none of them, as that is an easier state to
recover from.

* include/libvirt/libvirt.h.in
(VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC): New flag.
* src/libvirt.c (virDomainSnapshotCreateXML): Document it.
* tools/virsh.c (cmdSnapshotCreate, cmdSnapshotCreateAs): Expose it.
* tools/virsh.pod (snapshot-create, snapshot-create-as): Document
it.
2012-03-23 16:38:20 -06:00