-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
partitioners: move and add abstraction for sgdisk and sfdisk
Add an interface to abstract implementation details for partition management, allowing tooling to pivot between implementations. TBD: argument/tag reading for triggering the pivot Fixes: https://issues.redhat.com/browse/COS-2930
- Loading branch information
Showing
5 changed files
with
283 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2024 Red Hat | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package partitioners | ||
|
||
import ( | ||
"github.com/coreos/ignition/v2/config/v3_5_experimental/types" | ||
) | ||
|
||
type DeviceManager interface { | ||
CreatePartition(p Partition) | ||
DeletePartition(num int) | ||
Info(num int) | ||
WipeTable(wipe bool) | ||
Pretend() (string, error) | ||
Commit() error | ||
ParseOutput(string, []int) (map[int]Output, error) | ||
} | ||
|
||
type Partition struct { | ||
types.Partition | ||
StartSector *int64 | ||
SizeInSectors *int64 | ||
StartMiB string | ||
SizeMiB string | ||
} | ||
|
||
type Output struct { | ||
Start int64 | ||
Size int64 | ||
} |
Oops, something went wrong.