[libvirt] [PATCH] docs: add a mention for start a vm with rawio = 'yes'
by Luyao Huang
When we start a vm which have rawio = 'yes' settings without
any file caps settings for qemu, qemu process still cannot use
this caps (CAP_SYS_RAWIO) and the /proc/pidofqemu/status like
this:
CapInh: 0000000000020000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 0000001fffffffff
this is because we do not set file caps for qemu (see man 7
capabilities), although laine have mentioned this in commit
e11451, i think it will be good if we add this in docs.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
docs/formatdomain.html.in | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index fb0a0d1..2bcb59d 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1886,7 +1886,10 @@
than that (per-process basis, affects all the domain disks).
To confine the capability as much as possible for QEMU driver
as this stage, <code>sgio</code> is recommended, it's more
- secure than <code>rawio</code>.
+ secure than <code>rawio</code>. If you really want use rawio
+ = 'yes', please also add file caps for qemu (like this
+ 'setcap "cap_sys_rawio+ie" /usr/libexec/qemu-kvm', for more details
+ please see capabilities(7)).
</dd>
<dt><code>sgio</code> attribute
<span class="since">since 1.0.2</span></dt>
--
1.8.3.1
9 years, 8 months
[libvirt] [PATCH] qemuProcessReconnect: Fill in pid file path
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1197600
So, libvirt uses pid file to track pid of started qemus. Whenever
a domain is started, its pid is put into corresponding pid file.
The pid file path is generated based on domain name and stored
into domain object internals. However, it's not stored in the
status XML and therefore lost on daemon restarts. Hence, later,
when domain is being shut down, the daemon does not know which
pid file to unlink, and the correct pid file is left behind. To
avoid this, lets generate the pid file path again in
qemuProcessReconnect().
Reported-by: Luyao Huang <lhuang(a)redhat.com>
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_process.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7ce6115..e77616a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3762,6 +3762,13 @@ qemuProcessReconnect(void *opaque)
cfg = virQEMUDriverGetConfig(driver);
priv = obj->privateData;
+ /* XXX If we ever gonna change pid file pattern, come up with
+ * some intelligence here to deal with old paths. */
+ if (!(priv->pidfile = virPidFileBuildPath(cfg->stateDir, obj->def->name))) {
+ virReportSystemError(errno, "%s", _("Failed to build pidfile path."));
+ goto killvm;
+ }
+
if (qemuDomainObjBeginJob(driver, obj, QEMU_JOB_MODIFY) < 0)
goto killvm;
--
2.0.5
9 years, 8 months
[libvirt] [PATCH v3 0/9] qemu: Add quorum support to libvirt
by Matthias Gatto
The purpose of these patches is to introduce quorum for libvirt
I've try to follow this proposal:
http://www.redhat.com/archives/libvir-list/2014-May/msg00533.html
This feature ask for 6 task:
1) Allow a _virStorageSource to contain more than one backing store.
Because all the actual libvirt code use the backingStore field
as a pointer and we needs want to change that, I've decide to encapsulate
the backingStore field to simplifie the array manipulation.
2) Add the missing field a quorum need in _virStorageSource and
the VIR_STORAGE_TYPE_QUORUM and VIR_STORAGE_FILE_QUORUM in
their respectives enums.
3) Parse and format the xml
Because a quorum allows to have more than one backing store at the same level
we need to change virDomainDiskDefFormat and virDomainDiskDefParseXML
to call virDomainDiskBackingStoreFormat and virDomainDiskBackingStoreParse
in a loop.
virDomainDiskBackingStoreFormat and virDomainDiskBackingStoreParse can
call themself recursively in a loop because a quorum can contain another
quorum
4) Add nodename
We need to add nodename support in _virStorageSource because qemu
use them for their child.
5) Build qemu string
As for the xml, we have to call the function which create quorum recursively.
But this task have the problem explained here:
http://www.redhat.com/archives/libvir-list/2014-October/msg00529.html
The _virStorageSource missing some informations that can be passed to
a child, and therefore this version of quorum is incomplet.
6) Allow to hotplug/change a disk in a quorum
This part is not present in these patches because for this task
we have to use blockdev-add, and currently libvirt use
device_add for hotpluging that doesn't allow to hotplug quorum childs.
There is 3 way to handle this problem:
1) create a virDomainBlockDevAdd function in libvirt witch call
blockdev-add.
2) use blockdev-add instead of device_add in qemuMonitorJSONAddDevice
3) write a hack which uses blockdev-add when only attaching quorum
(but i'm pretty sure this solution is not the good one)
V2:
-Rebase on master
-Add Documentation
V3:
-Transforme the backingStore field in virStorageSource into
an array of pointer instead of a pointer
-Modify virStorageSourceSetBackingStore to allow it to expand
the backingStore size.
Matthias Gatto (9):
virstoragefile: Add virStorageSourceGetBackingStore
virstoragefile: Always use virStorageSourceGetBackingStore to get
backing store
virstoragefile: Add virStorageSourceSetBackingStore
virstoragefile: Always use virStorageSourceSetBackingStore to set
backing store
virstoragefile: change backingStore to backingStores.
virstoragefile: Add quorum in virstoragefile
domain_conf: Read and Write quorum config
qemu: Add quorum support in qemuBuildDriveDevStr
virstoragefile: Add node-name
docs/formatdomain.html.in | 27 ++++-
docs/schemas/domaincommon.rng | 96 +++++++++++------
docs/schemas/storagecommon.rng | 1 +
docs/schemas/storagevol.rng | 1 +
src/conf/domain_conf.c | 195 ++++++++++++++++++++++++++--------
src/conf/storage_conf.c | 23 ++--
src/libvirt_private.syms | 2 +
src/qemu/qemu_cgroup.c | 4 +-
src/qemu/qemu_command.c | 114 ++++++++++++++++++++
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 30 +++---
src/qemu/qemu_migration.c | 1 +
src/security/security_dac.c | 2 +-
src/security/security_selinux.c | 4 +-
src/security/virt-aa-helper.c | 2 +-
src/storage/storage_backend.c | 33 +++---
src/storage/storage_backend_fs.c | 36 ++++---
src/storage/storage_backend_gluster.c | 10 +-
src/storage/storage_backend_logical.c | 15 ++-
src/storage/storage_driver.c | 2 +-
src/util/virstoragefile.c | 116 +++++++++++++++++---
src/util/virstoragefile.h | 12 ++-
tests/virstoragetest.c | 18 ++--
23 files changed, 573 insertions(+), 173 deletions(-)
--
1.8.3.1
9 years, 8 months
[libvirt] [PATCH] schema: Fix interface link state schema
by Peter Krempa
In commit edd1295e1da6bfe8e4e257e5fbfad71ac0bf7c87 I've introduced an
XML element that allows to configure state of the network interface
link. Somehow the RNG schema hunk ended up in a weird place in the
network schema definition. Move it to the right place and add a test
case.
Note that the link state is set up via the monitor at VM startup so I
originally didn't think of adding a test case.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1173468
---
docs/schemas/domaincommon.rng | 12 ++++++++++++
docs/schemas/network.rng | 11 -----------
tests/qemuxml2argvdata/qemuxml2argv-interface-driver.xml | 1 +
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4e4fe9f..6c45b1c 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2314,10 +2314,22 @@
- the name of the script used to set up the binding
- the target device used
- boot order
+ - link state
-->
<define name="interface-options">
<interleave>
<optional>
+ <element name="link">
+ <attribute name="state">
+ <choice>
+ <value>up</value>
+ <value>down</value>
+ </choice>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
+ <optional>
<element name="target">
<attribute name="dev">
<ref name="deviceName"/>
diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index 56b6086..4edb6eb 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -299,17 +299,6 @@
<optional>
<ref name="vlan"/>
</optional>
- <optional>
- <element name="link">
- <attribute name="state">
- <choice>
- <value>up</value>
- <value>down</value>
- </choice>
- </attribute>
- <empty/>
- </element>
- </optional>
<!-- <ip> element -->
<zeroOrMore>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-interface-driver.xml b/tests/qemuxml2argvdata/qemuxml2argv-interface-driver.xml
index ec5ab61..d907b9b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-interface-driver.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-interface-driver.xml
@@ -39,6 +39,7 @@
<mac address='52:54:00:e5:48:58'/>
<model type='virtio'/>
<driver ioeventfd='on' event_idx='on' queues='5'/>
+ <link state='up'/>
</interface>
<serial type='pty'>
<target port='0'/>
--
2.2.2
9 years, 8 months
[libvirt] [PATCH 0/2] Update find-storage-pool-source[-as] man page
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=921426
The first patch is just a change to the error message. As it turns out only
the host is necessary to find iSCSI targets. I have to assume over time
adjustments to the code made the need to provide the name obsolete, but
I did not research exactly which change may have done that...
The second patch is a virsh man page change to describe the functionality
based on how the code works today. It's perhaps "of interest" that the rbd
and sheepdog backends provide to means to find all possible sources. I also
suppose zfs could use something, but I don't build with zfs.
John Ferlan (2):
iscsi: Adjust error message for findStorageSources backend
virsh.pod: Update find-storage-pool-sources[-as] man page
src/storage/storage_backend_iscsi.c | 5 ++---
tools/virsh.pod | 45 ++++++++++++++++++++++++++++++++-----
2 files changed, 41 insertions(+), 9 deletions(-)
--
2.1.0
9 years, 8 months
[libvirt] [PATCH 0/2] Disallow the usage of the same target dev value
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1142631
Patch 1 was found when adjusting the bz to get the disk by the pool source
instead of directly by file attribute. When using domblklist, the source
wasn't displayed. Followed the model of the iscsi '@name' and added '@volume'
(eg, <source pool='default' volume='test-1g.img'/>)
Patch 2 started as a simple (hah!) double loop looking for duplicate dst
strings. I chose a separate API called before qemuCheckDiskConfig since
it's more of a "common" check that could be used by other drivers as opposed
to the perhaps more specific single disk checks made. Besides I didn't want
a ndisk factorial checking algorithm each time a disk was checked for something
that could be checked once.
With the code in place, running make check tripped over a number of existing
tests that duplicated that '<target dev=...' value, so I fixed those. Of
interest for a few was that the test would duplicate the supposedly unique
alias id - those are cleaned up as well as a byproduct of the changes.
John Ferlan (2):
virsh: Adjust domblklist to understand disk volume syntax
disk: Disallow duplicated target 'dev' values
src/conf/domain_conf.c | 29 ++++++++++++++++++++++
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 3 +++
.../qemuxml2argv-disk-scsi-disk-split.xml | 2 +-
...qemuxml2argv-disk-scsi-lun-passthrough-sgio.xml | 2 +-
.../qemuxml2argv-disk-scsi-lun-passthrough.xml | 2 +-
.../qemuxml2argv-disk-source-pool-mode.xml | 2 +-
.../qemuxml2argv-disk-source-pool.xml | 2 +-
.../qemuxml2argv-pci-bridge-many-disks.args | 4 +--
.../qemuxml2argv-pci-bridge-many-disks.xml | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-pci-many.args | 8 +++---
tests/qemuxml2argvdata/qemuxml2argv-pci-many.xml | 4 +--
.../qemuxml2xmlout-disk-source-pool.xml | 2 +-
.../qemuxml2xmlout-pci-bridge-many-disks.xml | 2 +-
tools/virsh-domain-monitor.c | 3 ++-
16 files changed, 52 insertions(+), 17 deletions(-)
--
2.1.0
9 years, 8 months
[libvirt] [PATCH] qemu: Don't crash in qemuDomainOpenChannel()
by Martin Kletzander
The problem here was that when opening a channel, we were checking
whether the channel given is alias (can't be NULL for running domain) or
it's name, which can be NULL (for example with spicevmc). In case of
such domain qemuDomainOpenChannel() made the daemon crash.
STREQ_NULLABLE() is safe to use since the code in question is wrapped in
"if (name)" and is more readable, so use that instead of checking for
non-NULL "vm->def->channels[i]->target.name".
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 83a4e18..c87cc05 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15450,7 +15450,7 @@ qemuDomainOpenChannel(virDomainPtr dom,
if (vm->def->channels[i]->targetType == \
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO &&
- STREQ(name, vm->def->channels[i]->target.name))
+ STREQ_NULLABLE(name, vm->def->channels[i]->target.name))
chr = vm->def->channels[i];
}
} else {
--
2.3.1
9 years, 8 months
[libvirt] [PATCH] conf: De-duplicate scheduling policy enums
by Martin Kletzander
Since adding the support for scheduler policy settings in commit
8680ea97, there are two enums with the same information. That was
caused by rewriting the patch since first draft.
Find out thanks to clang, but there was no impact whatsoever.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/conf/domain_conf.c | 20 +++++++-------------
src/conf/domain_conf.h | 14 ++------------
src/libvirt_private.syms | 2 --
src/qemu/qemu_process.c | 2 +-
4 files changed, 10 insertions(+), 28 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9b7ae3f..95175ea 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -772,13 +772,6 @@ VIR_ENUM_IMPL(virDomainLoader,
"rom",
"pflash")
-VIR_ENUM_IMPL(virDomainThreadSched, VIR_DOMAIN_THREAD_SCHED_LAST,
- "other", /* default */
- "batch",
- "idle",
- "fifo",
- "rr")
-
/* Internal mapping: subset of block job types that can be present in
* <mirror> XML (remaining types are not two-phase). */
VIR_ENUM_DECL(virDomainBlockJob)
@@ -12867,7 +12860,7 @@ virDomainThreadSchedParse(xmlNodePtr node,
virDomainThreadSchedParamPtr sp)
{
char *tmp = NULL;
- int sched = 0;
+ int pol = 0;
tmp = virXMLPropString(node, name);
if (!tmp) {
@@ -12892,16 +12885,17 @@ virDomainThreadSchedParse(xmlNodePtr node,
tmp = virXMLPropString(node, "scheduler");
if (tmp) {
- if ((sched = virDomainThreadSchedTypeFromString(tmp)) <= 0) {
+ if ((pol = virProcessSchedPolicyTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid scheduler attribute: '%s'"),
tmp);
goto error;
}
- sp->scheduler = sched;
+ sp->policy = pol;
VIR_FREE(tmp);
- if (sp->scheduler >= VIR_DOMAIN_THREAD_SCHED_FIFO) {
+ if (sp->policy == VIR_PROC_POLICY_FIFO ||
+ sp->policy == VIR_PROC_POLICY_RR) {
tmp = virXMLPropString(node, "priority");
if (!tmp) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -19888,7 +19882,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
if (!(ids = virBitmapFormat(sp->ids)))
goto error;
virBufferAsprintf(buf, "<vcpusched vcpus='%s' scheduler='%s'",
- ids, virDomainThreadSchedTypeToString(sp->scheduler));
+ ids, virProcessSchedPolicyTypeToString(sp->policy));
VIR_FREE(ids);
if (sp->priority)
@@ -19903,7 +19897,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
if (!(ids = virBitmapFormat(sp->ids)))
goto error;
virBufferAsprintf(buf, "<iothreadsched iothreads='%s' scheduler='%s'",
- ids, virDomainThreadSchedTypeToString(sp->scheduler));
+ ids, virProcessSchedPolicyTypeToString(sp->policy));
VIR_FREE(ids);
if (sp->priority)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 02ddd93..aafeadd 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -50,6 +50,7 @@
# include "virbitmap.h"
# include "virstoragefile.h"
# include "virseclabel.h"
+# include "virprocess.h"
/* forward declarations of all device types, required by
* virDomainDeviceDef
@@ -1813,21 +1814,11 @@ typedef enum {
VIR_DOMAIN_CPU_PLACEMENT_MODE_LAST
} virDomainCpuPlacementMode;
-typedef enum {
- VIR_DOMAIN_THREAD_SCHED_OTHER = 0,
- VIR_DOMAIN_THREAD_SCHED_BATCH,
- VIR_DOMAIN_THREAD_SCHED_IDLE,
- VIR_DOMAIN_THREAD_SCHED_FIFO,
- VIR_DOMAIN_THREAD_SCHED_RR,
-
- VIR_DOMAIN_THREAD_SCHED_LAST
-} virDomainThreadSched;
-
typedef struct _virDomainThreadSchedParam virDomainThreadSchedParam;
typedef virDomainThreadSchedParam *virDomainThreadSchedParamPtr;
struct _virDomainThreadSchedParam {
virBitmapPtr ids;
- virDomainThreadSched scheduler;
+ virProcessSchedPolicy policy;
int priority;
};
@@ -2881,7 +2872,6 @@ VIR_ENUM_DECL(virDomainRNGModel)
VIR_ENUM_DECL(virDomainRNGBackend)
VIR_ENUM_DECL(virDomainTPMModel)
VIR_ENUM_DECL(virDomainTPMBackend)
-VIR_ENUM_DECL(virDomainThreadSched)
/* from libvirt.h */
VIR_ENUM_DECL(virDomainState)
VIR_ENUM_DECL(virDomainNostateReason)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index ba05cc6..ead1b45 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -415,8 +415,6 @@ virDomainStateTypeFromString;
virDomainStateTypeToString;
virDomainTaintTypeFromString;
virDomainTaintTypeToString;
-virDomainThreadSchedTypeFromString;
-virDomainThreadSchedTypeToString;
virDomainTimerModeTypeFromString;
virDomainTimerModeTypeToString;
virDomainTimerNameTypeFromString;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index bd63fd7..faf9907 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2614,7 +2614,7 @@ qemuProcessSetSchedParams(int id,
if (!s)
return 0;
- return virProcessSetScheduler(pid, s->scheduler, s->priority);
+ return virProcessSetScheduler(pid, s->policy, s->priority);
}
static int
--
2.3.1
9 years, 8 months
[libvirt] [PATCH 0/2] fix corner case of spice graphics channel mode settings
by Pavel Hrdina
Pavel Hrdina (2):
qemu: remove duplicated code for allocating spice ports
qemu: check defaultMode for spice graphics independently
src/qemu/qemu_driver.c | 45 ++----------------------------
src/qemu/qemu_process.c | 73 ++++++++++++++++++++++++++++---------------------
src/qemu/qemu_process.h | 5 ++++
3 files changed, 49 insertions(+), 74 deletions(-)
--
2.0.5
9 years, 8 months