def __init__()

in VMBackup/main/freezesnapshotter.py [0:0]


    def __init__(self, logger, hutil , freezer, g_fsfreeze_on, para_parser, takeCrashConsistentSnapshot):
        self.logger = logger
        self.configfile = '/etc/azure/vmbackup.conf'
        self.hutil = hutil
        self.freezer = freezer
        self.g_fsfreeze_on = g_fsfreeze_on
        self.para_parser = para_parser
        if(para_parser.snapshotTaskToken == None):
            para_parser.snapshotTaskToken = '' #making snapshot string empty when snapshotTaskToken is null
        self.logger.log('snapshotTaskToken : ' + str(para_parser.snapshotTaskToken))
        self.takeSnapshotFrom = CommonVariables.firstHostThenGuest
        self.isManaged = False
        self.taskId = self.para_parser.taskId
        self.hostIp = '168.63.129.16'
        self.extensionErrorCode = ExtensionErrorCodeHelper.ExtensionErrorCodeEnum.success
        self.takeCrashConsistentSnapshot = takeCrashConsistentSnapshot
        self.logger.log('FreezeSnapshotter : takeCrashConsistentSnapshot = ' + str(self.takeCrashConsistentSnapshot))
        
        #implement in next release
        '''
        # fetching wireserver IP from DHCP
        self.dhcpHandlerObj = None
        try:
            self.dhcpHandlerObj = DhcpHandler(self.logger)
            self.hostIp = self.dhcpHandlerObj.getHostEndoint()
        except Exception as e:
            errorMsg = "Failed to get hostIp from DHCP with error: %s, stack trace: %s" % (str(e), traceback.format_exc())
            self.logger.log(errorMsg, True, 'Error')
            self.hostIp = '168.63.129.16'
        '''

        self.logger.log( "hostIp : " + self.hostIp)

        try:
            if(para_parser.customSettings != None and para_parser.customSettings != ''):
                self.logger.log('customSettings : ' + str(para_parser.customSettings))
                customSettings = json.loads(para_parser.customSettings)
                snapshotMethodConfigValue = self.hutil.get_strvalue_from_configfile(CommonVariables.SnapshotMethod,customSettings['takeSnapshotFrom'])
                self.logger.log('snapshotMethodConfigValue : ' + str(snapshotMethodConfigValue))
                if snapshotMethodConfigValue != None and snapshotMethodConfigValue != '':
                    self.takeSnapshotFrom = snapshotMethodConfigValue
                else:
                    self.takeSnapshotFrom = customSettings['takeSnapshotFrom']

                self.isManaged = customSettings['isManagedVm']
                if( "backupTaskId" in customSettings.keys()):
                    self.taskId = customSettings["backupTaskId"]

                waDiskLunList= []

                if "waDiskLunList" in customSettings.keys() and customSettings['waDiskLunList'] != None :
                    waDiskLunList = customSettings['waDiskLunList']            
                    self.logger.log('WA Disk Lun List ' + str(waDiskLunList))

                if waDiskLunList!=None and waDiskLunList.count != 0 and para_parser.includeLunList!=None and para_parser.includeLunList.count!=0 : 
                    for crpLunNo in para_parser.includeLunList :
                        if crpLunNo in waDiskLunList :
                            self.logger.log('WA disk is present on the VM. Setting the snapshot mode to onlyHost.')
                            self.takeSnapshotFrom = CommonVariables.onlyHost
                            break
            else:
                self.logger.log('CustomSettings is null in extension input.')
        except Exception as e:
            errMsg = 'Failed to serialize customSettings with error: %s, stack trace: %s' % (str(e), traceback.format_exc())
            self.logger.log(errMsg, True, 'Error')
            self.isManaged = True
        
        try:
            if(para_parser.includedDisks != None and CommonVariables.isAnyWADiskIncluded in para_parser.includedDisks.keys()):
                if (para_parser.includedDisks[CommonVariables.isAnyWADiskIncluded] == True):
                    self.logger.log('WA disk is included. Setting the snapshot mode to onlyHost.')
                    self.takeSnapshotFrom = CommonVariables.onlyHost

            if(para_parser.includedDisks != None and CommonVariables.isVmgsBlobIncluded in para_parser.includedDisks.keys()):
                if (para_parser.includedDisks[CommonVariables.isVmgsBlobIncluded] == True):
                    self.logger.log('Vmgs Blob is included. Setting the snapshot mode to onlyHost.')
                    self.takeSnapshotFrom = CommonVariables.onlyHost

            if(para_parser.includedDisks != None and CommonVariables.isAnyDirectDriveDiskIncluded in para_parser.includedDisks.keys()):
                if (para_parser.includedDisks[CommonVariables.isAnyDirectDriveDiskIncluded] == True):
                    self.logger.log('DirectDrive Disk is included. Setting the snapshot mode to onlyHost.')
                    self.takeSnapshotFrom = CommonVariables.onlyHost

            if(para_parser.includedDisks != None and CommonVariables.isAnyDiskExcluded in para_parser.includedDisks):
                # IsAnyDiskExcluded is true, but the included LUN list is empty in the extensions input
                if (para_parser.includedDisks[CommonVariables.isAnyDiskExcluded] == True and (para_parser.includeLunList == None or para_parser.includeLunList.count == 0)):
                    # When the direct drive disk is part of the disks. so, failing the extension as snapshot can't be taken via Guest
                    if( CommonVariables.isAnyDirectDriveDiskIncluded in para_parser.includedDisks and para_parser.includedDisks[CommonVariables.isAnyDirectDriveDiskIncluded] == True):
                        errMsg = 'DirectDrive disk is included, so the host must create the snapshot. IsAnyDiskExcluded is true, but, the included LUN list is empty in the extension input, '\
                                    'which is not allowed for host DoSnapshot. Thus, failing the extension run.'
                        self.logger.log(errMsg, True, 'Error')
                        self.hutil.SetExtErrorCode(ExtensionErrorCodeHelper.ExtensionErrorCodeEnum.FailedInvalidDataDiskLunList)
                    # When the VmgsBlob is part of the disks. so, failing the extension as snapshot can't be taken via Guest
                    elif( CommonVariables.isVmgsBlobIncluded in para_parser.includedDisks and para_parser.includedDisks[CommonVariables.isVmgsBlobIncluded] == True):
                        errMsg = 'VmgsBlob is included, so the host must create the snapshot. IsAnyDiskExcluded is true, but, the included LUN list is empty in the extension input, '\
                                    'which is not allowed for host DoSnapshot. Thus, failing the extension run.'
                        self.logger.log(errMsg, True, 'Error')
                        self.hutil.SetExtErrorCode(ExtensionErrorCodeHelper.ExtensionErrorCodeEnum.FailedInvalidDataDiskLunList)
                    # When the WADisk is part of the disks. so, failing the extension as snapshot can't be taken via Guest
                    elif( CommonVariables.isAnyWADiskIncluded in para_parser.includedDisks and para_parser.includedDisks[CommonVariables.isAnyWADiskIncluded] == True):
                        errMsg = 'WADisk is included, so the host must create the snapshot. IsAnyDiskExcluded is true, but, the included LUN list is empty in the extension input, '\
                                    'which is not allowed for host DoSnapshot. Thus, failing the extension run.'
                        self.logger.log(errMsg, True, 'Error')
                        self.hutil.SetExtErrorCode(ExtensionErrorCodeHelper.ExtensionErrorCodeEnum.FailedInvalidDataDiskLunList)
                    else:
                        self.logger.log('Some disks are excluded from backup and LUN list is not present. Setting the snapshot mode to onlyGuest.')
                        self.takeSnapshotFrom = CommonVariables.onlyGuest

            #Check if snapshot uri has special characters
            if self.hutil.UriHasSpecialCharacters(self.para_parser.blobs):
                self.logger.log('Some disk blob Uris have special characters.')
        except Exception as e:
            errMsg = 'Failed to process flags in includedDisks with error: %s, stack trace: %s' % (str(e), traceback.format_exc())
            self.logger.log(errMsg, True, 'Error')

        self.logger.log('[FreezeSnapshotter] isManaged flag : ' + str(self.isManaged))