The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7799
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 <stgra...@ubuntu.com>
From 8670fa751664dfbf68ae67a86099d59fd030d7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Mon, 24 Aug 2020 09:33:48 -0400 Subject: [PATCH] lxd/storage/zfs: Don't filter mountpoint on block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/storage/drivers/driver_zfs_utils.go | 7 +++++-- lxd/storage/drivers/driver_zfs_volumes.go | 17 +++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lxd/storage/drivers/driver_zfs_utils.go b/lxd/storage/drivers/driver_zfs_utils.go index bf67e58053..edc01f2dbb 100644 --- a/lxd/storage/drivers/driver_zfs_utils.go +++ b/lxd/storage/drivers/driver_zfs_utils.go @@ -265,9 +265,12 @@ func (d *zfs) sendDataset(dataset string, parent string, volSrcArgs *migration.V return nil } -func (d *zfs) receiveDataset(dataset string, conn io.ReadWriteCloser, writeWrapper func(io.WriteCloser) io.WriteCloser) error { +func (d *zfs) receiveDataset(vol Volume, conn io.ReadWriteCloser, writeWrapper func(io.WriteCloser) io.WriteCloser) error { // Assemble zfs receive command. - cmd := exec.Command("zfs", "receive", "-x", "mountpoint", "-F", "-u", dataset) + cmd := exec.Command("zfs", "receive", "-x", "mountpoint", "-F", "-u", d.dataset(vol, false)) + if vol.ContentType() == ContentTypeBlock { + cmd = exec.Command("zfs", "receive", "-F", "-u", d.dataset(vol, false)) + } // Prepare stdin/stderr. stdin, err := cmd.StdinPipe() diff --git a/lxd/storage/drivers/driver_zfs_volumes.go b/lxd/storage/drivers/driver_zfs_volumes.go index c936189a64..5c548061e0 100644 --- a/lxd/storage/drivers/driver_zfs_volumes.go +++ b/lxd/storage/drivers/driver_zfs_volumes.go @@ -307,7 +307,11 @@ func (d *zfs) CreateVolumeFromBackup(vol Volume, srcBackup backup.Info, srcData if hdr.Name == srcFile { // Extract the backup. - err = shared.RunCommandWithFds(tr, nil, "zfs", "receive", "-x", "mountpoint", "-F", target) + if vol.ContentType() == ContentTypeBlock { + err = shared.RunCommandWithFds(tr, nil, "zfs", "receive", "-F", target) + } else { + err = shared.RunCommandWithFds(tr, nil, "zfs", "receive", "-x", "mountpoint", "-F", target) + } if err != nil { return err @@ -487,7 +491,12 @@ func (d *zfs) CreateVolumeFromCopy(vol Volume, srcVol Volume, copySnapshots bool // Send/receive the snapshot. var sender *exec.Cmd - receiver := exec.Command("zfs", "receive", "-x", "mountpoint", d.dataset(vol, false)) + var receiver *exec.Cmd + if vol.ContentType() == ContentTypeBlock { + receiver = exec.Command("zfs", "receive", d.dataset(vol, false)) + } else { + receiver = exec.Command("zfs", "receive", "-x", "mountpoint", d.dataset(vol, false)) + } // Handle transferring snapshots. if len(snapshots) > 0 { @@ -627,7 +636,7 @@ func (d *zfs) CreateVolumeFromMigration(vol Volume, conn io.ReadWriteCloser, vol fullSnapshotName := GetSnapshotVolumeName(vol.name, snapName) wrapper := migration.ProgressWriter(op, "fs_progress", fullSnapshotName) - err = d.receiveDataset(d.dataset(vol, false), conn, wrapper) + err = d.receiveDataset(vol, conn, wrapper) if err != nil { return err } @@ -636,7 +645,7 @@ func (d *zfs) CreateVolumeFromMigration(vol Volume, conn io.ReadWriteCloser, vol // Transfer the main volume. wrapper := migration.ProgressWriter(op, "fs_progress", vol.name) - err := d.receiveDataset(d.dataset(vol, false), conn, wrapper) + err := d.receiveDataset(vol, conn, wrapper) if err != nil { return err }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel