Beispiel #1
0
if options.action == 'check':
    print_detail("Checking LUN existence...", 1)
    lun = LUN(args[0], proxy=backend_proxy)
    status = lun.check()
elif options.action == 'create':
    print_detail("Creating LUN...", 1)
    lun = LUN(args[0], size=args[1], proxy=backend_proxy)
    status = lun.create()
elif options.action == 'delete':
    print_detail("Deleting LUN...", 1)
    lun = LUN(args[0], proxy=backend_proxy)
    status = lun.delete()
elif options.action == 'getturl':
    print_detail("Returning Transport URL...", 1)
    lun = LUN(args[0], proxy=backend_proxy)
    turl = lun.getTurl()
    # If an error occured, it has already been signaled.
    # If it succeeds, rebasedLUN should always be defined...
    if turl:
        print turl
        status = 0
    else:
        status = 10
elif options.action == 'rebase':
    print_detail("Rebasing LUN...", 1)
    lun = LUN(args[0], proxy=backend_proxy)
    rebasedLUN = lun.rebase()
    # If an error occured, it has already been signaled.
    # If it succeeds, rebasedLUN should always be defined...
    if rebasedLUN:
        print rebasedLUN
if options.action == 'check':
    print_detail("Checking LUN existence...", 1)
    lun = LUN(args[0], proxy=backend_proxy)
    status = lun.check()
elif options.action == 'create':
    print_detail("Creating LUN...", 1)
    lun = LUN(args[0], size=args[1], proxy=backend_proxy)
    status = lun.create()
elif options.action == 'delete':
    print_detail("Deleting LUN...", 1)
    lun = LUN(args[0], proxy=backend_proxy)
    status = lun.delete()
elif options.action == 'getturl' :
    print_detail("Returning Transport URL...", 1)
    lun = LUN(args[0], proxy=backend_proxy)
    turl = lun.getTurl()
    # If an error occured, it has already been signaled.
    # If it succeeds, rebasedLUN should always be defined...
    if turl:
        print turl
        status = 0
    else:
        status = 10
elif options.action == 'rebase':
    print_detail("Rebasing LUN...", 1)
    lun = LUN(args[0], proxy=backend_proxy)
    rebasedLUN = lun.rebase()
    # If an error occured, it has already been signaled.
    # If it succeeds, rebasedLUN should always be defined...
    if rebasedLUN:
        print rebasedLUN