mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-11-30 12:01:29 +00:00
Add libvirt support for qemu
This commit is contained in:
parent
71a2abb167
commit
3f899c1650
|
@ -1,5 +1,10 @@
|
||||||
{config, ...}:
|
{config, options, ...}:
|
||||||
{
|
{
|
||||||
config.networking.hostName = "chromium";
|
config.networking.hostName = "chromium";
|
||||||
config.virtualisation.memorySize = 2048;
|
config.fileSystems."/home/user" = {
|
||||||
|
device = "apphome";
|
||||||
|
fsType = "9p";
|
||||||
|
options = [ "trans=virtio" "version=9p2000.L" "cache=loose" ];
|
||||||
|
neededForBoot = true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
49
qemuvirt.md
Normal file
49
qemuvirt.md
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# /usr/bin/qemu-system-x86_64
|
||||||
|
|
||||||
|
## need
|
||||||
|
|
||||||
|
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny
|
||||||
|
-m 1024
|
||||||
|
-realtime mlock=off
|
||||||
|
-smp 1,sockets=1,cores=1,threads=1
|
||||||
|
-drive file=/home/user/appvm/result/iso/nixos-18.09pre144732.2171fc4d55b-x86_64-linux.iso,format=raw,if=none,id=drive-ide0-0-0,readonly=on
|
||||||
|
-chardev spicevmc,id=charchannel0,name=vdagent
|
||||||
|
-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0
|
||||||
|
-spice port=5900,addr=127.0.0.1,disable-ticketing,image-compression=off,seamless-migration=on
|
||||||
|
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pci.0,addr=0x2
|
||||||
|
-device intel-hda,id=sound0,bus=pci.0,addr=0x3
|
||||||
|
|
||||||
|
## no need :)
|
||||||
|
|
||||||
|
-msg timestamp=on
|
||||||
|
-name guest=generic,debug-threads=on
|
||||||
|
-S
|
||||||
|
-object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-1-generic/master-key.aes
|
||||||
|
-machine pc-i440fx-2.12,accel=kvm,usb=off,vmport=off,dump-guest-core=off
|
||||||
|
-cpu Skylake-Client-IBRS
|
||||||
|
-device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=2
|
||||||
|
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
|
||||||
|
-device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0
|
||||||
|
-chardev spicevmc,id=charredir0,name=usbredir
|
||||||
|
-device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=1
|
||||||
|
-chardev spicevmc,id=charredir1,name=usbredir
|
||||||
|
-device isa-serial,chardev=charserial0,id=serial0
|
||||||
|
-device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1
|
||||||
|
-chardev pty,id=charserial0
|
||||||
|
-boot strict=on
|
||||||
|
-device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7
|
||||||
|
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4
|
||||||
|
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1
|
||||||
|
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2
|
||||||
|
-device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5
|
||||||
|
-uuid cf00561e-ddc2-4be4-a91a-08b0c28f3f75
|
||||||
|
-no-user-config
|
||||||
|
-nodefaults
|
||||||
|
-chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-1-generic/monitor.sock,server,nowait
|
||||||
|
-mon chardev=charmonitor,id=monitor,mode=control
|
||||||
|
-rtc base=utc,driftfix=slew
|
||||||
|
-global kvm-pit.lost_tick_policy=delay
|
||||||
|
-no-hpet
|
||||||
|
-no-shutdown
|
||||||
|
-global PIIX4_PM.disable_s3=1
|
||||||
|
-global PIIX4_PM.disable_s4=1
|
61
v1.xml
Normal file
61
v1.xml
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
<domain type='kvm'>
|
||||||
|
<name>generic2</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<currentMemory unit='KiB'>1048576</currentMemory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc-i440fx-2.12'>hvm</type>
|
||||||
|
<boot dev='cdrom'/>
|
||||||
|
</os>
|
||||||
|
<features>
|
||||||
|
<acpi/>
|
||||||
|
<apic/>
|
||||||
|
<vmport state='off'/>
|
||||||
|
</features>
|
||||||
|
<cpu mode='custom' match='exact' check='partial'>
|
||||||
|
<model fallback='allow'>Skylake-Client-IBRS</model>
|
||||||
|
</cpu>
|
||||||
|
<clock offset='utc'>
|
||||||
|
<timer name='rtc' tickpolicy='catchup'/>
|
||||||
|
<timer name='pit' tickpolicy='delay'/>
|
||||||
|
<timer name='hpet' present='no'/>
|
||||||
|
</clock>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<pm>
|
||||||
|
<suspend-to-mem enabled='no'/>
|
||||||
|
<suspend-to-disk enabled='no'/>
|
||||||
|
</pm>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
<disk type='file' device='cdrom'>
|
||||||
|
<driver name='qemu' type='raw'/>
|
||||||
|
<source file='/nix/store/7br365hj49vxwjf6bk6yykazx1ind42m-nixos-18.09pre144732.2171fc4d55b-x86_64-linux.iso/iso/nixos-18.09pre144732.2171fc4d55b-x86_64-linux.iso'/>
|
||||||
|
<target dev='hda' bus='ide'/>
|
||||||
|
<readonly/>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||||
|
</disk>
|
||||||
|
<controller type='usb' index='0' model='piix3-uhci'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
|
<controller type='ide' index='0'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||||
|
</controller>
|
||||||
|
<input type='mouse' bus='ps2'/>
|
||||||
|
<input type='keyboard' bus='ps2'/>
|
||||||
|
<graphics type='spice' autoport='yes'>
|
||||||
|
<listen type='address'/>
|
||||||
|
<image compression='off'/>
|
||||||
|
</graphics>
|
||||||
|
<video>
|
||||||
|
<model type='qxl' ram='1048576' vram='1048576' vgamem='262144' heads='1' primary='yes'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||||
|
</video>
|
||||||
|
<memballoon model='virtio'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||||
|
</memballoon>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
||||||
|
|
77
v2.xml
Normal file
77
v2.xml
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
<domain type='kvm' id='19'>
|
||||||
|
<name>generic3</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<currentMemory unit='KiB'>1048576</currentMemory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<resource>
|
||||||
|
<partition>/machine</partition>
|
||||||
|
</resource>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc-i440fx-2.12'>hvm</type>
|
||||||
|
<boot dev='cdrom'/>
|
||||||
|
</os>
|
||||||
|
<features>
|
||||||
|
<acpi/>
|
||||||
|
<apic/>
|
||||||
|
<vmport state='off'/>
|
||||||
|
</features>
|
||||||
|
<cpu mode='custom' match='exact' check='full'>
|
||||||
|
<model fallback='forbid'>Skylake-Client-IBRS</model>
|
||||||
|
<feature policy='require' name='hypervisor'/>
|
||||||
|
</cpu>
|
||||||
|
<clock offset='utc'>
|
||||||
|
<timer name='rtc' tickpolicy='catchup'/>
|
||||||
|
<timer name='pit' tickpolicy='delay'/>
|
||||||
|
<timer name='hpet' present='no'/>
|
||||||
|
</clock>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<pm>
|
||||||
|
<suspend-to-mem enabled='no'/>
|
||||||
|
<suspend-to-disk enabled='no'/>
|
||||||
|
</pm>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
<disk type='file' device='cdrom'>
|
||||||
|
<driver name='qemu' type='raw'/>
|
||||||
|
<source file='/nix/store/818c4dbnvvfwb2928bycfds7l29zvnbl-nixos-18.09pre144732.2171fc4d55b-x86_64-linux.iso/iso/nixos-18.09pre144732.2171fc4d55b-x86_64-linux.iso'/>
|
||||||
|
<backingStore/>
|
||||||
|
<target dev='hda' bus='ide'/>
|
||||||
|
<readonly/>
|
||||||
|
<alias name='ide0-0-0'/>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||||
|
</disk>
|
||||||
|
<filesystem type='mount' accessmode='passthrough'>
|
||||||
|
<source dir='/home/user/appvm/chromium'/>
|
||||||
|
<target dir='app-home'/>
|
||||||
|
<alias name='fs0'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||||
|
</filesystem>
|
||||||
|
<input type='mouse' bus='ps2'>
|
||||||
|
<alias name='input0'/>
|
||||||
|
</input>
|
||||||
|
<input type='keyboard' bus='ps2'>
|
||||||
|
<alias name='input1'/>
|
||||||
|
</input>
|
||||||
|
<graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
|
||||||
|
<listen type='address' address='127.0.0.1'/>
|
||||||
|
<image compression='off'/>
|
||||||
|
</graphics>
|
||||||
|
<video>
|
||||||
|
<model type='qxl' ram='524288' vram='1048576' vgamem='262144' heads='1' primary='yes'/>
|
||||||
|
<alias name='video0'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||||
|
</video>
|
||||||
|
<memballoon model='virtio'>
|
||||||
|
<stats period='5'/>
|
||||||
|
<alias name='balloon0'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||||
|
</memballoon>
|
||||||
|
</devices>
|
||||||
|
<seclabel type='dynamic' model='dac' relabel='yes'>
|
||||||
|
<label>+77:+77</label>
|
||||||
|
<imagelabel>+77:+77</imagelabel>
|
||||||
|
</seclabel>
|
||||||
|
</domain>
|
||||||
|
|
Loading…
Reference in a new issue