Page 1 of 1

Suggestion: Snapshot showvminfo ,Suggestion for sub parameters of [-- machineadable].

Posted: 30. Jun 2023, 10:32
by HaotongYang
VBoxManage showvminfo <uuid | vmname> [--machinereadable]
Contains the [-- machineadable] parameter;

however.
VBoxManage snapshot <uuid|vmname> showvminfo <snapshot-name>
There is no [-- machineadable]. It is unfriendly for third-party software to read this information.

Re: Suggestion: Snapshot showvminfo ,Suggestion for sub parameters of [-- machineadable].

Posted: 30. Jun 2023, 15:46
by mpack
I don't see it.

The former is a reporting function, hence the "machine readable" option for the report.

The latter is a command (verb), not a reporting function.

Re: Suggestion: Snapshot showvminfo ,Suggestion for sub parameters of [-- machineadable].

Posted: 30. Jun 2023, 17:36
by fth0
mpack wrote: 30. Jun 2023, 15:46 The latter is a command (verb), not a reporting function.
Sorry, but you're wrong here. Both commands give more or less the same information, just for different states of the VM, so the request is sensible IMHO.

Re: Suggestion: Snapshot showvminfo ,Suggestion for sub parameters of [-- machineadable].

Posted: 30. Jun 2023, 18:30
by mpack
Oh, I see. One shows info for the VM, the other shows info for a snapshot. I mostly stopped reading after "VBoxManage snapshot" since I considered that a verb.

So yes, I agree it's a sensible request. In fact I'd be kinda surprised if the same code wasn't responsible for rendering the same info in both cases. It seems so obvious that you'd just pass a pointer to an info struct.

Re: Suggestion: Snapshot showvminfo ,Suggestion for sub parameters of [-- machineadable].

Posted: 1. Jul 2023, 14:34
by scottgus1
This is an interesting suggestion!

However, the difference between regular output and machinereadable output do not look that different to me from a script-driven parsing standpoint. Machinereadable would be good for both regular and snapshot showvminfo's, but regular output is quite usable by itself.

In machinereadable, you'd split each line output of the command on the =, and the first part is the data type, the second is the data.

In "humanreadable", you'd split on the :, the first part is the data type. Trim the second part of leading spaces to get the data.

I don't see anything in either output that wouldn't be beyond typical VBscript string manipulation. Note that machinereadable still requires string manipulation, unless the programming language has a datatype=data reader built-in. And if VBscript can do it, it's likely any programming language could do it. (DOS batch files might be a little harder to do it in, but I suspect it could still be done on either output.)

Re: Suggestion: Snapshot showvminfo ,Suggestion for sub parameters of [-- machineadable].

Posted: 10. Jul 2023, 19:30
by HaotongYang
I understand, then I can only modify the third-party software code to achieve the purpose I want :shock: