Commit Graph

16162 Commits

Author SHA1 Message Date
Andrea Bolognani
e57e9413ac hostdev: Change argument order for virHostdevReattachPCIDevice()
The new order aligns better with the virHostdev prefix.
2016-03-14 14:55:47 +01:00
Andrea Bolognani
5ce91139da 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.
2016-03-14 14:55:47 +01:00
Andrea Bolognani
2ec4664b1e 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.
2016-03-14 14:55:47 +01:00
Maxim Nestratov
8a74498721 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>
2016-03-14 15:12:10 +03:00
Michal Privoznik
2e70af12f2 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>
2016-03-14 09:34:43 +01:00
John Ferlan
95ca4fe2f2 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>
2016-03-11 19:23:46 -05:00
John Ferlan
60b1ff52f5 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>
2016-03-11 19:23:46 -05:00
John Ferlan
9de54baf26 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>
2016-03-11 19:23:46 -05:00
John Ferlan
e6944a529e 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>
2016-03-11 19:23:46 -05:00
John Ferlan
3cdcc910a0 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>
2016-03-11 19:23:46 -05:00
John Ferlan
0e1e7ade29 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>
2016-03-11 19:23:46 -05:00
John Ferlan
5ab86400bf 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>
2016-03-11 19:23:46 -05:00
John Ferlan
858bafebbf 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>
2016-03-11 19:23:45 -05:00
Martin Kletzander
eeb1e6fe9f 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
42b85f173d 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
5b7d09804c gendispatch: Support modern listing of more types
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-03-11 12:58:41 +01:00
Martin Kletzander
576c54f9b1 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
1cefc14f69 gendispatch: Accept server as an argument
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-03-11 12:58:41 +01:00
Martin Kletzander
d949280c72 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
6de2ef5d35 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
30c4931d28 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
335bc13cc1 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
8fcb81d2de 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
d4218ca64f 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
83942e5b6a Expose virNetServerGetName
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-03-11 12:58:41 +01:00
Martin Kletzander
6541a2b4ac 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
cd0a980ee1 daemon: Set error for unknown server name
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-03-11 12:58:41 +01:00
Martin Kletzander
62be54861b 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
fd4f278e1a 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
dad3b07814 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
b04e39ff86 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>
2016-03-11 12:58:41 +01:00
Martin Kletzander
23a646f840 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>
2016-03-11 12:58:41 +01:00
John Ferlan
ef2ab8fdc5 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>
2016-03-11 06:32:20 -05:00
John Ferlan
3dbc2a149f 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>
2016-03-11 06:31:05 -05:00
John Ferlan
0ea0f6c496 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>
2016-03-11 06:17:06 -05:00
John Ferlan
f87be33a6f 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>
2016-03-11 06:17:06 -05:00
John Ferlan
4908772e15 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>
2016-03-11 06:17:06 -05:00
John Ferlan
73379375c8 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>
2016-03-11 06:17:05 -05:00
John Ferlan
44616e3304 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>
2016-03-11 06:17:05 -05:00
John Ferlan
d6d31e00eb 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>
2016-03-11 06:17:05 -05:00
John Ferlan
05e9790802 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>
2016-03-11 06:17:05 -05:00
Marc-André Lureau
1e34a8f919 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>
2016-03-10 22:54:40 +01:00
Marc-André Lureau
0683ffc2ea 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>
2016-03-10 22:54:40 +01:00
Chunyan Liu
f41e03c63f 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>
2016-03-10 14:28:52 -07:00
Daniel P. Berrange
fcd3fa385f 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>
2016-03-10 15:43:19 +00:00
Daniel P. Berrange
3e12ec4a1e 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.
2016-03-10 15:41:52 +00:00
Daniel P. Berrange
3f68f33c36 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.
2016-03-10 15:41:52 +00:00
Daniel P. Berrange
4e461228dd 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>
2016-03-10 15:41:52 +00:00
Daniel P. Berrange
0192447519 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>
2016-03-10 15:40:54 +00:00
Daniel P. Berrange
06cb0cf7ce 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>
2016-03-10 15:33:51 +00:00