We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is any way i can add memory monitor of guest vm
my code for example
#!/usr/bin/env python
import libvirt from libvirt import libvirtError import time
def request_cred(credentials, user_data): for credential in credentials: if credential[0] == libvirt.VIR_CRED_AUTHNAME: credential[4] = 'test' elif credential[0] == libvirt.VIR_CRED_PASSPHRASE: credential[4] = 'dddddddd' return 0
auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE], request_cred, None] conn = libvirt.openAuth('qemu+{0}://{1}/system'.format('tcp','127.0.0.1'), auth, 0) #conn = libvirt.open(optional_params['conn']) guest = 'guest' vm = conn.lookupByName(guest) """ test with running vm """ memstats = vm.memoryStats() percent = memstats['rss'] / memstats['actual'] * 100 pcentCurrMem = max(100.0,min(percent, 0.0)) print(percent) print(int( float(int(memstats['rss'])) / float(int(memstats['actual'])) * 100 )) time.sleep(1) vm.setMemoryStatsPeriod(5, libvirt.VIR_DOMAIN_AFFECT_LIVE) memstats = vm.memoryStats() print(int( float(int(memstats['rss'])) / float(int(memstats['actual'])) * 100 ))
But the usage of memory the same 99% or 101% how can i solve this problem
The text was updated successfully, but these errors were encountered:
No branches or pull requests
There is any way i can add memory monitor of guest vm
my code for example
#!/usr/bin/env python
import libvirt
from libvirt import libvirtError
import time
def request_cred(credentials, user_data):
for credential in credentials:
if credential[0] == libvirt.VIR_CRED_AUTHNAME:
credential[4] = 'test'
elif credential[0] == libvirt.VIR_CRED_PASSPHRASE:
credential[4] = 'dddddddd'
return 0
auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE], request_cred, None]
conn = libvirt.openAuth('qemu+{0}://{1}/system'.format('tcp','127.0.0.1'), auth, 0)
#conn = libvirt.open(optional_params['conn'])
guest = 'guest'
vm = conn.lookupByName(guest)
""" test with running vm """
memstats = vm.memoryStats()
percent = memstats['rss'] / memstats['actual'] * 100
pcentCurrMem = max(100.0,min(percent, 0.0))
print(percent)
print(int( float(int(memstats['rss'])) / float(int(memstats['actual'])) * 100 ))
time.sleep(1)
vm.setMemoryStatsPeriod(5, libvirt.VIR_DOMAIN_AFFECT_LIVE)
memstats = vm.memoryStats()
print(int( float(int(memstats['rss'])) / float(int(memstats['actual'])) * 100 ))
But the usage of memory the same 99% or 101%
how can i solve this problem
The text was updated successfully, but these errors were encountered: