From f14affc1642e4b8617a83af8780d729887ba9708 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Delon Date: Wed, 13 Nov 2024 18:46:03 +0100 Subject: [PATCH] feat(dedicated): store HW raid & partitioning infos to scope ref: MANAGER-15929 Signed-off-by: Jean-Baptiste Delon --- .../node/translations/Messages_fr_FR.json | 27 -- .../server/translations/Messages_fr_FR.json | 27 -- .../ovh/server-installation-ovh.constants.js | 17 +- .../ovh/server-installation-ovh.controller.js | 459 ++++-------------- .../ovh/server-installation-ovh.html | 99 +--- .../src/server/server.service.js | 127 +---- 6 files changed, 125 insertions(+), 631 deletions(-) diff --git a/packages/manager/apps/dedicated/client/app/dedicated/dedicated-server/clusters/nodes/node/translations/Messages_fr_FR.json b/packages/manager/apps/dedicated/client/app/dedicated/dedicated-server/clusters/nodes/node/translations/Messages_fr_FR.json index 84079cf60771..5630898b6282 100644 --- a/packages/manager/apps/dedicated/client/app/dedicated/dedicated-server/clusters/nodes/node/translations/Messages_fr_FR.json +++ b/packages/manager/apps/dedicated/client/app/dedicated/dedicated-server/clusters/nodes/node/translations/Messages_fr_FR.json @@ -331,24 +331,6 @@ "server_configuration_installation_deprecated": "Deprecated", "server_configuration_installation_step1_language": "Langue :", "server_configuration_installation_step1_describe": "Description :", - "server_configuration_installation_BTRFS": "Btrfs", - "server_configuration_installation_EXT_3": "ext3", - "server_configuration_installation_EXT_4": "ext4", - "server_configuration_installation_FAT_16": "FAT16", - "server_configuration_installation_NTFS": "NTFS", - "server_configuration_installation_VMFS_5": "VMFS5", - "server_configuration_installation_VMFS_6": "VMFS6", - "server_configuration_installation_VMFSL": "VMFSL", - "server_configuration_installation_XFS": "XFS", - "server_configuration_installation_ZFS": "ZFS", - "server_configuration_installation_REISERFS": "ReiserFS", - "server_configuration_installation_SWAP": "Swap", - "server_configuration_installation_NONE": "Aucun", - "server_configuration_installation_UFS": "UFS", - "server_configuration_installation_LOGICAL": "logical", - "server_configuration_installation_LV": "lv", - "server_configuration_installation_PRIMARY": "primary", - "server_configuration_installation_error_hardwareRaid": "Une erreur est survenue lors de la sauvegarde de la configuration RAID.", "server_configuration_installation_resume_os": "Informations relatives au système d'exploitation :", "server_configuration_installation_resume_usage": "Informations relatives à l'applicatif :", "server_configuration_installation_resume_storage": "Stockage :", @@ -404,7 +386,6 @@ "server_configuration_installation_ovh_stephardraid_label_space_available": "Espace disponible :", "server_configuration_installation_ovh_stephardraid_label_error": "Cette configuration RAID est invalide.", "server_configuration_installation_ovh_stephardraid_loading_error": "Erreur de chargement du profile RAID. Veuillez ré-essayer.", - "server_configuration_installation_ovh_step2_type": "Type", "server_configuration_installation_ovh_step2_type_disk": "Disques utilisés pour cette installation :", "server_configuration_installation_ovh_step2_type_disk_disable": "Disque non allouable pour cette installation :", "server_configuration_installation_ovh_step2_type_disk_warning_windows": "Même si la grappe de disques sélectionnée contient {{t0}} disques, le système d'exploitation choisi ne peut être installé que sur 2 disques au maximum", @@ -437,11 +418,9 @@ "server_configuration_installation_ovh_step2_error_partition_order": "Une partition est déjà assignée à ce numéro d'ordre", "server_configuration_installation_ovh_step2_error_partition_order_first": "La première partition doit avoir comme point de montage /boot ou /. Si les 2 partitions sont présentes, /boot doit être placé en première position.", "server_configuration_installation_ovh_step2_error_partition_order_first_win": "La première partition doit avoir comme point de montage c:", - "server_configuration_installation_ovh_step2_error_partition_volumename_empty": "Le nom du volume est obligatoire pour une partition de type LV", "server_configuration_installation_ovh_step2_error_partition_mountPoint_empty": "Le point de montage est obligatoire", "server_configuration_installation_ovh_step2_error_partition_mountPoint_wrong": "Ce point de montage ne peut être utilisé, le nom est incorrect. Les caractères spéciaux sont interdits (excepté _ / et -) et le nombre maximum de caractères est de 255.", "server_configuration_installation_ovh_step2_error_partition_mountPoint_wrong2": "Le point de montage /var/log n'est pas autorisé pour cette distribution. Vous devez utiliser /home/log.", - "server_configuration_installation_ovh_step2_error_partition_mountPoint_primary": "Le point de montage c: doit être de type primaire.", "server_configuration_installation_ovh_step2_error_partition_mountPoint_windows": "Ce point de montage ne peut être utilisé. Il doit compris entre c et z et finir par :", "server_configuration_installation_ovh_step2_error_partition_mountPoint_use": "Ce point de montage est déjà utilisé", "server_configuration_installation_ovh_step2_error_partition_size_min_windows": "La taille minimale d'une partition Windows est de {{t0}}", @@ -449,12 +428,7 @@ "server_configuration_installation_ovh_step2_error_partition_size_min_boot": "La taille minimale de la partition /boot est de {{t0}}", "server_configuration_installation_ovh_step2_error_partition_size_min_add": "Vous n'avez pas assez d'espace disponible pour ajouter une nouvelle partition. Modifiez ou supprimez une partition pour libérer de l'espace.", "server_configuration_installation_ovh_step2_error_partition_size_min": "La taille minimale d'une partition est de {{t0}}", - "server_configuration_installation_ovh_step2_error_partition_type_order": "Une partition primaire doit être précédée d'une partition primaire.", "server_configuration_installation_ovh_step2_error_partition_type_order_lv": "Une partition de type LV doit être suivie d'une partition de type LV.", - "server_configuration_installation_ovh_step2_error_partition_type_primary": "Vous ne pouvez pas avoir plus de 4 partitions primaires. Modifiez le type d'une partition primaire en un autre type pour pouvoir ajouter d'autres partitions.", - "server_configuration_installation_ovh_step2_error_set": "Une erreur est survenue lors de la modification de la partition {{t0}} ({{t1}})", - "server_configuration_installation_ovh_step2_error_delete": "Une erreur est survenue lors de la suppression de la partition {{t0}} ({{t1}})", - "server_configuration_installation_ovh_step2_error_add": "Une erreur est survenue lors de l'ajout de la partition {{t0}} ({{t1}})", "server_configuration_installation_ovh_step2_error_raid_diskUse": "Vous ne mettez plus assez de disques à disposition pour créer ce schéma de partition. Le niveau du raid d'au moins une partition est trop élevé.", "server_configuration_installation_ovh_step2_error_raid_diskUse_icon": "Le niveau du raid de cette partition est trop élevé par rapport au nombre de disques utilisés.", "server_configuration_installation_ovh_step2_error_raid_0": "La configuration en Raid 0 de cette partition ne permettra pas sa sauvegarde", @@ -479,7 +453,6 @@ "server_configuration_installation_ovh_step3_partition_size": "Taille : {{t0}}", "server_configuration_installation_ovh_step3_error_integrity_info": "Veuillez corriger l'erreur en cliquant sur le bouton précédent", "server_configuration_installation_ovh_step3_scheme": "Schéma de partitionnement :", - "server_configuration_installation_ovh_step3_remaining_error": "Une erreur est survenue lors de la modification de la partition {{t0}} en partition variable ({{t1}}).", "server_configuration_installation_progress_button": "Progression de l'installation", "server_configuration_installation_progress_title": "Progression de l'installation", "server_configuration_installation_progress_info": "La demande d'installation a bien été prise en compte.", diff --git a/packages/manager/apps/dedicated/client/app/dedicated/dedicated-server/servers/server/translations/Messages_fr_FR.json b/packages/manager/apps/dedicated/client/app/dedicated/dedicated-server/servers/server/translations/Messages_fr_FR.json index 4af422a56782..742c6601d2e9 100644 --- a/packages/manager/apps/dedicated/client/app/dedicated/dedicated-server/servers/server/translations/Messages_fr_FR.json +++ b/packages/manager/apps/dedicated/client/app/dedicated/dedicated-server/servers/server/translations/Messages_fr_FR.json @@ -330,24 +330,6 @@ "server_configuration_installation_64": "64 bits", "server_configuration_installation_deprecated": "Deprecated", "server_configuration_installation_step1_describe": "Description :", - "server_configuration_installation_BTRFS": "Btrfs", - "server_configuration_installation_EXT_3": "ext3", - "server_configuration_installation_EXT_4": "ext4", - "server_configuration_installation_FAT_16": "FAT16", - "server_configuration_installation_NTFS": "NTFS", - "server_configuration_installation_VMFS_5": "VMFS5", - "server_configuration_installation_VMFS_6": "VMFS6", - "server_configuration_installation_VMFSL": "VMFSL", - "server_configuration_installation_XFS": "XFS", - "server_configuration_installation_ZFS": "ZFS", - "server_configuration_installation_REISERFS": "ReiserFS", - "server_configuration_installation_SWAP": "Swap", - "server_configuration_installation_NONE": "Aucun", - "server_configuration_installation_UFS": "UFS", - "server_configuration_installation_LOGICAL": "logical", - "server_configuration_installation_LV": "lv", - "server_configuration_installation_PRIMARY": "primary", - "server_configuration_installation_error_hardwareRaid": "Une erreur est survenue lors de la sauvegarde de la configuration RAID.", "server_configuration_installation_resume_os": "Informations relatives au système d'exploitation :", "server_configuration_installation_resume_usage": "Informations relatives à l'applicatif :", "server_configuration_installation_resume_storage": "Stockage :", @@ -398,7 +380,6 @@ "server_configuration_installation_ovh_stephardraid_label_space_available": "Espace disponible :", "server_configuration_installation_ovh_stephardraid_label_error": "Cette configuration RAID est invalide.", "server_configuration_installation_ovh_stephardraid_loading_error": "Erreur de chargement du profile RAID. Veuillez ré-essayer.", - "server_configuration_installation_ovh_step2_type": "Type", "server_configuration_installation_ovh_step2_type_disk": "Disques utilisés pour cette installation :", "server_configuration_installation_ovh_step2_type_disk_disable": "Disque non allouable pour cette installation :", "server_configuration_installation_ovh_step2_type_disk_warning_windows": "Même si la grappe de disques sélectionnée contient {{t0}} disques, le système d'exploitation choisi ne peut être installé que sur 2 disques au maximum", @@ -431,11 +412,9 @@ "server_configuration_installation_ovh_step2_error_partition_order": "Une partition est déjà assignée à ce numéro d'ordre", "server_configuration_installation_ovh_step2_error_partition_order_first": "La première partition doit avoir comme point de montage /boot ou /. Si les 2 partitions sont présentes, /boot doit être placé en première position.", "server_configuration_installation_ovh_step2_error_partition_order_first_win": "La première partition doit avoir comme point de montage c:", - "server_configuration_installation_ovh_step2_error_partition_volumename_empty": "Le nom du volume est obligatoire pour une partition de type LV", "server_configuration_installation_ovh_step2_error_partition_mountPoint_empty": "Le point de montage est obligatoire", "server_configuration_installation_ovh_step2_error_partition_mountPoint_wrong": "Ce point de montage ne peut être utilisé, le nom est incorrect. Les caractères spéciaux sont interdits (excepté _ / et -) et le nombre maximum de caractères est de 255.", "server_configuration_installation_ovh_step2_error_partition_mountPoint_wrong2": "Le point de montage /var/log n'est pas autorisé pour cette distribution. Vous devez utiliser /home/log.", - "server_configuration_installation_ovh_step2_error_partition_mountPoint_primary": "Le point de montage c: doit être de type primaire.", "server_configuration_installation_ovh_step2_error_partition_mountPoint_windows": "Ce point de montage ne peut être utilisé. Il doit compris entre c et z et finir par :", "server_configuration_installation_ovh_step2_error_partition_mountPoint_use": "Ce point de montage est déjà utilisé", "server_configuration_installation_ovh_step2_error_partition_size_min_windows": "La taille minimale d'une partition Windows est de {{t0}}", @@ -443,12 +422,7 @@ "server_configuration_installation_ovh_step2_error_partition_size_min_boot": "La taille minimale de la partition /boot est de {{t0}}", "server_configuration_installation_ovh_step2_error_partition_size_min_add": "Vous n'avez pas assez d'espace disponible pour ajouter une nouvelle partition. Modifiez ou supprimez une partition pour libérer de l'espace.", "server_configuration_installation_ovh_step2_error_partition_size_min": "La taille minimale d'une partition est de {{t0}}", - "server_configuration_installation_ovh_step2_error_partition_type_order": "Une partition primaire doit être précédée d'une partition primaire.", "server_configuration_installation_ovh_step2_error_partition_type_order_lv": "Une partition de type LV doit être suivie d'une partition de type LV.", - "server_configuration_installation_ovh_step2_error_partition_type_primary": "Vous ne pouvez pas avoir plus de 4 partitions primaires. Modifiez le type d'une partition primaire en un autre type pour pouvoir ajouter d'autres partitions.", - "server_configuration_installation_ovh_step2_error_set": "Une erreur est survenue lors de la modification de la partition {{t0}} ({{t1}})", - "server_configuration_installation_ovh_step2_error_delete": "Une erreur est survenue lors de la suppression de la partition {{t0}} ({{t1}})", - "server_configuration_installation_ovh_step2_error_add": "Une erreur est survenue lors de l'ajout de la partition {{t0}} ({{t1}})", "server_configuration_installation_ovh_step2_error_raid_diskUse": "Vous ne mettez plus assez de disques à disposition pour créer ce schéma de partition. Le niveau du raid d'au moins une partition est trop élevé.", "server_configuration_installation_ovh_step2_error_raid_diskUse_icon": "Le niveau du raid de cette partition est trop élevé par rapport au nombre de disques utilisés.", "server_configuration_installation_ovh_step2_error_raid_0": "La configuration en Raid 0 de cette partition ne permettra pas sa sauvegarde", @@ -472,7 +446,6 @@ "server_configuration_installation_ovh_step3_partition_size": "Taille : {{t0}}", "server_configuration_installation_ovh_step3_error_integrity_info": "Veuillez corriger l'erreur en cliquant sur le bouton précédent", "server_configuration_installation_ovh_step3_scheme": "Schéma de partitionnement :", - "server_configuration_installation_ovh_step3_remaining_error": "Une erreur est survenue lors de la modification de la partition {{t0}} en partition variable ({{t1}}).", "server_configuration_installation_progress_button": "Progression de l'installation", "server_configuration_installation_progress_title": "Progression de l'installation", "server_configuration_installation_progress_info": "La demande d'installation a bien été prise en compte.", diff --git a/packages/manager/modules/bm-server-components/src/general-information/installation/ovh/server-installation-ovh.constants.js b/packages/manager/modules/bm-server-components/src/general-information/installation/ovh/server-installation-ovh.constants.js index e84125f774a4..141afcdf43c3 100644 --- a/packages/manager/modules/bm-server-components/src/general-information/installation/ovh/server-installation-ovh.constants.js +++ b/packages/manager/modules/bm-server-components/src/general-information/installation/ovh/server-installation-ovh.constants.js @@ -13,21 +13,18 @@ export const TEMPLATE_OS_HARDWARE_RAID_ENUM = { }; export const TEMPLATE_OS_SOFTWARE_RAID_LIST = { - 1: ['_0'], - 2: ['_0', '_1'], - 3: ['_0', '_1', '_5'], - 4: ['_0', '_1', '_5', '_10'], - 5: ['_0', '_1', '_5', '_6', '_10'], - 6: ['_0', '_1', '_5', '_6', '_10'], - 7: ['_0', '_1', '_5', '_6', '_7', '_10'], + 1: ['0'], + 2: ['0', '1'], + 3: ['0', '1', '5'], + 4: ['0', '1', '5', '10'], + 5: ['0', '1', '5', '6', '10'], + 6: ['0', '1', '5', '6', '10'], + 7: ['0', '1', '5', '6', '7', '10'], }; -export const PARTITION_TYPES = ['LOGICAL', 'LV', 'PRIMARY']; - export default { MOUNT_POINTS, MAX_MOUNT_POINTS, TEMPLATE_OS_HARDWARE_RAID_ENUM, TEMPLATE_OS_SOFTWARE_RAID_LIST, - PARTITION_TYPES, }; diff --git a/packages/manager/modules/bm-server-components/src/general-information/installation/ovh/server-installation-ovh.controller.js b/packages/manager/modules/bm-server-components/src/general-information/installation/ovh/server-installation-ovh.controller.js index fb8c820a4592..7bdd60a223f2 100644 --- a/packages/manager/modules/bm-server-components/src/general-information/installation/ovh/server-installation-ovh.controller.js +++ b/packages/manager/modules/bm-server-components/src/general-information/installation/ovh/server-installation-ovh.controller.js @@ -11,7 +11,6 @@ import { MAX_MOUNT_POINTS, TEMPLATE_OS_HARDWARE_RAID_ENUM, TEMPLATE_OS_SOFTWARE_RAID_LIST, - PARTITION_TYPES, } from './server-installation-ovh.constants'; export default class ServerInstallationOvhCtrl { @@ -74,9 +73,8 @@ export default class ServerInstallationOvhCtrl { defaultOsCategory: 'BASIC', - raidList: null, // Map[nbDisk, available raid] + raidList: TEMPLATE_OS_SOFTWARE_RAID_LIST, fileSystemList: null, - partitionTypeList: null, forbiddenMountPoint: [ '/etc', @@ -90,22 +88,23 @@ export default class ServerInstallationOvhCtrl { '/sys', ], - warningRaid0: '_0', - warningRaid1: '_1', - warningLV: 'LV', - warningLogical: 'LOGICAL', - warningPrimary: 'PRIMARY', - warningNone: 'NONE', - warningSwap: 'SWAP', - warningReiserfs: 'REISERFS', - warningWindows: 'WINDOWS', + warningRaid0: '0', + warningRaid1: '1', + warningRaid5: '5', + warningRaid6: '6', + warningRaid7: '7', + warningRaid10: '10', + warningNone: 'none', + warningSwap: 'swap', + warningReiserfs: 'reiserfs', + warningWindows: 'windows', warningBoot: '/boot', warningRoot: '/', warningCwin: 'c:', - warningNTFS: 'NTFS', - warningEXT4: 'EXT_4', - warningLINUX: 'LINUX', - warningZFS: 'ZFS', + warningNTFS: 'ntfs', + warningEXT4: 'ext4', + warningLinux: 'linux', + warningZFS: 'zfs', swapLabel: 'swap', @@ -189,7 +188,6 @@ export default class ServerInstallationOvhCtrl { this.$scope.newPartition = { order: 0, - typePartition: null, fileSystem: null, mountPoint: null, volumeName: null, @@ -225,16 +223,12 @@ export default class ServerInstallationOvhCtrl { orderFirstWin: false, raid0: false, raidLv: false, - orderType: false, - typePrimary: false, mountPointEmpty: false, mountPoint: false, mountPoint2: false, mountPointUse: false, - volumeNameEmpty: false, - partitionSizeToAdd: false, partitionSizeOver: false, partitionSize: false, @@ -410,7 +404,7 @@ export default class ServerInstallationOvhCtrl { [this.$scope.installation.selectDesktopType] = this.$scope.installation.desktopType || []; } - this.$scope.installation.selectFamily = this.$scope.constants.warningLINUX; + this.$scope.installation.selectFamily = this.$scope.constants.warningLinux; }) .catch((data) => { this.goBack(); @@ -566,29 +560,29 @@ export default class ServerInstallationOvhCtrl { realRemainingSize = remainingSize; } else if (raid) { switch (raid) { - case '_0': + case this.$scope.constants.warningRaid0: realRemainingSize = remainingSize; break; - case '_1': + case this.$scope.constants.warningRaid1: realRemainingSize = remainingSize / this.$scope.installation.nbDiskUse; break; - case '_5': + case this.$scope.constants.warningRaid5: realRemainingSize = remainingSize - remainingSize / this.$scope.installation.nbDiskUse; break; - case '_6': + case this.$scope.constants.warningRaid6: realRemainingSize = remainingSize - (remainingSize / this.$scope.installation.nbDiskUse) * 2; break; - case '_7': + case this.$scope.constants.warningRaid7: realRemainingSize = remainingSize - (remainingSize / this.$scope.installation.nbDiskUse) * 3; break; - case '_10': + case this.$scope.constants.warningRaid10: realRemainingSize = remainingSize / (this.$scope.installation.nbDiskUse / 2); break; @@ -700,9 +694,7 @@ export default class ServerInstallationOvhCtrl { this.$scope.installation.partitionSchemesList = this.$scope.installation.selectDistribution.schemeNames; this.$scope.informations.gabaritName = this.$scope.installation.selectDistribution.id; - this.$scope.constants.raidList = TEMPLATE_OS_SOFTWARE_RAID_LIST; this.$scope.constants.fileSystemList = this.$scope.installation.selectDistribution.filesystems; - this.$scope.constants.partitionTypeList = PARTITION_TYPES; this.$scope.informations.softRaidOnlyMirroring = this.$scope.installation.selectDistribution.softRaidOnlyMirroring; if (this.$scope.installation.partitionSchemesList.length > 0) { @@ -844,23 +836,6 @@ export default class ServerInstallationOvhCtrl { this.getRemainingSize(); } - validationTypePrimary(forNewPartition) { - let nbPrimary = 0; - let nbOther = 0; - - this.$scope.installation.partitionSchemeModels.forEach((partition2) => { - if (partition2.typePartition === this.$scope.constants.warningPrimary) { - nbPrimary += 1; - } else { - nbOther += 1; - } - }); - if (forNewPartition) { - return nbPrimary === 4; - } - return (nbPrimary === 4 && nbOther > 0) || nbPrimary > 4; - } - // ------VALIDATION TOOLS------ // Create table of boolean with key = the propertie and value = true // because this propertie is already use @@ -934,19 +909,6 @@ export default class ServerInstallationOvhCtrl { this.$scope.newPartition.raid, ); - if ( - this.$scope.constants.partitionTypeList.includes( - this.$scope.constants.warningLogical, - ) - ) { - this.$scope.newPartition.typePartition = angular.copy( - this.$scope.constants.warningLogical, - ); - } else { - this.$scope.newPartition.typePartition = angular.copy( - this.$scope.constants.partitionTypeList[0], - ); - } if ( this.$scope.installation.selectDistribution.family === this.$scope.constants.warningWindows @@ -978,9 +940,7 @@ export default class ServerInstallationOvhCtrl { ); } - if (this.validationTypePrimary(true)) { - this.$scope.errorInst.typePrimary = true; - } else if ( + if ( this.$scope.informations.softRaidOnlyMirroring && this.$scope.newPartition.mountPoint === this.$scope.constants.warningCwin && @@ -1003,20 +963,12 @@ export default class ServerInstallationOvhCtrl { checkall(partition) { this.validationMountPoint(partition); - - // this.validationOrder // load by validationMountPoint - // this.validationType //load by validationOrder - // this.validationRaid(partition); //load by /this.$scope.validationType - this.validationVolumeName(partition); this.validationFileSystem(partition); - - // this.validationSize //load by validationRaid } isValidPartition() { return ( !this.hasErrorOrder() && - !this.hasErrorType() && !this.hasErrorMountPoint() && !this.hasErrorVolumeName() && !this.hasErrorRaid() && @@ -1035,10 +987,8 @@ export default class ServerInstallationOvhCtrl { } else { trueSize = this.$scope.newPartition.partitionSize; if ( - this.$scope.newPartition.typePartition !== - this.$scope.constants.warningLV && this.$scope.newPartition.fileSystem !== - this.$scope.constants.warningZFS + this.$scope.constants.warningZFS ) { this.$scope.newPartition.volumeName = null; } @@ -1050,57 +1000,29 @@ export default class ServerInstallationOvhCtrl { this.$scope.newPartition.raid = null; } - this.Server.postAddPartition( - this.$scope.informations.gabaritName, - this.$scope.installation.selectPartitionScheme, - { - raid: this.$scope.newPartition.raid, - fileSystem: this.$scope.newPartition.fileSystem, - typePartition: this.$scope.newPartition.typePartition, - volumeName: this.$scope.newPartition.volumeName, - order: this.$scope.newPartition.order, - mountPoint: this.$scope.newPartition.mountPoint, - oldMountPoint: this.$scope.newPartition.mountPoint, - partitionSize: trueSize, - }, - ).then( - () => { - this.$scope.warning.raid0 = false; - this.$scope.newPartition.partitionSize = trueSize; - this.$scope.newPartition.orderTable = angular.copy( - this.$scope.newPartition.order, - ); - this.$scope.installation.partitionSchemeModels.push( - angular.copy(this.$scope.newPartition), - ); - - this.$scope.newPartition.order = null; - this.$scope.newPartition.typePartition = null; - this.$scope.newPartition.fileSystem = null; - this.$scope.newPartition.mountPoint = null; - this.$scope.newPartition.volumeName = null; - this.$scope.newPartition.raid = null; - this.$scope.newPartition.partitionSize = null; - - this.$scope.newPartition.display = false; - - this.$scope.buttonControl.displayAddConfirmation = false; - this.$scope.buttonControl.addInProgress = false; - this.clearError(); - this.refreshBar(); - this.validationNbDiskUse(this.$scope.installation.nbDiskUse); - }, - (data) => { - this.$scope.buttonControl.addInProgress = false; - this.$scope.errorInst.ws = this.$translate.instant( - 'server_configuration_installation_ovh_step2_error_add', - { - t0: this.$scope.newPartition.mountPoint, - t1: data.message, - }, - ); - }, + this.$scope.warning.raid0 = false; + this.$scope.newPartition.partitionSize = trueSize; + this.$scope.newPartition.orderTable = angular.copy( + this.$scope.newPartition.order, ); + this.$scope.installation.partitionSchemeModels.push( + angular.copy(this.$scope.newPartition), + ); + + this.$scope.newPartition.order = null; + this.$scope.newPartition.fileSystem = null; + this.$scope.newPartition.mountPoint = null; + this.$scope.newPartition.volumeName = null; + this.$scope.newPartition.raid = null; + this.$scope.newPartition.partitionSize = null; + + this.$scope.newPartition.display = false; + + this.$scope.buttonControl.displayAddConfirmation = false; + this.$scope.buttonControl.addInProgress = false; + this.clearError(); + this.refreshBar(); + this.validationNbDiskUse(this.$scope.installation.nbDiskUse); } } else { this.$scope.buttonControl.addInProgress = false; @@ -1149,54 +1071,28 @@ export default class ServerInstallationOvhCtrl { } else { trueSize = partitionToSet.partitionSize; if ( - partitionToSet.typePartition !== this.$scope.constants.warningLV && - partitionToSet.fileSystem !== this.$scope.constants.warningZFS + (!this.$scope.installation.selectDistribution.lvmReady && + partitionToSet.fileSystem !== this.$scope.constants.warningZFS) || + partitionToSet.fileSystem === this.$scope.constants.warningSwap ) { partitionToSet.volumeName = null; } - this.Server.putSetPartition( - this.$scope.informations.gabaritName, - this.$scope.installation.selectPartitionScheme, - { - raid: partitionToSet.raid, - fileSystem: partitionToSet.fileSystem, - typePartition: partitionToSet.typePartition, - volumeName: partitionToSet.volumeName, - order: partitionToSet.order, - mountPoint: partitionToSet.mountPoint, - oldMountPoint: this.$scope.setPartition.save.mountPoint, - partitionSize: trueSize, - }, - ).then( - () => { - if (partitionToSet.isRemainingSizePartition) { - this.$scope.installation.dirtyPartition = true; - } - this.$scope.warning.raid0 = false; + if (partitionToSet.isRemainingSizePartition) { + this.$scope.installation.dirtyPartition = true; + } + this.$scope.warning.raid0 = false; - partitionToSet.partitionSize = trueSize; - partitionToSet.orderTable = angular.copy(partitionToSet.order); + partitionToSet.partitionSize = trueSize; + partitionToSet.orderTable = angular.copy(partitionToSet.order); - this.$scope.setPartition.save = null; - this.$scope.setPartition.indexSet = -1; + this.$scope.setPartition.save = null; + this.$scope.setPartition.indexSet = -1; - this.$scope.buttonControl.displayAddConfirmation = false; - this.$scope.buttonControl.setInProgress = false; - this.clearError(); - this.validationNbDiskUse(this.$scope.installation.nbDiskUse); - }, - (data) => { - this.$scope.buttonControl.setInProgress = false; - this.$scope.errorInst.ws = this.$translate.instant( - 'server_configuration_installation_ovh_step2_error_set', - { - t0: partitionToSet.mountPoint, - t1: data.message, - }, - ); - }, - ); + this.$scope.buttonControl.displayAddConfirmation = false; + this.$scope.buttonControl.setInProgress = false; + this.clearError(); + this.validationNbDiskUse(this.$scope.installation.nbDiskUse); } } else { this.$scope.buttonControl.setInProgress = false; @@ -1223,42 +1119,22 @@ export default class ServerInstallationOvhCtrl { deleteValidPartition() { this.$scope.buttonControl.deleteInProgress = true; - this.Server.deleteSetPartition( - this.$scope.informations.gabaritName, - this.$scope.installation.selectPartitionScheme, + if ( this.$scope.installation.partitionSchemeModels[ this.$scope.setPartition.delModel - ].mountPoint, - ).then( - () => { - if ( - this.$scope.installation.partitionSchemeModels[ - this.$scope.setPartition.delModel - ].isRemainingSizePartition - ) { - this.$scope.installation.dirtyPartition = true; - } - this.$scope.installation.partitionSchemeModels.splice( - this.$scope.setPartition.delModel, - 1, - ); - this.$scope.setPartition.delModel = null; - this.getRemainingSize(); - this.$scope.buttonControl.deleteInProgress = false; - this.clearError(); - this.validationNbDiskUse(this.$scope.installation.nbDiskUse); - }, - (data) => { - this.$scope.buttonControl.deleteInProgress = false; - this.$scope.errorInst.ws = this.$translate.instant( - 'server_configuration_installation_ovh_step2_error_delete', - { - t0: this.$scope.setPartition.delModel.mountPoint, - t1: data.message, - }, - ); - }, + ].isRemainingSizePartition + ) { + this.$scope.installation.dirtyPartition = true; + } + this.$scope.installation.partitionSchemeModels.splice( + this.$scope.setPartition.delModel, + 1, ); + this.$scope.setPartition.delModel = null; + this.getRemainingSize(); + this.$scope.buttonControl.deleteInProgress = false; + this.clearError(); + this.validationNbDiskUse(this.$scope.installation.nbDiskUse); } deleteCancelPartition() { @@ -1291,7 +1167,6 @@ export default class ServerInstallationOvhCtrl { return ( this.$scope.errorInst.order || this.$scope.errorInst.orderFirst || - this.$scope.errorInst.orderType || this.$scope.errorInst.orderFirstWin ); } @@ -1348,63 +1223,6 @@ export default class ServerInstallationOvhCtrl { firstPartition.mountPoint !== this.$scope.constants.warningCwin; } } - this.validationType(partition); - } - - // ------TYPE VALIDATION------ - validationVolumeNameByType(partition) { - this.$scope.errorInst.volumeNameEmpty = - partition.typePartition === this.$scope.constants.warningLV && - partition.volumeName === ''; - } - - hasErrorType() { - return ( - this.$scope.errorInst.orderType || - this.$scope.errorInst.typePrimary || - this.$scope.errorInst.mountPointPrimary - ); - } - - validationType(partition) { - if ( - this.$scope.installation.selectDistribution.family === - this.$scope.constants.warningWindows && - partition.mountPoint === this.$scope.constants.warningCwin - ) { - this.$scope.errorInst.mountPointPrimary = - partition.typePartition !== this.$scope.constants.warningPrimary; - } else { - this.$scope.errorInst.mountPointPrimary = false; - } - - this.$scope.errorInst.orderType = false; - - // this.$scope.errorInst.orderLv = false; - if ( - !this.$scope.errorInst.order && - !this.$scope.errorInst.orderFirst && - !this.$scope.errorInst.mountPointPrimary - ) { - this.$scope.installation.partitionSchemeModels.forEach((partition2) => { - // Primary first Test - if ( - (partition2.order < partition.order && - partition2.typePartition !== this.$scope.constants.warningPrimary && - partition.typePartition === this.$scope.constants.warningPrimary) || - (partition2.order > partition.order && - partition2.typePartition === this.$scope.constants.warningPrimary && - partition.typePartition !== this.$scope.constants.warningPrimary) - ) { - this.$scope.errorInst.orderType = true; - } - }); - } - - this.$scope.errorInst.typePrimary = - !this.$scope.errorInst.orderType && this.validationTypePrimary(); - this.validationRaid(partition); - this.validationVolumeNameByType(partition); } // ------FILE SYSTEM VALIDATION------ @@ -1484,10 +1302,6 @@ export default class ServerInstallationOvhCtrl { return this.$scope.errorInst.volumeNameEmpty; } - validationVolumeName(partition) { - this.validationVolumeNameByType(partition); - } - // ------Soft RAID VALIDATION------ hasErrorRaid() { @@ -1711,7 +1525,7 @@ export default class ServerInstallationOvhCtrl { this.$scope.informations.raidController ) { set(option, 'partition.realSize', option.partition.partitionSize); - } else if (option.partition.raid === '_7') { + } else if (option.partition.raid === this.$scope.constants.warningRaid7) { const { nbDiskUse: nbDisks } = this.$scope.installation; const nbParityDisks = 3; const nbDataDisks = nbDisks - nbParityDisks; @@ -1723,10 +1537,10 @@ export default class ServerInstallationOvhCtrl { ); } else if (option.partition.raid) { switch (option.partition.raid) { - case '_0': + case this.$scope.constants.warningRaid0: set(option, 'partition.realSize', option.partition.partitionSize); break; - case '_1': + case this.$scope.constants.warningRaid1: set( option, 'partition.realSize', @@ -1734,7 +1548,7 @@ export default class ServerInstallationOvhCtrl { this.$scope.installation.nbDiskUse, ); break; - case '_5': + case this.$scope.constants.warningRaid5: set( option, 'partition.realSize', @@ -1743,7 +1557,7 @@ export default class ServerInstallationOvhCtrl { (this.$scope.installation.nbDiskUse - 1), ); break; - case '_6': + case this.$scope.constants.warningRaid6: set( option, 'partition.realSize', @@ -1752,7 +1566,7 @@ export default class ServerInstallationOvhCtrl { this.$scope.installation.nbDiskUse, ); break; - case '_10': + case this.$scope.constants.warningRaid10: set( option, 'partition.realSize', @@ -2194,53 +2008,8 @@ export default class ServerInstallationOvhCtrl { // if change variable partition this.addRemainingSize(); - - if (this.$scope.installation.options.variablePartition) { - this.$scope.loader.loading = true; - this.Server.putSetPartition( - this.$scope.informations.gabaritName, - this.$scope.installation.selectPartitionScheme, - { - raid: this.$scope.installation.options.variablePartition.raid, - fileSystem: this.$scope.installation.options.variablePartition - .fileSystem, - typePartition: this.$scope.installation.options.variablePartition - .typePartition, - volumeName: this.$scope.installation.options.variablePartition - .volumeName, - order: this.$scope.installation.options.variablePartition.order, - mountPoint: this.$scope.installation.options.variablePartition - .mountPoint, - oldMountPoint: this.$scope.installation.options.variablePartition - .mountPoint, - partitionSize: size, - }, - ).then( - () => { - if (!stop) { - this.install(); - } else { - this.$scope.loader.loading = false; - } - }, - (data) => { - this.$scope.loader.loading = false; - if (size === 0) { - this.$scope.errorInst.wsinstall = this.$translate.instant( - 'server_configuration_installation_ovh_step3_remaining_error', - { - t0: this.$scope.installation.options.variablePartition - .mountPoint, - t1: data.message, - }, - ); - } // else it's revert size - }, - ); - } else if (!stop) { - this.install(); - } - } else if (!stop) { + } + if (!stop) { this.install(); } } @@ -2248,6 +2017,8 @@ export default class ServerInstallationOvhCtrl { startInstall() { this.$scope.loader.loading = true; const inputs = new Inputs(this.$scope.installation.inputs); + // console.log('startInstall'); + // console.log(this.$scope.installation.partitionSchemeModels); this.Server.startInstallation( this.$stateParams.productId, this.$scope.informations.gabaritName, @@ -2287,57 +2058,37 @@ export default class ServerInstallationOvhCtrl { ); } - setHardwareRaid( - schemeNameFilterList = [this.$scope.installation.selectPartitionScheme], - ) { - const disks = this.prepareDiskList(); - - schemeNameFilterList.forEach((schemeNameFilter) => { - this.Server.postHardwareRaid( - this.$stateParams.productId, - this.$scope.informations.gabaritName, - schemeNameFilter, - disks, - this.$scope.installation.hardwareRaid.raid, - ) - .catch((error) => { - if (error.status === 409) { - return this.Server.putHardwareRaid( - this.$stateParams.productId, - this.$scope.informations.gabaritName, - schemeNameFilter, - disks, - this.$scope.installation.hardwareRaid.raid, - ); - } - return this.$q.reject(error); - }) - .then(() => { - this.startInstall(); - }) - .catch(() => { - this.$scope.loader.loading = false; - this.saveRemainingSize(this.$scope.installation.saveSize, true); - this.$scope.errorInst.wsinstall = this.$translate.instant( - 'server_configuration_installation_error_hardwareRaid', - ); - }); - }); - } + // setHardwareRaid( + // schemeNameFilterList = [this.$scope.installation.selectPartitionScheme], + // ) { + // const disks = this.prepareDiskList(); + // // console.log('setHardwareRaid'); + + // schemeNameFilterList.forEach((schemeNameFilter) => { + // console.log(this.$stateParams.productId); + // console.log(this.$scope.informations.gabaritName); + // console.log(schemeNameFilter); + // console.log(disks); + // console.log(this.$scope.installation.hardwareRaid.raid); + // console.log('----'); + // console.log(this.$scope.installation.hardwareRaid); + // }); + // } install() { this.trackClick( `dedicated::dedicated::${this.serverType}::system-install::public-catalog::install`, ); - if (this.$scope.installation.hardwareRaid.raid) { - this.setHardwareRaid(); - } + // if (this.$scope.installation.hardwareRaid.raid) { + // this.setHardwareRaid(); + // } this.startInstall(); } hasLicencedOs() { return this.$scope.installation.distributionList?.find( - (distribution) => distribution.family === 'WINDOWS', + (distribution) => + distribution.family === this.$scope.constants.warningWindows, ); } diff --git a/packages/manager/modules/bm-server-components/src/general-information/installation/ovh/server-installation-ovh.html b/packages/manager/modules/bm-server-components/src/general-information/installation/ovh/server-installation-ovh.html index aaa48ae6c171..1b740ab962d8 100644 --- a/packages/manager/modules/bm-server-components/src/general-information/installation/ovh/server-installation-ovh.html +++ b/packages/manager/modules/bm-server-components/src/general-information/installation/ovh/server-installation-ovh.html @@ -514,10 +514,6 @@ > - @@ -602,31 +598,10 @@ data-ng-change="$ctrl.validationOrder(partition)" /> - - - - - @@ -674,22 +649,20 @@ }" > - - - - @@ -950,17 +908,15 @@ }" > - -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • - - @@ -1667,12 +1590,12 @@ data-ng-if="!informations.softRaidOnlyMirroring" > - diff --git a/packages/manager/modules/bm-server-components/src/server/server.service.js b/packages/manager/modules/bm-server-components/src/server/server.service.js index 7b8144b4c926..e15933cfa052 100644 --- a/packages/manager/modules/bm-server-components/src/server/server.service.js +++ b/packages/manager/modules/bm-server-components/src/server/server.service.js @@ -1,4 +1,3 @@ -import camelCase from 'lodash/camelCase'; import compact from 'lodash/compact'; import filter from 'lodash/filter'; import find from 'lodash/find'; @@ -809,6 +808,7 @@ export default class Server { }, params: { type: 'ovh', + mode: 'new', }, }, ); @@ -851,86 +851,6 @@ export default class Server { ); } - postAddPartition(gabaritName, gabaritSchemePartitionName, partition) { - const data = angular.copy(partition); - data.type = camelCase(data.typePartition); - delete data.typePartition; - - data.filesystem = camelCase(data.fileSystem); - delete data.fileSystem; - - data.size = camelCase(data.partitionSize); - delete data.partitionSize; - - data.raid = data.raid ? parseInt(data.raid.replace(/_/g, ''), 10) : null; - - delete data.oldMountPoint; - - data.step = camelCase(data.order); - delete data.order; - - data.mountpoint = data.mountPoint; - delete data.mountPoint; - - return this.OvhHttp.post( - '/me/installationTemplate/{templateName}/partitionScheme/{schemeName}/partition', - { - rootPath: 'apiv6', - urlParams: { - templateName: gabaritName, - schemeName: gabaritSchemePartitionName, - }, - data, - }, - ); - } - - putSetPartition(gabaritName, gabaritSchemePartitionName, partition) { - const newPartition = angular.copy(partition); - newPartition.filesystem = camelCase(newPartition.fileSystem); - newPartition.mountpoint = newPartition.mountPoint; - newPartition.size = { - value: newPartition.partitionSize, - unit: 'MB', - }; - newPartition.type = camelCase(newPartition.typePartition); - newPartition.raid = newPartition.raid - ? parseInt(newPartition.raid.replace(/_/g, ''), 10) - : null; - delete newPartition.fileSystem; - delete newPartition.mountPoint; - delete newPartition.typePartition; - delete newPartition.partitionSize; - delete newPartition.oldMountPoint; - - return this.OvhHttp.put( - '/me/installationTemplate/{gabaritName}/partitionScheme/{gabaritSchemePartitionName}/partition/{mountpoint}', - { - rootPath: 'apiv6', - urlParams: { - gabaritName, - gabaritSchemePartitionName, - mountpoint: partition.oldMountPoint, - }, - data: newPartition, - }, - ); - } - - deleteSetPartition(gabaritName, gabaritSchemePartitionName, mountpoint) { - return this.OvhHttp.delete( - '/me/installationTemplate/{templateName}/partitionScheme/{schemeName}/partition/{mountpoint}', - { - rootPath: 'apiv6', - urlParams: { - templateName: gabaritName, - schemeName: gabaritSchemePartitionName, - mountpoint, - }, - }, - ); - } - startInstallation( serviceName, templateName, @@ -938,7 +858,7 @@ export default class Server { details, userMetadata = {}, ) { - return this.OvhHttp.post('/dedicated/server/{serviceName}/install/start', { + return this.OvhHttp.post('/dedicated/server/{serviceName}/install/startt', { rootPath: 'apiv6', urlParams: { serviceName, @@ -1368,49 +1288,6 @@ export default class Server { ); } - postHardwareRaid(productId, templateName, schemeName, disks, raid) { - return this.post( - productId, - '{templateName}/partitionScheme/{schemeName}/hardwareRaid', - { - urlParams: { - templateName, - schemeName, - }, - data: { - disks, - mode: raid, - name: 'managerHardRaid', - step: 1, - }, - proxypass: true, - urlPath: this.path.installationMe, - }, - ); - } - - putHardwareRaid(productId, templateName, schemeName, disks, raid) { - return this.put( - productId, - '{templateName}/partitionScheme/{schemeName}/hardwareRaid/{name}', - { - urlParams: { - templateName, - schemeName, - name: 'managerHardRaid', - }, - data: { - disks, - mode: raid, - name: 'managerHardRaid', - step: 1, - }, - proxypass: true, - urlPath: this.path.installationMe, - }, - ); - } - updateServiceInfos(serviceName, data) { return this.OvhHttp.put('/dedicated/server/{serviceName}/serviceInfos', { rootPath: 'apiv6',