You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by dk...@apache.org on 2013/04/08 13:42:00 UTC

[1/4] git commit: CIMI: use storage volume name for cimi volume name if available, else id. https://issues.apache.org/jira/browse/DTACLOUD-535

Updated Branches:
  refs/heads/master 0c7f632f1 -> 64a8da06f


CIMI: use storage volume name for cimi volume name if available, else id.
https://issues.apache.org/jira/browse/DTACLOUD-535


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/30822949
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/30822949
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/30822949

Branch: refs/heads/master
Commit: 3082294909933a8bbc2ad044781429e93bd28f93
Parents: 0c7f632
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Sat Apr 6 21:54:56 2013 +1100
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Apr 8 21:38:42 2013 +1000

----------------------------------------------------------------------
 server/lib/cimi/service/machine_volume.rb |    4 ++--
 server/lib/cimi/service/volume.rb         |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/30822949/server/lib/cimi/service/machine_volume.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/machine_volume.rb b/server/lib/cimi/service/machine_volume.rb
index 77c545b..35397df 100644
--- a/server/lib/cimi/service/machine_volume.rb
+++ b/server/lib/cimi/service/machine_volume.rb
@@ -22,7 +22,7 @@ class CIMI::Service::MachineVolume < CIMI::Service::Base
         id = context.machine_url(instance_id)+"/volumes/#{vol.id}"
         attached <<  self.new(context, :values => {
           :id => id,
-          :name => vol.id,
+          :name => volume.name || vol.id,
           :description => "MachineVolume #{vol.id} for Machine #{instance_id}",
           :created => vol.created.nil? ? nil : Time.parse(vol.created).xmlschema,
           :initial_location => vol.device,
@@ -37,7 +37,7 @@ class CIMI::Service::MachineVolume < CIMI::Service::Base
       raise CIMI::Model::NotFound unless vol.instance_id == instance_id
       self.new(context, :values => {
         :id => id,
-        :name => vol.id,
+        :name => volume.name || vol.id,
         :description => "MachineVolume #{vol.id} for Machine #{instance_id}",
         :created => vol.created.nil? ? nil : Time.parse(vol.created).xmlschema,
         :initial_location => vol.device,

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/30822949/server/lib/cimi/service/volume.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/volume.rb b/server/lib/cimi/service/volume.rb
index 2e38691..969da43 100644
--- a/server/lib/cimi/service/volume.rb
+++ b/server/lib/cimi/service/volume.rb
@@ -48,7 +48,7 @@ class CIMI::Service::Volume < CIMI::Service::Base
 
   def self.from_storage_volume(volume, context)
     self.new(context, :values => {
-      :name => volume.id,
+      :name => volume.name || volume.id,
       :created => volume.created.nil? ? nil : Time.parse(volume.created).xmlschema,
       :id => context.volume_url(volume.id),
       :capacity => context.to_kibibyte(volume.capacity, 'GB'),


[4/4] git commit: FGCP: exclude system disks from storage_volumes and cimi system volumes. DTACLOUD-532.

Posted by dk...@apache.org.
FGCP: exclude system disks from storage_volumes and cimi system volumes. DTACLOUD-532.


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/64a8da06
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/64a8da06
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/64a8da06

Branch: refs/heads/master
Commit: 64a8da06fb7b48fa56497b3699e38fdf4af95f39
Parents: 3033c70
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Sat Apr 6 21:57:35 2013 +1100
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Apr 8 21:41:21 2013 +1000

----------------------------------------------------------------------
 server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb  |    7 ++++---
 .../drivers/fgcp/fgcp_driver_cimi_methods.rb       |    2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/64a8da06/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb b/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb
index 436cb50..9ca65c6 100644
--- a/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb
+++ b/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb
@@ -516,7 +516,8 @@ class FgcpDriver < Deltacloud::BaseDriver
               vdisks['vdisk'].each do |vdisk|
 
                 #state requires an additional call per volume. Only set if attached.
-                #exclude system disks as they are not detachable?
+                #exclude system disks as they are instance disks, not volumes
+                kind = determine_storage_type(vdisk['vdiskId'][0])
                 volumes << StorageVolume.new(
                   :id          => vdisk['vdiskId'][0],
                   :name        => vdisk['vdiskName'][0],
@@ -524,9 +525,9 @@ class FgcpDriver < Deltacloud::BaseDriver
                   :instance_id => vdisk['attachedTo'].nil? ? nil : vdisk['attachedTo'][0],
                   :realm_id    => client.extract_vsys_id(vdisk['vdiskId'][0]),
                   # aligning with rhevm, which returns 'system' or 'data'
-                  :kind        => determine_storage_type(vdisk['vdiskId'][0]),
+                  :kind        => kind,
                   :state       => vdisk['attachedTo'].nil? ? 'AVAILABLE' : 'IN-USE'
-                )
+                ) unless kind == 'system'
               end
             end
           rescue Exception => ex # cater for case where vsys was just destroyed since list_vsys call

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/64a8da06/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb b/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
index 64e434c..9735c62 100644
--- a/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
@@ -172,7 +172,7 @@ module Deltacloud::Drivers::Fgcp
             :id      => context.system_volume_url(:id => vsys_id, :ent_id => vdisk_id),
             :name    => vdisk['vdiskName'][0],
             :volume  => { :href => context.volume_url(vdisk_id)}
-          ) unless opts[:id] and opts[:id] != vdisk_id
+          ) unless (opts[:id] and opts[:id] != vdisk_id) or determine_storage_type(vdisk_id) == 'system'
         end
         volumes.compact
       end


[2/4] git commit: Fgcp: fix cimi system deletion: advertise op and ensure state becomes DELETING until gone

Posted by dk...@apache.org.
Fgcp: fix cimi system deletion: advertise op and ensure state becomes DELETING until gone


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/88c189a6
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/88c189a6
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/88c189a6

Branch: refs/heads/master
Commit: 88c189a6c3441aed605de04571a5a621862f0959
Parents: 3082294
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Sat Apr 6 01:51:01 2013 +1100
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Apr 8 21:39:27 2013 +1000

----------------------------------------------------------------------
 .../drivers/fgcp/fgcp_driver_cimi_methods.rb       |   15 ++++++++++-----
 .../drivers/mock/mock_driver_cimi_methods.rb       |    4 ++++
 2 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88c189a6/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb b/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
index d0ae1ea..64e434c 100644
--- a/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
@@ -48,7 +48,8 @@ module Deltacloud::Drivers::Fgcp
           )
         end
         systems = systems.select { |s| opts[:id] == s[:id] } if opts[:id]
-        # now add system state and advertised operations
+
+        # now add system state and advertise operations
         systems.each do |system|
           vservers = client.list_vservers(system[:id])['vservers'][0]['vserver']
           if vservers.nil?
@@ -57,19 +58,23 @@ module Deltacloud::Drivers::Fgcp
             vservers.each do |vserver|
               state = @@MACHINE_STATE_MAP[client.get_vserver_status(vserver['vserverId'][0])['vserverStatus'][0]]
               system[:state] ||= state
-              system[:operations] <<  { :href => context.system_url("#{system[:id]}/start"), :rel => "http://schemas.dmtf.org/cimi/1/action/start" } if state == 'STOPPED'
-              system[:operations] <<  { :href => context.system_url("#{system[:id]}/stop"), :rel => "http://schemas.dmtf.org/cimi/1/action/stop" } if state == 'STARTED'
+              system[:operations] << { :href => context.system_url("#{system[:id]}/start"), :rel => "http://schemas.dmtf.org/cimi/1/action/start" } if state == 'STOPPED'
+              system[:operations] << { :href => context.system_url("#{system[:id]}/stop"), :rel => "http://schemas.dmtf.org/cimi/1/action/stop" } if state == 'STARTED'
               if system[:state] != state
                 system[:state] = 'MIXED'
                 # this case could have been caused by one machine in capturing state and one in e.g. creating,
                 # but just advertise both operations to cut it short
-                system[:operations] <<  { :href => context.system_url("#{system[:id]}/start"), :rel => "http://schemas.dmtf.org/cimi/1/action/start" }
-                system[:operations] <<  { :href => context.system_url("#{system[:id]}/stop"), :rel => "http://schemas.dmtf.org/cimi/1/action/stop" }
+                system[:operations] << { :href => context.system_url("#{system[:id]}/start"), :rel => "http://schemas.dmtf.org/cimi/1/action/start" }
+                system[:operations] << { :href => context.system_url("#{system[:id]}/stop"), :rel => "http://schemas.dmtf.org/cimi/1/action/stop" }
                 break
               end
             end
             system[:operations].uniq!
           end
+          # check for special case: in destroy_system the FW is stopped before the system is deleted
+          system[:state] = 'DELETING' if ((vservers.nil? and system[:state] != 'CREATING') or system[:state] == 'STOPPED') and
+                                         ['STOPPED', 'STOPPING'].include? client.get_efm_status("#{system[:id]}-S-0001")['efmStatus'][0]
+          system[:operations] << { :href => context.system_url(system[:id]), :rel => "delete" } if system[:state] == 'STOPPED'
         end
         systems
       end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88c189a6/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
index b0d4f9a..0efeecb 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
@@ -303,6 +303,8 @@ module Deltacloud::Drivers::Mock
 
     # Convert all attributes that have values of the form
     #   http://cimi.example.org/COLL/ID
+    #   or
+    #   http://cimi.example.org/COLL/ID/SUBCOLL/ENT_ID
     def convert_urls(val, context)
       if val.nil? || val.is_a?(Fixnum)
         # Nothing to do
@@ -330,6 +332,8 @@ module Deltacloud::Drivers::Mock
     #
     # URLs that should be rewritten need to be in the form
     #   http://cimi.example.org/COLLECTION/ID
+    #   or
+    #   http://cimi.example.org/COLLECTION/SYSTEM_ID/SUBCOLLECTION/ENT_ID
     def rewrite_url(s, context)
       begin
         u = URI.parse(s)


[3/4] git commit: mock: fix href urls in mock system and subcollections. Also include start action for newly created system

Posted by dk...@apache.org.
mock: fix href urls in mock system and subcollections.
Also include start action for newly created system


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/3033c700
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/3033c700
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/3033c700

Branch: refs/heads/master
Commit: 3033c700d6e1f84e8ec3ca9b28d95813ecfd4bd7
Parents: 88c189a
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Fri Apr 5 15:23:50 2013 +1100
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Apr 8 21:40:31 2013 +1000

----------------------------------------------------------------------
 .../drivers/mock/data/cimi/system/system1.json     |    2 -
 .../drivers/mock/data/cimi/system/system2.json     |    2 -
 .../drivers/mock/mock_driver_cimi_methods.rb       |   28 ++++++--------
 3 files changed, 12 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3033c700/server/lib/deltacloud/drivers/mock/data/cimi/system/system1.json
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/system/system1.json b/server/lib/deltacloud/drivers/mock/data/cimi/system/system1.json
index 689ba60..0e9ec8b 100644
--- a/server/lib/deltacloud/drivers/mock/data/cimi/system/system1.json
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/system/system1.json
@@ -3,8 +3,6 @@
   "description": "the first system",
   "created": "Fri Feb 08 15:25:41 EET 2013",
   "state": "STOPPED",
-  "machines": { "href": "http://cimi.example.org/systems/system1/machines"},
-  "networks": { "href": "http://cimi.example.org/systems/system1/networks"},
   "operations": [
     { "rel": "edit", "href": "http://cimi.example.org/systems/system1" },
     { "rel": "delete", "href": "http://cimi.example.org/systems/system1" }

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3033c700/server/lib/deltacloud/drivers/mock/data/cimi/system/system2.json
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/system/system2.json b/server/lib/deltacloud/drivers/mock/data/cimi/system/system2.json
index 4062fb0..1c698e3 100644
--- a/server/lib/deltacloud/drivers/mock/data/cimi/system/system2.json
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/system/system2.json
@@ -3,8 +3,6 @@
   "description": "the second system",
   "created": "Fri Feb 08 15:25:41 EET 2013",
   "state": "STOPPED",
-  "machines": { "href": "http://cimi.example.org/systems/system2/machines"},
-  "networks": { "href": "http://cimi.example.org/systems/system2/networks"},
   "operations": [
     { "rel": "edit", "href": "http://cimi.example.org/systems/system2" },
     { "rel": "delete", "href": "http://cimi.example.org/systems/system2" }

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3033c700/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
index 0efeecb..217736a 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
@@ -44,7 +44,8 @@ module Deltacloud::Drivers::Mock
                   "created" => Time.now,
                   "state" => "STOPPED",
                   "systemTemplate"=> { "href" => opts[:system_template].id },
-                  "operations" => [{"rel"=>"edit", "href"=> id},
+                  "operations" => [{"rel"=>"http://schemas.dmtf.org/cimi/1/action/start", "href"=> "#{id}/start"},
+                                   {"rel"=>"edit", "href"=> id},
                                    {"rel"=>"delete", "href"=> id}]    }
       system = CIMI::Model::System.from_json(JSON.generate(sys_hsh))
 
@@ -78,9 +79,7 @@ module Deltacloud::Drivers::Mock
           return []
         end
       end
-      #FIXME: with ":machines", delete url becomes 'http://localhost:3001/cimi/machines?id=sysmach1'
-      #with ":system_machine"/":system_machines", undefined method `system_machine_url' for #<CIMI::Collections::Systems:0x44fe338> in mock_driver_cimi_methods.rb:261
-      machines.map{|mach|convert_cimi_mock_urls(:machines, mach, opts[:env])}.flatten
+      machines.map{|m|convert_urls(m, opts[:env])}.flatten
     end
 
     def system_volumes(credentials, opts={})
@@ -94,9 +93,7 @@ module Deltacloud::Drivers::Mock
           return []
         end
       end
-      #FIXME: with ":volumes", delete url becomes 'http://localhost:3001/cimi/volumes?id=sysvol1'
-      #with ":system_volume"/":system_volumes", undefined method `system_volume_url' for #<CIMI::Collections::Systems:0x44fe338> in mock_driver_cimi_methods.rb:261
-      volumes.map{|vol|convert_cimi_mock_urls(:volumes, vol, opts[:env])}.flatten
+      volumes.map{|vol|convert_urls(vol, opts[:env])}.flatten
     end
 
     def system_networks(credentials, opts={})
@@ -110,8 +107,7 @@ module Deltacloud::Drivers::Mock
           return []
         end
       end
-      #FIXME
-      networks.map{|vol|convert_cimi_mock_urls(:networks, vol, opts[:env])}.flatten
+      networks.map{|n|convert_urls(n, opts[:env])}.flatten
     end
 
     def system_addresses(credentials, opts={})
@@ -125,8 +121,7 @@ module Deltacloud::Drivers::Mock
           return []
         end
       end
-      #FIXME
-      addresses.map{|a|convert_cimi_mock_urls(:addresses, a, opts[:env])}.flatten
+      addresses.map{|a|convert_urls(a, opts[:env])}.flatten
     end
 
     def system_forwarding_groups(credentials, opts={})
@@ -140,8 +135,7 @@ module Deltacloud::Drivers::Mock
           return []
         end
       end
-      #FIXME
-      groups.map{|group|convert_cimi_mock_urls(:forwarding_groups, group, opts[:env])}.flatten
+      groups.map{|g|convert_urls(g, opts[:env])}.flatten
     end
 
     def system_templates(credentials, opts={})
@@ -341,10 +335,12 @@ module Deltacloud::Drivers::Mock
         return s
       end
       return s unless u.scheme == 'http' && u.host == 'cimi.example.org'
-      _, coll, id = u.path.split("/")
-      method = "#{coll.singularize}_url"
+      _, coll, id, sub_coll, sub_id = u.path.split("/")
+      method = sub_coll ? "#{coll.singularize}_#{sub_coll.singularize}_url"
+                        : "#{coll.singularize}_url"
       if context.respond_to?(method)
-        context.send(method, id)
+        sub_coll ? context.send(method, :id => id, :ent_id => sub_id)
+                 : context.send(method, id)
       else
         s
       end