1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-10-26 07:34:04 +03:00

python: Expose virDomain{G,S}etInterfaceParameters APIs in python binding

The v4 patch corrects indentation issues.

The v3 patch follows latest python binding codes and change 'size'
type from int to Py_ssize_t.

An simple example to show how to use it:

#!/usr/bin/env python

import libvirt

conn = libvirt.open(None)
dom = conn.lookupByName('foo')

print dom.interfaceParameters('vnet0', 0)

params = {'outbound.peak': 10,
          'inbound.peak': 10,
          'inbound.burst': 20,
          'inbound.average': 20,
          'outbound.average': 30,
          'outbound.burst': 30}

print dom.setInterfaceParameters('vnet0', params, 0)
print dom.interfaceParameters('vnet0', 0)

Signed-off-by: Alex Jia <ajia@redhat.com>
This commit is contained in:
Alex Jia
2012-02-14 10:46:23 +08:00
parent 4c1c361127
commit 8b29c45986
2 changed files with 142 additions and 0 deletions

View File

@@ -261,6 +261,22 @@
<arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
<arg name='flags' type='int' info='an OR&apos;ed set of virDomainModificationImpact'/>
</function>
<function name='virDomainSetInterfaceParameters' file='python'>
<info>Change the bandwidth tunables for a interface device</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
<arg name='device' type='const char *' info='interface name'/>
<arg name='params' type='virTypedParameterPtr' info='Pointer to bandwidth tuning params object'/>
<arg name='flags' type='unsigned int' info='an OR&apos;ed set of virDomainModificationImpact'/>
<return type='int' info='0 in case of success, -1 in case of failure'/>
</function>
<function name='virDomainGetInterfaceParameters' file='python'>
<info>Get the bandwidth tunables for a interface device</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
<arg name='device' type='const char *' info='interface name'/>
<arg name='flags' type='unsigned int' info='an OR&apos;ed set of virDomainModificationImpact'/>
<return type='str *' info='the bandwidth tunables value or None in case of error'/>
</function>
<function name='virConnectListStoragePools' file='python'>
<info>list the storage pools, stores the pointers to the names in @names</info>
<arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>