Skip to content

Commit

Permalink
feat(Name): Add Name as a meta info for partitions created by OpenEBS (
Browse files Browse the repository at this point in the history
…#494)

* Add "OpenEBS_NDM" as Name meta info for partition_test
* Update tests to assert Name meta info

Signed-off-by: avats-dev <[email protected]>
  • Loading branch information
avats-dev authored Oct 5, 2020
1 parent 8232952 commit 6c2ff64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/partition/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ const (

// NoOfLogicalBlocksForGPTHeader is the no. of logical blocks for the GPT header.
NoOfLogicalBlocksForGPTHeader = 1

// OpenEBSNDMPartitionName is the name meta info for openEBS created partitions.
OpenEBSNDMPartitionName = "OpenEBS_NDM"
)

// Disk struct represents a disk which needs to be partitioned
Expand Down Expand Up @@ -92,7 +95,7 @@ func (d *Disk) createPartitionTable() error {
}

// addPartition is used to add a partition to the partition table.
// Currently only a single partition can be created. i.e The method can be called only once for a disk
// Currently only a single partition can be created i.e, The method can be called only once for a disk.
// TODO: @akhilerm, add method to create partition with given size
func (d *Disk) addPartition() error {
var startSector, endSector uint64
Expand All @@ -111,6 +114,7 @@ func (d *Disk) addPartition() error {
Start: startSector,
End: endSector,
Type: gpt.LinuxFilesystem,
Name: OpenEBSNDMPartitionName,
}
d.table.Partitions = append(d.table.Partitions, partition)
return nil
Expand Down
2 changes: 2 additions & 0 deletions pkg/partition/partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func TestAddPartition(t *testing.T) {
Start: 2048,
End: 976773134,
Type: gpt.LinuxFilesystem,
Name: OpenEBSNDMPartitionName,
},
},
},
Expand All @@ -113,6 +114,7 @@ func TestAddPartition(t *testing.T) {
Start: 256,
End: 98303994,
Type: gpt.LinuxFilesystem,
Name: OpenEBSNDMPartitionName,
},
},
},
Expand Down

0 comments on commit 6c2ff64

Please sign in to comment.