[Crowbar] Router_pref backport

Kevin Bringard kbringard at atti.com
Thu Jan 19 18:48:20 CST 2012


Feel free to make the changes; I'm not about the glory, I just want to help make things better :-D

On Jan 19, 2012, at 5:36 PM, "Andi_Abes at Dell.com" <Andi_Abes at Dell.com> wrote:

> Thanks for chasing this down, and finding the bug, and sharing the results !
> (we're still not giving trunk/1.2.1 all the love they deserve love....will come soon).
> 
> Not sure where this got lost when I tested my changes (I might have futzed around the full proposal application).
> The fix you're describing makes perfect sense - and you proved it worked ;)
> 
> (Would you want to send in a pull request (so you gain github glory;) ) or should I just make the changes?)
> a
> -----Original Message-----
> From: crowbar-bounces On Behalf Of Kevin Bringard
> Sent: Thursday, January 19, 2012 9:26 AM
> To: crowbar
> Subject: Re: [Crowbar] Router_pref backport
> 
> Oh, and as a reminder: this is working in v1.2-openstack, but you need to check out the v1.2-openstack tag for crowbar and all submodules, copy HEAD for barclamps/network into place over it and then apply these changes
> 
> On 1/19/12 7:17 AM, "Kevin Bringard" <kbringard at atti.com> wrote:
> 
>> OK, I got this working. Please see the git diff below:
>> 
>> diff --git a/crowbar_framework/app/models/network_service.rb
>> b/crowbar_framework/app/models/network_service.rb
>> index 97047fe..4f1a539 100644
>> --- a/crowbar_framework/app/models/network_service.rb
>> +++ b/crowbar_framework/app/models/network_service.rb
>> @@ -67,6 +67,9 @@ class NetworkService < ServiceObject
>>      rangeH = db["network"]["ranges"][range]
>>      rangeH = db["network"]["ranges"]["host"] if rangeH.nil?
>>      conduit = db["network"]["conduit"]
>> +      unless db["network"]["router_pref"].nil?
>> +        router_pref = db["network"]["router_pref"]
>> +      end
>> 
>>      index = IPAddr.new(rangeH["start"]) & ~IPAddr.new(netmask)
>>      index = index.to_i
>> @@ -106,7 +109,7 @@ class NetworkService < ServiceObject
>>    return [404, "No Address Available"] if !found
>> 
>>    # Save the information.
>> -    net_info = { "conduit" => conduit, "address" => address.to_s,
>> "netmask" => netmask, "node" => name, "router" => router, "subnet" =>
>> subnet, "broadcast" => broadcast, "usage" => network, "use_vlan" =>
>> use_vlan, "vlan" => vlan, "add_bridge" => add_bridge }
>> +    net_info = { "conduit" => conduit, "address" => address.to_s,
>> "netmask" => netmask, "node" => name, "router" => router, "subnet" =>
>> subnet, "broadcast" => broadcast, "usage" => network, "use_vlan" =>
>> use_vlan, "vlan" => vlan, "add_bridge" => add_bridge, "router_pref" =>
>> rout
>>    node.crowbar["crowbar"]["network"][network] = net_info
>>    node.save
>> 
>> @@ -187,6 +190,9 @@ class NetworkService < ServiceObject
>>      router = db["network"]["router"]
>>      netmask = db["network"]["netmask"]
>>      conduit = db["network"]["conduit"]
>> +      unless db["network"]["router_pref"].nil?
>> +        router_pref = db["network"]["router_pref"]
>> +      end
>> 
>>    rescue Exception => e
>>      @logger.error("Error finding address: #{e.message}") @@ -194,7
>> +200,7 @@ class NetworkService < ServiceObject
>>    end
>> 
>>    # Save the information.
>> -    net_info = { "conduit" => conduit, "netmask" => netmask, "node" =>
>> name, "router" => router, "subnet" => subnet, "broadcast" => broadcast,
>> "usage" => network, "use_vlan" => use_vlan, "vlan" => vlan, "add_bridge"
>> => add_bridge }
>> +    net_info = { "conduit" => conduit, "netmask" => netmask, "node" =>
>> name, "router" => router, "subnet" => subnet, "broadcast" => broadcast,
>> "usage" => network, "use_vlan" => use_vlan, "vlan" => vlan, "add_bridge"
>> => add_bridge, "router_pref" => router_pref }
>>    node.crowbar["crowbar"]["network"][network] = net_info
>>    node.save
>> 
>> I verified that making these changes and rebuilding the iso does indeed
>> resolve my issue and the default route is set correctly.
>> 
>> 
>> It doesn't look like the router_pref is added to the net_info hash in
>> trunk either, so unless the mechanism has changed it is possible it's
>> bugged there.
>> 
>> -- Kevin
>> 
>> 
>> On 1/18/12 8:59 AM, "Gregory_Althaus at Dell.com"
>> <Gregory_Althaus at Dell.com>
>> wrote:
>> 
>>> Delete would be safest.  The reinstall maintains that network stanza
>>> (and it isn't rebuilt).  On delete, it would be.
>>> 
>>> Thanks,
>>> Greg
>>> 
>>> -----Original Message-----
>>> From: crowbar-bounces On Behalf Of Kevin Bringard
>>> Sent: Wednesday, January 18, 2012 9:48 AM
>>> To: crowbar
>>> Subject: Re: [Crowbar] Router_pref backport
>>> 
>>> If nodes have already been allocated will a reinstall of the node fix it?
>>> Or should I delete them, re-sledge, etc?
>>> 
>>> On 1/18/12 8:46 AM, "Gregory_Althaus at Dell.com"
>>> <Gregory_Althaus at Dell.com>
>>> wrote:
>>> 
>>>> It can be editted in place and the webserver restarted.  This needs
>>>> to be done before nodes are added though.
>>>> 
>>>> Thanks,
>>>> Greg
>>>> 
>>>> 
>>>> -----Original Message-----
>>>> From: crowbar-bounces On Behalf Of Kevin Bringard
>>>> Sent: Wednesday, January 18, 2012 9:44 AM
>>>> To: crowbar
>>>> Subject: Re: [Crowbar] Router_pref backport
>>>> 
>>>> I think I may have found it...
>>>> 
>>>> In the recipe, this value is pulled from the
>>>> node["crowbar"]["network"] object. In the crowbar framework
>>>> (/opt/dell/barclamps/network/crowbar_framework/app/models/network_ser
>>>> vic
>>>> e
>>>> .
>>>> r
>>>> b) I found the following:
>>>> 
>>>> # Find the node
>>>>   node = NodeObject.find_node_by_name name
>>>>   @logger.error("Network allocate_ip: return node not found:
>>>> #{name} #{network} #{range}") if node.nil?
>>>>   return [404, "No node found"] if node.nil?
>>>> 
>>>> ...
>>>> 
>>>> 
>>>> db = ProposalObject.find_data_bag_item "crowbar/#{network}_network"
>>>> 
>>>>     subnet = db["network"]["subnet"]
>>>>     vlan = db["network"]["vlan"]
>>>>     use_vlan = db["network"]["use_vlan"]
>>>>     add_bridge = db["network"]["add_bridge"]
>>>>     broadcast = db["network"]["broadcast"]
>>>>     router = db["network"]["router"]
>>>>     netmask = db["network"]["netmask"]
>>>>     rangeH = db["network"]["ranges"][range]
>>>>     rangeH = db["network"]["ranges"]["host"] if rangeH.nil?
>>>>     conduit = db["network"]["conduit"]
>>>> 
>>>> It appears as though this is where the node object is being built as
>>>> those objects all exist in the network hash. So, I added the
>>>> following after
>>>> "conduit":
>>>> 
>>>> 
>>>> unless db["network"]["router_pref"].nil?
>>>> router_pref = db["network"]["router_pref"]
>>>>     end
>>>> 
>>>> Does this make sense? I don't know if I can just edit it in place on
>>>> the admin server or if there is something else I need to do to make
>>>> the changes take effect. I am rebuilding the iso and I'll redeploy
>>>> the admin node, but while I do that if someone replies and lets me
>>>> know how I can just make it take effect on my existing admin node,
>>>> that would save a lot of time :-D
>>>> 
>>>> 
>>>> Thanks!
>>>> 
>>>> -- Kevin
>>>> 
>>>> 
>>>> 
>>>> On 1/17/12 5:02 PM, "Gregory_Althaus at Dell.com"
>>>> <Gregory_Althaus at Dell.com>
>>>> wrote:
>>>> 
>>>>> Ignore this.  This only applies if you were applying/installing a
>>>>> barclamp to a running system.
>>>>> 
>>>>> Thanks,
>>>>> Greg
>>>>> 
>>>>> -----Original Message-----
>>>>> From: crowbar-bounces On Behalf Of Althaus, Gregory
>>>>> Sent: Tuesday, January 17, 2012 5:50 PM
>>>>> To: kbringard at atti.com; crowbar
>>>>> Subject: [Crowbar] [SPAM] RE: Router_pref backport
>>>>> 
>>>>> So, the item is not incremental.  The network barclamp has an
>>>>> instance separate from the template.  So, the template has the new
>>>>> hash, but the current instance does not.  You can reinstall or you
>>>>> can edit the network barclamp instance and the hash to the json file and save it.
>>>>> Then apply the barclamp.  That should make it happen.
>>>>> 
>>>>> Thanks,
>>>>> Greg
>>>>> 
>>>>> -----Original Message-----
>>>>> From: crowbar-bounces On Behalf Of Kevin Bringard
>>>>> Sent: Tuesday, January 17, 2012 5:10 PM
>>>>> To: crowbar
>>>>> Subject: Re: [Crowbar] Router_pref backport
>>>>> 
>>>>> Yea, I'm looking at the admin node and I see my changes are there. I
>>>>> did make a couple of changes after build, like adding some debug
>>>>> messages, and knifed them in, but they took effect because the
>>>>> logging I added output...
>>>>> I still see the router_pref schema/json in place as well as the
>>>>> router_pref code block in default.rb, again all on the admin node.
>>>>> 
>>>>> But anyway, I guess the important bit is, there shouldn't be
>>>>> anything that I need to change elsewhere, correct? Like in the
>>>>> crowbar barclamp to push changes upstream via node or anything like that?
>>>>> 
>>>>> Thanks for the help!
>>>>> 
>>>>> -- Kevin
>>>>> 
>>>>> On 1/17/12 4:04 PM, "Andi_Abes at Dell.com" <Andi_Abes at Dell.com> wrote:
>>>>> 
>>>>>> This sounds more a build issue, rather than something specific to
>>>>>> the network bc.
>>>>>> 
>>>>>> Only thing I can come up with is - check your changes are still
>>>>>> there, committed in git. The build script plays some hokey tricks
>>>>>> with git, that might toss away uncommitted changes.
>>>>>> 
>>>>>> 
>>>>>> -----Original Message-----
>>>>>> From: crowbar-bounces On Behalf Of Kevin Bringard
>>>>>> Sent: Tuesday, January 17, 2012 5:57 PM
>>>>>> To: crowbar
>>>>>> Subject: Re: [Crowbar] Router_pref backport
>>>>>> 
>>>>>> I made the changes and then built a new iso, installed it, etc...
>>>>>> But again, the only changes I made were in the network barclamp.
>>>>>> 
>>>>>> I can send you the output of the hashes if it would be helpful
>>>>>> 
>>>>>> On 1/17/12 3:54 PM, "Andi_Abes at Dell.com" <Andi_Abes at Dell.com> wrote:
>>>>>> 
>>>>>>> The network barclamp gets instantiated during admin node install
>>>>>>> time.
>>>>>>> Did you apply the changes you're describing on top of an existing
>>>>>>> admin node, or did you build a new ISO + node?
>>>>>>> 
>>>>>>> -----Original Message-----
>>>>>>> From: crowbar-bounces On Behalf Of Kevin Bringard
>>>>>>> Sent: Tuesday, January 17, 2012 5:53 PM
>>>>>>> To: crowbar
>>>>>>> Subject: [Crowbar] Router_pref backport
>>>>>>> 
>>>>>>> Hey guys,
>>>>>>> 
>>>>>>> I'm trying to backport the router_pref setting to the v1.2
>>>>>>> release, but I'm having some trouble. I've added the requisite
>>>>>>> code in the network barclamp (basically, I checked out HEAD on
>>>>>>> that submodule and manually copied it into place). It all seems to
>>>>>>> work, however in the network hash router_pref isn't one of the
>>>>>>> keys. I've added it to the json and schema, but it just isn't
>>>>>>> being built into the hash for some reason.
>>>>>>> 
>>>>>>> Perhaps there is something else in the crowbar framework in the
>>>>>>> node setup that I'm missing? Any ideas?
>>>>>>> 
>>>>>>> Thanks!
>>>>>>> 
>>>>>>> -- Kevin
>>>>>>> 
>>>>>>> _______________________________________________
>>>>>>> Crowbar mailing list
>>>>>>> Crowbar at dell.com
>>>>>>> https://lists.us.dell.com/mailman/listinfo/crowbar
>>>>>>> For more information:
>>>>>>> https://github.com/dellcloudedge/crowbar/wiki
>>>>>> 
>>>>>> _______________________________________________
>>>>>> Crowbar mailing list
>>>>>> Crowbar at dell.com
>>>>>> https://lists.us.dell.com/mailman/listinfo/crowbar
>>>>>> For more information: https://github.com/dellcloudedge/crowbar/wiki
>>>>> 
>>>>> _______________________________________________
>>>>> Crowbar mailing list
>>>>> Crowbar at dell.com
>>>>> https://lists.us.dell.com/mailman/listinfo/crowbar
>>>>> For more information: https://github.com/dellcloudedge/crowbar/wiki
>>>>> 
>>>>> _______________________________________________
>>>>> Crowbar mailing list
>>>>> Crowbar at dell.com
>>>>> https://lists.us.dell.com/mailman/listinfo/crowbar
>>>>> For more information: https://github.com/dellcloudedge/crowbar/wiki
>>>>> 
>>>> 
>>>> _______________________________________________
>>>> Crowbar mailing list
>>>> Crowbar at dell.com
>>>> https://lists.us.dell.com/mailman/listinfo/crowbar
>>>> For more information: https://github.com/dellcloudedge/crowbar/wiki
>>> 
>>> _______________________________________________
>>> Crowbar mailing list
>>> Crowbar at dell.com
>>> https://lists.us.dell.com/mailman/listinfo/crowbar
>>> For more information: https://github.com/dellcloudedge/crowbar/wiki
>> 
>> _______________________________________________
>> Crowbar mailing list
>> Crowbar at dell.com
>> https://lists.us.dell.com/mailman/listinfo/crowbar
>> For more information: https://github.com/dellcloudedge/crowbar/wiki
>> 
> 
> _______________________________________________
> Crowbar mailing list
> Crowbar at dell.com
> https://lists.us.dell.com/mailman/listinfo/crowbar
> For more information: https://github.com/dellcloudedge/crowbar/wiki



More information about the Crowbar mailing list