Commit Graph

17402 Commits

Author SHA1 Message Date
Ján Tomko
2da6a13e5f Introduce virNetSocketRemoteAddrStringURI
It will return the socket address and port in a URI-like
format: [::1]:1234
Add a test case to virnetsockettest.
2016-06-23 22:21:36 +02:00
Ján Tomko
0f7eeb20ad Revert "virnetsocket: Provide socket address format in a more standard form"
This partially reverts commit 9b45c9f049.

It changed the default format of socket address from the one SASL
requires, but did not adjust all the callers.

It also removed the test coverage for it.

Revert most of the changes except the virSocketAddrFormatFull support
for URI-formatted strings.

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1345743 while
reverting the format used by virt-admin's client-info command from
the URI one to the SASL one.

https://bugzilla.redhat.com/show_bug.cgi?id=1345743
2016-06-23 22:15:06 +02:00
Ján Tomko
5217fe3db4 Allow configs to start with a dot
This fixes the disappearance of domains and networks starting with a
dot.

https://bugzilla.redhat.com/show_bug.cgi?id=1333248
2016-06-23 21:58:38 +02:00
Ján Tomko
dad2f010b0 Do not skip hidden entries when looking for a stable path
The device names are unlikely to start with a dot.
'.' and '..' are already skipped by virDirRead.
2016-06-23 21:58:38 +02:00
Ján Tomko
70a033ab42 Do not ignore hidden files in /sys and /proc
The directories we iterate over are unlikely to contain any entries
starting with a dot, other than '.' and '..' which is already skipped
by virDirRead.
2016-06-23 21:58:38 +02:00
Ján Tomko
852cd39830 Fix comment in virStorageBackendFileSystemRefresh
'.' and '..' are now skipped by virDirRead, there's no need to mention
them in the comment.
2016-06-23 21:58:38 +02:00
Ján Tomko
fe79c3f2c1 Do not check for '.' and '..' after virDirRead
It skips those directory entries.
2016-06-23 21:58:38 +02:00
Ján Tomko
7cecfba139 Skip '.' and '..' in virDirRead
All of the callers either skip these explicitly, skip all entries
starting with a dot or match the entry name against stricter patterns.
2016-06-23 21:58:38 +02:00
Ján Tomko
a4e6f1eb9c Introduce VIR_DIR_CLOSE
Introduce a helper that only calls closedir if DIR* is non-NULL
and sets it to NULL afterwards.
2016-06-23 21:58:33 +02:00
Ján Tomko
44f5b3f869 Do not check the return value of closedir
The only possible error is EBADFD.
Since we only use the directory stream returned by opendir,
this should never happen.
2016-06-23 21:57:45 +02:00
Ján Tomko
b914530d62 Do not save errno in virUSBDeviceSearch
The virUSBDeviceFind* callers do not check errno after calling
this function.
2016-06-23 21:37:32 +02:00
John Ferlan
dc428f450a qemu: Add new secret info type
Add 'encinfo' to the extended disk structure. This will contain the
encryption secret (if present).

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-23 12:30:28 -04:00
John Ferlan
42510c5199 util: Introduce virSecretLookupFormatSecret
Add utility to format the virSecretLookupTypeDefPtr in XML

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-23 12:30:28 -04:00
John Ferlan
ecd45ced0e util: Move and rename virStorageAuthDefParseSecret
Move to virsecret.c and rename to virSecretLookupParseSecret. Also convert
to usage xmlNodePtr and virXMLPropString rather than virXPathString.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-23 12:30:28 -04:00
John Ferlan
1eca5f6581 secret: Move virStorageSecretType and rename
Move the enum into a new src/util/virsecret.h, rename it to be
virSecretLookupType. Add a src/util/virsecret.h in order to perform
a couple of simple operations on the secret XML and virSecretLookupTypeDef
for clearing and copying.

This includes quite a bit of collateral damage, but the goal is to remove
the "virStorage*" and replace with the virSecretLookupType so that it's
easier to to add new lookups that aren't necessarily storage pool related.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-23 12:30:27 -04:00
Cole Robinson
e808d3f227 storage: Remove redundant refreshPool check
Every driver provides a refreshPool impl, and many other critical
places in the code unconditionally call it without checking if
it exists, so this check is pointless
2016-06-23 09:29:54 -04:00
Cole Robinson
7490fdec92 qemu: command: Error on accel2d
qemu doesn't have any accel2d support wired up. Explicitly error
if a user tries it out, or typos the accel3d option
2016-06-23 09:29:18 -04:00
Cole Robinson
9a4703a3f0 qemu: command: Error on accel3d with non-virtio
We should be raising an error if accel3d is present for any
non-virtio video as well, incase someone tries it for say 'qxl'
2016-06-23 09:29:18 -04:00
Nikolay Shirokovskiy
6606ea96a1 qemu: make monitor command API available during async jobs
One can not issue monitor commands manually during async calls thru
designated API while this could be useful for testing/debugging purposes.
qemuDomainQemuMonitorCommand uses job of type QEMU_JOB_MODIFY and any async
call disable parallel execution of this type of job. The only state that is
changed is taint variable. AFAIU the only place we can mess is resetting
taint flag in qemuProcessStop routine under some async job. But this can not
happen thanx to both virDomainObjIsActive check in qemuDomainQemuMonitorCommand
and resetting active status in qemuProcessStop before taint flag.

  Change job type to QEMU_JOB_QUERY and thus make the API call available for
most of async jobs.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-23 15:18:31 +02:00
Peter Krempa
dfeb19ff60 Allow virDomain(SG)etGuestVcpus on read-write connection only
Guest agent interaction is considered privileged.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1349272
2016-06-23 09:41:52 +02:00
Ján Tomko
8b04ce598d Add newDomain parameter to qemuDomainAssignAddresses
Pass 'true' if we are not dealing with a migration.
2016-06-23 07:45:31 +02:00
Cole Robinson
03ce132808 conf: Remove dead console compat formatting
This code was attempting to handle some implicit <console> XML
formatting for manually assembled DomainDef, since previously the
console<->serial compat copying was only done at XML parse time.

Nowadays it's done via virDomainDefPostParse ->
virDomainDefAddConsoleCompat, which all manual DomainDef builders
already call, so we can drop this workaround.
2016-06-22 20:14:31 -04:00
Jim Fehlig
76d5871648 libxl: use serial device for console when targetType is serial
When domXML contains only <console type='pty'> and no corresponding
<serial>, the console is "stolen" [1] and used as the first <serial>
device. When this "stolen" console is accessed from the libxl driver
(in libxlConsoleCallback and libxlDomainOpenConsole), check if the
targetType is VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL, and use the
"stolen" device in def->serials[0] instead. Prior to this change,
creating a domain with input XML containing only a <console> device
and subsequently attempting to access its console with
'virsh console' would fail

error: internal error: character device <null> is not using a PTY

[1] See comments associated with virDomainDefAddConsoleCompat() in
    $LIBVIRT-SRC/src/conf/domain_conf.c:
2016-06-22 15:06:27 -06:00
Ján Tomko
a921699ad9 Use for instead of code duplication when parsing USB port
We are done if the string ends and move to another nesting
level if we find a dot.
2016-06-22 21:33:57 +02:00
Ján Tomko
0956d9b2a3 Split out USB port parsing
Make rewriting it easier.
2016-06-22 21:33:57 +02:00
Jiri Denemark
d85c3a5451 Report auto convergence throttle rate in migration stats
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
445853e1ba qemu: Implement auto convergence migration parameters
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
abaa11006f qemu: Add support for cpu throttling parameters
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
8d58952bed qemu: Introduce qemuMigrationSetParams
Several places in the code update qemuMonitorMigrationParams structure
and qemuMigrationSetParams is then used to set them all at once.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
bd3da51697 qemu: Rework qemuMonitorJSONSetMigrationParams
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
eb3e018414 qemu: Rework qemuMonitorJSONGetMigrationParams
We should not require any parameters to be present. After all we have
the *_set bools to express that some parameters were not set.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
b1473708d8 qemu: Rename qemuMonitorMigrationCompression
qemuMonitorMigrationParams is a better name for a structure which
contains various migration parameters. While doing that, we should use
full names for individual parameters.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
dbcbc86648 qemu: Decouple migration parameters from compression settings
Compression parameters are not the only migration parameters.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
5a235947c2 qemu: Make qemuMonitorSetMigrationCompression saner
Checking whether the function has anything to do is better done in the
function rather then requiring callers to do that.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
0966f0d7e0 conf: Simplify conditions in CPU parser/formatter
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 12:16:19 +02:00
Jiri Denemark
70a576899a conf: Remove redundant free in virCPUDefFree
vendor_id is (and always was) already freed in virCPUDefFreeModel.

This effectively reverts commit fb49ffc3.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 10:38:52 +02:00
Jiri Denemark
0b224cce8b qemu: Fix reference leak in qemuDomainDefPostParse
The function gets a reference on virQEMUDriverConfig which needs to be
released before returning.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 10:29:15 +02:00
Jiri Denemark
cf32a69ae1 qemu: Hide virQEMUCapsNewForBinary
Since virQEMUCapsNewForBinaryInternal was introduced,
virQEMUCapsNewForBinary is no longer used outside qemu_capabilities.c.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 10:25:53 +02:00
Peter Krempa
66acbe603b qemu: Implement virDomainSetGuestVcpus
Allow modification of specific vCPU states via the guest agent.
2016-06-22 09:26:08 +02:00
Peter Krempa
a24edc48c3 qemu: Implement virDomainGetGuestVcpus
Allow gathering available vcpu ids, their state and offlinability via
the qemu guest agent. The maximum id was chosen arbitrarily and ought
to be enough for everybody.
2016-06-22 09:26:08 +02:00
Peter Krempa
b1aa91e140 qemu: agent: Make setting of vcpus more robust
Documentation for the "guest-set-vcpus" command describes a proper
algorithm how to set vcpus. This patch makes the following changes:

- state of cpus that has not changed is not updated
- if the command was partially successful the command is re-tried with
  the rest of the arguments to get a proper error message
- code is more robust against malicious guest agent
- fix testsuite to the new semantics
2016-06-22 09:26:08 +02:00
Peter Krempa
3ebf7ca07e lib: Add API to set individual vcpu usage in the guest via guest agent
To allow finer-grained control of vcpu state using guest agent this API
can be used to individually set the state of the vCPU.

This will allow to better control NUMA enabled guests and/or test
various vCPU configurations.
2016-06-22 09:25:47 +02:00
Peter Krempa
800244faf3 lib: Add API to query guest vcpu info using guest agent
Add a rather universal API implemented via typed params that will allow
to query the guest agent for the state and possibly other aspects of
guest vcpus.
2016-06-22 08:16:31 +02:00
Peter Krempa
830f9b624d rpcgen: Add support for generating funcs returning alloc'd typed params
Since it's rather tedious to write the dispatchers for functions that
return an array of typed parameters (which are rather common) let's add
some rpcgen code to generate them.
2016-06-22 08:15:45 +02:00
John Ferlan
35f6abef6b storage: Use virSecretGetSecretString
Rather than inline code secret lookup for rbd/iscsi, use the common function.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
John Ferlan
7df631b66a storage: Create helper to set options for CreateQemuImg code
Create a helper virStorageBackendCreateQemuImgSetOptions to set either
the qemu-img -o options or the previous mechanism using -F

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
John Ferlan
d12a64f310 storage: Create helper to set backing for CreateQemuImg code
Create a helper virStorageBackendCreateQemuImgSetBacking to perform the
backing store set

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
John Ferlan
f6a92f8e20 storage: Adjust qemu-img switches check
Since we support QEMU 0.12 and later, checking for support of specific flags
added prior to that isn't necessary.

Thus start with the base of having the "-o options" available for the
qemu-img create option and then determine whether we have the compat
option for qcow2 files (which would be necessary up through qemu 2.0
where the default changes to compat 0.11).

Adjust test to no long check for NONE and FLAG options as well was removing
results of tests that would use that option.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
Ján Tomko
8b3f0b767e Do not call postParse with ABI_UPDATE when parsing cmdline
So far this is only useful for recalculating NUMA memory size,
which this function cannot parse.

This will let us generate USB addresses based on this flag.
2016-06-21 18:23:56 +02:00
Ján Tomko
d0e5dd376f vbox: remove duplicate macros
There is a definiton of VIR_FROM_THIS just two lines above.

The rest is defined in vbox_common.h.
2016-06-21 18:07:25 +02:00
Ján Tomko
8ddf58f5a1 Remove unused SOL_NETLINK macro
Introduced by commit d575679, unused at the time.
2016-06-21 18:07:11 +02:00
Laine Stump
df2fb9bfff conf: limit chassisNr, and busNr to a minimum value of 1, not 0
In the case of chassisNr (used to set chassis_nr of a pci-bridge
controller), 0 is reserved for / used by the pci[e]-root bus. In the
base of busNr, a value of 0 would mean that the root bus had no places
available to plug in new buses, including the pxb itself (the
documentation I wrote for pxb even noted the limit of busNr as 1.254).

NB: oddly, the "chassis" attribute, which is used for pcie-root-port
and pcie-switch-downstream-port *can* be set to 0, since it's the
combination of {chassis, slot} that needs to be unique, not chassis by
itself (and slot 0 of pcie-root is reserved, while pcie-*-port can use
*only* slot 0).

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1342962
2016-06-21 11:54:46 -04:00
Andrea Bolognani
f83ab972bc qemu: Fix typo pci-extender-bus -> pci-expander-bus 2016-06-21 12:48:02 +02:00
Peter Krempa
832f160247 util: Make failure to get supplementary group list for a uid non-fatal
Since introduction of the DAC security driver we've documented that
seclabels with a leading + can be used with numerical uid. This would
not work though with the rest of libvirt if the uid was not actually
used in the system as we'd fail when trying to get a list of
supplementary groups for the given uid. Since a uid without entry in
/etc/passwd (or other user database) will not have any supplementary
groups we can treat the failure to obtain them as such.

This patch modifies virGetGroupList to not report the error for missing
users and makes it return an empty list or just the group specified in
@gid.

All callers will grant less permissions to a user in case of failure of
this function and thus this change is safe.
2016-06-20 17:35:55 +02:00
Peter Krempa
c674dcccf1 util: Add option not to report errors in virGetUserEnt
In some cases it will be necessary to ignore errors reported from this
function. This allows suppressing them to avoid spamming logs.
2016-06-20 16:51:10 +02:00
Peter Krempa
0a07bf3dc5 conf: Fix label name in virDomainGraphicsListensParseXML
Use 'cleanup' since it's also used on success.
2016-06-20 16:34:43 +02:00
Peter Krempa
9982758cc5 conf: Fix memory leak in graphics XML parser
When loading status XMLs with following graphics definition:

  <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
    <listen type='address' address='127.0.0.1' fromConfig='1'/>
    <image compression='off'/>
  </graphics>

libvirtd would leak a few bytes:

10 bytes in 1 blocks are definitely lost in loss record 71 of 1,127
   at 0x4C2C000: malloc (vg_replace_malloc.c:299)
   by 0x6789298: xmlStrndup (in /usr/lib64/libxml2.so.2.9.4)
   by 0x552AB0A: virXMLPropString (virxml.c:479)
   by 0x5539536: virDomainGraphicsListensParseXML (domain_conf.c:11171)
   by 0x553DD5E: virDomainGraphicsDefParseXMLSpice (domain_conf.c:11414)
   by 0x553DD5E: virDomainGraphicsDefParseXML (domain_conf.c:11749)
   by 0x5566061: virDomainDefParseXML (domain_conf.c:16939)
   by 0x556953F: virDomainObjParseXML (domain_conf.c:17348)
   by 0x556953F: virDomainObjParseNode (domain_conf.c:17513)
   by 0x5569902: virDomainObjParseFile (domain_conf.c:17532)
   by 0x5571E02: virDomainObjListLoadStatus (virdomainobjlist.c:514)
   by 0x5571E02: virDomainObjListLoadAllConfigs (virdomainobjlist.c:596)
   by 0x26E0BDC8: qemuStateInitialize (qemu_driver.c:911)
   by 0x55B1FDB: virStateInitialize (libvirt.c:770)
   by 0x122039: daemonRunStateInit (libvirtd.c:960)
2016-06-20 16:34:43 +02:00
Chen Hanxiao
a7822ba3f6 util: fix a typo
s/succcess/success

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2016-06-20 15:20:09 +02:00
Ján Tomko
dc56b3a7ce Introduce virBitmapParseUnlimited
For parsing a bitmap of an unknown size.
2016-06-20 12:09:52 +02:00
Ján Tomko
ff52e9d43a Remove separator argument from virBitmapParse
Most the callers pass 0 in one form or another, including
vircapstest which used VIR_ARCH_NONE.
2016-06-20 12:09:52 +02:00
Ján Tomko
d728689d9b Introduce virBitmapParseSeparator
This will be used for the caller that needs to specify a separator.
Currently identical to virBitmapParse.

Also change one test case to use the new function.
2016-06-20 12:09:39 +02:00
Ján Tomko
ba7c026dab Do not return number of set bits in virBitmapParse
This is only used by one caller.
2016-06-20 12:07:16 +02:00
Andrea Bolognani
dc5821d743 qemu: Don't use legacy USB for aarch64 mach-virt guests
The '-usb' option doesn't have any effect for aarch64 mach-virt
guests, so the fact that it's currently enabled by default is not
really causing any issue.

However, that might change in the future (although unlikely), and
having it as part of the QEMU command line can cause confusion to
someone looking through the process list.

Avoid it completely, like it's already happening for q35.
2016-06-20 09:58:48 +02:00
Tomasz Flendrich
ec3f07f0a7 qemu_hotplug: Use a helper variable consistently 2016-06-19 15:55:37 +02:00
Jim Fehlig
8bab1e7c05 libxl: add USB to hostdev domcapabilities
Commit 2a58ed0b added support for creating guests with USB
hostdevs. Commit fc21d10 later added support for hotplut of
USB hostdevs. Advertise support for USB hostdevs in the
domcapabilities.

In addition add the appropriate caps for USB support on
domaincapstest when libvirt is built on a Xen with
LIBXL_HAVE_PVUSB. Otherwise domaincapstest would fail i.e.
testing the wrong domain capabilities.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
2016-06-17 14:25:02 -06:00
Ján Tomko
22d262c9b0 qemu: restore non-pci hostdev labels after detach
Commit 409de00 changed the logic to only match PCI devices
while moving this before Remove*HostDevice calls.

https://bugzilla.redhat.com/show_bug.cgi?id=1342874
2016-06-17 19:43:22 +02:00
Andrea Bolognani
86a68bdb0c qemu: Permit PCI-free aarch64 mach-virt guests
There has been some progress lately in enabling virtio-pci on
aarch64 guests; however, guest OS support is still spotty at best,
so most guests are going to be using virtio-mmio instead.

Currently, mach-virt guests are closely modeled after q35 guests,
and that includes always adding a dmi-to-pci-bridge that's just
impossible to get rid of. While that's acceptable (if suboptimal)
for q35, where you will always need some kind of PCI device anyway,
mach-virt guests should be allowed to avoid it.
2016-06-17 18:30:04 +02:00
Michal Privoznik
9e155e1d8a qemuDomainDetachDeviceConfig: Allow cold unplug of redirdevs
This is fairly simple. We lookup the device in the array of
devices and remove it. No magic.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-17 18:12:43 +02:00
Michal Privoznik
3441274016 qemuDomainAttachDeviceConfig: Allow redirdev coldplug
This is really simple, we just need to append the device into the
domain def and that's it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-17 18:12:43 +02:00
Michal Privoznik
87bbb6eb2f virDomainDeviceInfoIterateInternal: Iterate through redirdevs too
This is going to be important later when we received
DEVICE_DELETED event on the qemu monitor. If we do,
virDomainDefFindDevice() is called to find the device for given
device alias in the virDomainDef tree. When we enable removal for
redirdevs we need to include them in the lookup process too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-17 18:12:43 +02:00
Michal Privoznik
e30dbb9f98 virDomainRedirdevDef: Introduce find & remove routines
Basically, there are just two functions introduced here:
virDomainRedirdevDefFind which looks up given redirdev in domain
definition, and virDomainRedirdevDefRemove which removes the
device at given index in the array of devices.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-17 18:12:43 +02:00
Michal Privoznik
9f20b3b45e domain_conf: Validate redirdev after parsing
There's currently just one limitation: redirdevs that want to go
on USB bus require a USB controller, surprisingly.
At the same time, since I'm using virDomainDefHasUSB() in this
new validator function, it has to be moved a few lines up and
also its header needed to be changed a bit: it is now taking a
const pointer to domain def since it's not changing anything in
there.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-17 18:12:43 +02:00
Andrea Bolognani
b31b3eee85 qemu: Fix alignment in virDomainDefAddController() call 2016-06-17 13:06:52 +02:00
Jiri Denemark
5a9221b9af cpu_x86: Use signature in CPU detection code
Our current detection code uses just the number of CPU features which
need to be added/removed from the CPU model to fully describe the CPUID
data. The smallest number wins. But this may sometimes generate wrong
results as one can see from the fixed test cases. This patch modifies
the algorithm to prefer the CPU model with matching signature even if
this model results in a longer list of additional features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-17 11:46:31 +02:00
Jiri Denemark
2f3ccdf01b cpu: Add Skylake-Client x86 CPU model
The CPU model was implemented in QEMU by commit f6f949e929.

The change to i7-5600U is wrong since it's a 5th generation CPU, i.e.,
Broadwell rather than Skylake, but that's just the result of our CPU
detection code (which is fixed by the following commit).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-17 11:40:58 +02:00
Peter Krempa
f8d565bf86 conf: Rename virDomainDefGetMemoryActual to virDomainDefGetMemoryTotal 2016-06-17 10:39:40 +02:00
Peter Krempa
a877a1635b conf: Remove pre-calculation of initial memory size
While we need to know the difference between the total memory stored in
<memory> and the actual size not included in the possible memory modules
we can't pre-calculate it reliably. This is due to the fact that
libvirt's XML is copied via formatting and parsing the XML and the
initial memory size can be reliably calculated only when certain
conditions are met due to backwards compatibility.

This patch removes the storage of 'initial_memory' and fixes the helpers
to recalculate the initial memory size all the time from the total
memory size. This conversion is possible when we also make sure that
memory hotplug accounts properly for the update of the total memory size
and thus the helpers for inserting and removing memory devices need to
be tweaked too.

This fixes a bug where a cold-plug and cold-remove of a memory device
would increase the size reported in <memory> in the XML by the size of
the memory device. This would happen as the persistent definition is
copied before attaching the device and this would lead to the loss of
data in 'initial_memory'.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1344892
2016-06-17 10:36:41 +02:00
Peter Krempa
23690e1d74 conf: Fix perf event parser
The parser was totaly broken. Fix it by rewriting it. Add tests so that
it doesn't happen.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1346723
2016-06-17 09:35:14 +02:00
Peter Krempa
da8285c44a qemu: perf: Don't set state of first event for every other event
A bug in the code used the value of the first perf event as state for
all the mentioned one rather than extracting individual ones.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1346730
2016-06-17 09:35:14 +02:00
Jim Fehlig
e33cd67a9b xenconfig: fix conversion of <driver> to backendtype
When converting domXML to xen xl.cfg, backendtype should
not be emitted if <driver> is not specified. Moreover,
<driver name='file'/> should be converted to backendtype
qdisk, similar to handling of <driver> in libxlMakeDisk()
in libxl_conf.c.

Prior to this change, connectDomainXMLToNative would
produce incorrect xl.cfg when the input domXML contained
<driver name='file'/>

domXML:

  <disk type="file" device="disk">
    <driver name="file"/>
    <source file="/image/file/path"/>
    <target dev="xvda" bus="xen"/>
  </disk>

virsh domxml-to-native xen-xl domXML

disk = [ "format=raw,vdev=xvda,access=rw,backendtype=target=/image/file/path" ]

xl create xl.cfg
config parsing error in disk specification: unknown value
for backendtype: near `target=/image/file/path' in
`format=raw,vdev=xvda,access=rw,backendtype=target=/image/file/path'
2016-06-16 12:31:04 -06:00
Laine Stump
bf913385ae util: fix missing broadcast address in bridge and tap device IP addresses
Commit b3d069872c added peer address setting to the low level
virNetDevSetIPAddress() function, but ended up causing a segfault in
cases where the caller passed NULL for peer address.

Commit a3510e33d3 fixed the segfault, but managed to cause us to
skip setting the broadcast address when setting an interface's IP
address. The result is that the broadcast address is 0.0.0.0 for all
libvirt-created bridges (and interfaces in lxc containers with IP
addresses set by libvirt).

This was reported on the mailing list:

  https://www.redhat.com/archives/libvir-list/2016-June/msg00027.html

but I was too busy to investigate at the time. I found it by accident
today while refactoring virNetDevSetIPAddress(). Since this regression
is present in the 1.3.5 release, I'm sending the bugfix as a separate
patch from my larger refactoring patchset.
2016-06-16 14:27:40 -04:00
Laine Stump
d5fb8f4564 qemu: don't add pci-bridge to Q35/arm domains unless it's needed
Until now, a Q35 domain (or arm/virt, or any other domain that has a
pcie-root bus) would always have a pci-bridge added, so that there
would be a hotpluggable standard PCI slot available to plug in any PCI
devices that might be added. This patch removes the explicit add,
instead relying on the pci-bridge being auto-added during PCI address
assignment (it will add a pci-bridge if there are no free slots).

This doesn't eliminate the dmi-to-pci-bridge controller that is
explicitly added whether or not a standard PCI slot is required (and
that is almost never used as anything other than a converter between
pcie.0's PCIe slots and standard PCI). That will be done separately.
2016-06-16 13:48:25 -04:00
Laine Stump
97b215a450 qemu: don't be as insistent about adding dmi-to-pci-bridge or pci-bridge
Previously there was no way to have a Q35 domain that didn't have
these two controllers. This patch skips their creation as long as
there are some other kinds of pci controllers at index 1 and 2
(e.g. some pcie-root-port controllers).

I'm hoping that soon we won't add them at all, plugging all devices
into auto-added pcie-*-port ports instead, but in the meantime this
makes it easier to experiment with alternative bus hierarchies.
2016-06-16 13:32:11 -04:00
Chen Hanxiao
e9df53052e util: remove redundant comments
Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2016-06-16 13:09:19 -04:00
Jovanka Gulicoska
41b2f108d5 storage: implement storage lifecycle event APIs
Implement storage pool event callbacks for START, STOP, DEFINE, UNDEFINED
and REFRESHED in functions when a storage pool is created/started/stopped
etc. accordingly
2016-06-16 12:22:11 -04:00
Jovanka Gulicoska
22fb4374da remote: implement storage lifecycle event APIs 2016-06-16 12:22:11 -04:00
Jovanka Gulicoska
edc1a27a5a test: implement storage lifecycle event APIs
Also includes unittests for storage pool lifecycle events API
2016-06-16 12:22:11 -04:00
Jovanka Gulicoska
dc7b849a0c conf: add storage_event handling
Add storage event handling infrastructure to storage_event.[ch], following
the network_event.[ch] pattern.
2016-06-16 12:22:11 -04:00
Jovanka Gulicoska
1328f98224 Introduce storage lifecycle event APIs
Storage pool lifecycle event API entry points for registering and deregistering
storage pool events, as well as types of events associated with storage pools.
These entry points will be used for implementing asynchronous lifecycle events.

Storage pool API:
virConnectStoragePoolEventRegisterAny
virConnectStoragePoolEventDeregisterAny
virStoragePoolEventLifecycleType which has events STARTED, STOPPED, DEFINED,
UNDEFINED, and REFRESHED
2016-06-16 12:22:11 -04:00
Martin Kletzander
bce3d20d04 qemu: Remove useless block in processWatchdogEvent
Best viewed with -w since this is mostly just an indentation patch.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-16 18:07:43 +02:00
Martin Kletzander
0aaeff96d6 qemu: Follow coding style convention
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-16 18:07:43 +02:00
Martin Kletzander
5e1257820f qemu: Unify automatic coredump filenames
Just create a helper for it and use it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-16 18:07:43 +02:00
John Ferlan
f0fe184fb9 qemu: Add cfg pointer to various command line helpers
Soon at least one of them will need to grab something out of the
qemu config structure

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-16 11:57:45 -04:00
John Ferlan
7d49f2c199 qemu: Make qemuBuildShmemBackendStr private
It's not used externally anywhere else

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-16 11:57:45 -04:00
Martin Kletzander
ab74f60a36 qemu: Shorten domain name for watchdog coredump
Similarly to commit d294f6b0df, if the name is long enough, the
filename can be longer than filesystem's limit.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-16 16:01:14 +02:00
Cole Robinson
e6001cc557 qemu: migration: use consistent error message
The other two DomainHasBlockJob usage error messages don't contain
'an', so unify things to save translators some effort. Dropping
the 'an' is closer to the sentence structure in the errors from
qemuDomainDiskBlockJobIsActive as well
2016-06-16 09:52:51 -04:00
Cole Robinson
b732704f49 qemu: More usage of qemuDomainDiskBlockJobIsActive
qemuDomainDiskBlockJobIsActive already checks if a disk has a
blockjob, and if so, raises an error
2016-06-16 09:52:51 -04:00
John Ferlan
55be2920c3 util: Fix broken syntax-check
Commit id '743db933' broke at least one syntax check rule regard open/close
braces and perhaps more with spacing.  Just remove the braces
2016-06-16 06:17:58 -04:00
yuelongguang
743db933ed add default mapping of credentials to machine
In the auth config file, it is currently required to have
an entry for each hostname to connect to, eg

  [auth-libvirt-prod1.example.com]
  credentials=prod

This is inconvenient when there are large numbers of machines
all with the same credentials. Add support for a default
entry:

  [auth-default]
  credentials=prod
2016-06-16 10:36:46 +01:00
Nikolay Shirokovskiy
475835e38b vz: get rid of unused home state variable in private domain obj
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-15 16:24:28 +02:00
Ján Tomko
b9df355592 maint: remove whitespace from closing parentheses
To allow tightening syntax check.
2016-06-15 15:07:47 +02:00
Ján Tomko
ca773b2fe2 vbox: reformat multi-line error reports
Put the comma on the first line.
2016-06-15 15:07:47 +02:00
Michal Privoznik
8ce58b0081 virHostCPUGetInfo: Fix build on non-Unix like systems
This function is plenty of ifdefs providing implementations for
Linux, *BSD and OS-X. However, if we are being build for any
other architecture, all that's left behind by preprocessor is
just a error reporting call and return of -1. In that case,
passed arguments are unused:

../../src/util/virhostcpu.c: In function 'virHostCPUGetInfo':
../../src/util/virhostcpu.c:966:33: error: unused parameter 'cpus' [-Werror=unused-parameter]
                   unsigned int *cpus,
                                 ^~~~

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-15 09:44:46 +02:00
Chunyan Liu
44c99f2500 Add conversion of domxml USB config to/from xl.cfg
xl.cfg:
usbdev = [ "hostbus=1,hostaddr=3" ]

usb.xml:
  <hostdev mode='subsystem' type='usb' managed='no'>
    <source>
      <address bus='1' device='3'/>
    </source>
  </hostdev>

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-06-14 14:33:15 -06:00
Chunyan Liu
fc21d1065b libxl: support hotplug USB host device
Support hot attach/detach a USB host device to guest.
Currently libxl only supports xen PV guest, and only
supports specifying USB host device by 'bus number'
and 'device number', for example:

 usb.xml:
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <address bus='1' device='3'/>
      </source>
    </hostdev>
 #xl attach-device dom usb.xml
 #xl detach-device dom usb.xml

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-06-14 14:26:09 -06:00
Chunyan Liu
2a58ed0bce libxl: support creating guest with USB hostdev
Support creating guest with USB host device in config file.
Currently libxl only supports xen PV guest, and only supports
specifying USB host device by 'bus number' and 'device number',
for example:

    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <address bus='1' device='3'/>
      </source>
    </hostdev>

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-06-14 14:25:47 -06:00
John Ferlan
55931292c9 qemu: Refactor qemuDomainAttachChrDevice error paths
Refactor the error paths for attaching char device (it's about to be
more complicated).

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-14 08:41:45 -04:00
John Ferlan
d2e14efb05 caps: Add capability for tls-x509-creds
Add the capability flag and checks for the qemu object 'tls-creds-x509'

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-14 08:41:45 -04:00
Martin Kletzander
e8dc0e3a43 Change 1.3.6 occurrences to 2.0.0 to follow version bump
Version was bumped but documentation (and comments) didn't follow the
numbering.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-14 11:15:18 +02:00
Martin Kletzander
b842741ba4 qemu: Allow ACPI shutdown only for running domains
If the domain is not running, but for example the CPUs are stopped, the
ACPI event gets queued and resume of the domain will just shut it off.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-14 11:13:03 +02:00
Martin Kletzander
a781eae8c1 qemu: Obtain job before checking if domain is live
Since obtaining a job can wait for another job to finish, the state
might change in the meantime.  And checking it more than once is
pointless.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-14 11:10:49 +02:00
Daniel P. Berrange
8264c70e0b Bump release to 2.0.0 and document release schedule & versioning
This bumps the release number of 2.0.0, to reflect the switch to
a new time based release versioning scheme. The downloads page
is updated to describe our policies for release schedules and
release version numbering

The stable release docs are changed to reflect the fact that
the stable version numbers are now just 3 digits long instead
of 4.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-14 10:59:07 +02:00
Martin Kletzander
6445ad488f qemu: Add support for zero-detection writes
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-14 08:25:25 +02:00
Martin Kletzander
d3c784999d conf: Add support of zero-detection for disks
This option allows or disallows detection of zero-writes if it is set to
"on" or "off", respectively.  It can be also set to "unmap" in which
case it will try discarding that part of image based on the value of the
"discard" option.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-14 08:25:25 +02:00
Jim Fehlig
00bcb45d8d libxl: Add support for ovmf firmware
Populate libxl_domain_build_info struct with bios and firmware
info from virDomainLoaderDef.

Note: Currently libxl only allows specifying the type of BIOS.
For type LIBXL_BIOS_TYPE_OVMF, the firmware path is configured
when building Xen using '--with-system-ovmf='. If not specified,
LIBXL_FIRMWARE_DIR/ovmf.bin is used. In the future, Xen will
support a user-specified firmware path. See

http://lists.xenproject.org/archives/html/xen-devel/2016-03/msg01628.html

Once that work is merged into xen.git, the libvirt libxl driver
will be able to honor a user-specified path. In the meantime use
the implicit path, which is tolerable since it is advertised in
domcapabilities.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-06-13 14:13:17 -06:00
Jim Fehlig
53d98ccea7 xenconfig: support bios=ovmf xl.cfg
Add support to xenconfig for conversion of xl.cfg(5) bios config
to/from libvirt domXml <loader> config. SeaBIOS is the default
for HVM guests using upstream QEMU. ROMBIOS is the default when
using the old qemu-dm. This patch allows specifying OVMF as an
alternate firmware.

Example xl.cfg:
  bios = "ovmf"

Example domXML:
  <os>
    ...
    <loader readonly='yes' type='pflash'>/usr/lib/xen/boot/ovmf.bin</loader>
  </os>

Note that currently Xen does not support a separate nvram for
non-volatile variables.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-06-13 14:13:17 -06:00
Jim Fehlig
11567cf66f libxl: implement connectGetDomainCapabilities
Add domain capabilities for PV and HVM domains.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-06-13 14:13:17 -06:00
Jim Fehlig
cb110a67e3 libxl: introduce libxl_capabilities.{ch}
Move capabilities code out of libxl_conf.{ch} and into new
libxl_capabilities.{ch} files.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-06-13 14:13:16 -06:00
Jim Fehlig
cb5d3e9b02 libxl: add default firmwares to driver config object
Prefer firmwares specified via --with-loader-nvram configure
option. If none are specified, use the Xen-provided default
firmwares found in LIBXL_FIRMWARE_DIR.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-06-13 14:13:16 -06:00
Jim Fehlig
fda5a98e9e driver config: Introduce virFirmware object
The virQEMUDriverConfig object contains lists of
loader:nvram pairs to advertise firmwares supported by
by the driver, and qemu_conf.c contains code to populate
the lists, all of which is useful for other drivers too.

To avoid code duplication, introduce a virFirmware object
to encapsulate firmware details and switch the qemu driver
to use it.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-06-13 14:13:16 -06:00
Wang Yufei
9ac9450780 libxl: fix vm lock overwritten bug
In libxl driver we do virObjectRef in libxlDomainObjBeginJob,
If virCondWaitUntil failed, it goes to error, do virObjectUnref,
There's a chance that someone undefine the vm at the same time,
and refs unref to zero, vm is freed in libxlDomainObjBeginJob.
But the vm outside function is not Null, we do virObjectUnlock(vm).
That's how we overwrite the vm memory after it's freed. I fix it.

Signed-off-by: Wang Yufei <james.wangyufei@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-13 13:34:37 +02:00
Roman Bogorodskiy
f2f6eb2ac5 bhyve: add missing virhost(cpu|mem).h headers 2016-06-12 10:56:11 +03:00
Roman Bogorodskiy
2af0541572 hostcpu: fix build on FreeBSD
* Fix misspelt function name:
    s/virHostCPUGetStatsFreebsd/virHostCPUGetStatsFreeBSD/
 * Mark the first argument to virHostCPUGetInfo with ATTRIBUTE_UNUSED
   as it's not actually used on non-Linux
2016-06-12 10:53:23 +03:00
Roman Bogorodskiy
992f93f18a nodeinfo: fix build on non-Linux
SYSFS_SYSTEM_PATH is only defined for Linux, however it's used outside
of #ifdef __linux__ code, e.g. as the first argument to
nodeCapsInitNUMAFake().

But as this argument's value is used on Linux only, it's safe to define
SYSFS_SYSTEM_PATH to "fake" to get things built on FreeBSD.
2016-06-12 10:33:17 +03:00
Maxim Nestratov
85d54f133c vz: fix crash when parsing unexpected disk configuration
As it turned out PrlVmDev_GetStackIndex can return negative values
without reporting an error, which is incorrect but nevertheless.
After that we feed this negative index to virIndexToDiskName,
which in turn returns NULL and we set it to virDomainDiskDef.dst.
Using virDiskNameToBusDeviceIndex with a virDomainDiskDef structure
which has NULL dst field crashes.
Fix this by returning an error in prlsdkGetDiskId in such cases.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-06-11 18:21:15 +03:00
Mikhail Feoktistov
ceb5461f7b vz: implementation of domainSetUserPassword callback 2016-06-11 18:20:56 +03:00
Maxim Nestratov
f166d6449c vz: return correct result for unimplemented ChangeState actions
Map PRL_ERR_UNIMPLEMENTED to VIR_ERR_OPERATION_INVALID

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-06-11 18:20:41 +03:00
Maxim Nestratov
ab753f7b50 vz: remove unused macro logPrlEventError
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-06-11 18:20:24 +03:00
Nikolay Shirokovskiy
4f17e4d0a1 vz: keep subscription to performance events thru domain lifetime
The approach of subscribing on first stat API call and then waiting
for receiving of performance event from sdk to process the call originates
in times when every vz libvirt connections spawns its own sdk connection.
Thus without this waiting virsh stat call would return empty stats. Now
with single sdk connection this scheme is unnecessary complicated.

This patch subscribes to performance events on first domain appearence
and unsubscribe on its removing.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-06-11 13:27:55 +03:00
Nikolay Shirokovskiy
4385b86817 vz: use consistent naming for different domain object in vz_driver.c
Naming scheme is next:

virDomainPtr domain;
virDomainObjPtr dom;

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-11 13:27:55 +03:00
Pavel Hrdina
13da6ff078 domain_conf: silence gcc warnings
../../src/conf/domain_conf.c:10949: error: declaration of 'socket'
shadows a global declaration [-Wshadow]

../../src/conf/domain_conf.c:24373: error: declaration of 'listen'
shadows a global declaration [-Wshadow]

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-10 19:42:54 +02:00
Maxim Nestratov
ecdff2fd89 vz: fixed build by including necessary headers
After eaf18f4c2 some functions changed their homes
Pushed under build breaking rule
2016-06-10 20:21:18 +03:00
Michal Privoznik
3668526fa6 qemuMonitorJSONAttachCharDev: Teach spicevmc
https://bugzilla.redhat.com/show_bug.cgi?id=1298070

We have the code for attaching redirdevs for ages now.
Unfortunately, our monitor code that handles talking to the qemu
process was missing a little piece of code that actually enabled
the feature.

BTW: it really is called "type" on the monitor, even though it's
called "name" on the cmd line. Don't ask.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-10 15:22:07 +02:00
Michal Privoznik
559b78d96a Export virDomainRedirdevDefFree
In the 162efa1a commit the function was introduced, but the
commit forgot to update livirt_private.syms accordingly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-10 15:16:56 +02:00
Daniel P. Berrange
57e62ee00a libvirt-lxc: add virDomainLxcEnterCGroup API
Add the virDomainLxcEnterCGroup API to the libvirt-lxc.so
file. This method moves the calling process into the cgroups
associated with the container.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-10 11:02:53 +01:00
Daniel P. Berrange
235620463c util: add function for looking up the user shell
Add a virGetUserShell wrapper around virGetUserEnt, that
returns the shell field.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-09 18:44:52 +01:00
Daniel P. Berrange
86dd9fac0f nodeinfo: move host memory APIs out into virhostmem file
Move all APIs with a virHostMEM name prefix out into new
util/virhostmem.h & util/virhostmem.c files

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-09 18:43:18 +01:00
Daniel P. Berrange
eaf18f4c2b nodeinfo: move host CPU APIs out into virhostcpu.c file
Move all APIs with a virHostCPU name prefix out into new
util/virhostcpu.h & util/virhostcpu.c files

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-09 18:31:11 +01:00
Daniel P. Berrange
4053350bfe nodeinfo: rename all CPU APIs to have a virHostCPU prefix
In preparation for moving all the CPU related APIs out of
the nodeinfo file, give them a virHostCPU name prefix.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-09 18:08:15 +01:00
Daniel P. Berrange
dcfe37e682 nodeinfo: rename all memory APIs to have a virHostMem prefix
In preparation for moving all the memory related APIs out of
the nodeinfo file, give them a virHostMem name prefix.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-09 18:07:00 +01:00
Daniel P. Berrange
bfb412a32e nodeinfo: split CPU info retrieval out of nodeGetInfo
Instead of having platform specific code in nodeGetInfo to
fetch CPU topology, split it all out into a new method
nodeGetCPUInfo.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-09 18:05:53 +01:00
Daniel P. Berrange
3050a3f5a6 nodeinfo: remove FreeBSD specific code for getting memory
The GNULIB physmem module already provides support for
the FreeBSD platform, so there's no reason to re-implement
FreeBSD portability code in libvirt. If there are bugs in
the GNULIB code, we should fix GNULIB rather than workaround
it in libvirt.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-09 18:04:44 +01:00
Daniel P. Berrange
912813de27 nodeinfo: make nodeGetInfo() call nodeGetMemory for memory size
The nodeGetInfo() method currently has its own code for getting
memory size in KB, that basically just re-invents what nodeGetMemory
already does. Remove it and just call nodeGetMemory, converting its
result from bytes to KB, allowing removal of more platform specific
conditional code.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-09 18:03:37 +01:00
Daniel P. Berrange
08ea852c25 nodeinfo: remove sysfs_prefix from all methods
Nearly all the methods in the nodeinfo file are given a
'const char *sysfs_prefix' parameter to override the
default sysfs path (/sys/devices/system). Every single
caller passes in NULL for this, except one use in the
unit tests. Furthermore this parameter is totally
Linux-specific, when the APIs are intended to be cross
platform portable.

This removes the sysfs_prefix parameter and instead gives
a new method linuxNodeInfoSetSysFSSystemPath for use by
the test suite.

For two of the methods this hardcodes use of the constant
SYSFS_SYSTEM_PATH, since the test suite does not need to
override the path for thos methods.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-09 18:00:18 +01:00
Martin Kletzander
5f4c50d528 qemu: Yet another check for blkdeviotune values
If you want to set block device I/O tuning values that end with '_max'
and there is nothing else set, libvirt emits an error.  In particular:

  error: internal error: Unexpected error

That's an unknown error.  That is because *_max values depend on their
respective non-_max values.  QEMU even says that in the error message
sent as a response to the monitor command:

  "error": {"class": "GenericError", "desc": "bps_max/iops_max require
  corresponding bps/iops values"}

the problem was that we didn't know that and there was no check for it.
Adding such check makes sure that there will be less confused users.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-09 17:16:38 +02:00
Pavel Hrdina
93a2fb230a vnc: add support for listen type none
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 14:46:45 +02:00
Pavel Hrdina
c34ada0996 spice: introduce listen type none
This new listen type is currently supported only by spice graphics.
It's introduced to make it easier and clearer specify to not listen
anywhere in order to start a guest with OpenGL support.

The old way to do this was set spice graphics autoport='no' and don't
specify any ports.  The new way is to use <listen type='none'/>.  In
order to be able to migrate to old libvirt the migratable XML will be
generated without the listen element and with autoport='no'.  Also the
old configuration will be automatically converted to the this listen
type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 14:44:08 +02:00
Pavel Hrdina
ffac505639 spice: introduce spice_auto_unix_socket config option
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 14:43:39 +02:00
Pavel Hrdina
e0c309b2dc spice: add support for listen type socket
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1335832

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 14:43:15 +02:00
Pavel Hrdina
61a63abfe8 qemu_capabilites: add QEMU_CAPS_SPICE_UNIX
Add a new capability to detect support of unix sockets for spice
graphics.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 14:43:09 +02:00
Pavel Hrdina
acc83afe33 vnc: add support for listen type 'socket'
VNC graphics already supports sockets but only via 'socket' attribute.
This patch coverts that attribute into listen type 'socket'.

For backward compatibility we need to handle listen type 'socket' and 'socket'
attribute properly to support old XMLs and new XMLs.  If both are provided they
have to match, if only one of them is provided we need to be able to parse that
configuration too.

To not break migration back to old libvirt if the socket is provided by user we
need to generate migratable XML without the listen element and use only 'socket'
attribute.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 14:42:48 +02:00
Pavel Hrdina
b6465e1aa4 graphics: introduce new listen type 'socket'
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 14:24:00 +02:00
Pavel Hrdina
c5caecab7b vnc: move generation of socket path to qemuProcessGraphicsSetupListen
This moves the socket generation if "vnc_auto_unix_socket" is set.

It also fixes a bug with this config option that we should auto-generate
socket path only if listen type is address and there is no address
specified.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 14:22:34 +02:00
Pavel Hrdina
17271d04e7 vnc: rename socketAutogenerated to socketFromConfig
Even though it's auto-generated it's based on qemu.conf option and listen type
address already uses "fromConfig" to carry this information.  Following commits
will convert the socket to listen element so this rename is required because
there will be also an option to get socket auto-generated independently on the
qemu.conf option.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 14:22:30 +02:00
Pavel Hrdina
fdff47c587 qemu_command: move websocket code into else part for address listen
There is no need to check again for vnc socket.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 14:22:27 +02:00
Martin Kletzander
326e5941cd qemu: Generate channel target paths on hotplug as well
Since commit 7140807917, qemu agent
channel cannot be plugged in because we won't generate its path
automatically.  Let's not only fix that, but also add tests for it so
next time it's checked for.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-09 13:27:54 +02:00
Martin Kletzander
f670008b58 qemu: Move channel path generation out of command creation
Put it into separate function called qemuDomainPrepareChannel() and call
it from the new qemuProcessPrepareDomain().

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-09 13:23:15 +02:00
Jiri Denemark
877c46d8a7 cpu: Add ARAT x86 CPU feature
Implemented in QEMU by commit 28b8e4d0bf93ba176b4b7be819d537383c5a9060.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 10:16:44 +02:00
Jiri Denemark
6dd5910da7 cpu: Add x86 feature flags for CPUID leaf 0xd, sub leaf 1
This was implemented in QEMU by commit 0bb0b2d2fe7f645dda.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 10:16:44 +02:00
Jiri Denemark
4c39a448e8 cpu: Sort CPU map features on eax_in
As a side effect this changes the order of CPU features in XMLs
generated by libvirt, but that's not a big deal since the order there is
insignificant.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 10:16:44 +02:00
Jiri Denemark
177bbc672f cpu: Shorten eax_in values in CPU map
For two reasons:
- 0x00000001 is very similar to 0x80000001, but 0x01 is visually
  different
- 0x01 format is consistent with CPUID manual

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 10:16:44 +02:00
Jiri Denemark
76561efedd cpu_x86: Add full support for ecx_in CPUID parameter
This patch makes our CPUID handling code up-to-date with the current
specification found in

Intel® 64 and IA-32 Architectures Developer's Manual: Vol. 2A
http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 10:16:41 +02:00
Jiri Denemark
f0fd7ae122 cpu_x86: Prepare for ecx_in CPUID parameter
CPUID instruction normally takes its parameter from EAX, but sometimes
ECX is used as an additional parameter. This patch prepares the x86 CPU
driver code for the new 'ecx_in' CPUID parameter.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 10:03:38 +02:00
Jiri Denemark
a54234c37b cpu_x86: Refactor internal KVM features
The internal features are only used in explicit checks with
cpuHasFeature. Loading them into the CPU map is dangerous since the
features may accidentally be reported to users when decoding CPUID data.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
74b23a00eb cpu_ppc64: Avoid unnecessary pointer to virCPUppc64Data
virCPUData and struct ppc64_model structures contained a pointer to
virCPUppc64Data, which was not very nice since the real data were
accessible by yet another level of pointers from virCPUppc64Data.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
9ea32aecb4 cpu_x86: Avoid unnecessary pointers to virCPUx86Data
virCPUData, virCPUx86Feature, and virCPUx86Model all contained a pointer
to virCPUx86Data, which was not very nice since the real CPUID data were
accessible by yet another pointer from virCPUx86Data. Moreover, using
virCPUx86Data directly will make static definitions of internal CPU
features a bit easier.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
2a8d40f4ec qemu: Refactor qemuMonitorJSONGetCPUx86Data
This patch splits qemuMonitorJSONGetCPUx86Data in three functions:

- qemuMonitorJSONCheckCPUx86 checks if QEMU supports reporting CPUID
  features for a guest CPU

- qemuMonitorJSONParseCPUx86Features parses CPUID features from a JSON
  array

- qemuMonitorJSONGetCPUx86Data gets the requested guest CPU property
  from QOM and uses qemuMonitorJSONParseCPUx86Features to parse it

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
90f4bc34b5 cpu_x86: Rename CPUID function to eax_in
CPUID instruction normally takes its parameter from EAX, but sometimes
ECX is used as an additional parameter. Let's rename 'function' to
'eax_in' in preparation for adding 'ecx_in'.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
7ab88767a7 cpu: Detect arch when parsing CPU data
A CPU data XML file already contains the architecture, let the parser
use it to detect which CPU driver should be used to parse the rest of
the file.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
a68ab347d5 cpu_x86: Fix CPU data parser
The formatter uses /cpudata/cpuid elements and the parser should really
do the same.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
fc4ee3e674 cpu_x86: Propagate vendor to guest's virCPUData
When computing CPU data for a given guest CPU we should set CPUID vendor
bits appropriately so that we don't lose the vendor when transforming
CPU data back to XML description.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Ján Tomko
378ef3df57 Fix typo in virNetDevGetEthtoolGFeatures stub
s/ATTRIBUGE/ATTRIBUTE/

Reported-by: Olaf Hering <olaf@aepfle.de>
2016-06-09 08:45:14 +02:00
Jovanka Gulicoska
609ba3a751 node_device: Replace VIR_ERROR with standard vir*Error in state driver init 2016-06-08 10:19:32 -04:00
Ján Tomko
e4fd42d87b lxc: simplify lxcDomainGetBlkioParameters
Replace all the repetitive code by using
virDomainGetBlkioParametersAssignFromDef, similar to what commit 9f50f6e
did in the qemu driver.
2016-06-08 15:25:35 +02:00
Ján Tomko
32e6339c19 Export virDomainGetBlkioParametersAssignFromDef
Move qemuDomainGetBlkioParametersAssignFromDef into domain_conf
and export it, to allow reuse in the LXC driver.
2016-06-08 15:23:44 +02:00
Ján Tomko
e74bbe5caf Use virDomainObjGetDefs in lxcDomainGetBlkioParameters 2016-06-08 15:23:44 +02:00
Ján Tomko
f62e4f2091 Use virDomainObjGetDefs in lxcDomainSetBlkioParameters
Remove yet another usage of virDomainLiveConfigHelperMethod
along with an sa_assert that helped clang understand the code flow.
2016-06-08 15:23:44 +02:00
Ján Tomko
a4b1371803 Use virDomainObjGetDefs in lxcDomainGetMemoryParameters
Instead of virDomainLiveConfigHelperMethod.
2016-06-08 15:23:40 +02:00
Ján Tomko
c643910486 Use virDomainObjGetDefs in lxcDomainGetSchedulerParametersFlags
On LXC domain startup we have already called virDomainObjSetDefTransient
to fill vm->newDef.

There is no need to call virDomainLiveConfigHelperMethod which has the
ability to fill newDef if it's NULL.
2016-06-08 15:22:36 +02:00
Ján Tomko
1ca45c8fb5 Use virDomainObjGetDefs in lxcDomainSetSchedulerParametersFlags
On LXC domain startup we have already called virDomainObjSetDefTransient
to fill vm->newDef.

There is no need to call virDomainLiveConfigHelperMethod which has the
ability to fill newDef if it's NULL.
2016-06-08 15:22:00 +02:00
Ján Tomko
15654cc594 Use virDomainObjGetDefs in lxcDomainSetMemoryFlags
On LXC domain startup we have already called virDomainObjSetDefTransient
to fill vm->newDef.

There is no need to call virDomainLiveConfigHelperMethod which has the
ability to fill newDef if it's NULL.
2016-06-08 15:21:57 +02:00
Ján Tomko
c646cd742a lxc: rename vmdef to persistentDef
A few functions using virDomainLiveConfigHelperMethod use the generic
name 'vmdef' to point to the persistent definition.

Use persistentDef and/or persistentDefCopy to make its purpose obvious.
2016-06-08 15:20:35 +02:00
Daniel P. Berrange
6d310c9cff remote: allow TLS priority to be customized
Support reading the TLS priority from the client configuration
file via the "tls_priority" config option, eg

 $ cat $HOME/.config/libvirt/libvirt.conf
 tls_priority="NORMAL:-VERS-SSL3.0"

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:45 +01:00
Daniel P. Berrange
5f1837eaca Pass config file object through to driver open methods
The virConnectOpenInternal method opens the libvirt client
config file and uses it to resolve things like URI aliases.

There may be driver specific things that are useful to
store in the config file too, so rather than have them
re-parse the same file, pass the virConfPtr down to the
drivers.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:45 +01:00
Daniel P. Berrange
416358d99d remote: allow TLS protocol/cipher priority override in URI
Add support for a "tls_priority" URI parameter in remote
driver URIs. eg

 qemu+tls://localhost/session?tls_priority=NORMAL:-VERS-SSL3.0

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:45 +01:00
Daniel P. Berrange
214489f550 rpc: allow priority string to be passed to TLS context
Extend the virNetTLSContextNew* constructors to allow
the TLS priority string to be passed in, overriding the
compile time default.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:45 +01:00
Daniel P. Berrange
cbb2e91ecc configure: allow setting default TLS priority string
Currently libvirt calls gnutls_set_default_priority()
which on old systems resolves to "NORMAL" while new
systems it resolves to "@SYSTEM". Either way, this
is a global default that is identical across all apps.

We want to allow distros to flexibility to define a
custom default string for libvirt priority, so add
a --tls-priority=STRING  flag to configure to enable
this to be set.

It is expected that distros would use this when creating
RPM/Deb/etc packages, according to their preferred crypto
handling policies.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:45 +01:00
Daniel P. Berrange
20c5ded9d0 rpc: set gnutls log function at global init time
Currently we set the gnutls log function when creating a
TLS context, however, the setting is in fact global, not
per context. So we should be setting it when we first call
gnutls_global_init() instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:45 +01:00
Daniel P. Berrange
d8a8af3492 tls: remove support for gnutls 1.x.x, require 2.2.0
We need to use the gnutls_priority_set_direct method which
was not introduced until 2.1.7, so bump version to 2.2.0
which is the first stable release with it included. This
release dates from Dec 2007 so it is reasonable to ditch
support for the 1.x.x series for gnutls releases entirely.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:45 +01:00
Pavel Hrdina
407c6909bc qemu_process: don't print empty line if qemu exits without any error
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1335617

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-08 13:51:00 +02:00
Pavel Hrdina
c1b8d87bab qemu_monitor: rephrase error message if qemu closes monitor
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-08 13:50:31 +02:00
Ján Tomko
4702687cfb Introduce virXMLValidatorValidate
Split out the code for XML validation into a new function.
2016-06-08 09:58:54 +02:00
Ján Tomko
87ae612de9 Introduce virXMLValidatorInit
Split out all the code initializing the validator
to a separate function.
2016-06-08 09:58:54 +02:00
Ján Tomko
8657c7a12f Introduce virXMLValidatorFree
Split out the code cleaning up the validator.
2016-06-08 09:58:54 +02:00
Ján Tomko
71c68b40df Introduce virXMLValidator structure
Store all the data related to RNG validation in one structure to
allow splitting virXMLValidateAgainstSchema.
2016-06-08 09:58:54 +02:00
Peter Krempa
9cda91d6f6 qemu: process: Call disk startup policy check after cloning domain def
In commit 1e38ef72 the disk startup policy check was moved prior to the
call to virDomainObjSetDefTransient which dropped the disk from the
config rather than the def to be started which is a bug.

Additionally we'd not report the disk change event for this since the
disk aliases were not set at that point.

Finally 'volume' based disks would not work with startup policy too.

Fix it by moving it back after the definition is copied, aliases are
assigned and disk sources are translated.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1341415
2016-06-08 08:15:11 +02:00
Peter Krempa
1e467f6622 qemu: domain: Sanitize return value handling in disk presence checker
One of the functions is returning always 0 and the second one uses
unnecessary labels.
2016-06-08 08:15:11 +02:00
Peter Krempa
f392654b5e qemu: driver: Unset log file watcher after restoring a VM save file
qemuProcessStart does not unset the infrastructure that retrieves errors
from the qemu log file in case of migration. As this wasn't handled
properly in qemuDomainSaveImageStartVM we kept the logging context/fd
open for the lifetime of the VM rather than closing it after it's not
needed.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1325080
2016-06-08 08:10:54 +02:00
Philipp Hahn
fafcc64a07 xen: Also add sub-type for driver=tap2 in xen-xm
tap2 only handles 'aio', but not 'raw', which must be explicitly given:

| $ virsh domxml-to-native yyy.xml > yyy.xm
| $ xm new yyy.xm
| Error: tap:/srv/xen/xxx.img not a valid disk type
| $ sed -i -e 's/tap2:/&aio:/' yyy.xm
| $ xm new yyy.xm

Fix reading and writing "xen-xm" format for "tap2" by handling it the
same as "tap".
2016-06-07 13:59:58 -06:00
Jovanka Gulicoska
62aff792ac qemu: Replace VIR_ERROR with standard vir*Error in state driver init 2016-06-07 13:47:13 -04:00
Jovanka Gulicoska
9c9afba4c0 xen: Replace VIR_ERROR with standard vir*Error in state driver init 2016-06-07 13:47:13 -04:00
Jovanka Gulicoska
de48ee1d6c uml: Replace VIR_ERROR with standard vir*Error in state driver init 2016-06-07 13:46:34 -04:00
Peter Krempa
ecb714de53 qemu: migration: Add VM log entry on start of migration
Note the start of migration of a qemu process to the VM log file for
possible debug purposes.
2016-06-07 18:10:29 +02:00
Peter Krempa
cf3ea0769c qemu: process: Append the "shutting down" message using the new APIs
Use qemuDomainLogAppendMessage rather than attempting to open a new
logging context with file descriptors. The new approach allows to log
the message even if qemu is still running at that point which appens
during migration finish phase where qemuProcessStop is killing qemu.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1312188
2016-06-07 18:10:29 +02:00
Peter Krempa
91a6eacc8f qemu: domain: Implement helper for one-shot log entries to the VM log file
Along with the virtlogd addition of the log file appending API implement
a helper for logging one-shot entries to the log file including the
fallback approach of using direct file access.

This will be used for noting the shutdown of the qemu proces and
possibly other actions such as VM migration and other critical VM
lifecycle events.
2016-06-07 18:10:29 +02:00
Peter Krempa
78b9b85c06 log: daemon: Add remote protocol handling for the log appending API
Implement the RPC dispatcher and caller for the new API.
2016-06-07 18:10:29 +02:00
Peter Krempa
5e6143fbcc log: handler: Add new API to append to logging files
For logging one-shot entries to the VM log file it's quite a waste to
hold open the file descriptor for logging that is provided by the
current API.

This new API will be ideal for logging one-shot entries to the file
e.g. at the point when we shut the VM down rather than having to add the
whole file-descriptor infrastructure.

Additionally this will allow to add the messages even after restart of
libvirtd since virtlogd doesn't allow to obtain a regular context with
filedescriptors while the VM is still active.
2016-06-07 18:10:29 +02:00
John Ferlan
456ccc14d5 util: Perform proper virRandomBytes return value checking
Document the return value of virRandomBytes as 0 or some errno value and
then make sure all callers make the proper checks.
2016-06-07 10:18:36 -04:00
Ján Tomko
cf922bf837 Reindent virNetDevSendEthtoolIoctl 2016-06-07 14:13:11 +02:00
Ján Tomko
0a9bbe748a Reuse the socket in virNetDevGetFeatures
This speeds up node_device_udev driver startup 11x.
2016-06-07 14:13:11 +02:00
Ján Tomko
d59ca0b05f Return bool in virNetDevFeatureAvailable
Simplify the logic
2016-06-07 14:13:11 +02:00
Ján Tomko
3a7440bdc7 Split out virNetDevGetEthtoolGFeatures
Move out the code depending on HAVE_DECL_ETHTOOL_GFEATURES.
2016-06-07 14:13:11 +02:00
Ján Tomko
970af4a69f Split out virNetDevGetEthtoolFeatures
Split out the features that we probe via various ethtool commands
and ETHTOOL_GFLAGS.
2016-06-07 14:13:11 +02:00
Ján Tomko
0a7da7882d Move struct elem out of virNetDevGetFeatures
Rename struct elem to virNetDevEthtoolFeatureCmd and move it
out of the function to allow reusing it.
2016-06-07 14:13:11 +02:00
Ján Tomko
7d097b223d Reindent comment of virNetDevFeatureAvailable 2016-06-07 14:13:11 +02:00
Peter Krempa
577fb98fbd qemu: process: Allow VIR_QEMU_PROCESS_START_NEW in qemuProcessLaunch
The new flag was not added to virCheckFlags in commit '0d1c17aa' causing
a regression where VMs were not able to start.
2016-06-07 13:56:36 +02:00
John Ferlan
896c4862d5 util: Alter virCryptoEncryptData for non GNUTLS builds
Rather than intermixing the ATTRIBUTE_UNUSED - use HAVE_GNUTLS_CIPHER_ENCRYPT
for the whole function instead.
2016-06-07 07:38:25 -04:00
Ján Tomko
1fd8fc8fc1 Add nomatch filters when enumerating udev devices
Filter out some subsystems we are not interested in.
2016-06-07 13:23:22 +02:00
Ján Tomko
207a50f7cd node_device_udev: rename labels to cleanup
Instead of the custom out and out_unlock.
2016-06-07 13:23:22 +02:00
Ján Tomko
074b4888ee node_device_udev: remove unnecessary ret variables
Remove ret variables and labels from functions where there is no cleanup
to be done.
2016-06-07 13:23:22 +02:00
Peter Krempa
5972f185e1 qemu: Move check that validates 'min_guarantee' to qemuDomainDefValidate
Introduce a validation callback for qemu and move checking of
min_guarantee to the new callback.
2016-06-07 13:02:20 +02:00
Peter Krempa
18f1dda390 conf: Move validation of disk LUN device to the appropriate place
Now with the proper domain config validation infrastructure the check
can be moved to a place that doesn't make domains vanish.
2016-06-07 13:02:20 +02:00
Peter Krempa
05eab1bf9a conf: Move disk info validator to the domain conf validator
Since it will not be called from outside of conf we can unexport it too
if we move it to the appropriate place.

Test suite change is necessary since the error will be reported sooner
now.
2016-06-07 13:02:20 +02:00
Peter Krempa
d071d292ca qemu: process: Call the domain config validator when starting a new VM
To avoid duplicating all the checks when starting a fresh VM from a
possibly unchecked config, call the domain def validator.
2016-06-07 13:02:20 +02:00
Peter Krempa
0d1c17aa68 qemu: process: Convert multiple boolean args to a single flag
Validation of qemu process startup requires to know whether the process
is used for a fresh VM or whether it's reloaded from a
snapshot/migration. Pass this information in via a flag rather than
calculating it from a bunch of bools.
2016-06-07 13:02:20 +02:00
Peter Krempa
43e21b1f10 qemu: process: Unexport qemuProcessStartValidate 2016-06-07 13:02:20 +02:00
Peter Krempa
9890a7a183 conf: Add device def validation callback
Similarly to the domain definition validator add a device validator. The
change to the prototype of the domain validator is necessary as
virDomainDeviceInfoIterateInternal requires a non-const pointer.
2016-06-07 13:02:20 +02:00
Peter Krempa
0fc1fde20b conf: drop 'def' from struct virDomainDefPostParseDeviceIteratorData
It's passed to all places along with the structure.
2016-06-07 13:02:20 +02:00
Peter Krempa
b394af162a conf: Add infrastructure for adding configuration validation
Until now we weren't able to add checks that would reject configuration
once accepted by the parser. This patch adds a new callback and
infrastructure to add such checks. In this patch all the places where
rejecting a now-invalid configuration wouldn't be a good idea are marked
with a new parser flag.
2016-06-07 13:02:20 +02:00
Peter Krempa
998c9e34e6 conf: Rename VIR_DOMAIN_DEF_PARSE_VALIDATE to VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA
Make it obvious that the flag is controlling RNG schema validation.
2016-06-07 13:02:20 +02:00
Ján Tomko
0c8fe3d457 node_device_udev: remove yoda condition 2016-06-07 12:53:37 +02:00
Ján Tomko
29c2a9cc21 udevSetupSystemDev: return if allocation fails
There is no cleanup to be done.
2016-06-07 12:53:37 +02:00
Ján Tomko
d1d4719814 Reformat udevProcessRemoveableMedia
Remove unnecessary ret variable and return early if we have no media
to save on indentation.
2016-06-07 12:53:37 +02:00
Ján Tomko
e2859b9dcd udevProcessStorage: trim all whitespace from model and vendor
Use virTrimSpaces instead of a custom implementation.
2016-06-07 12:53:37 +02:00
Ján Tomko
cc1d0e2a0e node_device_udev: switch to using virReportError
Also use the more common "Unable to initialize mutex" string
and virReportSystemError instead of virStrerror.
2016-06-07 12:53:37 +02:00
Ján Tomko
c40ed871cc Remove PROPERTY_* constants
They are no longer used.
2016-06-07 12:53:37 +02:00
Ján Tomko
4ab526ef71 Only return two values in udevGetUintSysfsAttr
Open code the call to udev_device_get_sysattr_value
in the one place where it's needed.
2016-06-07 12:53:37 +02:00
Ján Tomko
3554492a08 Only return two values in udevGetIntSysfsAttr
Callers only check for an error or a specific integer value.
2016-06-07 12:53:37 +02:00
Ján Tomko
e545806db9 Only return two values in udevGetStringSysfsAttr
The callers only care for an error, and a missing attribute
is simply NULL.
2016-06-07 12:53:37 +02:00
Ján Tomko
470498de18 Remove extra allocation in udevGetDeviceSysfsAttr
Most of the code paths free it right after converting it to
an integer.
2016-06-07 12:53:37 +02:00
Ján Tomko
10427db779 Only return two values in udevGetUintProperty
We only care about the failure, not a missing property.
2016-06-07 12:53:37 +02:00
Ján Tomko
71402ef6f5 Only return two values in udevGetStringProperty
There is no need to differentiate between PROPERTY_FOUND
and PROPERTY_MISSING - we can just look if the string is non-NULL.
2016-06-07 12:53:37 +02:00
Martin Kletzander
3484c05ce0 qemu: Add support to QXL's max_outputs parameter
Historically, we added heads=1 to videos, but for example for qxl, we
did not reflect that on the command line.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-07 12:42:54 +02:00
Martin Kletzander
6e81a1f9ef qemu: Check for qxl's max_outputs parameter
Add capabilities for both qxl and qxl-vga devices.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-07 12:40:01 +02:00
Ján Tomko
71cddab042 Rewrite disk type checking in udevProcessStorage
Error out on parsing errors and use a local const char pointer
instead of chained ifs to check whether we found a match.
2016-06-07 12:14:24 +02:00
Ján Tomko
4ccf6886c8 Fix the return value in udevKludgeStorageType
Since the switch to VIR_STRDUP this function returns 1 on success,
but the caller treats any non-zero value as failure.
2016-06-07 12:13:59 +02:00
Ján Tomko
df7291c31c udevProcessFloppy; remove unnecessary allocation
Use udevHasDeviceProperty instead of udevGetStringProperty.
We do not need to copy the string since we do not need it.

Also add braces around the if body, since the change made
syntax check complain.
2016-06-07 12:13:38 +02:00
Ján Tomko
61cafffb2f Move udevHasDeviceProperty earlier 2016-06-07 12:13:33 +02:00
Ján Tomko
0d372687eb Do not VIR_STRDUP the string in udevGetDeviceProperty
Two out of three callers free it right after converting it to a number.

Also change the comment at the beginning of the function, because
the comment inside the function told me to.
2016-06-07 12:00:36 +02:00
Ján Tomko
fde3a38e03 Remove udevStrToLong_i
Open code the error message.
2016-06-07 12:00:36 +02:00