]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agoqemuxml2argvtest: cleanup test
Pavel Hrdina [Tue, 15 Mar 2016 12:57:47 +0000 (13:57 +0100)]
qemuxml2argvtest: cleanup test

Use qemuProcessCreatePretendCmd instead duplicating required steps from
qemuProcessStart.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemuxml2argvtest: use driver.config and priv for qemuDomainSetPrivatePaths
Pavel Hrdina [Tue, 15 Mar 2016 12:54:24 +0000 (13:54 +0100)]
qemuxml2argvtest: use driver.config and priv for qemuDomainSetPrivatePaths

Update testutilsqemu to overwrite libDir and channelTargetDir and set
private paths using domain's privateData.  This changes is required for
following patch.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_driver: cleanup qemuConnectDomainXMLToNative
Pavel Hrdina [Thu, 17 Mar 2016 12:20:58 +0000 (13:20 +0100)]
qemu_driver: cleanup qemuConnectDomainXMLToNative

Use qemuProcessCreatePretendCmd instead duplicating required steps from
qemuProcessStart.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: introduce qemuProcessCreatePretendCmd
Pavel Hrdina [Tue, 22 Mar 2016 12:17:27 +0000 (13:17 +0100)]
qemu_process: introduce qemuProcessCreatePretendCmd

This will skip few steps from qemuProcessStart in order to create only
qemu CMD.  Use a VIR_QEMU_PROCESS_START_PRETEND for all the qemuProcess*
functions called by this one to not modify or check host.

This new function will be used later on for XMLToNative API and also for
qemuxml2argvtest to make sure that both API and test uses the same code
as qemuProcessStart.

We need also update qemuProcessInit to wrap few lines of code with check
that VIR_QEMU_PROCESS_START_PRETEND that makes sense only for
qemuProcessStart.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: move qemuDomainSetPrivatePaths to qemuProcessInit
Pavel Hrdina [Mon, 14 Mar 2016 09:31:28 +0000 (10:31 +0100)]
qemu_process: move qemuDomainSetPrivatePaths to qemuProcessInit

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: move checks to qemuProcessStartValidate
Pavel Hrdina [Thu, 17 Mar 2016 12:51:20 +0000 (13:51 +0100)]
qemu_process: move checks to qemuProcessStartValidate

Move all code that checks host and domain.  Do not check host if we use
VIR_QEMU_PROCESS_START_PRETEND flag.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu: update callers of qemuProcessStartValidate to use virDomainObjPtr
Pavel Hrdina [Thu, 17 Mar 2016 12:19:35 +0000 (13:19 +0100)]
qemu: update callers of qemuProcessStartValidate to use virDomainObjPtr

This change is required by following patches.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: introduce qemuProcessPrepareHost
Pavel Hrdina [Tue, 22 Mar 2016 12:16:05 +0000 (13:16 +0100)]
qemu_process: introduce qemuProcessPrepareHost

Move all code that modifies host system to this function.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: introduce qemuProcessPrepareDomain
Pavel Hrdina [Tue, 15 Mar 2016 12:00:59 +0000 (13:00 +0100)]
qemu_process: introduce qemuProcessPrepareDomain

Move all code that modifies only live XML to this function.  The new
VIR_QEMU_PROCESS_START_PRETEND flag will be used by qemuXMLToNative and
qemuxml2argvtest later in order to reuse the same code as
qemuProcessStart uses.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agotests: cleanup qemuxml2argvtest
Pavel Hrdina [Mon, 14 Mar 2016 09:37:40 +0000 (10:37 +0100)]
tests: cleanup qemuxml2argvtest

This removes the testFailed magic and makes the code more readable.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agonvram: generate it's path in qemuDomainDefPostParse
Pavel Hrdina [Wed, 9 Mar 2016 15:10:54 +0000 (16:10 +0100)]
nvram: generate it's path in qemuDomainDefPostParse

The postParse callback is the correct place to generate default values
that should be present in offline XML.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: check for correct return value while starting domain
Pavel Hrdina [Mon, 14 Mar 2016 15:54:03 +0000 (16:54 +0100)]
qemu_process: check for correct return value while starting domain

Function qemuProcessLaunch returns '-2' in case there was an error and
we need to cleanup labels.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu-hotplug: fix eject media
Pavel Hrdina [Thu, 17 Mar 2016 15:38:28 +0000 (16:38 +0100)]
qemu-hotplug: fix eject media

QEMU changed the error message to:

        "Tray of device 'drive-sata0-0-1' is not open"

and they may change the error massage in the future.

This updates the code to not depend on the text from the error message
but only on error itself.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agonss: Make aligning look nicer
Martin Kletzander [Fri, 18 Mar 2016 15:46:41 +0000 (16:46 +0100)]
nss: Make aligning look nicer

Every aligning requires at least one cast and it's hard to read.  Let's
make a function that makes sure the pointer is moved according to the
alignment and use that to move throughout the data buffer.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agotests: Produce predictable results in nsstest
Michal Privoznik [Mon, 21 Mar 2016 13:52:49 +0000 (14:52 +0100)]
tests: Produce predictable results in nsstest

Problem is that in the test any status file matching
tests/nssdata/*.status is loaded as it contains IP addresses that
are parsed. However, there's no order specified in which the
files are loaded. Therefore on different systems the order may be
different. This is then producing an unexpected results.
Instead of defining an order in which the files are loaded, make
the code that checks for missing IP addresses (or redundant ones)
cope with unordered list of addresses. The reasoning behind is
that the code doing the parsing is used in real NSS module where
we don't care for ordering.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agotests: nodedevxml2xml: add test for SCSI target
Bjoern Walk [Mon, 21 Mar 2016 14:49:30 +0000 (15:49 +0100)]
tests: nodedevxml2xml: add test for SCSI target

Let's add a test for SCSI target nodedev devices.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
9 years agoconf: node_device: fix up SCSI target
Bjoern Walk [Mon, 21 Mar 2016 14:49:29 +0000 (15:49 +0100)]
conf: node_device: fix up SCSI target

When reading in an XML definition for a SCSI target device, the name
property of struct scsi_target refers to the @target element.

Let's fix this obvious typo and also extend the XML schema to provide
validation.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
9 years agolibxl: support enabling and disabling <hap> feature
Jim Fehlig [Tue, 23 Feb 2016 03:06:57 +0000 (20:06 -0700)]
libxl: support enabling and disabling <hap> feature

Until now, the libxl driver ignored any <hap> setting in domain XML
and deferred to libxl, which enables hap if not specified. While
this is a good default, it prevents disabling hap if desired.

This change allows disabling hap with <hap state='off'/>. hap is
explicitly enabled with <hap/> or <hap state='on/>. Absense of <hap>
retains current behavior of deferring default state to libxl.

9 years agoXen drivers: show hap enabled by default in capabilities
Jim Fehlig [Tue, 23 Feb 2016 02:20:41 +0000 (19:20 -0700)]
Xen drivers: show hap enabled by default in capabilities

Hardware Assisted Paging is enabled by default in Xen. Change
the capabilities output to reflect this.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoxenconfig: change 'hap' setting to align with Xen behavior
Jim Fehlig [Tue, 23 Feb 2016 01:50:19 +0000 (18:50 -0700)]
xenconfig: change 'hap' setting to align with Xen behavior

hap is enabled by default in xm and xl config and usually only
specified when it is desirable to disable hap (hap = 0). Change
the xm,xl <-> xml converter to behave similarly. I.e. only
produce 'hap = 0' when <hap state='off'/> and vice versa.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoconf: add 'state' attribute to <hap> feature
Jim Fehlig [Tue, 23 Feb 2016 00:03:21 +0000 (17:03 -0700)]
conf: add 'state' attribute to <hap> feature

Most hypervisors use Hardware Assisted Paging by default and don't
require specifying the feature in domain conf. But some hypervisors
support disabling HAP on a per-domain basis. To enable HAP by default
yet provide a knob to disable it, extend the <hap> feature with a
'state=on|off' attribute, similar to <pvspinlock> and <vmport> features.

In the absence of <hap>, the hypervisor default (on) is used. <hap>
without the state attribute would be the same as <hap state='on'/> for
backwards compatibility. And of course <hap state='off'/> disables hap.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoqemu: Add flags to qemuMigrationWaitForCompletion
Jiri Denemark [Thu, 17 Dec 2015 12:46:18 +0000 (13:46 +0100)]
qemu: Add flags to qemuMigrationWaitForCompletion

The function already takes two bool arguments, switching to flags makes
it a lot easier to read. Especially in case we need to add another
boolean in the future.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Refuse to abort migration in post-copy mode
Jiri Denemark [Thu, 14 Jan 2016 23:10:37 +0000 (00:10 +0100)]
qemu: Refuse to abort migration in post-copy mode

In post-copy mode none of the hosts has a complete guest state and
rolling back migration is impossible. Thus aborting it would be
equivalent to destroying the domain.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Handle post-copy migration failures
Jiri Denemark [Wed, 13 Jan 2016 15:29:58 +0000 (16:29 +0100)]
qemu: Handle post-copy migration failures

When migration fails in the post-copy mode, it's impossible to just kill
the destination domain and resume the source since the source no longer
contains current guest state. Let's mark domains on both sides as
VIR_DOMAIN_PAUSED_POSTCOPY_FAILED to let the upper layer decide what to
do with them.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Refactor qemuProcessRecoverMigration
Jiri Denemark [Thu, 14 Jan 2016 14:55:18 +0000 (15:55 +0100)]
qemu: Refactor qemuProcessRecoverMigration

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Don't kill running migrated domain on daemon restart
Jiri Denemark [Fri, 8 Jan 2016 13:06:52 +0000 (14:06 +0100)]
qemu: Don't kill running migrated domain on daemon restart

When destination libvirtd is restarted during migration in Finish phase
just after the point we started guest CPUs, we should not kill the
domain.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agovirsh: Add --postcopy-after-precopy option to migrate
Cristian Klein [Mon, 1 Dec 2014 16:00:02 +0000 (17:00 +0100)]
virsh: Add --postcopy-after-precopy option to migrate

Signed-off-by: Cristian Klein <cristiklein@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agovirsh: Configurable migrate --timeout action
Jiri Denemark [Wed, 2 Dec 2015 14:14:41 +0000 (15:14 +0100)]
virsh: Configurable migrate --timeout action

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agovirsh: Add support for post-copy migration
Cristian Klein [Mon, 1 Dec 2014 15:59:58 +0000 (16:59 +0100)]
virsh: Add support for post-copy migration

Signed-off-by: Cristian Klein <cristiklein@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Implement virDomainMigrateStartPostCopy
Cristian Klein [Mon, 1 Dec 2014 15:59:57 +0000 (16:59 +0100)]
qemu: Implement virDomainMigrateStartPostCopy

Signed-off-by: Cristian Klein <cristiklein@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Add support for VIR_MIGRATE_POSTCOPY flag
Cristian Klein [Mon, 1 Dec 2014 15:59:55 +0000 (16:59 +0100)]
qemu: Add support for VIR_MIGRATE_POSTCOPY flag

Signed-off-by: Cristian Klein <cristiklein@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Add QMP functions for post-copy migration
Cristian Klein [Mon, 1 Dec 2014 15:59:54 +0000 (16:59 +0100)]
qemu: Add QMP functions for post-copy migration

Signed-off-by: Cristian Klein <cristiklein@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Handle postcopy-active migration state
Jiri Denemark [Thu, 26 Nov 2015 14:37:23 +0000 (15:37 +0100)]
qemu: Handle postcopy-active migration state

Migration enters "postcopy-active" state after QEMU switches to
post-copy and pauses guest CPUs. From libvirt's point of view this state
is similar to "completed" because we need to transfer guest execution to
the destination host.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoAdd public APIs for post-copy migration
Cristian Klein [Mon, 1 Dec 2014 15:59:53 +0000 (16:59 +0100)]
Add public APIs for post-copy migration

To use post-copy one has to start the migration with
VIR_MIGRATE_POSTCOPY flag and, while migration is in progress, call
virDomainMigrateStartPostCopy() to switch from pre-copy to post-copy.

Signed-off-by: Cristian Klein <cristiklein@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoAdd event and state details for post-copy
Jiri Denemark [Tue, 5 Jan 2016 11:08:37 +0000 (12:08 +0100)]
Add event and state details for post-copy

VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY and VIR_DOMAIN_PAUSED_POSTCOPY are
used on the source host once migration enters post-copy mode (which
means the domain gets paused on the source. After the destination host
takes over the execution of the domain, its virtual CPUs are resumed and
the domain enters VIR_DOMAIN_RUNNING_POSTCOPY state and
VIR_DOMAIN_EVENT_RESUMED_POSTCOPY event is emitted.

In case migration fails during post-copy mode and none of the hosts have
complete state of the domain, both domains will remain paused with
VIR_DOMAIN_PAUSED_POSTCOPY_FAILED reason and an upper layer may decide
what to do.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoutil: Add virSocketAddrSetIPv[46]AddrNetOrder and use it
Martin Kletzander [Fri, 18 Mar 2016 15:34:10 +0000 (16:34 +0100)]
util: Add virSocketAddrSetIPv[46]AddrNetOrder and use it

This allows setting the address in host and/or network order and makes
the naming consistent.  Now you don't need to call [hn]to[nh]l()
functions as that is taken care of by these functions.  Also, now
the *NetOrder take the address in network order, the other functions in
host order so the naming and usage is consistent.  Some places were
having the address in network order and calling ntohl() just so the
original function can call htonl() again.  This makes it nicer to read.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: Don't add -spice port=0 when no port is specified
Christophe Fergeau [Wed, 16 Mar 2016 11:11:58 +0000 (12:11 +0100)]
qemu: Don't add -spice port=0 when no port is specified

If a <graphics type='spice'> has no port nor tlsPort set, the generated
QEMU command line will contain -spice port=0.
This is later going to be ignored by spice-server, but it's better not
to add it at all in this situation.
As an empty -spice is not allowed, we still need to append port=0 if we
did not add any other argument.

9 years agoqemu: Omit SPICE address if no port is specified
Christophe Fergeau [Fri, 11 Mar 2016 17:18:12 +0000 (18:18 +0100)]
qemu: Omit SPICE address if no port is specified

Currently -spice addr=127.0.0.1 is generated, but spice-server is going
to ignore this as no port is specified.

9 years agoqemu: Make all SPICE command-line args optional
Christophe Fergeau [Fri, 11 Mar 2016 17:15:25 +0000 (18:15 +0100)]
qemu: Make all SPICE command-line args optional

The end goal is to avoid adding -spice port=0,addr=127.0.0.1 to QEMU command
line when no SPICE port is specified in libvirt XML.

Currently, the code relies on port=xx to always be present, so subsequent
args can be unconditionally appended with a leading ','. Since port=0
will no longer be added in a subsequent commit, we append a ',' to every
arg instead of prepending, and remove the last one before adding it to
the arg list.

9 years agozfs: Only unencrypted volumes are supported
Richard Laager [Tue, 15 Mar 2016 06:17:36 +0000 (01:17 -0500)]
zfs: Only unencrypted volumes are supported

9 years agozfs: Only raw volumes are supported
Richard Laager [Tue, 15 Mar 2016 06:17:35 +0000 (01:17 -0500)]
zfs: Only raw volumes are supported

9 years agological: Only raw volumes are supported
Richard Laager [Tue, 15 Mar 2016 06:17:34 +0000 (01:17 -0500)]
logical: Only raw volumes are supported

9 years agostorage: Improve code consistency between backends
Richard Laager [Tue, 15 Mar 2016 06:17:33 +0000 (01:17 -0500)]
storage: Improve code consistency between backends

This improves the code consistency around freeing vol->target.path in
createVol implementations.

9 years agosheepdog: Use a consistent error message
Richard Laager [Tue, 15 Mar 2016 06:17:32 +0000 (01:17 -0500)]
sheepdog: Use a consistent error message

This also reduces the number of strings to translate.

9 years agorbd: Use proper error type
Richard Laager [Tue, 15 Mar 2016 06:17:31 +0000 (01:17 -0500)]
rbd: Use proper error type

9 years agodomain: Add virDomainDefAddImplicitDevices
Cole Robinson [Fri, 8 Jan 2016 03:49:58 +0000 (22:49 -0500)]
domain: Add virDomainDefAddImplicitDevices

It's just a combination of AddImplicitControllers, and AddConsoleCompat.
Every caller that wants ImplicitControllers also wants the ConsoleCompat
AFAICT, so lump them together. We also need it for future patches.

9 years agonss: don't try to build nss plugin when disabled
Roman Bogorodskiy [Sat, 19 Mar 2016 16:56:02 +0000 (19:56 +0300)]
nss: don't try to build nss plugin when disabled

Even if nss is disabled, the build system tries to build some
targets like libnss_libvirt_impl.la and nsstest. Hide those
under the "if WITH_NSS" block like the rest of NSS plugin bits.

9 years agobhyve: caps: Log error message when CPU init fails
Cole Robinson [Fri, 18 Mar 2016 22:33:05 +0000 (18:33 -0400)]
bhyve: caps: Log error message when CPU init fails

virBhyveCapsInitCPU will raise a libvirt error; even though we treat
it as non-fatal we should log the actual message.

9 years agodomain: Remove controller/net address whitelists
Cole Robinson [Wed, 6 Jan 2016 20:44:30 +0000 (15:44 -0500)]
domain: Remove controller/net address whitelists

Judging by how the whitelist has skewed quite far from the original
error message, I think it's better to just drop these.

If someone wants to revive this check I suggest implementing it on
a per-HV driver basis with PostParse callbacks.

9 years agonodedev: Expose PCI header type
Martin Kletzander [Tue, 15 Mar 2016 11:22:03 +0000 (12:22 +0100)]
nodedev: Expose PCI header type

If we expose this information, which is one byte in every PCI config
file, we let all mgmt apps know whether the device itself is an endpoint
or not so it's easier for them to decide whether such device can be
passed through into a VM (endpoint) or not (*-bridge).

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agonodedev: Indent PCI express for future fix
Martin Kletzander [Tue, 15 Mar 2016 12:13:48 +0000 (13:13 +0100)]
nodedev: Indent PCI express for future fix

Best viewed with '-w' as this is just an adjustment for future patch to
be readable without that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agotests: Introduce nsslinktest
Michal Privoznik [Thu, 3 Mar 2016 14:29:51 +0000 (15:29 +0100)]
tests: Introduce nsslinktest

The only purpose of this test is to catch possible linking
problems with libnss_libvirt.so.2.
One of the problems I faced was that the NSS plugin was unloaded
immediately after it got loaded and the name resolution process
continued with next configured option. Without any error. It was
very hard to debug why until I created this simple test and found
out immediately that there were some symbols missing. The reason
why problem was not caught in nsstest is that in the test we want
to use all the fancy stuff and therefore link it with libvirt.la.
So even if there's a symbol missing in the NSS plugin it will be
found in the libvirt.la.
But even after I resolved the issue we still need this test
because files the NSS plugin is built from are still live (mostly
those under utils/ dir). So as they change new symbol might be
required which would render the NSS plugin unusable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agonss: Introduce a test
Michal Privoznik [Mon, 15 Feb 2016 13:02:05 +0000 (14:02 +0100)]
nss: Introduce a test

A small test to see how is the nss module working.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoImplement _nss_libvirt_gethostbyname4_r
Michal Privoznik [Sun, 14 Feb 2016 07:13:54 +0000 (08:13 +0100)]
Implement _nss_libvirt_gethostbyname4_r

This function is a different beast compared to previous ones.
But yet again, nothing surprising is happening here.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agonss: Implement _nss_libvirt_gethostbyname3_r
Michal Privoznik [Sun, 14 Feb 2016 10:38:37 +0000 (11:38 +0100)]
nss: Implement _nss_libvirt_gethostbyname3_r

The implementation is pretty straightforward. Moreover, because
of the nature of things, gethostbyname_r and gethostbyname2_r can
be implemented at the same time too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agolibvirt.spec.in: Introduce libvirt-nss package
Michal Privoznik [Tue, 16 Feb 2016 08:41:30 +0000 (09:41 +0100)]
libvirt.spec.in: Introduce libvirt-nss package

Lets put the NSS module into its own package.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoInitial support for NSS plugin skeleton
Michal Privoznik [Sat, 13 Feb 2016 08:27:50 +0000 (09:27 +0100)]
Initial support for NSS plugin skeleton

Name Service Switch is a glibc feature responsible for many
things. Translating domain names into IP addresses and vice versa
is just one of them. However, currently it's the only
functionality that this commit is tickling. Well, in this commit
the plugin skeleton is introduced. Implementation to come in next
patches.
Because of the future testing, where the implementation is to be
linked with a test, this needs to go into static library. Linking
a program with an .so statically is not portable. Therefore a
dummy libnss_libvirt_impl library is being introduced too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirsocketaddr: Introduce virSocketAddrSetIPv6Addr
Michal Privoznik [Tue, 15 Mar 2016 15:35:23 +0000 (16:35 +0100)]
virsocketaddr: Introduce virSocketAddrSetIPv6Addr

This is a missing counterpart for virSocketAddrSetIPv4Addr()
and is going to be needed later in the tests.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirLeaseReadCustomLeaseFile: Allow server_duid to be NULL
Michal Privoznik [Tue, 15 Mar 2016 15:49:37 +0000 (16:49 +0100)]
virLeaseReadCustomLeaseFile: Allow server_duid to be NULL

This function is going to be used later in such context where the
argument makes no sense. Teach this function to cope with that
instead of the caller having to deal with passing some dummy
argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoExport virLease* functions for leases file handling
Michal Privoznik [Sun, 14 Feb 2016 06:50:12 +0000 (07:50 +0100)]
Export virLease* functions for leases file handling

These functions are going to be reused very shortly. So instead
of duplicating the code, lets move them into utils module.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agotests: add schema test for default cache mode
Jim Fehlig [Mon, 14 Mar 2016 22:35:02 +0000 (16:35 -0600)]
tests: add schema test for default cache mode

None of the existing domXML configs under tests/* specify a
default cache mode since default generally means "use the
hypervisor default" and is left unset by the various hypervisor
drivers. Add a config to tests/domainschemadata that specifies
cache='default'.

9 years agotests: add xlconfigdata to domainschematests
Jim Fehlig [Mon, 14 Mar 2016 22:27:41 +0000 (16:27 -0600)]
tests: add xlconfigdata to domainschematests

Include the XML files under tests/xlconfigdata in the domain
schema tests

9 years agoconf: Format disk pool part_separator attribute for running pool
John Ferlan [Thu, 17 Mar 2016 11:29:23 +0000 (07:29 -0400)]
conf: Format disk pool part_separator attribute for running pool

Commit id '4f846170' added printing of a new field 'part_separator';
however, neglected to do so when there was an "freeExtent" defined
for the device (as there would be when the disk pool was started).

This patch adjusts the logic to appropriately format the device path and
if there the part_separator attribute.

9 years agoqemu: Move last error save/restore to qemuBuildNetCommandLine
John Ferlan [Tue, 15 Mar 2016 11:15:30 +0000 (07:15 -0400)]
qemu: Move last error save/restore to qemuBuildNetCommandLine

Commit 'ef2ab8fd' moved just the virDomainConfNWFilterTeardown and left
the logic to save/restore the current error essentially doing nothing
in the error path for qemuBuildCommandLine.  So move it to where it
was meant to be.

Although the original code would reset the filter on command creation
errors after building the network command portion and commit 'ef2ab8fd'
altered that logic, the teardown is called during qemuProcessStop from
virDomainConfVMNWFilterTeardown and that code has the save/restore
last error logic, so just allow that code to handle the teardown rather
than running it twice. The qemuProcessStop would be called in the failure
path of qemuBuildCommandLine.

9 years agotests: Set PATH in each test
Michal Privoznik [Thu, 17 Mar 2016 12:30:42 +0000 (13:30 +0100)]
tests: Set PATH in each test

Currently we spawn couple of binaries in our test suite.
Moreover, we provide some spoofed versions of system binaries
hoping that those will be executed instead of the system ones.
For instance, for testing SSH socket we have written our own ssh
binary for producing predictable results. We certainly don't want
to execute the system ssh binary.
However, in order to prefer our binaries over system ones, we
need to set PATH environment variable. But this is done only at
the Makefile level. So if anybody runs a test by hand that
expects our spoofed binary, the test ends up executing real
system binaries. This is not good. In fact, it's terribly wrong.
The fix lies in a small trick - putting our build directory at
the beginning of the PATH environment variable in each test.
Hopefully, since every test has this VIRT_TEST_MAIN* wrapper, we
can fix this at a single place.
Moreover, while this removes setting PATH for our tests written
in bash, it's safe as we are not calling anything ours that would
require PATH change there.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoDrop paths.h include
Michal Privoznik [Thu, 17 Mar 2016 10:44:01 +0000 (11:44 +0100)]
Drop paths.h include

We include the file in plenty of places. This is mostly due to
historical reasons. The only place that needs something from the
header file is storage_backend_fs which opens _PATH_MOUNTED. But
it gets the file included indirectly via mntent.h. At no other
place in our code we need _PATH_.*. Drop the include and
configure check then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodriver: log missing modules as INFO, not WARN osstest/frozen/xen-4.0-testing osstest/frozen/xen-4.1-testing osstest/frozen/xen-4.2-testing osstest/frozen/xen-4.3-testing
Jovanka Gulicoska [Thu, 17 Mar 2016 19:02:20 +0000 (20:02 +0100)]
driver: log missing modules as INFO, not WARN

Missing modules is a common expected scenario for most libvirt usage on
RPM distributions like Fedora, so it doesn't really warrant logging at
WARN level. Use INFO instead

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

9 years agoadmin: Add virAdmConnectLookupServer
Martin Kletzander [Tue, 1 Mar 2016 16:33:37 +0000 (17:33 +0100)]
admin: Add virAdmConnectLookupServer

It does not have a suffix ByName because there are no other means of
looking up the server and since the name is known, this should be the
preferred one.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: implement setting target disks migration port
Nikolay Shirokovskiy [Thu, 17 Mar 2016 14:58:48 +0000 (17:58 +0300)]
qemu: implement setting target disks migration port

Mostly it is just passing new parameter here and there. In case
of zero value we fallback to auto selecting port and thus keep
backward compatibility.

Also we need to fix places of auto selected port managment.
We should bother only when auto selected was done that is
when externally specified port is not 0.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agomigration: add target peer disks port
Nikolay Shirokovskiy [Thu, 17 Mar 2016 14:58:47 +0000 (17:58 +0300)]
migration: add target peer disks port

Some hypervisors (namely qemu) can have a separate connecton for
non-shared disks migration of active domains. Currently we have
no means to control the port of such a connection. At the same
time we have options to control port of memory migration traffic
(thru migration uri) as well as interfaces that target server
is bound to for incoming migration (thru VIR_MIGRATE_PARAM_LISTEN_ADDRESS).
Let's add the option for setting disks port too.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agodocs: fix libvirt version for vram64 in formatdomain.html.in
Pavel Hrdina [Thu, 17 Mar 2016 14:50:43 +0000 (15:50 +0100)]
docs: fix libvirt version for vram64 in formatdomain.html.in

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agovz: code refactoring
Mikhail Feoktistov [Thu, 17 Mar 2016 10:58:23 +0000 (13:58 +0300)]
vz: code refactoring

In prlsdkAddNet() Attach/DetachNet() functions
privconn should be the first argument

9 years agorpc: wait longer for session daemon to start up
Cole Robinson [Tue, 15 Mar 2016 21:04:32 +0000 (17:04 -0400)]
rpc: wait longer for session daemon to start up

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

We only wait 0.5 seconds for the session daemon to start up and present
its socket, which isn't sufficient for many users. Bump up the sleep
interval and retry amount so we wait for a total of 5.0 seconds.

9 years agovirlog: Fix build breaker with "comparison between signed and unsigned"
Erik Skultety [Wed, 16 Mar 2016 15:22:30 +0000 (16:22 +0100)]
virlog: Fix build breaker with "comparison between signed and unsigned"

Refactor series 0b231195 worked with virLogDestination type which, depending
on the compiler, might be (and probably will be) an unsigned data type.
However, virEnumFromString may return -1 in case of an error. So, when enum
happens to be unsigned, some compilers will naturally complain about foo:
    'if (foo < 0)'

9 years agovz: set default SCSI model
Mikhail Feoktistov [Tue, 15 Mar 2016 07:47:51 +0000 (10:47 +0300)]
vz: set default SCSI model

Each version of virtuozzo supports only one type of SCSI controller
So if we add disk on SCSI bus, we should set SCSI controller model.
We can take it from vzCapabilities structure.

9 years agovz: check supported controllers
Mikhail Feoktistov [Tue, 15 Mar 2016 07:47:50 +0000 (10:47 +0300)]
vz: check supported controllers

Because Vz6 supports SCSI(BUSLOGIC), IDE and SATA controllers only and
Vz7 supports SCSI(VIRTIO_SCSI) and IDE only we add list of supported
controllers and scsi models to vzCapabilities structure.
When a new  connection opens, we select proper capabilities values according
to Virtuozzo version and check them in XMLPostParse.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
9 years agovz: report correct disk format in domainGetXMLDesc
Mikhail Feoktistov [Tue, 15 Mar 2016 07:47:49 +0000 (10:47 +0300)]
vz: report correct disk format in domainGetXMLDesc

We should report correct disk format depending on vz version and domain type.
Since we support only one disk format for each domain type, we can take it
from vzCapabilities structure.

9 years agovz: move prlsdkCheckDiskUnsupportedParams to vz_utils.c
Maxim Nestratov [Wed, 16 Mar 2016 11:55:27 +0000 (14:55 +0300)]
vz: move prlsdkCheckDiskUnsupportedParams to vz_utils.c

As long as we have another function checking disk parameters correctness,
let's have them in one place. Here we change prefix of the moved function and
start to call it from vzCheckUnsupportedDisks rather than add disk.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
9 years agovz: check supported disk format and bus
Mikhail Feoktistov [Tue, 15 Mar 2016 07:47:48 +0000 (10:47 +0300)]
vz: check supported disk format and bus

Now we check disk parameters correctness in DomainPostParse.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
9 years agovz: add vzCapabilities to connection structure
Mikhail Feoktistov [Tue, 15 Mar 2016 07:47:47 +0000 (10:47 +0300)]
vz: add vzCapabilities to connection structure

As far as Virtuozzo6 and Virtuozzo7 support different disk types for virtual
machines (ploop and qcow2 respectively) and different buses (vz6: IDE, SCSI,
SATA; vz7: IDE SCSI) we add vzCapabilities structure to help undestand which
disk formats and buses are supported in the context of a current connection.

When a new connection opens, we select proper capabilities in accordance to
current Virtuozzo version.

9 years agovz: save vz version in connection structure
Mikhail Feoktistov [Tue, 15 Mar 2016 07:47:46 +0000 (10:47 +0300)]
vz: save vz version in connection structure

Move code from connectGetVersion callback to vzInitVersion function

9 years agovirlog: Refactor virLogParseOutputs
Erik Skultety [Tue, 15 Mar 2016 21:15:02 +0000 (22:15 +0100)]
virlog: Refactor virLogParseOutputs

The problem with the original virLogParseOutputs method was that the way it
parsed the input, walking the string char by char and using absolute jumps
depending on the virLogDestination type, was rather complicated to read.
This patch utilizes virStringSplit method twice, first time to filter out any
spaces and split the input to individual log outputs and then for each
individual output to tokenize it by to the parts according to our
PRIORITY:DESTINATION?(:DATA) format. Also, to STREQLEN for matching destination
was replaced with virDestinationTypeFromString call.

9 years agovirlog: Introduce Type{To,From}String for virLogDestination
Erik Skultety [Tue, 15 Mar 2016 20:35:17 +0000 (21:35 +0100)]
virlog: Introduce Type{To,From}String for virLogDestination

In order to refactor the ugly virLogParseOutputs method, this is a neat way of
finding out whether the destination type (in the form of a string) user
provided is a valid one. As a bonus, if it turns out it is valid, we get the
actual enum which will later be passed to any of virLogAddOutput methods right
away.

9 years agotests: Add a new test for logging outputs parser
Erik Skultety [Wed, 16 Mar 2016 09:58:32 +0000 (10:58 +0100)]
tests: Add a new test for logging outputs parser

Test for parser's functionality.

9 years agotests: Slightly tweak virlogtest
Erik Skultety [Wed, 16 Mar 2016 09:55:38 +0000 (10:55 +0100)]
tests: Slightly tweak virlogtest

Patch adds a generic DO_TEST_FULL macro, some PASS/FAIL macros to better
visually distinguish tests that should fail and tests that should pass. Also,
some cosmetic changes like renames and direct call to fprintf is replaced with
our VIR_TEST_DEBUG macro, as using testutils should be our preferred way of
reporting errors in tests.

9 years agonodedev: Shorten match condition
Martin Kletzander [Mon, 14 Mar 2016 15:47:51 +0000 (16:47 +0100)]
nodedev: Shorten match condition

Just a cleanup I stumbled upon in one of my older branches I did when
browsing through some code and forgot to send it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: Don't access uninitialized memory
Martin Kletzander [Fri, 11 Mar 2016 13:21:56 +0000 (14:21 +0100)]
qemu: Don't access uninitialized memory

In qemuConnectDomainXMLToNative() we set up the monitor, but we never
memset() it to zeros.  Thanks to the introduction of the logfile
parameter of chardevs (and the logfile member of the struct), we started
checking whether that's non-NULL and that exposed this old error.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: Don't overwrite DomainSave errors
Cole Robinson [Tue, 15 Mar 2016 19:24:10 +0000 (15:24 -0400)]
qemu: Don't overwrite DomainSave errors

These functions already report fine grained errors, there's no
benefit to overwriting the error here.

9 years agoqemuDomainRevertToSnapshot: save domain configuration
Dmitry Andreev [Sat, 12 Mar 2016 15:39:36 +0000 (18:39 +0300)]
qemuDomainRevertToSnapshot: save domain configuration

Reverting to a snapshot may change domain configuration. New
configuration should be saved if domain has persistent flag.

VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT is emitted in case of
configuration update.

9 years agoIntroduce new VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT sub-event
Dmitry Andreev [Sat, 12 Mar 2016 15:39:35 +0000 (18:39 +0300)]
Introduce new VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT sub-event

VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT event should be emitted
when domain configuration was changed on revert to snapshot.

9 years agoqemu: Introduce qemuBuildPanicCommandLine
John Ferlan [Sat, 12 Mar 2016 00:36:29 +0000 (19:36 -0500)]
qemu: Introduce qemuBuildPanicCommandLine

Add new function to manage adding the panic device options to the
command line removing that task from the mainline qemuBuildCommandLine.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildNVRAMCommandLine
John Ferlan [Sat, 12 Mar 2016 00:36:28 +0000 (19:36 -0500)]
qemu: Introduce qemuBuildNVRAMCommandLine

Add new function to manage adding the NVRAM device options to the
command line removing that task from the mainline qemuBuildCommandLine.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildRNGCommandLine
John Ferlan [Sat, 12 Mar 2016 00:36:27 +0000 (19:36 -0500)]
qemu: Introduce qemuBuildRNGCommandLine

Add new function to manage adding the RNG device options to the
command line removing that task from the mainline qemuBuildCommandLine.

Also modify the qemuBuildRNGDevStr to use const virDomainDef instead
of virDomainDefPtr.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildMemballoonCommandLine
John Ferlan [Sat, 12 Mar 2016 00:36:26 +0000 (19:36 -0500)]
qemu: Introduce qemuBuildMemballoonCommandLine

Add new function to manage adding the memballoon device options to the
command line removing that task from the mainline qemuBuildCommandLine.

Also modify the qemuBuildMemballoonDevStr to use const virDomainDef
instead of virDomainDefPtr.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildHostdevCommandLine
John Ferlan [Sat, 12 Mar 2016 00:36:25 +0000 (19:36 -0500)]
qemu: Introduce qemuBuildHostdevCommandLine

Add new function to manage adding the host device options to the
command line removing that task from the mainline qemuBuildCommandLine.

Also modify qemuBuildPCIHostdevDevStr, qemuBuildUSBHostdevDevStr,
and qemuBuildSCSIHostdevDevStr to use const virDomainDef instead
of virDomainDefPtr.

Make qemuBuildPCIHostdevPCIDevStr and qemuBuildUSBHostdevUSBDevStr
static to the qemu_command.c.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildRedirdevCommandLine
John Ferlan [Sat, 12 Mar 2016 00:36:24 +0000 (19:36 -0500)]
qemu: Introduce qemuBuildRedirdevCommandLine

Add new function to manage adding the redirdev device options to the
command line removing that task from the mainline qemuBuildCommandLine.

Also move the qemuBuildRedirdevDevStr closer to the new function and
modify to use the const virDomainDef instead of virDomainDefPtr

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildWatchdogCommandLine
John Ferlan [Sat, 12 Mar 2016 00:36:23 +0000 (19:36 -0500)]
qemu: Introduce qemuBuildWatchdogCommandLine

Add new function to manage adding the watchdog device options to the
command line removing that task from the mainline qemuBuildCommandLine.

Also since qemuBuildWatchdogDevStr was only local here, make it static as
well as modifying the const virDomainDef.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildSoundCommandLine
John Ferlan [Sat, 12 Mar 2016 00:36:22 +0000 (19:36 -0500)]
qemu: Introduce qemuBuildSoundCommandLine

Add new function to manage adding the sound device options to the
command line removing that task from the mainline qemuBuildCommandLine.

Also since qemuBuildSoundDevStr was only local here, make it static as
well as modifying the const virDomainDef.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agohostdev: Add more comments
Andrea Bolognani [Mon, 7 Mar 2016 12:41:19 +0000 (13:41 +0100)]
hostdev: Add more comments

These comments explain the difference between a virPCIDevice
instance used for lookups and an actual device instance; some
information is also provided for specific uses.

9 years agohostdev: Use consistent variable names
Andrea Bolognani [Wed, 24 Feb 2016 13:59:25 +0000 (14:59 +0100)]
hostdev: Use consistent variable names

This is not just a cosmetic change: the name of the variable now
gives a hint about what it is supposed to be used for.