def purgeTarget(lvName):
    iqn = "test"
    targetName = "%s:%d:%s" % (iqn, 123456, lvName)
    handler = ISCSIHandler()
    try:
        handler.cleanTarget(lvName, targetName)
        print "purgeTarget success"
        iSCSILogger.debug("purgeTarget success")
    except Exception, e:
        errMsg = traceback.format_exc()
        iSCSILogger.critical(errMsg)
 def cleanTarget(self, lvName, targetName):
     # 先后顺序很重要,
     self.purgeIqn(targetName)  #  lio_node --deltpg
     iSCSILogger.info("purgeIqn success")
     print "purgeIqn success"
     self.purgeTcm(lvName)  #  tcm_node --freedev
     iSCSILogger.debug("purgeTcm success")
     print "purgeTcm success"
     self.purgeIscsi(targetName)  #  lio_node --deliqn=
     iSCSILogger.debug("purgeIscsi success")
     print "purgeIscsi success"
Beispiel #3
0
def purgeTarget(lvName):
    iqn ="test"
    targetName = "%s:%d:%s" % (iqn, 123456, lvName)
    handler = ISCSIHandler()
    try:
        handler.cleanTarget(lvName,targetName)
        print "purgeTarget success"
        iSCSILogger.debug("purgeTarget success")
    except Exception, e:
        errMsg = traceback.format_exc()
        iSCSILogger.critical(errMsg)
Beispiel #4
0
 def cleanTarget(self, lvName, targetName):
     # 先后顺序很重要,
     self.purgeIqn(targetName)    #  lio_node --deltpg
     iSCSILogger.info("purgeIqn success")
     print "purgeIqn success"
     self.purgeTcm(lvName)        #  tcm_node --freedev 
     iSCSILogger.debug("purgeTcm success")
     print "purgeTcm success"
     self.purgeIscsi(targetName)  #  lio_node --deliqn=
     iSCSILogger.debug("purgeIscsi success")
     print "purgeIscsi success"
def startTarget(lvName):
    initiatorName = "iqn.1993-08.org.debian:01:fcc9228c36cc"
    #initiatorName = configure.initiatorName
    iqn = "test"
    targetName = "%s:%d:%s" % (iqn, 123456, lvName)
    handler = ISCSIHandler()
    try:
        handler.sendTarget(lvName, initiatorName)
        print "sendTarget success"
        iSCSILogger.debug("sendTarget success")
        #time.sleep(1)
        #handler.cleanTarget(lvName,targetName)
    except Exception, e:
        handler.cleanTarget(lvName, targetName)
        handler.sendTarget(lvName, initiatorName)
        errMsg = traceback.format_exc()
        iSCSILogger.critical(errMsg)
Beispiel #6
0
def startTarget(lvName):
    initiatorName = "iqn.1993-08.org.debian:01:fcc9228c36cc"
    #initiatorName = configure.initiatorName
    iqn ="test"
    targetName = "%s:%d:%s" % (iqn, 123456, lvName)
    handler = ISCSIHandler()
    try:
        handler.sendTarget(lvName, initiatorName)
        print "sendTarget success"
        iSCSILogger.debug("sendTarget success")
        #time.sleep(1)
        #handler.cleanTarget(lvName,targetName)
    except Exception, e:
        handler.cleanTarget(lvName,targetName)
        handler.sendTarget(lvName, initiatorName)
        errMsg = traceback.format_exc()
        iSCSILogger.critical(errMsg)