/// <summary> /// Persists the state of a running virtual machine and then stops it. This is /// equivalent to hibernation for a physical machine. /// </summary> /// <param name="machineName">The machine name.</param> public void SaveVm(string machineName) { if (isAdmin) { hypervClient.SaveVm(machineName: machineName); } else { var request = new GrpcSaveVmRequest(machineName: machineName); var reply = desktopService.SaveVmAsync(request).Result; reply.Error.EnsureSuccess(); } }
/// <inheritdoc/> public async Task <GrpcBaseReply> SaveVmAsync(GrpcSaveVmRequest request, CallContext context = default) { await SyncContext.Clear; try { hyperv.SaveVm(machineName: request.MachineName); return(new GrpcBaseReply()); } catch (Exception e) { return(new GrpcBaseReply(e)); } }