You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by "Ellinger, David" <de...@ltionline.com> on 2013/06/03 19:15:25 UTC

Amazon EC2 -- Defining actions based on Instance Type

I have been working on modifying the EC2 Driver to accommodate "EBS" backed instance ("persistent") and "S3 backed" instances (transient). At the moment the deltacloud actions are for S3 backed instanced. So when "STOP" is used, the instance is terminated.

I have a requirement to make it so I can perform a "STOP" on EBS backed instances. 

So I've modified the EC2 driver to have a new Finite State Machine for "instance states", now when STOP is performed, the state goes to "stopped" instead of "finish", and then when DESTROY is performed the instance state goes to "finish". 

This works great with persistent instances, but now I have an issue with transient instances. Since STOP is not an applicable EC2 action for these instances, I get an EC2 error.

My solution ---

I would like to make it so when "STOP" is performed, it checks to see if the instance is persistent or transient. If it is persistent, then I would like to perform the STOP action, otherwise if it is transient I would like to perform the DESTROY action.

I unfortunately am not familiar enough with Ruby to make this particular change. So I'm asking if anyone knows of a better solution, or how to check the instance type and where that should be implemented in the driver.

I appreciate any assistance on this,

Thank you




Re: Amazon EC2 -- Defining actions based on Instance Type

Posted by "marios@redhat.com" <ma...@redhat.com>.
On 05/06/13 12:23, marios@redhat.com wrote:
> On 03/06/13 20:15, Ellinger, David wrote:
>> I have been working on modifying the EC2 Driver to accommodate "EBS" backed instance ("persistent") and "S3 backed" instances (transient). At the moment the deltacloud actions are for S3 backed instanced. So when "STOP" is used, the instance is terminated.
> 
> thanks for taking the lead on this David
> 
>>
>> I have a requirement to make it so I can perform a "STOP" on EBS backed instances. 
>>
>> So I've modified the EC2 driver to have a new Finite State Machine for "instance states", now when STOP is performed, the state goes to "stopped" instead of "finish", and then when DESTROY is performed the instance state goes to "finish". 
>>
>> This works great with persistent instances, but now I have an issue with transient instances. Since STOP is not an applicable EC2 action for these instances, I get an EC2 error.
>>
>> My solution ---
>>
>> I would like to make it so when "STOP" is performed, it checks to see if the instance is persistent or transient. If it is persistent, then I would like to perform the STOP action, otherwise if it is transient I would like to perform the DESTROY action.
>>
>> I unfortunately am not familiar enough with Ruby to make this particular change. So I'm asking if anyone knows of a better solution, or how to check the instance type and where that should be implemented in the driver.
>>
> 
> it looks like you've had a good go at doing this with
> https://github.com/deltacloud/deltacloud-core/pull/44 ? I put a comment
> on that pull request - it's been a while since I've looked at the ec2
> driver or the way we define the state machines (and where/how they're
> used - like for determining the list of available actions to advertise
> for a given instance). I need to spend some more time on this but can't
> today - in any case I hope to get a proper response to you asap,
> 

Hi David - I spent some more time on this today - please see my comments
on github @
https://github.com/deltacloud/deltacloud-core/pull/44#issuecomment-19095397

thanks again, marios

> all the best, marios
> 
>> I appreciate any assistance on this,
>>
>> Thank you
>>
>>
>>
> 


Re: Amazon EC2 -- Defining actions based on Instance Type

Posted by "marios@redhat.com" <ma...@redhat.com>.
On 03/06/13 20:15, Ellinger, David wrote:
> I have been working on modifying the EC2 Driver to accommodate "EBS" backed instance ("persistent") and "S3 backed" instances (transient). At the moment the deltacloud actions are for S3 backed instanced. So when "STOP" is used, the instance is terminated.

thanks for taking the lead on this David

> 
> I have a requirement to make it so I can perform a "STOP" on EBS backed instances. 
> 
> So I've modified the EC2 driver to have a new Finite State Machine for "instance states", now when STOP is performed, the state goes to "stopped" instead of "finish", and then when DESTROY is performed the instance state goes to "finish". 
> 
> This works great with persistent instances, but now I have an issue with transient instances. Since STOP is not an applicable EC2 action for these instances, I get an EC2 error.
> 
> My solution ---
> 
> I would like to make it so when "STOP" is performed, it checks to see if the instance is persistent or transient. If it is persistent, then I would like to perform the STOP action, otherwise if it is transient I would like to perform the DESTROY action.
> 
> I unfortunately am not familiar enough with Ruby to make this particular change. So I'm asking if anyone knows of a better solution, or how to check the instance type and where that should be implemented in the driver.
> 

it looks like you've had a good go at doing this with
https://github.com/deltacloud/deltacloud-core/pull/44 ? I put a comment
on that pull request - it's been a while since I've looked at the ec2
driver or the way we define the state machines (and where/how they're
used - like for determining the list of available actions to advertise
for a given instance). I need to spend some more time on this but can't
today - in any case I hope to get a proper response to you asap,

all the best, marios

> I appreciate any assistance on this,
> 
> Thank you
> 
> 
>