remote: add mount support tools command
This commit is contained in:
parent
da9c5c4ae9
commit
e6653fd7a0
|
@ -1295,7 +1295,7 @@ class UTMRemoteData: UTMData {
|
|||
}
|
||||
|
||||
override func mountSupportTools(for vm: any UTMVirtualMachine) async throws {
|
||||
throw UTMDataError.notImplemented
|
||||
try await remoteClient.server.mountGuestToolsOnVirtualMachine(id: vm.id)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -400,6 +400,10 @@ extension UTMRemoteClient {
|
|||
try await _deletePackageFile(parameters: .init(id: id, relativePathComponents: relativePathComponents))
|
||||
}
|
||||
|
||||
func mountGuestToolsOnVirtualMachine(id: UUID) async throws {
|
||||
try await _mountGuestToolsOnVirtualMachine(parameters: .init(id: id))
|
||||
}
|
||||
|
||||
func startVirtualMachine(id: UUID, options: UTMVirtualMachineStartOptions) async throws -> UTMRemoteMessageServer.StartVirtualMachine.ServerInformation {
|
||||
return try await _startVirtualMachine(parameters: .init(id: id, options: options)).serverInfo
|
||||
}
|
||||
|
@ -485,6 +489,11 @@ extension UTMRemoteClient {
|
|||
try await M.DeletePackageFile.send(parameters, to: peer)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
private func _mountGuestToolsOnVirtualMachine(parameters: M.MountGuestToolsOnVirtualMachine.Request) async throws -> M.MountGuestToolsOnVirtualMachine.Reply {
|
||||
try await M.MountGuestToolsOnVirtualMachine.send(parameters, to: peer)
|
||||
}
|
||||
|
||||
private func _startVirtualMachine(parameters: M.StartVirtualMachine.Request) async throws -> M.StartVirtualMachine.Reply {
|
||||
try await M.StartVirtualMachine.send(parameters, to: peer)
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ enum UTMRemoteMessageServer: UInt8, MessageID {
|
|||
case getPackageFile
|
||||
case sendPackageFile
|
||||
case deletePackageFile
|
||||
case mountGuestToolsOnVirtualMachine
|
||||
case startVirtualMachine
|
||||
case stopVirtualMachine
|
||||
case restartVirtualMachine
|
||||
|
@ -174,6 +175,16 @@ extension UTMRemoteMessageServer {
|
|||
struct Reply: Serializable, Codable {}
|
||||
}
|
||||
|
||||
struct MountGuestToolsOnVirtualMachine: Message {
|
||||
static let id = UTMRemoteMessageServer.mountGuestToolsOnVirtualMachine
|
||||
|
||||
struct Request: Serializable, Codable {
|
||||
let id: UUID
|
||||
}
|
||||
|
||||
struct Reply: Serializable, Codable {}
|
||||
}
|
||||
|
||||
struct StartVirtualMachine: Message {
|
||||
static let id = UTMRemoteMessageServer.startVirtualMachine
|
||||
|
||||
|
|
|
@ -622,6 +622,8 @@ extension UTMRemoteServer {
|
|||
return try await _sendPackageFile(parameters: .decode(data)).encode()
|
||||
case .deletePackageFile:
|
||||
return try await _deletePackageFile(parameters: .decode(data)).encode()
|
||||
case .mountGuestToolsOnVirtualMachine:
|
||||
return try await _mountGuestToolsOnVirtualMachine(parameters: .decode(data)).encode()
|
||||
case .startVirtualMachine:
|
||||
return try await _startVirtualMachine(parameters: .decode(data)).encode()
|
||||
case .stopVirtualMachine:
|
||||
|
@ -774,6 +776,14 @@ extension UTMRemoteServer {
|
|||
return .init()
|
||||
}
|
||||
|
||||
private func _mountGuestToolsOnVirtualMachine(parameters: M.MountGuestToolsOnVirtualMachine.Request) async throws -> M.MountGuestToolsOnVirtualMachine.Reply {
|
||||
let vm = try await findVM(withId: parameters.id)
|
||||
if let wrapped = await vm.wrapped {
|
||||
try await data.mountSupportTools(for: wrapped)
|
||||
}
|
||||
return .init()
|
||||
}
|
||||
|
||||
private func _startVirtualMachine(parameters: M.StartVirtualMachine.Request) async throws -> M.StartVirtualMachine.Reply {
|
||||
let vm = try await findVM(withId: parameters.id)
|
||||
let serverInfo = try await data.startRemote(vm: vm, options: parameters.options, forClient: client)
|
||||
|
|
Loading…
Reference in New Issue