-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VolumeGet implementation for VMware FCD (#339)
* VolumeGet implementation * Set fields to default values * Update the doc string * Fix the import order * Add error check * Address review comments
- Loading branch information
1 parent
6911c75
commit 3baeb82
Showing
2 changed files
with
48 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package vmware | ||
|
||
import ( | ||
"github.com/vmware/govmomi/vim25/types" | ||
|
||
"github.com/kanisterio/kanister/pkg/blockstorage" | ||
) | ||
|
||
func convertFromObjectToVolume(vso *types.VStorageObject) *blockstorage.Volume { | ||
return &blockstorage.Volume{ | ||
Type: blockstorage.TypeFCD, | ||
ID: vso.Config.Id.Id, | ||
CreationTime: blockstorage.TimeStamp(vso.Config.CreateTime), | ||
Size: vso.Config.CapacityInMB / 1024, | ||
Az: "", | ||
Iops: 0, | ||
Encrypted: false, | ||
VolumeType: "", | ||
Tags: blockstorage.VolumeTags{}, | ||
Attributes: map[string]string{}, | ||
} | ||
} | ||
|
||
// vimID wraps ID string with vim25.ID struct. | ||
func vimID(id string) types.ID { | ||
return types.ID{ | ||
Id: id, | ||
} | ||
} | ||
|
||
func convertKeyValueToTags(kvs []types.KeyValue) []*blockstorage.KeyValue { | ||
tags := make(map[string]string) | ||
for _, kv := range kvs { | ||
tags[kv.Key] = kv.Value | ||
} | ||
return blockstorage.MapToKeyValue(tags) | ||
} |
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