提交 170d1e31 编写于 作者: M Michal Privoznik

virDevMapperGetTargetsImpl: Be tolerant to kernels without DM support

https://bugzilla.redhat.com/show_bug.cgi?id=1591732

If kernel is compiled without CONFIG_BLK_DEV_DM enabled, there is
no /dev/mapper/control device and since dm_task_create() actually
does some ioctl() over it creating a task may fail.
To cope with this handle ENOENT and ENODEV gracefully.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 318d54e5
......@@ -87,8 +87,14 @@ virDevMapperGetTargetsImpl(const char *path,
return ret;
}
if (!(dmt = dm_task_create(DM_DEVICE_DEPS)))
if (!(dmt = dm_task_create(DM_DEVICE_DEPS))) {
if (errno == ENOENT || errno == ENODEV) {
/* It's okay. Kernel is probably built without
* devmapper support. */
ret = 0;
}
return ret;
}
if (!dm_task_set_name(dmt, path)) {
if (errno == ENOENT) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册