def addservices(self, node):
        if len(node.services) == 0:
            return
        defaults = self.session.services.getdefaultservices(node.type)
        if node.services == defaults:
            return
        spn = self.createElement("Node")
        spn.setAttribute("name", node.name)
        self.sp.appendChild(spn)

        for svc in node.services:
            s = self.createElement("Service")
            spn.appendChild(s)
            s.setAttribute("name", str(svc._name))
            s.setAttribute("startup_idx", str(svc._startindex))
            if svc._starttime != "":
                s.setAttribute("start_time", str(svc._starttime))
            # only record service names if not a customized service
            if not svc._custom:
                continue
            s.setAttribute("custom", str(svc._custom))
            addelementsfromlist(self, s, svc._dirs, "Directory", "name")
            
            for fn in svc._configs:
                if len(fn) == 0:
                    continue
                f = self.createElement("File")
                f.setAttribute("name", fn)
                # all file names are added to determine when a file has been deleted
                s.appendChild(f)
                data = self.session.services.getservicefiledata(svc, fn)
                if data is None:
                    # this includes only customized file contents and skips
                    # the auto-generated files
                    continue
                txt = self.createTextNode(data)
                f.appendChild(txt)
                    
            addtextelementsfromlist(self, s, svc._startup, "Command",
                                    (("type","start"),))
            addtextelementsfromlist(self, s, svc._shutdown, "Command",
                                    (("type","stop"),))
            addtextelementsfromlist(self, s, svc._validate, "Command",
                                    (("type","validate"),))
Add services and their customizations to the ServicePlan.
dataset/ETHPy150Open coreemu/core/daemon/core/misc/xmlwriter0.py/CoreDocumentWriter0.addservices