Skip to content

Commit

Permalink
Add a initial Version of the Disk Driver API
Browse files Browse the repository at this point in the history
  • Loading branch information
powerkimhub committed Aug 11, 2022
1 parent 8331431 commit 12df9e9
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Cloud Driver Interface of CB-Spider.
// The CB-Spider is a sub-Framework of the Cloud-Barista Multi-Cloud Project.
// The CB-Spider Mission is to connect all the clouds with a single interface.
//
// * Cloud-Barista: https://github.com/cloud-barista
//
// This is Resouces interfaces of Cloud Driver.
//
// by CB-Spider Team, 2022.08.

package resources

import "time"


//-------- Const
type DiskStatus string

const (
DiskCreating DiskStatus = "Creating"
DiskAvailable DiskStatus = "Available"
DiskAttached DiskStatus = "Attached"
DiskDeleting DiskStatus = "Deleting"
)

//-------- Info Structure
type DiskInfo struct {
IId IID // {NameId, SystemId}

DiskType string // "", "SSD(gp2)", "Premium SSD", ...
DiskSize string // "", "default", "50", "1000" # (GB)

Status DiskStatus // DiskCreating | DiskAvailable | DiskAttached | DiskDeleting
OwnerVM IID // When the Status is DiskAttached

CreatedTime time.Time
KeyValueList []KeyValue
}


//-------- Disk API
type DiskHandler interface {

//------ Disk Management
CreateDisk(DiskReqInfo DiskInfo) (DiskInfo, error)
ListDisk() ([]*DiskInfo, error)
GetDisk(diskIID IID) (DiskInfo, error)
ChangeDiskSize(diskIID IID, size string) (bool, error)
DeleteDisk(diskIID IID) (bool, error)


//------ Disk Attachment
AttachDisk(diskIID IID, ownerVM IID) (DiskInfo, error)
DetachDisk(diskIID IID, ownerVM IID) (bool, error)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ type VMReqInfo struct {
RootDiskType string // "", "SSD(gp2)", "Premium SSD", ...
RootDiskSize string // "", "default", "50", "1000" (GB)

DataDiskIIDs []IID

VMUserId string
VMUserPasswd string
}
Expand Down Expand Up @@ -79,9 +81,11 @@ type VMInfo struct {
RootDiskType string // "SSD(gp2)", "Premium SSD", ...
RootDiskSize string // "default", "50", "1000" (GB)
RootDeviceName string // "/dev/sda1", ...
VMBootDisk string // Deprecated soon

VMBlockDisk string // ex)
DataDiskIIDs []IID

VMBootDisk string // Deprecated soon
VMBlockDisk string // Deprecated soon

VMUserId string // ex) user1
VMUserPasswd string
Expand Down

0 comments on commit 12df9e9

Please sign in to comment.