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

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) ===
Signed-off-by: Stéphane Graber <[email protected]>
From 4c41b09fc058669674c0c481fee30fa4c6ea07c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]>
Date: Tue, 21 Aug 2018 13:17:51 -0400
Subject: [PATCH] lxd/storage/ceph: Only freeze container if running
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <[email protected]>
---
 lxd/storage_ceph.go | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/lxd/storage_ceph.go b/lxd/storage_ceph.go
index 15b6c6ce91..0345fd7176 100644
--- a/lxd/storage_ceph.go
+++ b/lxd/storage_ceph.go
@@ -1618,16 +1618,19 @@ func (s *storageCeph) ContainerGetUsage(container 
container) (int64, error) {
 }
 
 func (s *storageCeph) ContainerSnapshotCreate(snapshotContainer container, 
sourceContainer container) error {
-       // This is costly but we need to ensure that all cached data has
-       // been committed to disk. If we don't then the rbd snapshot of
-       // the underlying filesystem can be inconsistent or - worst case
-       // - empty.
-       syscall.Sync()
-       containerMntPoint := getContainerMountPoint(s.pool.Name, 
sourceContainer.Name())
-       msg, fsFreezeErr := shared.TryRunCommand("fsfreeze", "--freeze", 
containerMntPoint)
-       logger.Debugf("Trying to freeze the filesystem: %s: %s", msg, 
fsFreezeErr)
-       if fsFreezeErr == nil {
-               defer shared.TryRunCommand("fsfreeze", "--unfreeze", 
containerMntPoint)
+       if sourceContainer.IsRunning() {
+               // This is costly but we need to ensure that all cached data has
+               // been committed to disk. If we don't then the rbd snapshot of
+               // the underlying filesystem can be inconsistent or - worst case
+               // - empty.
+               syscall.Sync()
+
+               containerMntPoint := getContainerMountPoint(s.pool.Name, 
sourceContainer.Name())
+               msg, fsFreezeErr := shared.TryRunCommand("fsfreeze", 
"--freeze", containerMntPoint)
+               logger.Debugf("Trying to freeze the filesystem: %s: %s", msg, 
fsFreezeErr)
+               if fsFreezeErr == nil {
+                       defer shared.TryRunCommand("fsfreeze", "--unfreeze", 
containerMntPoint)
+               }
        }
 
        return s.doContainerSnapshotCreate(snapshotContainer.Name(), 
sourceContainer.Name())
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to