Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some storage issues #290

Merged
merged 4 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading