Changeset cebcdce


Ignore:
Timestamp:
Dec 1, 2011 5:10:32 PM (12 years ago)
Author:
Ted Faber <faber@…>
Branches:
compt_changes, info-ops, master
Children:
7f57435
Parents:
32b4536
Message:

Track initial state image name; move attributes into emulab_access:
namespace

Location:
fedd/federation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/emulab_access.py

    r32b4536 rcebcdce  
    10321032                if a not in attr: attr.append(a)
    10331033
     1034        def merge_os(os, e):
     1035            if len(e.os) == 0:
     1036                # No OS at all:
     1037                if os.get_attribute('emulab_access:image'):
     1038                    os.set_attribute('emulab_access:initial_image',
     1039                            os.get_attribute('emulab_access:image'))
     1040                e.os = [ os ]
     1041            elif len(e.os) == 1:
     1042                # There's one OS, copy the initial image and replace
     1043                eos = e.os[0]
     1044                initial = eos.get_attribute('emulab_access:initial_image')
     1045                if initial:
     1046                    os.set_attribute('emulab_access:initial_image', initial)
     1047                e.os = [ os]
     1048            else:
     1049                # Multiple OSes, replace or append
     1050                for eos in e.os:
     1051                    if os.name == eos.name:
     1052                        eos.version = os.version
     1053                        eos.version = os.distribution
     1054                        eos.version = os.distributionversion
     1055                        for a in os.attribute:
     1056                            if eos.get_attribute(a.attribute):
     1057                                eos.remove_attribute(a.attribute)
     1058                            eos.set_attribute(a.attribute, a.value)
     1059                        break
     1060                else:
     1061                    e.os.append(os)
     1062
     1063
     1064        if t is None: return
    10341065        # Copy the assigned names into the return topology
    10351066        for e in t.elements:
     
    10421073                        e.status = info.node[e.name].status
    10431074                        os = info.node[e.name].getOS()
    1044                         if os: e.os = [ os ]
     1075                        if os: merge_os(os, e)
    10451076                else:
    10461077                    # Simple debugging assignment
  • fedd/federation/emulab_segment.py

    r32b4536 rcebcdce  
    3333                        version=self.osversion)
    3434            if self.image and rv:
    35                 rv.set_attribute('image', self.image)
     35                rv.set_attribute('emulab_access:image', self.image)
    3636            return rv
    3737
     
    295295                raise service_error(service_error.internal,
    296296                        "Cannot get node mapping of segment:%s/%s" % (pid, eid))
    297     def get_image(self, node, top):
     297    def get_initial_image(self, node, top):
    298298        for e in top.elements:
    299299            if isinstance(e, topdl.Computer):
    300300                if node == e.name:
    301                     if e.os:
    302                         return e.os[0].get_attribute('image')
     301                    if e.os and len(e.os) == 1:
     302                        return e.os[0].get_attribute(
     303                                'emulab_access:initial_image')
    303304        return None
    304305
     
    326327                return False
    327328            elif state == 'initial':
    328                 image = self.get_image(lnode, top)
     329                image = self.get_initial_image(lnode, top)
    329330                if image:
    330331                    pid, iid = image.split('/')
  • fedd/federation/local_emulab_segment.py

    r32b4536 rcebcdce  
    141141    def __call__(self, parent, op, targets, param, top):
    142142        for l, p in targets.items():
    143             self.log.info("[operation_segment]: Calling op on %s(%s)" % (l,p))
     143            self.log.info("[operation_segment]: Calling op %s on %s(%s)" % \
     144                    (op, l,p))
    144145            self.do_operation(op, l, p, param, top)
    145146        return True
Note: See TracChangeset for help on using the changeset viewer.