def __purgeAttachLV(self, lvName):
        """卸载逻辑卷
        
        @param lvName 逻辑卷名称
        """

        targetList = getTargetList(VSConfig.getHost())
        for target in targetList:
            cells = target.split(":")
            if cells[-1] == lvName:
                self.__purgeIscsi(target)
        self.__purgeTcm(lvName)
    def __lvIsAttached(self, lvName):
        """检测逻辑卷是否已挂载
        
        @param lvName 逻辑卷名称
        @return 已挂载返回1,未挂载返回0
        """

        lioCfgDir = "/sys/kernel/config/target/core/iblock_0/%s_%s" % (VSConfig.getVgName(), lvName)
        if os.path.exists(lioCfgDir):
            return 1
        else:
            return 0
    targetName = "%s:%d:%s" % (iqn, 123456, suffix)
    handler = VSServiceHandler()
    try:
        handler.cleanTarget(lvName, targetName, tpgt)
        print "purgeTarget success"
        VSLogger.debug("purgeTarget success")
    except Exception, e:
        errMsg = traceback.format_exc()
        VSLogger.critical(errMsg)


debug = True
# debug=False
# handler.purgeIqn(targetName)
if __name__ == "__main__":
    VSConfig.loadConfig()
    VSLogger.initLogger()

    if debug:
        pdb.set_trace()
    for arg in sys.argv:
        print arg
    if cmp(sys.argv[1], "send") == 0:
        startTarget(sys.argv[2], int(sys.argv[3]), int(sys.argv[4]), sys.argv[5])
    elif cmp(sys.argv[1], "purge") == 0:
        purgeTarget(sys.argv[2], int(sys.argv[3]), sys.argv[4])

#        while True:
#            try:
#                handler.sendTarget("loop1", initiatorName)
#                print "sendTarget success"