Coverage for drivers/RawISCSISR.py : 0%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1#!/usr/bin/python3
2#
3# Copyright (C) Citrix Systems Inc.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published
7# by the Free Software Foundation; version 2.1 only.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with this program; if not, write to the Free Software Foundation, Inc.,
16# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17#
18# ISCSISR: ISCSI software initiator SR driver
19#
21from sm_typing import override
23import SR
24import SRCommand
25import VDI
26import BaseISCSI
27import LUNperVDI
28import util
30CAPABILITIES = ["SR_PROBE", "VDI_CREATE", "VDI_DELETE", "VDI_ATTACH",
31 "VDI_DETACH", "VDI_INTRODUCE"]
33CONFIGURATION = [['target', 'IP address or hostname of the iSCSI target (required)'], \
34 ['targetIQN', 'The IQN of the target LUN group to be attached (required)'], \
35 ['chapuser', 'The username to be used during CHAP authentication (optional)'], \
36 ['chappassword', 'The password to be used during CHAP authentication (optional)'], \
37 ['incoming_chapuser', 'The incoming username to be used during bi-directional CHAP authentication (optional)'], \
38 ['incoming_chappassword', 'The incoming password to be used during bi-directional CHAP authentication (optional)'], \
39 ['port', 'The network port number on which to query the target (optional)'], \
40 ['multihomed', 'Enable multi-homing to this target, true or false (optional, defaults to same value as host.other_config:multipathing)'],
41 ['force_tapdisk', 'Force use of tapdisk, true or false (optional, defaults to false)'],
42]
44DRIVER_INFO = {
45 'name': 'iSCSI',
46 'description': 'Base ISCSI SR driver, provides a LUN-per-VDI. Does not support creation of VDIs but accesses existing LUNs on a target.',
47 'vendor': 'Citrix Systems Inc',
48 'copyright': '(C) 2008 Citrix Systems Inc',
49 'driver_version': '1.0',
50 'required_api_version': '1.0',
51 'capabilities': CAPABILITIES,
52 'configuration': CONFIGURATION
53 }
56class RawISCSISR(BaseISCSI.BaseISCSISR):
57 """Raw ISCSI storage repository"""
59 @override
60 @staticmethod
61 def handles(type) -> bool:
62 if type == "iscsi":
63 return True
64 return False
66 @override
67 def load(self, vdi_uuid) -> None:
68 super(RawISCSISR, self).load(vdi_uuid)
69 self.managed = True
71 @override
72 def detach(self, sr_uuid) -> None:
73 super(RawISCSISR, self).detach_and_delete(sr_uuid)
75 @override
76 def vdi(self, uuid) -> VDI.VDI:
77 return ISCSIVDI(self, uuid)
80class ISCSIVDI(LUNperVDI.RAWVDI):
81 @override
82 def load(self, vdi_uuid) -> None:
83 super(ISCSIVDI, self).load(vdi_uuid)
84 self.managed = True
87if __name__ == '__main__':
88 SRCommand.run(RawISCSISR, DRIVER_INFO)
89else:
90 SR.registerSR(RawISCSISR)