Lxc storage volume copy to remote


#1

Hi, there is some trick to copy a custom volume to remote lxd? I’m using lvm storage.
rsync is the only option?

thank you in advance


(Stéphane Graber) #2

lxc storage volume copy some-pool/some-volume remote:some-pool/some-volume should work fine. That will indeed be using rsync internally over the LXD API.


#3

You right!
My mistake, I was thinking to snapshot the volume before the transfert!

Thank you!

btw, on the command line it’s not documented:
lxc storage volume copy <pool>/<volume>[/<snapshot>] <pool>/<volume> [flags]


#4

A nice to have would be user/group remapping…
:slight_smile:

Maybe using --numeric-ids with rsync.


(Chris Green) #5

I’ve been able to copy a storage volume using the above, but not a snapshot of the storage volume. I’m less than a week into lxc, am I missing something obvious?

In these commands, I’m reaching out from what will be a backup server, to copy the storage volume from the obfuscated REMOTE_URL

Works
lxc storage volume copy REMOTE_URL:default/data backup/grabbed

Doesn’t work
lxc storage volume copy REMOTE_URL:default/data/remote-snapshot backup/grabbed
Error: not found

List of storage volume snapshots on REMOTE_URL

lxc storage volume list default

+-------------------+------------------------------------------------------------------+-------------+---------+
|       TYPE        |                               NAME                               | DESCRIPTION | USED BY |
+-------------------+------------------------------------------------------------------+-------------+---------+
| container         | centos                                                           |             | 1       |
+-------------------+------------------------------------------------------------------+-------------+---------+
| custom            | data                                                             |             | 1       |
+-------------------+------------------------------------------------------------------+-------------+---------+
| custom (snapshot) | data/remote-snapshot                                             |             | 0       |
+-------------------+------------------------------------------------------------------+-------------+---------+
| image             | 5afd62d51b11466b22f911d5046657ddf5d733a483946837916e011178e963df |             | 1       |
+-------------------+------------------------------------------------------------------+-------------+---------+

(Stéphane Graber) #6

We are about to merge a fix for this, it will be in 3.12


(Chris Green) #7

Thanks for the big update @stgraber :+1:

I’ve tried to copy and move a custom storage volume snapshot, from one lxd to another, but I’m still getting the Error: not found.

This was tested using two of the “tryit” online CLIs; listing storage volumes and remotely creating snapshots was still possible.

lxc storage volume move tryit:default/data/snapped default/backed-up

Chris.


(Stéphane Graber) #8

@monstermunchkin any idea why this would still fail?

@DirectRoot could you show the output when passing --debug to it?


(Chris Green) #9

@stgraber I’m not able to copy the whole output from the “tryit” CLI, Chrome seems to only capture what’s in the window at any one point (despite trying to highlight the whole thing)

To recreate with two instances (A and B):

  1. lxc storage volume create default data (on instance A)

  2. lxc remote add for the other instance on each of A and B.

  3. lxc storage volume snapshot tryit:default data snapped (on instance B)

  4. lxc storage volume list tryit:default (on instance B)

+-------------------+------------------------------------------------------------------+-------------+---------+   
|       TYPE        |                               NAME                               | DESCRIPTION | USED BY |   
+-------------------+------------------------------------------------------------------+-------------+---------+   
| container         | centos                                                           |             | 1       |   
+-------------------+------------------------------------------------------------------+-------------+---------+   
| custom            | data                                                             |             | 0       |   
+-------------------+------------------------------------------------------------------+-------------+---------+   
| custom (snapshot) | data/snapped                                                     |             | 0       |   
+-------------------+------------------------------------------------------------------+-------------+---------+   
| image             | b3efc7ccf8aa33fdc5eb3b9b3a8bfa66d1f8c2d0455dd1a0cf376adcabacd54f |             | 1       |   
+-------------------+------------------------------------------------------------------+-------------+---------+  
  1. Copying the volume itself works… lxc storage volume copy tryit:default/data default/backed-up (on instance B)
Storage volume copied successfully!
  1. But copying the snapshot does not… lxc storage volume copy tryit:default/data/snapped default/backed-up-snapshot --debug (on instance B)

(Thomas Hipp) #10

Hi @DirectRoot,

thank you for discovering this bug. Our code simply ignores volume snapshots when copying volumes between remotes. That is indeed an issue. Our testsuite didn’t complain since we don’t seem to have tests for this yet. The bug is being tracked on LXD, and will be fixed soon.

—Thomas


(Chris Green) #11

@monstermunchkin - No problem Thomas, thanks for taking the time to confirm.

Chris.


(Thomas Hipp) #12

The issue should be fixed now as we have merged the PR.