simulating multiple hypervisors with the test driver

Hello, I'm working on a python application that will manage multiple remote libvirt hypervisors. I've been using the test:///default uri for single-hypervisor tests, and it works great. I'd like to simulate connecting to two different remote hypervisors, however, in my testing so far it appears that multiple connections to the test:///default uri just look like different connections to the same hypervisor. Here's what I tried : conn_one = libvirt.open('test:///default') <build and start some domains> one_vms = conn_one.listAllDomains(0) for x in one_vms: print(f"The vm in set one is {x.name()}") <get list of all the domains I just built> conn_two = libvirt.open('test:///default') <build and start some different domains> two_vms = conn_two.listAllDomains(0) for z in two_vms: print(f"The vm in set one is {z.name()}") <get list of ALL domains including those created with conn_one, not just those created using the conn_two instance> What I would like is to be able to spin up two completely independent instances of the test driver so that it can simulate two different hypervisors/instances of libvirtd. Is that possible? Thanks, Tom -- ----------------------------------------------------------------------------- Tom Ammon M: (737) 400-9042 thomasammon@gmail.com -----------------------------------------------------------------------------

On Mon, Jan 03, 2022 at 09:06:35PM -0600, Tom Ammon wrote:
Hello,
I'm working on a python application that will manage multiple remote libvirt hypervisors. I've been using the test:///default uri for single-hypervisor tests, and it works great.
I'd like to simulate connecting to two different remote hypervisors, however, in my testing so far it appears that multiple connections to the test:///default uri just look like different connections to the same hypervisor. Here's what I tried :
Yes, the test:///default URI is shared process-global state.
What I would like is to be able to spin up two completely independent instances of the test driver so that it can simulate two different hypervisors/instances of libvirtd.
Pass in a path to a custom XML file for the connection eg: test:///path/to/checkout/of/libvirt.git/examples/xml/test/testnode.xml every instance of a file base URL will be unique. See this example file for guidance on how to write the XML to pre-populate arbitrary resources Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

Daniel, That got me up and running quickly. The examples were easy to follow, all I had to do was read a couple of the xml documents to figure out how to get what I was after. Thank you, and the rest of the people working on the project, for all the effort you've put into libvirt! Tom On Tue, Jan 4, 2022 at 4:56 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
On Mon, Jan 03, 2022 at 09:06:35PM -0600, Tom Ammon wrote:
Hello,
I'm working on a python application that will manage multiple remote libvirt hypervisors. I've been using the test:///default uri for single-hypervisor tests, and it works great.
I'd like to simulate connecting to two different remote hypervisors, however, in my testing so far it appears that multiple connections to the test:///default uri just look like different connections to the same hypervisor. Here's what I tried :
Yes, the test:///default URI is shared process-global state.
What I would like is to be able to spin up two completely independent instances of the test driver so that it can simulate two different hypervisors/instances of libvirtd.
Pass in a path to a custom XML file for the connection
eg:
test:///path/to/checkout/of/libvirt.git/examples/xml/test/testnode.xml
every instance of a file base URL will be unique. See this example file for guidance on how to write the XML to pre-populate arbitrary resources
Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
-- ----------------------------------------------------------------------------- Tom Ammon M: (737) 400-9042 thomasammon@gmail.com -----------------------------------------------------------------------------
participants (2)
-
Daniel P. Berrangé
-
Tom Ammon