This file is indexed.

/usr/share/pyshared/lsm/iplugin.py is in python-libstoragemgmt 0.0.20-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
# Copyright (C) 2011-2013 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
#
# Author: tasleson

from abc import ABCMeta, abstractmethod


class IPlugin(object):
    """
    Plug-in interface that all plug-ins must implement for basic
    operation.
    """
    __metaclass__ = ABCMeta

    @abstractmethod
    def startup(self, uri, password, timeout, flags=0):
        """
        Method first called to setup the plug-in

        Returns None on success, else LsmError exception
        """
        pass

    @abstractmethod
    def set_time_out(self, ms, flags=0):
        """
        Sets any time-outs for the plug-in (ms)

        Returns None on success, else LsmError exception
        """
        pass

    @abstractmethod
    def get_time_out(self, flags=0):
        """
        Retrieves the current time-out

        Returns time-out in ms, else raise LsmError
        """
        pass

    @abstractmethod
    def shutdown(self, flags=0):
        """
        Called when the client wants to finish up or the socket goes eof.
        Plug-in should clean up all resources.  Note: In the case where
        the socket goes EOF and the shutdown runs into errors the exception(s)
        will not be delivered to the client!

        Returns None on success, else LsmError exception
        """
        pass

    @abstractmethod
    def job_status(self, job_id, flags=0):
        """
        Returns the stats of the given job.

        Returns a tuple ( status (enumeration), percent_complete,
                            completed item).
        else LsmError exception.
        """
        pass

    @abstractmethod
    def job_free(self, job_id, flags=0):
        """
        Frees resources for a given job.

        Returns None on success, else raises an LsmError
        """
        pass

    @abstractmethod
    def capabilities(self, system, flags=0):
        """
        Returns the capabilities for the selected system, raises LsmError
        """
        pass

    @abstractmethod
    def plugin_info(self, flags=0):
        """
        Returns the description and version for plug-in, raises LsmError
        """
        pass

    @abstractmethod
    def pools(self, flags=0):
        """
        Returns an array of pool objects.  Pools are used in both block and
        file system interfaces, thus the reason they are in the base class.

        Raises LsmError on error
        """
        pass

    @abstractmethod
    def systems(self, flags=0):
        """
        Returns an array of system objects.  System information is used to
        distinguish resources from on storage array to another when the plug=in
        supports the ability to have more than one array managed by it

        Raises LsmError on error
        """
        pass


class IStorageAreaNetwork(IPlugin):
    @abstractmethod
    def volumes(self, flags=0):
        """
        Returns an array of volume objects

        Raises LsmError on error
        """
        pass

    @abstractmethod
    def initiators(self, flags=0):
        """
        Return an array of initiator objects

        Raises LsmError on error
        """
        pass

    @abstractmethod
    def volume_create(self, pool, volume_name, size_bytes, provisioning,
                      flags=0):
        """
        Creates a volume, given a pool, volume name, size and provisioning

        Returns a tuple (job_id, new volume)
        Note: Tuple return values are mutually exclusive, when one
        is None the other must be valid.
        """
        pass

    @abstractmethod
    def volume_delete(self, volume, flags=0):
        """
        Deletes a volume.

        Returns Job id or None if completed, else raises LsmError on errors.
        """
        pass

    @abstractmethod
    def volume_resize(self, volume, new_size_bytes, flags=0):
        """
        Re-sizes a volume.

        Returns a tuple (job_id, re-sized_volume)
        Note: Tuple return values are mutually exclusive, when one
        is None the other must be valid.
        """

        pass

    @abstractmethod
    def volume_replicate(self, pool, rep_type, volume_src, name, flags=0):
        """
        Replicates a volume from the specified pool.  In this library, to
        replicate means to create a new volume which is a copy of the source.

        Returns a tuple (job_id, replicated volume)
        Note: Tuple return values are mutually exclusive, when one
        is None the other must be valid.
        """
        pass

    @abstractmethod
    def volume_replicate_range_block_size(self, system, flags=0):
        """
        Returns the number of bytes per block for volume_replicate_range
        call.  Callers of volume_replicate_range need to use this when
        calculating start and block lengths.

        Note: bytes per block may not match volume blocksize.

        Returns bytes per block, Raises LsmError on error
        """
        pass

    @abstractmethod
    def volume_replicate_range(self, rep_type, volume_src, volume_dest, ranges,
                               flags=0):
        """
        Replicates a portion of a volume to itself or another volume.  The src,
        dest and number of blocks values change with vendor, call
        volume_replicate_range_block_size to get block unit size.

        Returns Job id or None if completed, else raises LsmError on errors.
        """
        pass

    @abstractmethod
    def volume_online(self, volume, flags=0):
        """
        Makes a volume available to the host

        Returns None on success, else raises LsmError on errors.
        """
        pass

    @abstractmethod
    def volume_offline(self, volume, flags=0):
        """
        Makes a volume unavailable to the host

        Returns None on success, else raises LsmError on errors.
        """
        pass

    @abstractmethod
    def iscsi_chap_auth(self, initiator, in_user, in_password, out_user,
                        out_password, flags):
        """
        Register a user/password for the specified initiator for CHAP
        authentication.  in_user & in_password are for inbound CHAP, out_user &
        out_password are for outbound CHAP.

        Note: Setting in_user, in_password or out_user, out_password to None
        will disable authentication.

        Raises LsmError on error
        """
        pass

    @abstractmethod
    def initiator_grant(self, initiator_id, initiator_type, volume, access,
                        flags=0):
        """
        Allows an initiator to access a volume.

        Returns None on success, else raises LsmError on errors.
        """
        pass

    @abstractmethod
    def initiator_revoke(self, initiator, volume, flags=0):
        """
        Revokes access to a volume for the specified initiator

        Returns None on success, else raises LsmError on errors.
        """
        pass

    def access_group_grant(self, group, volume, access, flags=0):
        """
        Allows an access group to access a volume.

        Returns None on success, else raises LsmError on errors.
        """
        pass

    def access_group_revoke(self, group, volume, flags=0):
        """
        Revokes access for an access group for a volume

        Returns None on success, else raises LsmError on errors.
        """
        pass

    @abstractmethod
    def access_group_list(self, flags=0):
        """
        Returns a list of access groups, raises LsmError on errors.
        """
        pass

    @abstractmethod
    def access_group_create(self, name, initiator_id, id_type, system_id,
                            flags=0):
        """
        Returns a list of access groups, raises LsmError on errors.
        """
        pass

    @abstractmethod
    def access_group_del(self, group, flags=0):
        """
        Deletes an access group, Raises LsmError on error
        """
        pass

    @abstractmethod
    def access_group_add_initiator(self, group, initiator_id, id_type,
                                   flags=0):
        """
        Adds an initiator to an access group, Raises LsmError on error
        """
        pass

    @abstractmethod
    def access_group_del_initiator(self, group, initiator_id, flags=0):
        """
        Deletes an initiator from an access group, Raises LsmError on error
        """
        pass

    @abstractmethod
    def volumes_accessible_by_access_group(self, group, flags=0):
        """
        Returns the list of volumes that access group has access to.
        Raises LsmError on error
        """
        pass

    @abstractmethod
    def access_groups_granted_to_volume(self, volume, flags=0):
        """
        Returns the list of access groups that have access to the specified,
        Raises LsmError on error
        """
        pass

    @abstractmethod
    def volume_child_dependency(self, volume, flags=0):
        """
        Returns True if this volume has other volumes which are dependant on it.
        Implies that this volume cannot be deleted or possibly modified because
        it would affect its children.
        """
        pass

    @abstractmethod
    def volume_child_dependency_rm(self, volume, flags=0):
        """
        If this volume has child dependency, this method call will fully
        replicate the blocks removing the relationship between them.  This
        should return None (success) if volume_child_dependency would return
        False.

        Note:  This operation could take a very long time depending on the size
        of the volume and the number of child dependencies.

        Returns None if complete else job id, raises LsmError on errors.
        """
        pass

    @abstractmethod
    def volumes_accessible_by_initiator(self, initiator, flags=0):
        """
        Returns a list of volumes that the initiator has access to,
        Raises LsmError on errors.
        """
        pass

    @abstractmethod
    def initiators_granted_to_volume(self, volume, flags=0):
        """
        Returns a list of initiators that have access to the specified volume,
        Raises LsmError on errors.
        """
        pass


class INetworkAttachedStorage(IPlugin):
    """
    Class the represents Network attached storage (Common NFS/CIFS operations)
    """

    @abstractmethod
    def fs(self, flags=0):
        """
        Returns a list of file systems on the controller. Raises LsmError on
        errors.
        """
        pass

    @abstractmethod
    def fs_delete(self, fs, flags=0):
        """
        WARNING: Destructive

        Deletes a file system and everything it contains
        Returns None on success, else job id
        """
        pass

    @abstractmethod
    def fs_resize(self, fs, new_size_bytes, flags=0):
        """
        Re-size a file system

        Returns a tuple (job_id, re-sized file system)
        Note: Tuple return values are mutually exclusive, when one
        is None the other must be valid.
        """
        pass

    @abstractmethod
    def fs_create(self, pool, name, size_bytes, flags=0):
        """
        Creates a file system given a pool, name and size.
        Note: size is limited to 2**64 bytes so max size of a single volume
        at this time is 16 Exabytes

        Returns a tuple (job_id, file system)
        Note: Tuple return values are mutually exclusive, when one
        is None the other must be valid.
        """
        pass

    @abstractmethod
    def fs_clone(self, src_fs, dest_fs_name, snapshot=None, flags=0):
        """
        Creates a thin, point in time read/writable copy of src to dest.
        Optionally uses snapshot as backing of src_fs

        Returns a tuple (job_id, file system)
        Note: Tuple return values are mutually exclusive, when one
        is None the other must be valid.
        """
        pass

    @abstractmethod
    def file_clone(self, fs, src_file_name, dest_file_name, snapshot=None,
                   flags=0):
        """
        Creates a thinly provisioned clone of src to dest.
        Note: Source and Destination are required to be on same filesystem

        Returns Job id or None if completed, else raises LsmError on errors.
        """
        pass

    @abstractmethod
    def fs_snapshots(self, fs, flags=0):
        """
        Returns a list of snapshots for the supplied file system,
        Raises LsmError on error
        """
        pass

    @abstractmethod
    def fs_snapshot_create(self, fs, snapshot_name, files, flags=0):
        """
        Snapshot is a point in time read-only copy

        Create a snapshot on the chosen file system with a supplied name for
        each of the files.  Passing None implies snapping all files on the file
        system.  When files is non-none it implies snap shoting those file.
        NOTE:  Some arrays only support snapshots at the file system level.  In
        this case it will not be considered an error if file names are passed.
        In these cases the file names are effectively discarded as all files
        are done.

        Returns a tuple (job_id, snap shot created)
        Note: Tuple return values are mutually exclusive, when one
        is None the other must be valid.

        Note:  Snapshot name may not match
        what was passed in (depends on array implementation)
        """
        pass

    @abstractmethod
    def fs_snapshot_delete(self, fs, snapshot, flags=0):
        """
        Frees the re-sources for the given snapshot on the supplied filesystem.

        Returns Job id or None if completed, else raises LsmError on errors.
        """
        pass

    @abstractmethod
    def fs_snapshot_revert(self, fs, snapshot, files, restore_files,
                           all_files=False, flags=0):
        """
        WARNING: Destructive!

        Reverts a file-system or just the specified files from the snapshot.  If
        a list of files is supplied but the array cannot restore just them then
        the operation will fail with an LsmError raised.  If files == None and
        all_files = True then all files on the file-system are reverted.

        Restore_file if not None must be the same length as files with each
        index in each list referring to the associated file.

        Returns None on success, else job id, LsmError exception on error
        """
        pass

    @abstractmethod
    def fs_child_dependency(self, fs, files, flags=0):
        """
        Returns True if the specified filesystem or specified file on this
        file system has child dependencies.  This implies that this filesystem
        or specified file on this file system cannot be deleted or possibly
        modified because it would affect its children.
        """
        pass

    @abstractmethod
    def fs_child_dependency_rm(self, fs, files, flags=0):
        """
        If this filesystem or specified file on this filesystem has child
        dependency this method will fully replicate the blocks removing the
        relationship between them.  This should return None(success) if
        fs_child_dependency would return False.

        Note:  This operation could take a very long time depending on the size
        of the filesystem and the number of child dependencies.

        Returns Job id or None if completed, else raises LsmError on errors.
        """
        pass


class INfs(INetworkAttachedStorage):
    @abstractmethod
    def export_auth(self, flags=0):
        """
        Returns the types of authentication that are available for NFS
        """
        pass

    @abstractmethod
    def exports(self, flags=0):
        """
        Get a list of all exported file systems on the controller.
        """
        pass

    @abstractmethod
    def export_fs(self, fs_id, export_path, root_list, rw_list, ro_list,
                  anon_uid, anon_gid, auth_type, options, flags=0):
        """
        Exports a filesystem as specified in the export
        """
        pass

    @abstractmethod
    def export_remove(self, export, flags=0):
        """
        Removes the specified export
        """
        pass