Это старая версия документа!
Проверка аппаратной виртуализации:
cat /proc/cpuinfo | egrep 'flags.*(svm|vmx)
'
tasksel install virt-host
/etc/libvirt/storage/vg01.xml
<pool type='logical'> <name>vg01</name> <target> <path>/dev/vg01</path> </target> </pool>
virsh pool-define /etc/libvirt/storage/vg01.xml
virsh pool-start vg01
virsh pool-autostart vg01
virsh pool-info vg01
apt-get install virtinst
virt-install --os-variant list
lvcreate -L51200 -n nti09 /dev/vg01
virsh pool-refresh vg01
virt-install --connect=qemu:///system \ --name=nti09 \ --cpu host \ --vcpus=1,sockets=1,cores=1,threads=1 \ --ram=512 \ --os-type=linux \ --os-variant=ubuntutrusty \ --disk vol=vg01/nti09,bus=virtio,cache=none \ --cdrom=/tmp/ubuntu-14.04.1-server-amd64.iso \ --network bridge:br0,model=virtio \ --graphics vnc,listen=0.0.0.0,port=46599,password=zzzzzz \ --accelerate \ --hvm \ --noautoconsole
lvcreate -L51200 -n nti08 /dev/vg01
virsh pool-refresh vg01
virt-install --connect=qemu:///system \ --name=nti08 \ --cpu host \ --vcpus=1,sockets=1,cores=1,threads=1 \ --ram=512 \ --os-type=linux \ --os-variant=rhel6 \ --disk vol=vg01/nti08,bus=virtio,cache=none \ --cdrom=/tmp/CentOS-6.6-x86_64-minimal.iso \ --network bridge:br0,model=virtio \ --graphics vnc,listen=0.0.0.0,port=46598,password=zzzzzz \ --accelerate \ --hvm \ --noautoconsole
lvcreate -L50000 -n vm-adm1-root /dev/vg01 virsh pool-refresh vg01 virt-install --connect=qemu:///system \ --name=adm1 \ --cpu host \ --vcpus=1,sockets=1,cores=2,threads=1 \ --ram=512 \ --os-type=linux \ --os-variant=rhel7 \ --disk vol=vg01/vm-adm1-root,bus=virtio,cache=none \ --location=http://mirror.yandex.ru/centos/7/os/x86_64/ \ --network bridge:br0,model=virtio \ --nographics \ --extra-args='console=tty0 console=ttyS0,115200n8' \ --accelerate \ --hvm
lvcreate -L102500 -n nti02 /dev/vg01
virsh pool-refresh vg01
virt-install --connect=qemu:///system \ --name=nti02 \ --cpu host \ --vcpus=8,sockets=1,cores=8,threads=1 \ --ram=12288 \ --os-type=windows \ --os-variant=win2k8 \ --disk vol=vg01/nti02,bus=virtio,cache=none \ --cdrom=/bak/iso/ru_windows_server_2008_r2_standard_enterprise_datacenter_web_vl_build_x64_dvd_x15-59789.iso \ --network bridge:br0,model=virtio \ --graphics vnc,listen=0.0.0.0,port=46591,password=zzzzzz \ --accelerate \ --hvm \ --noautoconsole
Подключить образ:
virsh attach-disk guest01 /root/disc1.iso hdc –driver file –type cdrom –mode readonly
Отключить образ:
virsh attach-disk vguest01 " " hdc –driver file –type cdrom –mode readonly
virsh edit guest01
<os> <type arch='x86_64' machine='pc-0.12'>hvm</type> <boot dev='cdrom'/> <boot dev='hd'/> </os>
<disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/tmp/ubuntu-14.04.1-server-amd64.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
virsh attach-device nti02 /etc/libvirt/qemu/devices/usbpwc2.xml
<hostdev mode='subsystem' type='usb'> <source> <vendor id='0x0d9f' /> <product id='0x00a3' /> </source> </hostdev>