The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7986

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Fixes #7959 
From d8054daeb459c9fb4bf8ef128abde3dccc18a323 Mon Sep 17 00:00:00 2001
From: "daniel.defisher" <ddefis...@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"))
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to