[libvirt] Web Interface -> LibVirt Communication?

Michael March mmarch at gmail.com
Wed Jul 9 13:57:11 UTC 2008


This might not be the 'right way' but here is how I handled 
communication to each Xen instance my web interface is managing. I used 
the ssh style connect string.. even if it was a local instance.. here is 
a line ripped right from my code:

server_list={"michael":['127.0.0.1',""], "tito":['192.168.101.5',""], 
"jermaine":['192.168.101.6',""}

.. then later in my code...

for server in server_list:
    server_list[server][1] = 
libvirt.open('xen+ssh://root@'+server_list[server][0]+'/')
    if server_list[server][1] == None:
        print 'Failed to open connection to the hypervisor'
        sys.exit(1)

.. in this setup you MUST have the ssh public key of the user the web 
server runs as in the 'root' account of each server it manages.. again, 
this might not be 100% kosher.. but it works.
> Hi,
>
> I want to write a web tool that lets me administer my cluster from one 
> location (including operations that things like virt-manager don't 
> provide) - what's the proper way of achieving this? Can i communicate 
> over TCP with libvirt on each server (is this documented?) or should I 
> be trying to get my web app to auth and run virsh commands over SSH?
>
> Thanks.




More information about the libvir-list mailing list