XenServer - Rename guest within guest?
-
I built a script that I use with my Linux (CentOS) template that eases standing up Linux VMs (very handy). It walks me through IPing the host, setting the hostname, joining it to AD, and making sure it's up to date.
Something I just thought of and am wondering if it's possible is re-naming the VM from within the VM.
In my environment, the guest name as displayed in XenCenter is equal to the guest's real hostname. What I'd like to do is have my script then "apply" this name to the guest. And, even a step forward, also re-name the virtual disk too.
Is this possible?
-
I have wondered about this same as you.
Your current script, is it in ~ of the template user? It runs within the vms you make?I don't think XS can do anything with the vms it hosts other than turn on/off, migrate, suspend, delete, expand, other things like that.
If you look atxe vm-???
command list you will see all the things you can do only involve vm operation or virtual hardware actions. -
@anthonyh said in XenServer - Rename guest within guest?:
I built a script that I use with my Linux (CentOS) template that eases standing up Linux VMs (very handy). It walks me through IPing the host, setting the hostname, joining it to AD, and making sure it's up to date.
Something I just thought of and am wondering if it's possible is re-naming the VM from within the VM.
In my environment, the guest name as displayed in XenCenter is equal to the guest's real hostname. What I'd like to do is have my script then "apply" this name to the guest. And, even a step forward, also re-name the virtual disk too.
Is this possible?
Maybe you can ssh using key file to XenServer and then use your xapi commands to capture the VM name so you can rename your guest VM. You can probably to do the same with renaming virtual disk too.
-
@momurda said in XenServer - Rename guest within guest?:
I have wondered about this same as you.
Your current script, is it in ~ of the template user? It runs within the vms you make?I don't think XS can do anything with the vms it hosts other than turn on/off, migrate, suspend, delete, expand, other things like that.
If you look atxe vm-???
command list you will see all the things you can do only involve vm operation or virtual hardware actions.The script resides within the template and I manually run it when I create VMs based off the template.
-
@black3dynamite said in XenServer - Rename guest within guest?:
@anthonyh said in XenServer - Rename guest within guest?:
I built a script that I use with my Linux (CentOS) template that eases standing up Linux VMs (very handy). It walks me through IPing the host, setting the hostname, joining it to AD, and making sure it's up to date.
Something I just thought of and am wondering if it's possible is re-naming the VM from within the VM.
In my environment, the guest name as displayed in XenCenter is equal to the guest's real hostname. What I'd like to do is have my script then "apply" this name to the guest. And, even a step forward, also re-name the virtual disk too.
Is this possible?
Maybe you can ssh using key file to XenServer and then use your xapi commands to capture the VM name so you can rename your guest VM. You can probably to do the same with renaming virtual disk too.
That's not a bad idea! I may look into this.
-
I was thinking ssh too.
You would need to run ssh into your vm from xs#
then run your template script, but save the machine name info as a variable that xs can use locally
Then runxe vm-param-set uuid=uuidofvm name-label=$variable
Then runxe vdi-param-set uuid=uuidofvm name-label=$variable.disk0
Or something like that. Youll probably have to mess with single and double quotes somewhere