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


Python ComSystem.execLocalOutput方法代码示例

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


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

示例1: lock

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
 def lock(self, sleeptime=-1, retries=-1, locktimeout=-1, suspend=-1):
     try:
         ComSystem.execLocalOutput("%s %s %s" %(self.COMMAND, self._buildOptions(sleeptime, retries, locktimeout, suspend), self.filename))
     except ComSystem.ExecLocalException, ele:
         if ele.rc==73<<8:
             raise lockfileTimeout(self.filename)
         else:
             raise ele
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:10,代码来源:lockfile.py

示例2: isDMMultipath

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
 def isDMMultipath(self):
    if not os.path.exists(CMD_DMSETUP):
       return False
    __cmd="%s table %s --target=multipath 2>/dev/null | grep multipath &>/dev/null"  % (CMD_DMSETUP, self.getDeviceName())
    try:
       ComSystem.execLocalOutput(__cmd, True, "")
       return True
    except ComSystem.ExecLocalException: 
       return False
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:11,代码来源:ComDisk.py

示例3: mount

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
        def mount(self, device, mountpoint, readOnly=0, bindMount=0, instroot=""):
            if not self.isMountable():
                return
            iutil.mkdirChain("%s/%s" %(instroot, mountpoint))
#            if flags.selinux:
#                log.info("Could not mount nfs filesystem with selinux context enabled.")
#                return
            anacondalog.debug("nfsFileSystem: Mounting nfs %s => %s" %(device, "%s/%s" %(instroot, mountpoint)))
            ComSystem.execLocalOutput("mount -t nfs -o nolock %s %s/%s" %(device, instroot, mountpoint))
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:11,代码来源:nfs.py

示例4: checkFs

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
 def checkFs(self, device):
     """ check filesystem on device (virtual method)
     device: ComDevice.Device
     """
     if self.getFsckCmd():
         (__cmd)=self.getFsckCmd()+" "+device.getDeviceName()
         log.debug("checkFs: cmd: %s" %(__cmd))
         ComSystem.execLocalOutput(__cmd)
     else:
         raise NotImplementedYetException("Method checkFs is not implemented by filesystem %s (class: %s)." %(self.getName(), self.__class__.__name__))
开发者ID:radicke-atix-de,项目名称:comoonics-cluster-suite,代码行数:12,代码来源:ComFileSystem.py

示例5: scsi_remove_disk

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
def scsi_remove_disk(host, disk_path):
   target=False
   if os.path.isdir(disk_path) and os.access(disk_path, os.W_OK):
      log.debug("scsi_remove_disk(%s/delete)" %(disk_path))
      try: 
         ComSystem.execLocalOutput("echo %s > %s" %(SCSIDELETE_CMD, disk_path+"/device/delete"))
      except Exception, e:
         log.debug("Error during scsi_remove_disk %s." %e)
      #remove=open(disk_path+"/delete", "w")
      #print >> remove, SCSIDELETE_CMD
      target=True
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:13,代码来源:ComSCSI.py

示例6: _do

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
 def _do(self):
    """
    If need be does something
    """
    from comoonics.scsi import ComSCSI
    if self.name == "rescan":
       ComSCSI.rescan(self.dest)
    elif self.name == "rescan_qla":
       ComSCSI.rescan_qla(self.dest)
    else:
       raise SCSIRequirementException("Unsupported SCSI Rescan name %s", self.name)
    ComSystem.execLocalOutput("udevsettle")
    stabilized.stabilized(file="/proc/partitions", iterations=10, type="hash")
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:15,代码来源:ComSCSIRequirement.py

示例7: createPartitionsParted

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
    def createPartitionsParted(self):
        import parted
        import ComParted
        if not self.exists():
            raise ComException("Device %s not found" % self.getDeviceName())

        phelper=ComParted.PartedHelper()
        #IDEA compare the partition configurations for update
        #1. delete all aprtitions
        dev=parted.PedDevice.get(self.getDeviceName())

        try:
            disk=parted.PedDisk.new(dev)
            disk.delete_all()
        except parted.error:
            #FIXME use generic disk types
            disk=dev.disk_new_fresh(parted.disk_type_get("msdos"))

        # create new partitions
        for com_part in self.getAllPartitions():
            type=com_part.getPartedType()
            if self.sameSize():
                size=com_part.getPartedSize(dev)
            else:
                size=com_part.getPartedSizeOptimum(dev)
            flags=com_part.getPartedFlags()
            self.log.debug("creating partition: size: %i" % size )
            phelper.add_partition(disk, type, size, flags)

        disk.commit()
        self.commit()

        #dev.sync()
        #dev.close()

        # run partx if the device is a multipath device
        self.log.debug("ComHostDisk: checking for multipath devices")
        if self.isDMMultipath():
            self.log.debug("Device %s is a dm_multipath device, adding partitions" %self.getDeviceName())
            __cmd=CMD_KPARTX + " -d " + self.getDeviceName()
            try:
                __ret = ComSystem.execLocalOutput(__cmd, True, "")
                self.log.debug(__ret)
                __cmd=CMD_KPARTX + " -a " + self.getDeviceName()
                __ret = ComSystem.execLocalOutput(__cmd, True, "")
                self.log.debug(__ret)
                #FIXME: crappy fix to give os some time to create devicefiles.
                time.sleep(10)
            except ComSystem.ExecLocalException, ele:
                ComLog.debugTraceLog(self.log)
                self.log.debug("Could not execute %s. Error %s" %(ele.cmd, ele))
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:53,代码来源:ComDisk.py

示例8: check

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
 def check(*args, **kwds):
     ret=False
     try:
         if not kwds and not args:
             ComSystem.execLocalOutput("%s -qf $(which rpm)" %(RPMLinuxSystemInformation.RPM_CMD))
             ret= True
         elif kwds.has_key("operatingsystem") and  \
             (re.compile("linux", re.I).search(kwds["operatingsystem"]) or \
              re.compile("centos", re.I).search(kwds["operatingsystem"]) or \
              re.compile("fedora", re.I).search(kwds["operatingsystem"]) or \
              re.compile("redhat", re.I).search(kwds["operatingsystem"])):
             ret=True
     finally:
         return ret
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:16,代码来源:ComSystemInformation.py

示例9: queryStatusElement

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
 def queryStatusElement(self, **kwds):
     import xml.dom
     self.__setfromkwds("clusterstatus_cmd", kwds, self.clusterstatus_cmd)
     self.__setfromkwds("clusterstatus_opts", kwds, self.clusterstatus_opts)
     asValue=self.__getfromkwds("asvalue", kwds, True)
     delimitor=self.__getfromkwds("delimitor", kwds, " ")
     query=self.__getfromkwds("query", kwds, None)
     __output=self.__getfromkwds("output", kwds, None)
     self.log.debug("queryStatusElement: query=%s" %query)
     try:
         # create Reader object
         _dom=comoonics.XmlTools.parseXMLString(ComSystem.execLocalOutput(self.getClusterStatusCmd(True, delimitor), True, __output))
         if not query:
             return _dom.documentElement
         else:
             _tmp1 = comoonics.XmlTools.evaluateXPath(query, _dom.documentElement)
             _tmp2 = None
             if asValue:
                 _tmp2=list()
                 for i in range(len(_tmp1)):
                     if isinstance(_tmp1[i], xml.dom.Node) and _tmp1[i].nodeType == xml.dom.Node.ATTRIBUTE_NODE:
                         _tmp2.append(_tmp1[i].value)
                     else:
                         _tmp2.append(_tmp1[i])
                 return delimitor.join(_tmp2)
             else:
                 return comoonics.XmlTools.toPrettyXML(_tmp1[0])
     except ComSystem.ExecLocalException, error:
         warnings.warn("Could not query the running cluster with %s. No active values will be available." %self.clusterstatus_cmd)
         self.log.debug("Error: %s" %error)
         return None
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:33,代码来源:RedHatClusterHelper.py

示例10: _copyData

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
    def _copyData(self):
        # FIXME: this implementation is VERY POOR!! This should be fixed without any instance casting of classes on
        #        the end of the child tree. There should be a abstract class FilesystemCopyObject and PathCopyObject
        #        derive from!!!!
        # 1. copy fs/path to fs/path
        ComLog.getLogger(__logStrLevel__).debug("doCopy: instance(self.source: %s), instance(self.dest: %s)" %(self.source.__class__, self.dest.__class__))
        ComLog.getLogger(__logStrLevel__).debug("doCopy: isinstance(%s, PathCopyObject): %s" %(self.source.__class__, isinstance(self.source, PathCopyObject)))
        if isinstance(self.source, FilesystemCopyObject) or isinstance(self.source, PathCopyObject):
            if isinstance(self.source, FilesystemCopyObject):
                if not self.source.filesystem.isCopyable():
                    return True
            mountpoint=self.source.getMountpoint().getAttribute("name")
            ComLog.getLogger(__logStrLevel__).debug("doCopy: isinstance(%s, PathCopyObject): %s" %(self.dest.__class__, isinstance(self.dest, PathCopyObject)))
            if isinstance(self.dest, FilesystemCopyObject) or isinstance(self.dest, PathCopyObject):
                __cmd = self._getFSCopyCommand()
                try:
                    __out = ComSystem.execLocalOutput(__cmd, True)
                except ComSystem.ExecLocalException, ele:
                    raise RSyncError(ele)
                #ComLog.getLogger(__logStrLevel__).debug("doCopy: "  + __cmd +" "+ __ret)
                return True

            # 2. copy fs to archive
            elif isinstance(self.dest, ArchiveCopyObject):
#                try:
                archive=self.dest.getDataArchive()
                archive.createArchive("./", mountpoint)
                return True
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:30,代码来源:ComFilesystemCopyset.py

示例11: savePartitionTable

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
 def savePartitionTable(self, filename):
    """ saves the Disks partition table in sfdisk format to <filename>
    Throws ComException on error
    """
    __cmd = self.getDumpStdout() + " > " + filename
    __ret = ComSystem.execLocalOutput(__cmd, True, "saved partition table")
    self.log.debug("savePartitionTable( " + filename + "):\n " + __ret)
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:9,代码来源:ComDisk.py

示例12: doRealModifications

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
 def doRealModifications(self):
     """
     calls doCatifAction for every action
     """
     _dest=self.getAttribute("destination", "./")
     self.errors=self.getAttribute("errors", "log")
     _childs=self.getElement().getElementsByTagName(self.child)
     for _child in _childs:
         _name=_child.getAttribute("name")
         _names=list()
         _names.append(_name)
         try:
             if re.findall("\$\(.+\)", _name):
                 _names=re.split("\s+", str(ComSystem.execLocalOutput("echo %s" %_name)[0])[:-1])
                 CatifModification.logger.debug("doRealModifications() _names: %s" %_names)
         except ExecLocalException:
             _names=None
         _log=None
         if self.hasAttribute("log"):
             _log=self.getAttribute("log")
         elif _child.hasAttribute("log"):
             _log=_child.getAttribute("log")
         if not _names:
             continue
         for _name in _names:
             try:
                 if _name and _name != "":
                     self.doCatifAction(_name, _dest, _log)
             except ExecLocalException, _ale:
                 self._handleError(_ale)
             except pexpect.ExceptionPexpect, ep:
                 self._handleError(ep)
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:34,代码来源:ComCatifModification.py

示例13: getIP

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
 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,代码行数:29,代码来源:ComClusterNodeNic.py

示例14: executeSaveFs

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
 def executeSaveFs(self, level, file=None):
    values=list()
    if file:
       self.savefs_options.append(LegatoNetworker.OPTION_NOT_IN_SAVESET)
       values.append(file)
    _cmd="%s %s -l %s -c %s -s %s -g %s %s" %(LegatoNetworker.LEGATO_CMD_SAVEFS, " ".join(self.savefs_options), level, \
                                   self.client, self.server, self.group, " ".join(values))
    _output=ComSystem.execLocalOutput(_cmd)
    self.log.debug("executeSaveFs: cmd=%s, output=%s" %(_cmd, _output))
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:11,代码来源:ComEMCLegatoNetworker.py

示例15: restorePartitionTable

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocalOutput [as 别名]
 def restorePartitionTable(self, filename):
    """ writes partition table stored in <filename> to Disk.
    Note, that the format has to be sfdisk stdin compatible
    see sfdisk -d
    Throws ComException on error
    """
    __cmd = self.getRestoreStdin(True) + " < " + filename
    __out = ComSystem.execLocalOutput(__cmd, True, "")
    self.log.debug("restorePartitionTable( " + filename + "):\n " + __out)
    self.commit()
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:12,代码来源:ComDisk.py


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