]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agoutil: remove dead assignment
Eric Blake [Tue, 3 May 2011 20:27:40 +0000 (14:27 -0600)]
util: remove dead assignment

Clang complained about this, and it was easy enough to fix.

* src/util/util.c (virFileOpenAs): Drop dead assignment.

14 years agolxc: report correct error
Eric Blake [Tue, 3 May 2011 20:30:34 +0000 (14:30 -0600)]
lxc: report correct error

Clang noticed a dead assignment, which turned out to be the use
of the wrong variable.  rc starts life as -1, and is only ever
assigned to 0 just before a successful cleanup.

* src/lxc/lxc_driver.c (lxcSetupInterfaces): Don't call
virReportSystemError(-1).

14 years agolibxl: avoid compiler warning
Eric Blake [Wed, 4 May 2011 15:21:05 +0000 (09:21 -0600)]
libxl: avoid compiler warning

Detected by gcc:

libxl/libxl_driver.c: In function 'libxlDomainDestroy':
libxl/libxl_drier.c:1351:30: error: variable 'priv' set but not used [-Werror=unused-but-set-variable]

* src/libxl/libxl_driver.c (libxlDomainDestroy): Delete unused
variable.

14 years agoqemu: remove dead assignment
Eric Blake [Tue, 3 May 2011 21:08:09 +0000 (15:08 -0600)]
qemu: remove dead assignment

Detected by clang.

* src/qemu/qemu_migration.c (qemuMigrationToFile): Nothing later
uses is_reg.

14 years agostorage: use virCommand to avoid compiler warning
Eric Blake [Tue, 3 May 2011 22:14:00 +0000 (16:14 -0600)]
storage: use virCommand to avoid compiler warning

clang didn't like the last increment to nargs.  But why even
track nargs ourselves, when virCommand does it for us?

* src/storage/storage_backend_iscsi.c
(virStorageBackendISCSIConnection): Switch to virCommand to avoid
a dead-store warning on nargs.

14 years agocgroup: avoid leaking a file
Eric Blake [Tue, 3 May 2011 21:46:06 +0000 (15:46 -0600)]
cgroup: avoid leaking a file

Clang detected a dead store to rc.  It turns out that in fixing this,
I also found a FILE* leak.

This is a subtle change in behavior, although unlikely to hit.  The
pidfile is a kernel file, so we've probably got more serious problems
under foot if we fail to parse one.  However, the previous behavior
was that even if one pid file failed to parse, we tried others,
whereas now we give up on the first failure.  Either way, though,
the function returns -1, so the caller will know that something is
going wrong, and that not all pids were necessarily reaped.  Besides,
there were other instances already in the code where failure in the
inner loop aborted the outer loop.

* src/util/cgroup.c (virCgroupKillInternal): Abort rather than
resuming loop on fscanf failure, and cleanup file on error.

14 years agoqemu: silence clang false positives
Eric Blake [Tue, 3 May 2011 19:17:04 +0000 (13:17 -0600)]
qemu: silence clang false positives

Clang 2.8 wasn't quite able to follow that persistentDef was
assigned earlier if (flags & VIR_DOMAIN_MEM_CONFIG) is true.
Silence this false positive, to make clang analysis easier to use.

* src/qemu/qemu_driver.c (qemudDomainSetMemoryFlags): Add an
annotation to silence clang's claim of a NULL dereference.

14 years agovirsh: avoid null pointer dereference
Eric Blake [Tue, 3 May 2011 16:41:57 +0000 (10:41 -0600)]
virsh: avoid null pointer dereference

Clang detected that vol-download will call unlink(NULL) if there
is a parse error during option parsing.  Also, mingw doesn't like
unlinking an open file.

* tools/virsh.c (cmdVolDownload): Only unlink file if created.

14 years agopci: fix null pointer dereference
Eric Blake [Tue, 3 May 2011 15:29:26 +0000 (09:29 -0600)]
pci: fix null pointer dereference

Clang detected a null-pointer dereference regression, introduced
in commit 4e8969eb.  Without this patch, a device with
unbind_from_stub set to false would eventually try to call
virFileExists on uncomputed drvdir.

* src/util/pci.c (pciUnbindDeviceFromStub): Ensure drvdir is set
before use.

14 years agoqemu: avoid null pointer dereference
Eric Blake [Tue, 3 May 2011 15:36:12 +0000 (09:36 -0600)]
qemu: avoid null pointer dereference

This code has had problems historically.  As originally
written, in commit 6bcf2501 (Jun 08), it could call unlink
on a random string, nuking an unrelated file.

Then commit 182a80b9 (Sep 09), the code was rewritten to
allocate tmp, with both a use-after-free bug and a chance to
call unlink(NULL).

Commit e206946 (Mar 11) fixed the use-after-free, but not the
NULL dereference.  Thanks to clang for catching this!

* src/qemu/qemu_driver.c (qemudDomainMemoryPeek): Don't call
unlink on NULL.

14 years agotests: avoid null pointer dereference
Eric Blake [Tue, 3 May 2011 16:37:13 +0000 (10:37 -0600)]
tests: avoid null pointer dereference

Unlikely to hit in real life, but clang noticed it.

* tests/commandtest.c (checkoutput, test4, test18): Avoid
unlink(NULL) on OOM.

14 years agoRevert "lxc: Do not try to reconnect inactive domain when do lxcStartup"
Eric Blake [Tue, 3 May 2011 16:07:48 +0000 (10:07 -0600)]
Revert "lxc: Do not try to reconnect inactive domain when do lxcStartup"

This reverts commit 0e7f7f8566f3e7fcf5bce395555fa1b5cf1e136b.

From the mailing list:

> So, AFAICT, this patch means we will never reconnect to any LXC
> VMs now.
>
> The correct solution, is to refactor LXC driver startup to work
> the same way as the QEMU driver startup.
>
>   - Load all the live state XML files (to pick up running VMs)
>   - Reconnect to all VMs
>   - Load all the persistent config XML files (to pick up any additional
>     inactive guets)

But that solution is invasive enough to be post-0.9.1.

14 years agotests: suppress more valgrind situations
Eric Blake [Mon, 2 May 2011 22:54:04 +0000 (16:54 -0600)]
tests: suppress more valgrind situations

* tests/.valgrind.supp: Consolidate bash suppressions.  Ignore
more libnl issues.

14 years agoFix disability to run on systems with no PCI bus
Michal Privoznik [Fri, 22 Apr 2011 12:24:54 +0000 (14:24 +0200)]
Fix disability to run on systems with no PCI bus

The patch which moved libpciaccess initialization to one place caused
regression - we were not able to run on system with no PCI bus, like
s390(x).

14 years agolxc: Do not try to reconnect inactive domain when do lxcStartup
Osier Yang [Tue, 3 May 2011 06:48:03 +0000 (14:48 +0800)]
lxc: Do not try to reconnect inactive domain when do lxcStartup

Otherwise if there are inactive lxc domains, lxcStartup will
try to reconnect to sockets of these domains, which results in
errors in libvirtd log.

14 years agotests: avoid compiler warning
Eric Blake [Mon, 2 May 2011 23:35:18 +0000 (17:35 -0600)]
tests: avoid compiler warning

../../tests/xmconfigtest.c: In function 'testCompareParseXML':
../../tests/xmconfigtest.c:49:19: error: 'conn' may be used uninitialized in this function [-Wuninitialized]

* tests/xmconfigtest.c (testCompareParseXML): Initialize variable.

14 years agoqemu: fix uninitialized variable warning
Christophe Fergeau [Mon, 2 May 2011 09:10:10 +0000 (11:10 +0200)]
qemu: fix uninitialized variable warning

This commit fixes
qemu/qemu_driver.c: In function 'qemuDomainModifyDeviceFlags':
qemu/qemu_driver.c:4041:8: warning: 'ret' may be used uninitialized in this
function [-Wuninitialized]
qemu/qemu_driver.c:4013:9: note: 'ret' was declared here

The variable is set to -1 so that the error paths are taken when the code
to set it didn't get a chance to run. Without initializing it, we could
return some an undefined value from this function.

While I was at it, I made a trivial whitespace change in the same function
to improve readability.

14 years agofix missing VLAN id for Qbg example
Gerhard Stenzel [Mon, 2 May 2011 14:49:03 +0000 (16:49 +0200)]
fix missing VLAN id for Qbg example

For IEEE 802.1Qbg, it is necessary to use a VLAN interface.
vepa itself does not require a VLAN interface.

Signed-off-by: Gerhard Stenzel <stenzel at de.ibm.com>
14 years agotests: Lower stack usage below 4096 bytes
Matthias Bolte [Sun, 24 Apr 2011 22:25:10 +0000 (00:25 +0200)]
tests: Lower stack usage below 4096 bytes

Make virtTestLoadFile allocate the buffer to read the file into.

Fix logic error in virtTestLoadFile, stop reading on the first empty line.

Use virFileReadLimFD in virtTestCaptureProgramOutput to avoid manual
buffer handling.

14 years agotests: Update valgrind suppressions file
Matthias Bolte [Sat, 30 Apr 2011 10:24:01 +0000 (12:24 +0200)]
tests: Update valgrind suppressions file

14 years agovirsh: fix regression in log to file
Supriya Kannery [Sat, 30 Apr 2011 10:56:14 +0000 (16:26 +0530)]
virsh: fix regression in log to file

Commit 36deff04 introduced a regression due to which virsh is not able
to log to a file - msg_buf was changed from an array to a pointer
without corresponding change to usage of "sizeof()".

Fix regression in virsh logging

Signed-off-by: Supriya Kannery <supriyak@in.ibm.com>
14 years agonwfilter: Fix memory leak in the ebtables subdriver
Matthias Bolte [Sat, 30 Apr 2011 10:23:31 +0000 (12:23 +0200)]
nwfilter: Fix memory leak in the ebtables subdriver

Call shutdown functions for all subcomponents in nwfilterDriverShutdown.

Make sure that this shutdown functions can safely be called multiple times
and independent from the actual subcomponents state.

14 years agoqemu: Fix qemuDomainModifyDeviceFlags leaking the caps bitmap
Matthias Bolte [Sat, 30 Apr 2011 10:07:39 +0000 (12:07 +0200)]
qemu: Fix qemuDomainModifyDeviceFlags leaking the caps bitmap

14 years agoFix memory leak in __virExec
Matthias Bolte [Sat, 30 Apr 2011 10:06:29 +0000 (12:06 +0200)]
Fix memory leak in __virExec

Commit e0d014f2379dd made binary potentially allocated on the heap.
It was freed in the parent in the error path, but not in the success path
that doesn't goto the cleanup label.

Found by 'make -C tests valgrind'.

14 years agohash: fix memory leak regression
Eric Blake [Fri, 29 Apr 2011 19:49:36 +0000 (13:49 -0600)]
hash: fix memory leak regression

Commit 1671d1d introduced a memory leak in virHashFree, and
wholesale table corruption in virHashRemoveSet (elements not
requested to be freed are lost).

* src/util/hash.c (virHashFree): Free bucket array.
(virHashRemoveSet): Don't lose elements.
* tests/hashtest.c (testHashCheckForEachCount): New method.
(testHashCheckCount): Expose the bug.

14 years agodocs: Document <filesystem> device
Cole Robinson [Fri, 29 Apr 2011 17:20:28 +0000 (13:20 -0400)]
docs: Document <filesystem> device

Tried to dredge through old changelogs and commits to come up with it, so
may not be completely accurate.

v2:
Drop ambiguous 'containers'
Use same mail archive for all links

14 years agobuild: fix getcwd portability problems
Eric Blake [Fri, 29 Apr 2011 17:14:23 +0000 (11:14 -0600)]
build: fix getcwd portability problems

* bootstrap.conf (gnulib_modules): Add getcwd-lgpl.
* tests/commandtest.c (checkoutput): Drop unused cwd.
* tests/commandhelper.c (main): Let getcwd malloc.
* tests/testutils.c (virTestMain): Likewise.
* tools/virsh.c (cmdPwd): Likewise.
(virshCmds): Expose cmdPwd and cmdCd on mingw.

14 years agotests: simplify common setup
Eric Blake [Fri, 29 Apr 2011 16:21:20 +0000 (10:21 -0600)]
tests: simplify common setup

A few of the tests were missing basic sanity checks, while most
of them were doing copy-and-paste initialization (in fact, some
of them pasted the argc > 1 check more than once!).  It's much
nicer to do things in one common place, and minimizes the size of
the next patch that fixes getcwd usage.

* tests/testutils.h (EXIT_AM_HARDFAIL): New define.
(progname, abs_srcdir): Define for all tests.
(VIRT_TEST_MAIN): Change callback signature.
* tests/testutils.c (virtTestMain): Do more common init.
* tests/commandtest.c (mymain): Simplify.
* tests/cputest.c (mymain): Likewise.
* tests/esxutilstest.c (mymain): Likewise.
* tests/eventtest.c (mymain): Likewise.
* tests/hashtest.c (mymain): Likewise.
* tests/networkxml2xmltest.c (mymain): Likewise.
* tests/nodedevxml2xmltest.c (myname): Likewise.
* tests/nodeinfotest.c (mymain): Likewise.
* tests/nwfilterxml2xmltest.c (mymain): Likewise.
* tests/qemuargv2xmltest.c (mymain): Likewise.
* tests/qemuhelptest.c (mymain): Likewise.
* tests/qemuxml2argvtest.c (mymain): Likewise.
* tests/qemuxml2xmltest.c (mymain): Likewise.
* tests/qparamtest.c (mymain): Likewise.
* tests/sexpr2xmltest.c (mymain): Likewise.
* tests/sockettest.c (mymain): Likewise.
* tests/statstest.c (mymain): Likewise.
* tests/storagepoolxml2xmltest.c (mymain): Likewise.
* tests/storagevolxml2xmltest.c (mymain): Likewise.
* tests/virbuftest.c (mymain): Likewise.
* tests/virshtest.c (mymain): Likewise.
* tests/vmx2xmltest.c (mymain): Likewise.
* tests/xencapstest.c (mymain): Likewise.
* tests/xmconfigtest.c (mymain): Likewise.
* tests/xml2sexprtest.c (mymain): Likewise.
* tests/xml2vmxtest.c (mymain): Likewise.

14 years agobuild: avoid test warnings on mingw
Eric Blake [Thu, 28 Apr 2011 23:39:17 +0000 (17:39 -0600)]
build: avoid test warnings on mingw

* .gnulib: Update to latest, for getaddrinfo fixes.
Reported by Matthias Bolte.

14 years agovirsh: avoid compiler warning on mingw
Eric Blake [Thu, 28 Apr 2011 21:09:08 +0000 (15:09 -0600)]
virsh: avoid compiler warning on mingw

We don't use gnulib's sanitizations for vfprintf, but vshDebug
was used with %zu, which means that it would fail on mingw.
Thank goodness the compiler indirectly caught this for us :)

virsh.c: In function 'vshDebug':
virsh.c:12105:5: warning: function might be possible candidate for
'ms_printf' format attribute [-Wmissing-format-attribute]

since mingw <stdio.h> hasn't yet added gcc attributes to vfprintf.

* tools/virsh.c (vshDebug): Avoid vfprintf.
(vshPrintExtra): Use lighter-weight fputs.
Reported by Matthias Bolte.

14 years agolibvirt/qemu - support persistent update of disks
KAMEZAWA Hiroyuki [Fri, 22 Apr 2011 03:10:28 +0000 (12:10 +0900)]
libvirt/qemu - support persistent update of disks

Support update of disks by MODIFY_CONFIG

This patch includes changes for qemu's disk to support
virDomainUpdateDeviceFlags() with VIR_DOMAIN_DEVICE_MODIFY_CONFIG.

This patch adds support for CDROM/foppy disk types.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
* src/qemu/qemu_driver.c
(qemuDomainUpdateDeviceConfig): support cdrom/floppy.

14 years agoXen: Do not generate net ifname if domain is inactive
Jim Fehlig [Wed, 27 Apr 2011 22:39:37 +0000 (16:39 -0600)]
Xen: Do not generate net ifname if domain is inactive

V2: Use virAsprintf instead of snprintf/strdup

The xend driver will generate a virDomainNetDef ifname if one is not
specified in xend sexpr, even if domain is inactive.  The result is
network interface XML containing 'vif-1.Y' on dev attribute of target
element, e.g.

  <interface type='bridge'>
    <target dev='vif-1.0'/>
    ...

This patch changes the behavior to only generate the ifname if not
specified in xend sexpr *and* domain is not inactive (id != -1).

14 years agoxen: check if device is assigned to guest before reattaching
Yufang Zhang [Wed, 27 Apr 2011 12:09:12 +0000 (20:09 +0800)]
xen: check if device is assigned to guest before reattaching

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=664059

Reattaching pci device back to host without destroying guest or
detaching device from guest would cause host to crash. This patch adds
a check before doing device reattach. If the device is being assigned
to guest, libvirt refuses to reattach device to host. The patch only
works for Xen, for it just checks xenstore to get pci device
information.

Signed-off-by: Yufang Zhang <yuzhang@redhat.com>
14 years agonetwork: fix return value of hostsFileWrite
Laine Stump [Wed, 27 Apr 2011 18:11:14 +0000 (14:11 -0400)]
network: fix return value of hostsFileWrite

The lone caller to hostsFileWrite (and the callers for at least 3
levels up the return stack) assume that the return value will be < 0
on failure. However, hostsFileWrite returns 0 on success, and a
positive errno on failure. This patch changes hostsFileWrite to return
-errno on failure.

14 years agomaint: fix comment typos
Eric Blake [Thu, 28 Apr 2011 14:14:09 +0000 (08:14 -0600)]
maint: fix comment typos

* src/esx/esx_driver.c: Fix spelling of 'relative'.
* src/util/util.c: Likewise.

14 years agobuild: Use pkg-config for libssh2 check
Jiri Denemark [Wed, 27 Apr 2011 10:26:07 +0000 (12:26 +0200)]
build: Use pkg-config for libssh2 check

Currently the build fails if /usr/local/include does not exist since
its use is hardcoded in configure.ac

14 years agobuild: Ignore old audit library
Jiri Denemark [Wed, 27 Apr 2011 09:19:23 +0000 (11:19 +0200)]
build: Ignore old audit library

Check for audit_encode_nv_string in libaudit so that ancient audit
library is ignored rather than trying to compile with libaudit support
and failing.

14 years agoutil: Initialize hooks at daemon shutdown if no hooks defined
Osier Yang [Thu, 28 Apr 2011 06:48:26 +0000 (14:48 +0800)]
util: Initialize hooks at daemon shutdown if no hooks defined

We support to initialize the hooks at daemon reload if there is no
hooks script is defined, we should also support initialize the hooks
at daemon shutdown if no hooks is defined.

To address bz: https://bugzilla.redhat.com/show_bug.cgi?id=688859

14 years agofix virsh's regression
Wen Congyang [Tue, 26 Apr 2011 03:03:04 +0000 (11:03 +0800)]
fix virsh's regression

This patch does the following things:
1. The return value of cmdSchedInfoUpdate() can be -1, 0 and 1. So the
   type of return value should be int not bool.(This function is not a
   entry of a virsh command, but the name of this function likes cmdXXX)

2. The type of cmdSchedinfo()'s, cmdFreecell()'s, cmdPoolList()'s and
   cmdVolList()'s return value is bool not int, so change the type of
   variable ret_val, func_ret and functionReturn.

3. Add a variable functionReturn for cmdMigrate(), cmdAttachInterface(),
   cmdDetachInterface(), cmdAttachDisk() and cmdDetachDisk() to save the
   return value.

4. Change the type of variable ret in the function cmdAttachDevice(),
   cmdDetachDevice(), cmdUpdateDevice(), cmdAttachInterface(),
   cmdDetachInterface(), cmdAttachDisk() and cmdDetachDisk() to int, as
   we use it to save the return value of virXXX() and the type of virXXX()'s
   return value is int not bool.

5. Do some cleanup when virBuff.error is 1.

The bug 1-4 were introduced by commit b56fa5bb.

14 years agolibvirt/qemu - support persistent attach/detach disks
KAMEZAWA Hiroyuki [Fri, 22 Apr 2011 03:09:32 +0000 (12:09 +0900)]
libvirt/qemu - support persistent attach/detach disks

Support changes of disks by MODIFY_CONFIG for qemu.

This patch includes patches for qemu's disk to support
virDomainAt(De)tachDeviceFlags with VIR_DOMAIN_DEVICE_MODIFY_CONFIG.

Other devices can be added incrementally.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
* /src/conf/domain_conf.c
(virDomainDiskIndexByName): returns array index of disk in vmdef.
(virDomainDiskRemoveByName): removes a disk which has the name in vmdef.
* src/qemu/qemu_driver.c
(qemuDomainAttachDeviceConfig): add support for Disks.
(qemuDomainDetachDeviceConfig): add support for Disks.

14 years agolibvirt/qemu - support persistent modification of devices
KAMEZAWA Hiroyuki [Fri, 22 Apr 2011 03:07:56 +0000 (12:07 +0900)]
libvirt/qemu - support persistent modification of devices

This patch adds functions for modify domain's persistent definition.
To do error recovery in easy way, we use a copy of vmdef and update it.

The whole sequence will be:

  make a copy of domain definition.

  if (flags & MODIFY_CONFIG)
      update copied domain definition
  if (flags & MODIF_LIVE)
      do hotplug.
  if (no error)
      save copied one to the file and update cached definition.
  else
      discard copied definition.

This patch is mixuture of Eric Blake's work and mine.
From: Eric Blake <eblake@redhat.com>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
(virDomainObjCopyPersistentDef): make a copy of persistent vm definition
(qemuDomainAttach/Detach/UpdateDeviceConfig) : callbacks. now empty
(qemuDomainModifyDeviceFlags): add support for MODIFY_CONFIG and MODIFY_CURRENT

14 years agobuild: fix 32-bit test failure
Eric Blake [Wed, 27 Apr 2011 16:46:12 +0000 (10:46 -0600)]
build: fix 32-bit test failure

Same fix as commit 1fc288e1e25.

* tests/hashtest.c (testHashRemoveForEach): Use correct format.

14 years agoutil: Simplify hash implementation
Jiri Denemark [Tue, 12 Apr 2011 17:12:12 +0000 (19:12 +0200)]
util: Simplify hash implementation

So far first entries for each hash key are stored directly in the hash
table while other entries mapped to the same key are linked through
pointers. As a result of that, the code is cluttered with special
handling for the first items.

This patch makes all entries (even the first ones) linked through
pointers, which significantly simplifies the code and makes it more
maintainable.

14 years agotests: More unit tests for internal hash APIs
Jiri Denemark [Fri, 15 Apr 2011 19:17:11 +0000 (21:17 +0200)]
tests: More unit tests for internal hash APIs

This adds several tests for remaining hash APIs (custom
hasher/comparator functions are not covered yet, though).

All tests pass both before and after the "Simplify hash implementation".

14 years agobuild: Fix problem of building Python bindings
Osier Yang [Wed, 27 Apr 2011 13:07:14 +0000 (21:07 +0800)]
build: Fix problem of building Python bindings

If one specify "--with-python=yes" but no python-devel package
is installed, we ignore it with just a notice message, which
doesn't give clear guide to user.

14 years agorelease PCI address only when we have ensured it successfully
Wen Congyang [Tue, 26 Apr 2011 03:40:01 +0000 (11:40 +0800)]
release PCI address only when we have ensured it successfully

Steps to reproduce this bug:
1. # cat net.xml # 00:03.0 has been used
    <interface type='network'>
      <mac address='52:54:00:04:72:f3'/>
      <source network='default'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

2. # virsh attach-device vm1 net.xml
   error: Failed to attach device from net.xml
   error: internal error unable to reserve PCI address 0:0:3

3. # virsh attach-device vm1 net.xml
   error: Failed to attach device from net.xml
   error: internal error unable to execute QEMU command 'device_add': Device 'rtl8139' could not be initialized

The reason of this bug is that: we can not reserve PCI address 0:0:3 because it has
been used, but we release PCI address when we reserve it failed.

14 years agofree memory properly in cleanup patch
Hu Tao [Tue, 26 Apr 2011 01:20:31 +0000 (09:20 +0800)]
free memory properly in cleanup patch

virsh schedinfo inactive-domain will trigger the problem.

14 years agofree buf->content when vsnprintf() failed
Wen Congyang [Wed, 27 Apr 2011 05:43:24 +0000 (13:43 +0800)]
free buf->content when vsnprintf() failed

When buf->error is 1, we do not return buf->content in the function
virBufferContentAndReset(). So we should free buf->content when
vsnprintf() failed.

14 years agoesx: Fix dynamic dispatch for CastFromAnyType functions
Matthias Bolte [Mon, 25 Apr 2011 10:38:17 +0000 (12:38 +0200)]
esx: Fix dynamic dispatch for CastFromAnyType functions

This was broken by the refactoring in ac1e6586ec75. It resulted in a
segfault for 'virsh vol-dumpxml' and related volume functions.

Before the refactoring all users of the ESX_VI__TEMPLATE__DISPATCH
macro dispatched on the item type, as the item is the input to all those
functions.

Commit ac1e6586ec75 made the dynamically dispatched CastFromAnyType
functions use this macro too, but this functions dispatched on the
actual type of the AnyType object. The item is the output of the
CastFromAnyType functions.

This difference was missed in the refactoring, making CastFromAnyType
functions dereferencing the item pointer that is NULL at the time of
the dispatch.

14 years agoMove call to virReportOOMError into virFileBuildPath
Matthias Bolte [Sun, 24 Apr 2011 09:48:00 +0000 (11:48 +0200)]
Move call to virReportOOMError into virFileBuildPath

Suggested by Daniel P. Berrange

14 years agobuild: use gnulib passfd for simpler SCM_RIGHTS code
Eric Blake [Wed, 20 Apr 2011 19:56:50 +0000 (13:56 -0600)]
build: use gnulib passfd for simpler SCM_RIGHTS code

* .gnulib: Update to latest for passfd fixes.
* bootstrap.conf (gnulib_modules): Add passfd.
* src/util/util.c (virFileOpenAs): Simplify.

14 years agoqemu: Add flags checking in DomainCoreDump
Jiri Denemark [Fri, 22 Apr 2011 10:02:39 +0000 (12:02 +0200)]
qemu: Add flags checking in DomainCoreDump

14 years agoMake crash and live flags mutually exclusive in virDomainCoreDump
Mark Wu [Fri, 22 Apr 2011 09:45:33 +0000 (11:45 +0200)]
Make crash and live flags mutually exclusive in virDomainCoreDump

They don't make any sense when used together.

14 years agoMake sure DNSMASQ_STATE_DIR exists
Guido Günther [Sat, 23 Apr 2011 12:28:44 +0000 (14:28 +0200)]
Make sure DNSMASQ_STATE_DIR exists

otherwise the directory returned by networkDnsmasqLeaseFileName will not
be created if ipdef->nhosts == 0 in networkBuildDnsmasqArgv.

14 years agoFix small memory leaks in config parsing related functions
Matthias Bolte [Sun, 24 Apr 2011 18:00:30 +0000 (20:00 +0200)]
Fix small memory leaks in config parsing related functions

Found by 'make -C tests valgrind'.

xen_xm.c: Dummy allocation via virDomainChrDefNew is directly
overwritten and lost. Free 'script' in success path too.

vmx.c: Free virtualDev_string in success path too.

domain_conf.c: Free compression in success path too.

14 years agoAdd virDomainEventRebootNew
Matthias Bolte [Mon, 25 Apr 2011 11:35:23 +0000 (13:35 +0200)]
Add virDomainEventRebootNew

This will be used in the ESX driver event handling.

14 years agobuild: make VIR_FREE do some type checking
Eric Blake [Sat, 23 Apr 2011 02:15:50 +0000 (20:15 -0600)]
build: make VIR_FREE do some type checking

We can exploit the fact that gcc warns about int-to-pointer conversion
in ternary cond?(void*):(int) in order to prevent future mistakes of
calling VIR_FREE on a scalar lvalue.  For example, between commits
158ba873 and 802e2df, we would have had this warning:

cc1: warnings being treated as errors
remote.c: In function 'remoteDispatchListNetworks':
remote.c:3684:70: error: pointer/integer type mismatch in conditional expression

There are still a number of places that malloc into a const char*;
while it would probably be worth scrubbing them to use char*
instead, that is a separate patch, so we have to cast away const
in VIR_FREE for now.

* src/util/memory.h (VIR_FREE): Make gcc warn about integers.
Iteratively developed from a patch by Christophe Fergeau.

14 years agothreads: add one-time initialization support
Eric Blake [Wed, 20 Apr 2011 22:26:00 +0000 (16:26 -0600)]
threads: add one-time initialization support

mingw lacks the counterpart to PTHREAD_MUTEX_INITIALIZER, so the
best we can do is portably expose once-only runtime initialization.

* src/util/threads.h (virOnceControlPtr): New opaque type.
(virOnceFunc): New callback type.
(virOnce): New prototype.
* src/util/threads-pthread.h (virOnceControl): Declare.
(VIR_ONCE_CONTROL_INITIALIZER): Define.
* src/util/threads-win32.h (virOnceControl)
(VIR_ONCE_CONTROL_INITIALIZER): Likewise.
* src/util/threads-pthread.c (virOnce): Implement in pthreads.
* src/util/threads-win32.c (virOnce): Implement in WIN32.
* src/libvirt_private.syms: Export it.

14 years agoesx: Add a wrapper for shared CURL handles
Matthias Bolte [Sat, 19 Feb 2011 14:27:16 +0000 (15:27 +0100)]
esx: Add a wrapper for shared CURL handles

To be used to share a CURL handle between multiple threads in the
upcoming domain event support.

14 years agoesx: Move CURL handling code to it's own type
Matthias Bolte [Sat, 19 Feb 2011 13:34:25 +0000 (14:34 +0100)]
esx: Move CURL handling code to it's own type

14 years agodaemon: Don't try to free an unsigned int in error paths
Matthias Bolte [Fri, 22 Apr 2011 09:05:38 +0000 (11:05 +0200)]
daemon: Don't try to free an unsigned int in error paths

14 years agodaemon: Honor error variable name change in the generator
Matthias Bolte [Fri, 22 Apr 2011 09:01:15 +0000 (11:01 +0200)]
daemon: Honor error variable name change in the generator

Commit 36b652138be renamed err to rerr, do the same in the generator.

14 years agolibvirt/qemu - clean up UpdateDevice for consolidation.
KAMEZAWA Hiroyuki [Thu, 21 Apr 2011 07:25:46 +0000 (16:25 +0900)]
libvirt/qemu - clean up UpdateDevice for consolidation.

This patch strips reusable part of qemuDomainUpdateDeviceFlags()
and consolidate it to qemuDomainModifyDeviceFlags().
No functional changes.

* src/qemu/qemu_driver.c
(qemuDomainChangeDiskMediaLive) : pulled out code for updating disks.
(qemuDomainUpdateDeviceLive) : core of UpdateDevice, extracted from
UpdateDeviceFlags()
(qemuDomainModifyDeviceFlags): add support for updating device in live domain.
(qemuDomainUpdateDeviceFlags): reworked as a wrapper function of
qemuDomainModifyDeviceFlags()

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agolibvirt/qemu - clean up At(De)tachDeviceFlags() for consolidation.
KAMEZAWA Hiroyuki [Thu, 21 Apr 2011 07:23:48 +0000 (16:23 +0900)]
libvirt/qemu - clean up At(De)tachDeviceFlags() for consolidation.

clean up At(De)tachDeviceFlags() for consolidation.

qemuDomainAttachDeviceFlags()/qemuDomainDetachFlags()/
qemuDomainUpdateDeviceFlags() has similar logics and copied codes.

This patch series tries to unify them to use shared code when it can.
At first, clean up At(De)tachDeviceFlags() and devide it into functions.

By this, this patch pulls out shared components between functions.
Based on patch series by Eric Blake, I added some modification as
switch-case with QEMU_DEVICE_ATTACH, QEMU_DEVICE_DETACH, QEMU_DEVICE_UPDATE

* src/qemu/qemu_driver.c
(qemuDomainAt(De)tachDeviceFlags) : pulled out to qemuDomainModifyDeviceFlags()
(qemuDomainModifyDeviceFlags) : implements generic code for modifying domain.
(qemuDomainAt(De)tachDeviceFlagsLive) : code for at(de)taching devices to
domain in line. no changes in logic from old code.
(qemuDomainAt(De)tachDeviceDiskLive) : for at(de)taching Disks.
(qemuDomainAt(De)tachDeviceControllerLive) : for at(de)taching Controllers

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agolibvirt/qemu - Centralize device modification in the more flexible APIs
KAMEZAWA Hiroyuki [Thu, 21 Apr 2011 07:22:30 +0000 (16:22 +0900)]
libvirt/qemu - Centralize device modification in the more flexible APIs

Centralize device modification in the more flexible APIs, to allow future
honoring of additional flags.  Explicitly reject the
VIR_DOMAIN_DEVICE_MODIFY_FORCE flag on attach/detach.

Based on Eric Blake<eblake@redhat.com>'s work.

* src/qemu/qemu_driver.c
(qemudDomainAttachDevice)(qemudDomainAttachDeviceFlags): Swap bodies,rename...
(qemudDomainDetachDevice, qemudDomainDetachDeviceFlags): Likewise.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agoAdd support for s390(x) cpu options parsing
Michal Privoznik [Thu, 21 Apr 2011 15:27:40 +0000 (17:27 +0200)]
Add support for s390(x) cpu options parsing

Up to now we missed parser for cpuinfo on x390(x) machines. Those machines
have only 1 thread, core, socket. What is missing is information about
CPU frequency.

14 years agoFix QEMU tunnelled migration FD handling
Daniel P. Berrange [Thu, 21 Apr 2011 15:02:40 +0000 (16:02 +0100)]
Fix QEMU tunnelled migration FD handling

The two ends of the pipe used for feeding QEMU tunnelled
migration data were interchanged, so QEMU got given the
"write" end instead of the "read" end.

The qemuMigrationPrepareTunnel method was also immediately
closing the "write" end of the pipe, so the stream failed
to actually write anything.

* src/qemu/qemu_migration.c: Swap tunnelled migration
  pipe FDs & don't close pipe given to stream

14 years agobuild: fix 32-bit test failure
Eric Blake [Thu, 21 Apr 2011 14:23:59 +0000 (08:23 -0600)]
build: fix 32-bit test failure

ARRAY_CARDINALITY is typed as size_t, not long; this matters on 32-bit
platforms:

hashtest.c: In function 'testHashRemoveForEach':
hashtest.c:114: error: format '%lu' expects type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat]

* tests/hashtest.c (testHashRemoveForEach): Use correct format.

14 years agoRemove artificial minimum limit for guest memory
Jiri Denemark [Thu, 21 Apr 2011 10:06:41 +0000 (12:06 +0200)]
Remove artificial minimum limit for guest memory

Remove the artificial minimum of 4096 KB for guest memory. It's drivers'
job to set the limit if needed.

14 years agoPHYP: Adding reboot domain function
Eduardo Otubo [Tue, 19 Apr 2011 15:34:08 +0000 (12:34 -0300)]
PHYP: Adding reboot domain function

Adding reboot <domain> function for pHyp driver.

14 years agobuild: fix syntax-check failure
Eric Blake [Wed, 20 Apr 2011 23:00:30 +0000 (17:00 -0600)]
build: fix syntax-check failure

* .mailmap: Add an alias for last commit.

14 years agofix tunnelled migration's regression
Wen Congyang [Wed, 20 Apr 2011 10:20:12 +0000 (18:20 +0800)]
fix tunnelled migration's regression

If the migrateFrom is "stdio" not "stdin", qemuBuildCommandLine()
will convert it to exec:cat or fd:n.

14 years agonwfilter: no support for direct type of interface
Stefan Berger [Tue, 19 Apr 2011 20:23:59 +0000 (16:23 -0400)]
nwfilter: no support for direct type of interface

Ebtables filtering doesn't work on macvtap device. Remove support for direct type of interface.

14 years agovirsh: nuke use of TRUE and FALSE
Eric Blake [Mon, 18 Apr 2011 22:37:42 +0000 (16:37 -0600)]
virsh: nuke use of TRUE and FALSE

Gnulib already guarantees <stdbool.h>, so it is easier to just
use the standardized spellings.

* tools/virsh.c (vshCmdDef): Change callback to return real bool.
(__vshControl): Change several fields to bool.
(vshCommandOptBool): Change return type.
All callers updated.
* tools/Makefile.am (virsh-net-edit.c, virsh-pool-edit.c):
Likewise.

14 years agoqemu: fix the check of virDomainObjUnref()'s return value
Wen Congyang [Tue, 19 Apr 2011 02:08:21 +0000 (10:08 +0800)]
qemu: fix the check of virDomainObjUnref()'s return value

If vm is unlocked in virDomainObjUnref(), the return value is 0, not less
than 0.

14 years agoAdd cputune support to libxl driver
Markus Groß [Mon, 18 Apr 2011 09:16:33 +0000 (11:16 +0200)]
Add cputune support to libxl driver

Here is a new version of this patch:
https://www.redhat.com/archives/libvir-list/2011-April/msg00337.html

v2:
  - store the cputune info for the whole runtime of the domain
  - remove cputune info when domain is destroyed

The nodeGetInfo code had to be moved into a helper
function to reuse it without a virConnectPtr.

14 years agoUpdate and sort msg_gen_function list and mark unmarked messages
Matthias Bolte [Sun, 17 Apr 2011 06:30:49 +0000 (08:30 +0200)]
Update and sort msg_gen_function list and mark unmarked messages

Inspired by Eric Blake

14 years agophyp: another simplification
Eric Blake [Wed, 13 Apr 2011 21:27:16 +0000 (15:27 -0600)]
phyp: another simplification

Rather than copying and pasting lots of code, factor it into a
single helper function.

This commit adds a warning if tighter integer parsing would fail
due to any stray bytes after the number, but should not change
any behavior other than the bug fix for phypNumDomainsGeneric
looking only at numeric lines.

* src/phyp/phyp_driver.c (phypExecInt): New function.
(phypGetVIOSPartitionID, phypNumDomainsGeneric, phypGetLparID)
(phypGetLparMem, phypGetLparCPUGeneric, phypGetRemoteSlot)
(phypGetVIOSNextSlotNumber, phypAttachDevice)
(phypGetStoragePoolSize, phypStoragePoolNumOfVolumes)
(phypNumOfStoragePools, phypInterfaceDestroy)
(phypInterfaceDefineXML, phypInterfaceLookupByName)
(phypInterfaceIsActive, phypNumOfInterfaces): Use it.
(phypNumDomainsGeneric): Correctly find numeric line.

14 years agomaint: ignore built file
Eric Blake [Mon, 18 Apr 2011 15:30:49 +0000 (09:30 -0600)]
maint: ignore built file

* .gitignore: Add exemption for hashtest.

14 years agobuild: fix qemu build failure in previous patch
Daniel P. Berrange [Mon, 18 Apr 2011 11:41:23 +0000 (12:41 +0100)]
build: fix qemu build failure in previous patch

This last minute addition caused a build failure

cc1: warnings being treated as errors
qemu/qemu_process.c: In function 'qemuProcessHandleWatchdog':
qemu/qemu_process.c:436:34: error: ignoring return value of 'virDomainObjUnref', declared with attribute warn_unused_result [-Wunused-result]
make[3]: *** [libvirt_driver_qemu_la-qemu_process.lo] Error 1

14 years agoChange some variable names to follow standard in daemon dispatcher
Daniel P. Berrange [Wed, 13 Apr 2011 18:10:03 +0000 (19:10 +0100)]
Change some variable names to follow standard in daemon dispatcher

Replace some occurrances of

  virDomainPtr domain;
  virNetworkPtr network;

With

  virDomainPtr dom;
  virNetworkPtr net;

* daemon/remote.c: Fix variable naming to follow standard

14 years agoWrite error check conditionals in more compact form for dispatcher
Daniel P. Berrange [Wed, 13 Apr 2011 17:50:40 +0000 (18:50 +0100)]
Write error check conditionals in more compact form for dispatcher

Replace cases of

     type = virConnectGetType(conn);
     if (type == NULL)
         goto cleanup;

With

     if (!(type = virConnectGetType(conn)))
         goto cleanup;

* daemon/remote.c: Write error checks in compat form

14 years agoRemove curly braces on all single-line conditional jumps in dispatcher
Daniel P. Berrange [Wed, 13 Apr 2011 17:23:00 +0000 (18:23 +0100)]
Remove curly braces on all single-line conditional jumps in dispatcher

Replace all occurrances of

   if (....) {
      goto cleanup;
   }

With

   if (.....)
      goto cleanup;

to save one line of code

* daemon/remote.c: Remove curly braces on single line conditionals

14 years agoFix checking of return codes in dispatcher
Daniel P. Berrange [Wed, 13 Apr 2011 17:13:37 +0000 (18:13 +0100)]
Fix checking of return codes in dispatcher

The libvirt APIs reserve any negative value for indicating an
error. Thus checks

    if (virXXXX() == -1)

Should instead be

    if (virXXXX() < 0)

* daemon/remote.c: s/ == -1/ < 0/

14 years agoMerge all returns paths from dispatcher into single path
Daniel P. Berrange [Wed, 13 Apr 2011 15:21:35 +0000 (16:21 +0100)]
Merge all returns paths from dispatcher into single path

The dispatcher functions have numerous places where they
return to the caller. This leads to duplicated cleanup
code, often resulting in memory leaks. It makes it harder
to ensure that errors are dispatched before freeing objects,
which may overwrite the original error.

The standard pattern is now

    remoteDispatchXXX(...) {
        int rv = -1;

        ....
        if (XXX < 0)
          goto cleanup;
        ...
        if (XXXX < 0)
          goto cleanup;
        ...

        rv = 0;
    cleanup:
        if (rv < 0)
           remoteDispatchError(rerr);
        ...free all other stuff..
        return rv;
    }

* daemon/remote.c: Centralize all cleanup paths
* daemon/stream.c: s/remoteDispatchConnError/remoteDispatchError/
* daemon/dispatch.c, daemon/dispatch.h: Replace
  remoteDispatchConnError with remoteDispatchError
  removing unused virConnectPtr

14 years agoExperimental libvirtd upstart job
Alan Pevec [Fri, 18 Feb 2011 18:45:49 +0000 (19:45 +0100)]
Experimental libvirtd upstart job

To install it, disable libvirtd sysv initscript:
    chkconfig libvirtd off
    service libvirtd stop

and enable libvirtd upstart job:
    cp  /usr/share/doc/libvirt-*/libvirtd.upstart \
        /etc/init/libvirtd.conf
    initctl reload-configuration
    initctl start libvirtd

Test:
    initctl status libvirtd
libvirtd start/running, process 3929
    killall -9 libvirtd
    initctl status libvirtd
libvirtd start/running, process 4047

I looked into the possibility to use the upstart script from Ubuntu or
at least getting inspiration from it but that's not possible. "expect
daemon" is a nice thing but it only works if the process is defined with
exec stanza instead of script ... no script. Unfortunately, with exec
stanza environment variables can only be set within upstart script
(i.e., configuration in /etc/sysconfig/libvirtd can't work). Hence, we
need to use script stanza, source sysconfig, and execute libvirtd
without --daemon. For similar reasons we can't use limit stanza and need
to handle DAEMON_COREFILE_LIMIT in job's script.

14 years agoenhance processWatchdogEvent()
Wen Congyang [Fri, 15 Apr 2011 03:11:39 +0000 (11:11 +0800)]
enhance processWatchdogEvent()

This patch does the following two things:
1. hold an extra reference while handling watchdog event
   If the domain is not persistent, and qemu quits unexpectedly before
   calling processWatchdogEvent(), vm will be freed and the function
   processWatchdogEvent() will be dangerous.

2. unlock qemu driver and vm before returning from processWatchdogEvent()
   When the function processWatchdogEvent() failed, we only free wdEvent,
   but forget to unlock qemu driver and vm, free dumpfile.

14 years agoqemu: avoid qemu_driver being unlocked twice when virThreadPoolNew() failed
Wen Congyang [Wed, 6 Apr 2011 07:53:11 +0000 (15:53 +0800)]
qemu: avoid qemu_driver being unlocked twice when virThreadPoolNew() failed

We do not lock qemu_driver when calling virThreadPoolNew(). If it failed,
we will unlock qemu_driver. It is dangerous.

We may use this pool during auto starting domains. So we must create it before
calling qemuAutostartDomains(). Otherwise, libvirtd will crash.

14 years agoFix two out-of-date comments in LVM backend
Richard Laager [Sun, 17 Apr 2011 06:34:10 +0000 (08:34 +0200)]
Fix two out-of-date comments in LVM backend

14 years agoxen: Replace statsErrorFunc with a macro
Matthias Bolte [Sat, 16 Apr 2011 09:30:40 +0000 (11:30 +0200)]
xen: Replace statsErrorFunc with a macro

Also mark error messages in block_stats.c for translation, add the
new macro to the msg_gen functions in cfg.mk and add block_stats.c
to po/POTFILES.in

14 years agoRemove virConnectPtr from virRaiseErrorFull
Matthias Bolte [Sat, 16 Apr 2011 08:30:22 +0000 (10:30 +0200)]
Remove virConnectPtr from virRaiseErrorFull

And from all related macros and functions.

14 years agotests: Unit tests for internal hash APIs
Jiri Denemark [Fri, 15 Apr 2011 11:15:37 +0000 (13:15 +0200)]
tests: Unit tests for internal hash APIs

This is a basic set of tests for testing removals of hash entries during
iteration.

14 years agobuild: include esx_vi.generated.* into dist file
Wen Congyang [Fri, 15 Apr 2011 03:00:35 +0000 (11:00 +0800)]
build: include esx_vi.generated.* into dist file

commit d4601696 introduces two more generated files: esx_vi.generated.h
and esx_vi.generated.h. But we do not include them into dist file.
It will break building if using dist file to build.

14 years agotests: test recent virsh option parsing changes
Eric Blake [Tue, 12 Apr 2011 21:59:19 +0000 (15:59 -0600)]
tests: test recent virsh option parsing changes

* tests/virsh-optparse: New file.
* tests/Makefile.am (test_scripts): Use it.

14 years agovirsh: fix regression in parsing optional integer
Eric Blake [Tue, 12 Apr 2011 20:42:59 +0000 (14:42 -0600)]
virsh: fix regression in parsing optional integer

Regression introduced in 0.8.5, commit c1564268.  The command
'virsh freecell 0' quit working when it changed from an optional
string to an optional integer.

This patch introduces a slight change that specifying an option
twice is now detected as an error.  It also changes things so
that a command that has more than 1 required option will not
complain about missing options if one but not all of the options
were given in long format, as in 'virsh vol-create --pool p file',
as well as making positional parsing work for all optional
options (each positional argument is associated with the earliest
option that has not yet been seen by name).

Optional boolean options can appear before required argument
options, because they don't affect positional argument parsing,
and obviously a required boolean option makes no sense.

Technically, this patch renders VSH_OT_STRING and VSH_OT_DATA
redundant; but cleaning that up can be a separate patch.

No command should ever need more than 32 options, right? :)

* tools/virsh.c (vshCmddefGetData, vshCmddefGetOption)
(vshCommandCheckOpts): Alter parameters to use bitmaps.
(vshCmddefOptParse): New function.
(vshCommandParse): Update for better handling of positional
arguments.
(vshCmddefHelp): Allow unit tests to validate options.

14 years agovirsh: list required options first
Eric Blake [Tue, 12 Apr 2011 20:58:02 +0000 (14:58 -0600)]
virsh: list required options first

The current state of virsh parsing is that:

$ virsh vol-info /path/to/image
$ virsh vol-info --pool default /path/to/image
$ virsh vol-info --pool default --vol /path/to/image

all lookup the volume by path (technically, the last two also attempt
a name lookup within a pool, whereas the first skips that step, but
the end result is the same); meanwhile:

$ virsh vol-info default /path/to/image

complains about unexpected data.  Why?  Because the --pool option is
optional, so default was parsed as the --vol argument, and
/path/to/image.img doesn't match up with any remaining options that
require an argument.  For proof, note that:

$ virsh vol-info default --vol /path/to/image

complains about looking up 'default' - the parser mis-associated both
arguments with --vol.  Given the above, the only way to specify pool
is with an explicit "--pool" argument (you can't specify it
positionally).  However, named arguments can appear in any order, so:

$ virsh vol-info /path/to/image --pool default
$ virsh vol-info --vol /path/to/image --pool default

have also always worked.  Therefore, this patch has no functional
change on vol-info option parsing, but only on 'virsh help vol-info'
synopsis layout.  However, it also allows the next patch to 1) enforce
that required options are always first (without this patch, the next
patch would fail the testsuite), and 2) allow the user to omit the
"--pool" argument.  That is, the next patch makes it possible to do:

$ virsh vol-info /path/to/image default

which to date was not possible.

* tools/virsh.c (opts_vol_create_from, opts_vol_clone)
(opts_vol_upload, opts_vol_download, opts_vol_delete)
(opts_vol_wipe, opts_vol_info, opts_vol_dumpxml, opts_vol_key)
(opts_vol_path): List optional pool parameter after required
arguments.

14 years agophyp: avoid memory leaks in command values
Eric Blake [Wed, 13 Apr 2011 20:13:33 +0000 (14:13 -0600)]
phyp: avoid memory leaks in command values

* src/phyp/phyp_driver.c (phypExecBuffer): New function. Use it
throughout file for less code, and for plugging a few leaks.

14 years agophyp: use consistent return string handling
Eric Blake [Thu, 14 Apr 2011 19:02:17 +0000 (13:02 -0600)]
phyp: use consistent return string handling

Use the name 'ret' for all phypExec results, to make it easier
to wrap phypExec.  Don't allow a possibly NULL ret through printf.

* src/phyp/phyp_driver.c (phypBuildVolume, phypDestroyStoragePool)
(phypBuildStoragePool, phypBuildLpar): Avoid NULL dereference.
(phypInterfaceDestroy): Avoid redundant free.
(phypVolumeLookupByPath, phypVolumeGetPath): Use consistent
naming.

14 years agophyp: prefer memcpy over memmove when legal
Eric Blake [Wed, 13 Apr 2011 20:59:06 +0000 (14:59 -0600)]
phyp: prefer memcpy over memmove when legal

* src/phyp/phyp_driver.c (phypUUIDTable_AddLpar)
(phypGetLparUUID, phypGetStoragePoolUUID, phypVolumeGetXMLDesc)
(phypGetStoragePoolXMLDesc): Use faster method.

14 years agophyp: use consistent style for labels
Eric Blake [Thu, 14 Apr 2011 18:53:52 +0000 (12:53 -0600)]
phyp: use consistent style for labels

* src/phyp/phyp_driver.c: Match label style of rest of project.
(phypExec, phypUUIDTable_Pull): Drop an extra label.