Installing a Windows Server instance into Openstack from an ISO

Started by Dieselboy, July 06, 2018, 04:40:16 AM

Previous topic - Next topic

Dieselboy

Summary

Recently and at least once in the past I have tried to quickly find the information to allow me to install a Windows based VM instance in an Openstack environment. The issue I have found is that using Horizon only, you cannot simply create a blank VM with a CDROM attached, boot from the CDROM and then swap the disk to install the necessary drivers to allow your boot-from-dvd system to see the attached, empty volumes. I think the trouble arises because of the confusion between images and volumes in openstack. Also I didnt want to download someone elses packaged qcow2 and distance constraints means that I could not first build a qcow on another system and then transfer to this environment. The resulting end file is at least 8gb and my first attempt at this did not work. I think I know my error now, but I had to leave this transfer running over night and wasn't prepared to wait until tonight to try it again, only for some other oversight.  :twitch:

In any case I have managed to boot a new instance in Openstack from a OEM Windows 2012 Server ISO, install storage drivers from another, 2nd ISO to allow the empty volume to be 'seen', and then successfully installed Windows 2012 into a volume on openstack. The end result is a bootable Windows Server 2012 volume that you can either use as-is or create a qcow2 image from. I suggest taking a snapshot once the updates are installed and keeping that as a reference. Bear in mind that you will need to run sysprep if you make any 2nd system, but if you snapshot now and something goes wrong with the sysprep then you can always spin up from where you left off.

My test environment

Actually for this test the environment is quite simple: A single Lenovo server running Centos7 and latest (at time of writing) RDO Packstack-all-in-one which is Openstack Queens.

Pre-requisites:
1. upload the windows ISO to glance and obtain the image ID
2. upload the correct drivers .ISO [hint: https://docs.fedoraproject.org/quick-docs/en-US/creating-windows-virtual-machines-using-virtio-drivers.html#Direct_download]
3. this one is a bit obvious - but spare capacity to perform this.

Steps:

1. Obtain the ID from openstack for the Windows server ISO image (in my case: cb921407-af7b-45c0-bb6f-3cf9aa34dbc3 )
2. Obtain the ID from openstack for the drivers ISO (in my case: 066aa976-5e14-4dd6-8e08-4e2b36ac29ab )
3. Obtain your flavour ID and network ID for the below command
4. Source your openstack project RC file and authenticate so we can run openstack command against the env.
5. Put the magic together:

We're going to tell nova to boot a new instance using the Windows 2012 image to boot but also to mount a 2nd image as a cdrom device. Lastly, we get a 50G empty volume created and attached to the same instance.

Quotenova boot --flavor ad15aeea-7421-4692-a833-025f39fdee18 --image cb921407-af7b-45c0-bb6f-3cf9aa34dbc3 --nic net-id=76415546-eec8-4587-84db-c65b41b237c7 --block-device id=066aa976-5e14-4dd6-8e08-4e2b36ac29ab,source=image,dest=volume,bus=ide,device=/dev/hda,size=1,type=cdrom,bootindex=1 --block-device source=blank,dest=volume,size=50,shutdown=preserve Windy

Openstack should return something like:
+--------------------------------------+------------------------------------------------------------------+
| Property                             | Value                                                            |
+--------------------------------------+------------------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                           |
| OS-EXT-AZ:availability_zone          |                                                                  |
| OS-EXT-SRV-ATTR:host                 | -                                                                |
| OS-EXT-SRV-ATTR:hostname             | Windy                                                          |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                                                |
| OS-EXT-SRV-ATTR:instance_name        |                                                                  |
| OS-EXT-SRV-ATTR:kernel_id            |                                                                  |
| OS-EXT-SRV-ATTR:launch_index         | 0                                                                |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                                                  |
| OS-EXT-SRV-ATTR:reservation_id       | r-zdznsnfv                                                       |
| OS-EXT-SRV-ATTR:root_device_name     | -                                                                |
| OS-EXT-SRV-ATTR:user_data            | -                                                                |
| OS-EXT-STS:power_state               | 0                                                                |
| OS-EXT-STS:task_state                | scheduling                                                       |
| OS-EXT-STS:vm_state                  | building                                                         |
| OS-SRV-USG:launched_at               | -                                                                |
| OS-SRV-USG:terminated_at             | -                                                                |
| accessIPv4                           |                                                                  |
| accessIPv6                           |                                                                  |
| adminPass                            | 2cFHEAxyVw8S                                                     |
| config_drive                         |                                                                  |
| created                              | 2018-07-06T08:46:53Z                                             |
| description                          | -                                                                |
| flavor:disk                          | 50                                                               |
| flavor:ephemeral                     | 0                                                                |
| flavor:extra_specs                   | {}                                                               |
| flavor:original_name                 | SLDC                                                             |
| flavor:ram                           | 2048                                                             |
| flavor:swap                          | 0                                                                |
| flavor:vcpus                         | 2                                                                |
| hostId                               |                                                                  |
| host_status                          |                                                                  |
| id                                   | 916b0b85-7f62-4b73-a15b-e5c53fddf619                             |
| image                                | win2012 (cb921407-af7b-45c0-bb6f-3cf9aa34dbc3)                   |
| key_name                             | -                                                                |
| locked                               | False                                                            |
| metadata                             | {}                                                               |
| name                                 | Windy                                                          |
| os-extended-volumes:volumes_attached | []                                                               |
| progress                             | 0                                                                |
| security_groups                      | default                                                          |
| status                               | BUILD                                                            |
| tags                                 | []                                                               |
| tenant_id                            | 9dd446a087594dc8ae6b801a60d9a6ec                                 |
| updated                              | 2018-07-06T08:46:53Z                                             |
| user_id                              | 729c0f68314683dsaf9c16637c32f72e8c11a006a2d5d5310 |
+--------------------------------------+------------------------------------------------------------------+



Result

After getting the output above, the instance will boot from the Windows Install ISO. You will need to use some keyboard skills to navigate the console and get to the screen where you are about to install, but there are no disks showing. When you select add drivers, a screen will load up showing you the Windows install ISO mounted as well as your driver ISO mounted simultaneously. From there, install the storage drivers and when you refresh on the previous screen, your empty disk should now be displayed  :mrgreen:

As a side-note, I recommend you also install network drivers and anything else you will definitely need as this will save you booting up with no network installed.

Hope this helps someone as this time around I spent a good few hours on this. At very least, these notes will help me in the future  8)

deanwebb

Take a baseball bat and trash all the routers, shout out "IT'S A NETWORK PROBLEM NOW, SUCKERS!" and then peel out of the parking lot in your Ferrari.
"The world could perish if people only worked on things that were easy to handle." -- Vladimir Savchenko
Вопросы есть? Вопросов нет! | BCEB: Belkin Certified Expert Baffler | "Plan B is Plan A with an element of panic." -- John Clarke
Accounting is architecture, remember that!
Air gaps are high-latency Internet connections.

maxleroux

Hi
I am stuck because I didn't find the good driver for storage for my windows 10. At each time, there is "we could find any driver"

Have you got where to find it?

Dieselboy

Looks like you don't have it there in the list. You need "viostor" for the virt IO storage. This is annoying because without that you cannot begin the installation to the disk.

A quick google found a bunch of results for this:

- https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/

- https://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers

Good luck!

Dieselboy