Coverage for libs/sm/drivers/RawISCSISR.py: 0%

25 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2026-07-10 07:59 +0000

1# Copyright (C) Citrix Systems Inc. 

2# 

3# This program is free software; you can redistribute it and/or modify 

4# it under the terms of the GNU Lesser General Public License as published 

5# by the Free Software Foundation; version 2.1 only. 

6# 

7# This program is distributed in the hope that it will be useful, 

8# but WITHOUT ANY WARRANTY; without even the implied warranty of 

9# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

10# GNU Lesser General Public License for more details. 

11# 

12# You should have received a copy of the GNU Lesser General Public License 

13# along with this program; if not, write to the Free Software Foundation, Inc., 

14# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 

15# 

16# ISCSISR: ISCSI software initiator SR driver 

17# matches with drivers/ISCSISR 

18# 

19 

20from sm import SR 

21from sm import BaseISCSI 

22from sm import LUNperVDI 

23from sm.core import util 

24 

25CAPABILITIES = ["SR_PROBE", "VDI_CREATE", "VDI_DELETE", "VDI_ATTACH", 

26 "VDI_DETACH", "VDI_INTRODUCE"] 

27 

28CONFIGURATION = [['target', 'IP address or hostname of the iSCSI target (required)'], \ 

29 ['targetIQN', 'The IQN of the target LUN group to be attached (required)'], \ 

30 ['chapuser', 'The username to be used during CHAP authentication (optional)'], \ 

31 ['chappassword', 'The password to be used during CHAP authentication (optional)'], \ 

32 ['incoming_chapuser', 'The incoming username to be used during bi-directional CHAP authentication (optional)'], \ 

33 ['incoming_chappassword', 'The incoming password to be used during bi-directional CHAP authentication (optional)'], \ 

34 ['port', 'The network port number on which to query the target (optional)'], \ 

35 ['multihomed', 'Enable multi-homing to this target, true or false (optional, defaults to same value as host.other_config:multipathing)'], 

36 ['force_tapdisk', 'Force use of tapdisk, true or false (optional, defaults to false)'], 

37] 

38 

39DRIVER_INFO = { 

40 'name': 'iSCSI', 

41 'description': 'Base ISCSI SR driver, provides a LUN-per-VDI. Does not support creation of VDIs but accesses existing LUNs on a target.', 

42 'vendor': 'Citrix Systems Inc', 

43 'copyright': '(C) 2008 Citrix Systems Inc', 

44 'driver_version': '1.0', 

45 'required_api_version': '1.0', 

46 'capabilities': CAPABILITIES, 

47 'configuration': CONFIGURATION 

48 } 

49 

50 

51class RawISCSISR(BaseISCSI.BaseISCSISR): 

52 """Raw ISCSI storage repository""" 

53 

54 def handles(type): 

55 if type == "iscsi": 

56 return True 

57 return False 

58 handles = staticmethod(handles) 

59 

60 def load(self, vdi_uuid): 

61 super(RawISCSISR, self).load(vdi_uuid) 

62 self.managed = True 

63 

64 def detach(self, sr_uuid): 

65 super(RawISCSISR, self).detach(sr_uuid, True) 

66 

67 def vdi(self, uuid): 

68 return ISCSIVDI(self, uuid) 

69 

70 

71class ISCSIVDI(LUNperVDI.RAWVDI): 

72 def load(self, vdi_uuid): 

73 super(ISCSIVDI, self).load(vdi_uuid) 

74 self.managed = True 

75 

76 

77# SR registration at import 

78SR.registerSR(RawISCSISR)