func (c *client) VolumeCopy( ctx types.Context, service, volumeID string, request *types.VolumeCopyRequest) (*types.Volume, error) { ctx = c.withInstanceID(c.requireCtx(ctx), service) lsd, _ := registry.NewClientDriver(service) if lsd != nil { if err := lsd.Init(ctx, c.config); err != nil { return nil, err } if err := lsd.VolumeCopyBefore( &ctx, service, volumeID, request); err != nil { return nil, err } } vol, err := c.APIClient.VolumeCopy(ctx, service, volumeID, request) if err != nil { return nil, err } if lsd != nil { lsd.VolumeCopyAfter(ctx, vol) } return vol, nil }
func (c *client) VolumeRemove( ctx types.Context, service, volumeID string) error { ctx = c.withInstanceID(c.requireCtx(ctx), service) lsd, _ := registry.NewClientDriver(service) if lsd != nil { if err := lsd.Init(ctx, c.config); err != nil { return err } if err := lsd.VolumeRemoveBefore( &ctx, service, volumeID); err != nil { return err } } err := c.APIClient.VolumeRemove(ctx, service, volumeID) if err != nil { return err } if lsd != nil { lsd.VolumeRemoveAfter(ctx, service, volumeID) } return nil }
func (c *client) VolumeCreate( ctx types.Context, service string, request *types.VolumeCreateRequest) (*types.Volume, error) { ctx = c.withInstanceID(c.requireCtx(ctx), service) ctxA, err := c.withAllLocalDevices(ctx) if err != nil { return nil, err } ctx = ctxA lsd, _ := registry.NewClientDriver(service) if lsd != nil { if err := lsd.Init(ctx, c.config); err != nil { return nil, err } if err := lsd.VolumeCreateBefore( &ctx, service, request); err != nil { return nil, err } } vol, err := c.APIClient.VolumeCreate(ctx, service, request) if err != nil { return nil, err } if lsd != nil { lsd.VolumeCreateAfter(ctx, vol) } return vol, nil }