Tip: lock an instance against admin permissions
Couple of days ago I was looking for a way to lock an instance but something more powerful than a simple lock via the nova API.
First of all, an option already exists in the API, you can call it from like so:
$ nova list
Howeverer this doens’t work when the admin user performs a termination, which makes sense. But in a last hope I looked into the nova database within the instance table. I came across a row called
disable_terminate, which eventually did the trick! To enable it you have to update the row:
mysql> UPDATE SET disable_terminate = '1' FROM instances WHERE uuid = 'e1e311b2-9dc5-4290-bd53-ab3a149b4849';
Unfortunately I didn’t find any command to use this option, neither on
nova-manage. I think it’s pretty (but I might have missed something…) since apparently the row was also present in Essex. Anyway that one really saved me!