Not only can a file be assigned to the guest machine as a virtual disk, but the LV in the VG on the host machine can also be assigned to the virtual machine as a virtual disk.
However, since LV does not have the MBR boot record of the disk, it cannot be used as a startup disk for a virtual machine and can only be used as a data disk.
In this configuration, the VG on the host is a Storage Pool, and the LV in the VG is the Volume.
The advantage of LV is that it has better performance; its disadvantage is that it is not as good as image files in terms of management and mobility, and it cannot be used remotely through the network.
Here’s an example.
First, create a VG with a capacity of 10G on the host machine and name it HostVG.
Then a Storage Pool definition file /etc/libvirt/storage/HostVG.xml was created with the content of
Then create a new Storage Pool “HostVG” via virsh command
and enable this HostVG
Now we You can add the LV virtual disk to the virtual machine kvm1 in virt-manager.
Click Browse
You can see that HostVG is already in the list of Stroage Pool, select HostVG
Name the volume newlv and set the size to 100MB
Click Finish, newlv is created successfully
Click Choose Volume
Click Finish to confirm adding newlv as volume to kvm1
The new volume is added successfully
On the host machine then There is an additional LV named newlv
KVM also supports iSCSI, Ceph and other types of Storage Pool, here is I won’t introduce them one by one. The most commonly used type is the directory type. For other types, please refer to the document http://libvirt.org/storage.html
In the next section we will start to discuss the network virtualization principles of KVM