Return-Path: X-Original-To: apmail-deltacloud-commits-archive@www.apache.org Delivered-To: apmail-deltacloud-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 87C56DF22 for ; Wed, 14 Nov 2012 09:28:26 +0000 (UTC) Received: (qmail 50209 invoked by uid 500); 14 Nov 2012 09:28:26 -0000 Delivered-To: apmail-deltacloud-commits-archive@deltacloud.apache.org Received: (qmail 50137 invoked by uid 500); 14 Nov 2012 09:28:25 -0000 Mailing-List: contact commits-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list commits@deltacloud.apache.org Received: (qmail 49947 invoked by uid 99); 14 Nov 2012 09:28:24 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Nov 2012 09:28:24 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BA4F355E3A; Wed, 14 Nov 2012 09:28:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: marios@apache.org To: commits@deltacloud.apache.org X-Mailer: ASF-Git Admin Mailer Subject: git commit: CIMI - fix stop/restart actions on Machine (DTACLOUD-367 and DTACLOUD-368) Message-Id: <20121114092823.BA4F355E3A@tyr.zones.apache.org> Date: Wed, 14 Nov 2012 09:28:23 +0000 (UTC) Updated Branches: refs/heads/master 5ed52fc7a -> d8392739f CIMI - fix stop/restart actions on Machine (DTACLOUD-367 and DTACLOUD-368) https://issues.apache.org/jira/browse/DTACLOUD-367 https://issues.apache.org/jira/browse/DTACLOUD-368 Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/d8392739 Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/d8392739 Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/d8392739 Branch: refs/heads/master Commit: d8392739f02ad8f5b269390250afd11be81b9394 Parents: 5ed52fc Author: marios Authored: Wed Nov 14 11:15:19 2012 +0200 Committer: marios Committed: Wed Nov 14 11:27:57 2012 +0200 ---------------------------------------------------------------------- server/lib/cimi/collections/machines.rb | 6 +++--- server/lib/cimi/models/machine.rb | 2 +- .../drivers/openstack/openstack_driver.rb | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltacloud/blob/d8392739/server/lib/cimi/collections/machines.rb ---------------------------------------------------------------------- diff --git a/server/lib/cimi/collections/machines.rb b/server/lib/cimi/collections/machines.rb index 6fdfbc2..1ae71e6 100644 --- a/server/lib/cimi/collections/machines.rb +++ b/server/lib/cimi/collections/machines.rb @@ -85,15 +85,15 @@ module CIMI::Collections end end - action :restart, :with_capability => :restart_instance do + action :restart, :with_capability => :reboot_instance do description "Start specific machine." param :id, :string, :required control do machine = Machine.find(params[:id], self) if request.content_type.end_with?("json") - action = Action.from_json(request.body.read) + action = Action.from_json(request.body.read.gsub("restart", "reboot")) else - action = Action.from_xml(request.body.read) + action = Action.from_xml(request.body.read.gsub("restart", "reboot")) end machine.perform(action, self) do |operation| no_content_with_status(202) if operation.success? http://git-wip-us.apache.org/repos/asf/deltacloud/blob/d8392739/server/lib/cimi/models/machine.rb ---------------------------------------------------------------------- diff --git a/server/lib/cimi/models/machine.rb b/server/lib/cimi/models/machine.rb index 648c395..1958806 100644 --- a/server/lib/cimi/models/machine.rb +++ b/server/lib/cimi/models/machine.rb @@ -79,7 +79,7 @@ class CIMI::Model::Machine < CIMI::Model::Base def perform(action, context, &block) begin - if context.driver.send(:"#{action.name}_instance", context.credentials, self.name) + if context.driver.send(:"#{action.name}_instance", context.credentials, self.id.split("/").last) block.callback :success else raise "Operation failed to execute on given Machine" http://git-wip-us.apache.org/repos/asf/deltacloud/blob/d8392739/server/lib/deltacloud/drivers/openstack/openstack_driver.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb index 0f3c97a..6425d1b 100644 --- a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb +++ b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb @@ -173,10 +173,10 @@ module Deltacloud end if opts[:keyname] && opts[:keyname].length > 0 params[:key_name]=opts[:keyname] - end - if opts[:user_data] && opts[:user_data].length > 0 - params[:user_data]=Base64.encode64(opts[:user_data]) - end + end + if opts[:user_data] && opts[:user_data].length > 0 + params[:user_data]=Base64.encode64(opts[:user_data]) + end safely do server = os.create_server(params) result = convert_from_server(server, os.connection.authuser)