Return-Path: X-Original-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BD8A99540 for ; Fri, 18 Nov 2011 09:39:58 +0000 (UTC) Received: (qmail 15167 invoked by uid 500); 18 Nov 2011 09:39:58 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 15140 invoked by uid 500); 18 Nov 2011 09:39:58 -0000 Mailing-List: contact deltacloud-dev-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-dev@incubator.apache.org Received: (qmail 15132 invoked by uid 99); 18 Nov 2011 09:39:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Nov 2011 09:39:58 +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 (nike.apache.org: domain of mfojtik@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, 18 Nov 2011 09:39:52 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pAI9dUXD010848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 18 Nov 2011 04:39:30 -0500 Received: from dhcp-29-121.brq.redhat.com (dhcp-29-121.brq.redhat.com [10.34.29.121]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pAI9dSTx002689; Fri, 18 Nov 2011 04:39:29 -0500 Message-ID: <4EC62804.5080309@redhat.com> Date: Fri, 18 Nov 2011 10:40:20 +0100 From: Michal Fojtik User-Agent: Postbox 3.0.0 (Macintosh/20111031) MIME-Version: 1.0 To: deltacloud-dev@incubator.apache.org Subject: Re: [PATCH] Adds CIMI Volume model and spec data/test References: <1321608325-857-1-git-send-email-marios@redhat.com> In-Reply-To: <1321608325-857-1-git-send-email-marios@redhat.com> X-Enigmail-Version: 1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Virus-Checked: Checked by ClamAV on apache.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 ACK. -- Michal marios@redhat.com wrote: > From: marios > > > Signed-off-by: marios --- > server/lib/cimi/model.rb | 1 + > server/lib/cimi/model/volume.rb | 31 > ++++++++++++++++++++++++++++ server/spec/cimi/data/volume.json | > 16 ++++++++++++++ server/spec/cimi/data/volume.xml | 12 > +++++++++++ server/spec/cimi/model/volume_spec.rb | 36 > +++++++++++++++++++++++++++++++++ 5 files changed, 96 insertions(+), > 0 deletions(-) create mode 100644 server/lib/cimi/model/volume.rb > create mode 100644 server/spec/cimi/data/volume.json create mode > 100644 server/spec/cimi/data/volume.xml create mode 100644 > server/spec/cimi/model/volume_spec.rb > > diff --git a/server/lib/cimi/model.rb b/server/lib/cimi/model.rb > index 1e4a34a..c436074 100644 --- a/server/lib/cimi/model.rb +++ > b/server/lib/cimi/model.rb @@ -25,3 +25,4 @@ require > 'cimi/model/base' require 'cimi/model/machine_template' require > 'cimi/model/machine_image' require > 'cimi/model/machine_configuration' +require 'cimi/model/volume' diff > --git a/server/lib/cimi/model/volume.rb > b/server/lib/cimi/model/volume.rb new file mode 100644 index > 0000000..b83fcc3 --- /dev/null +++ b/server/lib/cimi/model/volume.rb > @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) > under one or more +# contributor license agreements. See the NOTICE > file distributed with +# this work for additional information > regarding copyright ownership. The +# ASF licenses this file to you > under the Apache License, Version 2.0 (the +# "License"); you may not > use this file except in compliance with the +# License. You may > obtain a copy of the License at +# +# > http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by > applicable law or agreed to in writing, software +# distributed under > the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES > OR CONDITIONS OF ANY KIND, either express or implied. See the +# > License for the specific language governing permissions and > limitations +# under the License. + +class CIMI::Model::Volume < > CIMI::Model::Base + struct :capacity do + scalar :quantity + > scalar :units + end + text :bootable + text :supports_snapshots + > array :snapshots do + scalar :ref + end + text :guest_interface > + array :meters do + scalar :ref + end + scalar :eventlog +end > diff --git a/server/spec/cimi/data/volume.json > b/server/spec/cimi/data/volume.json new file mode 100644 index > 0000000..af22517 --- /dev/null +++ > b/server/spec/cimi/data/volume.json @@ -0,0 +1,16 @@ +{ + "uri": > "http://cimi.example.org/volumes/1", + "name": "volume1", + > "description": "Volume One", + "created": "2011-11-17", + > "capacity": { "quantity": "10", "units": "gigabyte" }, + "bootable": > "false", + "supportsSnapshots": "false", + "guestInterface": > "NFS", + "operations": [ + { "rel": "edit", + "href": > "http://cimi.example.org/volumes/1/edit" }, + { "rel": "delete", + > "href": "http://cimi.example.org/volumes/1/delete" } + ] +} diff > --git a/server/spec/cimi/data/volume.xml > b/server/spec/cimi/data/volume.xml new file mode 100644 index > 0000000..2e4699e --- /dev/null +++ > b/server/spec/cimi/data/volume.xml @@ -0,0 +1,12 @@ + xmlns="http://www.dmtf.org/cimi"> + > http://cimi.example.org/volumes/1 + volume1 > + Volume One + > 2011-11-17 + units="gigabyte"/> + false + > false + > NFS + href="http://cimi.example.org/volumes/1/edit"/> + rel="delete" href="http://cimi.example.org/volumes/1/delete"/> > + diff --git a/server/spec/cimi/model/volume_spec.rb > b/server/spec/cimi/model/volume_spec.rb new file mode 100644 index > 0000000..829dc57 --- /dev/null +++ > b/server/spec/cimi/model/volume_spec.rb @@ -0,0 +1,36 @@ +# Licensed > to the Apache Software Foundation (ASF) under one or more +# > contributor license agreements. See the NOTICE file distributed > with +# this work for additional information regarding copyright > ownership. The +# ASF licenses this file to you under the Apache > License, Version 2.0 (the +# "License"); you may not use this file > except in compliance with the +# License. You may obtain a copy of > the License at +# +# > http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by > applicable law or agreed to in writing, software +# distributed under > the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES > OR CONDITIONS OF ANY KIND, either express or implied. See the +# > License for the specific language governing permissions and > limitations +# under the License. +# + +describe "Volume model" do + > + before(:all) do + @xml = IO::read(File::join(DATA_DIR, > "volume.xml")) + @json = IO::read(File::join(DATA_DIR, > "volume.json")) + end + + it "can be constructed from XML" do + > conf = CIMI::Model::Volume.from_xml(@xml) + conf.should_not > be_nil + should_serialize_from_xml! conf, @xml, @json + end + + > it "can be constructed from JSON" do + conf = > CIMI::Model::Volume.from_json(@json) + conf.should_not be_nil + > should_serialize_from_json! conf, @xml, @json + end + +end - -- - -- Michal Fojtik, mfojtik@redhat.com Deltacloud API: http://deltacloud.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOxigEAAoJEEnFpmY+LvFRYfgIAKKF6s+FJzYXUwXdvrjE5yBz gMEpSL1bLzvYPt+ZfEgt7sm0LXXGN33EEk66uPeIZtH+t1ySr89msDMbZ0bRAiUl GH8wP/5lqOyH0WyaVgvvYsaXw4tk16b/sgZc7KE97HLnjjQ5VfSmINveqJjw1tWr x321Vqf4qFiSrJQSP5kPdxkd7QXhN8H5w6+j1FpBik390uxbaI3cnjvc0dBvJmp8 A0SFwZQ1mbLQxRx+PKu/OZxu6AgU+kZxyxRguoirhbX13xJvZwzUI2tLbX0oMu9x azz2s99zKkLBkpXevZ3EmtnSVBeorJfk591UIhS04QVI3Bn0ae0y5nYG4IOITD4= =/nnk -----END PGP SIGNATURE-----