Skip to content

Default hostname to name/alias when provisioning a new VM #266

@blackwood821

Description

@blackwood821

Any time I provision a VM through AdminUI such as a native SmartOS zone and then SSH into the zone, the hostname is the UUID which makes for an unfriendly PS1 so I need to run mdata-get sdc:alias > /etc/nodename && reboot to change it but that won't persist across reprovisions. It seems like creating a VM via node-triton (CloudAPI) defaults the hostname to the VM name/alias so AdminUI should be consistent.

I also tried manually calling VMAPI after the VM was provisioned to update the hostname but according to the documentation hostname is not a field that can be updated.

[root@headnode (neptune) ~]# sdc-vmapi /vms/73d03c63-c00a-4c67-bc5c-3047eeb78312?action=update -X POST -d '{"hostname":"nginx"}'
HTTP/1.1 409 Conflict
Connection: close
Content-Type: application/json
Content-Length: 77
Date: Fri, 06 May 2022 19:09:57 GMT
Server: VMAPI/9.14.1
x-request-id: 9cd50b8b-8468-42d5-88f8-0f386a65a189
x-response-time: 19
x-server-name: 50172949-5150-42ba-967d-c1e3434820d9

{
  "code": "ValidationFailed",
  "message": "No VM parameters provided",
  "errors": []
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions