diff --git a/cloud-control-manager/cloud-driver/interfaces/resources/DiskHandler.go b/cloud-control-manager/cloud-driver/interfaces/resources/DiskHandler.go new file mode 100644 index 000000000..df508201f --- /dev/null +++ b/cloud-control-manager/cloud-driver/interfaces/resources/DiskHandler.go @@ -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) +} diff --git a/cloud-control-manager/cloud-driver/interfaces/resources/VMHandler.go b/cloud-control-manager/cloud-driver/interfaces/resources/VMHandler.go index 908890962..055ac4e3c 100644 --- a/cloud-control-manager/cloud-driver/interfaces/resources/VMHandler.go +++ b/cloud-control-manager/cloud-driver/interfaces/resources/VMHandler.go @@ -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 } @@ -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