-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
controller: decompose the LH provisioner
Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
- Loading branch information
1 parent
0641ea6
commit e65b17e
Showing
3 changed files
with
322 additions
and
135 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,34 @@ | ||
package provisioner | ||
|
||
import ( | ||
diskv1 "github.com/harvester/node-disk-manager/pkg/apis/harvesterhci.io/v1beta1" | ||
) | ||
|
||
const ( | ||
TypeLonghornV1 = "Longhornv1" | ||
TypeLonghornV2 = "Longhornv2" | ||
TypeLVM = "LVM" | ||
) | ||
|
||
type Provisioner interface { | ||
Format() (bool, error) | ||
UnFormat() (bool, error) | ||
Provision() (bool, error) | ||
UnProvision() (bool, error) | ||
Update() (bool, error) | ||
GetProvisionerName() string | ||
} | ||
|
||
func setCondDiskAddedToNodeFalse(device *diskv1.BlockDevice, message string, targetStatus diskv1.BlockDeviceProvisionPhase) { | ||
device.Status.ProvisionPhase = targetStatus | ||
diskv1.DiskAddedToNode.SetError(device, "", nil) | ||
diskv1.DiskAddedToNode.SetStatusBool(device, false) | ||
diskv1.DiskAddedToNode.Message(device, message) | ||
} | ||
|
||
func setCondDiskAddedToNodeSuccess(device *diskv1.BlockDevice, message string, targetStatus diskv1.BlockDeviceProvisionPhase) { | ||
device.Status.ProvisionPhase = targetStatus | ||
diskv1.DiskAddedToNode.SetError(device, "", nil) | ||
diskv1.DiskAddedToNode.SetStatusBool(device, true) | ||
diskv1.DiskAddedToNode.Message(device, message) | ||
} |
Oops, something went wrong.