当前位置: 首页>>代码示例>>Python>>正文


Python comoonics.ComLog类代码示例

本文整理汇总了Python中comoonics.ComLog的典型用法代码示例。如果您正苦于以下问题:Python ComLog类的具体用法?Python ComLog怎么用?Python ComLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ComLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create

    def create(self):
        """
        Newly creates the logical volume
        """
        LinuxVolumeManager.has_lvm()
        size=""

        if self.ondisk and self.getAttribute("overwrite", "false") == "true":
            self.remove()

        try:
            self.init_from_disk()
        except:
            pass

        if self.ondisk:
            raise LinuxVolumeManager.LVMAlreadyExistsException(self.__class__.__name__+"("+str(self.getAttribute("name"))+")")
        try:
            size=self.getAttribute("size")
            if int(self.getAttribute("size")) > int(self.parentvg.getAttribute("free")):
                ComLog.getLogger(self.__logStrLevel__).warn("Requested LV size %s is too big taking free %s" % (self.getAttribute("size"), self.parentvg.getAttribute("free")))
                self.setAttribute("size", self.parentvg.getAttribute("free"))
                size=self.getAttribute("size")
        except NameError:
            if ComSystem.isSimulate():
                size="1000"
            else:
                size=self.parentvg.getAttribute("free")
        LinuxVolumeManager.lvm('lvcreate', '-L %sM' %size, '-n %s' %str(self.getAttribute("name")), '%s' %str(self.parentvg.getAttribute("name")))
        self.init_from_disk()
        if ComSystem.isSimulate():
            self.ondisk=True
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:32,代码来源:ComLVM.py

示例2: do_help

    def do_help(self, arg):
        ComLog.getLogger().debug("do_help(%s)" %(arg))
        arg=arg.strip()
        arg=arg.replace(" ", "_")
        if arg == '?' or arg == "help":
            cmds_keys=self.getCommands("do_")
            self.print_topics("",  cmds_keys, 15, 6)
            #self.print_topics(self.undoc_header, cmds_undoc, 15,80)
        elif arg:
            # XXX check arg syntax
            try:
                func = getattr(self, 'help_' + arg)
            except AttributeError:
                cmds_keys=self.getCommands("do_%s_" %(arg))
                if cmds_keys:
                    ComLog.getLogger().debug("do_help(%s, %s)" %(arg, cmds_keys))
                    self.print_topics("", cmds_keys, 15, 6)
                else:
                    try:
                        doc=getattr(self, 'do_' + arg).__doc__
                        if doc:
                            self.stdout.write("%s"%str(doc))
                            return
                    except AttributeError:
                        pass
#                    self.stdout.write("%s\n"%str(self.nohelp % (arg)))
                return
            func()
        else:
            self.stdout.write(HP_EVA_SSSU_Sim.DEFAULT_HELP)
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:30,代码来源:ComHP_EVA_SSSU_Sim.py

示例3: getCopyObject

def getCopyObject(element, doc):
    """ Factory function to create Copyset Objects"""
    if isinstance(element, Node):
        __type=element.getAttribute("type")
        #print "getCopyObject(%s)" %(element.tagName)
        if __type == "disk":
            from ComPartitionCopyObject import PartitionCopyObject
            cls=PartitionCopyObject
        elif __type == "filesystem":
            from ComFilesystemCopyObject import FilesystemCopyObject
            cls=FilesystemCopyObject
        elif __type == "lvm":
            from ComLVMCopyObject import LVMCopyObject
            cls=LVMCopyObject
        elif __type == "backup":
            from ComArchiveCopyObject import ArchiveCopyObject
            cls=ArchiveCopyObject
        elif _copyobject_registry.has_key(__type):
            cls=_copyobject_registry[__type]
            #from ComPathCopyObject import PathCopyObject
            #cls=PathCopyObject
        else:
            raise UnsupportedCopyObjectException("Unsupported CopyObject type %s in element %s" % (__type, element.tagName))
        ComLog.getLogger(CopyObject.__logStrLevel__).debug("Returning new object %s" %(cls))
        return cls(element, doc)
    else:
        raise UnsupportedCopyObjectException("Wrong parameters passed to factory method getCopyObject. Expected element, doc.")
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:27,代码来源:ComCopyObject.py

示例4: getCommands

    def getCommands(self, what):
            names = self.get_names()
            cmds = {}
            prevname = ''
            for name in names:
                if name[:len(what)] == what:
                    if name == prevname:
                        continue
                    prevname = name
                    under1=len(what)+name[len(what):].find("_")+1
#                    under2=-1
#                    if under1>0:
#                        under2=under1+name[under1:].find("_")+1
                    ComLog.getLogger().debug("do_help(name %s, what %s, under1 %u/%s" %(name, what, under1, name[:under1]))

                    if under1==len(what):
                        cmds[name[len(what):]]=1
                    elif under1>0 and not hasattr(self, name[:under1-1]):
                        cmds[name[len(what):]]=1
                    #elif not hasattr(self, "%s_%s" %(name[:name(+len
                    #    cmds[name[len(what):]]=1

#            self.stdout.write("%s\n"%str(self.doc_leader))
            self.stdout.write("%s" %(self.doc_header))
#            ComLog.getLogger().debug("do_help(cmds: %s" %(cmds))
            cmds_keys=cmds.keys()
            cmds_keys.sort()
            return cmds_keys
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:28,代码来源:ComHP_EVA_SSSU_Sim.py

示例5: updateMetaData

 def updateMetaData(self, element):
    ComLog.getLogger(self.__logStrLevel__).debug("%u logical volumes cloning all from source" %(len(self.getVolumeGroup().getLogicalVolumes())))
    #ComLog.getLogger(self.__logStrLevel__).debug("Element to copy %s" %(element))
    if (len(self.getVolumeGroup().getLogicalVolumes()) == 0):
       #ComLog.getLogger(self.__logStrLevel__).debug("0 logical volumes cloning all from source")
       XmlTools.merge_trees_with_pk(element, self.getVolumeGroup().getElement(), self.document, "name", XmlTools.ElementFilter("logicalvolume"))
       self.vg=VolumeGroup(self.getVolumeGroup().getElement(), self.getDocument())
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:7,代码来源:ComLVMCopyObject.py

示例6: __new__

 def __new__(cls, *args, **kwds):
     if len (args) > 0 and isinstance(args[0], Node):
         __type=args[0].getAttribute("type")
         #print "getCopyObject(%s)" %(element.tagName)
         if __type == "disk":
             from ComPartitionCopyObject import PartitionCopyObject
             cls=PartitionCopyObject
         elif __type == "filesystem":
             from ComFilesystemCopyObject import FilesystemCopyObject
             cls=FilesystemCopyObject
         elif __type == "lvm":
             from ComLVMCopyObject import LVMCopyObject
             cls=LVMCopyObject
         elif __type == "backup":
             from ComArchiveCopyObject import ArchiveCopyObject
             cls=ArchiveCopyObject
         elif _copyobject_registry.has_key(__type):
             cls=_copyobject_registry[__type]
             #from ComPathCopyObject import PathCopyObject
             #cls=PathCopyObject
         else:
             raise UnsupportedCopyObjectException("Unsupported CopyObject type %s in element %s" % (__type, args[0].tagName))
         ComLog.getLogger(CopyObject.__logStrLevel__).debug("Returning new object %s" %(cls))
         return object.__new__(cls, args, kwds)
     else:
         return object.__new__(cls, args, kwds)
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:26,代码来源:ComCopyObject.py

示例7: doPre

    def doPre(self):
        """
        Unpacks the given file to dest
        """
        srcfile=self.getAttribute("name")
        destfile=self.getAttribute("dest")
        __mkdir=self.getAttributeBoolean("mkdir", default=True)

        if not ComSystem.execMethod(os.path.exists, destfile) and __mkdir:
            ComLog.getLogger(ArchiveRequirement.__logStrLevel__).debug("Path %s does not exists. I'll create it." % destfile)
            os.makedirs(destfile)

        if self.check() and not ComSystem.isSimulate():
            if not os.access(srcfile, os.R_OK) or not os.access(destfile, os.F_OK) or not os.access(destfile, os.W_OK):
                raise ArchiveRequirementException("Either srcfile %s is not readable or dest %s is not writeable" % (srcfile, destfile))

        __cmd="rm -rf %s/*" % destfile
        (rc, rv) = ComSystem.execLocalGetResult(__cmd)
        if rc >> 8 != 0:
            raise RuntimeError("running \"%s\" failed: %u, %s" % (__cmd, rc,rv))

        self.olddir=os.curdir
        ComSystem.execMethod(os.chdir, destfile)
        __cmd="gzip -cd %s | cpio -i" % srcfile
        (rc, rv, stderr) = ComSystem.execLocalGetResult(__cmd, True)
        if rc >> 8 != 0:
            raise RuntimeError("running \"%s\" failed: %u, %s, %s" % (__cmd, rc,rv, stderr))
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:27,代码来源:ComArchiveRequirement.py

示例8: _testCdsls

    def _testCdsls(self, repository, clusterinfo, results):
        self.cwd.pushd(os.path.join(repository.root, repository.getMountpoint()))
#        setupCDSLRepository._createCDSLFiles(".")
        _dirs=results.keys()
        _dirs.sort()
        repository.buildInfrastructure(clusterinfo)
        for _path in _dirs:
            _cdsl=None
            try:
                _cdsl=repository.getCdsl(_path)
            except CdslNotFoundException:
                if results[_path][1] == True:
                    _cdsl=getCdsl(_path, CDSL_HOSTDEPENDENT_TYPE, repository, clusterinfo)
                elif results[_path][1] == False:
                    _cdsl=getCdsl(_path, CDSL_SHARED_TYPE, repository, clusterinfo)
            
            if _cdsl:
                self.assert_(repository.commit(_cdsl))
        ComLog.setLevel(logging.DEBUG, "comoonics.cdsl")
        repository.refresh()
        ComLog.setLevel(logging.INFO, "comoonics.cdsl")
        for cdsl in repository.getCdsls():
            self.assert_(repository.delete(cdsl))
        repository.removeInfrastructure(clusterinfo)       
#        setupCDSLRepository._removeCDSLFiles(".")
        self.cwd.popd()
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:26,代码来源:test_CdslRepository.py

示例9: getIP

 def getIP(self):
     """
     @return: Returns ip-address of interface
     @rtype: string
     """
     #optional attribute, return empty string if not set
     try:
         self.log.debug("get ip attribute: " + self.getAttribute(ComoonicsClusterRepository.attribute_netdev_ip))
         # special case for dhcp we'll return the given ipaddress
         if self.isDHCP():
             from comoonics import ComSystem
             import re
             try:
                 output=ComSystem.execLocalOutput("PATH=/sbin:/usr/sbin ip addr show %s" %self.getName(), True)
                 _mac=re.search("link/ether (?P<mac>\S+)", output).group("mac")
                 _ip=re.search(".*inet (?P<ip>[0-9.]+)", output).group("ip")
                 if _mac.upper() == self.getMac().upper():
                     return _ip
                 else:
                     return self.getAttribute(ComoonicsClusterRepository.attribute_netdev_ip)
             except:
                 ComLog.debugTraceLog(self.log)
                 return self.getAttribute(ComoonicsClusterRepository.attribute_netdev_ip)
         else:
             return self.getAttribute(ComoonicsClusterRepository.attribute_netdev_ip)
     except NameError:
         return ""
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:27,代码来源:ComClusterNodeNic.py

示例10: parseClusterConfFP

def parseClusterConfFP(_clusterconffp, _clusterconf, _validate=False):
    from comoonics import ComLog
    from comoonics import XmlTools
    try:
        doc = XmlTools.parseXMLFP(_clusterconffp)
    except Exception, arg:
        ComLog.getLogger().critical("Problem while reading clusterconfiguration (%s): %s" %(_clusterconf, str(arg)))
        raise
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:8,代码来源:__init__.py

示例11: serialize

    def serialize(self, element):
        from comoonics.storage.ComArchive import Archive
        earchive=self.getElement().getElementsByTagName("archive")[0]
        archive=Archive(earchive, self.getDocument())
#        print "Created archive: %s" %(archive)
        ComLog.getLogger(self.__logStrLevel__).debug("Saving element %s to archive" %(element))
        archive.addNextDOMElement(element)
        ComLog.getLogger(self.__logStrLevel__).debug("Saved element %s to archive element" %(element.tagName))
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:8,代码来源:ComMetadataSerializer.py

示例12: setUp

 def setUp(self):
     import inspect
     import os.path
     self.filename=os.path.join(os.path.dirname(inspect.getfile(self.__class__)), "loggingconfig.xml")
     self.cp=ConfigParser()
     self.cp.read(self.filename)
     self.loggers=["atix", "atix.atix1", "atix.atix2"]
     ComLog.fileConfig(self.filename)
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:8,代码来源:testXMLConfigParser.py

示例13: delete_attribute

 def delete_attribute(self, item, model, iter, name):
     self.status("Menu Delete attribute... " + name + " pressed menuitem %s, model %s, iter %s" % (item, model, iter))
     value = model.get_value(iter, DOMModel.COLUMN_NODE)
     ref_node=value.get_data(DOMModel.NODE_KEY)
     ref_node.removeAttribute(name)
     ComLog.getLogger(__logStrLevel__).debug("ref_node: %s" % ref_node)
     self.__basemodelr.clear()
     self.__basemodelr.createStoreModelFromNode(ref_node)
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:8,代码来源:ComDOMTreeView.py

示例14: selection_changed

 def selection_changed(self, selection, dest, filter):
     (model, iter) = selection.get_selected()
     ComLog.getLogger(__logStrLevel__).debug("Selection changed %s, %s, %s %s" % (model, iter, dest, filter))
     dest.clear()
     if iter:
         dest.createStoreModelFromNode(model.get_value(iter, DOMModel.COLUMN_NODE).get_data(DOMModel.NODE_KEY))
     if filter:
         filter.refilter()
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:8,代码来源:ComDOMTreeView.py

示例15: dtd_changed

 def dtd_changed(self, filedialog, chooser):
     ComLog.getLogger(__logStrLevel__).debug("dtd changed pressed %s, %s." %(filedialog, chooser))
     try:
         self.newFromDTDFile(filedialog.get_filename())
         chooser.get_model().clear()
         for element_txt in self.dtd.get_elements():
             chooser.append_text(element_txt)
     except:
         pass
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:9,代码来源:ComDOMTreeView.py


注:本文中的comoonics.ComLog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。