Openstack Hyper-V instance/VM Name

Upon launching an instance through OpenStack on a Hyper-V host, the VM is name "instance-00000xx"--is there a way to have the prefix "instance" replaced with something else on a per-launch basis, particularly using the metadata when launching the instance? For example, if I launch 5 instances of a special Windows 7 build, I would like the VM names in Hyper-V to be similar to "Special-00000xx"

Also, is there a way to configure VM attributes like Hyper-V integration services or CD drive options at the launch of an instance?

1 answer

So, there is a configuration option in nova, called instance_name_template [1]. By default it is, instance-%08x, which results in VM names as you've already seen. You can change this behaviour, by setting this configuration option in the C:\Program Files\Cloudbase Solutions\OpenStack\Nova\etc\nova.conf files on your compute nodes to something that suites your needs, but make sure that you do it across all your compute nodes.

Also, make sure that the instance_name_template you set will ensure unique names for each instance, otherwise you'll end up with instances having the same names on your compute nodes. In particular, for you scenario, you can have this template: instance_name_template = instance-%(display_name)s-%(id)08x. This means that the VM name contains the name you pass in to nova boot (for example, nova boot --image yourspecialmage Special-1). Do keep in mind that this will be done for each instance.

As far Linux Integration Services go, you can install them on your images, and then register those images into glance. Nova doesn't install them. Also, Windows images do not require any Integration Services on Hyper-V.

Not sure I understand what you mean by CD drive options, but nova can attach a configdrive to your instance, containing any given userdata passed by you to the instance (including scripts - just make sure you have cloud-init for Linux / cloudbase-init for Windows installed on your images). You can have the force_config_drive=True in your compute nodes' nova.conf file. Alternatively, if you have cloud-init / cloudbase-init installed in your guest VMs, they will fetch this metadata from nova.