Use a combination of Ganeti instance creation with a Windows 10 ISO and a Windows virtual IO driver disk to create and install a Windows instance running in KVM and controlled by the Ganeti virtual machine cluster management tool (Hypervisor).
The Virtual IO driver disk is accessed as a secondary CD-ROM during the Windows intallation. We use VNC to view our new VM’s console to be able to install Windows via it’s graphic user interface.
Log in to your host and become root:
$ sudo -s
Now create the disk instance
gnt-instance add -t plain -n host1.ws.nsrc.org \
-s 20G -o noop --no-name-check --no-ip-check \
--no-start windows10
Here is the command in one long line to make it easier to copy and paste:
# gnt-instance add -t plain -n host1.ws.nsrc.org -s 20G -o noop --no-name-check --no-ip-check --no-start windows10
Note that the guest name is “windows10” and it has been assigned 20GB of “plain” disk, which is a single copy of the disk in the LVM store of the primary node.
You should see something like this:
Sun Oct 24 08:59:35 2021 * disk 0, size 20.0G
Sun Oct 24 08:59:35 2021 * creating instance disks...
Sun Oct 24 08:59:36 2021 adding instance windows10 to cluster config
Sun Oct 24 08:59:36 2021 adding disks to cluster config
Sun Oct 24 08:59:36 2021 - INFO: Waiting for instance windows10 to sync disks
Sun Oct 24 08:59:36 2021 - INFO: Instance windows10's disks are in sync
Sun Oct 24 08:59:36 2021 - INFO: Waiting for instance windows10 to sync disks
Sun Oct 24 08:59:36 2021 - INFO: Instance windows10's disks are in sync
Sun Oct 24 08:59:36 2021 * running the instance OS create scripts...
Assign an IDE CD-ROM drive to your new instance:
# gnt-instance modify -H cdrom_disk_type=ide windows10
You may see this message:
Modified instance windows10
- hv/cdrom_disk_type -> ide
Please don't forget that most parameters take effect only at the next (re)start of the instance initiated by ganeti; restarting from within the instance will not be enough.
Note that changing hypervisor parameters without performing a restart might lead to a crash while performing a live migration. This will be addressed in future Ganeti versions.
It’s OK. This is just telling us that if we had done this while the instance was running, then we won’t see changes until we shut down the instance from Ganeti - not from within the instance itself. That is, the newly assiged cd-rom drive would not appear until we restarted the instance using Ganeti.
Give the instance some memory and CPUs (vcpus = virtual cpus)
# gnt-instance modify -B minmem=1G,maxmem=2G,vcpus=2 windows10
You should see something like:
Modified instance windows10
- be/minmem -> 1024
- be/vcpus -> 2
- be/maxmem -> 2048
Please don't forget that most parameters take effect only at the next (re)start of the instance initiated by ganeti; restarting from within the instance will not be enough.
Tell Ganeti what network interface on our host machine the instance should use:
# gnt-instance modify --net 0:link=br-lan windows10
You should see something like:
root@host1:~# gnt-instance modify --net 0:link=br-lan windows10
Modified instance windows10
- nic.vlan/0 ->
- nic.link/0 -> br-lan
- nic.mode/0 -> bridged
Please don't forget that most parameters take effect only at the next (re)start of the instance initiated by ganeti; restarting from within the instance will not be enough.
If you need access to the ISOs in the NFS mount directory /iso on your host be sure they are available:
# mount s1.ws.nsrc.org:/iso /iso
Now we’ll start our instance telling it to boot the Windows 10 install ISO from the cdrom drive and to provide a second cdrom that will have the virtual i/o drivers available so that the Windows 10 installer can see the ganeti prepared plain disk image.
gnt-instance start \
-H cdrom_image_path=/iso/Win10_21H1_English_x32.iso,\
cdrom2_image_path=/iso/virtio-win.iso,\
boot_order=cdrom windows10
And, to make this easier to copy and paste here is the command in one long line:
# gnt-instance start -H cdrom_image_path=/iso/Win10_21H1_English_x32.iso,cdrom2_image_path=/iso/virtio-win.iso,boot_order=cdrom windows10
To find out what VNC port the instance console is available on do:
gnt-instance list -o name,pnode,network_port
Here is a sample output:
Instance Primary_node Network_port
windows10 host1.ws.nsrc.org 11001
wordpressx host1.ws.nsrc.org 11000
In this case you would use your VNC client and attach to port 11001. Remember, the console for your instance might be on a different port.
Now use your VNC client and attach VNC to hostX.ws.nsrc.org on port 11001
One example (Remember, your port may be different):
$ vncviewer hostX.ws.nsrc.org:11001
At this point you should see the Windows 10 instller startup screen in VNC.
Next.Click on the choice “I don’t have a product key”
Load driver:The first try fails. The error message is incorrect. Click Cancel first:
Browse:Go down to the CD Drive “E:” and select that and press OK:
OK:NextNext:At this point let’s shutdown our Windows 10 instance even though we are mid-install and move on to our next set of exercises. Completing the install can take 30 minutes or longer and we will run out of time.
To stop the installer go back to your Ganeti host. Maybe see your instances again:
# gnt-instance list
You might see something like:
Instance Hypervisor OS Primary_node Status Memory
windows10 kvm noop host1.ws.nsrc.org running -
wordpressx kvm noop host1.ws.nsrc.org ADMIN_down -
To shutdown the Windows 10 insance and the installer you would do:
# gnt-instance shutdown --submit windows10
The “–submit” option lets the command run in the background so that we can continue to work and now have to wait for command completion. Shutdown can take some time for some instances.
When the shutdown command finished you should have seen a number, a colon and the name of the instance. Something like:
1NN: windows10
If you want detailed information on the shutdown process you can type;
# gnt-job info 1NN
Here is a sample output of this command for shutting down a Windows instance:
root@host1:~# gnt-job info 144
- Job ID: 144
Status: success
Received: 2021-10-24 10:13:39.600443
Processing start: 2021-10-24 10:13:39.751754 (delta 0.151311s)
Processing end: 2021-10-24 10:13:39.904289 (delta 0.152535s)
Total processing time: 0.303846 seconds
Opcodes:
- Opcode: OP_INSTANCE_SHUTDOWN
Status: success
Processing start: 2021-10-24 10:13:39.751754
Execution start: 2021-10-24 10:13:39.760824
Processing end: 2021-10-24 10:13:39.904278
Input fields:
OP_ID: OP_INSTANCE_SHUTDOWN
admin_state_source: admin
comment: None
debug_level: 0
depends: None
dry_run: False
force: False
ignore_offline_nodes: False
instance_name: windows10
instance_uuid: 622646bf-f4ef-4fb7-b0aa-a9154c07742c
no_remember: False
priority: 0
reason:
- - gnt:client:gnt-instance
- shutdown
- 1635070419598670848
- - gnt:opcode:instance_shutdown
- job=144;index=0
- 1635070419600443000
timeout: 120
Result: None
Execution log:
Finally, if you wanted to start the installer again on the same Ganeti disk instance as install did not complete you need to issue the command:
# gnt-instance start -H cdrom_image_path=/iso/Win10_21H1_English_x32.iso,cdrom2_image_path=/iso/virtio-win.iso,boot_order=cdrom windows10
But, once an installer is complete, then the disk image will be bootable and you can simply use start and shutdown to control the instance in the future.
For example:
# gnt-instance list
# gnt-instance start windows10
# gnt-instance shutdown --submit windows10