Commit Graph

16307 Commits

Author SHA1 Message Date
Peter Krempa
1d8351a94f qemu: perf: Tweak flags before using them
@flags have a valid modification impact only after calling
virDomainObjUpdateModificationImpact. virDomainObjGetOneDef calls it but
doesn't update them in the caller.
2016-04-01 09:52:24 +02:00
Jim Fehlig
ff825f9def libxl: fix net device detach
Chunyan sent a nice cleanup patch for libxlDomainDetachNetDevice

https://www.redhat.com/archives/libvir-list/2016-March/msg00926.html

which I incorrectly modified before pushing as commit b5534e53. My
modification caused network devices of type hostdev to no longer
be removed. This patch changes b5534e53 to resemble Chunyan's
original, correct patch.
2016-03-31 10:17:28 -06:00
Jim Fehlig
95d3c73871 libxl: fix attaching net device of type hostdev
Chunyan sent a correct patch to fix a resource leak on error in
libxlDomainAttachNetDevice

https://www.redhat.com/archives/libvir-list/2016-March/msg00924.html

I made what was thought to be an improvement and pushed the patch as
commit e6336442. As it turns out, my change broke adding net devices
that are actually hostdevs to the list of nets in virDomainDef. This
patch changes e6336442 to resemble Chunyan's original, correct
patch.
2016-03-31 10:17:28 -06:00
Fabiano Fidêncio
ab74e8763d build: workaround broken SASL header (again)
Compilation for xdg-app failed due to a buggy SASL headers present on
the used runtime (org.gnome.Sdk 3.18).

In file included from rpc/virnetsaslcontext.h:24:0,
                 from rpc/virnetsaslcontext.c:25:
/usr/include/sasl/sasl.h:230:38: error: unknown type name 'size_t'
 typedef void *sasl_realloc_t(void *, size_t);
                                      ^
/usr/include/sasl/sasl.h:235:5: error: unknown type name 'sasl_realloc_t'
     sasl_realloc_t *,

Use the same workaround as commit 1be3dfd did.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2016-03-31 17:36:49 +02:00
Michal Privoznik
382ea24b1a qemuProcessVerifyGuestCPU: Avoid coverity false positive
We use _LAST items in enums to mark the last position in given
enum. Now, if and enum is passed to switch(), compiler checks
that all the values from enum occur in 'case' enumeration.
Including _LAST. But coverity spots it's a dead code. And it
really is. So to resolve this, we tend to put a comment just
above 'case ..._LAST' notifying coverity that we know this is a
dead code but we want to have it that way.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-03-31 17:25:21 +02:00
Michal Privoznik
2cbdd64adf virPerfReadEvent: Prefer saferead over read
Do I really need to explain why?
Well, if read() is interrupted int the middle of reading, we will
never read the rest (even though it's highly unlikely as we are
reading just 8 bytes).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-03-31 17:25:21 +02:00
Martin Kletzander
c62e7702c0 remote: Add flags to remote_protocol-structs
Caused by 3b6c818532.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-03-31 14:07:46 +02:00
Michal Privoznik
4349e24d54 virDomain{Get,Set}PerfEvents: Grab job
Even though we have the machine locked throughout whole APIs we
are querying/modifying domain internal state. We should grab a
job whilst doing that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-03-31 10:48:41 +02:00
Michal Privoznik
ed504ba392 virDomain{Get,Set}PerfEvents: support --config --live --current
Now that we have @flags we can support changing perf events just
in active or inactive configuration regardless of the other.
Previously, calling virDomainSetPerfEvents set events in both
active and inactive configuration at once. Even though we allow
users to set perf events that are to be enabled once domain is
started up. The virDomainGetPerfEvents API was flawed too. It
returned just runtime info.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-03-31 10:42:46 +02:00
Michal Privoznik
3b6c818532 virDomain{Get,Set}PerfEvents: Add @flags argument
I've noticed that these APIs are missing @flags argument. Even
though we don't have a use for them, it's our policy that every
new API must have @flags.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-03-31 07:24:36 +02:00
Michal Privoznik
46a5d1938e remoteDomainGetPerfEvents: Re-indent
There are few lines off the indentation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-03-31 07:24:36 +02:00
Peter Krempa
13a4ec678f qemu: command: Split up formatting of -numa and memory devices
They recently were extracted to a separate function. They don't belong
together though. Since -numa formatting is pretty compact, move it to
the main function and rename qemuBuildNumaCommandLine to
qemuBuildMemoryDeviceCommandLine.
2016-03-30 13:56:43 +02:00
Peter Krempa
25c39f76b8 qemu: command: Pass numad nodeset when formatting memory devices at boot
When starting up a VM libvirtd asks numad to place the VM in case of
automatic nodeset. The nodeset would not be passed to the memory device
formatter and the user would get an error.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1269715
2016-03-30 13:56:43 +02:00
Pavel Hrdina
95bbe4bf52 qemu_process: add check for hyperv features
Commit 7068b56c introduced several hyperv features.  Not all hyperv
features are supported by old enough kernels and we shouldn't allow to
start a guest if kernel doesn't support any of the hyperv feature.

There is one exception, for backward compatibility we cannot error out
if one of the RELAXED, VAPIC or SPINLOCKS isn't supported, for the same
reason we ignore invtsc, to not break restoring saved domains with older
libvirt.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-03-30 10:35:15 +02:00
Pavel Hrdina
e7cc2e3bef qemu_process: skip only cpu features
This check is there to allow restore saved domain with older libvirt
where we included invtsc by default for host-passthrough model.  Don't
skip the whole function, but only the part that checks for invtsc.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-03-30 10:35:15 +02:00
Jim Fehlig
e23a640c42 libxl: only disable domain death events in libxlDomainCleanup
Remove disabling domain death events from libxlDomainStart error
path. The domain death event is already disabled in libxlDomainCleanup.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-03-29 14:16:31 -06:00
Chunyan Liu
45fc2c1436 libxl: fix resource leaks in libxlDomainStart error paths
libxlDomainStart allocates and reserves resources that were not
being released in error paths. libxlDomainCleanup already handles
the job of releasing resources, and libxlDomainStart should call
it when encountering a failure.

Change the error handling logic to call libxlDomainCleanup on
failure. This includes acquiring the lease sooner and allowing
it to be released in libxlDomainCleanup on failure, similar to
the way other resources are reclaimed. With the lease now
released in libxlDomainCleanup, the release_dom label can be
renamed to cleanup_dom to better reflect its changed semantics.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-03-29 14:16:31 -06:00
Jim Fehlig
a75e35a083 libxl: rename cleanup_dom label
Rename cleanup_dom label to destroy_dom, which better describes what
it does.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-03-29 14:16:31 -06:00
Peter Krempa
5c633e0f7b conf: Remove now unused virDomainIOThreadIDMap 2016-03-29 21:26:07 +02:00
Peter Krempa
0b4b58690d conf: decrease iterations complexity when formatting iothreads
Create a bitmap of iothreads that have scheduler info set so that the
transformation algorithm does not have to iterate the empty bitmap many
times. By reusing self-expanding bitmaps the bitmap size does not need
to be pre-calculated.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1264008
2016-03-29 21:26:06 +02:00
Peter Krempa
917426c8d7 util: bitmap: Introduce self-expanding bitmap APIs
In some cases it's impractical to use the regular APIs as the bitmap
size needs to be pre-declared. These new APIs allow to use bitmaps that
self expand.

The new code adds a property to the bitmap to track the allocation of
memory so that VIR_RESIZE_N can be used.
2016-03-29 21:25:41 +02:00
Roman Bogorodskiy
4ed5937d71 perf: fix build on non-Linux
* Sync stubbed functions with prototypes
 * Add missing ATTRIBUTE_UNUSED where needed

Pushing under the build breaker rule.
2016-03-29 19:26:47 +03:00
Jiri Denemark
801a5f65fa qemu: Fix /proc/**/stat parsing
Since commit v1.3.2-119-g1e34a8f which enabled debug-threads in QEMU
qemuGetProcessInfo would fail to parse stats for any thread with a space
in its name.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-03-29 16:41:20 +02:00
Peter Krempa
0c8e3b2234 qemu: domain: Move and export qemuDomainDiskChainElement(Prepare|Revoke)
Move the function to qemu_domain.c and export them for further use.
2016-03-29 15:25:16 +02:00
Peter Krempa
358c18c391 qemu: Refactor qemuDomainPrepareDiskChainElement
Now that there are only two elements in the enum, let's change it to a
bool and rename the function similarly to the one added in previous
commit.
2016-03-29 15:25:16 +02:00
Peter Krempa
5126174357 qemu: Split image access revoking from qemuDomainPrepareDiskChainElement
Introduce qemuDomainDiskChainElementRevoke that revokes the access
rather than having a flag to do so.
2016-03-29 15:25:16 +02:00
Peter Krempa
0ea4fd7a58 qemu: Kill qemuDiskPathToAlias
The function has terrible semantics. Split it into two functions.
2016-03-29 15:25:16 +02:00
Peter Krempa
9f7d9891f0 qemu: monitor: Remove JSON impls of drive_add and drive_del
qemu won't ever add those functions directly to QMP. They will be
replaced with 'blockdev-add' and 'blockdev-del' eventually. At this time
there's no need to keep the stubs around.

Additionally the drive_del stub in JSON contained dead code in the
attempt to report errors. (VIR_ERR_OPERATION_UNSUPPORTED was never
reported). Since the text impl does have the same message it is reported
anyways.
2016-03-29 15:25:16 +02:00
Peter Krempa
552bf13f45 qemu: monitor: Drop qemuMonitorAttachDrive and leaves in call tree
Functions no longer required for attaching SCSI disks since
QEMU_CAPS_DEVICE is expected.
2016-03-29 15:23:10 +02:00
Peter Krempa
d4d32005d6 qemu: hotplug: Assume support for -device in qemuDomainAttachSCSIDisk
We've started to assume support for QEMU_CAPS_DEVICE. Doing so in the
SCSI disk hotplug code allows us to drop a lot of ugly legacy code.
2016-03-29 15:20:44 +02:00
Maxim Nestratov
9b73aff033 bhyve: fix invalid hostsysinfo freeing 2016-03-29 15:58:07 +03:00
Maxim Nestratov
f999f77d7d bhyve: cleanup unnecessary variables 2016-03-29 15:57:54 +03:00
Qiaowei Ren
bf9bc04683 perf: reenable perf events when libvirtd restart
When libvirtd daemon restart, this patch will reenable those perf
events previously enabled.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-7-git-send-email-qiaowei.ren@intel.com
2016-03-29 13:13:05 +01:00
Qiaowei Ren
afe833e9bd perf: add new xml element
This patch adds new xml element, and so we can have the option of
also having perf events enabled immediately at startup.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-6-git-send-email-qiaowei.ren@intel.com
2016-03-29 13:13:05 +01:00
Qiaowei Ren
0dd0165c03 qemu_driver: add support to perf event
This patch implement the internal driver API for perf event into
qemu driver.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-5-git-send-email-qiaowei.ren@intel.com
2016-03-29 13:13:05 +01:00
Qiaowei Ren
28b446292b perf: implement a set of util functions for perf event
This patch implement a set of interfaces for perf event. Based on
these interfaces, we can implement internal driver API for perf,
and get the results of perf conuter you care about.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-4-git-send-email-qiaowei.ren@intel.com
2016-03-29 13:13:05 +01:00
Qiaowei Ren
dd00767cbd perf: implement the remote protocol for perf event
Add remote support for perf event.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-3-git-send-email-qiaowei.ren@intel.com
2016-03-29 13:13:05 +01:00
Qiaowei Ren
c803b0072b perf: add new public APIs for perf event
API agreed on in
https://www.redhat.com/archives/libvir-list/2015-October/msg00872.html

* include/libvirt/libvirt-domain.h (virDomainGetPerfEvents,
virDomainSetPerfEvents): New declarations.
* src/libvirt_public.syms: Export new symbols.
* src/driver-hypervisor.h (virDrvDomainGetPerfEvents,
virDrvDomainSetPerfEvents): New typedefs.
* src/libvirt-domain.c: Implement virDomainGetPerfEvents and
virDomainSetPerfEvents.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-2-git-send-email-qiaowei.ren@intel.com
2016-03-29 13:13:05 +01:00
Nitesh Konkar
3e19b5d53d storage: Initialize pool size parameters for refresh thread
If the pool creation thread happens to detect the luns in
the scsi target, the size parameters will be calculated as
part of the refreshPool called from storagePoolCreate().

This means the virStoragePoolFCRefreshThread (commit id
'512b874') waiting to run and "refresh" the pool will
essentially double the allocation and capacity values.
A separate refresh would correct the values.

To avoid this, the FCRefreshThread needs to reinitialize
the pool size values prior to calling virStorageBackendSCSIFindLUs
which eventually calls virStorageBackendSCSINewLun and
updates the size values for each volume found.
2016-03-29 07:28:47 -04:00
Peter Krempa
98033a8b94 storage: rbd: Fix build
After the recent commits the build didn't work for me. Fix it by
using size_t as the callback argument is using and the correct
formatter. The attempted fixup to use %llu as a formatter was wrong.
2016-03-29 08:51:33 +02:00
Jim Fehlig
33a1a7c6f5 libxl: remove reference to non-existent out label
Commit e6336442 changed the 'out:' label to 'cleanup'  in
libxlDomainAttachNetDevice(), but missed a comment referencing
the 'out:' label. Remove it from the comment since it is no
longer accurate anyhow.
2016-03-28 13:05:42 -06:00
Maxim Nestratov
7068b56c85 conf: qemu: Add support for more HyperV Enlightenment features
This patch adds support for "vpindex", "runtime", "synic",
"stimer", and "vendor_id" features available in qemu 2.5+.

- When Hyper-V "vpindex" is on, guest can use MSR HV_X64_MSR_VP_INDEX
to get virtual processor ID.

- Hyper-V "runtime" enlightement feature allows to use MSR
HV_X64_MSR_VP_RUNTIME to get the time the virtual processor consumes
running guest code, as well as the time the hypervisor spends running
code on behalf of that guest.

- Hyper-V "synic" stands for Synthetic Interrupt Controller, which is
lapic extension controlled via MSRs.

- Hyper-V "stimer" switches on Hyper-V SynIC timers MSR's support.
Guest can setup and use fired by host events (SynIC interrupt and
appropriate timer expiration message) as guest clock events

- Hyper-V "reset" allows guest to reset VM.

- Hyper-V "vendor_id" exposes hypervisor vendor id to guest.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-03-28 13:10:18 -04:00
Nikolay Shirokovskiy
2e26d78c8b conf: refactor hyperv features xml output
1. All hyperv features are tristate ones. So make tristate generating part common.
2. Reduce nesting on spinlocks.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-03-28 13:10:18 -04:00
Nikolay Shirokovskiy
ae37d9f1d1 conf: refactor hyperv features parsing
1. All hyperv features are tristate ones. So make tristate parsing code common.
2. Reindent switch statement.
3. Reduce nesting in spinlocks parsing.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-03-28 13:10:18 -04:00
Laine Stump
5b5f12cffa util: avoid getting stuck on macvtapN name created outside libvirt
After the patches that added tracking of in-use macvtap names (commit
370608, first appearing in libvirt-1.3.2), if the function to allocate
a new macvtap device came to a device name created outside libvirt, it
would retry the same device name MACVLAN_MAX_ID (8191) times before
finally giving up in failure.

The problem was that virBitmapNextClearBit was always being called
with "0" rather than the value most recently checked (which would
increment each time through the loop), so it would always return the
same id (since we dutifully release that id after failing to create a
new device using it).

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

Signed-off-by: Laine Stump <laine@laine.org>
2016-03-28 12:52:50 -04:00
Chunyan Liu
373b9e9f00 libxl: fix hot add/remove VF from a pool
For those VF allocated from a network pool, we need to set its backend
to be VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN so that later work can be
correct.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
2016-03-28 10:18:39 -06:00
Roman Bogorodskiy
b77cec09db Revert "zfs: Only raw volumes are supported"
This reverts commit bb5f2dc91f.

The "if (vol->target.format != VIR_STORAGE_FILE_RAW)" check in the
createVol backend. This check is bogus because virStorageVolDefParseXML()
in conf/storage_conf.c sets target.format only if volOptions in
virStoragePoolTypeInfo has formatFromString set, and that's not the
case the zfs backend.

So the check always fails and breaks volume creation.
2016-03-27 11:11:04 -04:00
Roman Bogorodskiy
139a319794 Revert "logical: Only raw volumes are supported"
This reverts commit 6682d6219d.

The "if (vol->target.format != VIR_STORAGE_FILE_RAW)" check in the
createVol backend. This check is bogus because virStorageVolDefParseXML()
in conf/storage_conf.c sets target.format only if volOptions in
virStoragePoolTypeInfo has formatFromString set, and that's not the
case the logical backend.

So the check always fails and breaks volume creation.
2016-03-27 11:09:53 -04:00
Chunyan Liu
420eff8f26 libxlDomainDetachDeviceLive: handle hostdev parent is network device
When hostdev parent is network device, should call
libxlDomainDetachNetDevice to detach the device from a higher level.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
2016-03-25 16:57:34 -06:00
Chunyan Liu
b5534e5391 libxlDomainDetachNetDevice: cleanup codes
Adjust codes to make it cleaner.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
2016-03-25 16:57:34 -06:00