VM grouping done via VBoxManage is not refreshed in UI

This is for discussing general topics about how to use VirtualBox.
Post Reply
JannisSEA
Posts: 25
Joined: 7. Oct 2013, 14:41

VM grouping done via VBoxManage is not refreshed in UI

Post by JannisSEA »

Hi, I'm using VirtualBox 6.1.34 for a CI system on Ubuntu amd64. We have some "Base VMs" that are in a "Base VMs" group and our CI server automatically creates linked clones, puts them into a "Dynamic VMs" group and starts them (all via VBoxManage). When I watch the process using the VirtualBox GUI, I can see that the VMs are being cloned and started. However, the dynamic VMs appear in the "Base VMs" group on the UI. When I close the UI and open it right again, the grouping is displayed correctly. That indicates that the group move actually works and I'm not doing anything wrong. However, the UI auto-refresh doesn't seem to work properly.
Can anyone confirm this behaviour? Thanks :)
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: VM grouping done via VBoxManage is not refreshed in UI

Post by scottgus1 »

One of us can try to test this, but it would be good if we could see your clone & group script, to see how you're doing this process.
JannisSEA
Posts: 25
Joined: 7. Oct 2013, 14:41

Re: VM grouping done via VBoxManage is not refreshed in UI

Post by JannisSEA »

Sure, those are the scripts that we are using on the CI. They are used in Jenkins "Scripted Pipelines", so it's Groovy language. In the past, I tried the "--groups"-parameter to the "clonevm" command but since it didn't work according to the UI, I tried with a separate command:

Code: Select all

@NonCPS
def cloneVmLinked(sourceVmName, sourceSnapshotName, destVmName) {
	echo "Trying to create a linked clone of existing VM \"${sourceVmName}\", snapshot \"${sourceSnapshotName}\" as \"${destVmName}\" ...";
	def stdout = new StringBuilder();
	def stderr = new StringBuilder();
	def proc = "sudo -u vbox VBoxManage clonevm ${sourceVmName} --name=${destVmName} --options=Link --register --snapshot=${sourceSnapshotName}".execute();
	proc.consumeProcessOutput(stdout, stderr);
	proc.waitForOrKill(20000);
	println "stdout:\n$stdout\nstderr:\n$stderr";

	def proc2 = "sudo -u vbox VBoxManage modifyvm ${destVmName} --groups=/DynamicVMs".execute();
	proc2.consumeProcessOutput(stdout, stderr);
	proc2.waitForOrKill(20000);
	println "stdout:\n$stdout\nstderr:\n$stderr";

	// TODO: stdout and stderr checking, return value?
}
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: VM grouping done via VBoxManage is not refreshed in UI

Post by scottgus1 »

Thanks for the commands! Will try this when I get a moment.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: VM grouping done via VBoxManage is not refreshed in UI

Post by scottgus1 »

OK, just tried it and got the same thing. The VM switched groups but the main Virtualbox window did not show the change. My commands were not run under extended privileges (Windows host, Run As Admin) just in a standard command prompt.

Where the group "DynamicVMs" previously exists and the main Virtualbox window is open:
vboxmanage clonevm DOS2 --name=DOS2clone --options=Link --register --snapshot=BaseSnap
vboxmanage modifyvm DOS2clone --groups=/DynamicVMs

makes the clone and edits the Groups tag in the VM's .vbox file, but the VM in the list does not switch the group it is displayed in until the main window is closed then reopened.

A ticket on the Bugtracker with a link back to this topic would be a good idea.
JannisSEA
Posts: 25
Joined: 7. Oct 2013, 14:41

Re: VM grouping done via VBoxManage is not refreshed in UI

Post by JannisSEA »

Thanks for confirming the issue :)
Ticket created: https://www.virtualbox.org/ticket/20933
Post Reply