canonical / lxd

Powerful system container and virtual machine manager
https://canonical.com/lxd
GNU Affero General Public License v3.0
4.38k stars 931 forks source link

Implement support for `--compression` in `lxc export` #6284

Closed ghost closed 5 years ago

ghost commented 5 years ago

Required information

Issue description

Please add --compression off switch to the lxc export command

I export large images from my laptop to another computer on my local network. gzip puts a lot of load on the laptop CPU. I would prefer to have an option to switch off the compression since moving large images in a local network is not a problem.

stgraber commented 5 years ago

This should be implemented the same way things are done for lxc publish.

Note that a current workaround is to set backups.compression_algorithm as a global setting, if you set it to none then it won't compress.

ghost commented 5 years ago

thanks @stgraber I'll try to use workaround until the solution is implemented

ghost commented 5 years ago

hey @stgraber would something like this work? https://github.com/lxc/lxd/compare/master...srados:no-compression-backup

it's not finished but I wanted to see if this is the way to go.

ghost commented 5 years ago

oh, or shall I copy the lxc publish approach to maintain uniformity?

stgraber commented 5 years ago

I'd prefer it work the same way we've done for lxc publish.

stgraber commented 5 years ago

Assigning to you since you seem to have most of the pieces figured out already :)

stgraber commented 5 years ago

As far as how we usually split commits for this type of work, it'd look like:

Let me know if you need any help with this!

stgraber commented 5 years ago

Thanks!

ghost commented 5 years ago

I may ping you in order to find out how you test the changes, otherwise I think I'll be fine ;)

ghost commented 5 years ago

@stgraber shall I log backup_compression_algorithm to instances_backups table? If yes, where do I create migration to add new field to that table?

stgraber commented 5 years ago

No, we don't need to record the compression algorithm, we have logic to figure it out from the on-disk files.

ghost commented 5 years ago

is there an easy way to test my changes? I ran make and I have binaries, but I'm not sure how to set the whole system up

stgraber commented 5 years ago

If you're using the snap, you can move your locally built binaries to:

Then reload LXD with systemctl reload snap.lxd.daemon which will then have it start from the debug binaries.

ghost commented 5 years ago

Thanks for the tip...this would definitely help me stop programming in the dark :)

stgraber commented 5 years ago

Seems to be working well from a quick local test.

ghost commented 5 years ago

Great. Thanks for all the help and such an awesome project!

stgraber commented 5 years ago

Np, thanks for the contribution!