[libvirt] [PATCH 0/2] Hyper-v crash feature support
by Dmitry Andreev
A new Hyper-V cpu feature 'hv_crash' was added to QEMU. The feature
will become available in v2.5.0.
This patch adds support for this feature.
Dmitry Andreev (2):
conf: add crash to hyperv features
qemu: add hv_crash support
docs/formatdomain.html.in | 7 +++++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 6 +++++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 2 ++
tests/qemuxml2argvdata/qemuxml2argv-hyperv-off.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-hyperv.args | 4 ++--
tests/qemuxml2argvdata/qemuxml2argv-hyperv.xml | 1 +
8 files changed, 24 insertions(+), 3 deletions(-)
--
1.8.3.1
9 years, 1 month
[libvirt] [PATCH] doc: fix memory setting API documentation inconsistencies
by Nikolay Shirokovskiy
Hi, everyone.
Patch series "vz: implement memory setting functions in driver" besides doing what it declares
also fixes inconsistency in documentation of domain API vs virsh CLI and somewhat biased to
vz case. I've hoped that core mantainers check this out but suddenly realized that
they are not as nothing in subject invites them to do it. So this letter instead of
being an actual patch is an invitation for them to evaluate mentioned patch series
in part that corresponds to documentation.
9 years, 1 month
[libvirt] [PATCH] qemu: process: Fix automatic setting of locked memory limit for VFIO
by Peter Krempa
For VFIO passthrough the guest memory including the device memory to be
resident in memory. Previously we used a magic constant of 1GiB that we
added to the current memory size of the VM to accomodate all this. It is
possible though that the device that is passed through exposes more than
that. To avoid guessing wrong again in the future set the memory lock
limit to unlimited at the point when VFIO will be used.
This problem is similar to the issue where we tried to infer the hard
limit for a VM according to it's configuration. This proved to be really
problematic so we moved this burden to the user.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1273480
Additionally this patch also fixes a similar bug, where the mlock limit
was not increased prior to a memory hotplug operation.
https://bugzilla.redhat.com/show_bug.cgi?id=1273491
---
src/qemu/qemu_command.c | 17 +++++------------
src/qemu/qemu_hotplug.c | 20 +++++---------------
src/util/virprocess.c | 3 +++
3 files changed, 13 insertions(+), 27 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 8824541..183aa85 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -11448,20 +11448,13 @@ qemuBuildCommandLine(virConnectPtr conn,
}
if (mlock) {
- unsigned long long memKB;
-
- /* VFIO requires all of the guest's memory to be
- * locked resident, plus some amount for IO
- * space. Alex Williamson suggested adding 1GiB for IO
- * space just to be safe (some finer tuning might be
- * nice, though).
- */
+ /* VFIO requires all of the guest's memory and the IO space of the
+ * device to be locked resident. Since we can't really know what the
+ * users decide to plug in we need to set the limit to unlimited. */
if (virMemoryLimitIsSet(def->mem.hard_limit))
- memKB = def->mem.hard_limit;
+ virCommandSetMaxMemLock(cmd, def->mem.hard_limit << 10);
else
- memKB = virDomainDefGetMemoryActual(def) + 1024 * 1024;
-
- virCommandSetMaxMemLock(cmd, memKB * 1024);
+ virCommandSetMaxMemLock(cmd, ULLONG_MAX);
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MSG_TIMESTAMP) &&
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 8f2fda9..1cf61ac 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1254,7 +1254,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
bool teardowncgroup = false;
bool teardownlabel = false;
int backend;
- unsigned long long memKB;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
unsigned int flags = 0;
@@ -1279,20 +1278,11 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
goto error;
}
- /* VFIO requires all of the guest's memory to be locked
- * resident (plus an additional 1GiB to cover IO space). During
- * hotplug, the guest's memory may already be locked, but it
- * doesn't hurt to "change" the limit to the same value.
- * NB: the domain's memory tuning parameters are stored as
- * Kibibytes, but virProcessSetMaxMemLock expects the value in
- * bytes.
- */
- if (virMemoryLimitIsSet(vm->def->mem.hard_limit))
- memKB = vm->def->mem.hard_limit;
- else
- memKB = virDomainDefGetMemoryActual(vm->def) + (1024 * 1024);
-
- virProcessSetMaxMemLock(vm->pid, memKB * 1024);
+ /* VFIO requires all of the guest's memory and the IO space of the
+ * device to be locked resident. Since we can't really know what the
+ * users decide to plug in we need to set the limit to unlimited. */
+ if (!virMemoryLimitIsSet(vm->def->mem.hard_limit))
+ virProcessSetMaxMemLock(vm->pid, ULLONG_MAX);
break;
default:
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 103c114..92195df 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -749,6 +749,9 @@ virProcessSetMaxMemLock(pid_t pid, unsigned long long bytes)
if (bytes == 0)
return 0;
+ if (bytes == ULLONG_MAX)
+ bytes = RLIM_INFINITY;
+
rlim.rlim_cur = rlim.rlim_max = bytes;
if (pid == 0) {
if (setrlimit(RLIMIT_MEMLOCK, &rlim) < 0) {
--
2.6.2
9 years, 1 month
[libvirt] Assert with libvirt + xen hvm
by CloudPatch Staff
We're hitting an assert whenever we try to create an HVM instance under Xen
via libvirtd.
System is running on Gentoo, package information as follows:
app-emulation/xen-4.5.0 USE="api debug flask hvm pam pygrub python qemu
screen"
app-emulation/xen-tools-4.5.0 USE="api debug flask hvm pam pygrub python
qemu screen"
app-emulation/libvirt-1.2.11-r2:0/1.2.11 USE="caps libvirtd lvm macvtap nls
qemu udev vepa virtualbox xen"
The following commands are run in parallel:
vmmachine ~ # libvirtd --listen
2015-01-22 16:33:13.596+0000: 2620: info : libvirt version: 1.2.11
2015-01-22 16:33:13.596+0000: 2620: error : udevGetDMIData:1607 : Failed to
get udev device for syspath '/sys/devices/virtual/dmi/id' or
'/sys/class/dmi/id'
libvirtd: libxl_fork.c:350: sigchld_installhandler_core: Assertion
`((void)"application must negotiate with libxl about SIGCHLD",
!(sigchld_saved_action.sa_flags & 4) &&
(sigchld_saved_action.__sigaction_handler.sa_handler == ((__sighandler_t)
0) || sigchld_saved_action.__sigaction_handler.sa_handler ==
((__sighandler_t) 1)))' failed.
Aborted
vmmachine ~ # VIRSH_DEBUG=0 virsh create xml
create: file(optdata): xml
libvirt: XML-RPC error : End of file while reading data: Input/output error
error: Failed to create domain from xml
error: End of file while reading data: Input/output error
libvirt: Domain Config error : Requested operation is not valid: A
different callback was requested
9 years, 1 month
[libvirt] [PATCH 00/10] Allow memory hotplug without NUMA on ppc64
by Peter Krempa
Peter Krempa (10):
conf: Make @def const in virDomainDefGetMemoryInitial
conf: Turn targetNode in struct virDomainMemoryDef to signed
qemu: command: Make qemuBuildMemoryBackendStr usable without NUMA
qemu: command: Always execute memory device formatter
qemu: domain: Add common function to perform memory hotplug checks
qemu: command: Move dimm device checks from formatter to checker
qemu: domain: Remove memory device check from post parse callback
conf: Prepare making memory device target node optional
qemu: command: Prepare memory device def formatter for missing target
node
qemu: ppc64: Support memory hotplug without NUMA enabled
docs/formatdomain.html.in | 5 +-
docs/schemas/domaincommon.rng | 8 +-
src/conf/domain_conf.c | 18 ++-
src/conf/domain_conf.h | 4 +-
src/qemu/qemu_command.c | 143 +++++------------
src/qemu/qemu_command.h | 4 +-
src/qemu/qemu_domain.c | 177 ++++++++++++++++++++-
src/qemu/qemu_domain.h | 4 +
src/qemu/qemu_hotplug.c | 11 +-
.../qemuxml2argv-memory-hotplug-ppc64-nonuma.args | 19 +++
.../qemuxml2argv-memory-hotplug-ppc64-nonuma.xml | 38 +++++
tests/qemuxml2argvtest.c | 2 +
12 files changed, 296 insertions(+), 137 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-ppc64-nonuma.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-ppc64-nonuma.xml
--
2.4.5
9 years, 1 month
[libvirt] Issue with Parallel/VZ driver on Parallel Cloud Server 6.0
by Frank Laszlo
Hello,
I've been tasked with integrating libvirt into a server running Parallel
Cloud Server 6.0. However, it seems I've ran into some trouble getting the
vz/parallel driver to compile. It appears there might be an issue with the
version of parallels-virtualization-sdk thats installed (6.10.24195)
I first tried using the latest libvirt version, 1.2.21. After finding the
magical configure arguments and ENV variables to get it to find the SDK,
the configure script reported "Yes" next to the vz driver. I then proceeded
to run a make, and was confronted with the following error message:
vz/vz_sdk.c: In function 'prlsdkAddNet':
vz/vz_sdk.c:2964: error: 'PRL_USE_VNET_NAME_FOR_BRIDGE_NAME' undeclared
(first use in this function)
vz/vz_sdk.c:2964: error: (Each undeclared identifier is reported only once
vz/vz_sdk.c:2964: error: for each function it appears in.)
make[3]: *** [vz/libvirt_driver_vz_la-vz_sdk.lo] Error 1
make[3]: Leaving directory `/root/libvirt-1.2.21/src'
I then tried to use libvirt 1.2.16, thinking that if I go back a few
versions to before the driver was renamed (parallels -> vz), it might work.
This appears to have sorted out the compiler errors, however, when it goes
to link the modules, I get the following:
make[3]: Entering directory `/root/libvirt-1.2.16/src'
CCLD libvirt_sanlock_helper
./.libs/libvirt.so: undefined reference to `PrlSrv_GetSrvConfig'
./.libs/libvirt.so: undefined reference to `PrlApi_Deinit'
./.libs/libvirt.so: undefined reference to `PrlSrv_AddVirtualNetwork'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetNetAdaptersCount'
./.libs/libvirt.so: undefined reference to `PrlSrv_GetVmListEx'
./.libs/libvirt.so: undefined reference to `PrlJob_GetResult'
./.libs/libvirt.so: undefined reference to `PrlHandle_GetType'
./.libs/libvirt.so: undefined reference to `PrlEvent_GetType'
./.libs/libvirt.so: undefined reference to `PrlVm_BeginEdit'
./.libs/libvirt.so: undefined reference to `PrlVmDev_GetStackIndex'
./.libs/libvirt.so: undefined reference to `PrlVmDevNet_SetAdapterType'
./.libs/libvirt.so: undefined reference to `PrlVmDev_GetIfaceType'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetDescription'
./.libs/libvirt.so: undefined reference to
`PrlVmDevNet_SetHostInterfaceName'
./.libs/libvirt.so: undefined reference to `PrlVmDevHd_SetMountPoint'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetVNCHostName'
./.libs/libvirt.so: undefined reference to
`PrlVmDevNet_GetHostInterfaceName'
./.libs/libvirt.so: undefined reference to `PrlVmDev_SetEmulatedType'
./.libs/libvirt.so: undefined reference to `PrlVm_StopEx'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetDiskCacheWriteBack'
./.libs/libvirt.so: undefined reference to `PrlSrv_Create'
./.libs/libvirt.so: undefined reference to `PrlBootDev_SetIndex'
./.libs/libvirt.so: undefined reference to `PrlJob_GetRetCode'
./.libs/libvirt.so: undefined reference to `PrlHndlList_GetItem'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetAutoStart'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetVmType'
./.libs/libvirt.so: undefined reference to `PrlVmDev_SetStackIndex'
./.libs/libvirt.so: undefined reference to `PrlVmDev_SetFriendlyName'
./.libs/libvirt.so: undefined reference to `PrlSrv_UnregEventHandler'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetVNCPort'
./.libs/libvirt.so: undefined reference to `PrlVm_Pause'
./.libs/libvirt.so: undefined reference to `PrlVmDev_GetImagePath'
./.libs/libvirt.so: undefined reference to `PrlHandle_AddRef'
./.libs/libvirt.so: undefined reference to `PrlVm_RefreshConfig'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetSerialPortsCount'
./.libs/libvirt.so: undefined reference to `PrlVm_Resume'
./.libs/libvirt.so: undefined reference to `PrlSrv_Logoff'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetHomePath'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetCpuMode'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetCpuMask'
./.libs/libvirt.so: undefined reference to `PrlVm_CommitEx'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetVNCMode'
./.libs/libvirt.so: undefined reference to `PrlJob_Wait'
./.libs/libvirt.so: undefined reference to `PrlVmDevNet_GetVirtualNetworkId'
./.libs/libvirt.so: undefined reference to `PrlEvent_GetIssuerId'
./.libs/libvirt.so: undefined reference to `PrlVm_RegEx'
./.libs/libvirt.so: undefined reference to `PrlResult_GetParamsCount'
./.libs/libvirt.so: undefined reference to `PrlVmDevNet_SetMacAddress'
./.libs/libvirt.so: undefined reference to `PrlVmDevNet_GetAdapterType'
./.libs/libvirt.so: undefined reference to `PrlVm_Suspend'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetCpuMode'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetCpuCount'
./.libs/libvirt.so: undefined reference to `PrlBootDev_SetSequenceIndex'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetBootDev'
./.libs/libvirt.so: undefined reference to `PrlBootDev_SetInUse'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetOpticalDisk'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetEnvId'
./.libs/libvirt.so: undefined reference to `PrlVirtNet_SetNetworkId'
./.libs/libvirt.so: undefined reference to
`PrlVmCfg_SetOfflineManagementEnabled'
./.libs/libvirt.so: undefined reference to `PrlVmDev_SetEnabled'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetNetAdapter'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetCpuMask'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetHardDisk'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetVNCMode'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetBootDevCount'
./.libs/libvirt.so: undefined reference to `PrlBootDev_SetType'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetCpuCount'
./.libs/libvirt.so: undefined reference to `PrlVmDev_SetIfaceType'
./.libs/libvirt.so: undefined reference to `PrlApi_InitEx'
./.libs/libvirt.so: undefined reference to `PrlVmDev_Remove'
./.libs/libvirt.so: undefined reference to `PrlJob_GetError'
./.libs/libvirt.so: undefined reference to `PrlEvent_GetErrCode'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetRamSize'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetVideoRamSize'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetName'
./.libs/libvirt.so: undefined reference to `PrlApi_GetResultDescription'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetVideoRamSize'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetUuid'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetOsTemplate'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetDefaultConfig'
./.libs/libvirt.so: undefined reference to `PrlSrv_DeleteVirtualNetwork'
./.libs/libvirt.so: undefined reference to `PrlVmDev_GetIndex'
./.libs/libvirt.so: undefined reference to `PrlVmDevHd_GetMountPoint'
./.libs/libvirt.so: undefined reference to `PrlVm_Reg'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetName'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetVNCPort'
./.libs/libvirt.so: undefined reference to `PrlSrv_GetDefaultVmConfig'
./.libs/libvirt.so: undefined reference to `PrlSrv_CreateVm'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetVNCHostName'
./.libs/libvirt.so: undefined reference to `PrlVm_DropSuspendedState'
./.libs/libvirt.so: undefined reference to `PrlSrv_GetVmConfig'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetRamSize'
./.libs/libvirt.so: undefined reference to `PrlVm_Unreg'
./.libs/libvirt.so: undefined reference to
`PrlVmDevNet_SetPktFilterPreventMacSpoof'
./.libs/libvirt.so: undefined reference to `PrlBootDev_Remove'
./.libs/libvirt.so: undefined reference to `PrlHndlList_GetItemsCount'
./.libs/libvirt.so: undefined reference to `PrlVmDev_SetImagePath'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetHardDisksCount'
./.libs/libvirt.so: undefined reference to `PrlResult_GetParamByIndex'
./.libs/libvirt.so: undefined reference to `PrlSrv_LoginLocalEx'
./.libs/libvirt.so: undefined reference to `PrlVirtNet_Create'
./.libs/libvirt.so: undefined reference to `PrlVmDevSerial_SetSocketMode'
./.libs/libvirt.so: undefined reference to `PrlVmInfo_GetState'
./.libs/libvirt.so: undefined reference to `PrlVm_GetState'
./.libs/libvirt.so: undefined reference to `PrlEvtPrm_ToInt32'
./.libs/libvirt.so: undefined reference to
`PrlVmDevNet_GetMacAddressCanonical'
./.libs/libvirt.so: undefined reference to `PrlVmDev_GetFriendlyName'
./.libs/libvirt.so: undefined reference to `PrlHandle_Free'
./.libs/libvirt.so: undefined reference to `PrlVmDev_IsConnected'
./.libs/libvirt.so: undefined reference to `PrlVm_StartEx'
./.libs/libvirt.so: undefined reference to `PrlVmDev_GetEmulatedType'
./.libs/libvirt.so: undefined reference to `PrlBootDev_GetType'
./.libs/libvirt.so: undefined reference to `PrlApi_SwitchConsoleLogging'
./.libs/libvirt.so: undefined reference to `PrlVirtNet_SetNetworkType'
./.libs/libvirt.so: undefined reference to `PrlEvent_GetParamByName'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_SetUuid'
./.libs/libvirt.so: undefined reference to `PrlEvent_GetErrString'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetSerialPort'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_CreateVmDev'
./.libs/libvirt.so: undefined reference to `PrlVmDev_SetIndex'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetAllDevices'
./.libs/libvirt.so: undefined reference to `PrlVmDev_SetSysName'
./.libs/libvirt.so: undefined reference to `PrlVmDev_SetConnected'
./.libs/libvirt.so: undefined reference to `PrlSrv_RegEventHandler'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_CreateBootDev'
./.libs/libvirt.so: undefined reference to `PrlVmDevNet_SetVirtualNetworkId'
./.libs/libvirt.so: undefined reference to `PrlVmCfg_GetOpticalDisksCount'
To me, these errors seem to be related to the parallels sdk, But I am
unable to figure out a way to get around them. I've
added PARALLELS_SDK_CFLAGS and PARALLELS_SDK_LIBS to my env with the proper
compiler and linker flags, I've also tried adjusting CFLAGS and LDFLAGS
directly with the same results.
Any help with this would be great, as we would like to continue using
libvirt as much as possible (We use it with a couple other drivers).
Thank you
--
Frank Laszlo
Nexcess - Beyond Hosting
21700 Melrose Ave.
Southfield, MI. 48075
Cell: +1.248.602.6123
Phone: +1.866.639.2377
Fax: +1.248.281.0473
9 years, 1 month
[libvirt] [PATCH] vz: implement memory setting functions in driver
by Nikolay Shirokovskiy
Implement functions for vz containers only. vz VMs memory
managment thru libvirt yet to be designed.
vz memory management for containers is rather different from other
drivers.
1. Whole bunch of memory settings functions change both cur_balloon and maximum
memory to the same value. The reason is that active container memory
settings is not limited by memory set at container startup as in virtual
machine case. Thus there is no real need in 2 parameters and this patch takes
an effort to map this situation to an existent interface.
2. virDomainSetMemory semantics is extended.
Current documentation states that this function changes memory only for
a current domain. At the same time virsh documentation states that behaviour of
'setmem' without flags (that eventually calls virDomainSetMemory) is hypervisor
specific. I think we can extend sematics of the function to the defined in
virsh. First this is already done for virDomainSetMaxMemory, second it would be
convinient for vz driver. With current semantics virDomainSetMemory can't be
implemented as vz always set persistent state if live state is set. With
extended semantics function just holds the vz driver behaviour and
we can use 'setmem' without flags to change domain memory.
3. VIR_DOMAIN_MEM_CURRENT is not supported.
There are 2 reasons. First is to be consistent with vzDomainAttachDeviceFlags
and vzDomainDetachDeviceFlags. Second is that this flag has no good
correllation with vz behaviour. I'm not sure what use case of this flag is,
I suppose it is to call the function without inquiring the current state of
domain so you will not fail because of incorrect flags combination. But with vz
this behaviour is impossible. The function will fail if domain is in active
state and you specify this flag as you can't change running domain config only.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/libvirt-domain.c | 5 ++-
src/vz/vz_driver.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/vz/vz_sdk.c | 23 ++++++++++++++
src/vz/vz_sdk.h | 1 +
4 files changed, 108 insertions(+), 2 deletions(-)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index de7eb04..56ab907 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -1882,8 +1882,9 @@ virDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
* to Domain0 i.e. the domain where the application runs.
* This function may require privileged access to the hypervisor.
*
- * This command only changes the runtime configuration of the domain,
- * so can only be called on an active domain.
+ * This command is hypervisor-specific for whether active, persistent,
+ * or both configurations are changed; for more control, use
+ * virDomainSetMemoryFlags().
*
* Returns 0 in case of success and -1 in case of failure.
*/
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 6f1cbfb..cab47ec 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1438,6 +1438,84 @@ vzNodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED)
return freeMem;
}
+static int vzDomainSetMemoryDefault(virDomainObjPtr dom, unsigned long memory)
+{
+ if (!IS_CT(dom->def)) {
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("Can't change memory size for vz VM"));
+ return -1;
+ }
+
+ if (prlsdkSetMemsize(dom, memory >> 10) < 0)
+ return -1;
+
+ virDomainDefSetMemoryInitial(dom->def, memory);
+ dom->def->mem.cur_balloon = memory;
+
+ return 0;
+}
+
+static int vzDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
+ unsigned int flags)
+{
+ virDomainObjPtr dom = NULL;
+ int ret = -1;
+
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG |
+ VIR_DOMAIN_MEM_MAXIMUM, -1);
+
+ if (!(dom = vzDomObjFromDomain(domain)))
+ return -1;
+
+ if (!(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("device attach needs VIR_DOMAIN_AFFECT_CONFIG "
+ "flag to be set"));
+ goto cleanup;
+ }
+
+ if (!virDomainObjIsActive(dom) && (flags & VIR_DOMAIN_AFFECT_LIVE)) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot do live update a device on "
+ "inactive domain"));
+ goto cleanup;
+ }
+
+ if (virDomainObjIsActive(dom) && !(flags & VIR_DOMAIN_AFFECT_LIVE)) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Updates on a running domain need "
+ "VIR_DOMAIN_AFFECT_LIVE flag"));
+ goto cleanup;
+ }
+
+ ret = vzDomainSetMemoryDefault(dom, memory);
+
+ cleanup:
+
+ virObjectUnlock(dom);
+ return ret;
+}
+
+static int vzDomainSetMemory(virDomainPtr domain, unsigned long memory)
+{
+ virDomainObjPtr dom = NULL;
+ int ret = -1;
+
+ if (!(dom = vzDomObjFromDomain(domain)))
+ return -1;
+
+ ret = vzDomainSetMemoryDefault(dom, memory);
+
+ virObjectUnlock(dom);
+ return ret;
+}
+
+static int vzDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
+{
+ return vzDomainSetMemory(domain, memory);
+}
+
static virHypervisorDriver vzDriver = {
.name = "vz",
.connectOpen = vzConnectOpen, /* 0.10.0 */
@@ -1499,6 +1577,9 @@ static virHypervisorDriver vzDriver = {
.domainBlockStatsFlags = vzDomainBlockStatsFlags, /* 1.2.17 */
.domainInterfaceStats = vzDomainInterfaceStats, /* 1.2.17 */
.domainMemoryStats = vzDomainMemoryStats, /* 1.2.17 */
+ .domainSetMemoryFlags = vzDomainSetMemoryFlags, /* 1.2.21 */
+ .domainSetMemory = vzDomainSetMemory, /* 1.2.21 */
+ .domainSetMaxMemory = vzDomainSetMaxMemory, /* 1.2.21 */
};
static virConnectDriver vzConnectDriver = {
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 89c9e89..2d0f688 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -4036,3 +4036,26 @@ prlsdkGetMemoryStats(virDomainObjPtr dom,
return ret;
}
+
+int prlsdkSetMemsize(virDomainObjPtr dom, unsigned int memsize)
+{
+ int ret = -1;
+ vzDomObjPtr privdom = dom->privateData;
+ PRL_HANDLE job = PRL_INVALID_HANDLE;
+ PRL_RESULT pret;
+
+ job = PrlVm_BeginEdit(privdom->sdkdom);
+ if (PRL_FAILED(waitJob(job)))
+ goto out;
+
+ pret = PrlVmCfg_SetRamSize(privdom->sdkdom, memsize);
+ prlsdkCheckRetGoto(pret, out);
+
+ job = PrlVm_CommitEx(privdom->sdkdom, PVCF_DETACH_HDD_BUNDLE);
+ if (PRL_FAILED(waitJob(job)))
+ goto out;
+
+ ret = 0;
+ out:
+ return ret;
+}
diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
index ebe4591..88fef4a 100644
--- a/src/vz/vz_sdk.h
+++ b/src/vz/vz_sdk.h
@@ -76,3 +76,4 @@ int
prlsdkGetVcpuStats(virDomainObjPtr dom, int idx, unsigned long long *time);
int
prlsdkGetMemoryStats(virDomainObjPtr dom, virDomainMemoryStatPtr stats, unsigned int nr_stats);
+int prlsdkSetMemsize(virDomainObjPtr dom, unsigned int memsize);
--
1.7.1
9 years, 1 month
[libvirt] [PATCH v2 0/8] libxl: domain statistics support
by Joao Martins
Hey,
This series bring support for various statistics about domains
regarding CPU, Memory, Network Interfaces, Block and Jobs. Not all of
the statistics are implemented: qdisk support is missing in this series
and some of the memory statistics aren't available.
With this series we further implement 7 more functions of libvirt APIs.
It is organized as follows:
* Patch 1, 2: implements cpu/memory statistics.
* Patch 3: implements network statistics
* Patch 4: adds helper method virDiskNameParse as an extension
to virDiskNameToIndex (New)
* Patch 5: VBD block statistics. QDisk will follow up in a separate
series regarding QEMU monitor integration.
* Patch 6: implement fetching all domain statistics
* Patch 7, 8: implements Job information statistics.
Overall it looks big but 70% of the patch is due to #5 and #6 but doesn't
add necessarily more complexity to the driver I believe. Patch #7 and #8
are of special importance because GetJobInfo and GetJobStats are now used
in Openstack Kilo to monitor live-migration progress. These two patches
together with the p2p migration I sent earlier let us sucessfully
live-migrate with Openstack Kilo. Furthermore with this series we get to
support nova diagnostics.
Tested this series on 4.4.3 and 4.5 setups plus Openstack Kilo.
Individual patches contain the changelog and comments addressed since v1.
Thanks!
Joao Martins (8):
libxl: implement virDomainGetCPUStats
libxl: implement virDomainMemorystats
libxl: implement virDomainInterfaceStats
util: add virDiskNameParse to handle disk and partition idx
libxl: implement virDomainBlockStats
libxl: implement virConnectGetAllDomainStats
libxl: implement virDomainGetJobInfo
libxl: implement virDomainGetJobStats
configure.ac | 2 +-
src/libvirt_private.syms | 1 +
src/libxl/libxl_domain.c | 43 +++
src/libxl/libxl_domain.h | 6 +
src/libxl/libxl_driver.c | 960 +++++++++++++++++++++++++++++++++++++++++++++++
src/util/virutil.c | 41 +-
src/util/virutil.h | 1 +
tests/utiltest.c | 56 +++
8 files changed, 1105 insertions(+), 5 deletions(-)
--
2.1.4
9 years, 1 month
[libvirt] [PATCH] vz: support cpu time in driver's domainGetInfo
by Nikolay Shirokovskiy
Just straight-forward patch.
Use reference counting for privdom as stats internally could drop domain lock.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/vz/vz_driver.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 6f1cbfb..0a968b9 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -554,7 +554,7 @@ vzDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
virDomainObjPtr privdom;
int ret = -1;
- if (!(privdom = vzDomObjFromDomain(domain)))
+ if (!(privdom = vzDomObjFromDomainRef(domain)))
goto cleanup;
info->state = virDomainObjGetState(privdom, NULL);
@@ -562,11 +562,24 @@ vzDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
info->maxMem = virDomainDefGetMemoryActual(privdom->def);
info->nrVirtCpu = privdom->def->vcpus;
info->cpuTime = 0;
+
+ if (virDomainObjIsActive(privdom)) {
+ unsigned long long vtime;
+ size_t i;
+
+ for (i = 0; i < privdom->def->vcpus; ++i) {
+ if (prlsdkGetVcpuStats(privdom, i, &vtime) < 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("cannot read cputime for domain"));
+ goto cleanup;
+ }
+ info->cpuTime += vtime;
+ }
+ }
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virDomainObjEndAPI(&privdom);
return ret;
}
--
1.7.1
9 years, 1 month
[libvirt] [PATCH v2 0/3] qemu: Fix mlock limit on memory hotplug
by Peter Krempa
Peter Krempa (3):
qemu: Extract logic to determine the mlock limit size for VFIO
qemu: hotplug: Fix mlock limit handling on memory hotplug
qemu: hotplug: Reject VFIO hotplug if setting RLIMIT_MEMLOCK fails
src/qemu/qemu_command.c | 18 ++---------------
src/qemu/qemu_domain.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_domain.h | 3 +++
src/qemu/qemu_hotplug.c | 50 +++++++++++++++++++++++++++++----------------
4 files changed, 92 insertions(+), 33 deletions(-)
--
2.6.2
9 years, 1 month