Commit Graph

19797 Commits

Author SHA1 Message Date
Peter Krempa
6a34d41894 qemu: Refactor qemuDomainPinEmulator by reusing virDomainObjGetDefs 2015-06-04 10:52:32 +02:00
Peter Krempa
582e8cb908 qemu: Refactor qemuDomainGetVcpuPinInfo by reusing virDomainObjGetDefs 2015-06-04 10:52:32 +02:00
Peter Krempa
7721e7901f qemu: Refactor qemuDomainPinVcpuFlags by reusing virDomainObjGetDefs 2015-06-04 10:52:32 +02:00
Peter Krempa
8db9610f57 qemu: Refactor qemuDomainSetBlkioParameters by reusing virDomainObjGetDefs 2015-06-04 10:52:32 +02:00
Peter Krempa
6200d86d60 qemu: Refactor qemuDomainChgIOThread by reusing virDomainObjGetDefs 2015-06-04 10:52:32 +02:00
Peter Krempa
cac6d6396d qemu: Refactor qemuDomainPinIOThread by reusing virDomainObjGetDefs 2015-06-04 10:52:32 +02:00
Peter Krempa
1282b350f3 qemu: Refactor qemuDomainGetIOThreadInfo by reusing virDomainObjGetDefs 2015-06-04 10:52:31 +02:00
Peter Krempa
0ad3d69e80 qemu: Refactor qemuDomainGetVcpusFlags by reusing virDomainObjGetDefs 2015-06-04 10:52:31 +02:00
Peter Krempa
10de2168e4 qemu: Refactor qemuDomainSetMemoryStatsPeriod by reusing virDomainObjGetDefs 2015-06-04 10:52:31 +02:00
Peter Krempa
65258d1f71 qemu: Refactor qemuDomainSetMemoryFlags by reusing virDomainObjGetDefs 2015-06-04 10:52:31 +02:00
Peter Krempa
3d021381c7 conf: Add new helpers to resolve virDomainModificationImpact to domain defs
virDomainLiveConfigHelperMethod that is used for this job now does
modify the flags but still requires the callers to extract the correct
definition objects.

In addition coverity and other static analyzers are usually unhappy as
they don't grasp the fact that @flags are upadted according to the
correct def to be present.

To work this issue around and simplify the calling chain let's add a new
helper that will work only on drivers that always copy the persistent
def to a transient at start of a vm. This will allow to drop a few
arguments. The new function syntax will also fill two definition
pointers rather than modifying the @flags parameter.
2015-06-04 10:52:31 +02:00
Peter Krempa
8db0f438c4 libxl: Don't remove vcpu pin definition in libxlDomainCleanup
The vCPU pinning definition gets removed when the domain definition is
being freed later. If there is no next configuration it would remove the
configured pinning.
2015-06-04 10:52:31 +02:00
Peter Krempa
5ce28b6d3b Revert "cputune: Support cputune for xend driver"
This reverts commit 01692bb167.

Quoting the original commit message:

"Not sure if it's the correct way to add cputune xml for xend driver..."

It is not. The defition created that is converted from the internal xend
structures would also be leaked since it isn't used any more.

Revert the commit since it does not make sense to keep the info
internally.
2015-06-04 10:52:31 +02:00
Peter Krempa
a02a161bb8 qemu: libxl: vcpupin: Don't reset pinning when pinning to all pcpus
In the pre-NUMA ages pinning a vCPU to all pCPUs was eaqual to deleting
the pinning info. Now it does not entirely work that way. Pinning a vCPU
to all pCPUs might be a desired operation. Additionally removal of the
pinning will result into using the default pinning information at the
next boot which might be different from all vcpus.

This patch removes the false assumption that we should remove the
pinning after pinning to all vCPUs and tweaks the documentation for
virsh.

A later patch will implement a new flag for the virDomainPinVcpuFlags
API that will allow to remove the pinning in a sane way.
2015-06-04 10:52:31 +02:00
Peter Krempa
efaa7197b6 lib: virDomainPinIOThread: Remove spurious overflow check
Internal structures use unsigned int, so there's no need for this legacy
check that was copied from the vCPU pinning api.
2015-06-04 10:52:31 +02:00
Peter Krempa
fbbea79890 conf: Store cpu count as unsigned int
While we probably won't see machines with more than 65536 cpus for a
while lets store the cpu count as an integer so that we can avoid quite
a lot of overflow checks in our code.
2015-06-04 10:52:30 +02:00
Peter Krempa
d3889db071 qemu: Refactor qemuDomainGetInfo
Since the returned structure uses "unsigned long" for memory sizes add a
few overflow checks to notify the user in case we are not able to
represent given values.
2015-06-04 10:52:30 +02:00
Peter Krempa
eaf4320869 qemu: Add helper to update domain balloon size and refactor usage places
When qemu does not support the balloon event the current memory size
needs to be queried. Since there are two places that implement the same
logic, split it out into a function and reuse.
2015-06-04 10:52:30 +02:00
Peter Krempa
641a145d73 qemu: process: Update current balloon state to maximum on vm startup
After libvirt issues the balloon resize command, the current balloon
size needs to be changed to the maximum memory size since the vCPUs were
not started and thus the balloon driver could not return the memory.

Since GetXMLDesc and other APIs return the balloon size without updating
it in case they are not able to obtain the job and the memory balloon
does not support the asynchronous event the sizing might be incorrect.
2015-06-04 10:52:30 +02:00
Ján Tomko
8728a78e90 Always add 'console' matching the 'serial' device
We have been formatting the first serial device also
as a console device, but only if there were no other consoles.

If there is a <serial> device present in the XML, but no serial
<console>, or if there isn't any <console> at all but the domain
definition hasn't gone through a parse->format->parse round-trip,
the <console> device would not be formatted.

Change the code to always add the stub device for the first
serial device.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1089914
2015-06-04 10:04:44 +02:00
Ján Tomko
12b949dfb2 maint: remove incorrect apostrophes from 'its' 2015-06-04 10:01:42 +02:00
Ján Tomko
22cdbec01b docs: php: remove reference to Red Hat
Also remove the redudant apostrophe from "it's".
2015-06-04 10:00:59 +02:00
Shivaprasad G Bhat
eac9445e40 check if console/channel PTY is null before attempting to open
Console/channel devices have their pty devices assigned when the emulator is
actually started. If time is spent in guest preparation, someone attempts
to open the console/channel, the libvirt crashes in virChrdevLockFilePath().
The patch attempts to fix the crash by adding a check before attempting to
open.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
2015-06-03 18:13:06 +02:00
Lubomir Rintel
81b19ce46a virnetdev: fix moving of 802.11 phys
There was a couple of problems with the style fixes applied to the original
patch:

1.) virFileReadAllQuiet comparison was incorrectly parenthesized when moved
into a condition, causing the len to be set to the result of comparison. This,
together with the removed underflow check would underflow the phy buffer.

2.) The logic was broken. Failure to call "ip" would abort the function, thus
the "iw" branch would never be reached.

This aims to fix the issues and work around possible style complains :)

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2015-06-03 18:05:23 +02:00
Peter Krempa
825df8c315 util: process: Refactor and fix virProcessSetAffinity
Refactor the function to return the bitmap instead of an integer and the
inner workings so that they make more sense.

This patch also fixes possible segfault on old systems that was
introduced by commit:

commit f1a43a8e41
Author: Hu Tao <hutao@cn.fujitsu.com>
Date:   Fri Sep 14 15:46:59 2012 +0800

    use virBitmap to store cpu affinity info
2015-06-03 14:20:25 +02:00
Martin Kletzander
99cc11b924 util: Clear output broadcast address before filling it in
Since commit 55ace7c478, the sockettest
fails without VIR_TEST_DEBUG set.  The problem is found by test number
42 (co-incidence?), which tests range '192.168.122.1' -
'192.168.122.255' in network '192.168.122.0/24'.  That is supposed to
fail because the end address is equal to the broadcast address.

When comparing these two in 'virSocketAddrEqual(end, &broadcast)',
there is a check for sin_addr as well as for sin_port.  That port,
however, is different when we do not enable test debugging.  With the
testing enabled, the port is 0 (correctly initialized), but without that
it has a random number there.  And that's because the structure is not
initialized anywhere.

By zeroing the structure before filling in the info, we make sure we
return only the address and not any information that was not requested.
And the test work once again.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-06-03 12:54:32 +02:00
Jiri Denemark
e9507fd41c virsh: Fix Ctrl-C behavior when watching a job
When watching a job (save, managedsave, dump, migrate) virsh spawns a
thread to call the appropriate API and waits for the result while
watching for interruption signals (SIGINT, Ctrl-C on the terminal).
Whenever such signal is caught, virsh calls virDomainAbortJob, stops
waiting for the job, and returns the result of virDomainAbortJob.

This is wrong because the job might have finished in the meantime or it
might have been cancelled by someone else and virsh would just report
the failure to abort the job. However, we are not interested in the
virDomainAbortJob's result at all, we need to keep waiting for the main
job to finish and report its result instead.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-06-03 09:53:02 +02:00
Peter Krempa
f4c67f0794 qemu: process: Refactor setup of memory ballooning
Since the monitor code now supports ullongs when setting balloon size,
drop the legacy code with overflow checking.

Additionally the comment mentioning that the job is treated as a sync
job does not make sense any more since the monitor is entered
asynchronously.
2015-06-03 09:42:08 +02:00
Peter Krempa
987b70777a qemu: monitor: Make qemuMonitorSetBalloon operate on unsinged long long 2015-06-03 09:42:08 +02:00
Peter Krempa
efe8b44a84 monitor: Move documentation for qemuMonitorGetBalloonInfo
Document the top level function rather than both bottom level ones. It
makes looking the docs up quicker.
2015-06-03 09:42:08 +02:00
Peter Krempa
65c61e5030 util: Add macro to overflow check integer assignments
Add a macro that will allow to simplify overflow checks and make them
more universal in case data types change.
2015-06-03 09:42:08 +02:00
Peter Krempa
f35b9b7898 libxl: Refactor libxlDomainGetVcpuPinInfo
Reuse the approach in qemuDomainGetVcpuPinInfo.
2015-06-03 09:42:07 +02:00
Peter Krempa
df55ed4bc0 libxl: Unbreak vcpu pinning
Libxl's vcpu pinning would work only if the vcpu array was ordered and
was not sparse. Remove the condition and iterate the pinning array
properly.
2015-06-03 09:42:07 +02:00
Peter Krempa
4f3f8ca88b libxl: Reuse virBitmapToData in libxlDomainSetVcpuAffinities 2015-06-03 09:42:07 +02:00
Peter Krempa
9f8196ace2 qemu: Refactor qemuDomainHelperGetVcpus by reusing virBitmapToDataBuf
Get rid of the unnecessary allocation and copying of the bitmap and
clean up some unnecesary temporary variables.
2015-06-03 09:42:07 +02:00
Peter Krempa
f79bfd9b51 qemu: Reuse virBitmapToDataBuf in qemuDomainGetEmulatorPinInfo 2015-06-03 09:42:07 +02:00
Peter Krempa
b6d438e10c qemu: Use virBitmapToDataBuf in qemuDomainGetVcpuPinInfo
Reuse the function so that we can get rid of a lot of temporary
allocations.
2015-06-03 09:42:07 +02:00
Peter Krempa
02a6c73f27 util: bitmap: Add virBitmapToDataBuf that does not allocate the buffer
Since some functions can be optimized by reusing the buffers that they
already have instead of allocating and copying new ones, lets split
virBitmapToData to two functions where one only converts the data and
the second one is a wrapper that allocates the buffer if necessary.
2015-06-03 09:42:07 +02:00
Peter Krempa
2c67a3513e conf: Move pinning information definition closer to the usage place 2015-06-03 09:42:07 +02:00
Peter Krempa
ee3da892f2 conf: Refactor emulatorpin handling
Store the emulator pinning cpu mask as a pure virBitmap rather than the
virDomainPinDef since it stores only the bitmap and refactor
qemuDomainPinEmulator to do the same operations in a much saner way.

As a side effect virDomainEmulatorPinAdd and virDomainEmulatorPinDel can
be removed since they don't add any value.
2015-06-03 09:42:07 +02:00
Peter Krempa
ff4c42ed7a qemu: Fix possible crash in qemuProcessSetVcpuAffinities
In case when <vcpu ... cpuset=""> is not specified, the vcpupin array is
not guaranteed to be allocated to def->vcpus. This would cause a crash
for TCG since it does not report thread IDs for vCPUs.
2015-06-03 09:42:07 +02:00
Maxim Nestratov
0d76794366 parallels: set virtType depending on driver name
We remember driver name in a new field 'drivername' within
private parallels connection structure. When a new domain
is defined we use this name to set corresponding virtType.
We set VIR_DOMAIN_VIRT_VZ for 'vz' driver and
VIR_DOMAIN_VIRT_PARALLELS for 'Parallels'.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-06-03 09:47:01 +03:00
Maxim Nestratov
4f20b241bb parallels: recommend to connect to vz:///system when connection fails
Though parallels:///system is still accepted we will encourage users
to use vz:///system instead.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-06-03 09:47:01 +03:00
Maxim Nestratov
560bbd4f9a parallels: increment the number of connection drivers
We need to do this because we have just added a vz driver.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-06-03 09:47:01 +03:00
Maxim Nestratov
26385e9477 parallels: add a new vz connection driver and hypervisor structures
We add this connection driver just as an exact copy with different
name to keep backward compatibility.
Vz stands for Virtuozzo, which is a new name of Parallels Cloud Server.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-06-03 09:47:01 +03:00
Maxim Nestratov
f4e51d9e41 parallels: accept vz as a driver uri and name
If 'parallels:///system' uri is specified then connection is made to
'Parallels' driver and domain type will be VIR_DOMAIN_VIRT_PARALLELS.
In case of 'vz:///system' connection is established to 'vz' driver
and domain type will be VIR_DOMAIN_VIRT_VZ.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-06-03 09:47:01 +03:00
Maxim Nestratov
4f01592c07 parallels: add new guest capabilities assigned to vz driver
Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-06-03 09:47:00 +03:00
Maxim Nestratov
a7f98a92cb parallels: use newly introduced VIR_DOMAIN_VIRT_VZ
As soon as we keep backward compatibility we treat this constant
as synonym to VIR_DOMAIN_VIRT_PARALLELS.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-06-03 09:47:00 +03:00
Maxim Nestratov
23b0f4511e parallels: introduce vz driver constant and string
This new name and constant will be used as substitutions for parallels driver one.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-06-03 09:47:00 +03:00
Luyao Huang
0ed3b33535 qemu: Do not release device address on successful RNG attach
Commit id '980b265d' neglected to check for a successful status when
deciding whether to release the device address for the RNG attach thus
the address would be released even though the device was added.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-06-02 14:03:48 -04:00