Commit Graph

138 Commits

Author SHA1 Message Date
Laine Stump
7c5f80e2f0 Fix build error in virsh.c
Another gettext string with no format args sent to printf as a format string.
2010-08-03 10:37:34 -04:00
Eric Blake
aa2d747350 build: avoid compiler warning, for real this time
* tools/virsh.c (vshParseArgv): Drop spurious argument to printf.
2010-08-02 14:16:03 -06:00
Eric Blake
a7d65ee9c1 Fix virsh error message when -d arg is not numeric 2010-08-02 22:03:13 +02:00
Daniel Veillard
b259bab8e7 Make virsh -d check its input
it was using atoi direct without checking leading to confusion
in case of flag error for example with -c

* tools/virsh.c: vshParseArgv() use virStrToLong_i and remove the
  unchecked atoi used to parse teh parameter
2010-08-02 21:20:26 +02:00
Chris Lalancette
cd35e8927f Fix a NULL dereference in the case that the arg in question
didn't exist.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-20 12:51:12 -04:00
Chris Lalancette
963a5b7a08 Make virsh setmaxmem balloon only when successful.
After playing around with virsh setmaxmem for a bit,
I ran into some surprising behavior; if a hypervisor does
not support the virDomainSetMaxMemory() API, but the value
specified for setmaxmem is less than the current amount
of memory in the domain, the domain would be ballooned
down *before* an error was reported.

To make this more consistent, run virDomainSetMaxMemory()
before trying to shrink; that way, if an error is thrown,
no changes to the running domain are made.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-20 09:44:14 -04:00
Chris Lalancette
4af1817d1d Use unsigned long in cmdSetmem.
The virsh command "setmem" takes as input a number that
should represent an unsigned long number of kilobytes.  Fix
cmdSetmem to properly parse this as an unsigned long instead
of an int.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-20 09:35:29 -04:00
Chris Lalancette
4487d33f67 Always clear out the last_error in virshReportError.
Otherwise you can get bogus "unknown error" printouts on
subsequent commands.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-19 14:56:29 -04:00
Chris Lalancette
0cdff7b5e7 Fix up inconsistent virsh option error reporting.
The virsh option error reporting was not being used
consistently; some commands would spit out errors on
missing required options while others would just silently fail.
However, vshCommandOptString knows which ones are required
and which ones aren't, so make it spit out an error where
appropriate.  The rest of the patch is just cleaning up
the uses of vshCommandOptString to deal with the new error
reporting.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-19 14:51:00 -04:00
Justin Clift
de7d4c6ae7 man pages: update authors and copyright notice for libvirtd and virsh
This patch removes the individual author names from the libvirtd and virsh
man pages, instead referring to the main AUTHORS file distributed with
libvirt.  This approach is needed, as we can't guarantee unicode support
across all versions of pod2man used with libvirt.

Additionally, this patch includes the libvirtd man page in the spec file
used with "make rpm".  Without this patch "make rpm" is broken.
2010-07-17 04:51:01 +10:00
Chris Lalancette
ee41ba665b Fix compile on i686.
When printing out size_t, we need to use %zu to make sure it
will continue to compile on both 32-bit and 64-bit platforms.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-16 09:14:53 -04:00
Chris Lalancette
ac475b9f83 Remove unused and bitrotting vshCommandOptStringList
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-16 09:07:21 -04:00
Chris Lalancette
9aa236e19f Remove error checking after using vshMalloc.
vshMalloc and friends always exit() on allocation failure,
so there is no reason to do checking for NULL in the code
that uses it.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-16 09:07:00 -04:00
Chris Lalancette
de6380726b Remove the "showerror" parameter from vshConnectionUsability.
Nobody was using it anyway.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-16 09:06:43 -04:00
Laine Stump
73b9dfeb31 Eliminate compiler warning due to gettext string with no format args 2010-07-12 23:35:43 -04:00
Jiri Denemark
2d14615a75 virsh: Fix man page syntax
pod2man prints the following warning when generating virsh.1:

    tools/virsh.pod:890: Unmatched =back
2010-07-12 19:45:22 +02:00
Justin Clift
f5271fc166 virsh: add new --details option to vol-list
This patch adds a new --details option to the virsh vol-list
command, making its output more useful when many luns are
present.

Addresses BZ # 605543

  https://bugzilla.redhat.com/show_bug.cgi?id=605543
2010-07-09 23:35:28 +10:00
Chris Lalancette
bfe2bef106 Fix a compile error in the previous commit.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-08 08:49:01 -04:00
Chris Lalancette
d222626af4 Implement virsh managedsave-remove command.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-08 08:42:39 -04:00
Eric Blake
26752f3be1 virsh: tweak help output for VSH_OT_DATA
https://bugzilla.redhat.com/show_bug.cgi?id=609044 complained
that 'virsh help pool-create-as' didn't document the shortcut
that you can do 'virsh pool-create-as $name $type --target $target'
rather than having to supply the four optional source- arguments
in order to fill out the necessary positional arguments.

This one-liner changes the help output to hopefully make this more obvious:

  NAME
    pool-create-as - create a pool from a set of args

  SYNOPSIS
    pool-create-as <name> [--print-xml] <type> [<source-host>] [<source-path>] [<source-dev>] [<source-name>] [<target>] [--source-format <string>]

  DESCRIPTION
    Create a pool.

  OPTIONS
    [--name] <string>  name of the pool
    --print-xml      print XML document, but don't define/create
    [--type] <string>  type of the pool
    [--source-host] <string>  source-host for underlying storage
    [--source-path] <string>  source path for underlying storage
    [--source-dev] <string>  source device for underlying storage
    [--source-name] <string>  source name for underlying storage
    [--target] <string>  target for underlying storage
    --source-format <string>  format for underlying storage

* tools/virsh.c (vshCmddefHelp): Make it more obvious that data
arguments may, but not must, be specified by option leaders.
2010-06-30 07:17:40 -06:00
Justin Clift
415b14903e virsh: add new --details option to pool-list
This patch adds a new --details option to the virsh pool-list
command, making its output more useful to people who use virsh
for significant lengths of time.

Addresses BZ # 605543

  https://bugzilla.redhat.com/show_bug.cgi?id=605543
2010-06-29 08:37:39 -06:00
Eric Blake
4cc2b6d676 virsh: document attach-disk better
http://bugzilla.redhat.com/601143, part 1 - document existing
behavior.  Ever since Mar 2010 (commit ced154cb), the use of
'attach-disk' or 'attach-device' to change cdrom/floppy media has been
documented but deprecated, but the replacement to use 'update-device'
was not documented.

* tools/virsh.c (cmdAttachInterface, cmdAttachDisk): Fix bad error
message.
* tools/virsh.pod (attach-device, attach-disk): Refer to
update-device for cdrom and floppy behavior.
(update-device): Add documentation.
2010-06-23 08:35:40 -06:00
Justin Clift
c7a33939bc virsh: remove a doubled up include for errno.h 2010-06-21 10:11:34 +02:00
Justin Clift
2b39cd355a virsh: add --uuid option to vol-pool
Adds an optional switch, --uuid, for telling the virsh vol-pool command
to return the pool UUID rather than pool name.
2010-06-17 14:45:34 -06:00
Justin Clift
c2160b137d virsh: ensure persistence and autostart are shown for dominfo and pool-info
This patch adds the persistence status (yes/no) to the output of the virsh
dominfo and pool-info commands.  This patch also adds the autostart status
to the output of the virsh pool-info command.

Red Hat BZ for this:

  https://bugzilla.redhat.com/show_bug.cgi?id=603696
2010-06-17 11:57:54 -06:00
Justin Clift
07be2403b6 virsh: change printf() calls to vshPrint()
Trivial fix changing printf() calls to vshPrint() where the ctl
variable is available.
2010-06-16 17:17:08 -06:00
Justin Clift
7d38d7b49b virsh: improve help text for vol query commands
Improves the help text for vol-path, vol-name, and vol-key, which
previously referred to volume UUIDs.

Addresses BZ # 598365.
2010-06-16 16:32:05 -06:00
Justin Clift
31495ef6a1 virsh: add pool support to vol-key command
Presently the vol-key command only supports being provided with
a volume path.

This patch adds support for providing it with a pool and volume
identifier pair as well.

    virsh # vol-key --pool <pool-name-or-uuid> <vol-name-or-path>
2010-06-16 16:32:05 -06:00
Justin Clift
043f05fda4 virsh: mark autostart answers for translation
This is a trivial fix for several autostart yes/no strings that
weren't correctly marked for translation.
2010-06-15 15:36:27 -06:00
Eric Blake
cbe6ebdb53 virsh: add start --paused support
Make 'start --paused' mirror 'create --paused'.

* tools/virsh.c (cmdStart): Use new virDomainCreateWithFlags API
when needed.
* tools/virsh.pod (start): Document --paused.
2010-06-15 09:50:58 -06:00
Justin Clift
b28a068b43 virsh: add snapshot backing store support to vol-create-as
This patch adds two new parameters to the vol-create-as command:

 --backing-vol <volume-name-or-key-or-path>
 --backing-vol-format <format-of-backing-vol>

  virsh # vol-create-as guest_images_lvm snapvol1 5G --backing-vol \
              rhel6vm1lun1
  Vol snapvol1 created

  virsh # vol-create-as image_dir qcow2snap2 5G --format qcow2 \
              --backing-vol imagevol1.qcow2 \
              --backing-vol-format qcow2
  Vol qcow2snap2 created

Additionally, the virsh man page update fixes incorrect snapshot
parameters that were included in my prior bulk volume command patch.
2010-06-10 12:03:13 -06:00
Justin Clift
c09f663a47 virsh: fixed trivial comment and debug message in vshCommandOptVolBy function 2010-06-09 06:16:54 -06:00
Justin Clift
74231267f8 virsh: remove xen reference in header comment
With libvirt and virsh now being used for much more than Xen, this
patch removes the outdated reference to Xen in the file header.
2010-06-09 05:18:27 -06:00
Justin Clift
cd2b18968d virsh: add the volume commands to the virsh man page
This patch also includes the new vol-pool command.
2010-06-08 18:59:29 -06:00
Justin Clift
62f8674d62 virsh: add new vol-pool command
This patch adds a new "vol-pool" command to virsh, to round out the
identifier conversion functions for volumes in virsh.  Now it is
possible to work with volumes when starting from just a volume key
or volume path.
2010-06-08 18:55:07 -06:00
Eric Blake
734bbf0ea9 virsh: add --paused option to create
* tools/virsh.c (opts_create): Add --paused option.
(cmdCreate): Pass appropriate flag.
* tools/virsh.pod: Document it.
2010-06-08 15:41:53 -06:00
Justin Clift
3093daf184 virsh: fix minor virsh man page typos and formatting problems
Signed-off-by: Eric Blake <eblake@redhat.com>
2010-06-07 18:22:42 -06:00
Justin Clift
3db47cb5d2 Add --source-format argument to virsh pool-define-as and pool-create-as
This is the corresponding patch for the virsh man page (virsh.pod).
2010-06-01 16:58:00 -06:00
Justin Clift
b221973a11 Add --source-format argument to virsh pool-define-as and pool-create-as
When creating pools from dedicated disks, the existing pool-define-as
and pool-create-as commands are a bit non-optimal.

Ideally, a person would be able to specify all of the required options
directly on the command line instead of having to edit the XML.

At the moment, there is no way to specify the format type (ie gpt) so it
gets included in the XML the pool is constructed with.

Please find attached a simple (tested) patch to add an optional
"--source-format 'type'" to virsh.  This is patched against current git
master and will apply cleanly.

Also created a Red Hat BZ ticket for this (#597790) for tracking.
2010-06-01 16:57:17 -06:00
Justin Clift
e5f31f461f Trivial virsh.pod additions --all for "list" command and similar
This is just a trivial patch to virsh.pod (from git master). It adds the
following pieces to the virsh man page:

  + Shows the --inactive and --all optional parameters for the list
    command.

    Closes Bugzilla #575512, reported by Renich Bon Ciric
    https://bugzilla.redhat.com/show_bug.cgi?id=575512

  + Corrects the existing description of the list command, to now say
    that only running domains are listed if no domains are specified.

    The man page up until this point has said all domains are listed if
    no domains are specified, which is incorrect.

  + Adds the "shut off" state to the list of states for the list
    command.

  + Adds a missing =back around line 755, that pod2man was complaining
    was missing.
2010-06-01 16:46:51 -06:00
Matthias Bolte
32d9e0707c Add VIR_STORAGE_POOL_INACCESSIBLE to denote inaccessible storage pools
This status will be used by the ESX storage driver.

For example a running NFS pool is inaccessible when the NFS server is
currently unreachable.
2010-05-18 01:34:34 +02:00
Eric Blake
6e5b5bbc0a build: fix up some compiler flags
Matthias noted that the line:
virt_aa_helper_LDFLAGS = $(WARN_CFLAGS)
looks inconsistent, so I did an audit.

Currently, the set of compiler warning flags passed to gcc as $CC are
equally permitted as the set of linker flags passed to gcc as $LD, so
there was no problem with that usage.  But if we ever get in a
situation where $CC and $LD treat particular flags differently, using
the right variable form will make it easier.

In the process, I spotted a couple of typos that were omitting useful
flags, as well as specifying a -l under the wrong variable.

* acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Define WARN_LDFLAGS as
an alias for WARN_CFLAGS.
* tools/Makefile.am (virsh_LDFLAGS): Use more canonical spelling.
* proxy/Makefile.am (libvirt_proxy_LDFLAGS): Likewise. Move
library...
(libvirt_proxy_LDADD): ...here.
* src/Makefile.am (virt_aa_helper_LDFLAGS): Use more canonical
spelling of WARN_LDFLAGS.
(libvirt_parthelper_LDFLAGS, libvirt_lxc_LDFLAGS): Likewise.  Use
correct spelling of COVERAGE_LDFLAGS.
Reported by Matthias Bolte.
2010-05-17 09:12:42 -06:00
Eric Blake
e8a1a730fe build: update gnulib
* .gnulib: Update to latest.
* bootstrap.conf (gnulib_modules): Import netdb.
* src/esx/esx_util.c (AI_ADDRCONFIG): Rely on gnulib.
* src/remote/remote_driver.c (AI_ADDRCONFIG): Likewise.
* tools/virsh.c (WEXITSTATUS, O_SYNC): Likewise.
2010-05-11 10:03:48 -06:00
Jim Meyering
9a641564fb virsh: schedinfo --set invalid=value would simply ignore the option
For example, virsh -c test:///default schedinfo 1 --set P=k would
mistakenly exit successfully, giving no indication that it had failed
to set the scheduling parameter "P".
* tools/virsh.c (cmdSchedinfo): Diagnose an invalid --set j=k option,
rather than silently ignoring it.
* tests/virsh-schedinfo: New test for the above.
* tests/Makefile.am (test_scripts): Add it.
Reported by Jintao Yang in http://bugzilla.redhat.com/586632
2010-05-11 16:37:15 +02:00
Jim Meyering
5603515127 virsh: fix a typo in a diagnostic
* tools/virsh.c (cmdSchedInfoUpdate): Fix typo in a diagnostic:
s/an long long/a long long/.  One in a comment, too.
2010-05-11 16:06:53 +02:00
Kenneth Nagin
b0a3f8b6c5 qemu: live migration with non-shared storage for kvm
Support for live migration between hosts that do not share storage was
added to qemu-kvm release 0.12.1.
It supports two flags:
-b migration without shared storage with full disk copy
-i migration without shared storage with incremental copy (same base image
shared between source and destination).

I tested the live migration without shared storage (both flags) for native
and p2p with and without tunnelling.  I also verified that the fix doesn't
affect normal migration with shared storage.
2010-05-04 16:03:36 -06:00
Eric Blake
9f87b631ce build: prefer WIN32 over __MINGW32__ checks
WIN32 is always defined when __MINGW32__ is defined, but the
converse is not true.  WIN32 is more generic, if someone were
to ever attempt porting to a microsoft compiler.  This does
not affect Cygwin, which intentionally does not define WIN32.

* src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Use more
generic flag macro.
* src/storage/storage_backend.c
(virStorageBackendUpdateVolTargetInfoFD)
(virStorageBackendRunProgRegex): Likewise.
* tools/console.h (vshRunConsole): Likewise.
2010-05-03 16:03:24 -06:00
Laine Stump
2b50cae54e Fix memory leaks in cmdInterfaceEdit and cmdNWFilterEdit.
This applies a fix to thos functions similar to that made to cmdEdit
in 270895063d, thus fnixing a memory
leak - if tmp is unlinked and NULLed early in the function, the memory
used by tmp is never freed. Since we will always unlink tmp prior to
freeing its memory at the end of the function, just remove the earlier
code and let cleanup: do the cleanup.
2010-05-03 11:16:08 -04:00
Dustin Kirkland
c179a0f63c Fix virt-pki-validate's determination of CN
Ubuntu's gntls package generates an Issuer line that looks like this:
        Issuer: C=US,ST=NY,L=Rochester,O=example.com,CN=example.com CA,EMAIL=hostmaster@example.com

While Red Hat's looks like this
Issuer: CN=Red Hat Emerging Technologies

Note the leading whitespace, and the additional fields in the former.

This patch updates the regular expression to:
 * trim leading characters before "Issuer:"
 * trim anything between Issuer: and CN=
 * trim anything after the next ,

I've tested this against the certool output of both RH and Ubuntu
generated certs.

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2010-04-29 20:10:46 -06:00
Daniel P. Berrange
7703c2c90a Add new domblkinfo command to virsh
virsh # domblkinfo demoguest /dev/hda2
  Capacity:       1048576000
  Allocation:     104857600
  Physical:       104857600

* tools/virsh.c: Implement domblkinfo command mapping to the
  new virDomainGetBlockInfo API
2010-04-29 17:21:32 +01:00