mirror of https://github.com/cirruslabs/tart.git
tart clone: make pruning limit configurable (#1126)
* tart clone: make pruning limit configurable * Fixed compilation
This commit is contained in:
parent
96c89ad76e
commit
02bf5651e7
|
|
@ -31,6 +31,9 @@ struct Clone: AsyncParsableCommand {
|
|||
@Flag(help: .hidden)
|
||||
var deduplicate: Bool = false
|
||||
|
||||
@Option(help: ArgumentHelp("limit automatic pruning to n gigabytes", valueName: "n"))
|
||||
var pruneLimit: UInt = 100
|
||||
|
||||
func validate() throws {
|
||||
if newName.contains("/") {
|
||||
throw ValidationError("<new-name> should be a local name")
|
||||
|
|
@ -77,7 +80,7 @@ struct Clone: AsyncParsableCommand {
|
|||
// So, once we clone the VM let's try to claim the rest of space for the VM to run without errors.
|
||||
let unallocatedBytes = try sourceVM.sizeBytes() - sourceVM.allocatedSizeBytes()
|
||||
// Avoid reclaiming an excessive amount of disk space.
|
||||
let reclaimBytes = min(unallocatedBytes, 100 * 1024 * 1024 * 1024)
|
||||
let reclaimBytes = min(unallocatedBytes, Int(pruneLimit) * 1024 * 1024 * 1024)
|
||||
if reclaimBytes > 0 {
|
||||
try Prune.reclaimIfNeeded(UInt64(reclaimBytes), sourceVM)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,6 +166,8 @@ Tart does have an analogue of Anka Controller for managing VMs across a cluster
|
|||
|
||||
In case there's not enough space to fit the newly pulled or cloned VM image, Tart will remove the least recently accessed VMs from OCI cache and `.ipsw` files from IPSW cache until enough free space is available.
|
||||
|
||||
The `tart clone` command limits this automatic pruning to 100 GB by default to avoid removing too many cached items. You can change this limit with the `--prune-limit` option (in gigabytes).
|
||||
|
||||
To disable this functionality, set the `TART_NO_AUTO_PRUNE` environment variable either globally:
|
||||
|
||||
```shell
|
||||
|
|
|
|||
Loading…
Reference in New Issue