Host os
You can run StratoVirt on both x86_64 and aarch64 platforms.
And on top of that, the StratoVirt is based on KVM, so please make sure you have KVM module on your platform.
Authority
You should have read/write permissions to /dev/kvm
. If not, you can get your permissions by:
$ sudo setfacl -m u:${USER}:rw /dev/kvm
StratoVirt is offerred by openEuler 20.09 or later. You can install by yum directly.
$ sudo yum install stratovirt
Now you can find StratoVirt binary with path: /usr/bin/stratovirt
.
If you'd like to build StratoVirt yourself, you should check out the build_guide.
With StratoVirt binary (either installed with yum, or built from source), we can boot a guest linux machine by StratoVirt.
First, you will need an PE format Linux kernel binary, and an ext4 file system image (as rootfs).
Or get the kernel and rootfs with shell:
arch=`uname -m`
dest_kernel="vmlinux.bin"
dest_rootfs="rootfs.ext4"
image_bucket_url="https://repo.openeuler.org/openEuler-21.03/stratovirt_img"
if [ ${arch} = "x86_64" ] || [ ${arch} = "aarch64" ]; then
kernel="${image_bucket_url}/${arch}/vmlinux.bin"
rootfs="${image_bucket_url}/${arch}/openEuler-21.03-stratovirt-${arch}.img.xz"
else
echo "Cannot run StratoVirt on ${arch} architecture!"
exit 1
fi
echo "Downloading $kernel..."
wget ${kernel} -O ${dest_kernel} --no-check-certificate
echo "Downloading $rootfs..."
wget ${rootfs} -O ${dest_rootfs}.xz --no-check-certificate
xz -d ${dest_rootfs}.xz
echo "kernel file: ${dest_kernel} and rootfs image: ${dest_rootfs} download over."
Start guest linux machine with StratoVirt:
socket_path=`pwd`"/stratovirt.sock"
kernel_path=`pwd`"/vmlinux.bin"
rootfs_path=`pwd`"/rootfs.ext4"
# Make sure api-channel can be created.
rm -f ${socket_path}
# Start StratoVirt guest linux machine.
/usr/bin/stratovirt \
-kernel ${kernel_path} \
-smp 1 \
-m 1024m \
-append console=ttyS0 pci=off reboot=k quiet panic=1 root=/dev/vda \
-drive file=${rootfs_path},id=rootfs,readonly=off,direct=off \
-api-channel unix:${socket_path} \
-serial stdio
You should now see a serial in stdio prompting you to log into the guest machine. If you used our
openEuler-21.03-stratovirt-aarch64.img
image, you can login as root
, using the password
openEuler12#$
.
If you want to quit the guest machine, using a reboot
command inside the guest will actually shutdown
StratoVirt. This is due to that StratoVirt didn't implement guest power management in microvm type.
If you want to know more information on running StratoVirt, go to the Configuration Guidebook.
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )