Skip to content

Commit 812dba9

Browse files
authored
Storage: Fix some incorrect operation entity URLs for storage volumes and buckets (#18139)
2 parents ca9a39d + 051ec1a commit 812dba9

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

lxd/storage_buckets.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ func storagePoolBucketPut(d *Daemon, r *http.Request) response.Response {
672672
location = request.QueryParam(r, "target")
673673
}
674674

675-
entityURL := entity.StorageBucketURL(effectiveProjectName, location, details.pool.Name(), details.bucketName)
675+
entityURL := entity.StorageBucketURL(effectiveProjectName, location, details.pool.Name(), details.bucketName).Project(effectiveProjectName)
676676

677677
run := func(ctx context.Context, op *operations.Operation) error {
678678
err := details.pool.UpdateBucket(effectiveProjectName, details.bucketName, req)
@@ -754,7 +754,7 @@ func storagePoolBucketDelete(d *Daemon, r *http.Request) response.Response {
754754
location = request.QueryParam(r, "target")
755755
}
756756

757-
entityURL := entity.StorageBucketURL(effectiveProjectName, location, details.pool.Name(), details.bucketName)
757+
entityURL := entity.StorageBucketURL(effectiveProjectName, location, details.pool.Name(), details.bucketName).Project(effectiveProjectName)
758758

759759
run := func(ctx context.Context, op *operations.Operation) error {
760760
err := doStorageBucketDelete(details.pool, effectiveProjectName, details.bucketName)
@@ -1015,7 +1015,7 @@ func storagePoolBucketKeysPost(d *Daemon, r *http.Request) response.Response {
10151015
location = request.QueryParam(r, "target")
10161016
}
10171017

1018-
entityURL := entity.StorageBucketURL(effectiveProjectName, location, details.pool.Name(), details.bucketName)
1018+
entityURL := entity.StorageBucketURL(effectiveProjectName, location, details.pool.Name(), details.bucketName).Project(effectiveProjectName)
10191019

10201020
run := func(ctx context.Context, op *operations.Operation) error {
10211021
key, err := details.pool.CreateBucketKey(effectiveProjectName, details.bucketName, req)
@@ -1107,7 +1107,7 @@ func storagePoolBucketKeyDelete(d *Daemon, r *http.Request) response.Response {
11071107
location = request.QueryParam(r, "target")
11081108
}
11091109

1110-
entityURL := entity.StorageBucketURL(effectiveProjectName, location, details.pool.Name(), details.bucketName)
1110+
entityURL := entity.StorageBucketURL(effectiveProjectName, location, details.pool.Name(), details.bucketName).Project(effectiveProjectName)
11111111

11121112
run := func(ctx context.Context, op *operations.Operation) error {
11131113
err := details.pool.DeleteBucketKey(effectiveProjectName, details.bucketName, keyName)
@@ -1303,7 +1303,7 @@ func storagePoolBucketKeyPut(d *Daemon, r *http.Request) response.Response {
13031303
location = request.QueryParam(r, "target")
13041304
}
13051305

1306-
entityURL := entity.StorageBucketURL(effectiveProjectName, location, details.pool.Name(), details.bucketName)
1306+
entityURL := entity.StorageBucketURL(effectiveProjectName, location, details.pool.Name(), details.bucketName).Project(effectiveProjectName)
13071307

13081308
run := func(ctx context.Context, op *operations.Operation) error {
13091309
err := details.pool.UpdateBucketKey(effectiveProjectName, details.bucketName, keyName, req)

lxd/storage_volumes.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,10 +1312,10 @@ func doVolumeCreateOrCopy(s *state.State, r *http.Request, requestProjectName st
13121312
if shared.IsSnapshot(req.Source.Name) {
13131313
opType = operationtype.VolumeSnapshotCopy
13141314
vName, sName, _ := api.GetParentAndSnapshotName(req.Source.Name)
1315-
entityURL = entity.StorageVolumeSnapshotURL(srcProjectName, location, req.Source.Pool, req.Type, vName, sName)
1315+
entityURL = entity.StorageVolumeSnapshotURL(srcProjectName, location, req.Source.Pool, req.Type, vName, sName).Project(projectName)
13161316
} else {
13171317
opType = operationtype.VolumeCopy
1318-
entityURL = entity.StorageVolumeURL(srcProjectName, location, req.Source.Pool, req.Type, req.Source.Name)
1318+
entityURL = entity.StorageVolumeURL(srcProjectName, location, req.Source.Pool, req.Type, req.Source.Name).Project(projectName)
13191319
}
13201320

13211321
run = func(ctx context.Context, op *operations.Operation) error {
@@ -1881,10 +1881,10 @@ func storagePoolVolumeTypePostMigration(state *state.State, r *http.Request, req
18811881
srcVolParentName, srcVolSnapName, srcIsSnapshot := api.GetParentAndSnapshotName(volumeName)
18821882
if srcIsSnapshot {
18831883
opType = operationtype.VolumeSnapshotTransfer
1884-
entityURL = api.NewURL().Path(version.APIVersion, "storage-pools", poolName, "volumes", "custom", srcVolParentName, "snapshots", srcVolSnapName)
1884+
entityURL = api.NewURL().Path(version.APIVersion, "storage-pools", poolName, "volumes", "custom", srcVolParentName, "snapshots", srcVolSnapName).Project(projectName)
18851885
} else {
18861886
opType = operationtype.VolumeMigrate
1887-
entityURL = api.NewURL().Path(version.APIVersion, "storage-pools", poolName, "volumes", "custom", volumeName)
1887+
entityURL = api.NewURL().Path(version.APIVersion, "storage-pools", poolName, "volumes", "custom", volumeName).Project(projectName)
18881888
}
18891889

18901890
// We're migrating volume on this node.

0 commit comments

Comments
 (0)