[libvirt] [PATCH] Use correct pci addresses during device-detach
by Nitesh_Konkar
From: Nitesh_Konkar <niteshkonkar(a)in.ibm.com>
The attach-device on live and persistent copies can be done independently.
Thus devices can end up having different pci addresses in live and persistent
copies. The detach device should try to detach the device from their respective
addresses instead of using the same from live/persistent.
Signed-off-by:nitkon12@linux.vnet.ibm.com
---
src/driver-nodedev.h | 1 +
src/qemu/qemu_driver.c | 25 ++++++++++---------------
2 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/src/driver-nodedev.h b/src/driver-nodedev.h
index e846612..dea79bd 100644
--- a/src/driver-nodedev.h
+++ b/src/driver-nodedev.h
@@ -59,6 +59,7 @@ typedef char *
typedef char *
(*virDrvNodeDeviceGetParent)(virNodeDevicePtr dev);
+
typedef int
(*virDrvNodeDeviceNumOfCaps)(virNodeDevicePtr dev);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f133b45..6fd58c2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8708,23 +8708,12 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
!(flags & VIR_DOMAIN_AFFECT_LIVE))
parse_flags |= VIR_DOMAIN_DEF_PARSE_INACTIVE;
- dev = dev_copy = virDomainDeviceDefParse(xml, vm->def,
+ dev_copy = virDomainDeviceDefParse(xml, vm->def,
caps, driver->xmlopt,
parse_flags);
- if (dev == NULL)
+ if (dev_copy == NULL)
goto endjob;
- if (flags & VIR_DOMAIN_AFFECT_CONFIG &&
- flags & VIR_DOMAIN_AFFECT_LIVE) {
- /* If we are affecting both CONFIG and LIVE
- * create a deep copy of device as adding
- * to CONFIG takes one instance.
- */
- dev_copy = virDomainDeviceDefCopy(dev, vm->def, caps, driver->xmlopt);
- if (!dev_copy)
- goto endjob;
- }
-
if (priv->qemuCaps)
qemuCaps = virObjectRef(priv->qemuCaps);
else if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, vm->def->emulator)))
@@ -8736,6 +8725,13 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
if (!vmdef)
goto endjob;
+ dev = virDomainDeviceDefParse(xml, vmdef,
+ caps, driver->xmlopt,
+ parse_flags);
+ if (!dev)
+ goto endjob;
+
+
if (virDomainDefCompatibleDevice(vmdef, dev,
VIR_DOMAIN_DEVICE_ACTION_DETACH) < 0)
goto endjob;
@@ -8777,8 +8773,7 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
cleanup:
virObjectUnref(qemuCaps);
virDomainDefFree(vmdef);
- if (dev != dev_copy)
- virDomainDeviceDefFree(dev_copy);
+ virDomainDeviceDefFree(dev_copy);
virDomainDeviceDefFree(dev);
virDomainObjEndAPI(&vm);
virObjectUnref(caps);
--
2.4.0
9 years, 5 months
[libvirt] [PATCH 0/3] security: misc cleanups
by Ján Tomko
Ján Tomko (3):
security_dac: check if virSecurityDACGetIds returns negative
security: remove extra security from function names
security_selinux: fix indentation
src/security/security_dac.c | 242 ++++++++++++++++++++--------------------
src/security/security_selinux.c | 205 +++++++++++++++++-----------------
2 files changed, 223 insertions(+), 224 deletions(-)
--
2.4.6
9 years, 5 months
[libvirt] [PATCH 0/2] Fix coverity build and resolve new issue
by John Ferlan
The first patch is a Coverity build breaker... The second one popped up
recently and while some may consider it noise or a false positive, it is
the only call that didn't check status. Not sure why it "popped up" after
the recent changes, but that does happen.
John Ferlan (2):
qemu: Fix build error in Coverity environment
vbox: Resolve Coverity CHECKED_RETURN
src/qemu/qemu_command.h | 2 +-
src/vbox/vbox_common.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
--
2.5.0
9 years, 5 months
[libvirt] [PATCH 0/6] Fixes for memory locking limit
by Andrea Bolognani
The code dealing with RLIMIT_MEMLOCK contained a few
assumptions that hold for x86 but don't necessarily work
as well for other platforms, eg. that qemu will need to
lock memory only when VFIO passthrough is involved.
This series removes such assumptions by removing ad-hoc
code and making sure that the function containing the
correct logic is called instead; it also implements the
platform-specific calculations needed to calculate the
correct RLIMIT_MEMLOCK value for ppc64 guests.
Patches 1-4 are architecture-agnostic, patches 5-6 are
specific to ppc64.
Cheers.
Andrea Bolognani (6):
process: Log when limiting the amount of locked memory
qemu: Use qemuDomainRequiresMlock() in qemuBuildCommandLine()
qemu: Use qemuDomainRequiresMlock() when attaching PCI hostdev
qemu: Reduce memlock limit after detaching hostdev
qemu: Always set locked memory limit for ppc64 domains
qemu: Add ppc64-specific math to qemuDomainGetMlockLimitBytes()
src/qemu/qemu_command.c | 9 ++---
src/qemu/qemu_domain.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++--
src/qemu/qemu_hotplug.c | 29 ++++++++++++----
src/util/virprocess.c | 4 +++
4 files changed, 116 insertions(+), 15 deletions(-)
--
2.5.0
9 years, 5 months
[libvirt] [PATCHv4 0/6] 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.
What is changed in v4:
* panic model attribute is added even if it wasn't specified
by the user [5/6], tests updated.
* configuration with multiple panic defices of same model is
rejected [6/6]
1-4 commits have no changes.
The previous version:
https://www.redhat.com/archives/libvir-list/2015-November/msg00457.html
Dmitry Andreev (6):
conf: add 'model' attribute for panic device with values isa, pseries,
hyperv
qemu: add support for hv_crash feature as a panic device
schema: allow multiple panic devices
tests: add tests for panic models and multiple panic devices
qemu: set panic device model if not specified by the user
conf: reject multiple panic devices of same model
docs/formatdomain.html.in | 19 ++-
docs/schemas/domaincommon.rng | 13 ++-
src/conf/domain_conf.c | 128 +++++++++++++--------
src/conf/domain_conf.h | 15 ++-
src/qemu/qemu_command.c | 74 ++++++++++--
src/qemu/qemu_domain.c | 30 ++++-
tests/qemuargv2xmltest.c | 1 +
.../qemuxml2argv-hyperv-panic.args | 21 ++++
.../qemuxml2argvdata/qemuxml2argv-hyperv-panic.xml | 25 ++++
.../qemuxml2argv-panic-double.args | 21 ++++
.../qemuxml2argvdata/qemuxml2argv-panic-double.xml | 28 +++++
tests/qemuxml2argvdata/qemuxml2argv-panic-isa.xml | 31 +++++
.../qemuxml2argv-panic-no-address.xml | 2 +-
.../qemuxml2argv-panic-pseries.xml | 30 +++++
.../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 2 +-
.../qemuxml2argv-pseries-nvram.xml | 2 +-
tests/qemuxml2argvtest.c | 3 +
tests/qemuxml2xmloutdata/qemuxml2xmlout-panic.xml | 31 +++++
.../qemuxml2xmlout-pseries-panic-missing.xml | 2 +-
.../qemuxml2xmlout-pseries-panic-no-address.xml | 30 +++++
tests/qemuxml2xmltest.c | 8 +-
21 files changed, 446 insertions(+), 70 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hyperv-panic.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hyperv-panic.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-double.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-double.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-isa.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-pseries.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-panic.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml
--
1.8.3.1
9 years, 5 months
[libvirt] qemuParseCommandLine and virDomainDefPostParse (and virDomaniDefAddImplicitControllers)
by Laine Stump
While playing with the idea of forcing explicit USB controller models, I
ended up with the qemuargv2xml test failing; it ended up that this was
because changes I had made to qemuDomainDefPostParse() were affecting
the XML produced by qemuParseCommandline(). The reason - after
constructing a virDomainDef object by parsing a qemu commandline,
qemuParseCommandline() calls two functions that are supposed to be
called after parsing domain XML - virDomainDefPostParse() (which calls
qemuDomainDefPostParse()).
In my opinion, qemuParseCommandLine() shouldn't be calling
virDomainDefPostParse() (or virDomainefAddImplicitControllers(), which
it calls in the wrong order relative to virDomainDefPostParse() BTW).
The reasons are:
1) this is causing the argv-to-xml conversion to include things in the
XML that were not on the original commandline, in particular "default"
devices like PCI and USB controllers (added in qemuDomainDefPostParse()
based on machinetype) as well as disk, smartcard, virtio-serial, and
hostdev-scsi controllers in virDomainDefAddImplicitControllers() (why
the duality there, anyway?)
2) If the output of argv-to-xml is used for a virDomainDefine, those
post-parse functions will be called then, and the implicit/auto devices
will be added at that time anyway, so in practice nothing is gained by
adding them during argv-to-xml.
Does anyone else have an opinion about this?
9 years, 5 months
[libvirt] [PATCH v2] vz: implementation of domainReboot callback
by Mikhail Feoktistov
Diff from v1.
1. Add virCheckFlags() call in vzDomainReboot
---
src/vz/vz_driver.c | 8 ++++++++
src/vz/vz_sdk.c | 8 ++++++++
src/vz/vz_sdk.h | 1 +
3 files changed, 17 insertions(+)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 0a968b9..39f58a4 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -923,6 +923,13 @@ static int vzDomainShutdown(virDomainPtr domain)
return prlsdkDomainChangeState(domain, prlsdkStop);
}
+static int vzDomainReboot(virDomainPtr domain,
+ unsigned int flags)
+{
+ virCheckFlags(0, -1);
+ return prlsdkDomainChangeState(domain, prlsdkRestart);
+}
+
static int vzDomainIsActive(virDomainPtr domain)
{
virDomainObjPtr dom = NULL;
@@ -1486,6 +1493,7 @@ static virHypervisorDriver vzDriver = {
.domainShutdown = vzDomainShutdown, /* 0.10.0 */
.domainCreate = vzDomainCreate, /* 0.10.0 */
.domainCreateWithFlags = vzDomainCreateWithFlags, /* 1.2.10 */
+ .domainReboot = vzDomainReboot, /* 1.2.22 */
.domainDefineXML = vzDomainDefineXML, /* 0.10.0 */
.domainDefineXMLFlags = vzDomainDefineXMLFlags, /* 1.2.12 */
.domainUndefine = vzDomainUndefine, /* 1.2.10 */
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 89c9e89..bf71e96 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1831,6 +1831,14 @@ PRL_RESULT prlsdkSuspend(PRL_HANDLE sdkdom)
return waitJob(job);
}
+PRL_RESULT prlsdkRestart(PRL_HANDLE sdkdom)
+{
+ PRL_HANDLE job = PRL_INVALID_HANDLE;
+
+ job = PrlVm_Restart(sdkdom);
+ return waitJob(job);
+}
+
int
prlsdkDomainChangeStateLocked(vzConnPtr privconn,
virDomainObjPtr dom,
diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
index ebe4591..88ee7d9 100644
--- a/src/vz/vz_sdk.h
+++ b/src/vz/vz_sdk.h
@@ -41,6 +41,7 @@ PRL_RESULT prlsdkStop(PRL_HANDLE sdkdom);
PRL_RESULT prlsdkPause(PRL_HANDLE sdkdom);
PRL_RESULT prlsdkResume(PRL_HANDLE sdkdom);
PRL_RESULT prlsdkSuspend(PRL_HANDLE sdkdom);
+PRL_RESULT prlsdkRestart(PRL_HANDLE sdkdom);
typedef PRL_RESULT (*prlsdkChangeStateFunc)(PRL_HANDLE sdkdom);
int
--
1.8.3.1
9 years, 5 months
[libvirt] [PATCH] vz: allow only en-us keymap for VNC
by Mikhail Feoktistov
In virtuozzo we support only en-us keymap for VMs and containers.
If keymap is specified than check that it's en-us, otherwise
show error message.
---
src/vz/vz_sdk.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 89c9e89..526c0f2 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -2220,10 +2220,11 @@ static int prlsdkCheckGraphicsUnsupportedParams(virDomainDefPtr def)
return -1;
}
- if (gr->data.vnc.keymap != 0) {
+ if (gr->data.vnc.keymap != 0 &&
+ STRNEQ(gr->data.vnc.keymap, "en-us")) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("vz driver doesn't support "
- "keymap setting for VNC graphics."));
+ _("vz driver supports only "
+ "\"en-us\" keymap for VNC graphics."));
return -1;
}
--
1.8.3.1
9 years, 5 months
[libvirt] [PATCH] set UID and GID according to dynamicOwnership
by Matteo Cafasso
When called with dynamicOwnership set, the qemuOpenFileAs function ignores it resulting in files not created with proper permissions.
The issue is reported in:
https://www.redhat.com/archives/libvirt-users/2015-November/msg00039.html
and also mentioned in:
https://www.redhat.com/archives/libvir-list/2015-November/msg00453.html
Signed-off-by: Matteo Cafasso <noxdafox(a)gmail.com>
---
src/qemu/qemu_driver.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 92a9961..b3b59b6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2932,6 +2932,11 @@ qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
if (path_shared <= 0 || dynamicOwnership)
vfoflags |= VIR_FILE_OPEN_FORCE_OWNER;
+ if (dynamicOwnership) {
+ uid = fallback_uid;
+ gid = fallback_gid;
+ }
+
if (stat(path, &sb) == 0) {
/* It already exists, we don't want to delete it on error */
need_unlink = false;
--
2.6.2
9 years, 5 months