-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add parent/child support for lans, as well as subnets #69
Conversation
@@ -0,0 +1,11 @@ | |||
class CreateVmSubnets < ActiveRecord::Migration[5.0] | |||
def change | |||
create_table :vm_subnets do |t| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agrare should we reuse our cloud_subnet model? Ignoring the bad naming for now...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, so best to get together with @Fryguy, since there seems to be some architecture shift. Not sure if we should use different Model for very similar things (AFAIK subnet is just subnet)
We are in the process of modeling a new (alternate?) network model with respect to physical networking, so once we get through that, I'd like to discuss in more detail to see where this and cloud networking fits in. |
Lets confirm with @Fryguy but I think we should make this a generic subnet model that can be used by physical when they get there and make it STI-able so we can subclass it as needed. When we get further into a generic set of network models we can look at migrating the |
Ah, I read @Fryguy's comment to mean, after this gets merged for the Gaprindashvili release, let's revisit this and see what refactoring needs to take place. Let's definitely get on the same page for this. |
Ok, I've renamed the table to just "subnets" for now. |
@bdunne Thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, as @agrare said, later we should unify network&subnet models (fun with migrations :-))
How about adding a |
t.integer :lan_id | ||
end | ||
|
||
add_foreign_key :subnets, :lans |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't use foreign keys, so please remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use foreign keys though, for 5.0, I will be adding them to multiple places. Since it's a new table, it might be worth to treat the DB the right way. ;-) (subnet should always be under network, it's one of the easy models)
That being said, it might open an ugly can of worms, so might be good to have a full release to solve it. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, once we go to 5.0, we can discuss...the original reason was because of replication which is a moot point, but I don't feel comfortable adding them until a major release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All foreign key _id columns must be a bigint.
@@ -0,0 +1,5 @@ | |||
class AddParentIdToLans < ActiveRecord::Migration[5.0] | |||
def change | |||
add_column :lans, :parent_id, :integer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be a bigint
t.string :name | ||
t.string :cidr | ||
t.string :type | ||
t.integer :lan_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be a bigint
@Fryguy Updated to bigint. Not sure what the failures are about. The specs pass locally. |
@djberg96 you need to add the rest of the new columns (cidr, type) to the db/schema file |
Add FK. Change from vm_subnets to just subnets. Added cidr and type columns, removed FK. Update schema.yml
Checked commit https://github.com/djberg96/manageiq-schema/commit/ceaed23f2045a7af5a30802ba592837f23b5ace8 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@agrare I thought I had. Anyway, updated. Thanks! |
I don't understand what codeclimate is whining about. |
@Fryguy Updated to bigint. |
This adds a
parent_id
column to thelans
table which will be used to support VM networks for SCVMM and possibly other providers. A VM network will be represented as a child of a LAN.It also adds a
vm_subnets
table with a FK to thelans
table. The plan is for the AR model to scope the linkage.