[libvirt] [PATCH v4 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.
V4:
-Rebase on master
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 | 95 +++++++++++------
docs/schemas/storagecommon.rng | 1 +
docs/schemas/storagevol.rng | 1 +
src/conf/domain_conf.c | 195 ++++++++++++++++++++++++++--------
src/conf/storage_conf.c | 22 ++--
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 | 35 +++---
src/storage/storage_backend_fs.c | 37 ++++---
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 | 13 ++-
tests/virstoragetest.c | 18 ++--
23 files changed, 573 insertions(+), 175 deletions(-)
--
1.8.3.1
9 years, 7 months
[libvirt] [PATCH] parallels: use SDK disks system names for paths
by Nikolay Shirokovskiy
For block devices SDK friendly name do not
refer to block device path but rather some
description while system name refer to
device path.
For ploop devices both names refer to
image path.
Thus system name is better choice.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)parallels.com>
---
src/parallels/parallels_sdk.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index 80e9d00..4911ab7 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -491,7 +491,7 @@ prlsdkGetDiskInfo(PRL_HANDLE prldisk,
if (VIR_ALLOC_N(buf, buflen) < 0)
goto cleanup;
- pret = PrlVmDev_GetFriendlyName(prldisk, buf, &buflen);
+ pret = PrlVmDev_GetSysName(prldisk, buf, &buflen);
prlsdkCheckRetGoto(pret, cleanup);
if (virDomainDiskSetSource(disk, buf) < 0)
--
1.7.1
9 years, 7 months
[libvirt] [PATCH] rng: Forbid to validate mismatched <disk> 'device' and 'type' attributes
by Erik Skultety
According to docs, using 'lun' as a value for device attribute is only valid
with disk types 'block' and 'network'. However current RNG schema also allows
a combination type='file' device='lun' which results in a successfull
xml validation, but fails at qemuBuildCommandLine.
Besides fixing the RNG schema, this patch also adds a qemuxml2argvtest
for this case.
https://bugzilla.redhat.com/show_bug.cgi?id=1210669
---
docs/schemas/domaincommon.rng | 42 ++++++++++++++--------
.../qemuxml2argv-disk-device-lun-type-invalid.xml | 28 +++++++++++++++
tests/qemuxml2argvtest.c | 2 ++
3 files changed, 58 insertions(+), 14 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-device-lun-type-invalid.xml
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 03fd541..ee32b73 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1316,37 +1316,43 @@
</choice>
</attribute>
</optional>
+ <interleave>
+ <ref name="diskSource"/>
+ <ref name="diskSpecsExtra"/>
+ </interleave>
</group>
<group>
<attribute name="device">
- <choice>
- <value>lun</value>
- </choice>
+ <value>lun</value>
</attribute>
<optional>
<ref name="rawIO"/>
</optional>
<optional>
- <attribute name="sgio">
- <choice>
- <value>filtered</value>
- <value>unfiltered</value>
- </choice>
- </attribute>
+ <ref name="sgIO"/>
</optional>
+ <interleave>
+ <choice>
+ <ref name="diskSourceNetwork"/>
+ <ref name="diskSourceBlock"/>
+ </choice>
+ <ref name="diskSpecsExtra"/>
+ </interleave>
</group>
</choice>
<optional>
<ref name="snapshot"/>
</optional>
- <interleave>
- <ref name="diskSource"/>
- <ref name="storageSourceExtra"/>
- <ref name="diskBackingChain"/>
- </interleave>
</element>
</define>
+ <define name="diskSpecsExtra">
+ <interleave>
+ <ref name="storageSourceExtra"/>
+ <ref name="diskBackingChain"/>
+ </interleave>
+ </define>
+
<define name="diskBackingChain">
<choice>
<ref name="diskBackingStore"/>
@@ -5315,4 +5321,12 @@
<ref name="virYesNo"/>
</attribute>
</define>
+ <define name="sgIO">
+ <attribute name="sgio">
+ <choice>
+ <value>filtered</value>
+ <value>unfiltered</value>
+ </choice>
+ </attribute>
+ </define>
</grammar>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-device-lun-type-invalid.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-device-lun-type-invalid.xml
new file mode 100644
index 0000000..ed3c89e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-device-lun-type-invalid.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='file' device='lun' rawio='yes'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/dev/HostVG/QEMUGuest1'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 8d0a4aa..63bf6ff 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -817,6 +817,8 @@ mymain(void)
QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
DO_TEST("disk-drive-no-boot",
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_BOOTINDEX);
+ DO_TEST_FAILURE("disk-device-lun-type-invalid",
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_SCSI);
DO_TEST("disk-usb", NONE);
DO_TEST("disk-usb-device",
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_USB_STORAGE,
--
1.9.3
9 years, 7 months
[libvirt] [PATCH 0/2] Misc fixes
by Cédric Bosdonnat
Hi all,
Here are 2 small fixes: the first one just gets the apparmor right for SLES
(and openSUSE). The second patch fixes a problem with lxc-enter-namespace on
pretty recent kernels. They surely have nothing to do with each other ;)
Cédric Bosdonnat (2):
Apparmor qemu abstraction fixes for SLES
Open /proc/PID/ns/* read-only to avoid getting permission denied
examples/apparmor/libvirt-qemu | 9 +++++++++
src/util/virprocess.c | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
--
2.1.4
9 years, 7 months
[libvirt] [PATCH] qemu: lifecycle: guest get rebooted after reboot and shutdown
by zhang bo
Steps:
1 virsh reboot guest1 --mode=acpi
2 virsh shutdown guest1 --mode=agent
Expected result:
As the SHUTDOWN job is after REBOOT, we expected the guest to be *shutoff*.
Exacted result:
After the 2 steps above, the guest got *rebooted*.
The reason to this problem:
1 in qemuDomainReboot(mode acpi), it sets priv->fakeReboot to 1.
2 after shutdown/reboot, qemu monitor IO trigged qemuProcessHandleShutdown(), which finds that priv->fakeReboot is 1, and reboot the guest.
Root Cause of the problem:
After further look into the problem, We found that the design of acpi/agent shutdown/reboot seems a little chaotic.
-----------------------------------
sheet1 who sets fakeReboot
-----------------------------------
shutdown reboot
acpi Y(0) Y(1)
agent N N
It's apparently, *acpi-mode* jobs set fakeReboot.
-----------------------------------
sheet2 who needs to check fakeReboot(qemuProcessHandleShutdown())
-----------------------------------
shutdown reboot
acpi Y Y
agent *Y* *N*
Things become a little odd here. only agent-mode reboot doesn't check fakeReboot.
We can tell from the above 2 sheets, that they're not consistent.
*Agent-mode shutdown checks fakeReboot(trigger by SHUTDOWN monitorIO event), while it didn't set it before.*
The chaos is not caused by libvirtd, it's a systematic problem, including guest os and qemu. (guest os writes ACPI, triggers qemu, qemu then triggers libvirtd)
Solution:
A simple solution is to make the 1st sheet consistent to the 2nd sheet, which is:
-----------------------------------
sheet3 who should set fakeReboot:
-----------------------------------
shutdown reboot
acpi Y(0) Y(1)
agent *Y(0)* N
-----------------------------------
we let agent-mode shutdown set fakeReboot to 0.
Signed-off-by: Zhang Bo <oscar.zhangbo(a)huawei.com>
Signed-off-by: Wang Yufei <james.wangyufei(a)huawei.com>
---
src/qemu/qemu_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7eb5a7d..c751dcf 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1959,6 +1959,8 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
goto endjob;
}
+ qemuDomainSetFakeReboot(driver, vm, isReboot);
+
if (useAgent) {
qemuDomainObjEnterAgent(vm);
ret = qemuAgentShutdown(priv->agent, agentFlag);
@@ -1970,7 +1972,6 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
*/
if (!useAgent ||
(ret < 0 && (acpiRequested || !flags))) {
- qemuDomainSetFakeReboot(driver, vm, isReboot);
/* Even if agent failed, we have to check if guest went away
* by itself while our locks were down. */
--
1.7.12.4
9 years, 7 months
[libvirt] Selective block device migration implementation
by Pavel Boldin
Dear Libvirt Developers,
I'm working to implement feature request [1]. The feature request proposes
to enhance `libvirt' code so the API caller can specify which block devices
are to be migrated using e.g. parameters in the `virDomainMigrateToURI3'
call.
There is the following issues:
1. It is obvious to identify devices to be migrated using the
`device_name'. However, these need to be serialized in either 1) a
comma-separated string or in 2) a set of values named like `blockdevice%d'
with `blockdevice' value holding amount of block devices to migrate. What
is the desired approach here? Can block device name contain commas or
should I neglect this possibility?
2. `libvirt' behavior in block devices migration was copied from the
`QEMU' implementation that ignores read-only devices as well. So, `libvirt'
code will need to pass this list to `QEMU' `migrate' QMP command and this
argument should be implemented in the `QEMU'.
Is there any implementation advices from your side?
Pavel
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1203032
9 years, 7 months
[libvirt] converting gatewaydev= from domU.cfg to libvirt.xml fails
by Olaf Hering
How should this be converted?
/etc/init.d/boot.local
tap=xentap
tunctl -pt ${tap}
ip addr add 1.1.1.1/29 dev ${tap}
ip link set up dev ${tap}
domU.cfg
vif=[
'mac=00:16:3e:13:01:00,ip=1.1.1.2,type=vif,gatewaydev=xentap,script=vif-route'
]
The result from "convert-xml xen-xl domU,cfg" is:
<interface type='ethernet'>
<mac address='00:16:3e:13:01:00'/>
<ip address='1.1.1.2' family='ipv4'/>
<script path='vif-route'/>
</interface>
gatewaydev= is missing, the guest will not start.
Olaf
9 years, 7 months
[libvirt] [libvirt-php] memory overflow when using libvirt_list_networks
by Kash Pande
Finding lots of bad behaviour here:
[Fri Apr 17 23:44:04.590626 2015] [:error] [pid 31714] [client
127.0.0.1:38103] PHP Warning: libvirt_list_networks(): this function is
not supported by the connection driver: virConnectNumOfNetworks
[Fri Apr 17 23:44:04.590655 2015] [:error] [pid 31714] [client
127.0.0.1:38103] PHP Fatal error: Out of memory (allocated 524288)
(tried to allocate 18446744073709551608 bytes)
There's no way to check if this exists... I noticed the following about
versions:
- this system works fine (Git):
libvirt 1.2.9
Array
(
[libvirt.release] => 9
[libvirt.minor] => 2
[libvirt.major] => 1
[connector.version] => 0.5.0
[connector.major] => 0
[connector.minor] => 5
[connector.release] => 0
)
- this system has problems (Git)
libvirt 1.2.12
Array
(
[libvirt.release] => 12
[libvirt.minor] => 2
[libvirt.major] => 1
[connector.version] => 0.5.0
[connector.major] => 0
[connector.minor] => 5
[connector.release] => 0
[type.release] => 12
[type.minor] => 2
[type.major] => 1
)
When I do a version check to only do network list for version under .12,
I get this:
[Fri Apr 17 23:44:43.608308 2015] [:error] [pid 31689] [client
127.0.0.1:38216] PHP Warning: libvirt_network_get(): this function is
not supported by the connection driver: virNetworkLookupByName
Which causes a cascade of other errors if you're not checking for
problems each step along the way.
Kash Pande
Jentu Technologies, Inc
http://jentu-networks.com
9 years, 7 months
[libvirt] [PATCH v3 0/4] storage: handle scsi/iscsi error paths better
by John Ferlan
Rework of unpushed patches from series:
http://www.redhat.com/archives/libvir-list/2015-April/msg00050.html
Details:
Patch 1 - Split out the non /dev/* checks into their own to start
satisfying Jan's comment in his review of the former patch 3:
http://www.redhat.com/archives/libvir-list/2015-April/msg00100.html
Patch 2 - New - Flip the logic from assume success, change status to failure,
and return to assume failure and only have success when everything
completes successfully
Patch 3 - Adjustments for previous patch 3 to make use of patch 1's split
of the checking for using the /dev path. If we find that the
/dev/* is not in use for the pool, then force an error earlier.
This makes the check later on not need to compare the returned
path to the generated 'devpath' to compensate for the logic in
virStorageBackendStablePath which will strdup the incoming target
path if something goes wrong in looking up the directory. Since
both paths will use the new virStorageBackendPoolUseDevPath
slightly differently, if devpath is the same as vol->target.path,
then we know it's not because the pool target path was to blame.
Patch 4 - Is the former patch 5, but now since patch 3 returns a failure
in virStorageBackendSCSINewLun for that bad path, we can use it
to be the error arbiter and bug fixer.
Former patch 6 - no longer necessary, although it would circumvent any of
the above patches being necessary to solve the bug...
John Ferlan (4):
storage: Split out the valid path check
refactor virStorageBackendSCSINewLun
scsi: Adjust return value for virStorageBackendSCSINewLun
scsi: Adjust return values from processLU
src/storage/storage_backend.c | 42 +++++++++----
src/storage/storage_backend.h | 1 +
src/storage/storage_backend_scsi.c | 124 +++++++++++++++++++++----------------
3 files changed, 100 insertions(+), 67 deletions(-)
--
2.1.0
9 years, 7 months
[libvirt] [PATCH] libxl: include a XLU_Config in _libxlDriverConfig
by Olaf Hering
Upcoming changes for vscsi will use libxlutil.so to prepare the
configuration for libxl. The helpers needs a xlu struct for logging.
Provide one and reuse the existing output as log target.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
Cc: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_conf.c | 6 ++++++
src/libxl/libxl_conf.h | 2 ++
2 files changed, 8 insertions(+)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 8b76fc7..43712b3 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1421,6 +1421,12 @@ libxlDriverConfigNew(void)
goto error;
}
+ cfg->xlu = xlu_cfg_init(cfg->logger_file, "libvirt");
+ if (!cfg->xlu) {
+ VIR_ERROR(_("cannot create xlu for libxenlight, disabling driver"));
+ goto error;
+ }
+
if (libxl_ctx_alloc(&cfg->ctx, LIBXL_VERSION, 0, cfg->logger)) {
VIR_ERROR(_("cannot initialize libxenlight context, probably not "
"running in a Xen Dom0, disabling driver"));
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 59389d1..fd2459f 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -27,6 +27,7 @@
# define LIBXL_CONF_H
# include <libxl.h>
+# include <libxlutil.h>
# include "internal.h"
# include "libvirt_internal.h"
@@ -90,6 +91,7 @@ struct _libxlDriverConfig {
/* log stream for driver-wide libxl ctx */
FILE *logger_file;
xentoollog_logger *logger;
+ XLU_Config *xlu;
/* libxl ctx for driver wide ops; getVersion, getNodeInfo, ... */
libxl_ctx *ctx;
9 years, 7 months