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

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

#!/usr/bin/python 

# 

# Copyright (C) Citrix Systems Inc. 

# 

# This program 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; version 2.1 only. 

# 

# This program 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 program; if not, write to the Free Software Foundation, Inc., 

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

# 

# LVHDoFCoESR: LVHD over Fibre Channel over Ethernet driver 

# 

 

import SR 

import LVHDoHBASR 

import LVHDSR 

import SRCommand 

import sys 

import xs_errors 

import util 

 

CAPABILITIES = ["SR_PROBE", "SR_UPDATE", "SR_METADATA", "SR_TRIM", 

                "VDI_CREATE", "VDI_DELETE", "VDI_ATTACH", "VDI_DETACH", 

                "VDI_GENERATE_CONFIG", "VDI_SNAPSHOT", "VDI_CLONE", 

                "VDI_RESIZE", "ATOMIC_PAUSE", "VDI_RESET_ON_BOOT/2", 

                "VDI_UPDATE", "VDI_MIRROR", "VDI_CONFIG_CBT", "VDI_ACTIVATE", 

                "VDI_DEACTIVATE"] 

 

CONFIGURATION = [['SCSIid', 'The scsi_id of the destination LUN'], 

                ['allocation', 'Valid values are thick or thin(optional,\ 

                 defaults to thick)']] 

 

DRIVER_INFO = { 

    'name': 'LVHD over FCoE', 

    'description': 'SR plugin which represents disks as VHDs on Logical \ 

    Volumes within a Volume Group created on a FCoE LUN', 

    'vendor': 'Citrix Systems Inc', 

    'copyright': '(C) 2015 Citrix Systems Inc', 

    'driver_version': '1.0', 

    'required_api_version': '1.0', 

    'capabilities': CAPABILITIES, 

    'configuration': CONFIGURATION 

} 

 

 

class LVHDoFCoESR(LVHDoHBASR.LVHDoHBASR): 

 

    """LVHD over FCoE storage repository""" 

    def handles(type): 

        if __name__ == '__main__': 

            name = sys.argv[0] 

        else: 

            name = __name__ 

        if name.endswith("LVMoFCoESR"): 

            return type == "lvmofcoe"  # for the initial switch from LVM 

        if type == "lvhdofcoe": 

            return True 

        return False 

    handles = staticmethod(handles) 

 

    def load(self, sr_uuid): 

        driver = SR.driver('hba') 

74   74        if 'type' not in self.original_srcmd.params['device_config'] or \ 

                'type' in self.original_srcmd.params['device_config'] and \ 

                self.original_srcmd.dconf['type'] == "any": 

            self.original_srcmd.dconf['type'] = "fcoe" 

        self.hbasr = driver(self.original_srcmd, sr_uuid) 

        pbd = None 

        try: 

            pbd = util.find_my_pbd(self.session, self.host_ref, self.sr_ref) 

        except: 

            pass 

 

        if not self.dconf.has_key('SCSIid') or not self.dconf['SCSIid']: 

            print >>sys.stderr, self.hbasr.print_devs() 

            raise xs_errors.XenError('ConfigSCSIid') 

 

        self.SCSIid = self.dconf['SCSIid'] 

        LVHDSR.LVHDSR.load(self, sr_uuid) 

 

    def vdi(self, uuid): 

        return LVHDoFCoEVDI(self, uuid) 

 

 

class LVHDoFCoEVDI(LVHDoHBASR.LVHDoHBAVDI): 

    pass 

 

96if __name__ == '__main__': 

    SRCommand.run(LVHDoFCoESR, DRIVER_INFO) 

else: 

    SR.registerSR(LVHDoFCoESR)