deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 3/3] Core: Report the time of creation of image
Date Thu, 25 Oct 2012 12:31:56 GMT
From: Michal Fojtik <mfojtik@redhat.com>

* Added to: VSphere, RHEV-M, OpenStack and Mock
* Not supported by: EC2, Eucalyptus

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/deltacloud/drivers/mock/data/images/img1.yml     | 1 +
 server/lib/deltacloud/drivers/mock/data/images/img2.yml     | 1 +
 server/lib/deltacloud/drivers/mock/data/images/img3.yml     | 1 +
 server/lib/deltacloud/drivers/openstack/openstack_driver.rb | 3 ++-
 server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb         | 3 ++-
 server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb     | 1 +
 server/lib/deltacloud/models/image.rb                       | 1 +
 7 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/server/lib/deltacloud/drivers/mock/data/images/img1.yml b/server/lib/deltacloud/drivers/mock/data/images/img1.yml
index 1b641b4..1b1d6be 100644
--- a/server/lib/deltacloud/drivers/mock/data/images/img1.yml
+++ b/server/lib/deltacloud/drivers/mock/data/images/img1.yml
@@ -5,3 +5,4 @@
 :id: img1
 :name: img1
 :description: Fedora 10
+:creation_time: "Thu Oct 25 14:27:53 CEST 2012"
diff --git a/server/lib/deltacloud/drivers/mock/data/images/img2.yml b/server/lib/deltacloud/drivers/mock/data/images/img2.yml
index 1aa77cc..9ae7caf 100644
--- a/server/lib/deltacloud/drivers/mock/data/images/img2.yml
+++ b/server/lib/deltacloud/drivers/mock/data/images/img2.yml
@@ -5,3 +5,4 @@
 :id: img2
 :name: img2
 :description: Fedora 10
+:creation_time: "Thu Oct 25 14:27:53 CEST 2012"
diff --git a/server/lib/deltacloud/drivers/mock/data/images/img3.yml b/server/lib/deltacloud/drivers/mock/data/images/img3.yml
index 3afb116..ba51af6 100644
--- a/server/lib/deltacloud/drivers/mock/data/images/img3.yml
+++ b/server/lib/deltacloud/drivers/mock/data/images/img3.yml
@@ -5,3 +5,4 @@
 :id: img3
 :name: img3
 :description: JBoss
+:creation_time: "Thu Oct 25 14:27:53 CEST 2012"
diff --git a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
index 04bd409..d2929c3 100644
--- a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
+++ b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
@@ -387,7 +387,8 @@ private
                     :description => image.send(op, :name),
                     :owner_id => owner,
                     :state => image.send(op, :status),
-                    :architecture => 'x86_64'
+                    :architecture => 'x86_64',
+                    :creation_time => image.send(op, :created)
                     })
         end
 
diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
index 6dc633a..2daa856 100644
--- a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
+++ b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
@@ -309,7 +309,8 @@ class RhevmDriver < Deltacloud::BaseDriver
       :owner_id => client.credentials[:username],
       :architecture => 'x86_64', # All RHEV-M VMs are x86_64
       :hardware_profiles => hardware_profiles(nil),
-      :state => img.status.strip.upcase
+      :state => img.status.strip.upcase,
+      :creation_time => img.creation_time
     )
   end
 
diff --git a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
index d4879ef..e975c97 100644
--- a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
+++ b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
@@ -104,6 +104,7 @@ module Deltacloud::Drivers::Vsphere
             :owner_id => credentials.user,
             :description => properties[:full_name],
             :state => image_state,
+            :creation_time => image.storage[:timestamp],
             :hardware_profiles => profiles
           )
         end
diff --git a/server/lib/deltacloud/models/image.rb b/server/lib/deltacloud/models/image.rb
index f9a64e1..6d6bc9b 100644
--- a/server/lib/deltacloud/models/image.rb
+++ b/server/lib/deltacloud/models/image.rb
@@ -23,5 +23,6 @@ class Image < BaseModel
   attr_accessor :architecture
   attr_accessor :state
   attr_accessor :hardware_profiles
+  attr_accessor :creation_time
 
 end
-- 
1.7.12.1


Mime
View raw message