Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
ciao-controller: Make CNCI storage ephemeral
Browse files Browse the repository at this point in the history
Refactor the instance launching code to make storage for the CNCI
ephemeral so that it will be cleaned up when the CNCI is deleted.

Fixes: #851

Signed-off-by: Rob Bradford <[email protected]>
  • Loading branch information
rbradford committed Nov 22, 2016
1 parent cc089c2 commit ef58c10
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ciao-controller/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ func newInstance(ctl *controller, tenantID string, workload *types.Workload) (*i
}

func (i *instance) Add() error {
ds := i.ctl.ds
if i.CNCI == false {
ds := i.ctl.ds
ds.AddInstance(&i.Instance)
storage := i.newConfig.sc.Start.Storage
if (storage != payloads.StorageResources{}) {
_, err := ds.CreateStorageAttachment(i.Instance.ID, storage.ID, storage.Ephemeral)
if err != nil {
glog.Error(err)
}
}
} else {
i.ctl.ds.AddTenantCNCI(i.TenantID, i.ID, i.MACAddress)
ds.AddTenantCNCI(i.TenantID, i.ID, i.MACAddress)
}
storage := i.newConfig.sc.Start.Storage
if (storage != payloads.StorageResources{}) {
_, err := ds.CreateStorageAttachment(i.Instance.ID, storage.ID, storage.Ephemeral)
if err != nil {
glog.Error(err)
}
}

return nil
Expand Down

0 comments on commit ef58c10

Please sign in to comment.