8 #include <libvirt/libvirt.h>
11 virConnectPtr conn
= NULL
; /* the hypervisor connection */
13 int main(int argc
, char*argv
[]) {
17 /* NULL means connect to local Xen hypervisor */
18 conn
= virConnectOpenReadOnly(NULL
);
20 fprintf(stderr
, "Failed to connect to hypervisor\n");
24 unsigned long long required
= strtoul(argv
[1], (char **) NULL
, 10);
25 unsigned long long free
= virNodeGetFreeMemory(conn
);
27 printf("%f\n", (float)required
/ (float)free
);
30 printf("%lu\n", virNodeGetFreeMemory(conn
));
32 virDomainPtr domu
= virDomainLookupByName(conn
, "klant1_testdomein");
33 printf("%lu\n", virDomainGetMaxMemory(domu
));
36 virStoragePoolPtr pool
= virStoragePoolLookupByName(conn
, "netapp-nfs");
37 //virStorageVolPtr volume = virStorageVolLookupByName(pool, "klant1_test.qcow");
38 virStorageVolPtr volume
= virStorageVolLookupByName(pool
, "distro/gentoo.qcow");
41 printf("die bestaat niet!\n");
43 printf("%\n\n%s", virStorageVolGetKey(volume
), virStorageVolGetXMLDesc(volume
, 0));
45 virStoragePoolFree(pool
);
47 virConnectClose(conn
);