Commit Graph

15817 Commits

Author SHA1 Message Date
Dmitry Andreev
3522a311ea qemu: add capability check for memballoon 'deflate-on-oom' feature
Add appropriate capability check and new virQEMUCaps flag for the new
virtio balloon feature. QEMU commit with the complete feature description:
http://git.qemu.org/?p=qemu.git;a=commit;h=e3816255bf4b6377bb405331e2ee0dc14d841b80
2016-01-12 10:48:21 -05:00
Dmitry Andreev
7bf3198df6 conf: introduce 'autodeflate' attribute for memballoon device
Excessive memory balloon inflation can cause invocation of OOM-killer,
when Linux is under severe memory pressure. QEMU memballoon device
has a feature to release some memory at the last moment before some
process will be get killed by OOM-killer.

Introduce a new optional balloon device attribute 'autodeflate' to
enable or disable this feature.
2016-01-12 10:48:21 -05:00
Cole Robinson
2eb7a97575 rpc: socket: Don't repeatedly attempt to launch daemon
On every socket connect(2) attempt we were re-launching session
libvirtd, up to 100 times in 5 seconds.

This understandably caused some weird load races and intermittent
qemu:///session startup failures

https://bugzilla.redhat.com/show_bug.cgi?id=1271183
2016-01-12 10:45:45 -05:00
Cole Robinson
8da02d5280 rpc: socket: Explicitly error if we exceed retry count
When we autolaunch libvirtd for session URIs, we spin in a retry
loop waiting for the daemon to start and the connect(2) to succeed.

However if we exceed the retry count, we don't explicitly raise an
error, which can yield a slew of different error messages elsewhere
in the code.

Explicitly raise the last connect(2) failure if we run out of retries.
2016-01-12 10:45:45 -05:00
Cole Robinson
f102c7146e rpc: socket: Minor cleanups
- Add some debugging
- Make the loop dependent only on retries
- Make it explicit that connect(2) success exits the loop
- Invert the error checking logic
2016-01-12 10:45:45 -05:00
Roman Bogorodskiy
bc451c4980 Add missing virxdrdefs.h include to log_protocol
Commit 2b6f6ad introduced the virxdrdefs.h header with
common definitions to be included in the protocol files,
but logging/log_protocol.x was missed, so add it there as well.

Hopefully this fixes build on OS X.
2016-01-12 18:15:09 +03:00
Ben Gray
133c511b52 rpc: Don't rewrite msg->fds on every read dispatch
When we are receiving data in smaller chunks it might happen that
virNetServerClientDispatchRead() will be called multiple times.  And as
that happens, if it is a message that also transfer headers, we decode
the number of them every single time and, unfortunately, also allocate
the memory for them.  That causes a leak, in the best scenario.

Best viewed with '-w'.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-12 08:56:50 +01:00
Laine Stump
21e63916dc util: eliminate bogus error log in virNetDevVPortProfileGetStatus
if instanceId is NULL

When virNetDevVPortProfileGetStatus() was called with instanceId =
NULL (which is the case for all DISASSOCIATE requests in 802.1Qbh) it
would log the following error:

   Could not find netlink response with expected parameters

even though the disassociate had been successfully completely. Then,
due to the fortunate coincidence of status having been initialized to
0 and then not changed when the "failure" was encountered, it would
still return a status of 0 (PORT_VDP_RESPONSE_SUCCESS), so the caller
would assume a successful operation.

This would result in a spurious log message though, and would fill in
LastErrorMessage, so that the API would return that error if it
happened during cleanup from some other error. That, in turn, would
lead to an incorrect supposition that the response to the port profile
disassociate was the cause of the failure.

During debugging, I noticed that the VF in question usually had *no
uuid* associated with it (big surprise)by the time the disassociate
completed, so the solution is *not* to send the previous instanceId
down.

This patch fixes virNetDevVPortProfileGetStatus() to only check the
VF's uuid in the status if it was given an instanceId to check against
when originally called. Otherwise it only checks that the particular
VF is present (it will be).

This does cause a slight difference in behavior - rather than
returning with status unchanged (and thus always 0) it will actually
get the IFLA_PORT_RESPONSE. This could lead to revelation of error
conditions we were previously ignoring. Or not. So far "not".
2016-01-11 17:09:28 -05:00
Laine Stump
47b830370a qemu: use enum when setting PCI "multi" value, not 0 or 1
Use the VIR_TRISTATE_SWITCH_* enums appropriately.

No functional change.
2016-01-11 15:13:54 -05:00
Laine Stump
bd04ad42e7 qemu: auto-add a USB2 controller set for Q35 machines
Use virDomainDefAddUSBController() to add an EHCI1+UHCI1+UHCI2+UHCI3
controller set to newly defined Q35 domains that don't have any USB
controllers defined.
2016-01-11 13:21:10 -05:00
Laine Stump
8ebca27bb7 qemu: define virDomainDevAddUSBController()
This new function will add a single controller of the given model,
except the case of ich9-usb-ehci1 (the master controller for a USB2
controller set) in which case a set of related controllers will be
added (EHCI1, UHCI1, UHCI2, UHCI3). These controllers will not be
given PCI addresses, but should be otherwise ready to use.

"-1" is allowed for controller model, and means "default for this
machinetype". This matches the existing practice in
qemuDomainDefPostParse(), which always adds the default controller
with model = -1, and relies on the commandline builder to set a model
(that is wrong, but will be fixed later).
2016-01-11 13:16:51 -05:00
Laine Stump
ed64d92bea conf: add virDomainDefAddController()
We need a virDomainDefAddController() that doesn't check for an
existing controller at the same index (since USB2 controllers must be
added in sets of 4 that are all at the same index), so rather than
duplicating the code in virDomainDefMaybeAddController(), split it
into two functions, in the process eliminating existing duplicated
code that loops through the controller list by calling
virDomainControllerFind(), which does the same thing).
2016-01-11 13:08:26 -05:00
Laine Stump
163338ec28 qemu: prefer 00:1D.x and 00:1A.x for USB2 controllers on Q35
The real Q35 machine puts the first USB controller set (EHCI+(UHCIx4))
on bus 0 slot 0x1D, and the 2nd USB controller set on bus 0 slot 0x1A,
so let's attempt to make the virtual machine match that for
controllers with auto-assigned addresses when possible.

Three test cases were added to assure that the proper addresses are
assigned - one with a single set of unaddressed USB controllers, one
with 3 (to grab both preferred slots plus one more), and one with the
order of the controller definitions reordered, to assure that the
auto-assignment isn't mixed up by order.
2016-01-11 13:04:17 -05:00
Laine Stump
7dbb5fce06 qemu: don't assume slot 0 is unused/reserved.
When qemuAssignDevicePCISlots() is looking for companion controllers
for a USB controller that has no PCI address specified, it initializes
a virDevicePCIAddress to 0000:00:00.0, fills it in with the
companion's address if one is found, then checks whether or not there
was a find based on slot == 0. On a system with a single PCI bus, that
is a valid way to check, because slot 0 is reserved, but on most other
PCI buses, slot 0 is not reserved, and is open for use by any
device. This patch adds a separate bool that is set when a companion
is found rather than relying on the faulty information provided with
"slot == 0".
2016-01-11 12:58:40 -05:00
Jasper Lievisse Adriaanse
2b6f6ad64b Unify int types handling in protocol files
Some of the protocol files already include handing of the missing int
types such as xdr_uint64_t, some don't. To fix it everywhere, move out
of the appropriate defines to the utils/virxdrdefs.h file and include
it where needed.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
2016-01-11 19:56:06 +03:00
Jasper Lievisse Adriaanse
91b423beb7 Use struct sockpeercred when available
OpenBSD uses 'struct sockpeercred' instead of 'struct ucred'. Add a
configure check that detects its presence and use if in the code that
could be compiled on OpenBSD.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
2016-01-11 19:56:06 +03:00
Jasper Lievisse Adriaanse
1b60f1b401 cgroup: don't include sys/mount.h if not needed
As cgroup implementation only works on Linux, it does not
make much sense to include sys/mount.h if other requirements are
not met, such as HAVE_MNTENT_H and HAVE_GETMNTENT_R.

Also, it fixes build on OpenBSD that requires to include sys/param.h
along with sys/mount.h.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
2016-01-11 19:56:06 +03:00
Michal Privoznik
0a84286d8f qemu: Introduce QEMU_CAPS_VSERPORT_CHANGE
This capability tells if qemu is capable of vserport_change
events.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-11 17:17:52 +01:00
Michal Privoznik
d5762cc034 qemu: change qemuFindAgentConfig return type
While this is no functional change, whole channel definition is
going to be needed very soon. Moreover, while touching this obey
const correctness rule in qemuAgentOpen() - so far it was passed
regular pointer to channel config even though the function is
expected to not change pointee at all. Pass const pointer
instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-11 17:17:52 +01:00
Michal Privoznik
2f50445537 qemu: Set virtio channel state sooner
In qemu driver we listen to virtio channel events like an agent
connected to or disconnected from the guest part of socket.
However, with a little exception - when we find out that the
socket in question is the guest agent one, we connect or
disconnect guest agent which is done prior setting new state in
internal structure. Due to a bug in our code it may happen that
we got the event but failed to set it in internal structure
representing the channel.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-11 17:16:29 +01:00
Martin Kletzander
6dc0e4f171 Fix LSB requirements in service script and sync them
Commit b22344f328 mistakenly reordered
Default-* lines.  Thanks to that I noticed that we are very inconsistent
with our init scripts, so I took the liberty of synchronizing them,
updating them and making them all look shiny and new.  So apart from
fixing the LSB requirements, I also fixed the ordering, specified
runlevels and fix the link to the reference specification.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-11 15:49:13 +01:00
Michal Privoznik
506e9d6c2d virDomainGetTime: Deny on RO connections
We have a policy that if API may end up talking to a guest agent
it should require RW connection. We don't obey the rule in
virDomainGetTime().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-11 13:36:19 +01:00
Michal Privoznik
95c370f0ee virDomainInterfaceAddresses: Allow API on RO connection too
This API does not change domain state. However, we have a policy
that an API talking to a guest agent requires RW access. But that
happens only if source == VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-11 13:36:19 +01:00
Martin Kletzander
8223bd22ed Don't clear libvirt-internal paths when parsing status XML
Earlier commit 7140807917 forgot to deal
properly with status XMLs where we want the libvirt-internal paths to be
kept in place and not cleared, otherwise we could end up copying a NULL
string and segfaulting th daemon.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-11 10:54:50 +01:00
Martin Kletzander
93103da84b Provide parse flags to PostParse functions
This way both Domain and Device PostParse functions can act based on the
flags.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-11 10:54:50 +01:00
Cole Robinson
fde937bda0 qemu: command: wire up usage of q35/ich9 disable s3/s4
If the q35 specific disable s3/s4 setting isn't supported, fallback to
specifying the PIIX setting, which is the previous behavior. It doesn't
have any effect, but qemu will just warn about it rather than error:

  qemu-system-x86_64: Warning: global PIIX4_PM.disable_s3=1 not used
  qemu-system-x86_64: Warning: global PIIX4_PM.disable_s4=1 not used

Since it doesn't error, I don't think we should either, since there
may be configs in the wild that already have q35 + disable_s3/4 (via
virt-manager)
2016-01-10 15:16:38 -05:00
Cole Robinson
c77fd89000 qemu: caps: check for q35/ICH9 disable S3/S4
Update test data to match
2016-01-10 14:59:53 -05:00
Cole Robinson
5900356efb qemu: caps: Rename CAPS_DISABLE_S[34] to CAPS_PIIX_DISABLE_S[34]
These settings are specific to PIIX, so clarify it
2016-01-10 14:59:53 -05:00
Cole Robinson
ab963449dc qemu: capabilities: s/Pixx/Piix/g
The chipset is called PIIX; the functions are misnamed
2016-01-10 14:59:53 -05:00
Michal Privoznik
b7fac9f77f virDomainMigrateUnmanagedParams: Don't blindly dereference @dconnuri
This function may be called with @dconnuri == NULL, e.g. from
virDomainMigrateToURI3() if the flags are missing
VIR_MIGRATE_PEER2PEER flag. Moreover, all later functions called
from here do wrap it into NULLSTR() so why not do the same here?

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-09 18:44:44 +01:00
Martin Kletzander
8156493d8d Fix USB model defaults for ppc64
The condition was checking for UHCI (and OHCI for ppc64) availability so
that it can specify the proper device instead of legacy usb.  However,
for ppc64, we don't need to check both OHCI and UHCI, but only OHCI as
that is the legacy default.  The condition is so big that it was just a
matter of time when someone will make a mistake there, so let's use more
lines so that it is visible what the condition checks for.

This fixes usage of -device instead of -usb for ppc64 that supports
pci-usb-ohci and does not support piix3-usb-uhci.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-09 18:39:17 +01:00
Jim Fehlig
f988ecfb34 libxl: support vif outgoing bandwidth QoS
The libxl_device_nic structure supports specifying an outgoing rate
limit based on a time interval and bytes allowed per interval. In xl
config a rate limit is specified as "<RATE>/s@<INTERVAL>". INTERVAL
is optional and defaults to 50ms.

libvirt expresses outgoing limits by average (required), peak, burst,
and floor attributes in units of KB/s. This patch supports the outgoing
bandwidth limit by converting the average KB/s to bytes per interval
based on the same default interval (50ms) used by xl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-01-08 18:56:00 -07:00
Jim Fehlig
ec63000a62 xenconfig: support vif bandwidth in xm and xl parser and formatter
Both xm and xl config have long supported specifying vif rate
limiting, e.g.

vif = [ 'mac=00:16:3E:74:3d:76,bridge=br0,rate=10MB/s' ]

Add support for mapping rate to and from <bandwidth> in the xenconfig
parser and formatter. rate is mapped to the required 'average' attribute
of the <outbound> element, e.g.

  <interface type='bridge'>
    ...
    <bandwidth>
      <outbound average='10240'/>
    </bandwidth>
  </interface>

Also add a unit test to check the conversion logic.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-01-08 18:56:00 -07:00
Jim Fehlig
1dd34bbb4b xenconfig: support vif bandwidth in sexpr parser and formatter
The xen sexpr config format has long supported specifying vif rate
limiting, e.g.

  (device
    (vif
      (mac '00:16:3e:1b:b1:47')
      (rate '10240KB/s')
      ...
    )
  )

Add support for mapping rate to and from <bandwidth> in the xenconfig
sexpr parser and formatter. rate is mapped to the required 'average'
attribute of the <outbound> element, e.g.

  <interface type='bridge'>
    ...
    <bandwidth>
      <outbound average='10240'/>
    </bandwidth>
  </interface>

Also add unit tests to check the conversion logic.

This patch benefits both the old xen driver and the libxl driver.
Both drivers gain support for vif bandwidth when converting to/from
domXML and xen-sxpr. In addition, the old xen driver will now be
able to handle vif 'rate' setting when communicating with xend.
2016-01-08 18:56:00 -07:00
Cole Robinson
3d92a000ff qemu: Fix crash when defining XML with bogus emulator
We weren't checking for failure of qemuCaps lookup
2016-01-08 20:05:31 -05:00
Laine Stump
79ba107670 util: add missing newline
Somehow I managed to backspace over the newline between the closing
brace and goto cleanup; in commit 36e244f3.
2016-01-08 14:09:31 -05:00
Cole Robinson
74abc3deac qemu: Handle SecurityManagerVerify in post parse
Rather than open coding calls. I can't see any reason not to
2016-01-08 13:25:21 -05:00
Cole Robinson
a8b628e7a8 qemu: Handle CanonicalizeMachine in post parse
Rather than open coding calls. I can't see any reason not to
2016-01-08 13:25:20 -05:00
Cole Robinson
9cec6239c1 qemu: domain: split out post parse default device handling
Should be a no-op
2016-01-08 13:25:20 -05:00
Cole Robinson
ee719cdcca domain: separate out function for post parse timer validation
This should be a no-op
2016-01-08 13:25:20 -05:00
Cole Robinson
11de45bb71 domain: separate out function for post parse console compat
This should be a no-op
2016-01-08 13:25:20 -05:00
Jiri Denemark
b2334e433a qemu: Refactor qemuMigrationFinish
To get rid of a giant if-else block which is very easy to get lost in.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-08 18:18:58 +01:00
Jiri Denemark
eb084a733b qemu: Report more migration statistics
memory_dirty_rate corresponds to dirty-pages-rate in QEMU and
memory_iteration is what QEMU reports in dirty-sync-count.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-08 18:18:58 +01:00
Jiri Denemark
b638b9b35c qemu: Create a proper type for migration status enum
The enum will be called qemuMonitorMigrationStatus.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-08 18:18:58 +01:00
Jiri Denemark
09bbd96239 qemu: Rename qemuMonitorMigrationStatus struct
The structure actually contains migration statistics rather than just
the status as the name suggests. Renaming it as
qemuMonitorMigrationStats removes the confusion.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-08 18:18:58 +01:00
Jiri Denemark
5fed699a2d qemu: Reorder migration status enum
A migration is in "setup" state after it was "inactive" and before it
becomes "active". Let's reflect this in our migration status enum.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-08 18:18:58 +01:00
Pavel Hrdina
4100aecd13 xen: move virDomainDefPostParse to xenParseSxpr
This patch partially reverts previous commit 91a00424 and moves the post
parse function to xenParseSxpr.  This update is required because xen
driver calls xenParseSxpr directly.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-01-08 14:45:20 +01:00
Martin Kletzander
f0df0dcaa0 Remove non-breaking space in comment
It was added by mistake before the 'If' by commit 7140807917.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-08 14:22:42 +01:00
Jiri Denemark
f87668b70e qemu: Fix NBD migration with default listenAddress
My commit 674afcb09e moved computing the
default listen address from qemuMigrationPrepareAny to
qemuMigrationPrepareIncoming. However, I didn't notice listenAddress was
later passed to qemuMigrationStartNBDServer. Thus, it would be called
with the original value of listenAddress (NULL).

Let's add the updated listen address to qemuProcessIncomingDef and use
it when starting NBD servers.

Reported-by: Michael Chapman <mike@very.puzzling.org>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-08 10:39:20 +01:00
Andrea Bolognani
4e1f37f812 pci: Log debug messages when manipulating the inactive list
Most of the changes to the list of active and inactive PCI devices
happen in virHostdev, where they are properly logged.

virPCIDeviceDetach() and virPCIDeviceReattach(), however, change the
inactive list as well, so they should be logging similar messages.
2016-01-08 09:52:33 +01:00
Michal Privoznik
587fd10554 virLogVMessage: Don't leak rawinitmsg
Instead of misusing a const string to hold up runtime allocated
data, introduce new variable @hoststr and obey const correctness.

==6879== 15 bytes in 1 blocks are definitely lost in loss record 68 of 1,064
==6879==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6879==    by 0xA7DDF97: vasprintf (in /lib64/libc-2.21.so)
==6879==    by 0x552BBC6: virVasprintfInternal (virstring.c:493)
==6879==    by 0x552BCDB: virAsprintfInternal (virstring.c:514)
==6879==    by 0x54FA44C: virLogHostnameString (virlog.c:468)
==6879==    by 0x54FAB0F: virLogVMessage (virlog.c:645)
==6879==    by 0x54FA680: virLogMessage (virlog.c:531)
==6879==    by 0x54FBBF4: virLogParseOutputs (virlog.c:1130)
==6879==    by 0x11CB4F: daemonSetupLogging (libvirtd.c:685)
==6879==    by 0x11E137: main (libvirtd.c:1297)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-08 09:16:33 +01:00
Michal Privoznik
9f7506488a virLogHostnameString: Don't leak hostname
Once @hostname is printed into @hoststr we don't need it anymore.

==6879== 5 bytes in 1 blocks are definitely lost in loss record 10 of 1,064
==6879==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6879==    by 0xA7ED599: strdup (in /lib64/libc-2.21.so)
==6879==    by 0x552C126: virStrdup (virstring.c:726)
==6879==    by 0x553B13E: virGetHostnameImpl (virutil.c:720)
==6879==    by 0x553B1BF: virGetHostnameQuiet (virutil.c:741)
==6879==    by 0x54FA3FD: virLogHostnameString (virlog.c:462)
==6879==    by 0x54FAB0F: virLogVMessage (virlog.c:645)
==6879==    by 0x54FA680: virLogMessage (virlog.c:531)
==6879==    by 0x54FBBF4: virLogParseOutputs (virlog.c:1130)
==6879==    by 0x11CB4F: daemonSetupLogging (libvirtd.c:685)
==6879==    by 0x11E137: main (libvirtd.c:1297)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-08 09:16:33 +01:00
Jiri Denemark
0e747f2029 qemu: Add debug message to spice migration
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-07 13:20:38 +01:00
Martin Kletzander
7140807917 qemu: Don't bother user with libvirt-internal paths
If user defines a virtio channel with UNIX socket backend and doesn't
care about the path for the socket (e.g. qemu-agent channel), we still
generate it into the persistent XML.  Moreover when then user renames
the domain, due to its persistent socket path saved into the per-domain
directory, it will not start.  So let's forget about old generated paths
and also stop putting them into the persistent definition.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-07 11:29:53 +01:00
Peter Krempa
5f7df34611 qemu: snapshot: Skip 'transaction' command when no disks are selected
When doing a memory-only snapshot libvirt would still issue the
'transaction' command without any disk. Skip it if it isn't necessary.
2016-01-07 08:26:35 +01:00
Wido den Hollander
6343018fac rbd: Do not append Ceph monitor port number 6789 if not provided
If no port number was provided for a storage pool libvirt defaults to
port 6789; however, librbd/librados already default to 6789 when no port
number is provided.

In the future Ceph will switch to a new port for the Ceph monitors since
port 6789 is already assigned to a different application by IANA.

Port 6789 is assigned to SMC-HTTPS and Ceph now has port 3300 assigned as
the 'Ceph monitor' port.

In this case it is the best solution to not hardcode any port number into
libvirt and let librados handle the connection.

Only if a user specifies a different port number we pass it down to librados,
otherwise we leave it blank.

Signed-off-by: Wido den Hollander <wido@widodh.nl>

merge
2016-01-06 08:13:50 -05:00
Wido den Hollander
f46d137e33 rbd: Do not error out on a single image during pool refresh
It could happen that rbd_list() returns X names, but that while
refreshing the pool one of those RBD images is removed from Ceph
through a different route then libvirt.

We do not need to error out in such case, we can simply ignore the
volume and continue.

  error : volStorageBackendRBDRefreshVolInfo:289 :
    failed to open the RBD image 'vol-998': No such file or directory

It could also be that one or more Placement Groups (PGs) inside Ceph
are inactive due to a system failure.

If that happens it could be that some RBD images can not be refreshed
and a timeout will be raised by librados.

  error : volStorageBackendRBDRefreshVolInfo:289 :
    failed to open the RBD image 'vol-893': Connection timed out

Ignore the error and continue to refresh the rest of the pool's
contents.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
2016-01-06 07:46:18 -05:00
Wido den Hollander
10028a9d58 rbd: Only close RBD image if it has been opened
It could be that we error out while the RBD image has not been
opened yet. This would cause us to call rbd_close() on pointer
which has not been initialized.

Set it to NULL by default and only close if it is not NULL.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
2016-01-06 07:46:17 -05:00
Olaf Hering
b22344f328 fix LSB part of virtlogd runlevel script
Currently pkg build of master branch fails:

[  300s] + /usr/lib/rpm/brp-boot-scripts
[  300s] E: File `virtlogd' is missing `Required-Start', please add even if empty!
[  300s] W: File `virtlogd' is missing `Required-Stop', please add even if empty!
[  300s] E: File `virtlogd' has empty `Default-Start', please specify default runlevel(s)!
[  300s] ERROR: found one or more broken init or boot scripts, please fix them.
[  300s]        For more information about LSB headers please read the manual
[  300s]        page of of insserv by executing the command `man 8 insserv'.
[  300s]        If you don't understand this, mailto=werner@suse.de
[  300s] error: Bad exit status from /var/tmp/rpm-tmp.44965 (%install)

Add the required tags, fix the existing tags.
Use soft dependency "Should-Start" because virtlogd may work without network.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2016-01-06 10:59:53 +01:00
Michael Chapman
44b4a4f6d7 virtlogd: fix lock file path in initscript
The virtlogd initscript's lock file should go in /var/lock/subsys/, not
(the nonexistent) /var/log/subsys/.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
2016-01-05 18:48:50 -05:00
Michal Privoznik
d7db33bfe9 qemu: Specify format= iff disk source is not empty
Just recently, qemu forbade specifying format for sourceless
disks (qemu commit 39c4ae941ed992a3bb5). It kind of makes sense.
If there's no file to open, why specify its format. Anyway, I
have a domain like this:

    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

and obviously I am unable to start it. Therefore, a fix on our
side is needed too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-05 16:41:16 +01:00
John Ferlan
dc77344a8e storage: Clean up error path for create buildPool failure
Commit id 'aeb1078ab' added a buildPool option and failure path which
calls virStoragePoolObjRemove, which unlocks the pool, clears the 'pool'
variable, and goto cleanup.  However, at cleanup virStoragePoolObjUnlock
is called without check if pool is non NULL.
2016-01-05 09:08:02 -05:00
Ján Tomko
488222800e libvirt-domain: fix dxml passing in virDomainMigrateToURI2
The refactoring in commit a26669d silently ignored the dxml
parameter of virDomainMigrateToURI2.

https://bugzilla.redhat.com/show_bug.cgi?id=1295405
2016-01-05 15:00:03 +01:00
Dmitry Mishin
5834527136 conf: Rework code around 'append' attribute
Commit id '70ffa02fc' added the data.file.append option to some
VIR_DOMAIN_CHR_TYPE_FILE cases in switch statements allowing the
code to "fall through" for the remainder of the cases. This causes
angst in code profiling tools, like Coverity since there is no break;
followed by more case conditions. Adjust the logic to be more specific
within each case.

Signed-off-by: Dmitry Mishin <dim@virtuozzo.com>
2016-01-05 07:59:17 -05:00
Dmitry Mishin
8746d95f6d Use tristate constants for new 'append' field
For completeness, use the VIR_TRISTATE_SWITCH_ABSENT for data.file.append
comparisons. Commit ids '70ffa02f' and '53a15aed' just went with the non
zero comparison.
2016-01-05 07:59:17 -05:00
Martin Kletzander
7d65a355fa Fix formatting for virDomainGetCPUStats docstring
We have few code samples there that are almost unreadable when formatted
because they are not indented properly.  By indenting them they are
formatted as code and hence quite readable.  Also adjust descriptions to
be comments and add semicolons so that the code sample looks like sample
of a working code.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-05 11:39:39 +01:00
Michal Privoznik
783b254413 qemu: Fix return value of qemuDomainGetBlockJobInfo
While reviewing 1b43885d17 I've noticed a virReportError()
followed by a goto endjob; without setting the correct return
value. Problem is, if block job is so fast that it's bandwidth
does not fit into ulong, an error is reported. However, by that
time @ret is already set to 1 which means success. Since the
scenario can be hardly considered successful, we should return a
value meaning error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-05 08:59:44 +01:00
Laine Stump
3d64a9d783 util: reduce debug log in virPCIGetVirtualFunctions()
Due to debug logs like this:

  virPCIGetDeviceAddressFromSysfsLink:2432 : Attempting to resolve device path from device link '/sys/class/net/eth1/device/virtfn6'
  logStrToLong_ui:2369 : Converted '0000:07:00.7' to unsigned int 0
  logStrToLong_ui:2369 : Converted '07:00.7' to unsigned int 7
  logStrToLong_ui:2369 : Converted '00.7' to unsigned int 0
  logStrToLong_ui:2369 : Converted '7' to unsigned int 7
  virPCIGetDeviceAddressFromSysfs:1947 : virPCIDeviceAddress 0000:07:00.7
  virPCIGetVirtualFunctions:2554 : Found virtual function 7

printed *once for each SR-IOV Virtual Function* of a Physical Function
each time libvirt retrieved the list of VFs (so if the system has 128
VFs, there would be 900 lines of log for each call), the debug logs on
any system with a large number of VFs was dominated by "information"
that was possibly useful for debugging when the code was being
written, but is now useless for debugging of any problem on a running
system, and only serves to obscure the real useful information. This
overkill has no place in production code, so this patch removes it.
2016-01-04 15:17:20 -05:00
Laine Stump
36e244f308 util: improve error reporting in virNetDevVPortProfileGetStatus
The previous error message just indicated that the desired response
couldn't be found, this patch tells what was desired, as well as
listing out the entire table that had been in the netlink response, to
give some kind of idea why it failed.
2016-01-04 15:15:20 -05:00
Laine Stump
5ffa236bb4 util: report the MAC address that couldn't be set
I noticed in a log file that we had failed to set a MAC address. The
log said which interface we were trying to set, but didn't give the
offending MAC address, which could have been useful in determining the
source of the problem. This patch modifies all three places in the
code that set MAC addresses to report the failed MAC as well as
interface.
2016-01-04 14:46:39 -05:00
Wido den Hollander
688623b5b0 rbd: Return VIR_STORAGE_FILE_RAW as format for RBD volumes
This used to return 'unkown' and that was not correct.

A vol-dumpxml now returns:

<volume type='network'>
  <name>image3</name>
  <key>libvirt/image3</key>
  <source>
  </source>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <target>
    <path>libvirt/image3</path>
    <format type='raw'/>
  </target>
</volume>

The RBD driver will now error out if a different format than RAW
is provided when creating a volume.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
2016-01-04 15:19:06 +01:00
Michael Chapman
c494db8fd6 storage: do not leak storage pool XML filename
Valgrind complained:

==28277== 38 bytes in 1 blocks are definitely lost in loss record 298 of 957
==28277==    at 0x4A06A2E: malloc (vg_replace_malloc.c:270)
==28277==    by 0x82D7F57: __vasprintf_chk (in /lib64/libc-2.12.so)
==28277==    by 0x52EF16A: virVasprintfInternal (stdio2.h:199)
==28277==    by 0x52EF25C: virAsprintfInternal (virstring.c:514)
==28277==    by 0x52B1FA9: virFileBuildPath (virfile.c:2831)
==28277==    by 0x19B1947C: storageDriverAutostart (storage_driver.c:191)
==28277==    by 0x19B196A7: storageStateAutoStart (storage_driver.c:307)
==28277==    by 0x538527E: virStateInitialize (libvirt.c:793)
==28277==    by 0x11D7CF: daemonRunStateInit (libvirtd.c:947)
==28277==    by 0x52F4694: virThreadHelper (virthread.c:206)
==28277==    by 0x6E08A50: start_thread (in /lib64/libpthread-2.12.so)
==28277==    by 0x82BE93C: clone (in /lib64/libc-2.12.so)

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
2016-01-04 14:54:23 +01:00
Michael Chapman
28c9eea032 qemu: do not leak NBD disk data in migration cookie
Valgrind complained:

==18990== 20 (16 direct, 4 indirect) bytes in 1 blocks are definitely lost in loss record 188 of 996
==18990==    at 0x4A057BB: calloc (vg_replace_malloc.c:593)
==18990==    by 0x5292E9B: virAllocN (viralloc.c:191)
==18990==    by 0x2221E731: qemuMigrationCookieXMLParseStr (qemu_migration.c:1012)
==18990==    by 0x2221F390: qemuMigrationEatCookie (qemu_migration.c:1413)
==18990==    by 0x222228CE: qemuMigrationPrepareAny (qemu_migration.c:3463)
==18990==    by 0x22224121: qemuMigrationPrepareDirect (qemu_migration.c:3865)
==18990==    by 0x22251C25: qemuDomainMigratePrepare3Params (qemu_driver.c:12414)
==18990==    by 0x5389EE0: virDomainMigratePrepare3Params (libvirt-domain.c:5107)
==18990==    by 0x1278DB: remoteDispatchDomainMigratePrepare3ParamsHelper (remote.c:5425)
==18990==    by 0x53FF287: virNetServerProgramDispatch (virnetserverprogram.c:437)
==18990==    by 0x540523D: virNetServerProcessMsg (virnetserver.c:135)
==18990==    by 0x54052C7: virNetServerHandleJob (virnetserver.c:156)
==18990==
==18990== 20 (16 direct, 4 indirect) bytes in 1 blocks are definitely lost in loss record 189 of 996
==18990==    at 0x4A057BB: calloc (vg_replace_malloc.c:593)
==18990==    by 0x5292E9B: virAllocN (viralloc.c:191)
==18990==    by 0x2221E731: qemuMigrationCookieXMLParseStr (qemu_migration.c:1012)
==18990==    by 0x2221F390: qemuMigrationEatCookie (qemu_migration.c:1413)
==18990==    by 0x222249D2: qemuMigrationRun (qemu_migration.c:4395)
==18990==    by 0x22226365: doNativeMigrate (qemu_migration.c:4693)
==18990==    by 0x22228E45: qemuMigrationPerform (qemu_migration.c:5553)
==18990==    by 0x2225144B: qemuDomainMigratePerform3Params (qemu_driver.c:12621)
==18990==    by 0x539F5D8: virDomainMigratePerform3Params (libvirt-domain.c:5206)
==18990==    by 0x127305: remoteDispatchDomainMigratePerform3ParamsHelper (remote.c:5557)
==18990==    by 0x53FF287: virNetServerProgramDispatch (virnetserverprogram.c:437)
==18990==    by 0x540523D: virNetServerProcessMsg (virnetserver.c:135)

If we're replacing the NBD data, it's simplest to free the old object
(including the disk list) and allocate a new one.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
2016-01-04 14:54:23 +01:00
Michael Chapman
1b43885d17 qemu: do not copy out non-existent block job info
Valgrind complained:

==23975== Conditional jump or move depends on uninitialised value(s)
==23975==    at 0x22255FA6: qemuDomainGetBlockJobInfo (qemu_driver.c:16538)
==23975==    by 0x538E97C: virDomainGetBlockJobInfo (libvirt-domain.c:9685)
==23975==    by 0x12F740: remoteDispatchDomainGetBlockJobInfoHelper (remote.c:2834)
==23975==    by 0x53FF287: virNetServerProgramDispatch (virnetserverprogram.c:437)
==23975==    by 0x540523D: virNetServerProcessMsg (virnetserver.c:135)
==23975==    by 0x54052C7: virNetServerHandleJob (virnetserver.c:156)
==23975==    by 0x52F515B: virThreadPoolWorker (virthreadpool.c:145)
==23975==    by 0x52F4668: virThreadHelper (virthread.c:206)
==23975==    by 0x6E08A50: start_thread (in /lib64/libpthread-2.12.so)
==23975==    by 0x82BE93C: clone (in /lib64/libc-2.12.so)
==23975==
==23975== Conditional jump or move depends on uninitialised value(s)
==23975==    at 0x22255FB4: qemuDomainGetBlockJobInfo (qemu_driver.c:16542)
==23975==    by 0x538E97C: virDomainGetBlockJobInfo (libvirt-domain.c:9685)
==23975==    by 0x12F740: remoteDispatchDomainGetBlockJobInfoHelper (remote.c:2834)
==23975==    by 0x53FF287: virNetServerProgramDispatch (virnetserverprogram.c:437)
==23975==    by 0x540523D: virNetServerProcessMsg (virnetserver.c:135)
==23975==    by 0x54052C7: virNetServerHandleJob (virnetserver.c:156)
==23975==    by 0x52F515B: virThreadPoolWorker (virthreadpool.c:145)
==23975==    by 0x52F4668: virThreadHelper (virthread.c:206)
==23975==    by 0x6E08A50: start_thread (in /lib64/libpthread-2.12.so)
==23975==    by 0x82BE93C: clone (in /lib64/libc-2.12.so)

If no matching block job is found, qemuMonitorGetBlockJobInfo returns 0
and we should not write anything to the caller-supplied
virDomainBlockJobInfo pointer.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
2016-01-04 14:54:23 +01:00
Michal Privoznik
f55d1316ad sysconf: Include unistd.h
The manpage for sysconf() suggest including unistd.h as the
function is declared there. Even though we are not hitting any
compile issues currently, let's include the correct header file
instead of relying on some hidden include chain.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-12-24 18:03:50 +01:00
Michal Privoznik
eec91958b4 virStorageVolWipe: Document that wiping journaled FS is useless
So you have a libvirt volume that you want to wipe out. But lets
say that the volume is actually a file stored on a journaled
filesystem. Overwriting it with zeroes or a pattern does not mean
that corresponding physical location on the disk is overwritten
too, due to journaling. It's the same story with network based
volumes, copy-on-write filesystems, and so on. Since there is no
way that an userland application can write onto specific areas on
disk, all that we can do is document the fact.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-12-24 18:02:58 +01:00
Maxim Nestratov
635daa2556 vz: BUG: fix connecting hang in case of init failure
In case of prlsdkLoadDomains fails, vzOpenDefault should
clear connection privateData pointer every time its
memory is actually freed.
Also it is not necessary to call vzConnectClose if a call
to vzOpenDefault fails, because they both make cleanup of
connection privateData.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-12-24 18:31:05 +03:00
Dmitry Mishin
53a15aed39 qemu: Process new 'append' attribute for char dev with output to a file
By default, QEMU truncates serial file on open. Sometimes, it could be weird -
for example, when we are trying to investigate some event, which occured several
restarts ago. This patch adds an ability to preserve previous content.

Signed-off-by: Dmitry Mishin <dim@virtuozzo.com>
2015-12-24 14:50:33 +00:00
Dmitry Mishin
70ffa02fc2 conf: Add new 'append' attribute for chardevs with file source
Currently, there is no possibility for user to specify desired behaviour of
output to file - truncate or append. This patch adds an ability to explicitly
specify that user wants to preserve file's content on reopen.

Signed-off-by: Dmitry Mishin <dim@virtuozzo.com>
2015-12-24 14:50:31 +00:00
Maxim Nestratov
6b4b916da4 vz: support additional flags in domain undefine
Implement VIR_DOMAIN_UNDEFINE_MANAGED_SAVE and
VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA flags support.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-12-24 14:20:56 +03:00
Maxim Nestratov
64b3bb7b15 vz: move prlsdkCleanupBridgedNet after domain deletion
prlsdkCleanupBridgedNet call should be made strongly after
any actual domain deletion accurs. By doing this we avoid
any potential problems connected with second undefine call
when it is made after first one fails by some reason, and
we detect that network is already deleted.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-12-24 14:20:56 +03:00
Maxim Nestratov
b733739416 vz: delete domains when undefine is called
Currently vz driver unregisters domains when undefine is called,
which is wrong because it contradicts with expected behavior.
All vz domains are persistent, which means that when one is
defined a new bundle directory containing meta data is created.
Undefining domains in a way we do now leaves those directories
undeleted, which prevents subsequent define call for the same
domain xml. I.e. the following sequence define->undefine->define
doesn't work now.
The patch fixes the problem by calling PrlVm_Delete instead of
PrlVm_Unreg detaching all disks prior actually doing this to
prevent images deletion.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-12-24 14:20:56 +03:00
Andrea Bolognani
d5a0cf10bc hostdev: Emit debug messages while handling PCI hostdevs
Both detach and reattach are complex operations involving several steps,
and it can be useful to be able to follow along by reading the log.
2015-12-21 11:24:31 +01:00
Andrea Bolognani
e926df601d hostdev: Only rollback detach of managed devices on error
Since we don't detach unmanaged devices before attaching them to a
domain, we shouldn't reattach them to rollback an error either.
2015-12-21 11:22:45 +01:00
Andrea Bolognani
b8a625f384 hostdev: Mark PCI devices as inactive as they're detached
We want to eventually factor out the code dealing with device detaching
and reattaching, so that we can share it and make sure it's called eg.
when 'virsh nodedev-detach' is used.

For that to happen, it's important that the lists of active and inactive
PCI devices are updated every time a device changes its state.

Instead of passing NULL as the last argument of virPCIDeviceDetach() and
virPCIDeviceReattach(), pass the proper list so that it can be updated.
2015-12-21 11:21:00 +01:00
Andrea Bolognani
6d9cdd2a57 pci: Introduce virPCIStubDriver enumeration
This replaces the virPCIKnownStubs string array that was used
internally for stub driver validation.

Advantages:

  * possible values are well-defined
  * typos in driver names will be detected at compile time
  * avoids having several copies of the same string around
  * no error checking required when setting / getting value

The names used mirror those in the
virDomainHostdevSubsysPCIBackendType enumeration.
2015-12-21 11:17:22 +01:00
Andrea Bolognani
e1b2458364 pci: Remove 'reprobe' parameter from virPCIDeviceUnbind()
The value is not inspected inside the function, so it makes more
sense for the caller to change the device's setting explicitly.
2015-12-21 11:04:37 +01:00
Andrea Bolognani
51f39c7048 pci: Remove redundant parameter from virPCIDeviceBindToStub()
This internal function supports, in theory, binding to a different
stub driver than the one the PCI device has been configured to use.

In practice, it is only ever called like

  virPCIDeviceBindToStub(dev, dev->stubDriver);

which makes its second parameter redundant. Get rid of it, along
with the extra string copy required to support it.
2015-12-21 11:04:37 +01:00
Erik Skultety
3245e1783c Revert "admin: Rename virAdmConnect to virAdmDaemon"
Commmit df8192aa introduced admin related rename and some minor
(caused by automated approach, aka sed) and some more severe isues along with
it. First reason to revert is the inconsistency with libvirt library.
Although we deal with the daemon directly rather than with a specific
hypervisor, we still do have a connection. That being said, contributors might
get under the impression that AdmDaemonNew would spawn/start a new daemon
(since it's admin API, why not...), or AdmDaemonClose would do the exact
opposite or they might expect DaemonIsAlive report overall status of the daemon
which definitely isn't the case.
The second reason to revert this patch is renaming virt-admin client. The
client tool does not necessarily have to reflect the names of the API's it's
using in his internals. An example would be 's/vshAdmConnect/vshAdmDaemon'
where noone can be certain of what the latter function really does. The former
is quite expressive about some connection magic it performs, but the latter does
not say anything, especially when vshAdmReconnect and vshAdmDisconnect were
left untouched.
2015-12-21 10:07:59 +01:00
Jim Fehlig
5b74103b0b Xen: support maxvcpus in xm and xl config
From: Ian Campbell <ian.campbell@citrix.com>

xend prior to 4.0 understands vcpus as maxvcpus and vcpu_avail
as a bit map of which cpus are online (default is all).

xend from 4.0 onwards understands maxvcpus as maxvcpus and
vcpus as the number which are online (from 0..N-1). The
upstream commit (68a94cf528e6 "xm: Add maxvcpus support")
claims that if maxvcpus is omitted then the old behaviour
(i.e. obeying vcpu_avail) is retained, but AFAICT it was not,
in this case vcpu==maxcpus==online cpus. This is good for us
because handling anything else would be fiddly.

This patch changes parsing of the virDomainDef maxvcpus and vcpus
entries to use the corresponding 'maxvcpus' and 'vcpus' settings
from xm and xl config. It also drops use of the old Xen 3.x
'vcpu_avail' setting.

The change also removes the maxvcpus limit of MAX_VIRT_VCPUS (since
maxvcpus is simply a count, not a bit mask), which is particularly
crucial on ARM where MAX_VIRT_CPUS == 1 (since all guests are
expected to support vcpu placement, and therefore only the boot
vcpu's info lives in the shared info page).

Existing tests adjusted accordingly, and new tests added for the
'maxvcpus' setting.
2015-12-18 17:52:00 -07:00
John Ferlan
7d792b99b8 libvirt: Add virStorageVolDeleteFlags to virStorageVolDelete
Although they've been present for quite a while, they weren't added
to the API definition, so add them there to make it clearer.

Currently only the RBD backend even checks for any flags.
2015-12-18 10:51:08 -05:00
John Ferlan
be783825af storage: Add virCheckFlags to virStorageBackendRBDDeleteVol
The initial commit '74951eade' did not include the proper check for whether
any flags are supported by the driver.

Even though the driver doesn't support VIR_STORAGE_VOL_DELETE_ZEROED,
it still checks and allows the processing to continue

Also add the new VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS since it is handled
as of commit id '3c7590e0a'.
2015-12-18 10:51:08 -05:00
John Ferlan
ae09988eb7 lxc_cgroup: Add check for NULL cgroup before AddTask call
Commit id '71ce4759' altered the cgroup processing with respect to the
call to virCgroupAddTask being moved out from lower layers into the calling
layers especially for qemu processing of emulator and vcpu threads. The
movement affected lxc insomuch as it is possible for a code path to
return a NULL cgroup *and* a 0 return status via virCgroupNewPartition
failure when virCgroupNewIgnoreError succeeded when virCgroupNewMachineManual
returns. Coverity pointed out that would cause virCgroupAddTask to core.

This patch will check for a NULL cgroup as well as the negative return
and just return the NULL cgroup to the caller (as it would have previously)
2015-12-18 08:59:34 -05:00
Jim Fehlig
be08842e47 Xen: remove xendConfigVersion from driver private struct
xendConfigVersion is no longer used, so remove it from the
xenUnifiedPrivate struct.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-12-17 21:28:48 -07:00
Jim Fehlig
60ac2aa821 Xen: xenconfig: remove xendConfigVersion from public sexpr functions
Remove use of xendConfigVersion in the s-expresion config formatter/parser
in src/xenconfig/. Adjust callers in the xen and libxl drivers accordingly.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-12-17 21:28:48 -07:00
Jim Fehlig
b6fa951897 Xen: xend: remove use of XEND_CONFIG_VERSION
Remove use of XEND_CONFIG_VERSION_* in xend_internal.c

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-12-17 21:28:47 -07:00
Jim Fehlig
64d14daa4b Xen: xen_driver: remove use of XEND_CONFIG_VERSION
Remove use of XEND_CONFIG_VERSION_* in the Xen unified driver.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-12-17 21:28:29 -07:00
Jim Fehlig
5ff2e370af Xen: xenconfig: remove use of XEND_CONFIG_VERSION in xen_sxpr
Remove use of XEND_CONFIG_VERSION_* in s-expression parser/formatter.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-12-17 21:22:34 -07:00
Jim Fehlig
bec993d60a Xen: xenconfig: remove disks from '(image)' sexpr
It has been quite some time since xend required specifying cdroms
and fds in '(image (hvm ...))'. Remove the code from the parsing
and formatting functions and fixup the associated tests.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-12-17 21:22:34 -07:00
Jim Fehlig
7d7c08be1c Xen: xenconfig: remove xendConfigVersion from public functions
Remove use of xendConfigVersion in the xm and xl config formatter/parsers
in src/xenconfig/. Adjust callers in the xen and libxl drivers accordingly.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-12-17 21:22:33 -07:00
Jim Fehlig
0f58db3092 Xen: xenconfig: remove use of XEND_CONFIG_VERSION in xen_xm
Remove use of XEND_CONFIG_VERSION_* in xm parser/formatter.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-12-17 21:22:33 -07:00
Jim Fehlig
4796d7b34b Xen: xenconfig: remove XEND_CONFIG_VERSION in common code
Remove use of XEND_CONFIG_VERSION_* from xenconfig/xen_common.c

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-12-17 21:22:33 -07:00
John Ferlan
aeb1078ab5 storage: Add flags to allow building pool during create processing
https://bugzilla.redhat.com/show_bug.cgi?id=830056

Add flags handling to the virStoragePoolCreate and virStoragePoolCreateXML
API's which will allow the caller to provide the capability for the storage
pool create API's to also perform a pool build during creation rather than
requiring the additional buildPool step. This will allow transient pools
to be defined, built, and started.

The new flags are:

    * VIR_STORAGE_POOL_CREATE_WITH_BUILD
      Perform buildPool without any flags passed.

    * VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE
      Perform buildPool using VIR_STORAGE_POOL_BUILD_OVERWRITE flag.

    * VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE
      Perform buildPool using VIR_STORAGE_POOL_BUILD_NO_OVERWRITE flag.

It is up to the backend to handle the processing of build flags. The
overwrite and no-overwrite flags are mutually exclusive.

NB:
This patch is loosely based upon code originally authored by Osier
Yang that were not reviewed and pushed, see:

https://www.redhat.com/archives/libvir-list/2012-July/msg01328.html
2015-12-17 11:56:18 -05:00
Ján Tomko
22f9754f1b mark virDomainVirtioSerialAddrSetAddController as static.
This function is no longer used outside domain_addr.c
2015-12-17 16:57:25 +01:00
Ján Tomko
36d7a36158 Remove dead code from qemuDomainAttachControllerDevice
We only support hotplugging SCSI controllers.
The USB and virtio-serial related code was never reachable because
this function was only called for VIR_DOMAIN_CONTROLLER_TYPE_SCSI
controllers.

This reverts commit ee0d97a and parts of commits 16db8d2
and d6d54cd1.
2015-12-17 16:57:25 +01:00
Ján Tomko
aaa42d905a qemu_hotplug: remove qemuDomainAttachDeviceControllerLive
This function calls qemuDomainAttachControllerDevice for SCSI
controllers and reports an error for all other controllers.

Move the error inside qemuDomainAttachControllerDevice and delete this
wrapper.
2015-12-17 16:57:25 +01:00
Cédric Bosdonnat
bec787ee9d Allow building lxc without virt-login-shell
Add a configure option to disable virt-login-shell build even if lxc is
enabled.
2015-12-17 15:49:06 +01:00
John Ferlan
8c865052b9 storage: Fix startup issue for logical pool
Commit id '71b803ac' assumed that the storage pool source device path
was required for a 'logical' pool. This resulted in a failure to start
a pool without any device path defined.

So, adjust the virStorageBackendLogicalMatchPoolSource logic to
return success if at least the pool name matches the vgs output
when no pool source device path is/are provided.
2015-12-17 08:20:22 -05:00
John Ferlan
5efcfb9695 qemu: Fix event generated for qemuDomainRevertToSnapshot (pause->run)
A closer review of the code shows that for the transition from paused to
running which was supposed to emit the VIR_DOMAIN_EVENT_RESUMED - no event
would be generated. Rather the event is generated when going from running
to running.

Following the 'was_running' boolean shows it is set when the domain obj
is active and the domain obj state is VIR_DOMAIN_RUNNING. So rather than
using was_running to generate the RESUMED event, use !was_running
2015-12-17 08:04:02 -05:00
John Ferlan
80ca86e54d storage: Attempt to refresh volume after successful wipe volume
https://bugzilla.redhat.com/show_bug.cgi?id=1270709

When a volume wipe is successful, perform a volume refresh afterwards to
update any volume data that may be used in future volume commands, such as
volume resize.  For a raw file volume, a wipe could truncate the file and
a followup volume resize the capacity may fail because the volume target
allocation isn't updated to reflect the wipe activity.
2015-12-17 07:30:03 -05:00
Ján Tomko
f61770a169 virStorageBackendWipeLocal: remove bytes_wiped argument
It is not used by the caller.
2015-12-17 12:44:35 +01:00
Ján Tomko
c3f7371c5e storage: drop 'Extent' from virStorageBackendWipeExtentLocal
The only caller always passes 0 for the extent start.
Drop the 'extent_start' parameter, as well as the mention of extents
from the function name.

Change off_t extent_length to unsigned long long wipe_len, as well as the
'remain' variable.
2015-12-17 12:44:35 +01:00
Ján Tomko
4bccdf0ceb storage: move buffer allocation inside virStorageBackendWipeExtentLocal
We do not need to pass a zero-filled buffer as an argument,
the function can allocate its own.
2015-12-17 12:44:35 +01:00
Ján Tomko
09cbfc0481 storage: fix return values of virStorageBackendWipeExtentLocal
Return -1:
* on all failures of fdatasync. Instead of propagating -errno
  all the way up to the virStorageVolWipe API, which is documented
  to return 0 or -1.
* after a partial wipe. If safewrite failed, we would re-use the
  non-negative return value of lseek (which should be 0 in this case,
  because that's the only offset we seek to).
2015-12-17 12:44:02 +01:00
Andrea Bolognani
242e3ea4e3 qemu: Replace Mlock with MemLock in function names
MemLock is already used in other modules and, while still an
abbreviation, is not ambiguous.
2015-12-17 10:12:47 +01:00
Andrea Bolognani
afbe1d4c56 qemu: Allow qemuDomainAdjustMaxMemLock() to restore previous value
When the function changes the memory lock limit for the first time,
it will retrieve the current value and store it inside the
virDomainObj for the domain.

When the function is called again, if memory locking is no longer
needed, it will be able to restore the memory locking limit to its
original value.
2015-12-17 10:12:47 +01:00
Andrea Bolognani
b583e80cb8 qemu: Reduce memlock limit after detaching PCI hostdev
We increase the limit before plugging in a PCI hostdev or a memory
module because some memory might need to be locked due to eg. VFIO.

Of course we should do the opposite after unplugging a device: this
was already the case for memory modules, but not for PCI hostdevs.
2015-12-17 10:12:47 +01:00
Andrea Bolognani
65909c7996 qemu: Use qemuDomainAdjustMaxMemLock()
Replace all uses of the qemuDomainRequiresMlock/virProcessSetMaxMemLock
combination with the equivalent qemuDomainAdjustMaxMemLock() call.
2015-12-17 10:12:47 +01:00
Andrea Bolognani
ac7e4df4f4 qemu: Add qemuDomainAdjustMaxMemLock()
This function detects whether a domain needs RLIMIT_MEMLOCK
to be set, and if so, uses an appropriate value.
2015-12-17 10:12:47 +01:00
Andrea Bolognani
bbefc9cc2e process: Add virProcessGetMaxMemLock()
This function can be used to retrieve the current locked memory
limit for a process, so that the setting can be later restored.

Add a configure check for getrlimit(), which we now use.
2015-12-17 10:12:47 +01:00
Andrea Bolognani
c2f797544f process: Allow virProcessPrLimit() to get current limit
The prlimit() function allows both getting and setting limits for
a process; expose the same functionality in our wrapper.

Add the const modifier for new_limit, in accordance with the
prototype for prlimit().
2015-12-17 10:12:47 +01:00
Martin Kletzander
68d4245d21 qemu: Search all nodes for shared memory access
In commit 686eb7a24f, the break was not considered part of the
condition, hence breaking after first node when searching.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-12-16 13:02:33 +01:00
Andrea Bolognani
7743454165 pci: Use virPCIDeviceAddress in virPCIDevice
Instead of replicating the information (domain, bus, slot, function)
inside the virPCIDevice structure, use the already-existing
virPCIDeviceAddress structure.

For users of the module, this means that the object returned by
virPCIDeviceGetAddress() can no longer be NULL and must no longer
be freed by the caller.
2015-12-16 09:07:25 +01:00
Joao Martins
b7b439196c libxl: implement virDomainGetJobStats
Introduces support for domainGetJobStats which has the same
info as domainGetJobInfo but in a slightly different format.
Another difference is that virDomainGetJobStats can also
retrieve info on the most recently completed job. Though so
far this is only used in the source node to know if the
migration has been completed. But because we don't support
completed jobs we will deliver an error.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
2015-12-15 15:21:38 -07:00
Joao Martins
ad71665104 libxl: implement virDomainGetJobInfo
Introduce support for domainGetJobInfo to get info about the
ongoing job. If the job is active it will update the
timeElapsed which is computed with the "started" field added to
struct libxlDomainJobObj.  For now we support just the very basic
info and all jobs have VIR_DOMAIN_JOB_UNBOUNDED (i.e. no completion
time estimation) plus timeElapsed computed.

Openstack Kilo uses the Job API to monitor live-migration
progress which is currently nonexistent in libxl driver and
therefore leads to a crash in the nova compute node. Right
now, migration doesn't use jobs in the source node and will
return VIR_DOMAIN_JOB_NONE. Though nova handles this case and
will migrate it properly instead of crashing.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
2015-12-15 15:21:37 -07:00
John Ferlan
71b803ac9a storage: Add helper to compare logical pool def against pvs output
https://bugzilla.redhat.com/show_bug.cgi?id=1025230

Add a new helper virStorageBackendLogicalMatchPoolSource to compare the
pool's source name against the output from a 'pvs' command to list all
volume group physical volume data on the host.  In addition, compare the
pool's source device list against the particular volume group's device
list to ensure the source device(s) listed for the pool match what the
was listed for the volume group.

Then for pool startup or check API's we need to call this new API in
order to ensure that the pool we're about to start or declare active
during checkPool has a valid definition vs. the running host.
2015-12-15 14:33:05 -05:00
John Ferlan
ae5519f7f8 storage: Create helper for virStorageBackendLogicalFindPoolSources
Rework virStorageBackendLogicalFindPoolSources a bit to create a
helper virStorageBackendLogicalGetPoolSources that will make the
pvs call in order to generate a list of associated pv_name and vg_name's.

A future patch will make use of this for start/check processing to
ensure the storage pool source definition matches expectations.
2015-12-15 14:33:04 -05:00
John Ferlan
dae7007d6e storage: Check FS pool source during virStorageBackendFileSystemIsMounted
https://bugzilla.redhat.com/show_bug.cgi?id=1025230

When determining whether a FS pool is mounted, rather than assuming that
the FS pool is mounted just because the target.path is in the mount list,
let's make sure that the FS pool source matches what is mounted
2015-12-15 14:33:04 -05:00
John Ferlan
61c29fe56f storage: Refactor virStorageBackendFileSystemGetPoolSource
Refactor code to use standard return functioning with respect to setting
a ret value and going to cleanup.
2015-12-15 14:33:04 -05:00
John Ferlan
1d1330f37e storage: Create helper to generate FS pool source value
Refactor the code that builds the pool source string during the FS
storage pool mount to be a separate helper.

A future patch will use the helper in order to validate the mounted
FS matches the pool's expectation during poolCheck processing
2015-12-15 14:33:00 -05:00
Laine Stump
a8e3247e65 qemu: add bootindex option to hostdev network interface commandline
when appropriate, of course. If the config for a domain specifies boot
order with <boot dev='blah'/> elements, e.g.:

     <os>
       ...
       <boot dev='hd'/>
       <boot dev='network'/>
     </os>

Then the first disk device in the config will have ",bootindex=1"
appended to its qemu commandline -device options, and the first (and
*only* the first) network interface device will get ",bootindex=2".

However, if the first network interface device is a "hostdev" device
(an SRIOV Virtual Function (VF) being assigned to the domain with
vfio), then the bootindex option will *not* be appended. This happens
because the bootindex=n option corresponding to the order of "<boot
dev='network'/>" is added to the -device for the first network device
when network device commandline args are constructed, but if it's a
hostdev network device, its commandline arg is instead constructed in
the loop for hostdevs.

This patch fixes that omission by noticing (in bootHostdevNet) if the
first network device was a hostdev, and if so passing on the proper
bootindex to the commandline generator for hostdev devices - the
result is that ",bootindex=2" will be properly appended to the first
"network" device in the config even if it is really a hostdev
(including if it is assigned from a libvirt network pool). (note that
this is only the case if there is no <bootmenu enabled='yes'/> element
in the config ("-boot menu-on" in qemu) , since the two are mutually
exclusive - when the bootmenu is enabled, the individual per-device
bootindex options can't be used by qemu, and we revert to using "-boot
order=xyz" instead).

If a greater level of control over boot order is desired (e.g., more
than one network device should be tried, or a network device other
than the first one encountered in the config), then <boot
dev='network'/> in the <os> element should not be used; instead, the
individual device elements in the config should be given a "<boot
order='n'/>

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1278421
2015-12-15 10:57:27 -05:00
Ján Tomko
077bdba5c2 security_stack: remove extra Security from function names
Many of the functions follow the pattern:
virSecurity.*Security.*Label

Remove the second 'Security' from the names, it should be
obvious that the virSecurity* functions deal with security
labels even without it.
2015-12-15 16:06:08 +01:00
Ján Tomko
ba9285b3a3 security_selinux: remove extra Security from function names
Many of the functions follow the pattern:
virSecurity.*Security.*Label

Remove the second 'Security' from the names, it should be obvious
that the virSecurity* functions deal with security labels even
without it.
2015-12-15 16:06:08 +01:00
Ján Tomko
be33e96533 security_dac: remove extra Security from function names
Many of the functions follow the pattern:
virSecurity.*Security.*Label

Remove the second 'Security' from the names, it should be obvious
that the virSecurity* functions deal with security labels even
without it.
2015-12-15 16:06:08 +01:00
Pavel Hrdina
cbd3d06541 qemuMonitorJSONEjectMedia: don't stringify the replay at all
Commit 256496e1 introduced a detection if "is locked" in error replay
from qemu monitor. Commit c4073657 fixed a memory leak, but it was
pointed out by Peter, that this could be done cleaner without
stringifing the replay.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-12-15 12:18:27 +01:00
Andrea Bolognani
90791fbf96 pci: Use 'addr' instead of 'dev' for virPCIDeviceAddressPtr
The name 'dev' is more appropriate for virPCIDevicePtr.
2015-12-15 11:19:17 +01:00
Michal Privoznik
c407365769 qemuMonitorJSONEjectMedia: Don't leak stringified reply
The return value of virJSONValueToString() should be freed when
no longer needed. This is not the case after 256496e1.

==26902== 138 bytes in 2 blocks are definitely lost in loss record 1,051 of 1,239
==26902==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==26902==    by 0xAA5F599: strdup (in /lib64/libc-2.21.so)
==26902==    by 0x552BAD9: virStrdup (virstring.c:726)
==26902==    by 0x54F60A7: virJSONValueToString (virjson.c:1790)
==26902==    by 0x1DF6EBB9: qemuMonitorJSONEjectMedia (qemu_monitor_json.c:2225)
==26902==    by 0x1DF57A4C: qemuMonitorEjectMedia (qemu_monitor.c:1985)
==26902==    by 0x1DF1EF2D: qemuDomainChangeEjectableMedia (qemu_hotplug.c:199)
==26902==    by 0x1DF90314: qemuDomainChangeDiskLive (qemu_driver.c:7985)
==26902==    by 0x1DF90476: qemuDomainUpdateDeviceLive (qemu_driver.c:8030)
==26902==    by 0x1DF91ED7: qemuDomainUpdateDeviceFlags (qemu_driver.c:8677)
==26902==    by 0x561785F: virDomainUpdateDeviceFlags (libvirt-domain.c:8559)
==26902==    by 0x134210: remoteDispatchDomainUpdateDeviceFlags (remote_dispatch.h:10966)

==26902== 106 bytes in 1 blocks are definitely lost in loss record 1,033 of 1,239
==26902==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==26902==    by 0xAA5F599: strdup (in /lib64/libc-2.21.so)
==26902==    by 0x552BAD9: virStrdup (virstring.c:726)
==26902==    by 0x54F60A7: virJSONValueToString (virjson.c:1790)
==26902==    by 0x1DF6EC0C: qemuMonitorJSONEjectMedia (qemu_monitor_json.c:2227)
==26902==    by 0x1DF57A4C: qemuMonitorEjectMedia (qemu_monitor.c:1985)
==26902==    by 0x1DF1EF2D: qemuDomainChangeEjectableMedia (qemu_hotplug.c:199)
==26902==    by 0x1DF90314: qemuDomainChangeDiskLive (qemu_driver.c:7985)
==26902==    by 0x1DF90476: qemuDomainUpdateDeviceLive (qemu_driver.c:8030)
==26902==    by 0x1DF91ED7: qemuDomainUpdateDeviceFlags (qemu_driver.c:8677)
==26902==    by 0x561785F: virDomainUpdateDeviceFlags (libvirt-domain.c:8559)
==26902==    by 0x134210: remoteDispatchDomainUpdateDeviceFlags (remote_dispatch.h:10966)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-12-15 10:27:19 +01:00
Henning Schild
90b721e43e qemu cgroups: move new threads to new cgroup after cpuset is set up
Moving tasks to cgroups implied sched_setaffinity. Changing the cpus in
a set implies the same for all tasks in the group.
The old code put the the thread into the cpuset inherited from the
machine cgroup, which allowed it to run outside of vcpupin for a short
while.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
2015-12-14 15:58:05 -05:00
Henning Schild
a41c00b472 qemu: do not put a task into machine cgroup
The machine cgroup is a superset, a parent to the emulator and vcpuX
cgroups. The parent cgroup should never have any tasks directly in it.
In fact the parent cpuset might contain way more cpus than the sum of
emulatorpin and vcpupins. So putting tasks in the superset will allow
them to run outside of <cputune>.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
2015-12-14 15:48:05 -05:00
Henning Schild
71ce475967 util: cgroups do not implicitly add task to new machine cgroup
virCgroupNewMachine used to add the pidleader to the newly created
machine cgroup. Do not do this implicit anymore.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
2015-12-14 15:43:29 -05:00
Michal Privoznik
65e3451ea9 virNetDevMacVLanTapSetup: Drop @multiqueue argument
Firstly, there's a bug (or typo) in the only place where we call
this function: @multiqueue is set whenever @tapfdSize is greater
than zero, while in fact the condition should have been 'greater
than one'.
Then, secondly, since the condition depends on just one
variable, that we are even passing down to the function, we can
move the condition into the function and drop useless argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-12-14 15:58:18 +01:00
Martin Kletzander
686eb7a24f qemu: Warn when using vhost-user without shared memory
When user configures vhost-user interface and forgets to also configure
any shared memory, the search for the root cause of non-operational
interface might take unpleasantly long time.  Let's enhance user
experience by emitting a warning in the logs.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-12-14 08:54:19 +01:00
Michal Privoznik
ec93cc25ec virNetDevMacVLanTapSetup: Work around older systems
Some older systems, e.g. RHEL-6 do not have IFF_MULTI_QUEUE flag
which we use to enable multiqueue feature. Therefore one gets the
following compile error there:

  CC     util/libvirt_util_la-virnetdevmacvlan.lo
util/virnetdevmacvlan.c: In function 'virNetDevMacVLanTapSetup':
util/virnetdevmacvlan.c:338: error: 'IFF_MULTI_QUEUE' undeclared (first use in this function)
util/virnetdevmacvlan.c:338: error: (Each undeclared identifier is reported only once
util/virnetdevmacvlan.c:338: error: for each function it appears in.)
make[3]: *** [util/libvirt_util_la-virnetdevmacvlan.lo] Error 1

So, whenever user wants us to enable the feature on such systems,
we will just throw a runtime error instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-12-13 08:35:46 +01:00
Eric Blake
034e47c338 CVE-2015-5313: storage: don't allow '/' in filesystem volume names
The libvirt file system storage driver determines what file to
act on by concatenating the pool location with the volume name.
If a user is able to pick names like "../../../etc/passwd", then
they can escape the bounds of the pool.  For that matter,
virStoragePoolListVolumes() doesn't descend into subdirectories,
so a user really shouldn't use a name with a slash.

Normally, only privileged users can coerce libvirt into creating
or opening existing files using the virStorageVol APIs; and such
users already have full privilege to create any domain XML (so it
is not an escalation of privilege).  But in the case of
fine-grained ACLs, it is feasible that a user can be granted
storage_vol:create but not domain:write, and it violates
assumptions if such a user can abuse libvirt to access files
outside of the storage pool.

Therefore, prevent all use of volume names that contain "/",
whether or not such a name is actually attempting to escape the
pool.

This changes things from:

$ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
Vol ../../../../../../etc/haha created
$ rm /etc/haha

to:

$ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
error: Failed to create vol ../../../../../../etc/haha
error: Requested operation is not valid: volume name '../../../../../../etc/haha' cannot contain '/'

Signed-off-by: Eric Blake <eblake@redhat.com>
2015-12-11 16:34:53 -07:00
John Ferlan
afe73ed468 util: Fixup virnetdevmacvlan.h ATTRIBUTE_NONNULL's
Commit id '56e2171c6' removed a variable from the argument list, but
neglected to update the ATTRIBUTE_NONNULL values, so when commit id
'08da97bfb' added a couple of arguments, the values were off.
2015-12-11 07:16:16 -05:00
Peter Krempa
ace1ee225f test: qemuxml2argv: Mock virMemoryMaxValue to remove 32/64 bit difference
Always return LLONG_MAX even on 32 bit systems. The limitation
originates from our use of "unsigned long" in several APIs. The internal
data type is unsigned long long. Make the test suite deterministic by
removing the architecture difference.

Flaw was introduced in 645881139b where
I've added a test that uses too large numbers.
2015-12-11 12:23:38 +01:00
Michal Privoznik
81a110edc7 qemu: Enable multiqueue for macvtaps
https://bugzilla.redhat.com/show_bug.cgi?id=1240439

Ta-da! Now that we know how to open a macvtap device multiple
times, we can finally enable the multiqueue feature. Everything
else is already prepared (e.g. command line generation) from the
previous iteration where the feature was implemented for
TUN/TAP devices.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-12-11 08:44:44 +01:00
Michal Privoznik
08da97bfb9 virNetDevMacVLanCreateWithVPortProfile: Rework to support multiple FDs
For the multiqueue on macvtaps we are going to need to open
the device multiple times. Currently, this is not supported.
Rework the function, so that upper layers can be reworked too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-12-11 08:44:43 +01:00
Michal Privoznik
1e90c744d5 virNetDevMacVLanTapSetup: Allow enabling of IFF_MULTI_QUEUE
Like we are doing for TUN/TAP devices, we should do the same for
macvtaps. Although, it's not as critical as in that case, we
should do it for the consistency.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-12-11 08:44:39 +01:00
Michal Privoznik
136fe2f7cc virNetDevMacVLanTapSetup: Rework to support multiple FDs
For the multiqueue on macvtaps we are going to need to open
the device multiple times. Currently, this is not supported.
Rework the function, so that upper layers can be reworked too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-12-11 08:42:50 +01:00