[Planetlab-devel] initscripts
tmack at CS.Princeton.EDU
tmack at CS.Princeton.EDU
Thu Dec 20 17:29:27 EST 2007
I all I have to do is make some minor api modifications (update
AddSliceAttribute / UpdateSliceAttribute)
Quoting Faiyaz Ahmed <faiyaza at CS.Princeton.EDU>:
> Hi Amine and Thierry,
>
> You're right in that the slice attribute name for initscripts changed
> in the API and NM was not updated. I've updated the key used by nm
> to use the correct name.
>
> As for using names rather than ids, the change in NM would clearly be
> simple. But, I believe things may break in the API.
>
> Tony, do you have any thoughts on what the change might entail?
>
>
> Faiyaz
>
>
> Modified:
> NodeManager/trunk/sm.py
> Log:
> s/plc_initscript_id/initscript
> The attribute name used in the API changed and nm was never updated.
> Thanks Amine & Thierry.
>
> Modified: NodeManager/trunk/sm.py
> ===================================================================
> --- NodeManager/trunk/sm.py 2007-12-20 21:45:00 UTC (rev 7583)
> +++ NodeManager/trunk/sm.py 2007-12-20 21:59:33 UTC (rev 7584)
> @@ -90,10 +90,11 @@
> ### Emulab-specific hack ends here
>
>
> - logger.verbose ('dealing with initscripts')
> - initscripts_by_id = {}
> + # Take intscripts (global) returned by API, make dict
> + initscripts = {}
> for is_rec in data['initscripts']:
> - initscripts_by_id[str(is_rec['initscript_id'])] = is_rec['script']
> + logger.verbose("initscript: %s" % is_rec['name'])
> + initscripts[str(is_rec['initscript_id'])] = is_rec['script']
>
> for sliver in data['slivers']:
> logger.verbose("sm:GetSlivers in slivers loop")
> @@ -116,9 +117,9 @@
> rec['type'] = 'delegate'
>
> rec.setdefault('vref', attr_dict.get('vref', 'default'))
> - is_id = attr_dict.get('plc_initscript_id')
> - if is_id is not None and is_id in initscripts_by_id:
> - rec['initscript'] = initscripts_by_id[is_id]
> + is_id = attr_dict.get('initscript')
> + if is_id is not None and is_id in initscripts:
> + rec['initscript'] = initscripts[is_id]
> else:
> rec['initscript'] = ''
> rec.setdefault('delegations', attr_dict.get("delegations", []))
>
>
> Thierry Parmentelat wrote:
>> Hi Fayaiz, and all
>>
>> We're still having problems with this initscript thing
>>
>> Here is the situation, as reported by Amine
>> ==
>> I start with a new Myplc based on the last build:
>> http://build.one-lab.org/planetlab/2007.12.20--planetlab-f7-linux32/
>> that contains nodemanager from the svn trunk
>>
>> I associated an Initscript to a slice(with the id returned by the db
>> when I added the initscript)
>> then locally in the node I restarted the NM , but nothing happens.
>>
>> My understanding reading the code is that, when the sm.py calls
>> GetSlivers(),
>> the nodemanager looks for a slice attribute named
>> "plc_initscript_id", while we naively use the predefined one simply
>> named 'initscript', and so our db contains something like this
>> {'instantiation': u'plc-instantiated', 'name': u'Slice_Name',
>> 'slice_id': *, 'keys': [], 'expires': 1199363409L, 'attributes':
>> [{'name': u'initscript', 'value': u'*'}
>>
>>
>> ****
>> So based on this part of the sm.py code:
>> ******************
>> for sliver in data['slivers']:
>> logger.verbose("sm:GetSlivers in slivers loop")
>> .....
>> ........
>> .........
>>
>> rec.setdefault('vref', attr_dict.get('vref', 'default'))
>> is_id = attr_dict.get('plc_initscript_id')
>> if is_id is not None and is_id in initscripts_by_id:
>> rec['initscript'] = initscripts_by_id[is_id]
>> else:
>> rec['initscript'] = '' "
>> ************
>> the rec['initscript'] that gets passed to the sliver_vs.py class,
>> will be empty..
>>
>> ==
>>
>> I haven't run the code myself, but if the above is correct, we would
>> advocate to either
>> (a) change the predefined slice attribute name to what is expected
>> by the nm so that the system works (b) or change the node manager
>> code to use the predefined name instead
>> I guess there are implications in terms of legacy that need be taken
>> into account.
>> In any case, it would of course make sense to add the feature that
>> we've discussed already, since an initscript name would probably be
>> a preferred method for slices to refer to initscripts. To this
>> respect, we could simply check whether the value attached to the
>> slice attribute is an integer or not, and react accordingly. We'd
>> appreciate to hear your comments on this matter
>>
>> Thanks - Thierry
>> ==
>> PS. fyi - we've started to add a unit test about this in our system
>> test suite.
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Devel mailing list
>> Devel at lists.planet-lab.org
>> https://lists.planet-lab.org/mailman/listinfo/devel
>
> _______________________________________________
> Devel mailing list
> Devel at lists.planet-lab.org
> https://lists.planet-lab.org/mailman/listinfo/devel
>
More information about the Devel
mailing list