Getting a VZVirtualMachine for a running virtualmachine

Viewed 147

I would like to write a thin wrapper around the Virtualization framework that offers docker style commands to start and stop virtual machines. One hurdle I found is the inability to create VZVirtualMachineConfiguration and VZVirtualMachine that refers to an already running machine.

So, if I want to use my cli tool like this:

# creates VZVirtualMachineConfiguration, VZVirtualMachine, starts VM and detaches process
vm-cli run --assorted-vm-parameters
vm-cli stop
# recreate VZVirtualMachineConfiguration with same hardwareidentifier,
# macmachineidentifier and VZVirtualMachine now refer to new virtual machine that is stopped

Is there a way to control a virtual machine of antoher process without having to write a daemon that maintains a list of created virtual machines?

0 Answers
Related