Hide keyboard shortcuts

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# 

20 

21import SR 

22import SRCommand 

23import BaseISCSI 

24import LUNperVDI 

25import util 

26 

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

28 "VDI_DETACH", "VDI_INTRODUCE"] 

29 

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

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

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

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

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

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

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

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

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

39] 

40 

41DRIVER_INFO = { 

42 'name': 'iSCSI', 

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

44 'vendor': 'Citrix Systems Inc', 

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

46 'driver_version': '1.0', 

47 'required_api_version': '1.0', 

48 'capabilities': CAPABILITIES, 

49 'configuration': CONFIGURATION 

50 } 

51 

52 

53class RawISCSISR(BaseISCSI.BaseISCSISR): 

54 """Raw ISCSI storage repository""" 

55 

56 def handles(type): 

57 if type == "iscsi": 

58 return True 

59 return False 

60 handles = staticmethod(handles) 

61 

62 def load(self, vdi_uuid): 

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

64 self.managed = True 

65 

66 def detach(self, sr_uuid): 

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

68 

69 def vdi(self, uuid): 

70 return ISCSIVDI(self, uuid) 

71 

72 

73class ISCSIVDI(LUNperVDI.RAWVDI): 

74 def load(self, vdi_uuid): 

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

76 self.managed = True 

77 

78 

79if __name__ == '__main__': 

80 SRCommand.run(RawISCSISR, DRIVER_INFO) 

81else: 

82 SR.registerSR(RawISCSISR)