mirror of https://github.com/cirruslabs/tart.git
{cpuCount,memorySize}min → {cpuCount,memorySize}
This commit is contained in:
parent
6fc868e3ba
commit
8375e3cf7a
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue