diff --git a/vendor/github.com/ukcloud/govcloudair/vapp.go b/vendor/github.com/ukcloud/govcloudair/vapp.go index 413c2ab29..48bbdb6a6 100644 --- a/vendor/github.com/ukcloud/govcloudair/vapp.go +++ b/vendor/github.com/ukcloud/govcloudair/vapp.go @@ -28,6 +28,11 @@ func NewVApp(c *Client) *VApp { } } +func (v *VCDClient) NewVApp(c *Client) VApp { + newvapp := NewVApp(c) + return *newvapp +} + func (v *VApp) Refresh() error { if v.VApp.HREF == "" { @@ -244,7 +249,7 @@ func (v *VApp) RemoveVM(vm VM) error { return nil } -func (v *VApp) ComposeVApp(orgvdcnetwork OrgVDCNetwork, vapptemplate VAppTemplate, name string, description string) (Task, error) { +func (v *VApp) ComposeVApp(orgvdcnetwork OrgVDCNetwork, vapptemplate VAppTemplate, storage_profile_reference *types.Reference, name string, description string) (Task, error) { if vapptemplate.VAppTemplate.Children == nil || orgvdcnetwork.OrgVDCNetwork == nil { return Task{}, fmt.Errorf("can't compose a new vApp, objects passed are not valid") @@ -298,6 +303,7 @@ func (v *VApp) ComposeVApp(orgvdcnetwork OrgVDCNetwork, vapptemplate VAppTemplat InnerNetwork: orgvdcnetwork.OrgVDCNetwork.Name, ContainerNetwork: orgvdcnetwork.OrgVDCNetwork.Name, }, + StorageProfile: storage_profile_reference, }, } diff --git a/vendor/github.com/ukcloud/govcloudair/vdc.go b/vendor/github.com/ukcloud/govcloudair/vdc.go index d6d1d3079..728e18993 100644 --- a/vendor/github.com/ukcloud/govcloudair/vdc.go +++ b/vendor/github.com/ukcloud/govcloudair/vdc.go @@ -105,6 +105,30 @@ func (v *Vdc) FindVDCNetwork(network string) (OrgVDCNetwork, error) { return OrgVDCNetwork{}, fmt.Errorf("can't find VDC Network: %s", network) } +func (v *Vdc) FindStorageProfile(storage_profile string) (types.Reference, error) { + + for _, an := range v.Vdc.VdcStorageProfiles { + for _, n := range an.VdcStorageProfile { + if n.Name == storage_profile { + return *n, nil + } + } + return types.Reference{}, fmt.Errorf("can't find VDC Storage_profile: %s", storage_profile) + } + return types.Reference{}, fmt.Errorf("can't find any VDC Storage_profiles") +} + +func (v *Vdc) GetDefaultStorageProfile(storage_profiles *types.QueryResultRecordsType) (types.Reference, error) { + + for _, n := range storage_profiles.OrgVdcStorageProfileRecord { + if n.IsDefaultStorageProfile { + storage_profile_reference := types.Reference{HREF: n.HREF, Name: n.Name} + return storage_profile_reference, nil + } + } + return types.Reference{}, fmt.Errorf("can't find Default VDC Storage_profile") +} + // Doesn't work with vCloud API 5.5, only vCloud Air func (v *Vdc) GetVDCOrg() (Org, error) { @@ -281,13 +305,13 @@ func (v *Vdc) FindVAppByID(vappid string) (VApp, error) { } urnslice := strings.SplitAfter(vappid, ":") - urnid := urnslice[len(urnslice)-1] + urnid := urnslice[len(urnslice) - 1] for _, resents := range v.Vdc.ResourceEntities { for _, resent := range resents.ResourceEntity { hrefslice := strings.SplitAfter(resent.HREF, "/") - hrefslice = strings.SplitAfter(hrefslice[len(hrefslice)-1], "-") + hrefslice = strings.SplitAfter(hrefslice[len(hrefslice) - 1], "-") res := strings.Join(hrefslice[1:], "") if res == urnid && resent.Type == "application/vnd.vmware.vcloud.vApp+xml" { diff --git a/vendor/vendor.json b/vendor/vendor.json index 09a55c3d8..a42883d35 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -2986,10 +2986,10 @@ "revisionTime": "2016-09-28T01:52:44Z" }, { - "checksumSHA1": "cm+mGoVXAuESxVeudG1FSIN0lv4=", + "checksumSHA1": "YOsTnuSgZn1CUUBNZJDjdPt072E=", "path": "github.com/ukcloud/govcloudair", - "revision": "3c7799ae4b9cd5896a77990514578681c837c7bb", - "revisionTime": "2017-04-12T09:42:31Z" + "revision": "81750aa743ea8c1ab671ae615b2277d1835c7eb2", + "revisionTime": "2017-04-26T18:57:05Z" }, { "checksumSHA1": "8FHandxT6XIwsawRe0eNupivqho=",