Commit Graph

887 Commits

Author SHA1 Message Date
Peter Krempa
edbdc45b6d virsh-host: Update host commands to use vshCommandOptStringReq 2013-02-04 14:17:44 +01:00
Peter Krempa
fa956d9055 virsh-domain: Update domain commands to use vshCommandOptStringReq 2013-02-04 14:17:44 +01:00
Peter Krempa
f605be8235 virsh-domain-monitor: Update domain commands to use vshCommandOptStringReq 2013-02-04 14:17:44 +01:00
Peter Krempa
1daa4ba33a virsh-volume: Update volume commands to use vshCommandOptStringReq 2013-02-04 14:17:44 +01:00
Peter Krempa
98007c8138 virsh-pool: Update pool commands to use vshCommandOptStringReq
Rework most of option string retrievals to the new helper.
2013-02-04 14:17:43 +01:00
Peter Krempa
41b5e8451b virsh: Add helper to request string arguments with error reporting
This patch adds a helper function with similar semantics to
vshCommandOptString that requests a string argument, but does some error
reporting without the need to do it in the functions themselves.

The error reporting also provides information about the parameter whose
retrieval failed.
2013-02-04 14:17:39 +01:00
Peter Krempa
d1de0c3d1a virsh-pool: Rename helper function buildPoolXML to vshBuildPoolXML 2013-02-04 10:56:27 +01:00
Peter Krempa
042bf709a9 virsh-volume: Rename helper function makeCloneXML to vshMakeCloneXML 2013-02-04 10:34:33 +01:00
Peter Krempa
f4464002fc virsh-snapshot: Fix coding style and remove dead code
buffer won't be NULL in any case when reaching the check and the first
block of the if statement was lacking parentheses
2013-02-04 10:34:33 +01:00
John Ferlan
46b1d8cf7a Enforce return check on virAsprintf() calls
Way back when I started making changes for Coverity messages my first set
were to a bunch of CHECKED_RETURN errors.  In particular virAsprintf() had
a few callers that Coverity noted didn't check their return (although some
did check if the buffer being printed to was NULL or not).

It was suggested at the time as a further patch an ATTRIBUTE_RETURN_CHECK
should be added to virAsprintf(), see:

https://www.redhat.com/archives/libvir-list/2013-January/msg00120.html

This patch does that and fixes a few more instances not found by Coverity
that failed the check.
2013-01-30 14:42:22 -07:00
Peter Krempa
366a3d52ee snapshot: Mention disk-only snapshots in error message
When a disk-only snapshot is requested the domain is treated as if it
was offline. This forbids to mix memory checkpoints with the DISK_ONLY
flag.

This patch improves the error message and mentions the restriction in
the virsh man page.
2013-01-30 11:08:41 +01:00
Jiri Denemark
b8a32e0e94 build: Regenerate man pages on version bump
Whenever libvirt version changes in configure.ac, we need to regenerate
man pages so that they contain correct version info.
2013-01-29 13:23:19 +01:00
Peter Krempa
f8d5119e4f virsh: Add --print-xml flag for attach-disk command
The flag causes the XML of the disk that would be attached to be printed
instead.
2013-01-25 20:53:37 +01:00
Satoru Moriya
3dbabd29f5 node_memory: Add '\n' to help message
Linefeed is missed in the help of node-memory-tune.
This patch just adds '\n' to get a correct help message.

Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
2013-01-25 13:25:59 +08:00
Peter Krempa
a54f25a946 virsh-domain: Refactor error paths for cmdCPUStats
This patch fixes the following issues in the cpu-stats virsh command:

1) Renames label failed_params to no_memory to match coding style
2) Uses proper typed parameter cleanup in error paths to avoid leaks
3) Adds a ret variable and simplifies error labels
4) Changes error message to a slightly more descriptive one and gets rid
   of the newline at the end:

Before:
$ virsh cpu-stats tr
error: Failed to virDomainGetCPUStats()

error: Requested operation is not valid: domain is not running

After:
$ tools/virsh cpu-stats tr
error: Failed to retrieve CPU statistics for domain 'tr'
error: Requested operation is not valid: domain is not running
2013-01-22 17:36:45 +01:00
John Ferlan
0ce43ca4ab virsh: Need to intialize 'str'
It was possible to call VIR_FREE in error prior to initialization.
2013-01-22 17:29:26 +01:00
Jiri Denemark
de78bf604c Introduce virTypedParamsClear public API
The function is just a renamed public version of former
virTypedParameterArrayClear.
2013-01-18 15:04:00 +01:00
Jiri Denemark
f52e9f1f4d virsh: Use virTypedParams* APIs in cpu-stats 2013-01-18 15:04:00 +01:00
Jiri Denemark
c7805f4099 virsh: Use virTypedParams* APIs in node-memory-tune 2013-01-18 15:04:00 +01:00
Jiri Denemark
ec3e50644e virsh: Use virTypedParams* APIs in numatune 2013-01-18 15:04:00 +01:00
Jiri Denemark
7786233009 virsh: Use virTypedParams* APIs in memtune 2013-01-18 15:03:59 +01:00
Jiri Denemark
2e467de44a virsh: Use virTypedParams* APIs in domblkstat 2013-01-18 15:03:59 +01:00
Jiri Denemark
e982dacb45 virsh: Use virTypedParams* APIs in schedinfo 2013-01-18 15:03:59 +01:00
Jiri Denemark
9b2d2446af virsh: Use virTypedParams* APIs in domiftune 2013-01-18 15:03:59 +01:00
Jiri Denemark
39e5173a3d virsh: Use virTypedParams* APIs in blkiotune 2013-01-18 15:03:59 +01:00
Jiri Denemark
a8fca0da06 virsh: Use virTypedParams* APIs in blkdeviotune 2013-01-18 15:03:59 +01:00
Michal Privoznik
4909bcbbc1 virsh-volume.c: Switch to C99 initialization of vshCmdOptDef 2013-01-17 13:58:53 +01:00
Michal Privoznik
8571608924 virsh-snapshot.c: Switch to C99 initialization of vshCmdOptDef 2013-01-17 13:58:53 +01:00
Michal Privoznik
7c959c61de virsh-secret.c: Switch to C99 initialization of vshCmdOptDef 2013-01-17 13:58:53 +01:00
Michal Privoznik
20b19324e5 virsh-pool.c: Switch to C99 initialization of vshCmdOptDef 2013-01-17 13:58:53 +01:00
Michal Privoznik
7b48d69207 virsh-nwfilter.c: Switch to C99 initialization of vshCmdOptDef 2013-01-17 13:58:53 +01:00
Michal Privoznik
d140e25949 virsh-nodedev.c: Switch to C99 initialization of vshCmdOptDef 2013-01-17 13:58:53 +01:00
Michal Privoznik
b2621046c2 virsh-network.c: Switch to C99 initialization of vshCmdOptDef 2013-01-17 13:58:52 +01:00
Michal Privoznik
d54384187b virsh-interface.c: Switch to C99 initialization of vshCmdOptDef 2013-01-17 13:58:52 +01:00
Michal Privoznik
d616254849 virsh-host.c: Switch to C99 initialization of vshCmdOptDef 2013-01-17 13:58:52 +01:00
Michal Privoznik
9a069f94ec virsh-domain-monitor.c: Switch to C99 initialization of vshCmdOptDef 2013-01-17 13:58:52 +01:00
Michal Privoznik
99419bd11e virsh-domain.c: Switch to C99 initialization of vshCmdOptDef 2013-01-17 13:58:52 +01:00
Michal Privoznik
0f6c46c3d7 virsh.c: Switch to C99 initialization of vshCmdOptDef 2013-01-17 13:58:52 +01:00
John Ferlan
e69a85cc2b tools: Check return status on virBufferTrim() 2013-01-16 10:43:13 +01:00
John Ferlan
6c7c7cabf9 virsh: Remove unused setting of 'br_node' and 'if_node' 2013-01-15 23:43:10 +01:00
Daniel P. Berrange
e397f658b0 Add 'lxc-enter-namespace' command to virsh
Add a 'lxc-enter-namespace' command which accepts a domain name
and then a command + args to run, attached to the container

eg

  virsh -c lxc:/// lxc-enter-namespace demo -- /bin/ps -auxf

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-15 19:09:47 +00:00
Eric Blake
c726d9eca5 docs: remove extra "
* tools/virsh.pod: Fix typo.
2013-01-14 16:47:23 -07:00
Daniel P. Berrange
3d1596b048 Introduce an LXC specific public API & library
This patch introduces support for LXC specific public APIs. In
common with what was done for QEMU, this creates a libvirt_lxc.so
library and libvirt/libvirt-lxc.h header file.

The actual APIs are

  int virDomainLxcOpenNamespace(virDomainPtr domain,
                                int **fdlist,
                                unsigned int flags);

  int virDomainLxcEnterNamespace(virDomainPtr domain,
                                 unsigned int nfdlist,
                                 int *fdlist,
                                 unsigned int *noldfdlist,
                                 int **oldfdlist,
                                 unsigned int flags);

which provide a way to use the setns() system call to move the
calling process into the container's namespace. It is not
practical to write in a generically applicable manner. The
nearest that we could get to such an API would be an API which
allows to pass a command + argv to be executed inside a
container. Even if we had such a generic API, this LXC specific
API is still useful, because it allows the caller to maintain
the current process context, in particular any I/O streams they
have open.

NB the virDomainLxcEnterNamespace() API is special in that it
runs client side, so does not involve the internal driver API.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-14 13:58:34 +00:00
Daniel P. Berrange
d3b05abfa9 Convert HAVE_UDEV to WITH_UDEV
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-14 13:26:47 +00:00
Peter Krempa
d0b8bc8565 virsh: Reformat output of virsh net-list
This patch changes whitespace and the length of the separation line from
this format:

$ virsh net-list --all
Name                 State      Autostart     Persistent
--------------------------------------------------
default              inactive   yes           yes

to

$ virsh net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              inactive   yes           yes

to match the output of virsh list.
2013-01-11 14:05:52 +01:00
Daniel P. Berrange
4da3000c66 Convert HAVE_SANLOCK to WITH_SANLOCK
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-11 11:03:23 +00:00
Daniel P. Berrange
24bcd8d45a Move qemu-XXX commands from virsh-host.c to virsh-domain.c
The QEMU specific APIs all operate on domains, not the host,
so should be in the virsh-domain.c file / group

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-01-08 08:56:49 +00:00
Eric Blake
5ec4b22b77 build: .service files don't need to be executable
See also commit 66ff2dd, where we avoided installing these files
as executables.

* daemon/Makefile.am (libvirtd.service): Drop chmod.
* tools/Makefile.am (libvirt-guests.service): Likewise.
* src/Makefile.am (virtlockd.service, virtlockd.socket):
Likewise.
2013-01-07 08:56:36 -07:00
Eric Blake
462a69621e build: use common .in replacement mechanism
We had several different styles of .in conversion in our Makefiles:
ALLCAPS, @ALLCAPS@, @lower@, ::lower::
Canonicalize on one form, to make it easier to copy and paste
between .in files.

Also, we were using some non-portable sed constructs: \@ is an
undefined escape sequence (it happens to be @ itself in GNU sed,
but POSIX allows it to mean something else), as well as risky
behavior (failure to consistently quote things means a space
in $(sysconfdir) could throw things off; also, Autoconf recommends
using | rather than , or ! in the s||| operator, because | has to
be quoted in shell and is therefore less likely to appear in file
names than , or !).

Fix all of these uses to follow the same syntax.

* daemon/libvirtd.8.in: Switch to @var@.
* tools/virt-xml-validate.in: Likewise.
* tools/virt-pki-validate.in: Likewise.
* src/locking/virtlockd.init.in: Likewise.
* daemon/Makefile.am: Prefer | over ! in sed.
(libvirtd.8): Prefer consistent substitution.
(libvirtd.init, libvirtd.service): Avoid non-portable sed.
* tools/Makefile.am (libvirt-guests.sh, libvirt-guests.init)
(libvirt-guests.service): Likewise.
(virt-xml-validate, virt-pki-validate, virt-sanlock-cleanup):
Prefer consistent capitalization.
* src/Makefile.am (virtlockd.init, virtlockd.service)
(virtlockd.socket): Prefer consistent substitution.
2013-01-07 08:56:36 -07:00
Daniel P. Berrange
f24404a324 Rename virterror.c virterror_internal.h to virerror.{c,h} 2012-12-21 11:19:50 +00:00