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

2832 commits

Author SHA1 Message Date
Paul Thornthwaite
1f5b152839 [compute|brightbox] Fixed typo in connection options 2011-09-19 17:30:07 +01:00
Patrick Debois
0ec38a2587 fixed missing disk-> volume conversion 2011-09-19 14:23:08 +02:00
Wesley Beary
e1f5bfda27 Merge pull request from extraordinaire/master
Add snapshot method to aws volume model
2011-09-17 08:47:29 -07:00
Andrei Serdeliuc
eff4e07947 [aws|compute] add snapshot method to volume model 2011-09-17 10:50:02 +01:00
Wesley Beary
271b512146 Merge pull request from minter/properly_encode_uris
Better URL escaping for Rackspace Cloud Files.
2011-09-16 22:18:56 -07:00
H. Wade Minter
934ff8a993 Better URL escaping for Rackspace Cloud Files.
URI.escape doesn't encode question marks properly, CGI.escape doesn't encode
spaces properly.  So we create an escape class method for Fog::Rackspace that
does the CGI.escape methods, only encoding spaces as %20.

This makes things work properly with Rackspace Cloud Files.
2011-09-16 23:52:55 -04:00
Patrick Debois
cb1d5919f0 [vmfusion|compute] fixed destroy function 2011-09-16 15:47:20 +02:00
Patrick Debois
1a576820ae vmfusion provider , requires the fission gem (pull request pending) 2011-09-16 14:57:00 +02:00
Paul Thornthwaite
34f44a36a2 [compute|brightbox] Updated Format test to remove gone fields 2011-09-16 09:34:20 +01:00
geemus
7b4a517cbf [core] don't rely on bin stuff for service init in tests
closes 
2011-09-15 08:01:37 -05:00
Patrick Debois
b1f39c09ba Merge pull request from jeffmccune/issue/master/fix_vm_clone_when_instance_uuid_is_not_a_string
[vsphere] Fix vm clone problem when a Guid instance is passed as the instance_uuid
2011-09-14 10:27:54 -07:00
Jeff McCune
dd9e132de5 Fix vm clone problem when a Guid instance is passed as the instance_uuid
Without this patch the vm_clone requiest would not find a Managed Object
Reference when a UUID that is not a string is passed as the
instance_uuid option.  This is a problem because an unhelpful "undefined
method `parent' for nil:NilClass" would be thrown to the application.

This patch throws a more helpful Fog::Compute::Vsphere::NotFound
exception if the Virtual Machine template is not found.

The tests have been updated to reflect this expectation.
2011-09-14 10:15:19 -07:00
Jeff McCune
91cd093cab Merge pull request from jeffmccune/feature/master/vsphere_server_attribute
[vsphere] Add vsphere_server connection attribute

 * Small patch with tests, merging my own code.
2011-09-14 09:31:36 -07:00
Jeff McCune
19cf9d7784 Add vsphere_server connection attribute
Without this patch it was difficult to figure out from the outside what
vSphere server Fog connected to.  The application using Fog should be
able to easily print out the connection information without breaking the
encapsulation Fog provides.

This patch makes the connected vSphere server hostname and API username
an attribute of the connection instance.

The tests have been updated to validate these attribute accessor
methods.
2011-09-14 09:29:30 -07:00
Dylan Egan
48b2f590aa [aws|compute] raise an ArgumentError if image_id is nil, otherwise an ugly InternalError is returned from AWS. 2011-09-14 11:35:22 +01:00
Patrick Debois
a842b3699e [Libvirt|Compute] renamed all disk_ params for server creation to volume_ to make it consistent with the object type volume 2011-09-14 09:33:58 +02:00
Patrick Debois
78233fd619 [doc] corrected the link to the actual blogpost instead of the github markdown page :) 2011-09-14 08:52:05 +02:00
Patrick Debois
ac93033f3c [doc] Added blogpost about libvirt into fog to the press page 2011-09-14 08:33:38 +02:00
Patrick Debois
4740174f12 [Libvirt] renamed 'raw' connection to raw in the Fog Connection
Because the initial provider was copied from the virtualbox example we ended up with a notation
connection.connection for the raw provider

The function of the raw are injected on the connection object. Still in analogy with the raw
for server , volume, ... it makes sense to rename connection.connection to connection.raw

Also all calls to the raw connection are now explicit
2011-09-13 07:34:18 +02:00
Patrick Debois
3d7adcf7ca [Libvirt] added blocked state and corrected crashed to shutoff state 2011-09-12 20:28:09 +02:00
Patrick Debois
3a6ab8e600 [Libvirt] rename xml_desc to xml as an attribute and hide all non_dynamic attributes from fog console 2011-09-12 20:11:58 +02:00
Patrick Debois
f23155c4f2 [Libvirt] Remove the newlines after running the local ip_command 2011-09-12 20:01:20 +03:00
Patrick Debois
22e804c3a9 [Libvirt] more specific error if the ip_command results in string that has no ip-address format 2011-09-12 19:55:36 +03:00
Patrick Debois
384b7e528d [Libvirt] initialize the ip_address as an empty string 2011-09-12 18:42:16 +03:00
Patrick Debois
31ab178dac [Libvirt] corrected typo for appending string output to IO.popen 2011-09-12 18:36:50 +03:00
Patrick Debois
308569b016 [Libvirt] Provided better solution for ip_command : use shell variable instead of ruby string for mac-address 2011-09-12 18:33:38 +03:00
Patrick Debois
7e1bc34f29 [Libvirt] Enable to pass an libvirt_ip_command for looking up the mac -> ip_address . Using eval to allow for passing of mac address in ip_command 2011-09-12 18:22:37 +03:00
geemus
40826101d7 [docs] add note about ec2 default username
closes 
2011-09-12 10:06:23 -05:00
geemus
ffd01e51dd [core] pass connection_options through service init
closes 
2011-09-12 10:01:56 -05:00
Patrick Debois
544ae281eb [Libvirt] if transport is empty, ssh can't be enabled 2011-09-12 17:52:20 +03:00
Patrick Debois
3c38d42776 [libvirt] Corrected template variable from interface_nat_network to network_nat_network 2011-09-12 17:43:35 +03:00
Patrick Debois
67741dfb3a [libvirt] Added option libvirt_ip_command to the credentials error page 2011-09-12 17:12:32 +03:00
Patrick Debois
0edd5157fd Made libvirt username param consistent with other providers libvirt_user -> libvirt_username 2011-09-12 17:10:12 +03:00
Patrick Debois
b47ca4f761 Added libvirt options to credentials error 2011-09-12 17:08:29 +03:00
Wesley Beary
1c46d66c9a Merge pull request from jbraeuer/tiny-fixes
[aws|cloudwatch] Fix whitespace.
2011-09-12 06:17:36 -07:00
Jens Braeuer
0527642bfa [aws|cloudwatch] Fix whitespace. 2011-09-12 09:56:59 +02:00
Wesley Beary
c7f3194cff Merge pull request from jeffmccune/feature/master/vsphere_provider_with_tests
[vsphere] vsphere provider with tests
2011-09-11 16:30:17 -07: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 () 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 () 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 () 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
ef2833cb20 () Add vm_clone API request
Without this patch we have no way to clone a new VM
from a template.  This patch adds the vm_clone request
which takes an instance uuid as the source template
to clone from an a name parameter which is the new VM's
name.

The clone operation is handled asynchronously as a vSphere
task object.  The clone request does not return a handle
for this task, which may make it difficult to monitor
the progress of the clone operation from Fog.  A future
enhancement may be to clone and return the task object
itself to monitor progress.
2011-09-10 13:32:58 -07:00
Jeff McCune
856eb7e033 () Add find_template_by_instance_uuid request
Without this patch we did not have a convenient way to find
a template by instance UUID.  We could only find virtual
machines by instance UUID, which may or may not be a template.

This patch adds a specific request to obtain the VMware managed
object instance of of a specific template.  This is necessary
plumbing for the clone request.
2011-09-10 13:32:58 -07:00
Jeff McCune
4264b1f99c () 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 () 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
d6fed7e4e4 () Add ability to find VMs by UUID
This patch adds two request methods to the compute service for VMware.
First, finding a VM by it's own UUID (from the vmx file) is supported.
This UUID is not guaranteed to be unique so this patch also implements
finding by instance UUID which is guaranteed to be unique.

The server models will primarily use these requests to obtain VM
managed objects to issue commands against.
2011-09-10 13:32:58 -07:00
Jeff McCune
00fbdaa932 () Add test skeleton framework
Without this patch the change set currently has no framework for testing
the Vsphere provider.  This patch doesn't actually test anything, but
does add the skeleton code to being testing mocked versions of other
code.

Particularly, we're going to take the approach of completely mocking the
@connection instance variable of the Compute instance.  This will allow
us to set expectations and return things from the underlying vmware API
library.
2011-09-10 13:32:58 -07:00
Jeff McCune
8bc5c768ec () 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
Jeff McCune
cf75fb1358 () Add current_time request
Without this patch, no actual API calls are being made through the Fog
layer to the underlying rbvmobi later and ultimately to the vSphere
target API.

This patch adds a simple current_time request which is similar to a
"ping"  The layers and API are exercised fully using this simple API
call to retrieve the current time on the remote system.

This provides:

    >> Fog::Compute[:vsphere].current_time
    Tue Aug 30 20:46:27 UTC 2011
    >> Fog::Compute[:vsphere].requests
    [:current_time]
2011-09-10 13:32:58 -07:00
Jeff McCune
ec32398811 () Add SSL verification
Without this patch we were blindly trusting the remote end of our API
connection is who they claim to be.  This is an insecure state because
we leave ourselves open to a man in the middle attack.

This patch adds a vsphere_expected_pubkey_hash setting for the Vsphere
provider.  This setting is expected to be the SHA256 hex digest string
of the PEM encoded text of the RSA public key.

The first time an end user connects this string is displayed to them in
the error message.  They need simply copy and paste it into ~/.fog to
securely connect to the remote end.

For example:

   :vspherebadpw:
     :vsphere_server: vc01.acme.lan
     :vsphere_username: api_login
     :vsphere_password: badpassword
     :vsphere_expected_pubkey_hash: 431dd...
2011-09-10 13:32:58 -07:00