]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agohostdev: add virObject field to virHostdevManager struct
Jim Fehlig [Wed, 12 Mar 2014 22:57:36 +0000 (16:57 -0600)]
hostdev: add virObject field to virHostdevManager struct

Commit 6b306d66 converted virHostdevManager to a virObject, but
missed adding a virObject field to the virHostdevManager struct.
Result is memory corruption when taking a reference on an instance
of the object, where atomic inc is done on the stateDir field.
Later use of stateDir crashes libvirtd.

11 years agoqemu.conf: Mention virtlockd in @lock_manager description
Michal Privoznik [Wed, 12 Mar 2014 07:53:37 +0000 (08:53 +0100)]
qemu.conf: Mention virtlockd in @lock_manager description

When I played with virtlockd I was stunned by lacking
documentation. My frustration got bigger when I had to
read the patches to get the correct value to set in
qemu.conf.

Moreover, from pure libvirt-pride  I'm changing commented
value from sanlock to lockd. We want to favor our own
implementation after all.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agohotplug:Fix log mistake in qemuMonitorAddNetdev
Wang Rui [Thu, 13 Mar 2014 17:05:03 +0000 (17:05 +0000)]
hotplug:Fix log mistake in qemuMonitorAddNetdev

VIR_DEBUG  in qemuMonitorAddNetdev should print vhostfdSize

Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
11 years agoMake ABI stability issue easier to debug
Jiri Denemark [Wed, 12 Mar 2014 10:50:12 +0000 (11:50 +0100)]
Make ABI stability issue easier to debug

When ABI stability check fails, we only log the error message describing
the incompatibility. Let's log both XMLs in case of an error to make it
easier to analyze where and why the stability check failed.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11 years agoqemu: Forbid "sgio" support for SCSI generic host device
Osier Yang [Fri, 7 Mar 2014 14:23:26 +0000 (22:23 +0800)]
qemu: Forbid "sgio" support for SCSI generic host device

The kernel didn't support the unprivileged SGIO for SCSI generic
device finally, and since it's unknow whether the way to support
unprivileged SGIO for SCSI generic device will be similar as for
SCSI block device or not, even it's simliar (I.e. via sysfs, for
SCSI block device, it's /sys/dev/block/8\:0/queue/unpriv_sgio,
for example), the file name might be different, So it's better not
guess what it should be like currently.

This patch removes the related code (mainly about the "shareable"
checking on the "sgio" setting, it's not supported at all, why
we leave checking code there? :-), and error out if "sgio" is
specified in the domain config.

11 years agodocs: add VMmanager to web apps
Martin Kletzander [Wed, 12 Mar 2014 07:27:42 +0000 (08:27 +0100)]
docs: add VMmanager to web apps

This is a request for adding a VMmanager application as requested and
described by Ksenya Phil.

Signed-off-by: Ksenya Phil <philka2003@mail.ru>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
11 years agolibxl: Check for control_d string to decide about dom0
Stefan Bader [Wed, 12 Mar 2014 12:03:26 +0000 (13:03 +0100)]
libxl: Check for control_d string to decide about dom0

As soon as any guest mounts xenfs to /proc/xen, there is a capabilities
file in that directory. However it returns nothing when reading from it.
Change the test to actually check the contents of the file.

BugLink: http://bugs.launchpad.net/bugs/1248025
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
11 years agovircrypto: fix Invalid write in virCryptoHashString()
Nehal J Wani [Wed, 12 Mar 2014 21:44:11 +0000 (03:14 +0530)]
vircrypto: fix Invalid write in virCryptoHashString()

While running vircryptotest, it was found that valgrind pointed out the
following error:

==27453== Invalid write of size 1
==27453==    at 0x4C7D7C9: virCryptoHashString (vircrypto.c:76)
==27453==    by 0x401C4E: testCryptoHash (vircryptotest.c:41)
==27453==    by 0x402A11: virtTestRun (testutils.c:199)
==27453==    by 0x401AD5: mymain (vircryptotest.c:76)
==27453==    by 0x40318D: virtTestMain (testutils.c:782)
==27453==    by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
==27453==  Address 0x51f0541 is 0 bytes after a block of size 65 alloc'd
==27453==    at 0x4A0577B: calloc (vg_replace_malloc.c:593)
==27453==    by 0x4C69F2E: virAllocN (viralloc.c:189)
==27453==    by 0x4C7D76B: virCryptoHashString (vircrypto.c:69)
==27453==    by 0x401C4E: testCryptoHash (vircryptotest.c:41)
==27453==    by 0x402A11: virtTestRun (testutils.c:199)
==27453==    by 0x401AD5: mymain (vircryptotest.c:76)
==27453==    by 0x40318D: virtTestMain (testutils.c:782)
==27453==    by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
==27453==

...and many more.  Two observations: hashstrlen was already set
to include the trailing NUL byte (so writing to hashstrlen as
the array offset was indeed writing one byte beyond bounds), and
VIR_ALLOC_N already guarantees zero-initialization (so we already
have a trailing NUL without needing to explicitly write one).

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoFix type mismatch of virNetDev*NetConfig on non-Linux
Ján Tomko [Wed, 12 Mar 2014 17:17:39 +0000 (18:17 +0100)]
Fix type mismatch of virNetDev*NetConfig on non-Linux

Commit b4bbaee changed char* to const char*, but omitted
the non-Linux version.

11 years agoadd pci passthrough to libxl driver
Chunyan Liu [Thu, 6 Mar 2014 09:46:11 +0000 (17:46 +0800)]
add pci passthrough to libxl driver

Add pci passthrough to libxl driver, support attach-device, detach-device and
start a vm with pci hostdev specified.

11 years agoadd hostdev pci backend type for xen
Chunyan Liu [Thu, 6 Mar 2014 08:44:22 +0000 (16:44 +0800)]
add hostdev pci backend type for xen

Add VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN. For legacy xen, it will use "pciback" as
stub driver.

11 years agochange lxc_hostdev.c to use virhostdev common library APIs
Chunyan Liu [Thu, 6 Mar 2014 08:24:17 +0000 (16:24 +0800)]
change lxc_hostdev.c to use virhostdev common library APIs

11 years agoadd unit test for new virhostdev common library
Chunyan Liu [Thu, 6 Mar 2014 08:08:36 +0000 (16:08 +0800)]
add unit test for new virhostdev common library

Add unit test for hostdev common library. Current tests are based on virpcimock.

11 years agoAdd parameter checks/annotations to hostdev APIs
Chunyan Liu [Thu, 6 Mar 2014 08:02:31 +0000 (16:02 +0800)]
Add parameter checks/annotations to hostdev APIs

Mark many parameters as NONNULL and check for empty list of
hostdevs.

11 years agoadd 3 wrapper functions for prepare/reattach/update domain hostdevs
Chunyan Liu [Thu, 6 Mar 2014 07:57:03 +0000 (15:57 +0800)]
add 3 wrapper functions for prepare/reattach/update domain hostdevs

11 years agoimprove virHostdevUpdate* parameters to make it more widely used
Chunyan Liu [Thu, 6 Mar 2014 07:48:49 +0000 (15:48 +0800)]
improve virHostdevUpdate* parameters to make it more widely used

Changes parameter from vm def to specific hostdevs info and name info, so that
it could be used more widely, e.g, could be used without full vm def info.

11 years agoCapitalize USB, PCI and SCSI in hostdev variables
Daniel P. Berrange [Wed, 12 Mar 2014 16:38:18 +0000 (16:38 +0000)]
Capitalize USB, PCI and SCSI in hostdev variables

Change any variable names with Usb, Pci or Scsi to use
USB, PCI and SCSI since they are abbreviations.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove redundant duplicated 'Hostdev' string method names
Daniel P. Berrange [Wed, 12 Mar 2014 16:35:30 +0000 (16:35 +0000)]
Remove redundant duplicated 'Hostdev' string method names

Some virHostdevXXXX methods included the string Hostdev again
as a suffix. Change the latter to Device instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoCapitalize USB, PCI and SCSI in hostdev methods
Chunyan Liu [Thu, 6 Mar 2014 07:35:03 +0000 (15:35 +0800)]
Capitalize USB, PCI and SCSI in hostdev methods

Change any method names with Usb, Pci or Scsi to use
USB, PCI and SCSI since they are abbreviations.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFixed const-ness of parameters in netdev/hostdev code
Daniel P. Berrange [Wed, 12 Mar 2014 16:01:39 +0000 (16:01 +0000)]
Fixed const-ness of parameters in netdev/hostdev code

Various methods in virnetdev.c and virhostdev.c were missing
const-ness for several char * parameters.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoimprove parameter name to let it more meaningful
Chunyan Liu [Thu, 6 Mar 2014 07:24:06 +0000 (15:24 +0800)]
improve parameter name to let it more meaningful

11 years agomove virHostdevNodeDevice* to virhostdev.c
Chunyan Liu [Thu, 6 Mar 2014 07:20:14 +0000 (15:20 +0800)]
move virHostdevNodeDevice* to virhostdev.c

11 years agoextract general code of NodeDeviceReset
Chunyan Liu [Thu, 6 Mar 2014 07:14:44 +0000 (15:14 +0800)]
extract general code of NodeDeviceReset

11 years agoextract general code of NodeDeviceReAttach
Chunyan Liu [Thu, 6 Mar 2014 07:04:01 +0000 (15:04 +0800)]
extract general code of NodeDeviceReAttach

11 years agoextract general code of NodeDeviceDetach
Chunyan Liu [Thu, 6 Mar 2014 06:57:02 +0000 (14:57 +0800)]
extract general code of NodeDeviceDetach

11 years agomove virHostdevReAttachHostScsiDevices to virhostdev.c
Chunyan Liu [Thu, 6 Mar 2014 06:49:23 +0000 (14:49 +0800)]
move virHostdevReAttachHostScsiDevices to virhostdev.c

11 years agopass driver name as parameter to virHostdevReAttachScciHostdevs
Chunyan Liu [Thu, 6 Mar 2014 06:47:56 +0000 (14:47 +0800)]
pass driver name as parameter to virHostdevReAttachScciHostdevs

11 years agoextract general code from qemuDomainReAttachHostScsiDevices
Chunyan Liu [Thu, 6 Mar 2014 06:45:23 +0000 (14:45 +0800)]
extract general code from qemuDomainReAttachHostScsiDevices

Extract general code from qemuDomainReAttachHostScsiDevices to
virHostdevDomainReAttachHostScsiDevices.

11 years agomove virHostdevReAttachUsbHostdevs to virhostdev.c
Chunyan Liu [Thu, 6 Mar 2014 06:37:30 +0000 (14:37 +0800)]
move virHostdevReAttachUsbHostdevs to virhostdev.c

11 years agopass driver name as paramter to virHostdevReAttachUsbHostdevs
Chunyan Liu [Thu, 6 Mar 2014 06:33:29 +0000 (14:33 +0800)]
pass driver name as paramter to virHostdevReAttachUsbHostdevs

11 years agoextract general code from qemuDomainReAttachHostUsbDevices
Chunyan Liu [Thu, 6 Mar 2014 06:28:07 +0000 (14:28 +0800)]
extract general code from qemuDomainReAttachHostUsbDevices

Extract general code from qemuDomainReAttachHostUsbDevices to
virHostdevDomainReAttachHostUsbDevices.

11 years agomove virHostdevPrepareHostSCSIDevices to virhostdev.c
Chunyan Liu [Thu, 6 Mar 2014 06:19:11 +0000 (14:19 +0800)]
move virHostdevPrepareHostSCSIDevices to virhostdev.c

11 years agopass driver name as parameter to virHostdevPrepareSCSIDevices
Chunyan Liu [Thu, 6 Mar 2014 06:12:52 +0000 (14:12 +0800)]
pass driver name as parameter to virHostdevPrepareSCSIDevices

11 years agoextract general code from qemuPrepareHostSCSIDevices
Chunyan Liu [Thu, 6 Mar 2014 06:05:22 +0000 (14:05 +0800)]
extract general code from qemuPrepareHostSCSIDevices

Extract general code from qemuPrepareHostSCSIDevices to
virHostdevPrepareHostSCSIDevices.

11 years agomove virHostdevPrepareHostUSBDevices to virhostdev.c
Chunyan Liu [Thu, 6 Mar 2014 05:53:56 +0000 (13:53 +0800)]
move virHostdevPrepareHostUSBDevices to virhostdev.c

11 years agopass driver name to virHostdevPrepareUSBDevices
Chunyan Liu [Thu, 6 Mar 2014 05:42:19 +0000 (13:42 +0800)]
pass driver name to virHostdevPrepareUSBDevices

11 years agorename qemu*USBDevices to virHostdev*USBDevices
Chunyan Liu [Thu, 6 Mar 2014 05:38:23 +0000 (13:38 +0800)]
rename qemu*USBDevices to virHostdev*USBDevices

11 years agoextract general code from qemuPrepareHostUSBDevices
Chunyan Liu [Thu, 6 Mar 2014 05:31:47 +0000 (13:31 +0800)]
extract general code from qemuPrepareHostUSBDevices

Extract general code from qemuPrepareHostUSBDevices to
virHostdevPrepareHostUSBDevices.

11 years agomove virHostdevUpdate* functions to virhostdev.c
Chunyan Liu [Thu, 6 Mar 2014 05:13:00 +0000 (13:13 +0800)]
move virHostdevUpdate* functions to virhostdev.c

11 years agopass driver_name as parameter of virHostdevUpdate*Hostdevs functions
Chunyan Liu [Thu, 6 Mar 2014 04:59:29 +0000 (12:59 +0800)]
pass driver_name as parameter of virHostdevUpdate*Hostdevs functions

11 years agoextract general code from qemuUpdateActiveScsiHostdevs
Chunyan Liu [Thu, 6 Mar 2014 04:47:50 +0000 (12:47 +0800)]
extract general code from qemuUpdateActiveScsiHostdevs

Extract general code from qemuUpdateActiveScsiHostdevs to
virHostdevUpdateActiveScsiHostdevs

11 years agoextract general code from qemuUpdateActiveUsbHostdevs
Chunyan Liu [Thu, 6 Mar 2014 04:45:16 +0000 (12:45 +0800)]
extract general code from qemuUpdateActiveUsbHostdevs

Extract general code from qemuUpdateActiveUsbHostdevs to
virHostdevUpdateActiveUsbHostdevs.

11 years agoextract general code from qemuUpdateActivePciHostdevs
Chunyan Liu [Thu, 6 Mar 2014 04:32:42 +0000 (12:32 +0800)]
extract general code from qemuUpdateActivePciHostdevs

Extract general code from qemuUpdateActivePciHostdevs to
virHostdevUpdateActivePciHostdevs.

11 years agomove virHostdevPrepare(ReAttach)PCIDevices to virhostdev.c
Chunyan Liu [Wed, 5 Mar 2014 12:14:38 +0000 (20:14 +0800)]
move virHostdevPrepare(ReAttach)PCIDevices to virhostdev.c

11 years agorename qemuReAttachPciDevice to virHostdevReAttachPciDevice
Daniel P. Berrange [Wed, 12 Mar 2014 15:51:31 +0000 (15:51 +0000)]
rename qemuReAttachPciDevice to virHostdevReAttachPciDevice

Signed-off-by: Chunyan Liu <cyliu@suse.com>
11 years agoConditionally wait for kvm_assigned_device cleanup
Chunyan Liu [Wed, 5 Mar 2014 11:56:17 +0000 (19:56 +0800)]
Conditionally wait for kvm_assigned_device cleanup

Only wait for kvm device cleanup if the driver is pci-stub

11 years agopass driver name as a parameter to virHostdevReAttachPCIDevices
Chunyan Liu [Wed, 5 Mar 2014 11:55:45 +0000 (19:55 +0800)]
pass driver name as a parameter to virHostdevReAttachPCIDevices

11 years agoextract general code from qemuDomainReAttachHostdevDevices
Chunyan Liu [Wed, 5 Mar 2014 11:53:51 +0000 (19:53 +0800)]
extract general code from qemuDomainReAttachHostdevDevices

11 years agopass driver name as a parameter to virHostdevPrepareHostdevPCIDevices
Chunyan Liu [Wed, 5 Mar 2014 11:47:40 +0000 (19:47 +0800)]
pass driver name as a parameter to virHostdevPrepareHostdevPCIDevices

11 years agorename qemuGet*PciHostDeviceList to virHostdevGet*PciHostDeviceList
Chunyan Liu [Wed, 5 Mar 2014 11:47:10 +0000 (19:47 +0800)]
rename qemuGet*PciHostDeviceList to virHostdevGet*PciHostDeviceList

11 years agorename qemu*NetConfigRestore/Replace to virHostdevNetConfigRestore/Replace
Chunyan Liu [Wed, 5 Mar 2014 11:46:22 +0000 (19:46 +0800)]
rename qemu*NetConfigRestore/Replace to virHostdevNetConfigRestore/Replace

11 years agoextract general code from qemuPrepareHostdevPCIDevices
Chunyan Liu [Wed, 5 Mar 2014 11:37:51 +0000 (19:37 +0800)]
extract general code from qemuPrepareHostdevPCIDevices

Extract general code from qemuPrepareHostdevPCIDevices to
virHostdevPrepareHostdevPCIDevices.

11 years agoqemu_hostdev: move netconfig file location to virhostdev stateDir
Chunyan Liu [Wed, 5 Mar 2014 11:15:59 +0000 (19:15 +0800)]
qemu_hostdev: move netconfig file location to virhostdev stateDir

11 years agoqemu_hostdev: move ColdBoot as a flag
Chunyan Liu [Wed, 5 Mar 2014 11:12:04 +0000 (19:12 +0800)]
qemu_hostdev: move ColdBoot as a flag

For extracting hostdev codes from qemu_hostdev.c to common library, change qemu
specific COLD_BOOT handling to be a flag, and pass it to hostdev functions.

11 years agoqemu_hostdev: move cfg->relaxedACS as a flag
Chunyan Liu [Wed, 5 Mar 2014 10:56:26 +0000 (18:56 +0800)]
qemu_hostdev: move cfg->relaxedACS as a flag

For extracting hostdev codes from qemu_hostdev.c to common library, change qemu
specific cfg->relaxedACS handling to be a flag, and pass it to hostdev
functions.

11 years agolxc: use general virhostdev lists instead of its own
Chunyan Liu [Wed, 5 Mar 2014 10:49:58 +0000 (18:49 +0800)]
lxc: use general virhostdev lists instead of its own

11 years agoqemu: use general virhostdev lists instead of its own
Chunyan Liu [Wed, 5 Mar 2014 09:58:54 +0000 (17:58 +0800)]
qemu: use general virhostdev lists instead of its own

11 years agoqemu: remove functions used internally only from qemu_hostdev.h
Chunyan Liu [Wed, 5 Mar 2014 06:46:40 +0000 (14:46 +0800)]
qemu: remove functions used internally only from qemu_hostdev.h

11 years agoqemu: reuse hostdev interfaces to avoid duplicate
Chunyan Liu [Wed, 5 Mar 2014 06:33:30 +0000 (14:33 +0800)]
qemu: reuse hostdev interfaces to avoid duplicate

Same logic of preparing/reattaching hostdevs could be used in attach/detach
hotplug places, so reuse hostdev interfaces to avoid duplicate, also for later
extracting general code to common library.

11 years agoupdate qemuPrepareHostUSBDevices parameters to keep consistency
Chunyan Liu [Wed, 5 Mar 2014 06:20:50 +0000 (14:20 +0800)]
update qemuPrepareHostUSBDevices parameters to keep consistency

Update parameters from vm->def to specific name, hostdevs, nhostdevs to keep
consistentcy with PreparePCIDevices and PrepareSCSIDevices. And, at the same
time, make it reusable in later patch.

11 years agovirhostdev: use virObject to virHostdevManager to keep reference
Chunyan Liu [Thu, 6 Mar 2014 04:14:21 +0000 (12:14 +0800)]
virhostdev: use virObject to virHostdevManager to keep reference

Use virObject to virHostdevManager, so that each driver using virHostdevManager
can keep a reference to it, and through counting refs to make virHostdevManager
get freed.

11 years agoLoad CPU map from builddir when run uninstalled
Jiri Denemark [Mon, 10 Mar 2014 15:00:49 +0000 (16:00 +0100)]
Load CPU map from builddir when run uninstalled

When libvirtd is run from a build directory without being installed, it
should not depend on files from a libvirt package installed in the
system. Not only because there may not be any libvirt installed at all.
We already do a good job for plugins but cpu_map.xml was still loaded
from the system.

The Makefile.am change is necessary to make this all work from VPATH
builds since libvirtd has no idea where to find libvirt sources. It only
knows the path from which it was started, i.e, a builddir.

https://bugzilla.redhat.com/show_bug.cgi?id=1074327
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11 years agoIntroduce vircommandpriv.h for functions used by tests
Ján Tomko [Tue, 11 Mar 2014 10:59:58 +0000 (11:59 +0100)]
Introduce vircommandpriv.h for functions used by tests

So far it's just virCommandSetDryRun.

11 years agoUse size_t for ndevice in pool source definition
Ján Tomko [Tue, 11 Mar 2014 08:13:15 +0000 (09:13 +0100)]
Use size_t for ndevice in pool source definition

This allows it to be used by the VIR_*_ELEMENT macros.

Also use them for parsing the definiton and remove the redundant
freeing of 'nodeset' before jumping to the cleanup label.

11 years agoIntroduce virStoragePoolSourceDeviceClear
Ján Tomko [Tue, 11 Mar 2014 07:44:22 +0000 (08:44 +0100)]
Introduce virStoragePoolSourceDeviceClear

Open-coding one VIR_FREE in the test suite just doesn't seem right.

11 years agoChange virStorageBackendISCSISession 'probe' arg to bool
Ján Tomko [Tue, 11 Mar 2014 11:58:35 +0000 (12:58 +0100)]
Change virStorageBackendISCSISession 'probe' arg to bool

It quacks like a bool.

11 years agonwfilter: Add missing goto err_exit in error path
Stefan Berger [Wed, 12 Mar 2014 14:35:13 +0000 (10:35 -0400)]
nwfilter: Add missing goto err_exit in error path

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

Add a missing goto err_exit in the error path where an unsupported
value is assigned to the CTRL_IP_LEARNING key.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
11 years agoFix sec label setup when attaching to QEMU processes
Daniel P. Berrange [Tue, 11 Mar 2014 15:14:26 +0000 (15:14 +0000)]
Fix sec label setup when attaching to QEMU processes

When attaching to a QEMU process, the def->seclabels array is
going to be empty. The qemuProcessAttach method must thus
populate it with data for the security drivers.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoqemu: don't munge user input during block commit
Eric Blake [Thu, 6 Mar 2014 23:33:16 +0000 (16:33 -0700)]
qemu: don't munge user input during block commit

While investigating https://bugzilla.redhat.com/show_bug.cgi?id=1061827
I noticed that we pass user input unscathed for block-pull, but
always pass a canonical absolute name through for block-commit.
[Note that we probably _ought_ to validate that the user's request
for block-pull actually matches the backing chain, the way we already
do for block-commit - but that's a separate issue.  Further note that
the ability to pass user input through unscathed allows backdoors
such as specifying a backing image that is a network URI such as
a gluster disk, instead of forcing things to the local file system;
which is an area still under active investigation on whether libvirt
needs to behave differently for network disks.]

Since qemu may write the name that the user passed in as the backing
file, a user may have a reason to want a relative file name passed
through to qemu, and always munging things to absolute prevents that.

Put another way, if you have the backing chain:

[A] <- [B(back=./A)] <- [C(back=./B)]

and commit B into A (virsh blockcommit $dom vda --base A --top B),
the metadata of C will have to be re-written. But should it be
rewritten as [C(back=./A)] or as [C(back=/path/to/A)]?  Still up in
the air is whether qemu's decision should be based on whether B
and/or C had relative paths, or on whether the --base and/or
--top arguments to the command were relative paths; but if we always
pass a canonical name, we've prevented the spelling of the command
arguments from being part of the hueristics that qemu uses.

I also audited the code, and verified that we never call
qemuMonitorBlockCommit() with a NULL base, either before or after
the change to qemu_driver.c.

* src/qemu/qemu_driver.c (qemuDomainBlockCommit): Preserve user's
spelling, since absolute vs. relative matters to qemu.
* src/qemu/qemu_monitor.h (qemuMonitorBlockCommit): Base is never
null.
* src/qemu/qemu_monitor.c (qemuMonitorBlockCommit): Likewise.
* src/qemu/qemu_monitor_json.h (qemuMonitorJSONBlockCommit):
Likewise.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockCommit):
Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoiptables: don't log command probe failures
Eric Blake [Mon, 10 Mar 2014 21:56:44 +0000 (15:56 -0600)]
iptables: don't log command probe failures

Commit b9dd878f caused a regression in iptables interaction by
logging non-zero status at a higher level than VIR_INFO.  Revert
that portion of the commit, as well as adding a comment explaining
why we check the status ourselves.

Reported by Nehal J Wani.

* src/util/viriptables.c (virIpTablesOnceInit): Undo log regression.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agolibxl: support sexpr in native to XML conversion
Jim Fehlig [Fri, 7 Mar 2014 17:31:45 +0000 (10:31 -0700)]
libxl: support sexpr in native to XML conversion

Supporting sexpr in connectDomainXMLFromNative in the libxl driver
adds flexibility for users importing legacy Xen configuration into
libvirt.  E.g. this patch allows importing previous xend-managed
domains from /var/lib/xend/domains/<dom-uuid>/config.sxp into the
libvirt libxl driver.

11 years agostorage: Fix bugs in VIR_APPEND_ELEMENT series
John Ferlan [Tue, 11 Mar 2014 19:26:14 +0000 (15:26 -0400)]
storage: Fix bugs in VIR_APPEND_ELEMENT series

From commit id 'd53bbfd1'

Found one core and one possible memory leak. Core seen during local
virt-test/tp_libvirt run for the vol_create_from test. The memory leak
was seen by inspection during a review of all VIR_APPEND_ELEMENT changes

In storage_backend_disk/virStorageBackendDiskMakeDataVol(), the 'vol'
needs to be kept around since it's used later, so use the _COPY macro.
This caused a segv in libvirtd:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe87c3700 (LWP 6919)]
virStorageBackendDiskMakeDataVol (vol=0x0, groups=0x7fffc8000d70, pool=0x7fffc8002460) at storage/storage_backend_disk.c:66
66          if (vol->target.path == NULL) {

In storage_backend_rbd/virStorageBackendRBDRefreshPool() there's a failure
path where the 'vol' needs to go through virStorageVolDefFree() since it
wouldn't be appended.

11 years agoRemove broken error reporting in QEMU mac filtering
Daniel P. Berrange [Fri, 7 Mar 2014 17:34:54 +0000 (17:34 +0000)]
Remove broken error reporting in QEMU mac filtering

The qemu_bridge_filter.c file had some helpers for calling
the ebtablesXXX functions todo bridge filtering. The only
thing these helpers did was to overwrite the original error
message from the ebtables code. For added fun, the callers
of these helpers overwrote the errors yet again. For even
more fun, one of the helpers called another helper and
overwrite its errors too.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove unused ebtablesRemoveForwardPolicyReject method
Daniel P. Berrange [Fri, 7 Mar 2014 17:07:33 +0000 (17:07 +0000)]
Remove unused ebtablesRemoveForwardPolicyReject method

The ebtablesRemoveForwardPolicyReject method was unused and
would not do anything useful even if called.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove worthless ebtRules data structure
Daniel P. Berrange [Fri, 7 Mar 2014 17:03:51 +0000 (17:03 +0000)]
Remove worthless ebtRules data structure

The ebtRules data structure serves no useful purpose as
the table name is never used and only 1 single chain name
needs to be stored. Just store the chain name directly
in the ebtablesContext instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove data structure holding list of ebtables rules
Daniel P. Berrange [Fri, 7 Mar 2014 16:56:56 +0000 (16:56 +0000)]
Remove data structure holding list of ebtables rules

When adding/removing ebtables rules, the code would keep
an array of all rules in memory. This list of rules was
never used for any purpose and would be lost if libvirtd
restarted. Delete all the unused code.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove unused variables from ebtablesContext
Daniel P. Berrange [Fri, 7 Mar 2014 16:54:28 +0000 (16:54 +0000)]
Remove unused variables from ebtablesContext

The input_filter and nat_postrouting variables were never
used to create any firewall rules.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoMake ebtablesForwardPolicyReject static
Daniel P. Berrange [Fri, 7 Mar 2014 16:53:21 +0000 (16:53 +0000)]
Make ebtablesForwardPolicyReject static

The ebtablesForwardPolicyReject method is only used internally
to the ebtables code and thus should have been static.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove decl of method which doesn't exist in virebtables.h
Daniel P. Berrange [Fri, 7 Mar 2014 16:51:54 +0000 (16:51 +0000)]
Remove decl of method which doesn't exist in virebtables.h

There is no impl of the ebtablesSaveRules method and nothing
attempts to use it.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove many decls from bridge driver platform header
Daniel P. Berrange [Thu, 6 Mar 2014 12:03:46 +0000 (12:03 +0000)]
Remove many decls from bridge driver platform header

The bridge_driver_platform.h defines many functions that
a platform driver must implement. Only two of these
functions are actually called from the main bridge driver
code. The remainder can be made internal to the linux
driver only.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoCache result of QEMU capabilities extraction
Daniel P. Berrange [Wed, 5 Mar 2014 16:51:59 +0000 (16:51 +0000)]
Cache result of QEMU capabilities extraction

Extracting capabilities from QEMU takes a notable amount of time
when all QEMU binaries are installed. Each system emulator
needs about 200-300ms multiplied by 26 binaries == ~5-8 seconds.

This change causes the QEMU driver to save an XML file containing
the content of the virQEMUCaps object instance in the cache
dir eg /var/cache/libvirt/qemu/capabilities/$SHA256(binarypath).xml
or $HOME/.cache/libvirt/qemu/cache/capabilities/$SHA256(binarypath).xml

We attempt to load this and only if it fails, do we fallback to
probing the QEMU binary. The ctime of the QEMU binary and libvirtd
are stored in the cached file and its data discarded if either
of them change.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoChange QEMU capabilities cache to check ctime instead of mtime
Daniel P. Berrange [Mon, 10 Mar 2014 15:50:19 +0000 (15:50 +0000)]
Change QEMU capabilities cache to check ctime instead of mtime

Debian's package manager will preserve mtime timestamp on binaries
from the time they are built, rather than installed. So if a
user downgrades their QEMU dpkg, the libvirt capabilities
cache will not refresh. The fix is to use ctime instead of mtime
since it cannot be faked.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd helper APIs to track if libvirtd or loadable modules have changed
Daniel P. Berrange [Wed, 5 Mar 2014 17:20:50 +0000 (17:20 +0000)]
Add helper APIs to track if libvirtd or loadable modules have changed

The future QEMU capabilities cache needs to be able to invalidate
itself if the libvirtd binary or any loadable modules are changed
on disk. Record the 'ctime' value for these binaries and provide
helper APIs to query it. This approach assumes that if libvirt.so
is changed, then libvirtd will also change, which should usually
be the case with libtool's wrapper scripts that cause libvirtd to
get re-linked

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agovirSecurityDACSetSecurityImageLabel: Unmark @def as unused
Michal Privoznik [Mon, 10 Mar 2014 16:47:06 +0000 (17:47 +0100)]
virSecurityDACSetSecurityImageLabel: Unmark @def as unused

The @def is clearly used just a few lines below. There's no need to use
ATTRIBUTE_UNUSED for it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agotests: Distribute securityselinuxhelperdata
Jiri Denemark [Tue, 11 Mar 2014 10:05:56 +0000 (11:05 +0100)]
tests: Distribute securityselinuxhelperdata

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11 years agoBZ1072677: Avoid freeing of 0 file descriptor
Stefan Berger [Mon, 10 Mar 2014 22:47:19 +0000 (18:47 -0400)]
BZ1072677: Avoid freeing of 0 file descriptor

Avoid the freeing of an array of zero file descriptors in case
of error. Initialize the array to -1 using memset.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
11 years agoConvert lock driver plugins to use new crypto APIs
Daniel P. Berrange [Wed, 5 Mar 2014 12:39:00 +0000 (12:39 +0000)]
Convert lock driver plugins to use new crypto APIs

Convert the sanlock and lockd lock driver plugins over to use
the new virCryptoHashString APIs instead of having their own
duplicated code.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd helper APIs for generating cryptographic hashes
Daniel P. Berrange [Wed, 5 Mar 2014 12:34:10 +0000 (12:34 +0000)]
Add helper APIs for generating cryptographic hashes

GNULIB provides APIs for calculating md5 and sha256 hashes,
but these APIs only return you raw byte arrays. Most users
in libvirt want the hash in printable string format. Add
some helper APIs in util/vircrypto.{c,h} for doing this.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoChange file names in comments to match the files they are in
Ján Tomko [Fri, 7 Mar 2014 13:38:51 +0000 (14:38 +0100)]
Change file names in comments to match the files they are in

Some of these are leftovers from renaming the files, others
are just typos.

Also introduce an ugly awk script to enforce this.

11 years agoWildcard ignore tests/*test instead of listing every one
Daniel P. Berrange [Fri, 7 Mar 2014 11:50:36 +0000 (11:50 +0000)]
Wildcard ignore tests/*test instead of listing every one

There is a forever growing list of test cases. It is just
not worth listing each one individually when a wildcard
can do the job.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agosrc/xenxs: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Michal Privoznik [Fri, 7 Mar 2014 08:33:31 +0000 (09:33 +0100)]
src/xenxs: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agosrc/xen: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Michal Privoznik [Fri, 7 Mar 2014 08:33:31 +0000 (09:33 +0100)]
src/xen: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agosrc/util: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Michal Privoznik [Fri, 7 Mar 2014 08:33:31 +0000 (09:33 +0100)]
src/util: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agosrc/test: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Michal Privoznik [Fri, 7 Mar 2014 08:33:31 +0000 (09:33 +0100)]
src/test: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agosrc/storage: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Michal Privoznik [Fri, 7 Mar 2014 08:33:31 +0000 (09:33 +0100)]
src/storage: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agosrc/rpc: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Michal Privoznik [Fri, 7 Mar 2014 08:33:31 +0000 (09:33 +0100)]
src/rpc: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agosrc/qemu: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Michal Privoznik [Fri, 7 Mar 2014 08:33:31 +0000 (09:33 +0100)]
src/qemu: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agosrc/phyp: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Michal Privoznik [Fri, 7 Mar 2014 08:33:31 +0000 (09:33 +0100)]
src/phyp: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agosrc/parallels: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Michal Privoznik [Fri, 7 Mar 2014 08:33:31 +0000 (09:33 +0100)]
src/parallels: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agosrc/openvz: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Michal Privoznik [Fri, 7 Mar 2014 08:33:31 +0000 (09:33 +0100)]
src/openvz: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>