]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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>
9 years agodocs: generic.css: Indentation and spacing tweaks
Cole Robinson [Thu, 10 Mar 2016 01:57:59 +0000 (20:57 -0500)]
docs: generic.css: Indentation and spacing tweaks

- Add line-height:150% spacing for all text. This makes text lines far
  less cramped, and seems closer visually to what wikipedia uses.

- Remove bottom and top margin from lists: entries seemed needlessly
  spread out.

- Reduce sublist indentation a bit

- Add a bottom border after headings: IMO this greatly helps in break
  up the vertical flow of a big page of text. Doesn't look great on the
  front page, but helps a lot on dense pages like formatdomain

9 years agodocs: generic.css: font size tweaks
Cole Robinson [Thu, 10 Mar 2016 01:53:58 +0000 (20:53 -0500)]
docs: generic.css: font size tweaks

- change font-family to just 'sans-serif' rather than hardcode a few
  font families. this means we abide the user's browser font setting,
  and makes us consistent with other sites like en.wikipedia.org
- raise font-size to 90%. this is what en.wikipedia.org uses.

With these two tweaks, libvirt.org text renders the same as
en.wikipedia.org with fedora firefox out of the box config. Previously
the font on libvirt.org was very small and difficult to read.

9 years agodocs: generic.css: minor cleanups
Cole Robinson [Thu, 10 Mar 2016 01:42:26 +0000 (20:42 -0500)]
docs: generic.css: minor cleanups

- Drop some redundant bits
- Use consistent spacing
- Group similar blocks near each other

There should be no functional change

9 years agodocs: website: Remove the et.redhat.com footer
Cole Robinson [Thu, 10 Mar 2016 01:35:37 +0000 (20:35 -0500)]
docs: website: Remove the et.redhat.com footer

This is long since obsolete, just scrap it all

9 years agoqemu: support use of virtlogd with file based chardevs
Daniel P. Berrange [Tue, 23 Feb 2016 13:41:57 +0000 (13:41 +0000)]
qemu: support use of virtlogd with file based chardevs

Currently the file based character devices let QEMU write
directly to a file on disk. This allows a malicious QEMU
to inflict a denial of service by consuming all free space.

Switch QEMU to use a pipe to virtlogd, which will enforce
file rollover.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoqemu: use virtlogd for character device log files
Daniel P. Berrange [Tue, 23 Feb 2016 13:05:09 +0000 (13:05 +0000)]
qemu: use virtlogd for character device log files

If use of virtlogd is enabled, then use it for backing the
character device log files too. This avoids the possibility
of a guest denial of service by writing too much data to
the log file.

9 years agologging: support truncation of logfiles when opening
Daniel P. Berrange [Mon, 29 Feb 2016 12:26:02 +0000 (12:26 +0000)]
logging: support truncation of logfiles when opening

The virtlogd daemon currently opens all files for append, but
in some cases the user may wish to discard existing data. Define
a new flag to indicate that logfiles should be truncated when
opening.

9 years agoqemu: move functions for handling FD passing
Daniel P. Berrange [Mon, 29 Feb 2016 12:24:40 +0000 (12:24 +0000)]
qemu: move functions for handling FD passing

The functions for handling FD passing when building command line
arguments need to be used by many different bits of code, so need
to be at the start of the source file

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoqemu: don't append -chardev arg until after value is formatted
Daniel P. Berrange [Mon, 29 Feb 2016 12:21:14 +0000 (12:21 +0000)]
qemu: don't append -chardev arg until after value is formatted

The act of formatting a chardev backend value may need to
append command line arguments for passing FDs. If we append
the -chardev arg before formatting the value, then the
resulting arguments will end up interspersed

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoqemu: add support for logging chardev output to a file
Daniel P. Berrange [Tue, 23 Feb 2016 11:56:34 +0000 (11:56 +0000)]
qemu: add support for logging chardev output to a file

Honour the <log file='...'/> element in chardevs to output
data to a file. This requires QEMU >= 2.6

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoconf: allow use of a logfile with chardev backends
Daniel P. Berrange [Fri, 11 Dec 2015 16:58:13 +0000 (16:58 +0000)]
conf: allow use of a logfile with chardev backends

Extend the chardev source XML so that there is a new optional
<log/> element, which is applicable to all character device
backend types. For example, to log output of a TCP backed
serial port

    <serial type='tcp'>
      <source mode='connect' host='127.0.0.1' service='9999'/>
      <protocol type='raw'/>
      <log file='/var/log/libvirt/qemu/demo-serial0.log' append='on'/>
      <target port='0'/>
    </serial>

Not all hypervisors will support use of logfiles.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agologging: allow inode/offset params to be NULL
Daniel P. Berrange [Fri, 11 Dec 2015 10:58:29 +0000 (10:58 +0000)]
logging: allow inode/offset params to be NULL

Not all callers of virLogManagerDomainOpenLogFile will
care about getting the current inode/offset, so we should
allow those parameters to be NULL

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoqemu: cpu: Don't remove pinning of cold-unplugged cpu
Peter Krempa [Thu, 10 Mar 2016 08:37:08 +0000 (09:37 +0100)]
qemu: cpu: Don't remove pinning of cold-unplugged cpu

After adding support for offline vcpu pinning the code that removes the
pinning for cpu cold-unplug was forgotten. This fixes up commit 02ae21d

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

9 years agoqemu: Fix memory leak in qemuGetSchedInfo
Peter Krempa [Thu, 10 Mar 2016 08:57:13 +0000 (09:57 +0100)]
qemu: Fix memory leak in qemuGetSchedInfo

Memory returned from virStringSplit shall be freed with
virStringFreeList rather than VIR_FREE. Introduced in commit 511e7c5b.

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

9 years agoconf: Fix off-by-one in virDomainDefGetVcpu
Peter Krempa [Thu, 10 Mar 2016 08:46:53 +0000 (09:46 +0100)]
conf: Fix off-by-one in virDomainDefGetVcpu

Cpus are indexed starting from '0' so the check was invalid.

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

9 years agoqemu: Refactor bitmap handling in qemuDomainPinVcpuFlags
Peter Krempa [Tue, 23 Feb 2016 18:15:01 +0000 (19:15 +0100)]
qemu: Refactor bitmap handling in qemuDomainPinVcpuFlags

Now that the function was extracted we can get rid of some temp
variables. Additionally formatting of the bitmap string for the event
code should be checked.

9 years agoqemu: vcpupin: Extract live vcpupin setting into a separate function
Peter Krempa [Tue, 23 Feb 2016 12:41:43 +0000 (13:41 +0100)]
qemu: vcpupin: Extract live vcpupin setting into a separate function

The function was now beyond maintainability.

9 years agoutil: virfile: Only setuid for virFileRemove if on NFS
Cole Robinson [Wed, 9 Mar 2016 17:20:37 +0000 (12:20 -0500)]
util: virfile: Only setuid for virFileRemove if on NFS

NFS with root-squash is the only reason we need to do setuid/setgid
crazyness in virFileRemove, so limit that behavior to the NFS case.

9 years agoutil: virfile: Clarify setuid usage for virFileRemove
Cole Robinson [Wed, 9 Mar 2016 15:53:54 +0000 (10:53 -0500)]
util: virfile: Clarify setuid usage for virFileRemove

Break these checks out into their own function, and clearly document
each one. This shouldn't change behavior

9 years agoqemu: add support for offline vcpupin
Peter Krempa [Fri, 12 Feb 2016 13:57:45 +0000 (14:57 +0100)]
qemu: add support for offline vcpupin

Allow pinning for inactive vcpus. The pinning mask will be automatically
applied as we would apply the default mask in case of a cpu hotplug.

Setting the scheduler settings for a vcpu has the same semantics.

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

9 years agoconf: extract ignoring of inactive vcpu pinning information
Peter Krempa [Tue, 23 Feb 2016 11:35:40 +0000 (12:35 +0100)]
conf: extract ignoring of inactive vcpu pinning information

Introduce VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN domain feature flag
whcih will allow to skip ignoring of the pinning information for
hypervisor drivers which will want to implement forward-pinning of
vcpus.

9 years agoconf: refactor checking for unsupported memory devices
Peter Krempa [Tue, 23 Feb 2016 09:58:10 +0000 (10:58 +0100)]
conf: refactor checking for unsupported memory devices

Introduce a helper to check supported device and domain config and move
the memory hotplug checks to it.

The advantage of this approach is that by default all new features are
considered unsupported by all hypervisors unless specifically changed
rather than the previous approach where every hypervisor would need to
declare that a given feature is unsupported.

9 years agoconf: introduce parser feature flags
Peter Krempa [Tue, 23 Feb 2016 09:32:19 +0000 (10:32 +0100)]
conf: introduce parser feature flags

To avoid having to forbid new features added to domain XML in post parse
callbacks for individual hypervisor drivers the feature flag mechanism
will allow to add a central check that will be disabled for the drivers
that will add support.

As a first example flag, the 'hasWideSCSIBus' is converted to the new
bitmap.

9 years agoqemu: Report pinning for all vCPUs in qemuDomainGetVcpuPinInfo
Peter Krempa [Fri, 12 Feb 2016 13:57:41 +0000 (14:57 +0100)]
qemu: Report pinning for all vCPUs in qemuDomainGetVcpuPinInfo

The API documentation states that the function is returning pinning for
all vCPUs, so we can actually do so if the user passes a large enough
array.