Commit Graph

94 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Chris Lalancette
270895063d Fix a virsh edit memory leak
When running virsh edit, we are unlinking and setting
the tmp variable to NULL before going to the end of the
function, meaning that we never free tmp.  Since the
exit to the function will always unlink and free tmp,
just remove this bit of code and let it get done at the
end.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-29 09:16:33 -04:00
Chris Lalancette
52ae076a94 Fix memory leak in virsh snapshot-list.
We were forgetting to release the memory allocated by
virDomainSnapshotListNames.  Free the memory properly.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-23 14:23:27 -04:00
Jim Meyering
cd7ee20a68 vshCommandRun: avoid used-uninitialized timing-related report from clang
* tools/virsh.c (vshCommandRun): Test only the initial value of
ctl->timing, so that static analyzers don't have to consider that
it might be changed by cmd->def->handler.
2010-04-14 16:17:56 +02:00
Chris Lalancette
e2e000cf1b Rename virsh "revert-to-snapshot" to "snapshot-revert"
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-12 10:09:55 -04:00
Daniel P. Berrange
3d3af08879 Fix Win32 portability problems
The network filter / snapshot / hooks code introduced some
non-portable pices that broke the win32 build

* configure.ac: Check for net/ethernet.h required by nwfile config
   parsing code
* src/conf/nwfilter_conf.c: Define ethernet protocol  constants
  if net/ethernet.h is missing
* src/util/hooks.c: Disable hooks build on Win32 since it lacks
  fork/exec/pipe
* src/util/threads-win32.c: Fix unchecked return value
* tools/virsh.c: Disable SIGPIPE on Win32 since it doesn't exist.
  Fix non-portable strftime() formats
2010-04-08 12:01:57 +01:00
Chris Lalancette
28b9a6c769 Clarify an error message in setmem.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-06 09:56:44 -04:00
Chris Lalancette
23b1e5c0b0 Better error reporting in virsh.
When hitting failures in virsh, a common idiom is
to jump to a cleanup label, free some resources, and
then return a FALSE error code to vshCommandRun.
In theory, vshCommandRun is then supposed to print
out the last error.  The problem is that many of
the cleanup paths have library calls to free resources,
and all of those library calls clear out the last error.
This is leading to situations where no error is being
reported at all.

This patch remedies the situation somewhat by
printing out the errors inside the command methods
themselves when we know it will go through a cleanup
path that will lose the error.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-06 09:48:13 -04:00
Chris Lalancette
88151c7cbc Snapshot virsh implementation.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-05 10:25:02 -04:00
Daniel Veillard
d068f9609c Add a managedsave command to virsh
This command implements the managed save operation

* tools/virsh.c: new command
* tools/virsh.pod: documentation
2010-04-04 11:36:59 +02:00
Eric Blake
890af4ca8f virsh: add 'exit' as an alias for 'quit'
Call me lazy: some shells use exit (e.g. sh), others use quit (e.g. ftp),
but I never remember which.  So it's faster to write a patch to make
virsh take both than it is to take a 50-50 guess, and get it wrong
in half of my attempts.

* tools/virsh.c (commands): Add 'exit'.
* tools/virsh.pod: Document it.
2010-03-31 08:40:06 -06:00
Eric Blake
f3661756c1 virsh: support VISUAL, and allow metacharacters in EDITOR
Common Unix practice is to prefer VISUAL over EDITOR, particularly if
the editor of choice spawns a new window.  Thus, it is also common to
see settings like EDITOR='emacs -nw', with the expectation that the
shell will parse this as an argument to 'emacs' and not try to invoke
a file containing a space.

If a user puts junk in EDITOR, they deserve what they get (much more
than virsh will misbehave); furthermore, sudo scrubs EDITOR by
default.  So the blind use of metacharacters in EDITOR should not be
considered too much of a security issue.

* tools/virsh.c (editFile): Prefer VISUAL over EDITOR.  Don't
reject shell metacharacters in EDITOR.
* tools/virsh.pod (edit, net-edit, ENVIRONMENT): Document VISUAL.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=487738.
2010-03-29 16:38:51 -06:00
Jiri Denemark
e455b221be Introduce UPDATE_CPU flag for virDomainGetXMLDesc
This flag is used in migration prepare step to send updated XML
definition of a guest.

Also ``virsh dumpxml --update-cpu [--inactive] guest'' command can be
used to see the updated CPU requirements.
2010-03-26 23:05:23 +01:00
Stefan Berger
929560384d Add virsh support for new CLI commands
This patch adds virsh support for the five new CLI commands to manage
network filters.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2010-03-26 18:01:16 +00:00
Daniel P. Berrange
ced154cb54 Introduce a update-device command in virsh
Support the new virDomainUpdateDeviceFlags API in virsh by adding
a new 'update-device' command. In the future this should be augmented
with an explicit 'change-disk' command for media change to make it
end user discoverable, as attach-disk is.

* tools/virsh.c: Add 'update-device' command
2010-03-26 14:17:35 +00:00
Jiri Denemark
5ee592208c Add migrate-setmaxdowntime command to virsh 2010-03-19 22:57:10 +01:00
David Allan
3535092f3a Virsh support for vol wiping 2010-03-19 14:44:47 -04:00
Chris Lalancette
3ebbc241a1 Fix crash in virsh after bogus command
If you ran virsh in interactive mode and ran a command
that virsh could not parse, it would then SEGV
on subsequent commands.  The problem is that we are
freeing the vshCmd structure in the syntaxError label
at the end of vshCommandParse, but forgetting to
set ctl->cmd to NULL.  This means that on the next command,
we would try to free the same structure again, leading
to badness.

* tools/virsh.c: Make sure to set ctl->cmd to NULL after
  freeing it in vshCommandParse()
2010-03-12 12:00:46 +01:00
Chris Lalancette
be2a53e6e0 Fix virsh command 'cd'
* tools/virsh.c: cmdCd was returning a 0 on success and -1 on error,
  when the rest of the code expected a TRUE on success and a
  FALSE on error.
2010-03-12 11:49:16 +01:00