Guest customization is intended for template images. You
can provide the expected network information by using the --metadata parameter
during the boot process. If you do not provide the network device
attributes with metadata options, then nova-compute service gets the
network device attributes from the Neutron subnet
information.
Before you begin
The following prerequisites must be met to use this network customization for VMware
Linux guests:
- The provided network has DHCP disabled.
- The template image that is being used has vmware-tools installed.
Note: If the provided network has DHCP enabled, the deployed virtual machine will not have an
IP address assigned. No error message will display. Ensure that DHCP is disabled.
About this task
Complete the following tasks to customize the network for VMware Linux guests
Procedure
- Configure IBM Cloud
Manager with OpenStack to use VMware nodes. For
more information, see Deploying
with VMware compute nodes.
- Install VMware tools on
the virtual machine and then convert it to a template on vCenter.
For more information, see Installing and Configuring VMware Tools.
- Get the template image by using the VMware driver discovery
service. For more information about the VMware driver discovery
service, see VMware driver
discovery service.
- Create the net and subnet in OpenStack. You
can choose to create a subnet with network information specified.
For example:
[root@icm ~]# neutron net-create MY_NET
[root@icm ~]# neutron subnet-create --enable-dhcp=False --gateway 20.9.0.1 --dns-nameserver 24.9.0.6 MY_NET 20.9.0.0/24
[root@icm ~]# neutron subnet-show 8752e022-c28b-4301-acbd-10c9c517b2b6
+-------------------+--------------------------------------------+
| Field | Value |
+-------------------+--------------------------------------------+
| allocation_pools | {"start": "20.9.0.2", "end": "20.9.0.254"} |
| cidr | 20.9.0.0/24 |
| dns_nameservers | 24.9.0.6 |
| enable_dhcp | True |
| gateway_ip | 20.9.0.1 |
| host_routes | |
| id | 8752e022-c28b-4301-acbd-10c9c517b2b6 |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | |
| network_id | 666f39d9-700f-4109-99fd-12392459370f |
| tenant_id | 4f9d5c5dd0aa43ceac5bce2fb38088f1 |
+-------------------+--------------------------------------------+
[root@icm ~]#
- Start the instance with metadata values. When you start
the instance, you can provide the following metadata keys.
networkdevice.Network adapter 1.ipaddress
networkdevice.Network adapter 1.gateway1
networkdevice.Network adapter 1.netmask
linux.dns1
dns.suffix
linux.domainname
linux.hostname
The following example is
a sample
Nova command
for one NIC:
nova boot --flavor 10 --image xiej-rh65-template
--nic net-id=4ba1523c-2343-4368-bada-aed9beafdffa
--meta linux.dns1=10.9.0.14 --meta "networkdevice.Network adapter 1.ipaddress"=10.9.0.236
--meta "networkdevice.Network adapter 1.netmask"=255.255.252.0
--meta "networkdevice.Network adapter 1.gateway1"=10.9.0.1 --meta dns.suffix=sce.cn.ibm.com
--meta linux.domainname=xj-domainname test-cust-236 –meta linux.hostname test
Notes:
- linux.hostname can be specified in metadata.
If it is not specified in metadata, the instance name is used for
the hostname. The instance name should not contain underscores or
other special characters because of a vCenter limitation. If non-supported
characters are included, you might see errors such as the following
error:
VMwareDriverException: A specified parameter was not correct, spec.identity.hostName.
- If you plan to provide the network information by using metadata,
you must specify the following parameters together: dns, ipaddress, netmask,
and gateway.
Otherwise, add dns-nameserver and gateway when
you create the subnet. Then, the dns, ipaddress, netmask,
and gateway values are supplied by Neutron. If this
information is specified in both metadata and the Neutron subnet
at the same time, the information in the metadata has priority.
- You can specify the options dns.suffix and linux.domainname in
metadata. You can also configure these two options in the vmware section
of nova.conf as the configuration items dns_suffix and domain_name.
The metadata parameter has higher priority. Finally, if you do not
configure these two options in nova.conf, the
default value is used.
- If you want to configure two NICs, you must provide the related
information for NIC 2. For example, networkdevice.Network
adapter 2.ipaddress, networkdevice.Network adapter
2.netmask and networkdevice.Network adapter 2.gateway1 must
be provided in the metadata.
Results
After completing these steps, you should find the expected
attributes customized after logging in to the instance.