在libvirt中使用逻辑卷进行基于映像的配置是否存在已知问题?我在尝试做同样的事情时遇到了这个错误
Unable to save
Failed to create a compute kvm2 (Libvirt) instance test3.xxx.local: Call
to virNetworkCreateXML failed:
internal error: Child process (/usr/sbin/lvcreate --name
test3.xxx.local-disk1 -L 1K --type snapshot --virtualsize 10485760K -s
/vm-images-pool/images-vol/template_minimal) unexpected exit status 3: 2017-
01-05 00:42:08.133+0000: 12330: debug : virFileClose:102 : Closed fd 29
2017-01-05 00:42:08.133+0000: 12330: debug : virFileClose:102 : Closed fd 31
2017-01-05 00:42:08.133+0000: 12330: debug : virFileClose:102 : Closed fd 27
Volume group name expected (no slash) Run `lvcreate --help' for more
information
Red Hat的这个链接将其标记为已知问题:
https://access.redhat.com/solutions/1995053
该文件的日期为2015年10月20日。不确定在此之后是否有任何改变以支持LV。
我尝试通过创建基于dir的池来满足该doc中的要求:
设定:
template_minimal是图像模板。
[root@kvm2 libvirt]# virsh vol-list vm-images-pool-dir
Name Path
----------------------------------------------------------------------------
template_minimal /vm-images-pool/images-vol/template_minimal
vm-images-pool存储池的类型为VG,其中包含一个卷:
images-vol vm-images-pool -wi-ao---- 249.00g
images-vol安装在/ vm-images-pool / images-vol /
下感谢任何见解。
谢谢, TG
=======================================
更多细节。
丹尼尔,谢谢。我有点困惑。自从我清理它们以来,我无法提前发出实际命令。我重新创建了设置。以下是我使用的命令:
virsh pool-define-as vm-images-pool logical --source-dev /dev/mapper/mpathd
virsh pool-build vm-images-pool
virsh pool-start vm-images-pool
virsh vol-create-as vm-images-pool images-vol --capacity 249G
virsh pool-define-as vm-images-pool-dir dir - - - - /vm-images-pool/images- vol/
virsh pool-build vm-images-pool-dir
virsh pool-start vm-images-pool-dir
[root@kvm2 ~]# virsh vol-list vm-images-pool-dir
Name Path
---------------------------------------------------------------------------- --
lost+found /vm-images-pool/images-vol/lost+found
template_minimal /vm-images-pool/images-vol/template_minimal
=======================================
/ vm-images-pool / images-vol / template_minimal是用于模板图像的路径
==================================
更多测试:
将逻辑卷安装在挂载点以匹配基于目录的存储池:
[root@kvm2 ~]# df -h /vm-images-pool-dir/images-vol
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vm--images--pool-images--vol 245G 1.2G 232G 1% /vm-images- pool-dir/images-vol
[root@kvm2 ~]# virsh vol-list vm-images-pool-dir
Name Path
------------------------------------------------------------------------------
lost+found /vm-images-pool-dir/images-vol/lost+found
template_minimal /vm-images-pool-dir/images-vol/template_minimal
[root@kvm2 ~]#
使用/ vm-images-pool-dir / images-vol / template_minimal作为模板路径
相同的结果
Unable to save
Failed to create a compute kvm2 (Libvirt) instance test3.xxx.local: Call
to virNetworkCreateXML failed: internal error: Child process
(/usr/sbin/lvcreate --name test3.xxx.local-disk1 -L 1K --type
snapshot --virtualsize 10485760K - s /vm-images-pool-dir/images-
vol/template_minimal) unexpected exit status 3: 2017-01-05
16:45:10.694+0000: 40712: debug : virFileClose:102 : Closed fd 27 2017-
01-05 16:45:10.694+0000: 40712: debug : virFileClose:102 : Closed fd 29
2017-01-05 16:45:10.694+0000: 40712: debug : virFileClose:102 : Closed fd 24
Volume group name expected (no slash) Run `lvcreate --help' for more
information.
图像的来源是“/ vm-images-pool-dir / images-vol / template_minimal”,而访客的目标后端是另一个名为“虚拟机”的存储池上的10G LV
不了解“lvcreate”命令正在尝试做什么,不应该至少使用“虚拟机”作为目标VG。我使用的工具是Satellite 6.2。我在想,我正在忽视一些愚蠢的事情。不知道在哪里:)
由于 TG
答案 0 :(得分:0)
根据该命令中的路径,您似乎想在/ vm-images-pool / images-vol /中创建一个新的基于文件的卷,即您的" vm-images-pool-dir&# 34;池。您正在看到来自" lvcreate"的错误。但是,暗示你错误地指定了" vm-images-pool"将libvirt作为要使用的池,使其尝试创建逻辑卷。您没有显示正在运行的实际命令/ API,但请检查您是否为其指定了正确的池名称。
答案 1 :(得分:0)
我知道这个问题已经被问了很久了,但是我遇到了同样的问题并找到了答案。我找不到导致此错误的确切virsh命令,但在这里我将以下XML文件与virsh vol-create libvirtVG logical.xml
<volume >
<name>vol02</name>
<capacity unit='KiB'>2097152</capacity>
<allocation unit='KiB'>0</allocation>
<backingStore>
<path>/dev/libvirtVG/sles15sp1</path>
</backingStore>
</volume>
要摆脱错误,我必须将分配设置为容量值。您还可以看到virt-manager
正在为您自动完成此操作:
https://github.com/virt-manager/virt-manager/blob/master/virtinst/storage.py#L646
使用virsh vol-create-as
命令的等效项是:
virsh vol-create-as libvirtVG vol02 2048MiB --allocation 2048MiB \
--backing-vol /dev/libvirtVG/sles15sp1