[lxc-devel] [lxd/master] lxd/storage: Refuse BLOCK_AND_RSYNC with running instance

stgraber on Github lxc-bot at linuxcontainers.org
Tue Aug 25 21:59:00 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 512 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200825/894384fc/attachment.bin>
-------------- next part --------------
From 637d4973de5f69ecb7d5513cd16e97c947bdd4ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 25 Aug 2020 17:57:01 -0400
Subject: [PATCH] lxd/storage: Refuse BLOCK_AND_RSYNC with running instance
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is needed as QEMU will normally acquire a lock on the block device
backing the instance, preventing any further reader/writer to it.

Closes #7745

Signed-off-by: St├ęphane Graber <stgraber at ubuntu.com>
---
 lxd/storage/backend_lxd.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd/storage/backend_lxd.go b/lxd/storage/backend_lxd.go
index 4e13013eab..c4f34c08d6 100644
--- a/lxd/storage/backend_lxd.go
+++ b/lxd/storage/backend_lxd.go
@@ -1475,6 +1475,11 @@ func (b *lxdBackend) MigrateInstance(inst instance.Instance, conn io.ReadWriteCl
 	logger.Debug("MigrateInstance started")
 	defer logger.Debug("MigrateInstance finished")
 
+	// rsync+dd can't handle running source instances
+	if inst.IsRunning() && args.MigrationType.FSType == migration.MigrationFSType_BLOCK_AND_RSYNC {
+		return fmt.Errorf("Rsync based migration doesn't support running virtual machines")
+	}
+
 	volType, err := InstanceTypeToVolumeType(inst.Type())
 	if err != nil {
 		return err


More information about the lxc-devel mailing list