Matthew Barr
2013-05-21 22:53:27 UTC
The below code was one of the ways I found to get the ID of a guest system in Vsphere. It doesn't seem to work if ARGV[0] has a dash in it.
Ideally, this would find the ID of a guest, then shut it off.
(Other methods seems to fail to find the ID, or set the instance_uuid. )
This code has been around for a few months so the bugs behind the initial attempt might have been fixed in Fog…
(Once it's fixed & vetted, I'm happy to contribute this to the docs for Vsphere. )
----
include fog
host_name=ARGV[0]
f=Fog::Compute.new(:provider => "Vsphere" )
vm=f.get_virtual_machine(host_name)
vm["instance_uuid"] = vm["id"]
vm["force"] = true
f.vm_power_off(vm)
f.vm_destroy(vm)
----
Matthew Barr
Technical Architect
E: mbarr-q2pkGsKyZe6Kf2Id4j40wVaTQe2KTcn/@public.gmane.org
AIM: matthewbarr1
c: (646) 727-0535
Ideally, this would find the ID of a guest, then shut it off.
(Other methods seems to fail to find the ID, or set the instance_uuid. )
This code has been around for a few months so the bugs behind the initial attempt might have been fixed in Fog…
(Once it's fixed & vetted, I'm happy to contribute this to the docs for Vsphere. )
----
include fog
host_name=ARGV[0]
f=Fog::Compute.new(:provider => "Vsphere" )
vm=f.get_virtual_machine(host_name)
vm["instance_uuid"] = vm["id"]
vm["force"] = true
f.vm_power_off(vm)
f.vm_destroy(vm)
----
Matthew Barr
Technical Architect
E: mbarr-q2pkGsKyZe6Kf2Id4j40wVaTQe2KTcn/@public.gmane.org
AIM: matthewbarr1
c: (646) 727-0535
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.