After moving a machine from one Hypervisor to another it may be necessary to change some parameters, particularly likely are Network settings. This is a snippet for making changes to NIC configuration using an input file.
1) Update hostname and other trivial metadata. Hostname stored in the zone at /etc/nodename and /etc/hosts needs to be manually changed.
# echo '{"hostname": "rts-build-01.rts004.racktoplabs.com"}' | vmadm update bf43a067-b619-4383-bf6a-e2c44f0de575
2) Get information about NICs setup in the VM.
# vmadm get bf43a067-b619-4383-bf6a-e2c44f0de575|json nics
[
{
"interface": "net0",
"mac": "c2:cb:8a:ea:e2:96",
"vlan_id": 4,
"nic_tag": "v0004dev",
"gateway": "10.1.4.254",
"primary": true,
"ip": "10.1.4.17",
"netmask": "255.255.255.0"
}
]
3) Copy previous output and make any necessary changes to a JSON file which will be our input, so it looks like this.
{
"update_nics": [
{
"interface": "net0",
"mac": "c2:cb:8a:ea:e2:96",
"nic_tag": "v0004dev",
"gateway": "10.1.4.254",
"index": 0,
"ip": "10.1.4.17",
"netmask": "255.255.255.0",
"physical": "v0004dev01",
"vlan_id": 4,
"primary": true
}
]
}
4) Finally, apply changes made to input-file.json to the zone configuration.
# cat updated_nic_config.json | vmadm update bf43a067-b619-4383-bf6a-e2c44f0de575