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

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) ===
This was previously relying on the backend_lxd revert logic, but now we need CreateVolumeFromCopy to correctly revert on error so we can call it again if needed.

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From ea4958b403149eaae30c59e873ecaa057b1c077c Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Thu, 23 Apr 2020 09:34:39 +0100
Subject: [PATCH] lxd/storage/drivers/driver/zfs/volumes: Delete volume on
 error in CreateVolumeFromCopy

This was previously relying on the backend_lxd revert logic, but now we need 
CreateVolumeFromCopy to correctly revert on error so we can call it again if 
needed.

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/storage/drivers/driver_zfs_volumes.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lxd/storage/drivers/driver_zfs_volumes.go 
b/lxd/storage/drivers/driver_zfs_volumes.go
index d5e48e96b2..b39b957a9b 100644
--- a/lxd/storage/drivers/driver_zfs_volumes.go
+++ b/lxd/storage/drivers/driver_zfs_volumes.go
@@ -514,6 +514,9 @@ func (d *zfs) CreateVolumeFromCopy(vol Volume, srcVol 
Volume, copySnapshots bool
                if err != nil {
                        return err
                }
+
+               // Delete on revert.
+               revert.Add(func() { d.DeleteVolume(vol, op) })
        }
 
        // Apply the properties.
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to