kamzar1
(Dauerurlaub)
February 22, 2021, 7:12am
1
lxd v. 4.11
zfs
POST
/1.0/instances//X6/backups
{
“name”: “backupName2”,
“expiry”: 3600, // tried 1d, 1m as well
“volume_only”: true,
“optimized_storage”: true // also tried false, though it probabely doesnt relate
}
---------------------------------- RESULT --------------------------------------
Array
(
[health] => Array
(
[type] => async
[status_code] => 100
[status] => Operation created
[error_code] => 0
[error] =>
)
[meta] => Array
(
[id] => d85b43fb-9785-4af8-9aef-78328ef523c3
[class] => task
[description] => Backing up instance
[created_at] => 2021-02-22T07:44:11.092645029+01:00
[updated_at] => 2021-02-22T07:44:11.092645029+01:00
[status] => Running
[status_code] => 103
[resources] => Array
(
[backups] => Array
(
[0] => /1.0/backups/backupName2
)
[containers] => Array
(
[0] => /1.0/containers/X6
)
[instances] => Array
(
[0] => /1.0/instances/X6
)
)
[metadata] =>
[may_cancel] =>
[err] =>
[location] => none
)
)
GET
/1.0/instances/X6/backups/backupName2?project=101
[1] => Array
(
[name] => backupName2
[created_at] => 2021-02-22T07:44:11+01:00
[expires_at] => 0001-01-01T00:09:21+00:09
[instance_only] =>
[container_only] =>
[optimized_storage] => 1
)
kamzar1
(Dauerurlaub)
February 22, 2021, 8:03am
2
It has worked by replacing 'expiry" through “expires_at with real time value”
{
"name": "bk1",
"expires_at": "2021-02-23T08:52:35.357627613+01:00",
"instance_only": true,
"container_only": true,
"optimized_storage": false,
"compression_algorithm": "xz"
}
BTW, the “compression_algorithm” can be passed as well, which not mentioned in api docs.
What does expiry achieve anyway? Is it deleting the backup tarball file? Or just removing the db entry?
tomp
(Thomas Parrott)
February 22, 2021, 9:18am
3
It looks like the docs are out of sync with the API (one of the reasons we are working on auto generating the API docs by the way):
See
lxc:master
← monstermunchkin:fixes/backup
opened 12:35PM - 08 Oct 19 UTC
lxc:master
← srados:issues/6284
opened 08:54PM - 08 Oct 19 UTC
The auto expiry will remove the backup from the host’s filesystem as well as the DB entry.
If the backup has been exported before that to another file then that file will still remain.
I’ll send a PR to fix the docs.
tomp
(Thomas Parrott)
February 22, 2021, 9:19am
4
BTW, the current API structures are in here:
So the current instance backup structures are here:
package api
import "time"
// InstanceBackupsPost represents the fields available for a new LXD instance backup.
//
// API extension: instances
type InstanceBackupsPost struct {
Name string `json:"name" yaml:"name"`
ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`
InstanceOnly bool `json:"instance_only" yaml:"instance_only"`
ContainerOnly bool `json:"container_only" yaml:"container_only"` // Deprecated, use InstanceOnly.
OptimizedStorage bool `json:"optimized_storage" yaml:"optimized_storage"`
// API extension: backup_compression_algorithm
CompressionAlgorithm string `json:"compression_algorithm" yaml:"compression_algorithm"`
}
// InstanceBackup represents a LXD instance backup.
//
This file has been truncated. show original
kamzar1
(Dauerurlaub)
February 22, 2021, 10:16am
6
Thanks Thomas for super fast reaction.