[libvirt] Cpu Modeling
by Jason J. Herne
Hi Jiri & Eduardo,
You might remember a discussion with David Hildenbrand of IBM on the Qemu
mailing list regarding a new Qemu<->Libvirt interface for cpu modeling. I am
picking up this work from David and I wanted to confirm that we are
still on the
same page as to the direction of that interface.
For your reference:
https://www.redhat.com/archives/libvir-list/2016-June/thread.html#01413
https://lists.gnu.org/archive/html/qemu-devel/2016-09/threads.html#00489
The first link is to the discussion you were directly involved in. The
second
link is to the final patch set posted to qemu-devel. The cover letter
gives a
good overview of the interface added to Qemu and the proposed use-case for
Libvirt to use this new cpu modeling support. I'll paste in the most
relevant
section for your convenience:
--------------------------------Libvirt usecase----------------------------
Testing for runability:
- Simply try to start QEMU with KVM, compat machine, CPU model
- Could be done using query-cpu-model-comparison in the future.
Identifying host model, e.g. "virsh capabilities"
- query-cpu-model-expansion on "host" with "-M none --enable-kvm"
<cpu mode='host-model'>:
- simply copy the identified host model
<cpu mode='host-passthrough'>:
- "-cpu host"
"virsh cpu-baseline":
- query-cpu-model-baseline on two models with "-M none"
"virsh cpu-compare":
- query-cpu-model-comparison on two models with "-M none"
There might be some cenarios where libvirt wants to convert another CPU
model to a static variant, this can be done using query-cpu-model-expansion
---------------------------------------------------------------------------
Now that I've hopefully refreshed your memory :) I just want to make
sure that
you are still on-board with this plan. I realize that this new approach does
things differently than Libvirt does today for other platforms. Especially
x86_64. The big differences are as follows:
1. We will invoke qemu to gather the host cpu data used for virsh
capabilities.
Today this data seems to be collected directly from the host hardware
for most
(all?) architectures.
2. virsh cpu-models {arch} will also use a Qemu invocation to gather cpu
model
data.
3. Most architectures seem to use a "map" (xml file containing cpu model
data
that ships with Libvirt) to satisfy #1 and #2 above. Our new method does
not use
this map as it gets all of the data directly from Qemu.
4. virsh cpu-baseline and cpu-compare will now invoke qemu directly as well.
Note: I'm not sure exactly how much all of this will apply just to s390 with
other architectures moving over to the new interface if/when they want
to. Or if
we will want to change all architectures to this new interface at the
same time.
Any guidance?
Thanks for your time and consideration.
--
-- Jason J. Herne (jjherne(a)linux.vnet.ibm.com)
8 years, 1 month
[libvirt] [libvirt-perl][PATCH] Add VIR_DOMAIN_VCPU_HOTPLUGGABLE constant
by Michal Privoznik
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Changes | 2 +-
Virt.xs | 1 +
lib/Sys/Virt/Domain.pm | 4 ++++
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/Changes b/Changes
index 4985100..5831939 100644
--- a/Changes
+++ b/Changes
@@ -2,7 +2,7 @@ Revision history for perl module Sys::Virt
2.4.0 2016-00-00
- - XXX
+ - Add VIR_DOMAIN_VCPU_HOTPLUGGABLE constant
2.3.0 2016-10-06
diff --git a/Virt.xs b/Virt.xs
index b4ca049..c1d923c 100644
--- a/Virt.xs
+++ b/Virt.xs
@@ -8309,6 +8309,7 @@ BOOT:
REGISTER_CONSTANT(VIR_DOMAIN_VCPU_CONFIG, VCPU_CONFIG);
REGISTER_CONSTANT(VIR_DOMAIN_VCPU_MAXIMUM, VCPU_MAXIMUM);
REGISTER_CONSTANT(VIR_DOMAIN_VCPU_GUEST, VCPU_GUEST);
+ REGISTER_CONSTANT(VIR_DOMAIN_VCPU_HOTPLUGGABLE, VCPU_HOTPLUGGABLE);
REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_DEFAULT, SHUTDOWN_DEFAULT);
diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm
index e37b078..f45fc9e 100644
--- a/lib/Sys/Virt/Domain.pm
+++ b/lib/Sys/Virt/Domain.pm
@@ -2768,6 +2768,10 @@ Flag to request adjustment of the maximum vCPU value
Flag to request the guest VCPU mask
+=item Sys::Virt::Domain::VCPU_HOTPLUGGABLE
+
+Flag to make vcpus added hot(un)pluggable
+
=back
=head2 STATE CHANGE EVENTS
--
2.8.4
8 years, 1 month
[libvirt] [PATCH V3 0/4] qemu: report actual vcpu state in virVcpuInfo
by Viktor Mihajlovski
Currently, the virVcpuInfo returned by virDomainGetVcpus() will always
report a state of VIR_VCPU_RUNNING for each defined domain vcpu even if
the vcpu is currently in the halted state.
As the monitor interface is in fact reporting the accurate state, it is
rather easy to transport this information with the existing API.
This is done by
- adding a new state of VIR_VCPU_HALTED
- extending the monitor to pass back the halted state for the vcpus
- adding a new field to the private domain vcpu object reflecting the
halted state for the vcpu
- modifying the driver code to report the vcpu state based on the halted
indicator
- extending virsh vcpuinfo to also display the halted state
The vcpu state is however not recorded in the internal XML format, since
the state can change asynchronously (without notification).
V2 is a rebase on top of Peter Krempa's CPU hotplug modernization.
V3 tries to address the review comments by John and Peter.
I noticed Peter has posted (we had a tendency for mid-air collisions lately)
https://www.redhat.com/archives/libvir-list/2016-October/msg00498.html
I've applied the patches on top of mine and have seen no
issues so far.
Viktor Mihajlovski (4):
domain: Add new VCPU state "halted"
qemu: Add monitor support for CPU halted state
qemu: Add domain support for VCPU halted state
qemu: Ensure reported VCPU state is current in driver API
include/libvirt/libvirt-domain.h | 1 +
src/qemu/qemu_domain.c | 66 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_domain.h | 5 +++
src/qemu/qemu_driver.c | 15 +++++++--
src/qemu/qemu_monitor.c | 6 +++-
src/qemu/qemu_monitor.h | 3 ++
src/qemu/qemu_monitor_json.c | 3 ++
src/qemu/qemu_monitor_text.c | 8 ++++-
tests/qemumonitorjsontest.c | 8 ++---
tools/virsh-domain.c | 3 +-
tools/virsh.pod | 57 ++++++++++++++++++++++++++++++++++
11 files changed, 166 insertions(+), 9 deletions(-)
--
1.9.1
8 years, 1 month
[libvirt] [PATCH] virlog: Enclose part of virLogDefineOutputs in HAVE_SYSLOG_H block
by Erik Skultety
Commit 640b58ab broke the mingw build because it referenced 'current_ident'
as well as 'openlog' symbols both of which are declared conditionally within
HAVE_SYSLOG_H directive. This patch fixes the broken build. Additional changes
like moving all variable declarations in virLogDefineOutputs into the
conditional block were necessary to avoid 'unused variable' errors from mingw.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
I could've pushed it under build breaker rule but I'd rather be safe than sorry
that I missed anything else.
Erik
src/util/virlog.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 14ee701..f52d9d8 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1362,16 +1362,15 @@ virLogFindOutput(virLogOutputPtr *outputs, size_t noutputs,
int
virLogDefineOutputs(virLogOutputPtr *outputs, size_t noutputs)
{
- int ret = -1;
- int id;
+ if (virLogInitialize() < 0)
+ return -1;
+
+ virLogLock();
+ virLogResetOutputs();
+
+#if HAVE_SYSLOG_H
+ int id = -1;
char *tmp = NULL;
-
- if (virLogInitialize() < 0)
- return -1;
-
- virLogLock();
- virLogResetOutputs();
-
/* syslog needs to be special-cased, since it keeps the fd in private */
if ((id = virLogFindOutput(outputs, noutputs, VIR_LOG_TO_SYSLOG,
current_ident)) != -1) {
@@ -1379,20 +1378,21 @@ virLogDefineOutputs(virLogOutputPtr *outputs, size_t noutputs)
* holding the lock so it's safe to call openlog and change the message
* tag
*/
- if (VIR_STRDUP_QUIET(tmp, outputs[id]->name) < 0)
- goto cleanup;
+ if (VIR_STRDUP_QUIET(tmp, outputs[id]->name) < 0) {
+ virLogUnlock();
+ return -1;
+ }
VIR_FREE(current_ident);
current_ident = tmp;
openlog(current_ident, 0, 0);
}
+#endif
virLogOutputs = outputs;
virLogNbOutputs = noutputs;
- ret = 0;
- cleanup:
virLogUnlock();
- return ret;
+ return 0;
}
--
2.5.5
8 years, 1 month
[libvirt] [PATCH 0/2] Minor panic device fixes
by Martin Kletzander
Completely new BLURB, just for €99.99, call now!
Martin Kletzander (2):
schema: Allow alias for panic device
conf: Honour flags in virDomainPanicDefParseXML
docs/schemas/domaincommon.rng | 3 +++
src/conf/domain_conf.c | 10 +++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
--
2.10.1
8 years, 1 month
[libvirt] [PATCH] src: Threat pid as signed
by Michal Privoznik
This initially started as a fix of some debug printing in
virCgroupDetect. However it turned out that other places suffer
from the similar problem. While dealing with pids, esp. in cases
where we cannot use pid_t for ABI stability reasons, we often
chose an unsigned integer type. This makes no sense as pid_t is
signed.
Also, new syntax-check rule is introduced so we won't repeat this
mistake.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Technically, this is v2 of [1], but like 99% of the patch is
different, so I'm sending this as a completely new patch.
1: https://www.redhat.com/archives/libvir-list/2016-October/msg00254.html
cfg.mk | 8 ++++++++
src/locking/lock_driver_sanlock.c | 4 ++--
src/lxc/lxc_controller.c | 4 ++--
src/lxc/lxc_domain.c | 8 ++++----
src/lxc/lxc_driver.c | 4 ++--
src/lxc/lxc_monitor.c | 3 +--
src/lxc/lxc_process.c | 8 ++++----
src/qemu/qemu_process.c | 12 ++++++------
src/util/vircgroup.c | 24 ++++++++++++------------
src/util/viridentity.c | 2 +-
src/util/virpolkit.c | 1 +
src/util/virprocess.c | 14 ++++++--------
src/util/virsystemd.c | 9 +++++----
src/util/virutil.c | 4 ++--
14 files changed, 56 insertions(+), 49 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 9f5949c..b33b1e2 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -581,6 +581,11 @@ sc_prohibit_int_assign_bool:
halt='use bool type for boolean values' \
$(_sc_search_regexp)
+sc_prohibit_unsigned_pid:
+ @prohibit='\<unsigned\> [^,=]+pid' \
+ halt='use signed type for pid values' \
+ $(_sc_search_regexp)
+
# Many of the function names below came from this filter:
# git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \
# |sed 's/.*\.c- *//'|perl -pe 's/ ?\(.*//'|sort -u \
@@ -1214,6 +1219,9 @@ exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets = \
exclude_file_name_regexp--sc_prohibit_int_ijk = \
^(src/remote_protocol-structs|src/remote/remote_protocol\.x|cfg\.mk|include/libvirt/libvirt.+|src/admin_protocol-structs|src/admin/admin_protocol\.x)$$
+exclude_file_name_regexp--sc_prohibit_unsigned_pid = \
+ ^(include/libvirt/libvirt-qemu.h|src/(driver-hypervisor.h|libvirt-qemu.c|locking/lock_protocol.x|lxc/lxc_monitor_protocol.x|qemu/qemu_driver.c|remote/qemu_protocol.x|util/virpolkit.c|util/virsystemd.c)|tests/virpolkittest.c|tools/virsh-domain.c)$$
+
exclude_file_name_regexp--sc_prohibit_getenv = \
^tests/.*\.[ch]$$
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 332c2de..280219f 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -87,7 +87,7 @@ struct _virLockManagerSanlockPrivate {
char *vm_name;
unsigned char vm_uuid[VIR_UUID_BUFLEN];
unsigned int vm_id;
- unsigned int vm_pid;
+ int vm_pid;
unsigned int flags;
bool hasRWDisks;
int res_count;
@@ -494,7 +494,7 @@ static int virLockManagerSanlockNew(virLockManagerPtr lock,
if (VIR_STRDUP(priv->vm_name, param->value.str) < 0)
goto error;
} else if (STREQ(param->key, "pid")) {
- priv->vm_pid = param->value.ui;
+ priv->vm_pid = param->value.iv;
} else if (STREQ(param->key, "id")) {
priv->vm_id = param->value.ui;
} else if (STREQ(param->key, "uri")) {
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 8c581df..508bc3e 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1022,7 +1022,7 @@ static void virLXCControllerSignalChildIO(virNetDaemonPtr dmn,
int status;
ret = waitpid(-1, &status, WNOHANG);
- VIR_DEBUG("Got sig child %d vs %lld", ret, (unsigned long long)ctrl->initpid);
+ VIR_DEBUG("Got sig child %d vs %lld", ret, (long long) ctrl->initpid);
if (ret == ctrl->initpid) {
virNetDaemonQuit(dmn);
virMutexLock(&lock);
@@ -2328,7 +2328,7 @@ virLXCControllerEventSendInit(virLXCControllerPtr ctrl,
{
virLXCMonitorInitEventMsg msg;
- VIR_DEBUG("Init pid %llu", (unsigned long long)initpid);
+ VIR_DEBUG("Init pid %lld", (long long) initpid);
memset(&msg, 0, sizeof(msg));
msg.initpid = initpid;
diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c
index 9027c25..3a7404f 100644
--- a/src/lxc/lxc_domain.c
+++ b/src/lxc/lxc_domain.c
@@ -328,8 +328,8 @@ virLXCDomainObjPrivateXMLFormat(virBufferPtr buf,
{
virLXCDomainObjPrivatePtr priv = vm->privateData;
- virBufferAsprintf(buf, "<init pid='%llu'/>\n",
- (unsigned long long)priv->initpid);
+ virBufferAsprintf(buf, "<init pid='%lld'/>\n",
+ (long long) priv->initpid);
return 0;
}
@@ -340,9 +340,9 @@ virLXCDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
virDomainDefParserConfigPtr config ATTRIBUTE_UNUSED)
{
virLXCDomainObjPrivatePtr priv = vm->privateData;
- unsigned long long thepid;
+ long long thepid;
- if (virXPathULongLong("string(./init[1]/@pid)", ctxt, &thepid) < 0) {
+ if (virXPathLongLong("string(./init[1]/@pid)", ctxt, &thepid) < 0) {
VIR_WARN("Failed to load init pid from state %s",
virGetLastErrorMessage());
priv->initpid = 0;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index a9e664c..a880f7c 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3438,7 +3438,7 @@ lxcDomainShutdownFlags(virDomainPtr dom,
errno != ESRCH) {
virReportSystemError(errno,
_("Unable to send SIGTERM to init pid %llu"),
- (unsigned long long)priv->initpid);
+ (long long) priv->initpid);
goto endjob;
}
}
@@ -3521,7 +3521,7 @@ lxcDomainReboot(virDomainPtr dom,
errno != ESRCH) {
virReportSystemError(errno,
_("Unable to send SIGTERM to init pid %llu"),
- (unsigned long long)priv->initpid);
+ (long long) priv->initpid);
goto endjob;
}
}
diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c
index 57f4098..d828d52 100644
--- a/src/lxc/lxc_monitor.c
+++ b/src/lxc/lxc_monitor.c
@@ -105,8 +105,7 @@ virLXCMonitorHandleEventInit(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
virLXCMonitorPtr mon = opaque;
virLXCMonitorInitEventMsg *msg = evdata;
- VIR_DEBUG("Event init %llu",
- (unsigned long long)msg->initpid);
+ VIR_DEBUG("Event init %lld", (long long) msg->initpid);
if (mon->cb.initNotify)
mon->cb.initNotify(mon, (pid_t)msg->initpid, mon->vm);
}
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index bce6a2f..07da3d3 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -740,8 +740,8 @@ virLXCProcessGetNsInode(pid_t pid,
struct stat sb;
int ret = -1;
- if (virAsprintf(&path, "/proc/%llu/ns/%s",
- (unsigned long long)pid, nsname) < 0)
+ if (virAsprintf(&path, "/proc/%lld/ns/%s",
+ (long long) pid, nsname) < 0)
goto cleanup;
if (stat(path, &sb) < 0) {
@@ -776,8 +776,8 @@ static void virLXCProcessMonitorInitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED
priv->initpid = initpid;
if (virLXCProcessGetNsInode(initpid, "pid", &inode) < 0) {
- VIR_WARN("Cannot obtain pid NS inode for %llu: %s",
- (unsigned long long)initpid,
+ VIR_WARN("Cannot obtain pid NS inode for %lld: %s",
+ (long long) initpid,
virGetLastErrorMessage());
virResetLastError();
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index a4bc082..cfa7725 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5396,8 +5396,8 @@ qemuProcessLaunch(virConnectPtr conn,
_("Domain %s didn't show up"), vm->def->name);
rv = -1;
}
- VIR_DEBUG("QEMU vm=%p name=%s running with pid=%llu",
- vm, vm->def->name, (unsigned long long)vm->pid);
+ VIR_DEBUG("QEMU vm=%p name=%s running with pid=%lld",
+ vm, vm->def->name, (long long) vm->pid);
} else {
VIR_DEBUG("QEMU vm=%p name=%s failed to spawn",
vm, vm->def->name);
@@ -5788,9 +5788,9 @@ qemuProcessKill(virDomainObjPtr vm, unsigned int flags)
{
int ret;
- VIR_DEBUG("vm=%p name=%s pid=%llu flags=%x",
+ VIR_DEBUG("vm=%p name=%s pid=%lld flags=%x",
vm, vm->def->name,
- (unsigned long long)vm->pid, flags);
+ (long long) vm->pid, flags);
if (!(flags & VIR_QEMU_PROCESS_KILL_NOCHECK)) {
if (!virDomainObjIsActive(vm)) {
@@ -5868,10 +5868,10 @@ void qemuProcessStop(virQEMUDriverPtr driver,
char *timestamp;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
- VIR_DEBUG("Shutting down vm=%p name=%s id=%d pid=%llu, "
+ VIR_DEBUG("Shutting down vm=%p name=%s id=%d pid=%lld, "
"reason=%s, asyncJob=%s, flags=%x",
vm, vm->def->name, vm->def->id,
- (unsigned long long)vm->pid,
+ (long long) vm->pid,
virDomainShutoffReasonTypeToString(reason),
qemuDomainAsyncJobTypeToString(asyncJob),
flags);
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 8b52816..24917e7 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -548,13 +548,13 @@ virCgroupDetectPlacement(virCgroupPtr group,
char *procfile;
VIR_DEBUG("Detecting placement for pid %lld path %s",
- (unsigned long long)pid, path);
+ (long long) pid, path);
if (pid == -1) {
if (VIR_STRDUP(procfile, "/proc/self/cgroup") < 0)
goto cleanup;
} else {
- if (virAsprintf(&procfile, "/proc/%llu/cgroup",
- (unsigned long long)pid) < 0)
+ if (virAsprintf(&procfile, "/proc/%lld/cgroup",
+ (long long) pid) < 0)
goto cleanup;
}
@@ -732,11 +732,12 @@ virCgroupDetect(virCgroupPtr group,
return -1;
}
- VIR_DEBUG("Detected mount/mapping %zu:%s at %s in %s for pid %llu", i,
+ VIR_DEBUG("Detected mount/mapping %zu:%s at %s in %s for pid %lld",
+ i,
virCgroupControllerTypeToString(i),
group->controllers[i].mountPoint,
group->controllers[i].placement,
- (unsigned long long)pid);
+ (long long) pid);
}
return 0;
@@ -1235,8 +1236,7 @@ virCgroupAddTaskController(virCgroupPtr group, pid_t pid, int controller)
return -1;
}
- return virCgroupSetValueU64(group, controller, "tasks",
- (unsigned long long)pid);
+ return virCgroupSetValueI64(group, controller, "tasks", pid);
}
@@ -3506,8 +3506,8 @@ virCgroupKillInternal(virCgroupPtr group, int signum, virHashTablePtr pids)
goto cleanup;
} else {
while (!feof(fp)) {
- unsigned long pid_value;
- if (fscanf(fp, "%lu", &pid_value) != 1) {
+ long pid_value;
+ if (fscanf(fp, "%ld", &pid_value) != 1) {
if (feof(fp))
break;
virReportSystemError(errno,
@@ -3518,12 +3518,12 @@ virCgroupKillInternal(virCgroupPtr group, int signum, virHashTablePtr pids)
if (virHashLookup(pids, (void*)pid_value))
continue;
- VIR_DEBUG("pid=%lu", pid_value);
+ VIR_DEBUG("pid=%ld", pid_value);
/* Cgroups is a Linux concept, so this cast is safe. */
if (kill((pid_t)pid_value, signum) < 0) {
if (errno != ESRCH) {
virReportSystemError(errno,
- _("Failed to kill process %lu"),
+ _("Failed to kill process %ld"),
pid_value);
goto cleanup;
}
@@ -3553,7 +3553,7 @@ virCgroupKillInternal(virCgroupPtr group, int signum, virHashTablePtr pids)
static uint32_t
virCgroupPidCode(const void *name, uint32_t seed)
{
- unsigned long pid_value = (unsigned long)(intptr_t)name;
+ long pid_value = (long)(intptr_t)name;
return virHashCodeGen(&pid_value, sizeof(pid_value), seed);
}
diff --git a/src/util/viridentity.c b/src/util/viridentity.c
index 9b8ba4a..52a0a30 100644
--- a/src/util/viridentity.c
+++ b/src/util/viridentity.c
@@ -505,7 +505,7 @@ int virIdentitySetUNIXProcessID(virIdentityPtr ident,
{
char *val;
int ret;
- if (virAsprintf(&val, "%llu", (unsigned long long)pid) < 0)
+ if (virAsprintf(&val, "%lld", (long long) pid) < 0)
return -1;
ret = virIdentitySetAttr(ident,
VIR_IDENTITY_ATTR_UNIX_PROCESS_ID,
diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c
index e7e46b8..d8c35f1 100644
--- a/src/util/virpolkit.c
+++ b/src/util/virpolkit.c
@@ -82,6 +82,7 @@ int virPolkitCheckAuth(const char *actionid,
VIR_INFO("Checking PID %lld running as %d",
(long long) pid, uid);
+ /* Yes, PolicyKit really takes pid ad uint. */
if (virDBusCallMethod(sysbus,
&reply,
NULL,
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 8b9f9c5..718c4a2 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -608,8 +608,7 @@ int virProcessGetPids(pid_t pid, size_t *npids, pid_t **pids)
*npids = 0;
*pids = NULL;
- if (virAsprintf(&taskPath, "/proc/%llu/task",
- (unsigned long long)pid) < 0)
+ if (virAsprintf(&taskPath, "/proc/%llu/task", (long long) pid) < 0)
goto cleanup;
if (virDirOpen(&dir, taskPath) < 0)
@@ -657,7 +656,7 @@ int virProcessGetNamespaces(pid_t pid,
int fd;
if (virAsprintf(&nsfile, "/proc/%llu/ns/%s",
- (unsigned long long)pid,
+ (long long) pid,
ns[i]) < 0)
goto cleanup;
@@ -968,8 +967,7 @@ int virProcessGetStartTime(pid_t pid,
int len;
char **tokens = NULL;
- if (virAsprintf(&filename, "/proc/%llu/stat",
- (unsigned long long)pid) < 0)
+ if (virAsprintf(&filename, "/proc/%llu/stat", (long long) pid) < 0)
return -1;
if ((len = virFileReadAll(filename, 1024, &buf)) < 0)
@@ -1051,8 +1049,8 @@ int virProcessGetStartTime(pid_t pid,
{
static int warned;
if (virAtomicIntInc(&warned) == 1) {
- VIR_WARN("Process start time of pid %llu not available on this platform",
- (unsigned long long)pid);
+ VIR_WARN("Process start time of pid %lld not available on this platform",
+ (long long) pid);
}
*timestamp = 0;
return 0;
@@ -1069,7 +1067,7 @@ static int virProcessNamespaceHelper(int errfd,
int fd = -1;
int ret = -1;
- if (virAsprintf(&path, "/proc/%llu/ns/mnt", (unsigned long long)pid) < 0)
+ if (virAsprintf(&path, "/proc/%lld/ns/mnt", (long long) pid) < 0)
goto cleanup;
if ((fd = open(path, O_RDONLY)) < 0) {
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 604dcdd..bc3496a 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -210,8 +210,8 @@ virSystemdGetMachineNameByPID(pid_t pid)
if (virDBusMessageRead(reply, "o", &object) < 0)
goto cleanup;
- VIR_DEBUG("Domain with pid %llu has object path '%s'",
- (unsigned long long)pid, object);
+ VIR_DEBUG("Domain with pid %lld has object path '%s'",
+ (long long) pid, object);
if (virDBusCallMethod(conn, &reply, NULL,
"org.freedesktop.machine1",
@@ -226,8 +226,8 @@ virSystemdGetMachineNameByPID(pid_t pid)
if (virDBusMessageRead(reply, "v", "s", &name) < 0)
goto cleanup;
- VIR_DEBUG("Domain with pid %llu has machine name '%s'",
- (unsigned long long)pid, name);
+ VIR_DEBUG("Domain with pid %lld has machine name '%s'",
+ (long long) pid, name);
cleanup:
VIR_FREE(object);
@@ -348,6 +348,7 @@ int virSystemdCreateMachine(const char *name,
virError error;
memset(&error, 0, sizeof(error));
+ /* Yup, CreateMachine* APIs expect unsigned PID */
if (virDBusCallMethod(conn,
NULL,
&error,
diff --git a/src/util/virutil.c b/src/util/virutil.c
index b57a195..2d46b7e 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -2582,8 +2582,8 @@ virGetListenFDs(void)
}
if ((pid_t)procid != getpid()) {
- VIR_DEBUG("LISTEN_PID %s is not for us %llu",
- pidstr, (unsigned long long)getpid());
+ VIR_DEBUG("LISTEN_PID %s is not for us %lld",
+ pidstr, (long long) getpid());
return 0;
}
--
2.8.4
8 years, 1 month
[libvirt] [PATCH] virsh: vol-resize: be explicit that this is an offline operation.
by Ivan Baldo
No time to read manpages at home heheh (qemu-img check -r all repaired it very well though).
---
tools/virsh-volume.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index f302f95..46c36c2 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -1050,7 +1050,7 @@ static const vshCmdInfo info_vol_resize[] = {
.data = N_("resize a vol")
},
{.name = "desc",
- .data = N_("Resizes a storage volume.")
+ .data = N_("Resizes a storage volume offline (only safe if not in use).")
},
{.name = NULL}
};
--
2.1.4
8 years, 1 month
[libvirt] [PATCH 0/2] Forbid new-line char in name of networks
by Sławek Kapłoński
*** BLURB HERE ***
Sławek Kapłoński (2):
util: Add function to check if string contains some chars
Forbid new-line char in name of networks
src/conf/network_conf.c | 5 +----
src/util/virxml.c | 18 ++++++++++++++++++
src/util/virxml.h | 4 ++++
3 files changed, 23 insertions(+), 4 deletions(-)
--
2.10.0
8 years, 1 month
[libvirt] [PATCH v2 00/17] cleanups and improvements for video device code
by Pavel Hrdina
Pavel Hrdina (17):
qemu_process: move qemuProcessStartValidateGraphics to correct place
qemu_command: remove xenner leftover from video device code
tests: fix some QXL capability combinations that don't make sense
qemu_capabilities: join capabilities for qxl and qxl-vga devices
qemu_capabilities: mark QEMU_CAPS_VGA_QXL capability as deprecated
qemu_capabilities: rename QEMU_CAPS_VIRTIO_GPU_VIRGL
qemu_capabilities: detect properties for virtio-gpu-device
qemu_domain: move video validation out of qemu_command
qemu_process: move video validation out of qemu_command
qemu_process: always check capabilities for video devices
qemu_command: separate code for video device via -vga attribute
qemu_command: pass only video device to qemuBuildVgaVideoCommand
qemu_capabilities: check for existence of virtio-vga
qemu_command: properly detect which model to use for video device
qemu_command: cleanup qemuBuildVideoCommandLine
qemu_command: introduce enum of secondary models for video device
qemu_command: add support to use virtio as secondary video device
docs/formatdomain.html.in | 3 +-
src/qemu/qemu_capabilities.c | 23 +-
src/qemu/qemu_capabilities.h | 15 +-
src/qemu/qemu_command.c | 318 ++++++++-------------
src/qemu/qemu_domain.c | 87 ++++++
src/qemu/qemu_domain.h | 3 +
src/qemu/qemu_domain_address.c | 6 -
src/qemu/qemu_process.c | 54 +++-
.../qemu_2.6.0-gicv2-virt.aarch64.xml | 1 -
.../qemu_2.6.0-gicv3-virt.aarch64.xml | 1 -
tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml | 1 -
tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml | 1 -
.../qemucapabilitiesdata/caps_1.2.2.x86_64.replies | 70 +----
tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml | 4 -
.../qemucapabilitiesdata/caps_1.3.1.x86_64.replies | 76 +----
tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml | 4 -
.../qemucapabilitiesdata/caps_1.4.2.x86_64.replies | 74 +----
tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml | 4 -
.../qemucapabilitiesdata/caps_1.5.3.x86_64.replies | 74 +----
tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml | 4 -
.../qemucapabilitiesdata/caps_1.6.0.x86_64.replies | 74 +----
tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml | 4 -
.../qemucapabilitiesdata/caps_1.7.0.x86_64.replies | 74 +----
tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml | 4 -
.../qemucapabilitiesdata/caps_2.1.1.x86_64.replies | 74 +----
tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml | 4 -
.../qemucapabilitiesdata/caps_2.4.0.x86_64.replies | 107 ++-----
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 6 +-
.../qemucapabilitiesdata/caps_2.5.0.x86_64.replies | 117 +++-----
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 6 +-
.../caps_2.6.0-gicv2.aarch64.replies | 43 ++-
.../caps_2.6.0-gicv2.aarch64.xml | 1 -
.../caps_2.6.0-gicv3.aarch64.replies | 43 ++-
.../caps_2.6.0-gicv3.aarch64.xml | 1 -
.../caps_2.6.0.ppc64le.replies | 43 ++-
tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 2 +-
.../qemucapabilitiesdata/caps_2.6.0.x86_64.replies | 117 +++-----
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 6 +-
.../qemucapabilitiesdata/caps_2.7.0.x86_64.replies | 122 +++-----
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 6 +-
tests/qemuhelptest.c | 4 -
.../qemuxml2argv-pcie-root-port.args | 5 +-
.../qemuxml2argv-pcie-switch-downstream-port.args | 5 +-
.../qemuxml2argv-pcie-switch-upstream-port.args | 5 +-
.../qemuxml2argv-pcihole64-q35.args | 5 +-
.../qemuxml2argv-q35-usb2-multi.args | 5 +-
.../qemuxml2argv-q35-usb2-reorder.args | 5 +-
tests/qemuxml2argvdata/qemuxml2argv-q35-usb2.args | 5 +-
tests/qemuxml2argvdata/qemuxml2argv-q35.args | 5 +-
.../qemuxml2argv-video-virtio-gpu-device.args | 2 +-
.../qemuxml2argv-video-virtio-gpu-sec.args | 22 ++
.../qemuxml2argv-video-virtio-gpu-sec.xml | 27 ++
.../qemuxml2argv-video-virtio-gpu-spice-gl.args | 2 +-
.../qemuxml2argv-video-virtio-gpu-virgl.args | 2 +-
.../qemuxml2argv-video-virtio-vga.args | 24 ++
...evice.xml => qemuxml2argv-video-virtio-vga.xml} | 11 +-
tests/qemuxml2argvtest.c | 152 +++++-----
.../qemuxml2xmlout-video-virtio-gpu-sec.xml | 35 +++
tests/qemuxml2xmltest.c | 19 +-
59 files changed, 802 insertions(+), 1215 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-sec.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-sec.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-vga.args
rename tests/qemuxml2argvdata/{qemuxml2argv-video-qxl-sec-nodevice.xml => qemuxml2argv-video-virtio-vga.xml} (77%)
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-sec.xml
--
2.10.1
8 years, 1 month