Without this patch, we could not call the reload method
of a server model instance. This is because the Fog library
would try to call the get method using the existing identity
(instance_uuid) as the key.
This patch implements the get method by instantiating a new
model instance from a set of attributes obtained from the
vmware managed object instance.
The logic reflects that inside of the backspace servers
collection implementation.
As a side effect of this patch we also get wait_for.
For example:
server = Fog::Compute[:vsphere].servers.last
server.start
server.wait_for { ipaddress }
With the introduction of the vm_clone API request, a server
may be returned in the list which does not have a complete
configuration yet. This is because the system is still in
the process of being cloned.
This is a problem because Fog would throw an undefined
method error when calling the config method of the vm managed
object instance.
This patch fixes the problem by checking if the config method
returns something and only sets attributes that are known to be
available for a cloning VM.
Without this patch we have no way to completely destroy
a server instance. This patch adds a vm_destroy API request
and implements the destroy method on the server model.
The vSphere API requires the server to be in a poweredOff state.
The model action and the request do not verify this is the case
before issuing the command.
This patch implements the start, stop and reboot methods for the Server
model instances.
These server model methods share common names with the AWS server model.
This patch also implements the API requests required to control the
power state of a VMware Virtual Machine.
The requests default to issuing shutdown and reboot commands to the
guest operating system itself. However, if force is set to true for
power_off and reboot, then the VM is powered off or reset at the virtual
hardware layer.
This patch adds a request list_virtual_machines which is responsible for
making an API connection and returning a raw "response" object from the
API.
Model instances of a Server (compute resource) are returned as a
collection through the "all" method. The Fog framework calls all on the
instance of the collection.