[libvirt] FW: CPU Usage and Memory Usage for VM and Host
by Kumar R, Prashanth (Prashanth)
Hi All,
I would like to know if there is a way to fetch the "CPU Usage and Memory Usage for VM " and CPU Usage and Memory Usage for a Host in the KVM environment using libvirt java sdk .
I am using libvirt-0.5.1.jar.
This is the maximum Information I could fetch using the libvirt java API.:
________________________________
vmname:flow-cluster1
state:VIR_DOMAIN_RUNNING
ostype:hvm
guest id :8f0b96e5-1e08-40ce-aea1-9985d80fcabb
Max memory : 8388608
Max cpus : 4
Guest Info-cputime: 58930890000000
Guest Info-maxMem: 8388608
Guest Info-memory: 8388608
Guest Info-nrVirtCpu: 4
MemoryStatistic: 8388608
Autostart :false
________________________________
I tried looking into the libvirt java sdk but did not find any methods to fetch the exact CPU Usage percentage and Memory Usage percentage for a VM and Host.
Can you please provide me with the java example if possible.
Thanks,
Prashanth R
9 years, 5 months
[libvirt] [libvirt-sandbox][PATCH] configure: Require newer libvirt-glib
by Michal Privoznik
In the commit 68406aff new feature was introduced - users are allowed
to select the format of mounted host images. However, this uses some
libvirt-glib features that were introduced in the 0.2.1 release, e.g.
the symbol GVIR_CONFIG_DOMAIN_FILESYS_DRIVER_LOOP was introduced in
dbd063fe. So we must update the minimal required version of
libvirt-glib. At the same time, update it in the spec file too.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
configure.ac | 2 +-
libvirt-sandbox.spec.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index ba5247a..9e88da0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,7 +13,7 @@ AM_SILENT_RULES([yes])
GIO_UNIX_REQUIRED=2.28.0
GOBJECT_REQUIRED=2.32.0
LIBVIRT_REQUIRED=1.0.2
-LIBVIRT_GCONFIG_REQUIRED=0.1.8
+LIBVIRT_GCONFIG_REQUIRED=0.2.1
LIBVIRT_GLIB_REQUIRED=0.1.7
LIBVIRT_GOBJECT_REQUIRED=0.1.7
GOBJECT_INTROSPECTION_REQUIRED=0.10.8
diff --git a/libvirt-sandbox.spec.in b/libvirt-sandbox.spec.in
index 7deadb2..bd7b0dd 100644
--- a/libvirt-sandbox.spec.in
+++ b/libvirt-sandbox.spec.in
@@ -20,7 +20,7 @@ License: LGPLv2+
URL: http://libvirt.org/
Source0: ftp://libvirt.org/libvirt/sandbox/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: libvirt-gobject-devel >= 0.1.7
+BuildRequires: libvirt-gobject-devel >= 0.2.1
BuildRequires: gobject-introspection-devel
BuildRequires: glibc-static
BuildRequires: /usr/bin/pod2man
--
2.3.6
9 years, 5 months
[libvirt] libvirt proxy
by Vasiliy Tolstov
Hello. I need libvirt proxy, but not simple proxy connection, but
something like dedicated libvirt server, that can modify requests or
doing something based on incoming request.
I'm use go for this, i'm already parse xdr data, but i'm stuck at
payload. Where i can find payloads examples or how can i determine
needed payload for specific procedure ? (now i'm use wireshark with
libvirt dissector).
I don't need to provide all libvirt functions, now i need very basic
sets like open/close, list, create , destroy domains..
--
Vasiliy Tolstov,
e-mail: v.tolstov(a)selfip.ru
9 years, 5 months
[libvirt] incorrect memory size inside vm
by Vasiliy Tolstov
Hi. I have issue with incorrect memory side inside vm. I'm try utilize
memory balloon (not memory hotplug, because i have guest without
memory hotplug (may be)).
When domain started with static memory all works fine, but then i'm
specify in libvirt
memory = 16384 , maxMemory = 16384 and currentMemory = 1024, guest in
f/rpoc/meminfo says that have only 603608 Kb memory. Then i set memory
via virsh setmem to 2Gb, guest see only 1652184 Kb memory.
software versions
libvirt: 1.2.10
qemu: 2.3.0
Guest OS: centos 6.
qemu.log:
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/root USER=root LOGNAME=root QEMU_AUDIO_DRV=none /usr/bin/kvm
-name 26543 -S -machine pc-i440fx-1.7,accel=kvm,usb=off -m 1024
-realtime mlock=off -smp 1,maxcpus=4,sockets=4,cores=1,threads=1 -uuid
4521fb01-c2ca-4269-d2d6-0000035fd910 -no-user-config -nodefaults
-chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/26543.monitor,server,nowait
-mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc
-no-shutdown -boot strict=on -device
piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device
virtio-scsi-pci,id=scsi0,num_queues=1,bus=pci.0,addr=0x4 -device
virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -drive
file=/dev/vg4/26543,if=none,id=drive-scsi0-0-0-0,format=raw,cache=none,discard=unmap,aio=native,iops=5000
-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1
-drive if=none,id=drive-scsi0-0-1-0,readonly=on,format=raw -device
scsi-cd,bus=scsi0.0,channel=0,scsi-id=1,lun=0,drive=drive-scsi0-0-1-0,id=scsi0-0-1-0
-netdev tap,fd=30,id=hostnet0,vhost=on,vhostfd=52 -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:00:34:f7,bus=pci.0,addr=0x3,rombar=0
-chardev pty,id=charserial0 -device
isa-serial,chardev=charserial0,id=serial0 -chardev
socket,id=charchannel0,path=/var/lib/libvirt/qemu/26543.agent,server,nowait
-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0
-device usb-mouse,id=input0 -device usb-kbd,id=input1 -vnc
[::]:8,password -device VGA,id=video0,bus=pci.0,addr=0x2 -device
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -object
rng-random,id=rng0,filename=/dev/random -device
virtio-rng-pci,rng=rng0,max-bytes=1024,period=2000,bus=pci.0,addr=0x7
-msg timestamp=on
--
Vasiliy Tolstov,
e-mail: v.tolstov(a)selfip.ru
9 years, 5 months
[libvirt] cloud-init integration
by Tobias Florek
Hi,
if that has been discussed before, please point me to it. I have not
been able to find anything about it.
It would be great to easily generate and cd-attach cloud-init isos when
starting a vm. The config files could be taken from the file system
(e.g. %sysconfdir/cloud-init/host-name) and put into an iso. when the
host stops the generated iso should be removed.
What do you think? If that's a worthwhile cause, I would be glad to
start to implement it, if pointers are given. My C i a little rusty
unfortunately.
Thank you for your consideration,
Tobias Florek
9 years, 5 months
[libvirt] Socket files in virt-aa-helper
by Michał Dubiel
Hi guys,
I have got a question. I need to add apparmor support for vhost-user socket
files used to communicate with the vhost-user server app. Those ones
defined with something like:
<interface type='vhostuser'>
<mac address='02:ed:f3:5d:de:f3'/>
<source type='unix' path='/var/run/vrouter/uvh_vif_tapa8396c51-2a'
mode='client'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03'
function='0x0'/>
</interface>
I added something like this into get_files() function in virt-aa-helper.c:
for (i = 0; i < ctl->def->nnets; i++) {
if (ctl->def->nets[i] &&
ctl->def->nets[i]->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&
ctl->def->nets[i]->data.vhostuser) {
virDomainChrSourceDefPtr vhu =
ctl->def->nets[i]->data.vhostuser;
if (vah_add_file_chardev(&buf, vhu->data.nix.path, "rw",
vhu->type) != 0)
goto cleanup;
}
}
However, there is a restriction for the socket file types in valid_path()
function:
switch (sb.st_mode & S_IFMT) {
case S_IFSOCK:
return 1;
break;
default:
break;
}
That prevents this from working.
May I ask why the socket file types are restricted? Vhost-user uses sockets
so if I want to use apparmor virt-aa-helper has to be able to add the line
for the socket file into /etc/apparmor.d/libvirt/libvirt-UUID.files.
Regards,
Michal
9 years, 5 months
[libvirt] [PATCH 0/4] A cople of memleak fixes
by Michal Privoznik
One thing that I still haven't figured out is, when the daemon is waiting in
the even loop, in poll() and SIGINT comes, it jumps out and cleanup phase
begins. However, the event loop may still be the one and only holding a
reference to some objects, so we kind of want it to at least remove stale
handlers. Well, they will be deleted after the cleanup work in the daemon is
done. Yeah, messy and probably not worth breaking up the code into smaller
pieces just to cleanup deleted handles.
Michal Privoznik (4):
daemonSetupNetworking: Don't leak services
virNetSocketRemoveIOCallback: Be explicit about unref
virNetSocket: Fix @watch corner case
virNetServerServiceClose: Don't leak sockets
daemon/libvirtd.c | 47 ++++++++++++++++++++++---------------------
src/rpc/virnetserverservice.c | 5 ++++-
src/rpc/virnetsocket.c | 11 ++++++----
3 files changed, 35 insertions(+), 28 deletions(-)
--
2.3.6
9 years, 5 months
[libvirt] [v1.2.9-maint] Teach virt-aa-helper to use TEMPLATE.qemu if the domain is kvm or kqemu
by Guido Günther
(cherry picked from commit 16d2bc8b98563f801f111795250515fcbd39ab46)
---
Succesfully tested on Debian at:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=786652
src/security/virt-aa-helper.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 9afc8db..1f299a0 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -341,15 +341,25 @@ create_profile(const char *profile, const char *profile_name,
int tlen, plen;
int fd;
int rc = -1;
+ const char *driver_name = NULL;
if (virFileExists(profile)) {
vah_error(NULL, 0, _("profile exists"));
goto end;
}
+ switch (virtType) {
+ case VIR_DOMAIN_VIRT_QEMU:
+ case VIR_DOMAIN_VIRT_KQEMU:
+ case VIR_DOMAIN_VIRT_KVM:
+ driver_name = "qemu";
+ break;
+ default:
+ driver_name = virDomainVirtTypeToString(virtType);
+ }
if (virAsprintfQuiet(&template, "%s/TEMPLATE.%s", APPARMOR_DIR "/libvirt",
- virDomainVirtTypeToString(virtType)) < 0) {
+ driver_name) < 0) {
vah_error(NULL, 0, _("template name exceeds maximum length"));
goto end;
}
--
2.1.4
9 years, 5 months
[libvirt] [PATCH v3 0/9] Selective block device migration implementation
by Michal Privoznik
I've taken Pavel's patches, reworked them a bit, added something and sending
v3. The original patches can be found here:
https://www.redhat.com/archives/libvir-list/2015-May/msg00697.html
Michal Privoznik (3):
virDomainDiskGetSource: Mark passed disk as 'const'
qemuMigrationBeginPhase: Fix function header indentation
qemuMigrationDriveMirror: Pass disk format to qemu
Pavel Boldin (6):
util: multi-value virTypedParameter
util: multi-value parameters in virTypedParamsAdd*
util: virTypedParams{Filter,PickStrings}
util: add virTypedParamsAddStringList
qemu: migration: selective block device migration
virsh: selective block device migration
include/libvirt/libvirt-domain.h | 9 ++
include/libvirt/libvirt-host.h | 17 +++
src/conf/domain_conf.c | 2 +-
src/conf/domain_conf.h | 2 +-
src/libvirt_public.syms | 3 +
src/qemu/qemu_driver.c | 72 +++++++---
src/qemu/qemu_migration.c | 267 +++++++++++++++++++++++++----------
src/qemu/qemu_migration.h | 24 ++--
src/util/virtypedparam.c | 269 ++++++++++++++++++++++++++++-------
src/util/virtypedparam.h | 10 ++
tests/Makefile.am | 6 +
tests/virtypedparamtest.c | 294 +++++++++++++++++++++++++++++++++++++++
tools/virsh-domain.c | 23 +++
tools/virsh.pod | 21 +--
14 files changed, 854 insertions(+), 165 deletions(-)
create mode 100644 tests/virtypedparamtest.c
--
2.3.6
9 years, 5 months
[libvirt] [PATCH 0/2] Two trivial fixes
by Peter Krempa
Both are now pushed.
Peter Krempa (2):
qemu: Jump to correct label in qemuDomainPinIOThread
qemu: Fix double space in error message in qemuDomainGetVcpusFlags
src/qemu/qemu_driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
2.4.1
9 years, 5 months