mirror of https://github.com/cirruslabs/tart.git
Do not prune running VMs (#861)
Also prevent pushing of a running VM Fixes #860
This commit is contained in:
parent
679289d7ab
commit
ea5313698e
|
|
@ -33,6 +33,10 @@ struct Push: AsyncParsableCommand {
|
|||
func run() async throws {
|
||||
let ociStorage = VMStorageOCI()
|
||||
let localVMDir = try VMStorageHelper.open(localName)
|
||||
let lock = try localVMDir.lock()
|
||||
if try !lock.trylock() {
|
||||
throw RuntimeError.VMIsRunning(localName)
|
||||
}
|
||||
|
||||
// Parse remote names supplied by the user
|
||||
let remoteNames = try remoteNames.map{
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class VMStorageLocal: PrunableStorage {
|
|||
}
|
||||
|
||||
func prunables() throws -> [Prunable] {
|
||||
try list().map { (_, vmDir) in vmDir }
|
||||
try list().map { (_, vmDir) in vmDir }.filter { try !$0.running() }
|
||||
}
|
||||
|
||||
func hasVMsWithMACAddress(macAddress: String) throws -> Bool {
|
||||
|
|
|
|||
Loading…
Reference in New Issue