private void SetCustomSchemaUpload() { var imageSchemaRequest = new DtoImageSchemaRequest(); imageSchemaRequest.imageProfile = _imageProfile; imageSchemaRequest.schemaType = "upload"; var customSchema = new ServiceImageSchemaFE(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 DtoApiStringResponse GetSchema(DtoImageSchemaRequest schemaRequest) { var schema = new ServiceImageSchemaFE(schemaRequest).GetImageSchema(); return(new DtoApiStringResponse() { Value = JsonConvert.SerializeObject(schema) }); }
public DtoApiStringResponse GetPartitions(DtoImageSchemaRequest schemaRequest) { var partitions = new ServiceImageSchemaFE(schemaRequest).GetPartitionsForGridView(schemaRequest.selectedHd); return(new DtoApiStringResponse() { Value = JsonConvert.SerializeObject(partitions) }); }
public DtoApiStringResponse GetLogicalVolumes(DtoImageSchemaRequest schemaRequest) { var logicalVolumes = new ServiceImageSchemaFE(schemaRequest).GetLogicalVolumesForGridView(schemaRequest.selectedHd); return(new DtoApiStringResponse() { Value = JsonConvert.SerializeObject(logicalVolumes) }); }
public DtoApiStringResponse GetHardDrives(DtoImageSchemaRequest schemaRequest) { var hardDrives = new ServiceImageSchemaFE(schemaRequest).GetHardDrivesForGridView(); return(new DtoApiStringResponse() { Value = JsonConvert.SerializeObject(hardDrives) }); }
private void SetCustomSchemaDeploy() { var imageSchemaRequest = new DtoImageSchemaRequest(); imageSchemaRequest.imageProfile = _imageProfile; imageSchemaRequest.schemaType = "deploy"; var customSchema = new ServiceImageSchemaFE(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()); }