Skip to content

Commit

Permalink
Merge pull request #290 from stgraber/main
Browse files Browse the repository at this point in the history
Fix some storage issues
  • Loading branch information
brauner authored Dec 9, 2023
2 parents f09e9b6 + 0a865e0 commit 980b0d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/incus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ For help with any of those, simply call them with --help.`))
profileCmd := cmdProfile{global: &globalCmd}
app.AddCommand(profileCmd.Command())

// profile sub-command
// project sub-command
projectCmd := cmdProject{global: &globalCmd}
app.AddCommand(projectCmd.Command())

Expand Down
8 changes: 4 additions & 4 deletions internal/server/instance/drivers/driver_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -3764,11 +3764,11 @@ func (d *qemu) addDriveConfig(qemuDev map[string]string, bootIndexes map[string]
aioMode = "threads"
cacheMode = "unsafe" // Use host cache, but ignore all sync requests from guest.
}
}

// Special case ISO images as cdroms.
if driveConf.FSType == "iso9660" {
media = "cdrom"
}
// Special case ISO images as cdroms.
if driveConf.FSType == "iso9660" {
media = "cdrom"
}

// Check if the user has overridden the bus.
Expand Down
13 changes: 7 additions & 6 deletions internal/server/storage/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -6809,6 +6809,11 @@ func (b *backend) CreateCustomVolumeFromISO(projectName string, volName string,
// Check whether we are allowed to create volumes.
req := api.StorageVolumesPost{
Name: volName,
StorageVolumePut: api.StorageVolumePut{
Config: map[string]string{
"size": fmt.Sprintf("%d", size),
},
},
}

err := b.state.DB.Cluster.Transaction(b.state.ShutdownCtx, func(ctx context.Context, tx *db.ClusterTx) error {
Expand All @@ -6824,11 +6829,7 @@ func (b *backend) CreateCustomVolumeFromISO(projectName string, volName string,
// Get the volume name on storage.
volStorageName := project.StorageVolume(projectName, volName)

config := map[string]string{
"size": fmt.Sprintf("%d", size),
}

vol := b.GetVolume(drivers.VolumeTypeCustom, drivers.ContentTypeISO, volStorageName, config)
vol := b.GetVolume(drivers.VolumeTypeCustom, drivers.ContentTypeISO, volStorageName, req.Config)

volExists, err := b.driver.HasVolume(vol)
if err != nil {
Expand Down Expand Up @@ -6905,7 +6906,7 @@ func (b *backend) CreateCustomVolumeFromBackup(srcBackup backup.Info, srcData io
Name: srcBackup.Name,
}

err := b.state.DB.Cluster.Transaction(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {
err := b.state.DB.Cluster.Transaction(b.state.ShutdownCtx, func(ctx context.Context, tx *db.ClusterTx) error {
return project.AllowVolumeCreation(tx, srcBackup.Project, req)
})
if err != nil {
Expand Down

0 comments on commit 980b0d1

Please sign in to comment.