Python listDefinedDomains broken?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone,

please, don't roast me if I'm asking stupid things or fail to provide info, since I'm a freshman, using libvirt.

I have two servers, both running the following versions:

Compiled against library: libvirt 1.3.1
Using library: libvirt 1.3.1
Using API: QEMU 1.3.1
Running hypervisor: QEMU 0.14.0

I'm trying to create a Python program, which gets a list of all defined domains for each host and give a list for domains only defined on one of these hosts. This Python script is running on a third host (my workstation), using these versions:

Python: 3.5.1
libvirt-python: 1.3.1

When I'm running virsh on my workstation (version 1.3.1), like this:

virsh -c "qemu+ssh://root@host1/system?keyfile=/home/user/.ssh/id_rsa_libvirt" --readonly list --all

Then a domain named "winxp_ausgeschaltet" is within that list:


 Id    Name                           State
----------------------------------------------------
...
 -     winxp_ausgeschaltet            shut off


When I do the same for the second host, it is also in that list:


 Id    Name                           State
----------------------------------------------------
...
 7     winxp_ausgeschaltet            running


When I do the following in Python, this domain is listed for the first host (where it's state is "shut off"), but not for the second one:


import libvirt
import sys

class kvmhost:
    def __init__(self, host, keyfile):
        self.conn = self.connect_kvm(host, keyfile)
        self.doms = sorted(self.get_doms())
    def connect_kvm(self, host, keyfile):
        try:
conn = libvirt.openReadOnly('qemu+ssh://root@' + host + '/system?keyfile=' + keyfile)
        except libvirt.libvirtError as lve:
            print('Error: ' + str(lve))
            sys.exit(1)
        return conn
    def get_doms(self):
        try:
            alldoms = self.conn.listDefinedDomains()
        except libvirt.libvirtError as lve:
            print('Error: ' + str(lve))
            self.conn.close()
            sys.exit(1)
        return alldoms

host1 = kvmhost('host1', '/path/to/ssh_keyfile')
host2 = kvmhost('host2', '/path/to/ssh_keyfile')

print(host1.doms)
print(host2.doms)


What am I doing wrong here or: is there a missbehavior in libvirt or the python module?

Using listAllDomains instead of listDefinedDomains gives:

libvirt: Remote Driver error : unknown procedure: 273

What is the difference between listAllDomains and listDefinedDomains at all?

Thanks for your help.

Marc

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]