]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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.

9 years agohostdev: Remove virHostdevGetActivePCIHostDeviceList()
Andrea Bolognani [Wed, 24 Feb 2016 12:37:44 +0000 (13:37 +0100)]
hostdev: Remove virHostdevGetActivePCIHostDeviceList()

virHostdevGetPCIHostDeviceList() is similar but does not filter out
devices that are not in the active list; that said, we are looking
up the device in the active list just a few lines after anyway, so
we might as well just keep a single function around.

This also helps stress the fact the objects contained in pcidevs are
only for looking up the actual devices, which is something later
commits will make even more explicit.

9 years agoschema: support 'default' cache mode
Jim Fehlig [Mon, 29 Feb 2016 23:25:38 +0000 (16:25 -0700)]
schema: support 'default' cache mode

The docs claims the cache attribute of the disk <driver>
element supports 'default' as one of its permissible values,
but such configuration fails virt-xml-validate. Add 'default'
as one of the cache attribute choices in domaincommon.rng.

9 years agohostdev: Rename usesVfio -> usesVFIO
Andrea Bolognani [Tue, 1 Mar 2016 19:13:20 +0000 (20:13 +0100)]
hostdev: Rename usesVfio -> usesVFIO

Acronyms should be written in all caps.

9 years agohostdev: Rename hostdev_mgr -> mgr
Andrea Bolognani [Tue, 1 Mar 2016 18:53:37 +0000 (19:53 +0100)]
hostdev: Rename hostdev_mgr -> mgr

We're in the hostdev module, so mgr is not an ambiguous name, and
in fact it's already used in some cases. Switch all the code over.

Take the chance to shorten declaration of
virHostdevIsPCINodeDeviceUsedData structures.

9 years agohostdev: Look up devices using IDs when possible
Andrea Bolognani [Tue, 23 Feb 2016 16:46:48 +0000 (17:46 +0100)]
hostdev: Look up devices using IDs when possible

When we want to look up a device in a device list and we already
have the IDs from another source, we can simply use
virPCIDeviceListFindByIDs() instead of creating a temporary device
object.

9 years agohostdev: Change argument order for virHostdevReattachPCIDevice()
Andrea Bolognani [Mon, 7 Mar 2016 13:27:23 +0000 (14:27 +0100)]
hostdev: Change argument order for virHostdevReattachPCIDevice()

The new order aligns better with the virHostdev prefix.

9 years agohostdev: virHostdevIsPCINetDevice() should return a bool
Andrea Bolognani [Thu, 25 Feb 2016 14:39:25 +0000 (15:39 +0100)]
hostdev: virHostdevIsPCINetDevice() should return a bool

The only possible return values are true and false, so the return
type should be bool instead of int.

9 years agohostdev: Rework resetvfnetconfig loop condition
Andrea Bolognani [Thu, 25 Feb 2016 18:04:30 +0000 (19:04 +0100)]
hostdev: Rework resetvfnetconfig loop condition

If 'last_processed_hostdev_vf != -1' is false then, since the
loop counter 'i' starts at 0, 'i <= last_processed_hostdev_vf'
can't possibly be true and the loop body will never be executed.

However, since 'i' is unsigned and 'last_processed_hostdev_vf'
is signed, we can't just get rid of the check completely; what
we can do is move it outside of the loop to avoid checking its
value on every iteration and cluttering the actual loop
condition.

9 years agovz: fix active domain listing
Maxim Nestratov [Fri, 11 Mar 2016 08:36:17 +0000 (11:36 +0300)]
vz: fix active domain listing

Since commit 9c14a9ab we have broken active domain listing
because reworked prlsdkLoadDomain doesn't set dom->def->id
propely. It just looses it when a new def structure is set.
Now we make prlsdkConvertDomainState function return void
and move calling it after an old dom->def is replaces with
a new one within prlsdkLoadDomain function.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
9 years agoqemuBuildVideoCommandLine: Don't access def->videos without check
Michal Privoznik [Mon, 14 Mar 2016 08:34:43 +0000 (09:34 +0100)]
qemuBuildVideoCommandLine: Don't access def->videos without check

This function can be called over a domain definition that has no
video configured. The
tests/qemuxml2argvdata/qemuxml2argv-minimal.xml file could serve
as an example. Problem is, before the check that domain has some
or none video configured, def->videos is dereferenced causing a
segmentation fault in case there's none video configured.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Introduce qemuBuildVideoCommandLine
John Ferlan [Thu, 18 Feb 2016 16:32:25 +0000 (11:32 -0500)]
qemu: Introduce qemuBuildVideoCommandLine

Add new function to manage adding the video 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 qemuBuildInputCommandLine
John Ferlan [Thu, 18 Feb 2016 16:27:10 +0000 (11:27 -0500)]
qemu: Introduce qemuBuildInputCommandLine

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

Make qemuBuildUSBInputDevStr static since only this module calls it.

Also the change to use const virDomainDef forces other changes.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Modify qemuBuildTPMCommandLine
John Ferlan [Thu, 18 Feb 2016 16:18:49 +0000 (11:18 -0500)]
qemu: Modify qemuBuildTPMCommandLine

Modify the argument order and types to match other similar helpers.

Also modify called functions to use the def->emulator instead of passing
def->emulator and def.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildConsoleCommandLine
John Ferlan [Thu, 18 Feb 2016 16:09:17 +0000 (11:09 -0500)]
qemu: Introduce qemuBuildConsoleCommandLine

Add new function to manage adding the console 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 qemuBuildChannelsCommandLine
John Ferlan [Thu, 18 Feb 2016 16:05:27 +0000 (11:05 -0500)]
qemu: Introduce qemuBuildChannelsCommandLine

Add new function to manage adding the channel 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 qemuBuildParallelsCommandLine
John Ferlan [Thu, 18 Feb 2016 15:58:06 +0000 (10:58 -0500)]
qemu: Introduce qemuBuildParallelsCommandLine

Add new function to manage adding the parallels device options to the
command line removing that task from the mainline qemuBuildCommandLine.
Alter logic slight to reduce indention level.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildSerialCommandLine
John Ferlan [Thu, 18 Feb 2016 15:46:48 +0000 (10:46 -0500)]
qemu: Introduce qemuBuildSerialCommandLine

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

Using const virDomainDef causes collateral damage in other called APIs
which need to make the similar adjustment

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildSmartcardCommandLine
John Ferlan [Thu, 18 Feb 2016 15:38:29 +0000 (10:38 -0500)]
qemu: Introduce qemuBuildSmartcardCommandLine

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

Alter the logic slightly to make !nsmartcards check first so that remainder
of the code is less indented.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agogendispatch: Use proper error for limit checking
Martin Kletzander [Thu, 10 Mar 2016 14:25:52 +0000 (15:25 +0100)]
gendispatch: Use proper error for limit checking

All other places use VIR_ERR_RPC except this one, let's be consistent,
shall we?

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agovirt-admin: Don't tell everyone needlessly we're connected
Martin Kletzander [Thu, 10 Mar 2016 05:34:03 +0000 (06:34 +0100)]
virt-admin: Don't tell everyone needlessly we're connected

There are cases when we don't want to tell the user we are connected.
That's for example when we first connect to the server without the
command 'connect' itself.  That helps to clear out output of first
command, mainly when running non-interactively.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoremote: Generate what's possible
Martin Kletzander [Wed, 9 Mar 2016 12:33:56 +0000 (13:33 +0100)]
remote: Generate what's possible

Since gendisplatch can now generate "modern" *ListAll* functions, let
them all be generated.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agogendispatch: Support modern listing of more types
Martin Kletzander [Wed, 9 Mar 2016 12:32:55 +0000 (13:32 +0100)]
gendispatch: Support modern listing of more types

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agogendispatch: Remember the name of snapshot variable name
Martin Kletzander [Wed, 9 Mar 2016 19:38:06 +0000 (20:38 +0100)]
gendispatch: Remember the name of snapshot variable name

Until now, the script assumed that snapshot name is 'snap', but that's
going to change.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agogendispatch: Accept server as an argument
Martin Kletzander [Wed, 9 Mar 2016 12:40:27 +0000 (13:40 +0100)]
gendispatch: Accept server as an argument

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoadmin: Generate ConnectListServers dispatch helpers
Martin Kletzander [Wed, 2 Mar 2016 14:32:55 +0000 (15:32 +0100)]
admin: Generate ConnectListServers dispatch helpers

Since we have the opportunity now, let's save some precious code lines.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agogendispatch: Be able to generate multi-return values
Martin Kletzander [Tue, 1 Mar 2016 16:35:28 +0000 (17:35 +0100)]
gendispatch: Be able to generate multi-return values

Let's call it modern_ret_as_list as opposed to single_ret_as_list.  The
latter was able to return list of things.  However the new, more modern,
version came and it is used since listAllDomains till nowadays in
ListServers.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agogendispatch: Cluster, don't capture if not needed
Martin Kletzander [Wed, 9 Mar 2016 20:51:56 +0000 (21:51 +0100)]
gendispatch: Cluster, don't capture if not needed

We were using parentheses for grouping admin|remote even though we didn't
need to capture what's in it.  That caused some changes to be greater
than needed and, to be honest, some confusion as well.  Let's use it as
it should be used.  It'll also make future changes more consistent.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoadmin: Be consistent when resetting errors
Martin Kletzander [Wed, 2 Mar 2016 15:29:11 +0000 (16:29 +0100)]
admin: Be consistent when resetting errors

Resetting an error should be the first thing public API does.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agovirt-admin: Don't leak uri in cmdSrvList
Martin Kletzander [Tue, 1 Mar 2016 16:36:55 +0000 (17:36 +0100)]
virt-admin: Don't leak uri in cmdSrvList

virAdmConnectGetURI() returns string that needs to be free()'d but we
haven't done that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoadmin: Don't use priority for admin APIs
Martin Kletzander [Tue, 1 Mar 2016 16:34:19 +0000 (17:34 +0100)]
admin: Don't use priority for admin APIs

There are no priority workers as they don't make sense for now.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoChange virNetDaemonGetServerNames to virNetDaemonGetServers
Martin Kletzander [Tue, 1 Mar 2016 15:28:58 +0000 (16:28 +0100)]
Change virNetDaemonGetServerNames to virNetDaemonGetServers

For now it does not matter which ones we return as the code is similarly
complex, however it will fit in with other constructs in the future,
mainly when we will be able to generate dispatch helpers.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoadmin: Do not work with virAdm on the server side
Martin Kletzander [Tue, 1 Mar 2016 14:31:18 +0000 (15:31 +0100)]
admin: Do not work with virAdm on the server side

virAdm is prefix only used on the client side.  Or at least for now.  On
server, though, this corresponds to virNet structures (virAdmConnect is
virNetDaemon, virAdmServer should be virNetServer, in the future
virAdmClient will be resolved to virNetServerClient, and so on).

This will also make future work clearer and easier.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoExpose virNetServerGetName
Martin Kletzander [Tue, 1 Mar 2016 15:26:32 +0000 (16:26 +0100)]
Expose virNetServerGetName

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agodaemon: Properly check for clients
Martin Kletzander [Tue, 1 Mar 2016 14:42:32 +0000 (15:42 +0100)]
daemon: Properly check for clients

virHashForEach() returns 0 if everything went nice, so our session
daemon was timing out even when there was a client connected.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agodaemon: Set error for unknown server name
Martin Kletzander [Tue, 1 Mar 2016 14:41:43 +0000 (15:41 +0100)]
daemon: Set error for unknown server name

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agovirerror: Introduce new error type NO_SERVER
Martin Kletzander [Tue, 8 Mar 2016 16:22:46 +0000 (17:22 +0100)]
virerror: Introduce new error type NO_SERVER

This serves the same purpose as VIR_ERR_NO_xxx where xxx is any object
that API can be called upon.  Only this particular one is used for
daemon's servers.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agodaemon: Get server name from the server itself
Martin Kletzander [Tue, 1 Mar 2016 14:40:31 +0000 (15:40 +0100)]
daemon: Get server name from the server itself

Since servers know their name, there is no need to supply such
information twice.  Also defeats inconsistencies.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoserver: Store server name in server object
Martin Kletzander [Tue, 1 Mar 2016 14:34:15 +0000 (15:34 +0100)]
server: Store server name in server object

At first I did not want to do this, but after trying to implement some
newer feaures in the admin API I realized we need that to make our lives
easier.  On the other hand they are not saved redundantly and the
virNetServer objects are still kept in a hash table.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoadmin: Check for flags properly
Martin Kletzander [Tue, 1 Mar 2016 14:03:04 +0000 (15:03 +0100)]
admin: Check for flags properly

Function virAdmConnectListServers() forgot to check for flags at all,
virAdmConnectOpen() on the other hand checked them but did no dispatch
the error.  virCheckFlags() should be used only when there should be no
other thing done after erroring out and since they are used on different
places then just public API, they cannot dispatch errors.  So let's use
virCheckFlagsGoto instead.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoadmin: Make virAdmServerFree() handle NULL gracefully
Martin Kletzander [Tue, 1 Mar 2016 13:56:12 +0000 (14:56 +0100)]
admin: Make virAdmServerFree() handle NULL gracefully

We don't want to end up like with virDomainFree() and other, right?

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: Introduce qemuBuildNetCommandLine
John Ferlan [Thu, 18 Feb 2016 15:32:07 +0000 (10:32 -0500)]
qemu: Introduce qemuBuildNetCommandLine

Add new function to manage adding the network 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 qemuBuildFSDevCommandLine
John Ferlan [Thu, 18 Feb 2016 15:06:14 +0000 (10:06 -0500)]
qemu: Introduce qemuBuildFSDevCommandLine

Add new function to manage adding the -fsdev options to the
command line removing that task from the mainline qemuBuildCommandLine.
Alter the code slightly to perform the !caps and fsdev failure check
up front.

Since both qemuBuildFSStr and qemuBuildFSDevStr are local, make them
static and fix their prototypes to use the const virDomainDef as well.
Make some minor formatting changes for long lines.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildDiskDriveCommandLine
John Ferlan [Thu, 18 Feb 2016 14:56:10 +0000 (09:56 -0500)]
qemu: Introduce qemuBuildDiskDriveCommandLine

Add new function to manage adding the disk -drive options to the
command line removing that task from the mainline qemuBuildCommandLine.

Also since using const virDomainDef in new function, that means other
functions called needed to change their usage.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildHubCommandLine
John Ferlan [Thu, 18 Feb 2016 14:30:28 +0000 (09:30 -0500)]
qemu: Introduce qemuBuildHubCommandLine

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

Also make qemuBuildHubDevStr static to the module since it's only
used here.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildControllerDevCommandLine
John Ferlan [Thu, 18 Feb 2016 13:33:39 +0000 (08:33 -0500)]
qemu: Introduce qemuBuildControllerDevCommandLine

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

Also adjust to using const virDomainDef instead of virDomainDefPtr.
This causes collateral damage in order to modify called APIs to use
the const virDomainDef instead as well.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildGlobalControllerCommandLine
John Ferlan [Thu, 18 Feb 2016 13:18:18 +0000 (08:18 -0500)]
qemu: Introduce qemuBuildGlobalControllerCommandLine

Add new function to manage adding the -global controller options to
the command line removing that task from the mainline qemuBuildCommandLine.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildBootCommandLine
John Ferlan [Thu, 18 Feb 2016 13:15:10 +0000 (08:15 -0500)]
qemu: Introduce qemuBuildBootCommandLine

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

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildPMCommandLine
John Ferlan [Thu, 18 Feb 2016 13:06:17 +0000 (08:06 -0500)]
qemu: Introduce qemuBuildPMCommandLine

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

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildClockCommandLine
John Ferlan [Thu, 18 Feb 2016 11:42:45 +0000 (06:42 -0500)]
qemu: Introduce qemuBuildClockCommandLine

Add new function to manage adding the '-clock' options to the command
line removing that task from the mainline qemuBuildCommandLine.

Also includes some minor formatting cleanups.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: enable debug threads
Marc-André Lureau [Thu, 10 Mar 2016 19:46:39 +0000 (20:46 +0100)]
qemu: enable debug threads

When debug-threads is enabled, individual threads are given a separate
name (on Linux)

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

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: check for debug-threads capability
Marc-André Lureau [Thu, 10 Mar 2016 19:46:38 +0000 (20:46 +0100)]
qemu: check for debug-threads capability

QEMU (somewhere around 2.0) added a new sub-option to the -name flag
-name debug-threads=on.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agolibxl_conf: reuse virDomainNetGetActualtype in libxlMakeNicList
Chunyan Liu [Thu, 10 Mar 2016 02:50:41 +0000 (10:50 +0800)]
libxl_conf: reuse virDomainNetGetActualtype in libxlMakeNicList

Reuse existing helper function virDomainNetGetActualtype.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoqemuxml2argvtest: Fix monitor path in serial-file-log
Jiri Denemark [Thu, 10 Mar 2016 17:54:59 +0000 (18:54 +0100)]
qemuxml2argvtest: Fix monitor path in serial-file-log

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>