Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions oracle/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io/ioutil"
"net/http"
"os"
"strconv"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -787,6 +788,45 @@ func nodePoolContainsNode(s []containerengine.Node, e string) bool {
return false
}


func (o *oracleOps) Expand(volumeID string, newSizeInGiB uint64) (uint64, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First check the current size of the disk. If requested newSizeInGiB is less than or equal to current size then return an error.
Take a look at how are we currently doing in AWS: https://github.com/libopenstorage/cloudops/blob/master/aws/aws.go#L937

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

logrus.Debug("Expand volume to size ", newSizeInGiB, " GiB")

volume, err := o.storage.GetVolume(context.Background(), core.GetVolumeRequest{VolumeId: &volumeID})
if err != nil {
return 0, err
}

currentsize := uint64(*volume.SizeInGBs)

if (currentsize > newSizeInGiB) || (currentsize == newSizeInGiB) {
return currentsize, errors.New("Can not change Volume size from " + strconv.Itoa(int(currentsize)) + " GiB to " + strconv.Itoa(int(newSizeInGiB)) + " GiB")
}

req := core.UpdateVolumeRequest{
VolumeId: &volumeID,
UpdateVolumeDetails: core.UpdateVolumeDetails{
SizeInGBs: common.Int64(int64(newSizeInGiB)),
},
}

updateVolResp, err := o.storage.UpdateVolume(context.Background(), req)
if err != nil {
return 0, err
}

oracleVol, err := o.waitVolumeStatus(*updateVolResp.Id, core.VolumeLifecycleStateAvailable)
if err != nil {
return 0, err
}
updatedVol, ok := oracleVol.(*core.Volume)
if !ok {
return 0, errors.New("Marshelling failed for Oracle volume")
}

return uint64(*updatedVol.SizeInGBs), nil
}

func (o *oracleOps) SetClusterVersion(version string, timeout time.Duration) error {
logrus.Println("Setting Cluster version to", version)
req := containerengine.UpdateClusterRequest{
Expand Down