Return-Path: X-Original-To: apmail-incubator-deltacloud-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-deltacloud-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C902B6FC1 for ; Fri, 15 Jul 2011 08:37:35 +0000 (UTC) Received: (qmail 62818 invoked by uid 500); 15 Jul 2011 08:37:34 -0000 Delivered-To: apmail-incubator-deltacloud-commits-archive@incubator.apache.org Received: (qmail 62730 invoked by uid 500); 15 Jul 2011 08:37:24 -0000 Mailing-List: contact deltacloud-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-commits@incubator.apache.org Received: (qmail 62689 invoked by uid 99); 15 Jul 2011 08:37:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jul 2011 08:37:20 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jul 2011 08:37:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B940F23888C2; Fri, 15 Jul 2011 08:36:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1147018 - in /incubator/deltacloud/trunk/server: lib/deltacloud/drivers/ec2/ec2_driver.rb lib/deltacloud/drivers/vsphere/vsphere_driver.rb server.rb views/images/show.html.haml Date: Fri, 15 Jul 2011 08:36:53 -0000 To: deltacloud-commits@incubator.apache.org From: mfojtik@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110715083653.B940F23888C2@eris.apache.org> Author: mfojtik Date: Fri Jul 15 08:36:52 2011 New Revision: 1147018 URL: http://svn.apache.org/viewvc?rev=1147018&view=rev Log: Added destroy method for image for VSphere and EC2 Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb incubator/deltacloud/trunk/server/server.rb incubator/deltacloud/trunk/server/views/images/show.html.haml Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb?rev=1147018&r1=1147017&r2=1147018&view=diff ============================================================================== --- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb (original) +++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb Fri Jul 15 08:36:52 2011 @@ -169,6 +169,15 @@ module Deltacloud end end + def destroy_image(credentials, image_id) + ec2 = new_client(credentials) + safely do + unless ec2.deregister_image(image_id) + raise "ERROR: Unable to deregister AMI" + end + end + end + def instances(credentials, opts={}) ec2 = new_client(credentials) inst_arr = [] Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb?rev=1147018&r1=1147017&r2=1147018&view=diff ============================================================================== --- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb (original) +++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb Fri Jul 15 08:36:52 2011 @@ -256,10 +256,12 @@ module Deltacloud::Drivers::VSphere # Destroy an instance, given its id. Note that this will destory all # instance data. - def destroy_instance(credentials, id) - find_vm(credentials, id)[:instance].Destroy_Task.wait_for_completion + def destroy_instance(credentials, instance_id) + find_vm(credentials, instance_id)[:instance].Destroy_Task.wait_for_completion end + alias :destroy_image :destroy_instance + exceptions do on /InvalidLogin/ do Modified: incubator/deltacloud/trunk/server/server.rb URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/server.rb?rev=1147018&r1=1147017&r2=1147018&view=diff ============================================================================== --- incubator/deltacloud/trunk/server/server.rb (original) +++ incubator/deltacloud/trunk/server/server.rb Fri Jul 15 08:36:52 2011 @@ -214,6 +214,20 @@ END end end + operation :destroy do + description "Remove specified image from collection" + with_capability :destroy_image + param :id, :string, :required + control do + driver.destroy_image(credentials, params[:id]) + respond_to do |format| + format.xml { status 204 } + format.json { status 204 } + format.html { redirect(images_url) } + end + end + end + end collection :instance_states do Modified: incubator/deltacloud/trunk/server/views/images/show.html.haml URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/images/show.html.haml?rev=1147018&r1=1147017&r2=1147018&view=diff ============================================================================== --- incubator/deltacloud/trunk/server/views/images/show.html.haml (original) +++ incubator/deltacloud/trunk/server/views/images/show.html.haml Fri Jul 15 08:36:52 2011 @@ -19,3 +19,4 @@ %dt %dd = link_to 'Launch', api_url_for("instances/new?image_id=#{@image.id}") + = link_to_action 'Destroy', destroy_image_url(@image.id), :delete