Skip to content

Commit

Permalink
Properly parse datastore paths
Browse files Browse the repository at this point in the history
  • Loading branch information
zjs committed Oct 25, 2017
1 parent 048fa60 commit 2c23714
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/apiservers/service/restapi/handlers/vch_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"

"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/types"

"github.com/vmware/vic/lib/apiservers/service/models"
Expand Down Expand Up @@ -189,6 +190,12 @@ func vchToModel(op trace.Operation, vch *vm.VirtualMachine, d *data.Data, execut

volumeLocations := make([]*models.VCHStorageVolumeStoresItems0, 0, len(vchConfig.Storage.VolumeLocations))
for label, path := range vchConfig.Storage.VolumeLocations {
parsed_path := object.DatastorePath{}
parsed := parsed_path.FromString(path.Path)
if parsed {
path.Path = parsed_path.Path
}

volume := models.VCHStorageVolumeStoresItems0{Datastore: path.String(), Label: label}
volumeLocations = append(volumeLocations, &volume)
}
Expand Down Expand Up @@ -312,7 +319,6 @@ func asKB(value *int) *models.ValueBytesMetric {
return asBytesMetric(value, models.ValueBytesMetricUnitsKB)
}


func asMHz(value *int) *models.ValueHertz {
if value == nil {
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Create complex VCH
Property Should Be Equal .endpoint.memory.units MiB

Property Should Contain .storage.image_stores[0] %{TEST_DATASTORE}
#Property Should Contain .storage.volume_stores[0].datastore %{TEST_DATASTORE}/test-volumes/foo
Property Should Contain .storage.volume_stores[0].datastore %{TEST_DATASTORE}/test-volumes/foo
Property Should Contain .storage.volume_stores[0].label foo
Property Should Be Equal .storage.base_image_size.value 16000
Property Should Be Equal .storage.base_image_size.units KB
Expand Down

0 comments on commit 2c23714

Please sign in to comment.