From a8333ab2495efd3aacf87e2b8b37f702dc21a84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Thu, 7 Dec 2023 16:39:34 -0500 Subject: [PATCH 1/4] incus: Fix typo in comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- cmd/incus/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/incus/main.go b/cmd/incus/main.go index 6e208890d52..2441864009e 100644 --- a/cmd/incus/main.go +++ b/cmd/incus/main.go @@ -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()) From 6cb220fd46b8dbb61cabd4aa03e535d74b3ce3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Fri, 8 Dec 2023 17:46:50 -0500 Subject: [PATCH 2/4] incusd/storage: Use Shutdown context for import from backup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it consistent with the ISO import. Signed-off-by: Stéphane Graber --- internal/server/storage/backend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/server/storage/backend.go b/internal/server/storage/backend.go index 26fe5b10462..85297356d7d 100644 --- a/internal/server/storage/backend.go +++ b/internal/server/storage/backend.go @@ -6905,7 +6905,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 { From 4feeb19fe3a2507e7b4198ab97d47cbae8ca1937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Fri, 8 Dec 2023 17:47:11 -0500 Subject: [PATCH 3/4] incusd/storage: Fix size check for ISO volumes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #284 Signed-off-by: Stéphane Graber --- internal/server/storage/backend.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/server/storage/backend.go b/internal/server/storage/backend.go index 85297356d7d..3c342d6b3bf 100644 --- a/internal/server/storage/backend.go +++ b/internal/server/storage/backend.go @@ -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 { @@ -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 { From 0a865e0c280efa7e6eed741a1e4979750216477e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Fri, 8 Dec 2023 19:54:23 -0500 Subject: [PATCH 4/4] incusd/instance/qemu: Properly set cdrom type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- internal/server/instance/drivers/driver_qemu.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/server/instance/drivers/driver_qemu.go b/internal/server/instance/drivers/driver_qemu.go index da5efaa797b..6a8953dd59d 100644 --- a/internal/server/instance/drivers/driver_qemu.go +++ b/internal/server/instance/drivers/driver_qemu.go @@ -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.