From 8375e3cf7a137ae48da308ee031c8b3e7e7b931a Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Mon, 14 Feb 2022 16:57:54 +0300 Subject: [PATCH] =?UTF-8?q?{cpuCount,memorySize}min=20=E2=86=92=20{cpuCoun?= =?UTF-8?q?t,memorySize}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/tart/VM.swift | 12 ++++++------ Sources/tart/VMConfig.swift | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Sources/tart/VM.swift b/Sources/tart/VM.swift index 5016288..bb50cc8 100644 --- a/Sources/tart/VM.swift +++ b/Sources/tart/VM.swift @@ -24,8 +24,8 @@ class VM: NSObject, VZVirtualMachineDelegate, ObservableObject { ecid: vmConfig.ecid, auxStorage: auxStorage, hardwareModel: vmConfig.hardwareModel, - cpuCount: vmConfig.cpuCountMin, - memorySize: vmConfig.memorySizeMin + cpuCount: vmConfig.cpuCount, + memorySize: vmConfig.memorySize ) self.virtualMachine = VZVirtualMachine(configuration: configuration) @@ -68,8 +68,8 @@ class VM: NSObject, VZVirtualMachineDelegate, ObservableObject { // Create config self.vmConfig = VMConfig( hardwareModel: requirements.hardwareModel, - cpuCountMin: requirements.minimumSupportedCPUCount, - memorySizeMin: requirements.minimumSupportedMemorySize + cpuCount: requirements.minimumSupportedCPUCount, + memorySize: requirements.minimumSupportedMemorySize ) try self.vmConfig.save(toURL: vmDir.configURL) @@ -79,8 +79,8 @@ class VM: NSObject, VZVirtualMachineDelegate, ObservableObject { ecid: self.vmConfig.ecid, auxStorage: auxStorage, hardwareModel: requirements.hardwareModel, - cpuCount: self.vmConfig.cpuCountMin, - memorySize: self.vmConfig.memorySizeMin + cpuCount: self.vmConfig.cpuCount, + memorySize: self.vmConfig.memorySize ) self.virtualMachine = VZVirtualMachine(configuration: configuration) diff --git a/Sources/tart/VMConfig.swift b/Sources/tart/VMConfig.swift index 26cb6eb..a1cef27 100644 --- a/Sources/tart/VMConfig.swift +++ b/Sources/tart/VMConfig.swift @@ -4,22 +4,22 @@ enum CodingKeys: String, CodingKey { case version case ecid case hardwareModel - case cpuCountMin - case memorySizeMin + case cpuCount + case memorySize } struct VMConfig: Encodable, Decodable { var version: Int = 0 var ecid: VZMacMachineIdentifier var hardwareModel: VZMacHardwareModel - var cpuCountMin: Int - var memorySizeMin: UInt64 + var cpuCount: Int + var memorySize: UInt64 - init(ecid: VZMacMachineIdentifier = VZMacMachineIdentifier(), hardwareModel: VZMacHardwareModel, cpuCountMin: Int, memorySizeMin: UInt64) { + init(ecid: VZMacMachineIdentifier = VZMacMachineIdentifier(), hardwareModel: VZMacHardwareModel, cpuCount: Int, memorySize: UInt64) { self.ecid = ecid self.hardwareModel = hardwareModel - self.cpuCountMin = cpuCountMin - self.memorySizeMin = memorySizeMin + self.cpuCount = cpuCount + self.memorySize = memorySize } init(fromURL: URL) throws { @@ -60,9 +60,9 @@ struct VMConfig: Encodable, Decodable { } self.hardwareModel = hardwareModel - self.cpuCountMin = try container.decode(Int.self, forKey: .cpuCountMin) + self.cpuCount = try container.decode(Int.self, forKey: .cpuCount) - self.memorySizeMin = try container.decode(UInt64.self, forKey: .memorySizeMin) + self.memorySize = try container.decode(UInt64.self, forKey: .memorySize) } func encode(to encoder: Encoder) throws { @@ -71,7 +71,7 @@ struct VMConfig: Encodable, Decodable { try container.encode(self.version, forKey: .version) try container.encode(self.ecid.dataRepresentation.base64EncodedString(), forKey: .ecid) try container.encode(self.hardwareModel.dataRepresentation.base64EncodedString(), forKey: .hardwareModel) - try container.encode(self.cpuCountMin, forKey: .cpuCountMin) - try container.encode(self.memorySizeMin, forKey: .memorySizeMin) + try container.encode(self.cpuCount, forKey: .cpuCount) + try container.encode(self.memorySize, forKey: .memorySize) } }