diff --git a/README.md b/README.md index ce2cc13..01b0aaf 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,10 @@ Options: --api-token Api token format 'USER@REALM!TOKENID=UUID'. Require Proxmox VE 6.2 or later --username User name @ --password The password. Specify 'file:path_file' to store password in file. - --vmid The id or name VM/CT + --vmid The id or name VM + --proxy SPICE proxy server. This can be used by the client to specify the proxy server. + All nodes in a cluster runs 'spiceproxy', so it is up to the client to choose one. + By default, we return the node where the VM is currently running. --viewer Executable SPICE client remote viewer Commands: diff --git a/src/Corsinvest.ProxmoxVE.Pepper/Corsinvest.ProxmoxVE.Pepper.csproj b/src/Corsinvest.ProxmoxVE.Pepper/Corsinvest.ProxmoxVE.Pepper.csproj index a0b7304..7158068 100644 --- a/src/Corsinvest.ProxmoxVE.Pepper/Corsinvest.ProxmoxVE.Pepper.csproj +++ b/src/Corsinvest.ProxmoxVE.Pepper/Corsinvest.ProxmoxVE.Pepper.csproj @@ -1,7 +1,7 @@  Exe - 1.3.5 + 1.3.6 netcoreapp3.1 cv4pve-pepper Corsinvest Srl @@ -19,6 +19,6 @@ - + \ No newline at end of file diff --git a/src/Corsinvest.ProxmoxVE.Pepper/Program.cs b/src/Corsinvest.ProxmoxVE.Pepper/Program.cs index a8c9e32..d5a1de0 100644 --- a/src/Corsinvest.ProxmoxVE.Pepper/Program.cs +++ b/src/Corsinvest.ProxmoxVE.Pepper/Program.cs @@ -27,17 +27,29 @@ static int Main(string[] args) var optVmId = app.VmIdOrNameOption().DependOn(app, CommandOptionExtension.HOST_OPTION_NAME); + var optProxy = app.Option("--proxy", + @"SPICE proxy server. This can be used by the client to specify the proxy server." + + " All nodes in a cluster runs 'spiceproxy', so it is up to the client to choose one." + + " By default, we return the node where the VM is currently running.", + CommandOptionType.SingleValue); + var optRemoteViewer = app.Option("--viewer", "Executable SPICE client remote viewer", CommandOptionType.SingleValue) .DependOn(app, CommandOptionExtension.HOST_OPTION_NAME); optRemoteViewer.Accepts().ExistingFile(); + + app.OnExecute(() => { var fileName = Path.GetTempFileName().Replace(".tmp", ".vv"); var client = app.ClientTryLogin(); - var ret = SpiceHelper.CreateFileSpaceClient(client, optVmId.Value(), fileName); + + var ret = SpiceHelper.CreateFileSpaceClient(client, + optVmId.Value(), + optProxy.HasValue() ? optProxy.Value() : null, + fileName); if (ret) { @@ -78,7 +90,7 @@ static int Main(string[] args) } else { - if(!client.LastResult.IsSuccessStatusCode) + if (!client.LastResult.IsSuccessStatusCode) { app.Out.WriteLine($"Error: {client.LastResult.ReasonPhrase}"); }