diff options
author | Peter Krempa <pkrempa@redhat.com> | 2012-06-11 11:04:57 +0200 |
---|---|---|
committer | Peter Krempa <pkrempa@redhat.com> | 2012-06-20 13:35:26 +0200 |
commit | 33dc8cf018e41c0e973a4a46a108d5ff30cbbf49 (patch) | |
tree | dd42c41231145a6cfe755afdbe5dfd8e38e5d89c /src/libxl | |
parent | openvz: check pointer size instead of int (diff) | |
download | libvirt-33dc8cf018e41c0e973a4a46a108d5ff30cbbf49.tar.gz libvirt-33dc8cf018e41c0e973a4a46a108d5ff30cbbf49.tar.bz2 libvirt-33dc8cf018e41c0e973a4a46a108d5ff30cbbf49.zip |
drivers: Implement virListAllDomains for drivers using virDomainObj
This patch adds support for listing all domains into drivers that use
the common virDomainObj implementation: libxl, lxc, openvz, qemu, test,
uml, vmware.
For drivers that don't support managed save images the guests are
treated as if they had none, so filtering guests that do have such an
image on this driver succeeds and produces 0 results.
Diffstat (limited to 'src/libxl')
-rw-r--r-- | src/libxl/libxl_driver.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 0520ce988..4d1db3aad 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -45,6 +45,7 @@ #include "xen_xm.h" #include "virtypedparam.h" #include "viruri.h" +#include "virdomainlist.h" #define VIR_FROM_THIS VIR_FROM_LIBXL @@ -3858,6 +3859,24 @@ libxlIsAlive(virConnectPtr conn ATTRIBUTE_UNUSED) return 1; } +static int +libxlListAllDomains(virConnectPtr conn, + virDomainPtr **domains, + unsigned int flags) +{ + libxlDriverPrivatePtr driver = conn->privateData; + int ret = -1; + + virCheckFlags(VIR_CONNECT_LIST_FILTERS_ALL, -1); + + libxlDriverLock(driver); + ret = virDomainList(conn, driver->domains.objs, domains, flags); + libxlDriverUnlock(driver); + + return ret; +} + + static virDriver libxlDriver = { .no = VIR_DRV_LIBXL, @@ -3872,6 +3891,7 @@ static virDriver libxlDriver = { .getCapabilities = libxlGetCapabilities, /* 0.9.0 */ .listDomains = libxlListDomains, /* 0.9.0 */ .numOfDomains = libxlNumDomains, /* 0.9.0 */ + .listAllDomains = libxlListAllDomains, /* 0.9.13 */ .domainCreateXML = libxlDomainCreateXML, /* 0.9.0 */ .domainLookupByID = libxlDomainLookupByID, /* 0.9.0 */ .domainLookupByUUID = libxlDomainLookupByUUID, /* 0.9.0 */ |