Changeset 5f96438
- Timestamp:
- Apr 7, 2010 11:14:49 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- c23684d
- Parents:
- 73e7f5c
- Location:
- fedd/federation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/experiment_control.py
r73e7f5c r5f96438 886 886 "uri": uri, 887 887 } 888 if 'service' in r: 888 if 'service' in r: 889 for s in r['service']: 890 # Tag each service with the origin testbed 891 if s.has_key('fedAttr'): 892 # The else connects with the for 893 for a in s['fedAttr']: 894 if a.get('attribute', None) == 'testbed'): 895 break 896 else: 897 s['fedAttr'].append({'attribute': 'testbed', 898 'value': tb}) 899 else: 900 s['fedAttr'] = [ {'attribute': 'testbed', 'value': tb} ] 889 901 services.extend(r['service']) 890 902 … … 1614 1626 testbeds = set([ a.value for e in top.elements \ 1615 1627 for a in e.attribute \ 1616 if a.attribute == 'testbed'])1628 if a.attribute == 'testbed']) 1617 1629 1618 1630 allocated = { } # Testbeds we can access … … 1620 1632 connInfo = { } # Connection information 1621 1633 services = [ ] 1634 masters = { } # testbeds exporting services 1622 1635 self.get_access_to_testbeds(testbeds, access_user, 1623 1636 export_project, master, allocated, tbparams, services) 1637 1638 # After this masters will hold a set of services exported by each 1639 # testbed 1640 for s in services: 1641 i = s.get('visibility', 'import') 1642 if i == 'export': 1643 for a in s.get('fedAttr', []): 1644 if a.get('attribute', '') == 'testbed': 1645 tb = a.get('value', None) 1646 if tb: 1647 if masters.has_key(tb): masters[tb].add(s.name) 1648 else: masters[tb] = set([s.name]) 1649 else: 1650 log.error('Testbed attribute with no value?') 1651 1652 1624 1653 self.split_topology(top, topo, testbeds) 1625 1654 … … 1658 1687 part = experiment_partition(self.auth, self.store_url, self.tbmap, 1659 1688 self.muxmax) 1660 part.add_portals(top, topo, eid, master , tbparams, ip_allocator,1689 part.add_portals(top, topo, eid, masters, tbparams, ip_allocator, 1661 1690 connInfo, expid) 1662 1691 # Now get access to the dynamic testbeds -
fedd/federation/experiment_partition.py
r73e7f5c r5f96438 56 56 57 57 58 def new_portal_node(self, st, dt, tbparams, master , eid, myname, desthost,58 def new_portal_node(self, st, dt, tbparams, masters, eid, myname, desthost, 59 59 portal_type, iface_desc=(), conn_type="ssh", conn_attrs=[], 60 60 expid=None): … … 63 63 be attached. 64 64 """ 65 seer_master = None 66 for k, s in masters.items(): 67 if 'SEER' in s: 68 seer_master = k 69 break 70 71 if seer_master: 72 mdomain = tbparams[seer_master].get('domain', '.example.com') 73 mproject = tbparams[seer_master].get('project', 'project') 74 muser = tbparams[seer_master].get('user', 'root') 75 smbshare = tbparams[seer_master].get('smbshare', 'USERS') 76 else: 77 mdomain = '.example.com' 78 mproject = 'project' 79 muser = 'root' 80 smbshare = 'USERS' 81 65 82 dproject = tbparams[dt].get('project', 'project') 66 83 ddomain = tbparams[dt].get('domain', ".example.com") 67 mdomain = tbparams[master].get('domain', '.example.com') 68 mproject = tbparams[master].get('project', 'project') 69 muser = tbparams[master].get('user', 'root') 70 smbshare = tbparams[master].get('smbshare', 'USERS') 71 72 if st == master or dt == master: 73 active = ("%s" % (st == master)) 84 85 if (st in masters and dt not in masters) or \ 86 ( st in masters and dt not in masters ): 87 active = ("%s" % (st in masters)) 74 88 else: 75 89 active = ("%s" % (st > dt)) … … 249 263 ) 250 264 251 def create_dragon_substrate(self, sub, topo, tbs, tbparams, master , eid,265 def create_dragon_substrate(self, sub, topo, tbs, tbparams, masters, eid, 252 266 connInfo, expid=None): 253 267 """ … … 263 277 264 278 265 mdomain = tbparams[master].get('domain', '.example.com') 266 mproject = tbparams[master].get('project', 'project') 279 seer_master = None 280 for k, s in masters.items(): 281 if 'SEER' in s: 282 seer_master = k 283 break 284 285 if seer_master: 286 mdomain = tbparams[seer_master].get('domain', '.example.com') 287 mproject = tbparams[seer_master].get('project', 'project') 288 else: 289 mdomain = '.example.com' 290 mproject = 'project' 291 267 292 # dn is the number of previously created dragon nets. This routine 268 293 # creates a net numbered by dn … … 295 320 # This may need another look, but only a service gateway will 296 321 # look at the active parameter, and these are only inserted to 297 # connect to themaster.298 active = "%s" % ( tb == master)322 # connect to a master. 323 active = "%s" % ( tb in masters) 299 324 info = { 300 325 'type': 'transit', … … 332 357 self.new_dragon_topo(dn, sub, topo, tbs, tbparams, connInfo, expid) 333 358 334 def insert_internet_portals(self, sub, topo, tbs, tbparams, master , eid,359 def insert_internet_portals(self, sub, topo, tbs, tbparams, masters, eid, 335 360 segment_substrate, portals, connInfo, expid): 336 361 # More than one testbed is on this substrate. Insert … … 347 372 sproject = tbparams[st].get('project', 'project') 348 373 dproject = tbparams[dt].get('project', 'project') 349 mproject = tbparams[master].get('project', 'project')350 374 sdomain = tbparams[st].get('domain', ".example.com") 351 375 ddomain = tbparams[dt].get('domain', ".example.com") 352 mdomain = tbparams[master].get('domain', '.example.com')353 muser = tbparams[master].get('user', 'root')354 smbshare = tbparams[master].get('smbshare', 'USERS')355 376 aid = tbparams[dt]['allocID']['fedid'] 356 if st == master or dt == master: 357 active = ("%s" % (st == master)) 377 378 seer_master = None 379 for k, s in masters.items(): 380 if 'SEER' in s: 381 seer_master = k 382 break 383 384 if seer_master: 385 mdomain = tbparams[seer_master].get('domain', '.example.com') 386 mproject = tbparams[seer_master].get('project', 'project') 387 muser = tbparams[seer_master].get('user', 'root') 388 smbshare = tbparams[seer_master].get('smbshare', 'USERS') 389 else: 390 mdomain = '.example.com' 391 mproject = 'project' 392 muser = 'root' 393 smbshare = 'USERS' 394 395 if (st in masters and dt not in masters) or \ 396 (st not in masters and dt in masters): 397 active = ("%s" % (st in masters)) 358 398 else: 359 399 active = ("%s" %(st > dt)) 400 360 401 if not segment_substrate[st].has_key(dt): 361 402 # Put a substrate and a segment for the connected … … 404 445 desthost = "%stunnel%d" % (st.lower(), len(portals[st][dt])) 405 446 406 if dt == master or st == master: portal_type = "both"447 if dt in masters or st in masters: portal_type = "both" 407 448 else: portal_type = "experiment" 408 449 … … 415 456 ) 416 457 portal, info = self.new_portal_node(st, dt, tbparams, 417 master , eid, myname, desthost, portal_type,458 masters, eid, myname, desthost, portal_type, 418 459 infs, conn_type="ssh", conn_attrs=[], expid=expid) 419 460 … … 422 463 connInfo[st].append(info) 423 464 424 def add_control_portal(self, st, dt, master , eid, topo, tbparams, connInfo, expid):465 def add_control_portal(self, st, dt, masters, eid, topo, tbparams, connInfo, expid): 425 466 # Add to the master testbed 426 467 tsubstrate, segment_element = \ … … 429 470 desthost = "%stunnel" % st 430 471 431 portal, info = self.new_portal_node(st, dt, tbparams, master ,472 portal, info = self.new_portal_node(st, dt, tbparams, masters, 432 473 eid, myname, desthost, "control", 433 474 ((tsubstrate.name,(('portal','true'),)),), conn_type="ssh", … … 441 482 connInfo[st].append(info) 442 483 443 def new_dragon_portal(self, st, dt, master , eid, myip, dip, idx,484 def new_dragon_portal(self, st, dt, masters, eid, myip, dip, idx, 444 485 substrate, tbparams, expid): 445 486 # Add to the master testbed … … 447 488 desthost = "%s" % ip_addr(dip) 448 489 449 portal, info = self.new_portal_node(st, dt, tbparams, master ,490 portal, info = self.new_portal_node(st, dt, tbparams, masters, 450 491 eid, myname, desthost, "control", 451 492 ((substrate.name,( … … 456 497 return portal 457 498 458 def add_portals(self, top, topo, eid, master , tbparams, ip_allocator,499 def add_portals(self, top, topo, eid, masters, tbparams, ip_allocator, 459 500 connInfo, expid): 460 501 """ … … 483 524 all([tbparams[x].has_key('dragon') for x in tbs]): 484 525 self.create_dragon_substrate(s, topo, tbs, tbparams, 485 master , eid, connInfo, expid)526 masters, eid, connInfo, expid) 486 527 else: 487 self.insert_internet_portals(s, topo, tbs, tbparams, master ,528 self.insert_internet_portals(s, topo, tbs, tbparams, masters, 488 529 eid, segment_substrate, portals, connInfo, expid) 489 530 490 # Make sure that all the slaves have a control portal back to the 491 # master. 531 # Make sure that all the service importers have a control portal back 532 # to the master for each service. 533 #XXX you're here 492 534 for tb in [ t for t in tbparams.keys() if t != master ]: 493 535 if len([e for e in topo[tb].elements \
Note: See TracChangeset
for help on using the changeset viewer.