]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agostorage: Error out if the target is already mounted for netfs pool
Osier Yang [Wed, 27 Jun 2012 14:02:23 +0000 (22:02 +0800)]
storage: Error out if the target is already mounted for netfs pool

mnt_fsname can not be the same, as we check the duplicate pool
sources earlier before, means it can't be the same pool, moreover,
a pool can't be started if it's already active anyway. So no reason
to act as success.

12 years agoconfigure: show correct default argument in help
Marc-André Lureau [Thu, 28 Jun 2012 00:21:49 +0000 (02:21 +0200)]
configure: show correct default argument in help

Pushed without ack, under the trivial rule.

12 years agoevents: Don't fail on registering events for two different domains
Michal Privoznik [Wed, 27 Jun 2012 10:06:45 +0000 (12:06 +0200)]
events: Don't fail on registering events for two different domains

virConnectDomainEventRegisterAny() takes a domain as an argument.
So it should be possible to register the same event (be it
VIR_DOMAIN_EVENT_ID_LIFECYCLE for example) for two different domains.
That is, we need to take domain into account when searching for
duplicate event being already registered.

12 years agovirsh: Add domdisplay cmd for VNC, SPICE and RDP
Doug Goldstein [Sun, 24 Jun 2012 21:14:54 +0000 (16:14 -0500)]
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>
12 years agoRemove accidentally added Patch: lines from mingw-libvirt.spec.in
Daniel P. Berrange [Wed, 27 Jun 2012 13:31:52 +0000 (14:31 +0100)]
Remove accidentally added Patch: lines from mingw-libvirt.spec.in

12 years agodoc: fix typo in virDomainDestroy API doc
Christophe Fergeau [Wed, 27 Jun 2012 12:49:06 +0000 (14:49 +0200)]
doc: fix typo in virDomainDestroy API doc

12 years agoAdd /tools/libvirt-guests.service to .gitignore
Guido Günther [Tue, 26 Jun 2012 16:13:46 +0000 (18:13 +0200)]
Add /tools/libvirt-guests.service to .gitignore

since it's an autogenerated file

12 years agoDon't install systemd service files executable
Guido Günther [Tue, 26 Jun 2012 07:53:33 +0000 (09:53 +0200)]
Don't install systemd service files executable

since they aren't. Detected by Debian's lintian.

12 years agoAUTHORS: Update
Michal Privoznik [Mon, 25 Jun 2012 14:56:44 +0000 (16:56 +0200)]
AUTHORS: Update

Latest patchset enabling libvirt on s390(x) was developed by
  Viktor Mihajlovski   <mihajlov@linux.vnet.ibm.com>
  Thang Pham           <thang.pham@us.ibm.com>
Add them to the AUTHORS file.

12 years agoS390: Added sysinfo for host on s390(x).
Thang Pham [Fri, 22 Jun 2012 11:50:14 +0000 (13:50 +0200)]
S390: Added sysinfo for host on s390(x).

In order to retrieve some sysinfo data we need to parse /proc/sysinfo and
/proc/cpuinfo.

Signed-off-by: Thang Pham <thang.pham@us.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Fixed core identification for s390
Viktor Mihajlovski [Fri, 22 Jun 2012 11:50:13 +0000 (13:50 +0200)]
S390: Fixed core identification for s390

For the s390x architecture the sysfs core_id alone is not unique. As a
result it can happen that libvirt thinks there are less host CPUs available
than really present.
Currently, a logical CPU is equivalent to a core for s390x. We therefore
produce a fake core id from the CPU number.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Fixed Parser for /proc/cpuinfo needs to be adapted for your architecture
Thang Pham [Fri, 22 Jun 2012 11:50:12 +0000 (13:50 +0200)]
S390: Fixed Parser for /proc/cpuinfo needs to be adapted for your architecture

Minimal CPU "parser" for s390 to avoid compile time warning.

Signed-off-by: Thang Pham <thang.pham@us.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: CPU support for s390(x)
Thang Pham [Fri, 22 Jun 2012 11:50:11 +0000 (13:50 +0200)]
S390: CPU support for s390(x)

Adding CPU encoder/decoder for s390 to avoid runtime error messages.

Signed-off-by: Thang Pham <thang.pham@us.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Override QEMU_CAPS_NO_ACPI for s390x
Viktor Mihajlovski [Fri, 22 Jun 2012 11:50:10 +0000 (13:50 +0200)]
S390: Override QEMU_CAPS_NO_ACPI for s390x

Starting a KVM guest on s390 fails immediately. This is because
"qemu --help" reports -no-acpi even for the s390(x) architecture but
-no-acpi isn't supported there.
Workaround is to remove QEMU_CAPS_NO_ACPI from the capability set
after the version/capability extraction.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agostorage backend rbd: Do not prefix rbd: on volume names.
Wido den Hollander [Fri, 22 Jun 2012 12:45:59 +0000 (14:45 +0200)]
storage backend rbd: Do not prefix rbd: on volume names.

We used to prefix 'rbd:' to volume names, this is not necessary.

Qemu takes RBD devices in this way, like: qemu -drive rbd:pool/image

When attaching a network disk like RBD to a guest we however do not use this prefix.

Currently you can't map a RBD volume name directly to a domain without removing the prefix.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
12 years agoqemu: Improve error if setmem fails for lacking of balloon support
Osier Yang [Mon, 25 Jun 2012 13:34:22 +0000 (21:34 +0800)]
qemu: Improve error if setmem fails for lacking of balloon support

"cannot set memory of an active domain" is misleading, it sounds
like setting memory of active domain is not supported.

12 years agoInclude the default listen address in the live guest XML
Daniel P. Berrange [Mon, 25 Jun 2012 11:50:52 +0000 (12:50 +0100)]
Include the default listen address in the live guest XML

If no 'listen' attribute or <listen> element is set in the
guest XML, the default driver configured listen address is
used. There is no way to client applications to determine
what this address is though. When starting the guest, we
should update the live XML to include this default listen
address

12 years agostorage: Introduce --inactive for pool-dumpxml
Michal Privoznik [Mon, 25 Jun 2012 10:24:45 +0000 (12:24 +0200)]
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.

12 years agostorage: Switch to new def on pool-destroy
Michal Privoznik [Mon, 25 Jun 2012 09:38:17 +0000 (11:38 +0200)]
storage: Switch to new def on pool-destroy

Currently, we share the idea of old & new def with domains. Users can
*-edit an object (domain, pool) which spawns a new internal
representation for them. This is referenced via
{domainObj,poolObj}->newDef [compared to ->def]. However, for pool we
were never overwriting def with newDef. This must be done on
pool-destroy (like we do analogically in domain detroy).

12 years agosanlock: Properly indent
Michal Privoznik [Mon, 25 Jun 2012 10:46:21 +0000 (12:46 +0200)]
sanlock: Properly indent

One of latest patches (0fce94fe) didn't properly indented #define
making syntax-check fail.

12 years agoFix compilation on older sanlock
Daniel Veillard [Mon, 25 Jun 2012 10:31:09 +0000 (18:31 +0800)]
Fix compilation on older sanlock

Temporary fix since compilation broke with older version of
sanlock following acbd4965c44c4dbc676dfe89aff970052e376073

12 years agoRemove stray debug fprintf in XML parser
Daniel P. Berrange [Mon, 25 Jun 2012 10:26:29 +0000 (11:26 +0100)]
Remove stray debug fprintf in XML parser

12 years agoSupport bind mounting host files, as well as directories in LXC
Daniel J Walsh [Mon, 25 Jun 2012 09:53:39 +0000 (10:53 +0100)]
Support bind mounting host files, as well as directories in LXC

Currently libvirt-lxc checks to see if the destination exists and is a
directory.  If it is not a directory then the mount fails.  Since
libvirt-lxc can bind mount files on an inode, this patch is needed to
allow us to bind mount files on files.  Currently we want to bind mount
on top of /etc/machine-id, and /etc/adjtime

If the destination of the mount point does not exists, it checks if the
src is a directory and then attempts to create a directory, otherwise it
creates an empty file for the destination.  The code will then bind mount
over the destination.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAllow NOCONFIGURE=1 to make autogen.sh skip ./configure
Daniel P. Berrange [Thu, 21 Jun 2012 13:50:41 +0000 (14:50 +0100)]
Allow NOCONFIGURE=1 to make autogen.sh skip ./configure

Sometimes it is useful to re-bootstrap libvirt without running
through a ./configure invocation immediately. eg if you want
to run ./configure for Mingw32 rather than native.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix unused parameters / functions in virsh on Win32
Daniel P. Berrange [Thu, 21 Jun 2012 13:46:03 +0000 (14:46 +0100)]
Fix unused parameters / functions in virsh on Win32

The vshPrintRaw function is not used on Win32, and neither
is the 'msg' parameter of vshAskReedit. Change the nesting
of #ifdef WIN32 conditionals to address this

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoUpdate to latest GNULIB to fix compat with Mingw64 toolchain
Daniel P. Berrange [Thu, 21 Jun 2012 13:55:51 +0000 (14:55 +0100)]
Update to latest GNULIB to fix compat with Mingw64 toolchain

On both x86_64-w64-mingw32 and i686-w64-mingw32 there were
the following warnings/errors:

  CC     fstat.lo
../../../gnulib/lib/fstat.c:27:0: warning: "stat" redefined [enabled by default]
In file included from ./sys/stat.h:32:0,
                 from ../../../gnulib/lib/fstat.c:25:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:258:0: note: this is the location of the previous definition
../../../gnulib/lib/fstat.c:28:0: warning: "fstat" redefined [enabled by default]
In file included from ./sys/stat.h:32:0,
                 from ../../../gnulib/lib/fstat.c:25:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:259:0: note: this is the location of the previous definition

  CC     stat.lo
../../../gnulib/lib/stat.c:32:0: warning: "stat" redefined [enabled by default]
In file included from ./sys/stat.h:32:0,
                 from ../../../gnulib/lib/stat.c:27:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/stat.h:258:0: note: this is the location of the previous definition

  CC     stdio-read.lo
../../../gnulib/lib/stdio-read.c:102:1: error: redefinition of 'vscanf'
In file included from ./stdio.h:43:0,
                 from ../../../gnulib/lib/stdio-read.c:21:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:397:7: note: previous definition of 'vscanf' was here
../../../gnulib/lib/stdio-read.c:108:1: error: redefinition of 'vfscanf'
In file included from ./stdio.h:43:0,
                 from ../../../gnulib/lib/stdio-read.c:21:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:384:7: note: previous definition of 'vfscanf' was here
make[3]: *** [stdio-read.lo] Error 1
make[3]: Leaving directory `/home/berrange/src/virt/libvirt/build/gnulib/lib'

While on x86_64-w64-mingw32 only there was:

In file included from ../../../gnulib/lib/regex.c:69:0:
../../../gnulib/lib/regcomp.c: In function 'parse_dup_op':
../../../gnulib/lib/regcomp.c:2624:39: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
../../../gnulib/lib/regcomp.c: In function 'mark_opt_subexp':
../../../gnulib/lib/regcomp.c:3859:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agowinsock2.h must always be included before windows.h
Daniel P. Berrange [Thu, 21 Jun 2012 13:37:34 +0000 (14:37 +0100)]
winsock2.h must always be included before windows.h

Some GNULIB headers (eg unistd.h) will often need to include
winsock2.h for various symbols. There is a rule that winsock2.h
must be included before windows.h. This means that any file
which does

  #ifdef WIN32
  #include <windows.h>
  #endif
  #include <unistd.h>

is potentially broken. A simple rule is that /all/ includes of
windows.h must be matched with a preceding include of winsock2.h
regardless of whether unistd.h is used currently

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSwitch automated builds to use Mingw64 toolchain instead of Mingw32
Daniel P. Berrange [Fri, 15 Jun 2012 16:13:11 +0000 (17:13 +0100)]
Switch automated builds to use Mingw64 toolchain instead of Mingw32

The Mingw32 toolchain is broadly obsoleted by the Mingw64 toolchain.
The latter has been adopted by Fedora 17 and newer. Maintaining a
RPM spec for Mingw32 is a needless burden, so switch to a Mingw64
RPM spec (which provides 32 & 64 bit builds).

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agovirsh: Use virXPath wrappers for vncdisplay cmd
Doug Goldstein [Sun, 24 Jun 2012 21:36:00 +0000 (16:36 -0500)]
virsh: Use virXPath wrappers for vncdisplay cmd

Update the vncdisplay command to use the virXPath wrappers as well as
check if the domain is up rather than using the port set to -1 to mean
the domain is not up.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
12 years agoAdd support for shared sanlock leases
Daniel P. Berrange [Thu, 21 Jun 2012 14:34:46 +0000 (15:34 +0100)]
Add support for shared sanlock leases

A sanlock lease can be marked as shared (rather
than exclusive)  using SANLK_RES_SHARED flag. This
adds support for that flag and ensures that in auto
disk mode, any shared disks use shared leases. This
also makes any read-only disks be completely
ignored.

These changes remove the need for the option

  ignore_readonly_and_shared_disks

so that is removed

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for guest bind mounts with LXC
Daniel P. Berrange [Wed, 20 Jun 2012 14:03:30 +0000 (15:03 +0100)]
Add support for guest bind mounts with LXC

Currently you can configure LXC to bind a host directory to
a guest directory, but not to bind a guest directory to a
guest directory. While the guest container init could do
this itself, allowing it in the libvirt XML means a stricter
SELinux policy can be written

12 years agoAdd support for RAM filesystems for LXC
Daniel P. Berrange [Tue, 8 May 2012 16:50:48 +0000 (17:50 +0100)]
Add support for RAM filesystems for LXC

Introduce a new syntax for filesystems to allow use of a RAM
filesystem

   <filesystem type='ram'>
      <source usage='10' units='MiB'/>
      <target dir='/mnt'/>
   </filesystem>

The usage units default to KiB to limit consumption of host memory.

* docs/formatdomain.html.in: Document new syntax
* docs/schemas/domaincommon.rng: Add new attributes
* src/conf/domain_conf.c: Parsing/formatting of RAM filesystems
* src/lxc/lxc_container.c: Mounting of RAM filesystems

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agofix a bug of ref count in virnetserver.c
Hu Tao [Fri, 22 Jun 2012 03:26:03 +0000 (11:26 +0800)]
fix a bug of ref count in virnetserver.c

The test of ref count is not protected by lock, which is unsafe because
the ref count may have been changed by other threads during the test.

This patch fixes this.

12 years agovirsh: Improve error when trying to change vm's cpu count 0
Peter Krempa [Thu, 21 Jun 2012 16:34:32 +0000 (18:34 +0200)]
virsh: Improve error when trying to change vm's cpu count 0

This patch adds a check for the count of processors the user requests
for the guest machine so that invalid values produce a more helpful
error message.

12 years agoFix deadlock on libvirtd shutdown
Jim Fehlig [Thu, 21 Jun 2012 15:21:44 +0000 (09:21 -0600)]
Fix deadlock on libvirtd shutdown

When shutting down libvirtd, the virNetServer shutdown can deadlock
if there are in-flight jobs being handled by virNetServerHandleJob().
virNetServerFree() will acquire the virNetServer lock and call
virThreadPoolFree() to terminate the workers, waiting for the workers
to finish.  But in-flight workers will attempt to acquire the
virNetServer lock, resulting in deadlock.

Fix the deadlock by unlocking the virNetServer lock before calling
virThreadPoolFree().  This is safe since the virNetServerPtr object
is ref-counted and only decrementing the ref count needs to be
protected.  Additionally, there is no need to re-acquire the lock
after virThreadPoolFree() completes as all the workers have
terminated.

12 years agoqemu: Add xhci support
Gerd Hoffmann [Thu, 21 Jun 2012 13:45:25 +0000 (15:45 +0200)]
qemu: Add xhci support

qemu 1.1 features a xhci controller,
this patch adds support for it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agovirsh: add support for virConnectListAllDomains and clean up cmdList
Peter Krempa [Tue, 19 Jun 2012 13:18:16 +0000 (15:18 +0200)]
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.

12 years agovirsh: Rename namesorter to vshNameSorter and clean up indentation
Peter Krempa [Tue, 19 Jun 2012 13:13:47 +0000 (15:13 +0200)]
virsh: Rename namesorter to vshNameSorter and clean up indentation

12 years agoutil: Fix the indention
Osier Yang [Thu, 21 Jun 2012 06:58:03 +0000 (14:58 +0800)]
util: Fix the indention

src/util/util.c: virFileOpenAs.

12 years agoInitialize random generator in lxc controller
Jim Fehlig [Thu, 21 Jun 2012 05:28:09 +0000 (23:28 -0600)]
Initialize random generator in lxc controller

The lxc contoller eventually makes use of virRandomBits(), which was
segfaulting since virRandomInitialize() is never invoked.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff554d560 in random_r () from /lib64/libc.so.6
(gdb) bt
0  0x00007ffff554d560 in random_r () from /lib64/libc.so.6
1  0x0000000000469eaa in virRandomBits (nbits=32) at util/virrandom.c:80
2  0x000000000045bf69 in virHashCreateFull (size=256,
    dataFree=0x4aa2a2 <hashDataFree>, keyCode=0x45bd40 <virHashStrCode>,
    keyEqual=0x45bdad <virHashStrEqual>, keyCopy=0x45bdfa <virHashStrCopy>,
    keyFree=0x45be37 <virHashStrFree>) at util/virhash.c:134
3  0x000000000045c069 in virHashCreate (size=0, dataFree=0x4aa2a2 <hashDataFree>)
    at util/virhash.c:164
4  0x00000000004aa562 in virNWFilterHashTableCreate (n=0)
    at conf/nwfilter_params.c:686
5  0x00000000004aa95b in virNWFilterParseParamAttributes (cur=0x711d30)
    at conf/nwfilter_params.c:793
6  0x0000000000481a7f in virDomainNetDefParseXML (caps=0x702c90, node=0x7116b0,
    ctxt=0x7101b0, bootMap=0x0, flags=0) at conf/domain_conf.c:4589
7  0x000000000048cc36 in virDomainDefParseXML (caps=0x702c90, xml=0x710040,
    root=0x7103b0, ctxt=0x7101b0, expectedVirtTypes=16, flags=0)
    at conf/domain_conf.c:8658
8  0x000000000048f011 in virDomainDefParseNode (caps=0x702c90, xml=0x710040,
    root=0x7103b0, expectedVirtTypes=16, flags=0) at conf/domain_conf.c:9360
9  0x000000000048ee30 in virDomainDefParse (xmlStr=0x0,
    filename=0x702ae0 "/var/run/libvirt/lxc/x.xml", caps=0x702c90,
    expectedVirtTypes=16, flags=0) at conf/domain_conf.c:9310
10 0x000000000048ef00 in virDomainDefParseFile (caps=0x702c90,
    filename=0x702ae0 "/var/run/libvirt/lxc/x.xml", expectedVirtTypes=16, flags=0)
    at conf/domain_conf.c:9332
11 0x0000000000425053 in main (argc=5, argv=0x7fffffffe2b8)
    at lxc/lxc_controller.c:1773

12 years agostorage: Set the perms if the pool target already exists for fs pools
Osier Yang [Tue, 19 Jun 2012 08:15:27 +0000 (16:15 +0800)]
storage: Set the perms if the pool target already exists for fs pools

The comment says:

/* Now create the final dir in the path with the uid/gid/mode
 * requested in the config. If the dir already exists, just set
 * the perms.
 */

However, virDirCreate is only invoked if the target path doesn't
exist yet (which is opposite with the comment), or the uid from
the config is not -1 (I don't understand why, think it's just
another mistake). And the result is the perms of the pool won't
be changed if one tries to build the pool with different perms
again.

Besides these logic error fix, if no uid and gid are specified in
the config, the practical used uid, gid are reflected.

12 years agosnapshot: implement new APIs for esx and vbox
Eric Blake [Fri, 25 May 2012 02:28:54 +0000 (20:28 -0600)]
snapshot: implement new APIs for esx and vbox

The two new APIs are rather trivial; based on bits and pieces of
other existing APIs.  But rather than blindly return 0 or 1 for
HasMetadata, I chose to first validate that the snapshot in
question in fact exists.

* src/esx/esx_driver.c (esxDomainSnapshotIsCurrent)
(esxDomainSnapshotHasMetadata): New functions.
* src/vbox/vbox_tmpl.c (vboxDomainSnapshotIsCurrent)
(vboxDomainSnapshotHasMetadata): Likewise.

12 years agosnapshot: require existence before returning success
Eric Blake [Fri, 25 May 2012 02:28:54 +0000 (20:28 -0600)]
snapshot: require existence before returning success

Blindly returning success is misleading if the object no longer
exists; it is a bit better to check for existence up front before
returning information about that object.  This pattern matches the
fact that most of our other APIs check for existence as a side
effect prior to getting at the real piece of information being
queried.

* src/esx/esx_driver.c (esxDomainIsUpdated, esxDomainIsPersistent):
Add existence checks.
* src/vbox/vbox_tmpl.c (vboxDomainIsPersistent)
(vboxDomainIsUpdated): Likewise.

12 years agodrivers: Implement virListAllDomains for drivers using virDomainObj
Peter Krempa [Mon, 11 Jun 2012 09:04:57 +0000 (11:04 +0200)]
drivers: Implement virListAllDomains for drivers using virDomainObj

This patch adds support for listing all domains into drivers that use
the common virDomainObj implementation: libxl, lxc, openvz, qemu, test,
uml, vmware.

For drivers that don't support managed save images the guests are
treated as if they had none, so filtering guests that do have such an
image on this driver succeeds and produces 0 results.

12 years agoopenvz: check pointer size instead of int
Guido Günther [Tue, 19 Jun 2012 05:26:31 +0000 (07:26 +0200)]
openvz: check pointer size instead of int

since int is 4 bytes on both i386 and amd64.

12 years agoFix default USB controller for ppc64
Dipankar Sarma [Tue, 19 Jun 2012 10:21:47 +0000 (15:51 +0530)]
Fix default USB controller for ppc64

Fix the default usb controller for pseries systems if none
specified.

Signed-off-by: Dipankar Sarma <dipankar@in.ibm.com>
12 years agolist: add qemu snapshot list support
Eric Blake [Wed, 13 Jun 2012 23:52:51 +0000 (17:52 -0600)]
list: add qemu snapshot list support

The two new functions are very similar to the existing functions;
just a matter of different arguments and a call to a different
helper function.

* src/qemu/qemu_driver.c (qemuDomainSnapshotListNames)
(qemuDomainSnapshotNum, qemuDomainSnapshotListChildrenNames)
(qemuDomainSnapshotNumChildren): Support new flags.
(qemuDomainListAllSnapshots): New functions.

12 years agolist: new helper function to collect snapshots
Eric Blake [Wed, 13 Jun 2012 22:57:36 +0000 (16:57 -0600)]
list: new helper function to collect snapshots

Wraps the conversion from 'char *name' to virDomainSnapshotPtr in
a reusable manner.

* src/conf/virdomainlist.h (virDomainListSnapshots): New declaration.
* src/conf/virdomainlist.c (virDomainListSnapshots): Implement it.
* src/libvirt_private.syms (virdomainlist.h): Export it.

12 years agolist: provide RPC call for snapshots
Eric Blake [Sun, 10 Jun 2012 03:24:57 +0000 (21:24 -0600)]
list: provide RPC call for snapshots

The generator doesn't handle lists of virDomainSnapshotPtr, so
this commit requires a bit more work than some RPC additions.

* src/remote/remote_protocol.x
(REMOTE_PROC_DOMAIN_LIST_ALL_SNAPSHOTS)
(REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_ALL_CHILDREN): New RPC calls,
with corresponding structs.
* daemon/remote.c (remoteDispatchDomainListAllSnapshots)
(remoteDispatchDomainSnapshotListAllChildren): New functions.
* src/remote/remote_driver.c (remoteDomainListAllSnapshots)
(remoteDomainSnapshotListAllChildren): Likewise.
* src/remote_protocol-structs: Regenerate.

12 years agolist: provide python bindings for snapshots
Eric Blake [Sat, 9 Jun 2012 15:55:36 +0000 (09:55 -0600)]
list: provide python bindings for snapshots

This adds support for the new virDomainListAllSnapshots (a domain
function) and virDomainSnapshotListAllChildren (a snapshot function)
to the libvirt-python bindings.  The implementation is done manually
as the generator does not support wrapping lists of C pointers into
python objects.

* python/libvirt-override.c (libvirt_virDomainListAllSnapshots)
(libvirt_virDomainSnapshotListAllChildren): New functions.
* python/libvirt-override-api.xml: Document them.
* python/libvirt-override-virDomain.py (listAllSnapshots): New
file.
* python/libvirt-override-virDomainSnapshot.py (listAllChildren):
Likewise.
* python/Makefile.am (CLASSES_EXTRA): Ship them.

12 years agolist: use the new snapshot API in virsh when possible
Eric Blake [Fri, 8 Jun 2012 22:00:43 +0000 (16:00 -0600)]
list: use the new snapshot API in virsh when possible

Using the new API is so much shorter than the rest of the remainder
of the function.

* tools/virsh.c (vshSnapshotList): Use the new API.

12 years agolist: add virDomainListAllSnapshots API
Eric Blake [Wed, 23 May 2012 16:40:50 +0000 (10:40 -0600)]
list: add virDomainListAllSnapshots API

There was an inherent race between virDomainSnapshotNum() and
virDomainSnapshotListNames(), where an additional snapshot could
be created in the meantime, or where a snapshot could be deleted
before converting the name back to a virDomainSnapshotPtr.  It
was also an awkward name: the function operates on domains, not
domain snapshots.  virDomainSnapshotListChildrenNames() suffered
from the same inherent race, although its naming was nicer.

This patch makes things nicer by grabbing a snapshot list
atomically, in the format most useful to the user.

* include/libvirt/libvirt.h.in (virDomainListAllSnapshots)
(virDomainSnapshotListAllChildren): New declarations.
* src/libvirt.c (virDomainSnapshotListNames)
(virDomainSnapshotListChildrenNames): Add cross-references.
(virDomainListAllSnapshots, virDomainSnapshotListAllChildren):
New functions.
* src/libvirt_public.syms (LIBVIRT_0.9.13): Export them.
* src/driver.h (virDrvDomainListAllSnapshots)
(virDrvDomainSnapshotListAllChildren): New callbacks.
* python/generator.py (skip_function): Prepare for later
hand-written versions.

12 years agosnapshot: expose new flags in virsh
Eric Blake [Fri, 8 Jun 2012 22:31:24 +0000 (16:31 -0600)]
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.

12 years agosnapshot: add additional filters when getting lists
Eric Blake [Thu, 14 Jun 2012 14:44:13 +0000 (08:44 -0600)]
snapshot: add additional filters when getting lists

It turns out that one-bit filtering makes it hard to select the inverse
set, so it is easier to provide filtering groups.  For back-compat,
omitting all bits within a group means the group is not used for
filtering, and by definition of a group (each snapshot matches exactly
one bit within the group, and the set of bits in the group covers all
snapshots), selecting all bits also makes the group useless.

Unfortunately, virDomainSnapshotListChildren defined the bit
VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS as an expansion rather than a
filter, so we cannot make it part of a filter group, so that bit
(and its counterpart VIR_DOMAIN_SNAPSHOT_LIST_ROOTS for
virDomainSnapshotList) remains a single control bit.

* include/libvirt/libvirt.h.in (virDomainSnapshotListFlags): Add a
couple more flags.
* src/libvirt.c (virDomainSnapshotNum)
(virDomainSnapshotNumChildren): Document them.
(virDomainSnapshotListNames, virDomainSnapshotListChildrenNames):
Likewise, and add thread-safety caveats.
* src/conf/virdomainlist.h (VIR_DOMAIN_SNAPSHOT_FILTERS_*): New
convenience macros.
* src/conf/domain_conf.c (virDomainSnapshotObjListCopyNames)
(virDomainSnapshotObjListCount): Support the new flags.

12 years agovirsh: fix few typos on desc command
Martin Kletzander [Tue, 19 Jun 2012 09:05:31 +0000 (11:05 +0200)]
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>

12 years agodomain_conf: fix possible memory leak
Martin Kletzander [Tue, 19 Jun 2012 10:08:49 +0000 (12:08 +0200)]
domain_conf: fix possible memory leak

Until now, it was possible to crash libvirtd when defining domain with
channel device with missing source element.

When creating new virDomainChrDef, target.port is set to -1, but
unfortunately it is an union with addresses that virDomainChrDefFree
tries to free in case the deviceType is channel. Having the port set
to -1 is intended, however the cleanest way to get around the problems
with the crash seems to be renumbering the VIR_DOMAIN_CHR_CHANNEL_
target types to cover new NONE type (with value 0) being the default
(no target type yet).

12 years agoerror: Fix typos in argument checking macros
Peter Krempa [Tue, 19 Jun 2012 13:55:28 +0000 (15:55 +0200)]
error: Fix typos in argument checking macros

Macro virCheckNullArgGoto is supposed to check for NULL argument but
checks non-NULL instead.

Macro virCheckNonNullArgReturn reports error as if the argument should
be NULL when it shouldn't.

12 years agovirsh: make domiftune interface help string consistent
Martin Kletzander [Tue, 19 Jun 2012 12:14:50 +0000 (14:14 +0200)]
virsh: make domiftune interface help string consistent

Append '(MAC Address)' after the help string of domiftune virsh
command as it takes the same type of argument as domif-{get,set}link
which have it specified.

12 years agoLXC: avoid useless duplicate memory free
Gao feng [Tue, 19 Jun 2012 01:33:20 +0000 (09:33 +0800)]
LXC: avoid useless duplicate memory free

when lxcContainerIdentifyCGroups failed, the memory it allocated
has been freed, so we should not free this memory again in
lxcContainerSetupPivortRoot and lxcContainerSetupExtraMounts.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agodriver: Clean up driver header to space indentation
Peter Krempa [Thu, 7 Jun 2012 16:51:08 +0000 (18:51 +0200)]
driver: Clean up driver header to space indentation

12 years agosnapshot: merge count and name collection
Eric Blake [Thu, 14 Jun 2012 13:33:37 +0000 (07:33 -0600)]
snapshot: merge count and name collection

Another case where we can do the same amount of work with fewer
lines of redundant code, which will make adding new filters easier.

* src/conf/domain_conf.c (virDomainSnapshotNameData): Adjust
struct.
(virDomainSnapshotObjListCount): Delete, now taken care of...
(virDomainSnapshotObjListCopyNames): ...here.
(virDomainSnapshotObjListGetNames): Adjust caller to handle
counting.
(virDomainSnapshotObjListNum): Simplify.

12 years agosnapshot: merge domain and snapshot computation
Eric Blake [Thu, 14 Jun 2012 03:59:48 +0000 (21:59 -0600)]
snapshot: merge domain and snapshot computation

Now that domain listing is a thin wrapper around child listing,
it's easier to have a common entry point.  This restores the
hashForEach optimization lost in the previous patch when there
are no snapshots being filtered out of the entire list.

* src/conf/domain_conf.h (virDomainSnapshotObjListGetNames)
(virDomainSnapshotObjListNum): Add parameter.
(virDomainSnapshotObjListGetNamesFrom)
(virDomainSnapshotObjListNumFrom): Delete.
* src/libvirt_private.syms (domain_conf.h): Drop deleted functions.
* src/conf/domain_conf.c (virDomainSnapshotObjListGetNames):
Merge, and (re)add an optimization.
* src/qemu/qemu_driver.c (qemuDomainUndefineFlags)
(qemuDomainSnapshotListNames, qemuDomainSnapshotNum)
(qemuDomainSnapshotListChildrenNames)
(qemuDomainSnapshotNumChildren): Update callers.
* src/qemu/qemu_migration.c (qemuMigrationIsAllowed): Likewise.
* src/conf/virdomainlist.c (virDomainListPopulate): Likewise.

12 years agosnapshot: use metaroot node to simplify management
Eric Blake [Wed, 13 Jun 2012 19:13:02 +0000 (13:13 -0600)]
snapshot: use metaroot node to simplify management

This idea was first suggested by Daniel Veillard here:
https://www.redhat.com/archives/libvir-list/2011-October/msg00353.html

Now that I am about to add more complexity to snapshot listing, it
makes sense to avoid code duplication and special casing for domain
listing (all snapshots) vs. snapshot listing (descendants); adding
a metaroot reduces the number of code lines by having the domain
listing turn into a descendant listing of the metaroot.

Note that this has one minor pessimization - if we are going to list
ALL snapshots without filtering, then virHashForeach is more efficient
than recursing through the child relationships; restoring that minor
optimization will occur in the next patch.

* src/conf/domain_conf.h (_virDomainSnapshotObj)
(_virDomainSnapshotObjList): Repurpose some fields.
(virDomainSnapshotDropParent): Drop unused parameter.
* src/conf/domain_conf.c (virDomainSnapshotObjListGetNames)
(virDomainSnapshotObjListCount): Simplify.
(virDomainSnapshotFindByName, virDomainSnapshotSetRelations)
(virDomainSnapshotDropParent): Match new field semantics.
* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML)
(qemuDomainSnapshotReparentChildren, qemuDomainSnapshotDelete):
Adjust clients.

12 years agoopenvz: Fix wordsize on 64 bit architectures
Guido Günther [Thu, 14 Jun 2012 18:14:05 +0000 (20:14 +0200)]
openvz: Fix wordsize on 64 bit architectures

The word size there is 64 bit not 8.

12 years agoconf: Add helper for listing domains on drivers supporting virDomainObj
Peter Krempa [Tue, 5 Jun 2012 12:00:52 +0000 (14:00 +0200)]
conf: Add helper for listing domains on drivers supporting virDomainObj

This patch adds common code to list domains in fashion used by
virListAllDomains with all currently supported flags. The header file
also contains macros that group filters together that are used to
shorten filter conditions.

12 years agoconf: Store managed save image existence in virDomainObj
Peter Krempa [Mon, 11 Jun 2012 09:03:27 +0000 (11:03 +0200)]
conf: Store managed save image existence in virDomainObj

This patch stores existence of the image in the object. At start of the
daemon the state is checked and then updated in key moments in domain
lifecycle.

12 years agoremote: implement remote protocol for virConnectListAllDomains()
Peter Krempa [Sun, 20 May 2012 14:26:36 +0000 (16:26 +0200)]
remote: implement remote protocol for virConnectListAllDomains()

This patch wires up the RPC protocol handlers for
virConnectListAllDomains(). The RPC generator has no support for the way
how virConnectListAllDomains() returns the results so the handler code
had to be done manually.

The new api is handled by REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS, with
number 273 and marked with high priority.

12 years agopython: add API exports for virConnectListAllDomains()
Peter Krempa [Sun, 20 May 2012 14:20:11 +0000 (16:20 +0200)]
python: add API exports for virConnectListAllDomains()

This patch adds export of the new API function
virConnectListAllDomains() to the libvirt-python bindings. The
virConnect object now has method "listAllDomains" that takes only the
flags parameter and returns a python list of virDomain object
corresponding to virDomainPtrs returned by the underlying api.

The implementation is done manually as the generator does not support
wrapping list of virDomainPtrs into virDomain objects.

12 years agolib: Add public api to enable atomic listing of guest
Peter Krempa [Fri, 18 May 2012 15:22:02 +0000 (17:22 +0200)]
lib: Add public api to enable atomic listing of guest

This patch adds a new public api that lists domains. The new approach is
different from those used before. There are key points to this:

1) The list is acquired atomically and contains both active and inactive
domains (guests). This eliminates the need to call two different list
APIs, where the state might change in between the calls.

2) The returned list consists of virDomainPtrs instead of names or ID's
that have to be converted to virDomainPtrs anyways using separate calls
for each one of them. This is more convenient and saves hypervisor calls.

3) The returned list is auto-allocated. This saves a lot of hassle for
the users.

4) Built in support for filtering. The API call supports various
filtering flags that modify the output list according to user needs.

Available filter groups:
    Domain status:
    VIR_CONNECT_LIST_DOMAINS_ACTIVE, VIR_CONNECT_LIST_DOMAINS_INACTIVE

    Domain persistence:
    VIR_CONNECT_LIST_DOMAINS_PERSISTENT,
    VIR_CONNECT_LIST_DOMAINS_TRANSIENT

    Domain state:
    VIR_CONNECT_LIST_DOMAINS_RUNNING, VIR_CONNECT_LIST_DOMAINS_PAUSED,
    VIR_CONNECT_LIST_DOMAINS_SHUTOFF, VIR_CONNECT_LIST_DOMAINS_OTHER

    Existence of managed save image:
    VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE,
    VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE

    Auto-start option:
    VIR_CONNECT_LIST_DOMAINS_AUTOSTART,
    VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART

    Existence of snapshot:
    VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT,
    VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT

5) The python binding returns a list of domain objects that is very neat
to work with.

The only problem with this approach is no support from code generators
so both RPC code and python bindings had to be written manually.

*include/libvirt/libvirt.h.in: - add API prototype
                               - clean up whitespace mistakes nearby
*python/generator.py: - inhibit generation of the bindings for the new
                        api
*src/driver.h: - add driver prototype
               - clean up some whitespace mistakes nearby
*src/libvirt.c: - add public implementation
*src/libvirt_public.syms: - export the new symbol

12 years agoAdd a custom 404 error page for the website
Daniel P. Berrange [Mon, 18 Jun 2012 10:58:39 +0000 (11:58 +0100)]
Add a custom 404 error page for the website

12 years agoLXC: fix incorrect DEBUG info
Gao feng [Fri, 15 Jun 2012 07:41:05 +0000 (15:41 +0800)]
LXC: fix incorrect DEBUG info

print debug info "container support is enabled"
when host support the user or net namespace.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agoLXC: fix memory leak in lxcContainerSetupExtraMounts
Gao feng [Fri, 15 Jun 2012 07:41:04 +0000 (15:41 +0800)]
LXC: fix memory leak in lxcContainerSetupExtraMounts

kill the "return 0;" code, it will cause memory leak.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agobuild: fix whitespace damage
Eric Blake [Mon, 18 Jun 2012 16:13:32 +0000 (10:13 -0600)]
build: fix whitespace damage

Introduced in commit 1f8c33b67.

* src/lxc/lxc_container.c (lxcContainerGetSubtree): Avoid TAB.

12 years agoLXC: fix memory leak in lxcContainerGetSubtree
Gao feng [Tue, 12 Jun 2012 06:31:15 +0000 (14:31 +0800)]
LXC: fix memory leak in lxcContainerGetSubtree

when libvirt_lxc trigger oom error in lxcContainerGetSubtree
we should free the alloced memory for mounts.

so when lxcContainerGetSubtree failed,we should do some
memory cleanup in lxcContainerUnmountSubtree.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agoLXC: fix memory leak in lxcContainerMountFSBlockHelper
Gao feng [Tue, 12 Jun 2012 05:55:48 +0000 (13:55 +0800)]
LXC: fix memory leak in lxcContainerMountFSBlockHelper

we alloc the memory for format in lxcContainerMountDetectFilesystem
but without free it in lxcContainerMountFSBlockHelper.

this patch just call VIR_FREE to free it.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agovirsh: Update vol-create-as manpage
Michal Privoznik [Mon, 18 Jun 2012 11:20:01 +0000 (13:20 +0200)]
virsh: Update vol-create-as manpage

as we support qed format as well.

12 years agovirsh: Tweak attach-* documentation
Michal Privoznik [Mon, 18 Jun 2012 11:14:49 +0000 (13:14 +0200)]
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

12 years agoqemu_agent: Wait for events instead of agent response
Michal Privoznik [Fri, 15 Jun 2012 16:00:13 +0000 (18:00 +0200)]
qemu_agent: Wait for events instead of agent response

With latest changes to qemu-ga success on some commands is not reported
anymore, e.g. guest-shutdown or guest-suspend-*. However, errors are
still being reported. Therefore, we need to find different source of
indication if operation was successful. Events.

12 years agoqemu_agent: Add some more debug prints
Michal Privoznik [Fri, 15 Jun 2012 14:14:38 +0000 (16:14 +0200)]
qemu_agent: Add some more debug prints

for agent ref count and qemuProcessHandleAgentDestroy

12 years agosnapshot: use new virsh function for snapshot-list
Eric Blake [Sat, 9 Jun 2012 04:25:39 +0000 (22:25 -0600)]
snapshot: use new virsh function for snapshot-list

Operating on a list of snapshot objects looks so much simpler.
In particular, since the helper function already trimmed out
irrelevant entries, we no longer have quite so many special cases
on finding the first snapshot to operate on.  Also, vshTreePrint
no longer has a generic callback struct; both clients now pass
something different according to their own needs.

* tools/virsh.c (cmdSnapshotList): Use previous patches.
(vshTreeArrayLookup): Rename...
(vshNodeListLookup): ...now that it only has one client.
(cmdNodeListDevices): Adjust caller.

12 years agosnapshot: new virsh function factored from snapshot-list
Eric Blake [Fri, 15 Jun 2012 00:50:03 +0000 (18:50 -0600)]
snapshot: new virsh function factored from snapshot-list

This patch is based on the fallback code out of cmdSnapshotList,
with tweaks to keep the snapshot objects around rather than just
their name, and to remove unwanted elements before returning.
It looks forward to a future patch when we add a way to list all
snapshot objects at once, and the next patch will simplify
cmdSnapshotList to take advantage of this factorization.

* tools/virsh.c (vshSnapshotList, vshSnapshotListFree): New functions.

12 years agobuild: hoist qemu dependence on yajl to configure
Eric Blake [Wed, 13 Jun 2012 16:09:39 +0000 (10:09 -0600)]
build: hoist qemu dependence on yajl to configure

Commit 6e769eba made it a runtime error if libvirt was compiled
without yajl support but targets a new enough qemu.  But enough
users are hitting this on self-compiled libvirt that it is worth
erroring out at compilation time, rather than an obscure failure
when trying to use the built executable.

* configure.ac: If qemu is requested and -version works, require
yajl when qemu version is new enough.
* src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags): Add
comment.

12 years agoautogen: Always abide --system
Cole Robinson [Fri, 15 Jun 2012 17:46:51 +0000 (13:46 -0400)]
autogen: Always abide --system

If we do ./autogen.sh && ./configure, then later try ./autogen.sh --system,
configure isn't invoked with the requested params. Instead
config.status --recheck is run.

12 years agoCheck for errors when parsing bridge interface XML
Jim Fehlig [Thu, 14 Jun 2012 17:20:17 +0000 (11:20 -0600)]
Check for errors when parsing bridge interface XML

The return status of virInterfaceDefParseBridge() was not being
checked, potentially resulting in the creation of a broken
interface.

12 years agoFix launch of libvirtd when DHCP snooping support is not available.
Daniel P. Berrange [Fri, 15 Jun 2012 12:56:13 +0000 (13:56 +0100)]
Fix launch of libvirtd when DHCP snooping support is not available.

When libpcap is not available, the NWFilter driver provides a
no-op stub for the DHCP snooping initialization. This was
mistakenly returning '-1' instead of '0', so the entire driver
initialization failed

12 years agoAdd more debug logging for libvirtd startup
Daniel P. Berrange [Fri, 15 Jun 2012 12:48:34 +0000 (13:48 +0100)]
Add more debug logging for libvirtd startup

To facilitate future troubleshooting add a bunch more debugging
statements into important startup parts of libvirt

12 years agoschema: Update domain XML schema
Osier Yang [Fri, 15 Jun 2012 02:34:04 +0000 (10:34 +0800)]
schema: Update domain XML schema

'boot' tag shouldn't be exclusive with 'kernel', 'initrd', and 'cmdline',
though the boot sequence doesn't make sense when the guest boots from
kernel directly. But it's useful if booting from kernel is to install
a newguest, even if it's not to install a guest, there is no hurt. And
on the other hand, we allow 'boot' and the kernel tags when parsing.

12 years agovirsh: allow the user to specify vmcore's format
Wen Congyang [Tue, 12 Jun 2012 03:07:04 +0000 (11:07 +0800)]
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.

12 years agoqemu: allow the client to choose the vmcore's format
Wen Congyang [Tue, 12 Jun 2012 03:06:33 +0000 (11:06 +0800)]
qemu: allow the client to choose the vmcore's format

This patch updates qemu driver to allow the client to choose the
vmcore's format: memory only or including device state.

12 years agoqemu: implement qemu's dump-guest-memory
Wen Congyang [Tue, 12 Jun 2012 03:04:51 +0000 (11:04 +0800)]
qemu: implement qemu's dump-guest-memory

dump-guest-memory is a new dump mechanism, and it can work when the
guest uses host devices. This patch adds a API to use this new
monitor command.
We will always use json mode if qemu's version is >= 0.15, so I
don't implement the API for text mode.

12 years agoqemu: fix potential dead lock
Wen Congyang [Fri, 25 May 2012 10:12:00 +0000 (18:12 +0800)]
qemu: fix potential dead lock

If we lock the qemu_driver, we should call qemuDomainObjBeginJobWithDriver()
not qemuDomainObjBeginJob().

12 years agovirsh: Null terminated the string memcpy from buffer explicitly
Osier Yang [Thu, 14 Jun 2012 11:09:53 +0000 (19:09 +0800)]
virsh: Null terminated the string memcpy from buffer explicitly

Detected by valgrind:

==16217== 1 errors in context 1 of 12:
==16217== Invalid read of size 1
==16217==    at 0x4A07804: __GI_strlen (mc_replace_strmem.c:284)
==16217==    by 0x3019F167F6: xdr_string (in /lib64/libc-2.12.so)
==16217==    by 0x3033709E8D: xdr_remote_nonnull_string (remote_protocol.c:31)
==16217==    by 0x303370E5CB: xdr_remote_domain_update_device_flags_args (remote_protocol.c:2028)
==16217==    by 0x30337197D1: virNetMessageEncodePayload (virnetmessage.c:341)
==16217==    by 0x30337135E1: virNetClientProgramCall (virnetclientprogram.c:327)
==16217==    by 0x30336F1EFD: callWithFD (remote_driver.c:4586)
==16217==    by 0x30336F1F7B: call (remote_driver.c:4607)
==16217==    by 0x30336F42F2: remoteDomainUpdateDeviceFlags (remote_client_bodies.h:2865)
==16217==    by 0x30336D46E5: virDomainUpdateDeviceFlags (libvirt.c:9457)
==16217==    by 0x41AEE8: cmdChangeMedia (virsh.c:15249)
==16217==    by 0x413CB4: vshCommandRun (virsh.c:18669)
==16217==  Address 0x4ec5e25 is 0 bytes after a block of size 293 alloc'd
==16217==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==16217==    by 0x303364F1DB: virAllocN (memory.c:129)
==16217==    by 0x41A844: vshPrepareDiskXML (virsh.c:15043)
==16217==    by 0x41AECC: cmdChangeMedia (virsh.c:15246)
==16217==    by 0x413CB4: vshCommandRun (virsh.c:18669)
==16217==    by 0x423973: main (virsh.c:20261)

12 years agodocs: small typo in formatdomain.html
Laine Stump [Thu, 14 Jun 2012 17:26:19 +0000 (13:26 -0400)]
docs: small typo in formatdomain.html

12 years agoAlways pivot_root event if the new root source is '/'
Daniel P. Berrange [Tue, 12 Jun 2012 20:26:37 +0000 (16:26 -0400)]
Always pivot_root event if the new root source is '/'

This reverts

  commit c16b4c43fcdd8ec02581f38377983b2e0925bfcd
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Fri May 11 15:09:27 2012 +0100

    Avoid LXC pivot root in the root source is still /

This commit broke setup of /dev, because the code which
deals with setting up a private /dev and /dev/pts only
works if you do a pivotroot.

The original intent of avoiding the pivot root was to
try and ensure the new root has a minimumal mount
tree. The better way todo this is to just unmount the
bits we don't want (ie old /proc & /sys subtrees.
So apply the logic from

  commit c529b47a756960d332fbe9903943dae855e7b949
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Fri May 11 11:35:28 2012 +0100

    Trim /proc & /sys subtrees before mounting new instances

to the pivot_root codepath as well

12 years agoImprove error message diagnosing incorrect XML CPU mode
Daniel P. Berrange [Wed, 13 Jun 2012 17:21:29 +0000 (18:21 +0100)]
Improve error message diagnosing incorrect XML CPU mode

Tell the user what CPU mode value is wrong

12 years agoqemu: Enable disconnecting SPICE clients without changing password
Peter Krempa [Thu, 14 Jun 2012 12:48:42 +0000 (14:48 +0200)]
qemu: Enable disconnecting SPICE clients without changing password

Libvirt updates the configuration of SPICE server only when something
changes. This is unfortunate when the user wants to disconnect a
existing spice session when the connected attribute is already
"disconnect".

This patch modifies the conditions for calling the password updater to
be called when nothing changes, but the connected attribute is already
"disconnect".

12 years agovirsh: Report name from edited object
Michal Privoznik [Thu, 14 Jun 2012 12:18:31 +0000 (14:18 +0200)]
virsh: Report name from edited object

There is a little easter egg in virsh: one can easily clone
an object (domain, network, ...). Just 'virsh edit' change the name
and remove <uuid>. And then, in the end when reporting success
the new name was printed out.
However, with recent edit rewrite we lost the final part and are
still printing the original name out.

12 years agovirsh: Honor reedit opts printing to a function
Michal Privoznik [Wed, 13 Jun 2012 09:11:27 +0000 (11:11 +0200)]
virsh: Honor reedit opts printing to a function

When printing reedit options we make stdin raw. However,
this results in stdout being raw as well. Therefore we need
to return carriage when doing new line. Unfortunately,
'\r' cannot be part of internationalized messages hence
we must move them to formatting string which then in turn
become huge and disarranged. To solve this, a new function
is introduced which takes variable string arguments and
prepend each with "\r\n" just before printing.

12 years agoqemu: Fix off-by-one error while unescaping monitor strings
Peter Krempa [Thu, 14 Jun 2012 08:29:36 +0000 (10:29 +0200)]
qemu: Fix off-by-one error while unescaping monitor strings

While unescaping the commands the commands passed through to the monitor
function qemuMonitorUnescapeArg() initialized lenght of the input string
to strlen()+1 which is fine for alloc but not for iteration of the
string.

This patch fixes the off-by-one error and drops the pointless check for
a single trailing slash that is automaticaly handled by the default
branch of switch.

12 years agovirsh: Don't generate invalid XML in attach-disk command
Peter Krempa [Wed, 13 Jun 2012 14:55:51 +0000 (16:55 +0200)]
virsh: Don't generate invalid XML in attach-disk command

The attach-disk command used with parameter --cache created an invalid
XML snippet as the beginning of the <driver> element was not printed
when used solely with --cache and no other attribute to driver.