~ubuntu-branches/ubuntu/trusty/cinder/trusty

« back to all changes in this revision

Viewing changes to bin/cinder-rtstool

  • Committer: Package Import Robot
  • Author(s): James Page, Chuck Short, James Page
  • Date: 2013-03-16 09:30:20 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20130316093020-xnaqjbr18uhkti6l
Tags: 1:2013.1~rc1-0ubuntu1
[ Chuck Short ]
* debian/patches/fix-ubuntu-tests.patch: Dropped.
* debian/rules: Fix version number when building the testsuite. 
* debian/cinder-backup{.install, upstart, logroate}: Add cinder-backup
  service.
* debian/rules: Run the testsuite against PYTHONPATH.
* debian/control: Update build-depends and run-time depends.
  - Dropped python-glance not needed.
  - Dropped python-cheetah not needed.
  - Droped python-daemon not needed.
  - Dropped python-netaddr not needed.
  - Renamed python-oslo-config to python-oslo.config.
  - Added python-keystoneclient to depends.
  - Added python-swiftclient to depends.
 * debian/pydist-overrides: No longer needed.

[ James Page ]
* New upstream release candidate.
* d/watch: Update uversionmangle to deal with upstream versioning
  changes, remove tarballs.openstack.org.
* d/cinder.conf: Set lock_path to /var/lock/cinder (default is not
  sensible).

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
    acl_new.chap_userid = userid
79
79
    acl_new.chap_password = password
80
80
 
81
 
    m = rtslib.MappedLUN(acl_new, lun_new.lun, lun_new.lun)
 
81
    rtslib.MappedLUN(acl_new, lun_new.lun, lun_new.lun)
82
82
 
83
83
    if initiator_iqns:
84
84
        initiator_iqns = initiator_iqns.strip(' ')
87
87
            acl_new.chap_userid = userid
88
88
            acl_new.chap_password = password
89
89
 
90
 
            m = rtslib.MappedLUN(acl_new, lun_new.lun, lun_new.lun)
 
90
            rtslib.MappedLUN(acl_new, lun_new.lun, lun_new.lun)
91
91
 
92
92
    tpg_new.enable = 1
93
93
 
105
105
        pass
106
106
 
107
107
 
 
108
def add_initiator(target_iqn, initiator_iqn, userid, password):
 
109
    try:
 
110
        rtsroot = rtslib.root.RTSRoot()
 
111
    except rtslib.utils.RTSLibError:
 
112
        print _('Ensure that configfs is mounted at /sys/kernel/config.')
 
113
        raise
 
114
 
 
115
    # Look for the target
 
116
    target = None
 
117
    for t in rtsroot.targets:
 
118
        if t.dump()['wwn'] == target_iqn:
 
119
            target = t
 
120
            break
 
121
    if target == None:
 
122
        raise RtstoolError(_('Could not find target %s') % target_iqn)
 
123
 
 
124
    tpg = target.tpgs.next()  # get the first one
 
125
    for acl in tpg.dump()['node_acls']:
 
126
        # See if this ACL configuration already exists
 
127
        if acl['node_wwn'] == initiator_iqn:
 
128
            # No further action required
 
129
            return
 
130
 
 
131
    acl_new = rtslib.NodeACL(tpg, initiator_iqn, mode='create')
 
132
    acl_new.chap_userid = userid
 
133
    acl_new.chap_password = password
 
134
 
 
135
    rtslib.MappedLUN(acl_new, 0, tpg_lun=0)
 
136
 
 
137
 
108
138
def get_targets():
109
139
    rtsroot = rtslib.root.RTSRoot()
110
140
    for x in rtsroot.targets:
139
169
    print sys.argv[0], \
140
170
        "create [device] [name] [userid] [password]", \
141
171
        "<initiator_iqn,iqn2,iqn3,...>"
 
172
    print sys.argv[0], \
 
173
        "add-initiator [target_iqn] [userid] [password] [initiator_iqn]"
142
174
    print sys.argv[0], "get-targets"
143
175
    print sys.argv[0], "delete [iqn]"
144
176
    print sys.argv[0], "verify"
170
202
 
171
203
        create(backing_device, name, userid, password, initiator_iqns)
172
204
 
 
205
    elif argv[1] == 'add-initiator':
 
206
        if len(argv) < 6:
 
207
            usage()
 
208
 
 
209
        target_iqn = argv[2]
 
210
        userid = argv[3]
 
211
        password = argv[4]
 
212
        initiator_iqn = argv[5]
 
213
 
 
214
        add_initiator(target_iqn, initiator_iqn, userid, password)
 
215
 
173
216
    elif argv[1] == 'get-targets':
174
217
        get_targets()
175
218