Merge pull request #3448 from stgraber/main

Fix block backup issues
This commit is contained in:
Stéphane Graber 2026-06-03 04:41:51 -04:00 committed by GitHub
commit 4596075585
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 3 deletions

View File

@ -11074,6 +11074,12 @@ func (d *qemu) ExportQcow2Block(diskName string, blockIndex int) (func(), string
return nil, "", err
}
// Cleanup any leftover sockets.
err = os.Remove(socketPath)
if err != nil && !errors.Is(err, fs.ErrNotExist) {
return nil, "", fmt.Errorf("Failed to remove stale migration socket %q: %w", socketPath, err)
}
migrationSock, err := net.ListenUnix("unix", addr)
if err != nil {
return nil, "", fmt.Errorf("Error connecting to migration socket %q: %w", socketPath, err)

View File

@ -758,7 +758,14 @@ func (r *pipeResponse) Render(w http.ResponseWriter) error {
}
_, err := util.SafeCopy(w, r.reader)
return err
if err != nil {
// It's too late to send a clean error back to the client, so
// instead use the Go HTTP ErrAbortHandler logic to terminate the
// connection. This does not cause the daemon itself to panic.
panic(http.ErrAbortHandler)
}
return nil
}
// String returns a quick description of the response.

View File

@ -9123,8 +9123,8 @@ func (b *backend) qcow2BackupVolume(vol drivers.Volume, dbVol *db.StorageVolume,
return err
}
inst, deviceName, err := InstanceByVolumeName(b.state, b.name, projectName, vol.Name(), volumeDBType)
if err != nil {
inst, deviceName, err := InstanceByVolumeName(b.state, b.name, projectName, dbVol.Name, volumeDBType)
if err != nil && !errors.Is(err, ErrVolumeNotAttachedToRunningInstance) {
return err
}