From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/app/models/instance.rb | 1 +
src/app/models/instance_hwp.rb | 26 ++++++++++++++++++++
.../20090804135630_create_hardware_profiles.rb | 1 +
src/db/migrate/20090804142049_create_instances.rb | 10 +++++++
4 files changed, 38 insertions(+), 0 deletions(-)
create mode 100644 src/app/models/instance_hwp.rb
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 22069e2..8573c5a 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -34,6 +34,7 @@ class Instance < ActiveRecord::Base
belongs_to :realm
belongs_to :owner, :class_name => "User", :foreign_key =>
"owner_id"
belongs_to :instance_key
+ belongs_to :instance_hwp
validates_presence_of :pool_id
validates_presence_of :hardware_profile_id
diff --git a/src/app/models/instance_hwp.rb b/src/app/models/instance_hwp.rb
new file mode 100644
index 0000000..acf7598
--- /dev/null
+++ b/src/app/models/instance_hwp.rb
@@ -0,0 +1,26 @@
+ #
+# Copyright (C) 2009 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA. A copy of the GNU General Public License is
+# also available at
http://www.gnu.org/copyleft/gpl.html.
+
+# Filters added to this controller apply to all controllers in the application.
+# Likewise, all the methods added will be available for all controllers.
+#
+class InstanceHWP < ActiveRecord::Base
+
+ has_one :instance
+
+end
\ No newline at end of file
diff --git a/src/db/migrate/20090804135630_create_hardware_profiles.rb
b/src/db/migrate/20090804135630_create_hardware_profiles.rb
index 5ad0435..1765db5 100644
--- a/src/db/migrate/20090804135630_create_hardware_profiles.rb
+++ b/src/db/migrate/20090804135630_create_hardware_profiles.rb
@@ -55,6 +55,7 @@ class CreateHardwareProfiles < ActiveRecord::Migration
t.column "aggregator_hardware_profile_id", :integer
t.column "provider_hardware_profile_id", :integer
end
+
end
def self.down
diff --git a/src/db/migrate/20090804142049_create_instances.rb
b/src/db/migrate/20090804142049_create_instances.rb
index e6ba245..6baf2c4 100644
--- a/src/db/migrate/20090804142049_create_instances.rb
+++ b/src/db/migrate/20090804142049_create_instances.rb
@@ -30,6 +30,7 @@ class CreateInstances < ActiveRecord::Migration
t.integer :owner_id
t.integer :pool_id, :null => false
t.integer :cloud_account_id
+ t.integer :instance_hwp_id
t.string :public_address
t.string :private_address
t.string :state
@@ -50,7 +51,16 @@ class CreateInstances < ActiveRecord::Migration
end
end
+ create_table :instance_hwp do |t|
+ t.string :memory
+ t.string :cpu
+ t.string :architecture
+ t.string :storage
+ t.integer :lock_version, :default => 0
+ end
+
def self.down
drop_table :instances
+ drop_table :instance_hwp
end
end
--
1.7.2.3