1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
Commit graph

31 commits

Author SHA1 Message Date
Ohad Levy
d681420552 Merge pull request #1763 from grimme-atix-de/customfields
[VSphere] Added VMware customvalue and customfields to read the annotatitions for each VM
2013-05-05 05:06:56 -07:00
Marc Grimme
38c3bb1ba4 [vSphere] Refactor and extend network interface methods (similar to the ovirt implementation)
* added methods to add, remove and update interfaces for vSphere
* added missing method to retrieve the interface
* added existing attribute key to interface (required for modifying, deleting interfaces)
* alias interface's mac to id
2013-04-23 10:52:52 +02:00
Marc Grimme
d68806965a [VSphere] Added VMware customvalue and customfields to read the annotations for each VM. 2013-04-18 12:50:00 +02:00
Mick Pollard
5f9c927f98 [vsphere|compute] fix incorrect filters.merge in networks model 2013-04-08 20:08:24 +10:00
Tejas Ravindra Mandke
036a037074 [vsphere|compute] Switch some attributes to lazyload 2013-04-04 22:55:09 -07:00
Mick Pollard
99e7a09f78 fix bug where servers.all was ignoring filters due to hash merging in the wrong direction. 2013-03-18 08:28:31 +11:00
Paul Thornthwaite
e8630a0083 [vsphere|compute] Updates reference to service 2013-01-07 21:01:24 +00:00
Paul Thornthwaite
40c0cd7122 Make use of #persisted? method
In many places we were checking for identity which was the shorthand for
checking if the resource had been saved by the service.

The #persisted? method was added to show a clearer intent and also offer
minimal ActiveModel interface
2012-12-23 02:45:05 +00:00
Wesley Beary
f21f721c0a Merge pull request #1399 from maestrodev/vsphere_public_ip
[vsphere] Add vsphere public_ip_address correctly
2012-12-21 08:55:18 -08:00
Carlos Sanchez
dc5fc6cc66 Add vsphere public_ip_address correctly
Deprecate ipaddress
2012-12-21 17:31:14 +01:00
Nick Huanca
258275929b Added a new attribute to server model (relative_path)
cleaned up clone function from server model
Added better use of resource pool, dest_folder
Added new datastore selection, simplified vm_clone.rb
Added Customization specs for linux machines
Added a new call from datacenters method to grab virtual_servers in datacenter
2012-12-01 07:48:18 -07:00
Nick Huanca
44ddaae200 Added new output to vm_clone.rb
Fixed 'path' attribute on server model
fixed server.clone function and added some documentation.
2012-12-01 06:42:13 -07:00
Ohad Levy
825ff12119 [vsphere] ensure reload works correctly for server 2012-11-15 09:02:42 +02:00
Ohad Levy
b70e972a58 VMWare vsphere provider refactor
missing:
- new model tests
- templates model
- clone

this patch includes a lot of changes and cleanups, exposing more fog
collections/models and rewriting most requests
it includes valuable feedback from endzyme <nick.huanca@gmail.com>
2012-11-14 15:31:02 +02:00
Carlos Sanchez
a25691ed23 Move ssh private_key, public_key, username to Server model to reduce duplication 2012-10-31 12:31:49 +01:00
Carlos Sanchez
49946e0c8f Stop vSphere vms before destroying, or destroy will fail 2012-07-18 16:49:08 -07:00
Ohad Levy
1497124853 [vsphere] adds support to get and set vnc console 2012-03-28 13:48:14 +02:00
Ohad Levy
735a8822cc [vsphere] adds memory and cpu server attributes 2012-03-28 13:48:14 +02:00
Ohad Levy
0644377c60 [vsphere] force poweroff of instance of vmware tools are not installed 2012-03-28 13:48:07 +02:00
Eric Stonfer
9fdbd35415 add host based vmotion 2012-02-27 10:14:31 -05:00
Eric Stonfer
68c18a9ec3 add vm reconfiguration functions for memory cpu / generic spec 2012-01-31 15:43:48 -05:00
Eric Stonfer
88a32dd5ea This patch allows the ability to create 'blank' vms in vsphere 2012-01-21 16:45:34 -05:00
Jeff McCune
a36f3888e3 [vsphere] (#10644) Add servers filter to improve clone performance
The behavior without this patch is that the performance of the vm_clone
operation in unacceptably slow for VMware vCenter deployments with
multiple hundreds of virtual machines.

Performance is unacceptable because the vm_clone operation makes
multiple API calls to list _all_ of the VM's in the inventory.  This
patch eliminates the need to list all VM's by adding path and folder
filters to limit our API calls to subtrees of the VMware inventory.

= API Changes =

 * New datacenters request that caches the Datacenter objects for the
   life of the process.
 * New clone() method on the server model that returns a server model of
   the new VM even if it is not yet done cloning.
 * Ability to limit collections to inventory paths by passing the
 * 'folder' filter to the servers collection.  For example:
   `conn = Fog::Compute[:vsphere];
    conn.servers('path' => '/Datacenters/DC1/vm/Templates')`
   this filter will greatly reduce the number of SOAP API calls by
   limiting the server models in the collection to only those in the
   Templates inventory folder.  Note, this is not recursive yet.

= Tests =

Tests have been updated.  The vm_clone request no longer takes an
instance_uuid because we cannot actually use this to search the
inventory efficiently.  Instead, the vm_clone request now requires a
path attribute to allow Fog to search only a subset of the inventory.
2011-11-12 09:39:14 -08:00
Carl Caum
762aa624ac Adding a path attribute to the vm_mob_ref hash
This patch adds a new `path` attribute to the vm_mob_ref hash returned
by the `convert_vm_mob_ref_to_attr_hash` method. In order to support the
new `path` attribute, this patch also adds a new `get_folder_path` method
to the `list_virtual_machines` vsphere module.
2011-11-07 13:42:37 -05:00
Jeff McCune
743882f032 Refactor requests to return simple hashes and add unit tests
This massive commit refactors all of the request methods on the
Fog::Compute[:vsphere] instance to return simple hashes.  The behavior
before this commit returned full vmware object references which was a
problem because it was difficult to unit test.

With this patch, it is much easier to add and maintain Mock
implementations of the request methods.  This makes adding behavior
tests for the server model much easier.

In addition, test coverage using Shindo has been added.  Previously
there was little test coverage of the behavior.

To run the tests:

    shindont tests/vsphere/
2011-09-10 15:11:18 -07:00
Jeff McCune
dc9a2e4808 (#9124) Add ability to reload the model of a cloning VM
Without this patch it is very difficult to reload the model of a VM in
the process of being cloned.  All we have is the vmware managed object
reference ID string and the name of the VM.

This patch adds a number of improvements:

First, the model of a VM being cloned can reload itself after the VM
finishes cloning, even though we don't have an instance_uuid until the
clone completes.

Because the model can reload itself, it's now possible to do something
like:

    c = Fog::Compute[:vsphere]
    new_vm_name = "test"
    c.vm_clone(:instance_uuid => "abc123", :name => new_vm_name)
    my_new_vm = c.servers.find { |vm| vm.name == new_vm_name }
    my_new_vm.wait_for { uuid }
    puts "New VM is ready! (It has a UUID)"
    my_new_vm.wait_for { ipaddress }
    puts "New VM is on the network!"

Without this patch, a VM model could not reload itself with an id of
'vm-123', reloading the model only works if the ID is a UUID.

In addition, a number of the attributes of the server model have been
adjusted to be nil values when the VM is in the process of cloning.
This makes it easier to use wait_for conditionals in blocks.
2011-09-10 13:32:59 -07:00
Jeff McCune
96ada81149 (#9241) Make the reload action of the server models work
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 }
2011-09-10 13:32:58 -07:00
Jeff McCune
27a689b951 (#9241) Don't fail when trying to model a cloning VM
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.
2011-09-10 13:32:58 -07:00
Jeff McCune
4264b1f99c (#9241) Add destroy API request and model action
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.
2011-09-10 13:32:58 -07:00
Jeff McCune
cb4e9701b5 (#9421) Add start, stop, reboot server model methods
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.
2011-09-10 13:32:58 -07:00
Jeff McCune
8bc5c768ec (#9241) Add model for Fog::Compute[:vsphere].servers
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.
2011-09-10 13:32:58 -07:00