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


Python ComSystem.execLocal方法代码示例

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


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

示例1: rescan

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocal [as 别名]
    def rescan(self, __hosts, __bus, __target, __lun):
        """ Rescan SCSI
        invokes a rescan via /sys/class/scsi_host/hostH/scan interface
        IDEAS
        INPUTS
          * host - name of scsi host ( - for all )
          * bus - number of scsi bus (- for all )
          * target - number of target ( - for all )
          * lun - number of lun ( - for all )

        """
        __syspath = "/sys/class/scsi_host"

        if not os.path.isdir(__syspath):
            raise ComException(__syspath + " not found")

        if __hosts == "-":
            __hosts = self.getAllSCSIHosts()

        if not (ComUtils.isInt(__bus) or __bus == "-"):
            raise ComException(__bus + " is not valid to scan SCSI Bus")

        if not (ComUtils.isInt(__target) or __target == "-"):
            raise ComException(__bus + " is not valid to scan SCSI Target")

        if not (ComUtils.isInt(__lun) or __lun == "-"):
            raise ComException(__bus + " is not valid to scan SCSI Lun")

        print "Hosts: ", __hosts

        for __host in __hosts:
            ComSystem.execLocal(
                'echo "' + __bus + '" "' + __target + '" "' + __lun + '" > ' + __syspath + "/" + __host + "/scan"
            )
开发者ID:radicke-atix-de,项目名称:comoonics-cluster-suite,代码行数:36,代码来源:ComScsi.py

示例2: scanBootloaderGrub

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocal [as 别名]
    def scanBootloaderGrub(self):
        #scans bootdisk for a possible grub installation
        #returns (hd0,x) when succeeded
        import tempfile
        __tmp=tempfile.NamedTemporaryFile()

        # This is not working with all devices (e.g. cciss, mpath)
        # So I removed the part.
        #__exp=re.compile("[0-9]*")
        #__dev=__exp.sub("",self.getDeviceName())
        __dev=self.getDeviceName()
        __cmd="""/sbin/grub --batch 2>/dev/null <<EOF | egrep "(hd[0-9]+,[0-9]+)" 1>"""+__tmp.name+"""
        device (hd0) """+__dev+"""
        find /grub/stage2
        quit
        EOF
        """
        # TODO this will not work
        if ComSystem.execLocal( __cmd, """(hd0,1)
""" ):
            raise ComException("cannot find grub on "+__dev)

        __part=__tmp.readline()
        self.log.debug("Found grub loader on " + __part)
        return __part
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:27,代码来源:ComBootDisk.py

示例3: rereadPartitionTable

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocal [as 别名]
 def rereadPartitionTable(self):
    """ rereads the partition table of a disk """
    __cmd = CMD_SFDISK + " -R " + self.getDeviceName() + " >/dev/null 2>&1"
    if ComSystem.execLocal(__cmd):
       self.commit()
       return False
    else:
       self.commit()
       return True
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:11,代码来源:ComDisk.py

示例4: check

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocal [as 别名]
 def check(*args, **kwds):
     ret = False
     try:
         if not kwds and not args:
             #                SystemInformation.log.debug("Checking for cluster availability")
             if (
                 os.path.exists(RedhatClusterSystemInformation.REDHAT_CLUSTER_CONF)
                 and ComSystem.execLocal("%s >/dev/null 2>&1" % (RedhatClusterSystemInformation.CLUSTAT_CMD)) == 0
             ):
                 #                    SystemInformation.log.debug("OK")
                 ret = True
         #                else:
         #                    SystemInformation.log.debug("FAILED")
         else:
             if kwds.has_key("type") and kwds["type"] == "cluster":
                 ret = True
     finally:
         return ret
开发者ID:radicke-atix-de,项目名称:comoonics-cluster-suite,代码行数:20,代码来源:ComSystemInformation.py

示例5: installBootloaderGrub

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocal [as 别名]
   def installBootloaderGrub(self):
      # To DO
      # Add some checks if grub install was successfull.

      __part=self.scanBootloaderGrub()
      # This is not working with all devices (e.g. cciss, mpath)
      # So I removed the part.
      #__exp=re.compile("[0-9]*")
      #__dev=__exp.sub("",self.getDeviceName())
      __dev=self.getDeviceName()
      __cmd="""grub --batch 2>/dev/null <<EOF | grep "succeeded" > /dev/null
      device (hd0) """+__dev+"""
      root """ +__part+ """
      setup (hd0)
      quit
EOF"""
      if ComSystem.execLocal( __cmd ):
         raise ComException("cannot install grub on "+__dev)
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:20,代码来源:ComBootDisk.py

示例6: deletePartitionTable

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocal [as 别名]
 def deletePartitionTable(self):
    """ deletes the partition table """
    __cmd = CMD_DD + " if=/dev/zero of=" + self.getDeviceName() + " bs=512 count=2 >/dev/null 2>&1"
    if ComSystem.execLocal(__cmd):
       return False
    return self.rereadPartitionTable()
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:8,代码来源:ComDisk.py

示例7: testExecLocalFalse

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocal [as 别名]
 def testExecLocalFalse(self):
     ComSystem.setExecMode(None)
     result = ComSystem.execLocal("/bin/false", "output of /bin/false, execLocal")
     self.assertEquals(result, 256)
开发者ID:radicke-atix-de,项目名称:comoonics-cluster-suite,代码行数:6,代码来源:testComSystem.py

示例8: tearDown

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import execLocal [as 别名]
 def tearDown(self):
     from comoonics import ComSystem
     ComSystem.execLocal("rm -rf %s" %self.__tmpdir)
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:5,代码来源:testCatifModification.py


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