private bool Create_All_VM_IaaS_Server_Rehost_Perf_Model()

in src/Assessment/Processor/ProcessDatasets.cs [283:355]


        private bool Create_All_VM_IaaS_Server_Rehost_Perf_Model(List<All_VM_IaaS_Server_Rehost_Perf> All_VM_IaaS_Server_Rehost_Perf_List)
        {
            if (AzureVMPerformanceBasedMachinesData == null)
            {
                UserInputObj.LoggerObj.LogWarning("Not creating excel model for All_VM_IaaS_Server_Rehost_Perf as Azure VM Perf dataset is null");
                return false;
            }
            if (AzureVMPerformanceBasedMachinesData.Count <= 0)
            {
                UserInputObj.LoggerObj.LogWarning("Not creating excel model for All_VM_IaaS_Server_Rehost_Perf as Azure VM Perf dataset is empty");
                return false;
            }

            UserInputObj.LoggerObj.LogInformation("Creating excel model for All_VM_IaaS_Server_Rehost_Perf");

            if (All_VM_IaaS_Server_Rehost_Perf_List == null)
                All_VM_IaaS_Server_Rehost_Perf_List = new List<All_VM_IaaS_Server_Rehost_Perf>();

            foreach (var VMPerfDataKvp in AzureVMPerformanceBasedMachinesData)
            {
                if (VMPerfDataKvp.Value.Suitability != Suitabilities.ConditionallySuitable && VMPerfDataKvp.Value.Suitability != Suitabilities.Suitable)
                    continue;

                All_VM_IaaS_Server_Rehost_Perf obj = new All_VM_IaaS_Server_Rehost_Perf();

                obj.MachineName = VMPerfDataKvp.Value.DisplayName;
                obj.Environment = VMPerfDataKvp.Value.Environment;
                obj.AzureVMReadiness = new EnumDescriptionHelper().GetEnumDescription(VMPerfDataKvp.Value.Suitability);
                obj.AzureVMReadiness_Warnings = VMPerfDataKvp.Value.SuitabilityExplanation;
                obj.RecommendedVMSize = VMPerfDataKvp.Value.RecommendedVMSize;
                obj.MonthlyComputeCostEstimate = VMPerfDataKvp.Value.MonthlyComputeCostEstimate;
                obj.MonthlyStorageCostEstimate = VMPerfDataKvp.Value.StorageMonthlyCost;
                obj.MonthlySecurityCostEstimate = VMPerfDataKvp.Value.MonthlySecurityCost;
                obj.OperatingSystem = UtilityFunctions.GetStringValue(VMPerfDataKvp.Value.OperatingSystem);
                obj.SupportStatus = VMPerfDataKvp.Value.SupportStatus;
                obj.VMHost = UtilityFunctions.GetStringValue(VMPerfDataKvp.Value.DatacenterManagementServerName);
                obj.BootType = UtilityFunctions.GetStringValue(VMPerfDataKvp.Value.BootType);
                obj.Cores = VMPerfDataKvp.Value.NumberOfCores;
                obj.MemoryInMB = VMPerfDataKvp.Value.MegabytesOfMemory;
                obj.CpuUtilizationPercentage = VMPerfDataKvp.Value.PercentageOfCoresUtilization;
                obj.MemoryUtilizationPercentage = VMPerfDataKvp.Value.PercentageOfMemoryUtilization;
                obj.StorageInGB = UtilityFunctions.GetTotalStorage(VMPerfDataKvp.Value.Disks);
                obj.NetworkAdapters = VMPerfDataKvp.Value.NetworkAdapters;

                var macIpKvp = UtilityFunctions.ParseMacIpAddress(VMPerfDataKvp.Value.NetworkAdapterList);
                obj.MacAddresses = macIpKvp.Key;
                obj.IpAddresses = macIpKvp.Value;

                obj.DiskNames = UtilityFunctions.GetDiskNames(VMPerfDataKvp.Value.Disks);
                obj.AzureDiskReadiness = UtilityFunctions.GetDiskReadiness(VMPerfDataKvp.Value.Disks);
                obj.RecommendedDiskSKUs = UtilityFunctions.GetRecommendedDiskSKUs(VMPerfDataKvp.Value.Disks);

                obj.StandardHddDisks = UtilityFunctions.GetDiskTypeCount(VMPerfDataKvp.Value.Disks, RecommendedDiskTypes.Standard);
                obj.StandardSsdDisks = UtilityFunctions.GetDiskTypeCount(VMPerfDataKvp.Value.Disks, RecommendedDiskTypes.StandardSSD);
                obj.PremiumDisks = UtilityFunctions.GetDiskTypeCount(VMPerfDataKvp.Value.Disks, RecommendedDiskTypes.Premium);
                obj.UltraDisks = UtilityFunctions.GetDiskTypeCount(VMPerfDataKvp.Value.Disks, RecommendedDiskTypes.Ultra);

                obj.MonthlyStorageCostForStandardHddDisks = UtilityFunctions.GetDiskTypeStorageCost(VMPerfDataKvp.Value.Disks, RecommendedDiskTypes.Standard);
                obj.MonthlyStorageCostForStandardSsdDisks = UtilityFunctions.GetDiskTypeStorageCost(VMPerfDataKvp.Value.Disks, RecommendedDiskTypes.StandardSSD);
                obj.MonthlyStorageCostForPremiumDisks = UtilityFunctions.GetDiskTypeStorageCost(VMPerfDataKvp.Value.Disks, RecommendedDiskTypes.Premium);
                obj.MonthlyStorageCostForUltraDisks = UtilityFunctions.GetDiskTypeStorageCost(VMPerfDataKvp.Value.Disks, RecommendedDiskTypes.Ultra);

                obj.MonthlyAzureSiteRecoveryCostEstimate = VMPerfDataKvp.Value.AzureSiteRecoveryMonthlyCostEstimate;
                obj.MonthlyAzureBackupCostEstimate = VMPerfDataKvp.Value.AzureBackupMonthlyCostEstimate;
                obj.GroupName = VMPerfDataKvp.Value.GroupName;
                obj.MachineId = VMPerfDataKvp.Value.DatacenterMachineArmId;

                All_VM_IaaS_Server_Rehost_Perf_List.Add(obj);
            }

            UserInputObj.LoggerObj.LogInformation($"Updated All_VM_IaaS_Server_Rehost_Perf excel model with data of {All_VM_IaaS_Server_Rehost_Perf_List.Count} machines");
            return true;
        }