Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 334CC7852 for ; Fri, 25 Nov 2011 17:27:54 +0000 (UTC) Received: (qmail 11871 invoked by uid 500); 25 Nov 2011 17:27:54 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 11823 invoked by uid 500); 25 Nov 2011 17:27:54 -0000 Mailing-List: contact dev-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 dev@deltacloud.apache.org Received: (qmail 11815 invoked by uid 99); 25 Nov 2011 17:27:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Nov 2011 17:27:54 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of marios@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Nov 2011 17:27:47 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pAPHRQTi002803 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 25 Nov 2011 12:27:26 -0500 Received: from name.redhat.com (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pAPHRLKJ016584 for ; Fri, 25 Nov 2011 12:27:25 -0500 From: marios@redhat.com To: dev@deltacloud.apache.org Subject: [PATCH 1/5] CIMI::Volume to cimi/server.rb Date: Fri, 25 Nov 2011 19:27:15 +0200 Message-Id: <1322242039-30326-2-git-send-email-marios@redhat.com> In-Reply-To: <1322242039-30326-1-git-send-email-marios@redhat.com> References: <1322242039-30326-1-git-send-email-marios@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 From: marios Signed-off-by: marios --- server/lib/cimi/server.rb | 39 +++++++++++---------------------------- 1 files changed, 11 insertions(+), 28 deletions(-) diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb index 2bd3a39..85fa2f6 100644 --- a/server/lib/cimi/server.rb +++ b/server/lib/cimi/server.rb @@ -213,44 +213,27 @@ global_collection :machines do end global_collection :volumes do - description 'List all volumes' + description "Volume represents storage at either the block or file-system level. Volumes can be attached to Machines. Once attached, Volumes can be accessed by processes on that Machine" operation :index do description "List all volumes" control do - instances = driver.send(:storage_volumes, credentials, {}) - @dmtf_col_items = [] - if instances - instances.map do |instance| - new_item = { "name" => instance.id, - "href" => volume_url(instance.id) } - @dmtf_col_items.insert 0, new_item - end + volumes = Volume.all(self) + respond_to do |format| + format.xml { volumes.to_xml_cimi_collection(self) } + format.json { volumes.to_json_cimi_collection(self) } end - respond_to_collection "volume.col.xml" end end operation :show do - description "Show specific machine." - with_capability :storage_volume - param :id, :string, :required + description "Show specific Volume." + param :id, :string, :required control do - @volume = driver.send(:storage_volume, credentials, { :id => params[:id]} ) - if @volume - #setup the default values for a machine imageion - resource_default = get_resource_default "volume" - #get the actual values from image - resource_value = { "name" => @volume.id, - "status" => @volume.state, "uri" => @volume.id, - "href" => volume_url(@volume.id), - "capacity" => { "quantity" => @volume.capacity, "units" => "gigabyte"} } - #mixin actual values get from the specific image - @dmtfitem = resource_default["dmtfitem"].merge resource_value - show_resource "volumes/show", "Volume", - {"property" => "properties", "operation" => "operations"} - else - report_error(404) + volume = Volume.find(params[:id], self) + respond_to do |format| + format.xml { volume.to_xml } + format.json { volume.to_json } end end end -- 1.7.6.4