Setupping Windows guest inside of KVM
Agenda
- Create NBD instance containing Windows installer ISO
- Create and configure KVM instance to support Windows
Create Windows ISO
Under Linux, with Windows installer CDROM inserted:
# dd if=/dev/cdrom of=/root/windows.iso
Create NBD instance to host ISO (2)
Open the slapconsole:
slapos console ~/.slapos/slapos.cfg
In the slapconsole, type:
nbd_instance = slap.registerOpenOrder().request(
software_release=kvm,
partition_reference='windows nbd image',
software_type="nbd",
filter_kw={ "computer_guid": "COMP-123456" }, # Replace by your Computer ID
)
Then, connect to the instance and upload your image.
Request the KVM instance
Go to the last step, and wait next steps to validate the instance. We will need to fill more parameters.
Specify NBD host
Add this parameter to your KVM instance. Replace the IP by the IP given by the NBD instance.
<parameter id="nbd-host">2001:470:1f14:169:f:9e31:70ff:d369</parameter>
Virtual hdd: Two solutions
Qemu can boot in one of the two modes:
- Easiest: use "IDE" format (recommended)
- Easy but more performant: "virtio" format
Using "ide" allows transparent deployment of kvm instance.
Using "virtio" takes 15 minutes to configure + 5 more minutes per instance, but has better perfs.
To help you choose, here are some benchs.
IDE mode (recommended)
Just add this parameter to your KVM instance:
<parameter id="disk-type">ide</parameter>
Pros: easy deployment.
Cons: Can be slower than virtio solution.
virtio mode (1)
Currently not recommended
"virtio" mode isn't supported natively by Windows. You need drivers!
Drivers ISO can be mounted by setting a second NBD host. Add the following to your instance parameters:
<parameter id="nbd2-host">2001:470:1f14:169:f:9e31:70ff:d369</parameter>
<parameter id="nbd2-port">1024</parameter>
Pros: easy deployment.
Cons: Can be slower than virtio solution.
Note:
This uses "virtio driver" NBD instance of SlapOS team. If needed, you can create and use your own NBD instance.
Original drivers can be found here: http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/virtio-win-0.1-30.iso
virtio mode (2)
In the windows installer, just load your driver from the CDROM.