Lxd: Implement support for `--compression` in `lxc export`

Created on 7 Oct 2019  路  17Comments  路  Source: lxc/lxd

Required information

  • Distribution: ubuntu
  • Distribution version: 19.10
  • The output of

    • lxc-start --version

      3.0.3

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.

Documentation Easy Feature

Most helpful comment

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.

All 17 comments

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.

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

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.

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

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

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

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

  • api: Add backup_compression_algorithm API extension

    • Adds that string to shared/version/api.go

    • Adds a description in doc/api-extensions.md

  • shared/api: Add CompressionAlgorithm to InstanceBackupsPost

    • Add the new field to InstanceBackupsPost in shared/api/instance_backup.go

    • The field should be added at the end of the struct, after a API extension: backup_compression_algorithm comment which is itself preceded by a line break (see image.go for examples).

  • lxd/backups: Add support for CompressionAlgorithm

    • The actual change to the creation logic

  • lxc/export: Add --compression option

    • The change to the client to set the option based on the command line argument

  • i18n: Update translation templates

    • As the previous commit changes translated strings, you need a commit that updates the translation templates. You can generate the content of this commit by running make i18n.

Let me know if you need any help with this!

Thanks!

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

@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?

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

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

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

  • /var/snap/lxd/common/lxd.debug
  • /var/snap/lxd/common/lxc.debug

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

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

Seems to be working well from a quick local test.

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

Np, thanks for the contribution!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

srkunze picture srkunze  路  3Comments

AndreiPashkin picture AndreiPashkin  路  5Comments

shaun-ba picture shaun-ba  路  3Comments

simos picture simos  路  3Comments

mt-caret picture mt-caret  路  3Comments