This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
технология_kvm [2022/02/11 10:14] val [Установка] |
технология_kvm [2023/03/29 15:38] (current) val [Создание конфигурации VM из образа] |
||
---|---|---|---|
Line 8: | Line 8: | ||
===== Установка ===== | ===== Установка ===== | ||
- | * !!! 4GB RAM в хост систему | + | * !!! 4GB RAM в хост систему (однажды хватило 2:) |
<code> | <code> | ||
Line 34: | Line 34: | ||
</code> | </code> | ||
- | Подключаемся любым vnc клиентом к порту 5900, в процессе инсталляции XP VM надо будет повторно запустить | + | Подключаемся любым vnc клиентом ([[Сервис VNC]]) к порту 5900, в процессе инсталляции XP VM надо будет повторно запустить |
<code> | <code> | ||
# virsh start winxp | # virsh start winxp | ||
Line 46: | Line 46: | ||
# virsh undefine winxp | # virsh undefine winxp | ||
- | # cp /disk3/winxp.qcow2 /disk3/winxp2.qcow2 | + | # cp /disk3/winxp.qcow2 /disk3/winxp1.qcow2 |
</code> | </code> | ||
===== Создание конфигурации VM из образа ===== | ===== Создание конфигурации VM из образа ===== | ||
<code> | <code> | ||
- | node1# wget -O /disk3/winxp2.qcow2 http://val.bmstu.ru/unix/img/winxp.qcow2 | + | node1# wget http://val.bmstu.ru/unix/img/winxp.qcow2.zip |
- | или | + | |
- | node1# zcat winxp.qcow2.zip > /disk2/winxp2.qcow2 | + | |
- | node1# virt-install --name winxp2 --os-type windows --os-variant winxp \ | + | node1# time zcat winxp.qcow2.zip > /disk3/winxp1.qcow2 |
- | --ram 512 --vcpu 1 --disk path=/disk3/winxp2.qcow2 --graphics vnc,listen=0.0.0.0 \ | + | |
+ | node1# virt-install --name winxp1 --os-type windows --os-variant winxp \ | ||
+ | --ram 512 --vcpu 1 --disk path=/disk3/winxp1.qcow2 --graphics vnc,listen=0.0.0.0 \ | ||
--noautoconsole --hvm --boot hd --network bridge=br0,model=rtl8139 \ | --noautoconsole --hvm --boot hd --network bridge=br0,model=rtl8139 \ | ||
- | --print-xml | tee /disk3/winxp2.xml | + | --print-xml | tee /disk3/winxp1.xml |
- | node1# virsh define /disk3/winxp2.xml | + | node1# virsh define /disk3/winxp1.xml |
- | node1# virsh start winxp2 | + | node1# virsh edit winxp1 |
- | ... | + | node1# virsh start winxp1 |
- | node1# virsh undefine winxp2 | + | node1# virsh undefine winxp1 |
- | или запуск без регистрации VM в KVM | + | или, запуск без регистрации VM в KVM |
- | node1# virsh create /disk3/winxp2.xml | + | node1# virsh create /disk3/winxp1.xml |
+ | node1# virsh vncdisplay winxp1 | ||
</code> | </code> | ||
+ | * [[Сервис VNC]] | ||
===== Миграция VM ===== | ===== Миграция VM ===== | ||
+ | |||
+ | * Для "зрелищности" можно подключиться к winxp1 по RDP и/или подключиться с winxp1 по ssh к server1 | ||
+ | |||
<code> | <code> | ||
- | node1# virsh -c qemu+ssh://node2/system list --all | + | node1# virsh migrate --live winxp1 qemu+ssh://node2/system |
- | node1# virsh migrate --live winxp2 qemu+ssh://node2/system | + | node1# virsh -c qemu+ssh://node2/system list |
+ | |||
+ | node1# virsh -c qemu+ssh://node2/system shutdown winxp1 | ||
</code> | </code> | ||
===== Интеграция с Pacemaker ===== | ===== Интеграция с Pacemaker ===== | ||
- | * [[Пакет Pacemaker]] | + | * В [[Пакет Pacemaker#Управление конфигурацией]] Pacemaker увеличить op timeout и настроить [[Пакет Pacemaker#Запуск после монтирования файловых систем]] |
<code> | <code> | ||
- | crm(live/node1)configure# primitive pr_vm_winxp2 ocf:heartbeat:VirtualDomain params config=/disk3/winxp2.xml migration_transport=ssh meta allow-migrate=true | + | node1# ssn2 virsh -c qemu+ssh://node1/system list # проверка ssh доступа с node2 на node1 |
+ | |||
+ | crm(live/node1)configure# primitive pr_vm_winxp1 ocf:heartbeat:VirtualDomain params config=/disk3/winxp1.xml migration_transport=ssh meta allow-migrate=true | ||
</code> | </code> | ||