]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agotools: Include PIE_LDFLAGS at the correct place
Michal Privoznik [Sun, 20 Dec 2015 08:01:02 +0000 (09:01 +0100)]
tools: Include PIE_LDFLAGS at the correct place

This is no functional change, but I find it disturbing that
something_LDADD contains PIE_LDFLAGS while something_LDFLAGS
doesn't.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agosysconf: Include unistd.h
Michal Privoznik [Sun, 20 Dec 2015 07:27:21 +0000 (08:27 +0100)]
sysconf: Include unistd.h

The manpage for sysconf() suggest including unistd.h as the
function is declared there. Even though we are not hitting any
compile issues currently, let's include the correct header file
instead of relying on some hidden include chain.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirStorageVolWipe: Document that wiping journaled FS is useless
Michal Privoznik [Thu, 17 Dec 2015 10:06:51 +0000 (11:06 +0100)]
virStorageVolWipe: Document that wiping journaled FS is useless

So you have a libvirt volume that you want to wipe out. But lets
say that the volume is actually a file stored on a journaled
filesystem. Overwriting it with zeroes or a pattern does not mean
that corresponding physical location on the disk is overwritten
too, due to journaling. It's the same story with network based
volumes, copy-on-write filesystems, and so on. Since there is no
way that an userland application can write onto specific areas on
disk, all that we can do is document the fact.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovz: BUG: fix connecting hang in case of init failure
Maxim Nestratov [Thu, 24 Dec 2015 12:58:59 +0000 (15:58 +0300)]
vz: BUG: fix connecting hang in case of init failure

In case of prlsdkLoadDomains fails, vzOpenDefault should
clear connection privateData pointer every time its
memory is actually freed.
Also it is not necessary to call vzConnectClose if a call
to vzOpenDefault fails, because they both make cleanup of
connection privateData.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
9 years agoqemu: Process new 'append' attribute for char dev with output to a file
Dmitry Mishin [Thu, 24 Dec 2015 14:27:55 +0000 (17:27 +0300)]
qemu: Process new 'append' attribute for char dev with output to a file

By default, QEMU truncates serial file on open. Sometimes, it could be weird -
for example, when we are trying to investigate some event, which occured several
restarts ago. This patch adds an ability to preserve previous content.

Signed-off-by: Dmitry Mishin <dim@virtuozzo.com>
9 years agoconf: Add new 'append' attribute for chardevs with file source
Dmitry Mishin [Thu, 24 Dec 2015 14:27:54 +0000 (17:27 +0300)]
conf: Add new 'append' attribute for chardevs with file source

Currently, there is no possibility for user to specify desired behaviour of
output to file - truncate or append. This patch adds an ability to explicitly
specify that user wants to preserve file's content on reopen.

Signed-off-by: Dmitry Mishin <dim@virtuozzo.com>
9 years agotests: add qemu 2.6 caps test
Dmitry Mishin [Thu, 24 Dec 2015 14:27:53 +0000 (17:27 +0300)]
tests: add qemu 2.6 caps test

Signed-off-by: Dmitry Mishin <dim@virtuozzo.com>
9 years agovz: support additional flags in domain undefine
Maxim Nestratov [Tue, 22 Dec 2015 15:29:40 +0000 (18:29 +0300)]
vz: support additional flags in domain undefine

Implement VIR_DOMAIN_UNDEFINE_MANAGED_SAVE and
VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA flags support.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
9 years agovz: move prlsdkCleanupBridgedNet after domain deletion
Maxim Nestratov [Tue, 22 Dec 2015 15:29:39 +0000 (18:29 +0300)]
vz: move prlsdkCleanupBridgedNet after domain deletion

prlsdkCleanupBridgedNet call should be made strongly after
any actual domain deletion accurs. By doing this we avoid
any potential problems connected with second undefine call
when it is made after first one fails by some reason, and
we detect that network is already deleted.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
9 years agovz: delete domains when undefine is called
Maxim Nestratov [Tue, 22 Dec 2015 15:29:38 +0000 (18:29 +0300)]
vz: delete domains when undefine is called

Currently vz driver unregisters domains when undefine is called,
which is wrong because it contradicts with expected behavior.
All vz domains are persistent, which means that when one is
defined a new bundle directory containing meta data is created.
Undefining domains in a way we do now leaves those directories
undeleted, which prevents subsequent define call for the same
domain xml. I.e. the following sequence define->undefine->define
doesn't work now.
The patch fixes the problem by calling PrlVm_Delete instead of
PrlVm_Unreg detaching all disks prior actually doing this to
prevent images deletion.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
9 years agohostdev: Emit debug messages while handling PCI hostdevs
Andrea Bolognani [Wed, 16 Dec 2015 15:32:37 +0000 (16:32 +0100)]
hostdev: Emit debug messages while handling PCI hostdevs

Both detach and reattach are complex operations involving several steps,
and it can be useful to be able to follow along by reading the log.

9 years agohostdev: Only rollback detach of managed devices on error
Andrea Bolognani [Thu, 17 Dec 2015 14:11:27 +0000 (15:11 +0100)]
hostdev: Only rollback detach of managed devices on error

Since we don't detach unmanaged devices before attaching them to a
domain, we shouldn't reattach them to rollback an error either.

9 years agohostdev: Mark PCI devices as inactive as they're detached
Andrea Bolognani [Thu, 17 Dec 2015 10:54:14 +0000 (11:54 +0100)]
hostdev: Mark PCI devices as inactive as they're detached

We want to eventually factor out the code dealing with device detaching
and reattaching, so that we can share it and make sure it's called eg.
when 'virsh nodedev-detach' is used.

For that to happen, it's important that the lists of active and inactive
PCI devices are updated every time a device changes its state.

Instead of passing NULL as the last argument of virPCIDeviceDetach() and
virPCIDeviceReattach(), pass the proper list so that it can be updated.

9 years agopci: Introduce virPCIStubDriver enumeration
Andrea Bolognani [Fri, 23 Oct 2015 09:54:07 +0000 (11:54 +0200)]
pci: Introduce virPCIStubDriver enumeration

This replaces the virPCIKnownStubs string array that was used
internally for stub driver validation.

Advantages:

  * possible values are well-defined
  * typos in driver names will be detected at compile time
  * avoids having several copies of the same string around
  * no error checking required when setting / getting value

The names used mirror those in the
virDomainHostdevSubsysPCIBackendType enumeration.

9 years agopci: Remove 'reprobe' parameter from virPCIDeviceUnbind()
Andrea Bolognani [Thu, 29 Oct 2015 15:09:54 +0000 (16:09 +0100)]
pci: Remove 'reprobe' parameter from virPCIDeviceUnbind()

The value is not inspected inside the function, so it makes more
sense for the caller to change the device's setting explicitly.

9 years agopci: Remove redundant parameter from virPCIDeviceBindToStub()
Andrea Bolognani [Thu, 22 Oct 2015 16:15:11 +0000 (18:15 +0200)]
pci: Remove redundant parameter from virPCIDeviceBindToStub()

This internal function supports, in theory, binding to a different
stub driver than the one the PCI device has been configured to use.

In practice, it is only ever called like

  virPCIDeviceBindToStub(dev, dev->stubDriver);

which makes its second parameter redundant. Get rid of it, along
with the extra string copy required to support it.

9 years agoRevert "admin: Rename virAdmConnect to virAdmDaemon"
Erik Skultety [Thu, 10 Dec 2015 12:46:45 +0000 (13:46 +0100)]
Revert "admin: Rename virAdmConnect to virAdmDaemon"

Commmit df8192aa introduced admin related rename and some minor
(caused by automated approach, aka sed) and some more severe isues along with
it. First reason to revert is the inconsistency with libvirt library.
Although we deal with the daemon directly rather than with a specific
hypervisor, we still do have a connection. That being said, contributors might
get under the impression that AdmDaemonNew would spawn/start a new daemon
(since it's admin API, why not...), or AdmDaemonClose would do the exact
opposite or they might expect DaemonIsAlive report overall status of the daemon
which definitely isn't the case.
The second reason to revert this patch is renaming virt-admin client. The
client tool does not necessarily have to reflect the names of the API's it's
using in his internals. An example would be 's/vshAdmConnect/vshAdmDaemon'
where noone can be certain of what the latter function really does. The former
is quite expressive about some connection magic it performs, but the latter does
not say anything, especially when vshAdmReconnect and vshAdmDisconnect were
left untouched.

9 years agoXen: support maxvcpus in xm and xl config
Jim Fehlig [Tue, 15 Dec 2015 21:47:40 +0000 (14:47 -0700)]
Xen: support maxvcpus in xm and xl config

From: Ian Campbell <ian.campbell@citrix.com>

xend prior to 4.0 understands vcpus as maxvcpus and vcpu_avail
as a bit map of which cpus are online (default is all).

xend from 4.0 onwards understands maxvcpus as maxvcpus and
vcpus as the number which are online (from 0..N-1). The
upstream commit (68a94cf528e6 "xm: Add maxvcpus support")
claims that if maxvcpus is omitted then the old behaviour
(i.e. obeying vcpu_avail) is retained, but AFAICT it was not,
in this case vcpu==maxcpus==online cpus. This is good for us
because handling anything else would be fiddly.

This patch changes parsing of the virDomainDef maxvcpus and vcpus
entries to use the corresponding 'maxvcpus' and 'vcpus' settings
from xm and xl config. It also drops use of the old Xen 3.x
'vcpu_avail' setting.

The change also removes the maxvcpus limit of MAX_VIRT_VCPUS (since
maxvcpus is simply a count, not a bit mask), which is particularly
crucial on ARM where MAX_VIRT_CPUS == 1 (since all guests are
expected to support vcpu placement, and therefore only the boot
vcpu's info lives in the shared info page).

Existing tests adjusted accordingly, and new tests added for the
'maxvcpus' setting.

9 years agovirsh: Add --delete-snapshots flag for undefine and vol-delete
John Ferlan [Wed, 2 Dec 2015 23:04:04 +0000 (18:04 -0500)]
virsh: Add --delete-snapshots flag for undefine and vol-delete

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

Commit id '3c7590e0a' added the flag to the rbd backend, but provided
no means via virsh to use the flag.  This patch adds a '--delete-snapshots'
option to both the "undefine" and "vol-delete" commands.

For "undefine", the flag is combined with the "--remove-all-storage" flag
in order to add the appropriate flag for the virStorageVolDelete call;
whereas, for the "vol-delete" command, just the flag is sufficient since
it's only operating on one volume.

Currently only supported for rbd backends.

9 years agolibvirt: Add virStorageVolDeleteFlags to virStorageVolDelete
John Ferlan [Wed, 2 Dec 2015 22:00:46 +0000 (17:00 -0500)]
libvirt: Add virStorageVolDeleteFlags to virStorageVolDelete

Although they've been present for quite a while, they weren't added
to the API definition, so add them there to make it clearer.

Currently only the RBD backend even checks for any flags.

9 years agostorage: Add virCheckFlags to virStorageBackendRBDDeleteVol
John Ferlan [Wed, 2 Dec 2015 21:38:50 +0000 (16:38 -0500)]
storage: Add virCheckFlags to virStorageBackendRBDDeleteVol

The initial commit '74951eade' did not include the proper check for whether
any flags are supported by the driver.

Even though the driver doesn't support VIR_STORAGE_VOL_DELETE_ZEROED,
it still checks and allows the processing to continue

Also add the new VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS since it is handled
as of commit id '3c7590e0a'.

9 years agolxc_cgroup: Add check for NULL cgroup before AddTask call
John Ferlan [Fri, 18 Dec 2015 13:25:47 +0000 (08:25 -0500)]
lxc_cgroup: Add check for NULL cgroup before AddTask call

Commit id '71ce4759' altered the cgroup processing with respect to the
call to virCgroupAddTask being moved out from lower layers into the calling
layers especially for qemu processing of emulator and vcpu threads. The
movement affected lxc insomuch as it is possible for a code path to
return a NULL cgroup *and* a 0 return status via virCgroupNewPartition
failure when virCgroupNewIgnoreError succeeded when virCgroupNewMachineManual
returns. Coverity pointed out that would cause virCgroupAddTask to core.

This patch will check for a NULL cgroup as well as the negative return
and just return the NULL cgroup to the caller (as it would have previously)

9 years agoXen: remove xendConfigVersion from driver private struct
Jim Fehlig [Tue, 15 Dec 2015 02:53:16 +0000 (19:53 -0700)]
Xen: remove xendConfigVersion from driver private struct

xendConfigVersion is no longer used, so remove it from the
xenUnifiedPrivate struct.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: xenconfig: remove xendConfigVersion from public sexpr functions
Jim Fehlig [Tue, 15 Dec 2015 02:31:39 +0000 (19:31 -0700)]
Xen: xenconfig: remove xendConfigVersion from public sexpr functions

Remove use of xendConfigVersion in the s-expresion config formatter/parser
in src/xenconfig/. Adjust callers in the xen and libxl drivers accordingly.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: xend: remove use of XEND_CONFIG_VERSION
Jim Fehlig [Fri, 4 Dec 2015 22:27:34 +0000 (15:27 -0700)]
Xen: xend: remove use of XEND_CONFIG_VERSION

Remove use of XEND_CONFIG_VERSION_* in xend_internal.c

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: xen_driver: remove use of XEND_CONFIG_VERSION
Jim Fehlig [Fri, 4 Dec 2015 21:06:10 +0000 (14:06 -0700)]
Xen: xen_driver: remove use of XEND_CONFIG_VERSION

Remove use of XEND_CONFIG_VERSION_* in the Xen unified driver.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: xenconfig: remove use of XEND_CONFIG_VERSION in xen_sxpr
Jim Fehlig [Tue, 15 Dec 2015 01:18:55 +0000 (18:18 -0700)]
Xen: xenconfig: remove use of XEND_CONFIG_VERSION in xen_sxpr

Remove use of XEND_CONFIG_VERSION_* in s-expression parser/formatter.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: tests: use latest XEND_CONFIG_VERSION in xml2sexpr tests
Jim Fehlig [Mon, 14 Dec 2015 06:41:48 +0000 (23:41 -0700)]
Xen: tests: use latest XEND_CONFIG_VERSION in xml2sexpr tests

Change all xml2sexpr tests to use the latest XEND_CONFIG_VERSION
(XEND_CONFIG_VERSION_3_1_0 = 4). Fix tests that do not conform to
the latest version.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: xenconfig: remove disks from '(image)' sexpr
Jim Fehlig [Tue, 15 Dec 2015 00:44:30 +0000 (17:44 -0700)]
Xen: xenconfig: remove disks from '(image)' sexpr

It has been quite some time since xend required specifying cdroms
and fds in '(image (hvm ...))'. Remove the code from the parsing
and formatting functions and fixup the associated tests.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: tests: use latest XEND_CONFIG_VERSION in sexpr2xml tests
Jim Fehlig [Thu, 10 Dec 2015 04:15:07 +0000 (21:15 -0700)]
Xen: tests: use latest XEND_CONFIG_VERSION in sexpr2xml tests

Change all sexpr2xml tests to use the latest XEND_CONFIG_VERSION
(XEND_CONFIG_VERSION_3_1_0 = 4). Fix tests that do not conform to
the latest version.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: xenconfig: remove xendConfigVersion from public functions
Jim Fehlig [Sat, 5 Dec 2015 02:11:39 +0000 (19:11 -0700)]
Xen: xenconfig: remove xendConfigVersion from public functions

Remove use of xendConfigVersion in the xm and xl config formatter/parsers
in src/xenconfig/. Adjust callers in the xen and libxl drivers accordingly.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: xenconfig: remove use of XEND_CONFIG_VERSION in xen_xm
Jim Fehlig [Sat, 5 Dec 2015 06:55:00 +0000 (23:55 -0700)]
Xen: xenconfig: remove use of XEND_CONFIG_VERSION in xen_xm

Remove use of XEND_CONFIG_VERSION_* in xm parser/formatter.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: xenconfig: remove XEND_CONFIG_VERSION in common code
Jim Fehlig [Fri, 4 Dec 2015 23:08:59 +0000 (16:08 -0700)]
Xen: xenconfig: remove XEND_CONFIG_VERSION in common code

Remove use of XEND_CONFIG_VERSION_* from xenconfig/xen_common.c

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: tests: use latest XEND_CONFIG_VERSION in xm/xl tests
Jim Fehlig [Sat, 5 Dec 2015 01:09:28 +0000 (18:09 -0700)]
Xen: tests: use latest XEND_CONFIG_VERSION in xm/xl tests

Change all tests to use the latest XEND_CONFIG_VERSION
(XEND_CONFIG_VERSION_3_1_0 = 4). Fix tests that do not conform to
the latest version.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: tests: remove old xml2sexpr tests
Jim Fehlig [Mon, 14 Dec 2015 21:59:40 +0000 (14:59 -0700)]
Xen: tests: remove old xml2sexpr tests

Remove XML to s-expression converstion tests for old xend 3.0.2
config format.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: tests: remove old sexpr2xml tests
Jim Fehlig [Mon, 14 Dec 2015 21:48:58 +0000 (14:48 -0700)]
Xen: tests: remove old sexpr2xml tests

Remove s-expression to XML conversion tests for old xend 3.0.2
config format.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: tests: remove net-ioemu xm config test
Jim Fehlig [Mon, 14 Dec 2015 21:24:56 +0000 (14:24 -0700)]
Xen: tests: remove net-ioemu xm config test

Remove the fullvirt-net-ioemu test since explicitly specifying
'type=ioemu' has not been needed in xm/xend for a long time. It is
not used at all in xl/libxl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoXen: tests: remove old xm config tests
Jim Fehlig [Mon, 14 Dec 2015 21:22:14 +0000 (14:22 -0700)]
Xen: tests: remove old xm config tests

Remove xm config tests for old xend 3.0.2 config format.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agovirsh: Add build flags to pool-create[-as] and pool-start
John Ferlan [Wed, 25 Nov 2015 14:51:51 +0000 (09:51 -0500)]
virsh: Add build flags to pool-create[-as] and pool-start

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

Utilize recently added VIR_STORAGE_POOL_CREATE_WITH_BUILD* flags in
order to pass the flags along to the virStoragePoolCreateXML and
virStoragePoolCreate API's.

This affects the 'virsh pool-create', 'virsh pool-create-as', and
'virsh pool-start' commands.  While it could be argued that pool-start
doesn't need the flags, they could prove useful for someone trying to
do one command build --overwrite and start command processing or
essentially starting with a clean slate.

NB:
This patch is loosely based upon code originally authored by Osier
Yang that were not reviewed and pushed, see:

https://www.redhat.com/archives/libvir-list/2012-July/msg00497.html

9 years agovirsh: Create a macro for pool-define-as and pool-create-as options
John Ferlan [Wed, 25 Nov 2015 13:57:30 +0000 (08:57 -0500)]
virsh: Create a macro for pool-define-as and pool-create-as options

Although they both are the same now, a future patch will add new options
to pool-create-as. So create a common macro to capture commonality, then
use that in the command specific structure.

9 years agovirsh: Create macro for "overwrite" and no-overwrite" options
John Ferlan [Wed, 25 Nov 2015 14:35:41 +0000 (09:35 -0500)]
virsh: Create macro for "overwrite" and no-overwrite" options

Although not currently used in more than one command, it soon will be
so create a common macro to be used in the new command location.

Additionally, add the ".flags = 0," for both to match the expections
of the structure being predefined.

9 years agovirsh: Create macro for "file" option
John Ferlan [Wed, 25 Nov 2015 14:08:54 +0000 (09:08 -0500)]
virsh: Create macro for "file" option

Rather than continually cut/paste the "file" option for pool command
option structures, generate a macro which will commonly define it for
any command.  Then of course use that macro.

9 years agovirsh: Create macro for "pool" option
John Ferlan [Wed, 25 Nov 2015 14:06:33 +0000 (09:06 -0500)]
virsh: Create macro for "pool" option

Rather than continually cut/paste the "pool" option for pool command
option structures, generate a macro which will commonly define it for
any command.  Then of course use that macro.

9 years agostorage: Add flags to allow building pool during create processing
John Ferlan [Wed, 25 Nov 2015 15:01:45 +0000 (10:01 -0500)]
storage: Add flags to allow building pool during create processing

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

Add flags handling to the virStoragePoolCreate and virStoragePoolCreateXML
API's which will allow the caller to provide the capability for the storage
pool create API's to also perform a pool build during creation rather than
requiring the additional buildPool step. This will allow transient pools
to be defined, built, and started.

The new flags are:

    * VIR_STORAGE_POOL_CREATE_WITH_BUILD
      Perform buildPool without any flags passed.

    * VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE
      Perform buildPool using VIR_STORAGE_POOL_BUILD_OVERWRITE flag.

    * VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE
      Perform buildPool using VIR_STORAGE_POOL_BUILD_NO_OVERWRITE flag.

It is up to the backend to handle the processing of build flags. The
overwrite and no-overwrite flags are mutually exclusive.

NB:
This patch is loosely based upon code originally authored by Osier
Yang that were not reviewed and pushed, see:

https://www.redhat.com/archives/libvir-list/2012-July/msg01328.html

9 years agomark virDomainVirtioSerialAddrSetAddController as static.
Ján Tomko [Wed, 12 Aug 2015 14:52:12 +0000 (16:52 +0200)]
mark virDomainVirtioSerialAddrSetAddController as static.

This function is no longer used outside domain_addr.c

9 years agoRemove dead code from qemuDomainAttachControllerDevice
Ján Tomko [Wed, 12 Aug 2015 14:52:11 +0000 (16:52 +0200)]
Remove dead code from qemuDomainAttachControllerDevice

We only support hotplugging SCSI controllers.
The USB and virtio-serial related code was never reachable because
this function was only called for VIR_DOMAIN_CONTROLLER_TYPE_SCSI
controllers.

This reverts commit ee0d97a and parts of commits 16db8d2
and d6d54cd1.

9 years agoqemu_hotplug: remove qemuDomainAttachDeviceControllerLive
Ján Tomko [Wed, 9 Dec 2015 16:27:12 +0000 (17:27 +0100)]
qemu_hotplug: remove qemuDomainAttachDeviceControllerLive

This function calls qemuDomainAttachControllerDevice for SCSI
controllers and reports an error for all other controllers.

Move the error inside qemuDomainAttachControllerDevice and delete this
wrapper.

9 years agoAllow building lxc without virt-login-shell
Cédric Bosdonnat [Mon, 9 Nov 2015 22:36:40 +0000 (15:36 -0700)]
Allow building lxc without virt-login-shell

Add a configure option to disable virt-login-shell build even if lxc is
enabled.

9 years agostorage: Fix startup issue for logical pool
John Ferlan [Wed, 16 Dec 2015 16:54:04 +0000 (11:54 -0500)]
storage: Fix startup issue for logical pool

Commit id '71b803ac' assumed that the storage pool source device path
was required for a 'logical' pool. This resulted in a failure to start
a pool without any device path defined.

So, adjust the virStorageBackendLogicalMatchPoolSource logic to
return success if at least the pool name matches the vgs output
when no pool source device path is/are provided.

9 years agoqemu: Fix event generated for qemuDomainRevertToSnapshot (pause->run)
John Ferlan [Tue, 15 Dec 2015 18:39:44 +0000 (13:39 -0500)]
qemu: Fix event generated for qemuDomainRevertToSnapshot (pause->run)

A closer review of the code shows that for the transition from paused to
running which was supposed to emit the VIR_DOMAIN_EVENT_RESUMED - no event
would be generated. Rather the event is generated when going from running
to running.

Following the 'was_running' boolean shows it is set when the domain obj
is active and the domain obj state is VIR_DOMAIN_RUNNING. So rather than
using was_running to generate the RESUMED event, use !was_running

9 years agostorage: Attempt to refresh volume after successful wipe volume
John Ferlan [Thu, 17 Dec 2015 12:30:03 +0000 (07:30 -0500)]
storage: Attempt to refresh volume after successful wipe volume

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

When a volume wipe is successful, perform a volume refresh afterwards to
update any volume data that may be used in future volume commands, such as
volume resize.  For a raw file volume, a wipe could truncate the file and
a followup volume resize the capacity may fail because the volume target
allocation isn't updated to reflect the wipe activity.

9 years agovirStorageBackendWipeLocal: remove bytes_wiped argument
Ján Tomko [Fri, 11 Dec 2015 16:33:47 +0000 (17:33 +0100)]
virStorageBackendWipeLocal: remove bytes_wiped argument

It is not used by the caller.

9 years agostorage: drop 'Extent' from virStorageBackendWipeExtentLocal
Ján Tomko [Fri, 11 Dec 2015 16:14:01 +0000 (17:14 +0100)]
storage: drop 'Extent' from virStorageBackendWipeExtentLocal

The only caller always passes 0 for the extent start.
Drop the 'extent_start' parameter, as well as the mention of extents
from the function name.

Change off_t extent_length to unsigned long long wipe_len, as well as the
'remain' variable.

9 years agostorage: move buffer allocation inside virStorageBackendWipeExtentLocal
Ján Tomko [Fri, 11 Dec 2015 15:49:01 +0000 (16:49 +0100)]
storage: move buffer allocation inside virStorageBackendWipeExtentLocal

We do not need to pass a zero-filled buffer as an argument,
the function can allocate its own.

9 years agostorage: fix return values of virStorageBackendWipeExtentLocal
Ján Tomko [Fri, 11 Dec 2015 15:37:34 +0000 (16:37 +0100)]
storage: fix return values of virStorageBackendWipeExtentLocal

Return -1:
* on all failures of fdatasync. Instead of propagating -errno
  all the way up to the virStorageVolWipe API, which is documented
  to return 0 or -1.
* after a partial wipe. If safewrite failed, we would re-use the
  non-negative return value of lseek (which should be 0 in this case,
  because that's the only offset we seek to).

9 years agoqemu: Replace Mlock with MemLock in function names
Andrea Bolognani [Tue, 24 Nov 2015 12:51:11 +0000 (13:51 +0100)]
qemu: Replace Mlock with MemLock in function names

MemLock is already used in other modules and, while still an
abbreviation, is not ambiguous.

9 years agoqemu: Allow qemuDomainAdjustMaxMemLock() to restore previous value
Andrea Bolognani [Thu, 10 Dec 2015 18:13:58 +0000 (19:13 +0100)]
qemu: Allow qemuDomainAdjustMaxMemLock() to restore previous value

When the function changes the memory lock limit for the first time,
it will retrieve the current value and store it inside the
virDomainObj for the domain.

When the function is called again, if memory locking is no longer
needed, it will be able to restore the memory locking limit to its
original value.

9 years agoqemu: Reduce memlock limit after detaching PCI hostdev
Andrea Bolognani [Wed, 18 Nov 2015 12:56:09 +0000 (13:56 +0100)]
qemu: Reduce memlock limit after detaching PCI hostdev

We increase the limit before plugging in a PCI hostdev or a memory
module because some memory might need to be locked due to eg. VFIO.

Of course we should do the opposite after unplugging a device: this
was already the case for memory modules, but not for PCI hostdevs.

9 years agoqemu: Use qemuDomainAdjustMaxMemLock()
Andrea Bolognani [Mon, 23 Nov 2015 16:57:40 +0000 (17:57 +0100)]
qemu: Use qemuDomainAdjustMaxMemLock()

Replace all uses of the qemuDomainRequiresMlock/virProcessSetMaxMemLock
combination with the equivalent qemuDomainAdjustMaxMemLock() call.

9 years agoqemu: Add qemuDomainAdjustMaxMemLock()
Andrea Bolognani [Thu, 10 Dec 2015 17:39:14 +0000 (18:39 +0100)]
qemu: Add qemuDomainAdjustMaxMemLock()

This function detects whether a domain needs RLIMIT_MEMLOCK
to be set, and if so, uses an appropriate value.

9 years agoprocess: Add virProcessGetMaxMemLock()
Andrea Bolognani [Fri, 20 Nov 2015 16:06:41 +0000 (17:06 +0100)]
process: Add virProcessGetMaxMemLock()

This function can be used to retrieve the current locked memory
limit for a process, so that the setting can be later restored.

Add a configure check for getrlimit(), which we now use.

9 years agoprocess: Allow virProcessPrLimit() to get current limit
Andrea Bolognani [Fri, 20 Nov 2015 16:21:11 +0000 (17:21 +0100)]
process: Allow virProcessPrLimit() to get current limit

The prlimit() function allows both getting and setting limits for
a process; expose the same functionality in our wrapper.

Add the const modifier for new_limit, in accordance with the
prototype for prlimit().

9 years agobuild: disable vbox on cygwin
Eric Blake [Tue, 13 Oct 2015 20:47:42 +0000 (14:47 -0600)]
build: disable vbox on cygwin

Cygwin cannot build the vbox driver yet:

  CC       vbox/libvirt_driver_vbox_impl_la-vbox_glue.lo
In file included from vbox/vbox_glue.c:27:0:
vblox/vbox_XPCOMCGlue.c:63:3: error: #error "Port me"
 # error "Port me"
   ^
In file included from vbox/vbox_XPCOMCGlue.c:45:0,
                 from vbox/vbox_glue.c:27:
vbox/vbox_XPCOMCGlue.c: In function 'tryLoadOne':
vbox/vbox_XPCOMCGlue.c:98:46: error: 'DYNLIB_NAME' undeclared (first use in this function)
         if (virAsprintf(&name, "%s/%s", dir, DYNLIB_NAME) < 0)
                                      ^
./util/virstring.h:245:31: note: in definition of macro 'virAsprintf'
                         strp, __VA_ARGS__)
       ^

Rather than trying to figure out how to get dynamic loading of
vbox to work under cygwin (since I don't even have a working vbox
setup to test whether it works), I'm going to be lazy and just
default to not even trying vbox on cygwin.

9 years agoqemu: Search all nodes for shared memory access
Martin Kletzander [Wed, 16 Dec 2015 12:00:33 +0000 (13:00 +0100)]
qemu: Search all nodes for shared memory access

In commit 686eb7a24f7d, the break was not considered part of the
condition, hence breaking after first node when searching.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agopci: Use virPCIDeviceAddress in virPCIDevice
Andrea Bolognani [Tue, 15 Dec 2015 08:44:35 +0000 (09:44 +0100)]
pci: Use virPCIDeviceAddress in virPCIDevice

Instead of replicating the information (domain, bus, slot, function)
inside the virPCIDevice structure, use the already-existing
virPCIDeviceAddress structure.

For users of the module, this means that the object returned by
virPCIDeviceGetAddress() can no longer be NULL and must no longer
be freed by the caller.

9 years agolibxl: Use libxentoollog in preference to libxenctrl if available.
Ian Campbell [Thu, 10 Dec 2015 11:38:36 +0000 (11:38 +0000)]
libxl: Use libxentoollog in preference to libxenctrl if available.

Upstream Xen is in the process of splitting the (stable API) xtl_*
interfaces out from the (unstable API) libxenctrl library and into a
new (stable API) libxentoollog.

In order to be compatible with Xen both before and after this
transition check for xtl_createlogger_stdiostream in a libxentoollog
library and use it if present. If it is not present assume it is in
libxenctrl.

Compile tested on Xen 4.6 and a development tree with the split in
place.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
9 years agolibxl: implement virDomainGetJobStats
Joao Martins [Fri, 13 Nov 2015 13:14:48 +0000 (13:14 +0000)]
libxl: implement virDomainGetJobStats

Introduces support for domainGetJobStats which has the same
info as domainGetJobInfo but in a slightly different format.
Another difference is that virDomainGetJobStats can also
retrieve info on the most recently completed job. Though so
far this is only used in the source node to know if the
migration has been completed. But because we don't support
completed jobs we will deliver an error.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
9 years agolibxl: implement virDomainGetJobInfo
Joao Martins [Fri, 13 Nov 2015 13:14:47 +0000 (13:14 +0000)]
libxl: implement virDomainGetJobInfo

Introduce support for domainGetJobInfo to get info about the
ongoing job. If the job is active it will update the
timeElapsed which is computed with the "started" field added to
struct libxlDomainJobObj.  For now we support just the very basic
info and all jobs have VIR_DOMAIN_JOB_UNBOUNDED (i.e. no completion
time estimation) plus timeElapsed computed.

Openstack Kilo uses the Job API to monitor live-migration
progress which is currently nonexistent in libxl driver and
therefore leads to a crash in the nova compute node. Right
now, migration doesn't use jobs in the source node and will
return VIR_DOMAIN_JOB_NONE. Though nova handles this case and
will migrate it properly instead of crashing.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
9 years agostorage: Add helper to compare logical pool def against pvs output
John Ferlan [Mon, 7 Dec 2015 20:06:17 +0000 (15:06 -0500)]
storage: Add helper to compare logical pool def against pvs output

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

Add a new helper virStorageBackendLogicalMatchPoolSource to compare the
pool's source name against the output from a 'pvs' command to list all
volume group physical volume data on the host.  In addition, compare the
pool's source device list against the particular volume group's device
list to ensure the source device(s) listed for the pool match what the
was listed for the volume group.

Then for pool startup or check API's we need to call this new API in
order to ensure that the pool we're about to start or declare active
during checkPool has a valid definition vs. the running host.

9 years agostorage: Create helper for virStorageBackendLogicalFindPoolSources
John Ferlan [Mon, 7 Dec 2015 16:27:03 +0000 (11:27 -0500)]
storage: Create helper for virStorageBackendLogicalFindPoolSources

Rework virStorageBackendLogicalFindPoolSources a bit to create a
helper virStorageBackendLogicalGetPoolSources that will make the
pvs call in order to generate a list of associated pv_name and vg_name's.

A future patch will make use of this for start/check processing to
ensure the storage pool source definition matches expectations.

9 years agostorage: Check FS pool source during virStorageBackendFileSystemIsMounted
John Ferlan [Mon, 7 Dec 2015 13:35:57 +0000 (08:35 -0500)]
storage: Check FS pool source during virStorageBackendFileSystemIsMounted

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

When determining whether a FS pool is mounted, rather than assuming that
the FS pool is mounted just because the target.path is in the mount list,
let's make sure that the FS pool source matches what is mounted

9 years agostorage: Refactor virStorageBackendFileSystemGetPoolSource
John Ferlan [Mon, 7 Dec 2015 13:26:42 +0000 (08:26 -0500)]
storage: Refactor virStorageBackendFileSystemGetPoolSource

Refactor code to use standard return functioning with respect to setting
a ret value and going to cleanup.

9 years agostorage: Create helper to generate FS pool source value
John Ferlan [Mon, 7 Dec 2015 13:19:34 +0000 (08:19 -0500)]
storage: Create helper to generate FS pool source value

Refactor the code that builds the pool source string during the FS
storage pool mount to be a separate helper.

A future patch will use the helper in order to validate the mounted
FS matches the pool's expectation during poolCheck processing

9 years agoqemu: add bootindex option to hostdev network interface commandline
Laine Stump [Mon, 30 Nov 2015 22:40:44 +0000 (17:40 -0500)]
qemu: add bootindex option to hostdev network interface commandline

when appropriate, of course. If the config for a domain specifies boot
order with <boot dev='blah'/> elements, e.g.:

     <os>
       ...
       <boot dev='hd'/>
       <boot dev='network'/>
     </os>

Then the first disk device in the config will have ",bootindex=1"
appended to its qemu commandline -device options, and the first (and
*only* the first) network interface device will get ",bootindex=2".

However, if the first network interface device is a "hostdev" device
(an SRIOV Virtual Function (VF) being assigned to the domain with
vfio), then the bootindex option will *not* be appended. This happens
because the bootindex=n option corresponding to the order of "<boot
dev='network'/>" is added to the -device for the first network device
when network device commandline args are constructed, but if it's a
hostdev network device, its commandline arg is instead constructed in
the loop for hostdevs.

This patch fixes that omission by noticing (in bootHostdevNet) if the
first network device was a hostdev, and if so passing on the proper
bootindex to the commandline generator for hostdev devices - the
result is that ",bootindex=2" will be properly appended to the first
"network" device in the config even if it is really a hostdev
(including if it is assigned from a libvirt network pool). (note that
this is only the case if there is no <bootmenu enabled='yes'/> element
in the config ("-boot menu-on" in qemu) , since the two are mutually
exclusive - when the bootmenu is enabled, the individual per-device
bootindex options can't be used by qemu, and we revert to using "-boot
order=xyz" instead).

If a greater level of control over boot order is desired (e.g., more
than one network device should be tried, or a network device other
than the first one encountered in the config), then <boot
dev='network'/> in the <os> element should not be used; instead, the
individual device elements in the config should be given a "<boot
order='n'/>

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

9 years agosecurity_stack: remove extra Security from function names
Ján Tomko [Wed, 9 Dec 2015 13:35:11 +0000 (14:35 +0100)]
security_stack: remove extra Security from function names

Many of the functions follow the pattern:
virSecurity.*Security.*Label

Remove the second 'Security' from the names, it should be
obvious that the virSecurity* functions deal with security
labels even without it.

9 years agosecurity_selinux: remove extra Security from function names
Ján Tomko [Wed, 9 Dec 2015 13:34:34 +0000 (14:34 +0100)]
security_selinux: remove extra Security from function names

Many of the functions follow the pattern:
virSecurity.*Security.*Label

Remove the second 'Security' from the names, it should be obvious
that the virSecurity* functions deal with security labels even
without it.

9 years agosecurity_dac: remove extra Security from function names
Ján Tomko [Wed, 9 Dec 2015 13:33:55 +0000 (14:33 +0100)]
security_dac: remove extra Security from function names

Many of the functions follow the pattern:
virSecurity.*Security.*Label

Remove the second 'Security' from the names, it should be obvious
that the virSecurity* functions deal with security labels even
without it.

9 years agoqemuMonitorJSONEjectMedia: don't stringify the replay at all
Pavel Hrdina [Tue, 15 Dec 2015 10:04:49 +0000 (11:04 +0100)]
qemuMonitorJSONEjectMedia: don't stringify the replay at all

Commit 256496e1 introduced a detection if "is locked" in error replay
from qemu monitor. Commit c4073657 fixed a memory leak, but it was
pointed out by Peter, that this could be done cleaner without
stringifing the replay.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agopci: Use 'addr' instead of 'dev' for virPCIDeviceAddressPtr
Andrea Bolognani [Tue, 15 Dec 2015 08:53:31 +0000 (09:53 +0100)]
pci: Use 'addr' instead of 'dev' for virPCIDeviceAddressPtr

The name 'dev' is more appropriate for virPCIDevicePtr.

9 years agoqemuMonitorJSONEjectMedia: Don't leak stringified reply
Michal Privoznik [Tue, 15 Dec 2015 08:58:30 +0000 (09:58 +0100)]
qemuMonitorJSONEjectMedia: Don't leak stringified reply

The return value of virJSONValueToString() should be freed when
no longer needed. This is not the case after 256496e1.

==26902== 138 bytes in 2 blocks are definitely lost in loss record 1,051 of 1,239
==26902==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==26902==    by 0xAA5F599: strdup (in /lib64/libc-2.21.so)
==26902==    by 0x552BAD9: virStrdup (virstring.c:726)
==26902==    by 0x54F60A7: virJSONValueToString (virjson.c:1790)
==26902==    by 0x1DF6EBB9: qemuMonitorJSONEjectMedia (qemu_monitor_json.c:2225)
==26902==    by 0x1DF57A4C: qemuMonitorEjectMedia (qemu_monitor.c:1985)
==26902==    by 0x1DF1EF2D: qemuDomainChangeEjectableMedia (qemu_hotplug.c:199)
==26902==    by 0x1DF90314: qemuDomainChangeDiskLive (qemu_driver.c:7985)
==26902==    by 0x1DF90476: qemuDomainUpdateDeviceLive (qemu_driver.c:8030)
==26902==    by 0x1DF91ED7: qemuDomainUpdateDeviceFlags (qemu_driver.c:8677)
==26902==    by 0x561785F: virDomainUpdateDeviceFlags (libvirt-domain.c:8559)
==26902==    by 0x134210: remoteDispatchDomainUpdateDeviceFlags (remote_dispatch.h:10966)

==26902== 106 bytes in 1 blocks are definitely lost in loss record 1,033 of 1,239
==26902==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==26902==    by 0xAA5F599: strdup (in /lib64/libc-2.21.so)
==26902==    by 0x552BAD9: virStrdup (virstring.c:726)
==26902==    by 0x54F60A7: virJSONValueToString (virjson.c:1790)
==26902==    by 0x1DF6EC0C: qemuMonitorJSONEjectMedia (qemu_monitor_json.c:2227)
==26902==    by 0x1DF57A4C: qemuMonitorEjectMedia (qemu_monitor.c:1985)
==26902==    by 0x1DF1EF2D: qemuDomainChangeEjectableMedia (qemu_hotplug.c:199)
==26902==    by 0x1DF90314: qemuDomainChangeDiskLive (qemu_driver.c:7985)
==26902==    by 0x1DF90476: qemuDomainUpdateDeviceLive (qemu_driver.c:8030)
==26902==    by 0x1DF91ED7: qemuDomainUpdateDeviceFlags (qemu_driver.c:8677)
==26902==    by 0x561785F: virDomainUpdateDeviceFlags (libvirt-domain.c:8559)
==26902==    by 0x134210: remoteDispatchDomainUpdateDeviceFlags (remote_dispatch.h:10966)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu cgroups: move new threads to new cgroup after cpuset is set up
Henning Schild [Mon, 14 Dec 2015 20:58:05 +0000 (15:58 -0500)]
qemu cgroups: move new threads to new cgroup after cpuset is set up

Moving tasks to cgroups implied sched_setaffinity. Changing the cpus in
a set implies the same for all tasks in the group.
The old code put the the thread into the cpuset inherited from the
machine cgroup, which allowed it to run outside of vcpupin for a short
while.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
9 years agoqemu: do not put a task into machine cgroup
Henning Schild [Mon, 14 Dec 2015 20:48:05 +0000 (15:48 -0500)]
qemu: do not put a task into machine cgroup

The machine cgroup is a superset, a parent to the emulator and vcpuX
cgroups. The parent cgroup should never have any tasks directly in it.
In fact the parent cpuset might contain way more cpus than the sum of
emulatorpin and vcpupins. So putting tasks in the superset will allow
them to run outside of <cputune>.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
9 years agoutil: cgroups do not implicitly add task to new machine cgroup
Henning Schild [Wed, 9 Dec 2015 16:58:10 +0000 (17:58 +0100)]
util: cgroups do not implicitly add task to new machine cgroup

virCgroupNewMachine used to add the pidleader to the newly created
machine cgroup. Do not do this implicit anymore.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
9 years agovirNetDevMacVLanTapSetup: Drop @multiqueue argument
Michal Privoznik [Sun, 13 Dec 2015 06:54:46 +0000 (07:54 +0100)]
virNetDevMacVLanTapSetup: Drop @multiqueue argument

Firstly, there's a bug (or typo) in the only place where we call
this function: @multiqueue is set whenever @tapfdSize is greater
than zero, while in fact the condition should have been 'greater
than one'.
Then, secondly, since the condition depends on just one
variable, that we are even passing down to the function, we can
move the condition into the function and drop useless argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Warn when using vhost-user without shared memory
Martin Kletzander [Tue, 8 Dec 2015 13:15:47 +0000 (14:15 +0100)]
qemu: Warn when using vhost-user without shared memory

When user configures vhost-user interface and forgets to also configure
any shared memory, the search for the root cause of non-operational
interface might take unpleasantly long time.  Let's enhance user
experience by emitting a warning in the logs.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agovirNetDevMacVLanTapSetup: Work around older systems
Michal Privoznik [Sat, 12 Dec 2015 07:05:17 +0000 (08:05 +0100)]
virNetDevMacVLanTapSetup: Work around older systems

Some older systems, e.g. RHEL-6 do not have IFF_MULTI_QUEUE flag
which we use to enable multiqueue feature. Therefore one gets the
following compile error there:

  CC     util/libvirt_util_la-virnetdevmacvlan.lo
util/virnetdevmacvlan.c: In function 'virNetDevMacVLanTapSetup':
util/virnetdevmacvlan.c:338: error: 'IFF_MULTI_QUEUE' undeclared (first use in this function)
util/virnetdevmacvlan.c:338: error: (Each undeclared identifier is reported only once
util/virnetdevmacvlan.c:338: error: for each function it appears in.)
make[3]: *** [util/libvirt_util_la-virnetdevmacvlan.lo] Error 1

So, whenever user wants us to enable the feature on such systems,
we will just throw a runtime error instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoCVE-2015-5313: storage: don't allow '/' in filesystem volume names
Eric Blake [Wed, 9 Dec 2015 00:46:31 +0000 (17:46 -0700)]
CVE-2015-5313: storage: don't allow '/' in filesystem volume names

The libvirt file system storage driver determines what file to
act on by concatenating the pool location with the volume name.
If a user is able to pick names like "../../../etc/passwd", then
they can escape the bounds of the pool.  For that matter,
virStoragePoolListVolumes() doesn't descend into subdirectories,
so a user really shouldn't use a name with a slash.

Normally, only privileged users can coerce libvirt into creating
or opening existing files using the virStorageVol APIs; and such
users already have full privilege to create any domain XML (so it
is not an escalation of privilege).  But in the case of
fine-grained ACLs, it is feasible that a user can be granted
storage_vol:create but not domain:write, and it violates
assumptions if such a user can abuse libvirt to access files
outside of the storage pool.

Therefore, prevent all use of volume names that contain "/",
whether or not such a name is actually attempting to escape the
pool.

This changes things from:

$ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
Vol ../../../../../../etc/haha created
$ rm /etc/haha

to:

$ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
error: Failed to create vol ../../../../../../etc/haha
error: Requested operation is not valid: volume name '../../../../../../etc/haha' cannot contain '/'

Signed-off-by: Eric Blake <eblake@redhat.com>
9 years agoutil: Fixup virnetdevmacvlan.h ATTRIBUTE_NONNULL's
John Ferlan [Fri, 11 Dec 2015 11:37:48 +0000 (06:37 -0500)]
util: Fixup virnetdevmacvlan.h ATTRIBUTE_NONNULL's

Commit id '56e2171c6' removed a variable from the argument list, but
neglected to update the ATTRIBUTE_NONNULL values, so when commit id
'08da97bfb' added a couple of arguments, the values were off.

9 years agotest: qemuxml2argv: Mock virMemoryMaxValue to remove 32/64 bit difference
Peter Krempa [Thu, 10 Dec 2015 13:36:51 +0000 (14:36 +0100)]
test: qemuxml2argv: Mock virMemoryMaxValue to remove 32/64 bit difference

Always return LLONG_MAX even on 32 bit systems. The limitation
originates from our use of "unsigned long" in several APIs. The internal
data type is unsigned long long. Make the test suite deterministic by
removing the architecture difference.

Flaw was introduced in 645881139b3d2c86acf9d644c3a1471520bc9e57 where
I've added a test that uses too large numbers.

9 years agoqemu: Enable multiqueue for macvtaps
Michal Privoznik [Fri, 4 Dec 2015 10:47:22 +0000 (11:47 +0100)]
qemu: Enable multiqueue for macvtaps

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

Ta-da! Now that we know how to open a macvtap device multiple
times, we can finally enable the multiqueue feature. Everything
else is already prepared (e.g. command line generation) from the
previous iteration where the feature was implemented for
TUN/TAP devices.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNetDevMacVLanCreateWithVPortProfile: Rework to support multiple FDs
Michal Privoznik [Fri, 4 Dec 2015 10:31:17 +0000 (11:31 +0100)]
virNetDevMacVLanCreateWithVPortProfile: Rework to support multiple FDs

For the multiqueue on macvtaps we are going to need to open
the device multiple times. Currently, this is not supported.
Rework the function, so that upper layers can be reworked too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNetDevMacVLanTapSetup: Allow enabling of IFF_MULTI_QUEUE
Michal Privoznik [Tue, 8 Dec 2015 12:17:26 +0000 (13:17 +0100)]
virNetDevMacVLanTapSetup: Allow enabling of IFF_MULTI_QUEUE

Like we are doing for TUN/TAP devices, we should do the same for
macvtaps. Although, it's not as critical as in that case, we
should do it for the consistency.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNetDevMacVLanTapSetup: Rework to support multiple FDs
Michal Privoznik [Fri, 4 Dec 2015 10:19:32 +0000 (11:19 +0100)]
virNetDevMacVLanTapSetup: Rework to support multiple FDs

For the multiqueue on macvtaps we are going to need to open
the device multiple times. Currently, this is not supported.
Rework the function, so that upper layers can be reworked too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNetDevMacVLanTapOpen: Rework to support multiple FDs
Michal Privoznik [Fri, 4 Dec 2015 08:39:02 +0000 (09:39 +0100)]
virNetDevMacVLanTapOpen: Rework to support multiple FDs

For the multiqueue on macvtaps we are going to need to open
the device multiple times. Currently, this is not supported.
Rework the function, so that upper layers can be reworked too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNetDevMacVLanTapOpen: Slightly rework
Michal Privoznik [Fri, 4 Dec 2015 09:55:49 +0000 (10:55 +0100)]
virNetDevMacVLanTapOpen: Slightly rework

There are few outdated things. Firstly, we don't need to undergo
the torture of fopen, fscanf and fclose just to get the interface
index when we have nice wrapper over that: virNetDevGetIndex.
Secondly, we don't need to have statically allocated buffer for
the path we are opening.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNetDevMacVLanCreateWithVPortProfile: Turn vnet_hdr into flag
Michal Privoznik [Thu, 3 Dec 2015 10:33:55 +0000 (11:33 +0100)]
virNetDevMacVLanCreateWithVPortProfile: Turn vnet_hdr into flag

So yet again one of integer arguments that we use as a boolean.
Since the argument count of the function is unbearably long
enough, lets turn those booleans into flags.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agolog: include hostname in initial log message
Daniel P. Berrange [Fri, 4 Dec 2015 17:35:54 +0000 (17:35 +0000)]
log: include hostname in initial log message

On the very first log message we send to any output, we include
the libvirt version number and package string. In some bug reports
we have been given libvirtd.log files that came from a different
host than the corresponding /var/log/libvirt/qemu log files. So
extend the initial log message to include the hostname too.

eg on first log message we would now see:

 $ libvirtd
 2015-12-04 17:35:36.610+0000: 20917: info : libvirt version: 1.3.0
 2015-12-04 17:35:36.610+0000: 20917: info : hostname: dhcp-1-180.lcy.redhat.com
 2015-12-04 17:35:36.610+0000: 20917: error : qemuMonitorIO:687 : internal error: End of file from monitor

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agostorage: Ignore block devices that fail format detection
John Ferlan [Fri, 30 Oct 2015 14:29:46 +0000 (10:29 -0400)]
storage: Ignore block devices that fail format detection

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

Prior to commit id '98322052' failure to saferead the block device would
cause an error to be logged and the device to be skipped while attempting
to discover/create a stable target path for a new LUN (NPIV).

This was because virStorageBackendSCSIFindLUs ignored errors from
processLU and virStorageBackendSCSINewLun.

Ignoring the failure allowed a multipath device with an "active" and
"ghost" to be present on the host with the "ghost" block device being
ignored. This patch will return a -2 to the caller indicating the desire
to ignore the block device since it cannot be used directly rather than
fail the pool startup.

9 years agostorage: Add debug message
John Ferlan [Tue, 24 Nov 2015 14:23:46 +0000 (09:23 -0500)]
storage: Add debug message

I found this useful while processing a volume that wouldn't end up
showing up in the resulting list of block volumes. In this case, the
partition type wasn't found in the disk_types table.

9 years agostorage: Handle readflags errors
John Ferlan [Tue, 24 Nov 2015 16:15:53 +0000 (11:15 -0500)]
storage: Handle readflags errors

Similar to the openflags VIR_STORAGE_VOL_OPEN_NOERROR processing, if some
read processing operation fails, check the readflags for the corresponding
error flag being set. If so, rather then causing an error - use VIR_WARN
to flag the error, but return -2 which some callers can use to perform
specific actions. Use a new VIR_STORAGE_VOL_READ_NOERROR flag in a new
VolReadErrorMode enum.