[lxc-devel] [lxd/master] lxd: Prevent internal cluster migration of instances with backups
DDEFISHER on Github
lxc-bot at linuxcontainers.org
Tue Oct 6 03:08:15 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 313 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201005/2045957a/attachment.bin>
-------------- next part --------------
From d8054daeb459c9fb4bf8ef128abde3dccc18a323 Mon Sep 17 00:00:00 2001
From: "daniel.defisher" <ddefisher at gmail.com>
Date: Sun, 4 Oct 2020 14:56:08 -0400
Subject: [PATCH] lxd: Prevent internal cluster migration of instances with
backups
---
lxd/instance_post.go | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lxd/instance_post.go b/lxd/instance_post.go
index eb7b307a5b..a9a7eb035e 100644
--- a/lxd/instance_post.go
+++ b/lxd/instance_post.go
@@ -173,6 +173,15 @@ func containerPost(d *Daemon, r *http.Request) response.Response {
if req.Migration {
if targetNode != "" {
+ // Check if instance has backups.
+ backups, err := d.cluster.GetInstanceBackups(project, name)
+ if err != nil {
+ return response.SmartError(err)
+ }
+ if len(backups) > 0 {
+ return response.BadRequest(fmt.Errorf("Instance has backups"))
+ }
+
// Check whether the container is running.
if !sourceNodeOffline && inst.IsRunning() {
return response.BadRequest(fmt.Errorf("Container is running"))
More information about the lxc-devel
mailing list