On 12/08/2010 04:49 PM, [email protected] wrote: > From: Martyn Taylor<[email protected]> > > --- > src/app/models/instance.rb | 1 + > src/app/models/instance_hwp.rb | 26 > ++++++++++++++++++++ > .../20090804135630_create_hardware_profiles.rb | 8 ++++++ > src/db/migrate/20090804142049_create_instances.rb | 1 + > 4 files changed, 36 insertions(+), 0 deletions(-) > create mode 100644 src/app/models/instance_hwp.rb >
Hi Martyn, few comments inline. > 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..7897537 > --- /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 > + I would prefer InstanceHardwareProfile name to keep some consistency, but if you think HWP is better, go with it. > + has_many :instance > + As we discussed on irc, one-to-one mapping could be better in this case > +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..6f5cf5b 100644 > --- a/src/db/migrate/20090804135630_create_hardware_profiles.rb > +++ b/src/db/migrate/20090804135630_create_hardware_profiles.rb > @@ -55,6 +55,14 @@ class CreateHardwareProfiles< ActiveRecord::Migration > t.column "aggregator_hardware_profile_id", :integer > t.column "provider_hardware_profile_id", :integer > 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 > end > > def self.down could you extend self.down method too? Though self.down seems to be out of date for a long time :). > diff --git a/src/db/migrate/20090804142049_create_instances.rb > b/src/db/migrate/20090804142049_create_instances.rb > index e6ba245..824763b 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 _______________________________________________ deltacloud-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/deltacloud-devel
