Skip to content

Commit

Permalink
SnapshotDelete and VolumeDelete for FCD (#347)
Browse files Browse the repository at this point in the history
* Volume delete

* Snapshot delete
  • Loading branch information
Hakan Memisoglu authored and mergify[bot] committed Oct 10, 2019
1 parent 60236cd commit ea12d81
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pkg/blockstorage/vmware/vmware.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ func (p *fcdProvider) VolumeCreateFromSnapshot(ctx context.Context, snapshot blo
}

func (p *fcdProvider) VolumeDelete(ctx context.Context, volume *blockstorage.Volume) error {
return errors.New("Not implemented")
task, err := p.gom.Delete(ctx, vimID(volume.ID))
if err != nil {
return errors.Wrap(err, "Failed to delete the disk")
}
_, err = task.Wait(ctx, defaultWaitTime)
return err
}

func (p *fcdProvider) VolumeGet(ctx context.Context, id string, zone string) (*blockstorage.Volume, error) {
Expand Down Expand Up @@ -147,7 +152,16 @@ func (p *fcdProvider) SnapshotCreateWaitForCompletion(ctx context.Context, snaps
}

func (p *fcdProvider) SnapshotDelete(ctx context.Context, snapshot *blockstorage.Snapshot) error {
return errors.New("Not implemented")
volID, snapshotID, err := splitSnapshotFullID(snapshot.ID)
if err != nil {
return errors.Wrap(err, "Cannot infer volume ID from full snapshot ID")
}
task, err := p.gom.DeleteSnapshot(ctx, vimID(volID), vimID(snapshotID))
if err != nil {
return errors.Wrap(err, "Failed to delete snapshot")
}
_, err = task.Wait(ctx, defaultWaitTime)
return err
}

func (p *fcdProvider) SnapshotGet(ctx context.Context, id string) (*blockstorage.Snapshot, error) {
Expand Down

0 comments on commit ea12d81

Please sign in to comment.