MoveStoragePoolVolume renames or moves an existing storage volume.
(pool string, source InstanceServer, sourcePool string, volume api.StorageVolume, args *StoragePoolVolumeMoveArgs)
| 843 | |
| 844 | // MoveStoragePoolVolume renames or moves an existing storage volume. |
| 845 | func (r *ProtocolIncus) MoveStoragePoolVolume(pool string, source InstanceServer, sourcePool string, volume api.StorageVolume, args *StoragePoolVolumeMoveArgs) (RemoteOperation, error) { |
| 846 | if !r.HasExtension("storage_api_local_volume_handling") { |
| 847 | return nil, errors.New("The server is missing the required \"storage_api_local_volume_handling\" API extension") |
| 848 | } |
| 849 | |
| 850 | if r != source { |
| 851 | return nil, errors.New("Moving storage volumes between remotes is not implemented") |
| 852 | } |
| 853 | |
| 854 | req := api.StorageVolumePost{ |
| 855 | Name: args.Name, |
| 856 | Pool: pool, |
| 857 | } |
| 858 | |
| 859 | if args.Project != "" { |
| 860 | if !r.HasExtension("storage_volume_project_move") { |
| 861 | return nil, errors.New("The server is missing the required \"storage_volume_project_move\" API extension") |
| 862 | } |
| 863 | |
| 864 | req.Project = args.Project |
| 865 | } |
| 866 | |
| 867 | // Send the request |
| 868 | op, _, err := r.queryOperation("POST", fmt.Sprintf("/storage-pools/%s/volumes/%s/%s", url.PathEscape(sourcePool), url.PathEscape(volume.Type), volume.Name), req, "") |
| 869 | if err != nil { |
| 870 | return nil, err |
| 871 | } |
| 872 | |
| 873 | rop := remoteOperation{ |
| 874 | targetOp: op, |
| 875 | chDone: make(chan bool), |
| 876 | } |
| 877 | |
| 878 | // Forward targetOp to remote op |
| 879 | go func() { |
| 880 | rop.err = rop.targetOp.Wait() |
| 881 | close(rop.chDone) |
| 882 | }() |
| 883 | |
| 884 | return &rop, nil |
| 885 | } |
| 886 | |
| 887 | // UpdateStoragePoolVolume updates the volume to match the provided StoragePoolVolume struct. |
| 888 | func (r *ProtocolIncus) UpdateStoragePoolVolume(pool string, volType string, name string, volume api.StorageVolumePut, ETag string) error { |
nothing calls this directly
no test coverage detected