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


Python ComSystem.setExecMode方法代码示例

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


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

示例1: setSimulation

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
def setSimulation(flag):
    if flag:
        try:
            from comoonics import ComSystem
            ComSystem.setExecMode(ComSystem.SIMULATE)
        except ImportError:
            pass
开发者ID:MarcGrimme,项目名称:comoonics-initrd-ng,代码行数:9,代码来源:fence_scsi.py

示例2: testFilesystemCopyObject2

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
    def testFilesystemCopyObject2(self):
        from comoonics import ComSystem
        _xml="""
 <copyset type="filesystem" name="save-tmp">
    <source type="filesystem">
      <device id="sourcerootfs" name="/dev/vg_vmware_cluster_sr/lv_sharedroot" options="skipmount">
        <filesystem type="gfs"/>
        <mountpoint name="/">
          <option value="lock_nolock" name="lockproto"/>
          <option value="hdfhgg" name="locktable"/>
        </mountpoint>
      </device>
    </source>
    <destination type="filesystem">
      <device id="destrootfs" name="/dev/vg_vmware_cluster_srC/lv_sharedroot">
        <filesystem clustername="vmware_cluster" type="gfs"/>
        <mountpoint name="/var/lib/com-ec/dest">
          <option value="lock_nolock" name="lockproto"/>
          <option value="jhdshf" name="locktable"/>
        </mountpoint>
      </device>
    </destination>
 </copyset>
        """          
        oldexecmode=ComSystem.getExecMode()
        ComSystem.setExecMode(ComSystem.SIMULATE)
        self.__testCopyset(_xml)
        ComSystem.setExecMode(oldexecmode)
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:30,代码来源:testComFilesystemCopyset.py

示例3: testLVMCopyObject

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
 def testLVMCopyObject(self):
     import comoonics.XmlTools
     from comoonics.enterprisecopy.ComCopyObject import CopyObject
     from comoonics import ComSystem
     sourcexml="""
     <source type="lvm">
        <volumegroup name='centos' free='32' numlvs='2' attrs='wz--n-' numpvs='1' serial='0' size='3456'>
           <physicalvolume attr='a-' size='3456' name='/dev/sdf2' free='32' format='lvm2'/>
           <logicalvolume origin='' size='512' name='swap' attrs='-wi-a-'/>
           <logicalvolume origin='' size='2912' name='system' attrs='-wi-a-'/>
        </volumegroup>
    </source>
     """
     destxml="""
     <destination type="lvm">
         <volumegroup name="centos_new">
             <physicalvolume name="/dev/sde"/>
         </volumegroup>
     </destination>
     """
     ComSystem.setExecMode(ComSystem.SIMULATE)
     sourcedoc=comoonics.XmlTools.parseXMLString(sourcexml)
     destdoc=comoonics.XmlTools.parseXMLString(destxml)
     try:
         source=CopyObject(sourcedoc.documentElement, sourcedoc)
         dest=CopyObject(destdoc.documentElement, destdoc)
         dest.updateMetaData(source.getMetaData())
     except Exception, e:
         self.assert_("Could not execute copyobject %s => %s. Exception %s." %(source, dest, e))
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:31,代码来源:testLVMCopyObject.py

示例4: _testMethod

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
 def _testMethod(self, method, execmode, *params):
     oldmode=ComSystem.getExecMode()
     ComSystem.clearSimCommands()
     ComSystem.setExecMode(execmode)
     try:
         method(*params)
     except Exception, e:
         import traceback
         traceback.print_exc()
         self.fail("Could not execute %s method on with parameters %s, Error: %s" %(method, params, e))
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:12,代码来源:testComFileSystem.py

示例5: init

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
    def init(self):
        import os.path
        ComSystem.setExecMode(ComSystem.SIMULATE)
        super(test_ClusterNodeNic, self).init()
        #create comclusterRepository Object
        self.clusterRepository = getClusterRepository(os.path.join(self._testpath, "cluster2.conf"))

        #create comclusterinfo object
        self.clusterInfo = getClusterInfo(self.clusterRepository)  

        # setup the cashes for clustat for redhat cluster
        self.clusterInfo.helper.setSimOutput()
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:14,代码来源:test_ClusterNodeNic.py

示例6: setUp

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
 def setUp(self):
     from comoonics import ComSystem
     ComSystem.setExecMode(ComSystem.SIMULATE)
     from comoonics import ComLog
     import logging
     import inspect
     import os.path
     ComLog.setLevel(logging.DEBUG)
     self.helper=getClusterHelper()
     path=os.path.dirname(inspect.getfile(self.__class__))
     f=open(os.path.join(path, self.OUTPUT_TEST_FILE))
     import StringIO
     buf=StringIO.StringIO()
     for line in f:
         buf.write(line)
     self.TEST_OUTPUT=buf.getvalue()
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:18,代码来源:test_RedHatClusterHelper.py

示例7: init

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
    def init(self):
        import os.path
        ComSystem.setExecMode(ComSystem.SIMULATE)
        super(test_ClusterNode, self).init()
        #create comclusterRepository Object
        self.clusterRepository = getClusterRepository(os.path.join(self._testpath, "cluster2.conf"))

        #create comclusterinfo object
        self.clusterInfo = getClusterInfo(self.clusterRepository)  

        # setup the cashes for clustat for redhat cluster
        self.clusterInfo.helper.setSimOutput()
        self.nics=list()
        for node in self.clusterInfo.getNodes():
            node.helper.output=self.clusterInfo.helper.output
            for nic in node.getNics():
                self.nics.append(nic)
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:19,代码来源:test_ClusterNode.py

示例8: testsplitLVPath

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
 def testsplitLVPath(self):
     ComSystem.setExecMode(ComSystem.SIMULATE)
     for device in self.devicenames.keys():
         print("device="+device)
         expresult=self.devicenames[device][0]
         try:
             result=list(LogicalVolume.splitLVPath(device))
             if expresult != LogicalVolume.LVMInvalidLVPathException:
                 result.sort()
                 expresult.sort()
                 print "Found: vgname: %s, lvname: %s" %(result[0], result[1])
                 self.assertEquals(result, expresult, "vgname: %s lvname: %s but returned vgname %s, lvname %s" %(result[0], result[1], expresult[0], expresult[1]))
             else:
                 self.fail("We would expect a %s but got a %s" %(expresult, result))
         except LogicalVolume.LVMInvalidLVPathException, e:
             print e.value
             self.assertEquals(e.__class__, expresult, "Expected exception %s but got %s" %(expresult, e.__class__))
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:19,代码来源:testComLVM.py

示例9: init

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
    def init(self):
        import os.path
        from comoonics.cluster.ComClusterRepository import ClusterRepository
        from comoonics.cluster.ComClusterInfo import ClusterInfo
        import logging
        from comoonics import ComSystem
        ComSystem.setExecMode(ComSystem.SIMULATE)
        super(test_ClusterInfo, self).init()
        #create comclusterRepository Object
        self.clusterRepository = ClusterRepository(os.path.join(self._testpath, "cluster2.conf"))

        #create comclusterinfo object
        self.clusterInfo = ClusterInfo(self.clusterRepository)  

        # setup the cashes for clustat for redhat cluster
        ComLog.setLevel(logging.DEBUG)
        self.clusterInfo.helper.setSimOutput()
        self.nics=list()
        for node in self.clusterInfo.getNodes():
            node.helper.output=self.clusterInfo.helper.output
            for nic in node.getNics():
                self.nics.append(nic)
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:24,代码来源:test_ClusterInfo.py

示例10: testExecLocalStatusOutputFalse

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

示例11:

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
import sys
import os

sys.path.append("../lib")

from comoonics import ComScsi
from comoonics import ComSystem


ComSystem.setExecMode("ask")
#print os.listdir("/sys/class")

scsi=ComScsi.SCSI()
scsi.rescan("-", "-", "-", "-")
scsi.rescan("-", "0", "1", "2")
scsi.rescan("-", "x", "-", "-")
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:18,代码来源:testscsi.py

示例12: testExecMethodErrSim

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
 def testExecMethodErrSim(self):
     ComSystem.setExecMode(ComSystem.SIMULATE)
     result = ComSystem.execMethod(ComSystem.execLocalGetResult, self.cmd1, True)
     self.assertEquals(result, True)
开发者ID:radicke-atix-de,项目名称:comoonics-cluster-suite,代码行数:6,代码来源:testComSystem.py

示例13: testExecLocalStatusOutputSim

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
 def testExecLocalStatusOutputSim(self):
     ComSystem.setExecMode(ComSystem.SIMULATE)
     result = ComSystem.execLocalStatusOutput(self.cmd1, self.cmd1_simout)
     self.assertEquals(result, self.cmd1_sim_result[4])
开发者ID:radicke-atix-de,项目名称:comoonics-cluster-suite,代码行数:6,代码来源:testComSystem.py

示例14: testExecLocalGetResultErrSim

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
 def testExecLocalGetResultErrSim(self):
     ComSystem.setExecMode(ComSystem.SIMULATE)
     result = ComSystem.execLocalGetResult(self.cmd1, True, self.cmd1_simout, self.cmd1_simerr)
     self.assertEquals(result, self.cmd1_sim_result[3])
开发者ID:radicke-atix-de,项目名称:comoonics-cluster-suite,代码行数:6,代码来源:testComSystem.py

示例15: testExecLocalGetResultSim

# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import setExecMode [as 别名]
 def testExecLocalGetResultSim(self):
     ComSystem.setExecMode(ComSystem.SIMULATE)
     result = ComSystem.execLocalGetResult(self.cmd1, False, self.cmd1_simout)
     self.assertEquals(result, self.cmd1_sim_result[2])
开发者ID:radicke-atix-de,项目名称:comoonics-cluster-suite,代码行数:6,代码来源:testComSystem.py


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