You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cloudstack.apache.org by "Joe Y." <jy...@gmail.com> on 2014/12/18 19:15:20 UTC

Script to destroy vms

Can anyone point me to a script or way of destroying virtual machines via
cli? In cloud monkey I only see destroy by I'd but I'd like to be able to
via display name...thanks for the help!

Re: Script to destroy vms

Posted by Daan Hoogland <da...@gmail.com>.
you'll have to write a bit of script to search the id for the vm first.

On Thu, Dec 18, 2014 at 7:15 PM, Joe Y. <jy...@gmail.com> wrote:
> Can anyone point me to a script or way of destroying virtual machines via
> cli? In cloud monkey I only see destroy by I'd but I'd like to be able to
> via display name...thanks for the help!



-- 
Daan

RE: Script to destroy vms

Posted by Simon Fiddaman <s....@tech.leaseweb.com>.
Joe,

Something like this should work:

DISPLAY_NAME="supercoolwebserver" cloudmonkey destroy virtualmachine id=$( cloudmonkey list virtualmachines filter=id displayname=${DISPLAY_NAME} | awk -F'"' '/id/ {print $4}' )

Depending on how you've named your instances, you may need 'name=' or 'displayname='.

Note this won't expunge the instance (add expunge=true to the destroy command to do this, or use the expunge command). The recover command (also requires the machine id) will bring a destroyed (but not expunged) instance back to life if you've made a mistake.

Hope this helps.


Kind regards,

Simon Fiddaman
Innovation Engineer
LeaseWeb Technologies B.V.

T: +31 20 316 0235
M:
E: s.fiddaman@tech.leaseweb.com
W: http://www.leaseweb.com

Luttenbergweg 8, 1101 EC Amsterdam, Netherlands


-----Original Message-----
From: Joe Y. [mailto:jyduck@gmail.com]
Sent: Thursday, December 18, 2014 1:15 PM
To: users@cloudstack.apache.org
Subject: Script to destroy vms

Can anyone point me to a script or way of destroying virtual machines via cli? In cloud monkey I only see destroy by I'd but I'd like to be able to via display name...thanks for the help!