private void SetCustomSchemaUpload() { var imageSchemaRequest = new ImageSchemaRequestDTO(); imageSchemaRequest.imageProfile = _imageProfile; imageSchemaRequest.schemaType = "upload"; var customSchema = new ImageSchemaFEServices(imageSchemaRequest).GetImageSchema(); var customHardDrives = new StringBuilder(); customHardDrives.Append("custom_hard_drives=\""); var customPartitions = new StringBuilder(); customPartitions.Append("custom_partitions=\""); var customFixedPartitions = new StringBuilder(); customFixedPartitions.Append("custom_fixed_partitions=\""); var customLogicalVolumes = new StringBuilder(); customLogicalVolumes.Append("custom_logical_volumes=\""); var customFixedLogicalVolumes = new StringBuilder(); customFixedLogicalVolumes.Append("custom_fixed_logical_volumes=\""); foreach (var hd in customSchema.HardDrives.Where(x => x.Active)) { customHardDrives.Append(hd.Name + " "); foreach (var partition in hd.Partitions.Where(x => x.Active)) { customPartitions.Append(hd.Name + partition.Prefix + partition.Number + " "); if (partition.ForceFixedSize) { customFixedPartitions.Append(hd.Name + partition.Prefix + partition.Number + " "); } if (partition.VolumeGroup.LogicalVolumes != null) { foreach ( var logicalVolume in partition.VolumeGroup.LogicalVolumes.Where(x => x.Active)) { var vgName = partition.VolumeGroup.Name.Replace("-", "--"); var lvName = logicalVolume.Name.Replace("-", "--"); customLogicalVolumes.Append(vgName + "-" + lvName + " "); if (logicalVolume.ForceFixedSize) { customFixedLogicalVolumes.Append(vgName + "-" + lvName + " "); } } } } } customHardDrives.Append("\""); customPartitions.Append("\""); customFixedPartitions.Append("\""); customLogicalVolumes.Append("\""); customFixedLogicalVolumes.Append("\""); AppendString(customHardDrives.ToString()); AppendString(customPartitions.ToString()); AppendString(customFixedPartitions.ToString()); AppendString(customLogicalVolumes.ToString()); AppendString(customFixedLogicalVolumes.ToString()); }
public ApiStringResponseDTO GetSchema(ImageSchemaRequestDTO schemaRequest) { var schema = new ImageSchemaFEServices(schemaRequest).GetImageSchema(); return(new ApiStringResponseDTO() { Value = JsonConvert.SerializeObject(schema) }); }
public ApiStringResponseDTO GetPartitions(ImageSchemaRequestDTO schemaRequest) { var partitions = new ImageSchemaFEServices(schemaRequest).GetPartitionsForGridView(schemaRequest.selectedHd); return(new ApiStringResponseDTO() { Value = JsonConvert.SerializeObject(partitions) }); }
public ApiStringResponseDTO GetLogicalVolumes(ImageSchemaRequestDTO schemaRequest) { var logicalVolumes = new ImageSchemaFEServices(schemaRequest).GetLogicalVolumesForGridView(schemaRequest.selectedHd); return(new ApiStringResponseDTO() { Value = JsonConvert.SerializeObject(logicalVolumes) }); }
public ApiStringResponseDTO GetHardDrives(ImageSchemaRequestDTO schemaRequest) { var hardDrives = new ImageSchemaFEServices(schemaRequest).GetHardDrivesForGridView(); return(new ApiStringResponseDTO() { Value = JsonConvert.SerializeObject(hardDrives) }); }
private void SetCustomSchemaDeploy() { var imageSchemaRequest = new ImageSchemaRequestDTO(); imageSchemaRequest.imageProfile = _imageProfile; imageSchemaRequest.schemaType = "deploy"; var customSchema = new ImageSchemaFEServices(imageSchemaRequest).GetImageSchema(); var customHardDrives = new StringBuilder(); customHardDrives.Append("custom_hard_drives=\""); foreach (var hd in customSchema.HardDrives.Where(x => x.Active && !string.IsNullOrEmpty(x.Destination))) { customHardDrives.Append(hd.Destination + " "); } customHardDrives.Append("\""); AppendString(customHardDrives.ToString()); }