Beispiel #1
0
    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
        status = 0
    else:
        status = 10
elif options.action == 'snapshot':
    print_detail("Doing a LUN snapshot...", 1)
    lun = LUN(args[0], size=args[2], proxy=backend_proxy)
    snapshot_lun = LUN(args[1], proxy=backend_proxy)
    # Only the last error is returned
    status = lun.snapshot(snapshot_lun)
elif options.action == 'map':
    print_detail("Mapping LUN...", 1)
    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
        status = 0
    else:
        status = 10
elif options.action == 'snapshot':
    print_detail("Doing a LUN snapshot...", 1)
    lun = LUN(args[0],size=args[2],proxy=backend_proxy)
    snapshot_lun = LUN(args[1],proxy=backend_proxy)
    # Only the last error is returned
    status = lun.snapshot(snapshot_lun)
elif options.action == 'map':
    print_detail("Mapping LUN...", 1)