Hi All,
API Question: Can I automate this process a bit more ?
- Use the API to clone (fast) a drive (not the whole VM, just a drive) ?
- Use the API to shut down a VM, delete the OS drive, install the previously cloned drive, start the VM up again ?
Background: I have 150+ VM's where they have a multi drive setup:
- OS Drive. This is based on my template OS. Only the server name, IP address and DB Server config is different
- Data, Storage and Backup Drives. These three are unique to each instance.
To roll out OS and/or DB updates, I have a process where I:
- Prepare the template OS.
- Clone the template VM (normally in batches of 10-20 at a time)
- Delete the cloned templates, keeping the OS drive.
- For each of the 150+ VM's
i. Shut it down
ii. Delete the OS drive
iii. Add one of the cloned OS drives
iv. rename the drive name as appropriate
v. start up the VM
- On first start, the new OS drive has a script which runs to automatically set the server name, IP address and DB Server config (each VM's unique settings are saved in a config file on one of the other drives which my config script reads from).
I've been using this process for a number of years, 3 or 4 times a year - previously with the Windows XenCenter. This time round I tried using XO instead, but there was one step that was painful.
On XenCenter, after making 20x clones of the template. I can select all 20 and delete in one go. Before the actual delete, I can select to NOT delete the OS drive.
With XO, the only way I could figure out how to do this was individually editing each clone to disconnect the drive.
The other difference is, with XenCenter the original copy was always listed last. With XO, the original copy appeared to be in the middle of the list and more than once I ended up adding the original copy to a machine by mistake and only discovering when I went to make more clones and discovering the drive name was renamed to one of the VM's I'd just updated. I worked around this by renaming it after doing the clones, then renaming it back before creating more clones.
Cheers
Kent.