]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
12 years agoNew functions for virBitmap
Hu Tao [Fri, 14 Sep 2012 07:46:57 +0000 (15:46 +0800)]
New functions for virBitmap

In many places we store bitmap info in a chunk of data
(pointed to by a char *), and have redundant codes to
set/unset bits. This patch extends virBitmap, and convert
those codes to use virBitmap in subsequent patches.

12 years agobitmap: new member variable and function renaming
Hu Tao [Fri, 14 Sep 2012 07:46:56 +0000 (15:46 +0800)]
bitmap: new member variable and function renaming

Add a new member variable map_len to store map len of bitmap.
and rename size to max_bit accordingly.

rename virBitmapAlloc to virBitmapNew.

12 years agovirsh: Clarify behavior of domain list filtering.
Peter Krempa [Mon, 17 Sep 2012 08:57:41 +0000 (10:57 +0200)]
virsh: Clarify behavior of domain list filtering.

Some combinations of filtering flags produce no result. This patch tries
to clarify this.

12 years agoBuild: Fix typos which cause build failure
Osier Yang [Mon, 17 Sep 2012 06:39:43 +0000 (14:39 +0800)]
Build: Fix typos which cause build failure

Pushed under build-breaker rules.

12 years agonode_memory: Expose the APIs to Python bindings
Osier Yang [Fri, 14 Sep 2012 14:42:19 +0000 (22:42 +0800)]
node_memory: Expose the APIs to Python bindings

* python/libvirt-override-api.xml: (Add document to describe
  the APIs).
* python/libvirt-override.c: (Implement the API wrappers manually)

12 years agonode_memory: Expose the APIs to virsh
Osier Yang [Fri, 14 Sep 2012 14:42:18 +0000 (22:42 +0800)]
node_memory: Expose the APIs to virsh

New command node-memory-tune to get/set the node memory parameters,
only two parameters are allowed to set (pages_to_scan, and sleep_millisecs,
see documents in this patch for more details).

Example of node-memory-tune's output:

Shared memory:
pages_to_scan   100
sleep_millisecs 20
pages_shared    0
pages_sharing   0
pages_unshared  0
pages_volatile  0
full_scans      0

12 years agonode_memory: Support get/set memory parameters for drivers
Osier Yang [Fri, 14 Sep 2012 14:42:17 +0000 (22:42 +0800)]
node_memory: Support get/set memory parameters for drivers

Including QEMU, LXC, UML, XEN drivers.

12 years agonode_memory: Implement the internal APIs
Osier Yang [Fri, 14 Sep 2012 14:42:16 +0000 (22:42 +0800)]
node_memory: Implement the internal APIs

Only implemented for linux platform.

* src/nodeinfo.h: (Declare node{Get,Set}MemoryParameters)
* src/nodeinfo.c: (Implement node{Get,Set}MemoryParameters)
* src/libvirt_private.syms: (Export those two new internal APIs to
  private symbols)

12 years agonode_memory: Wire up the RPC protocol
Osier Yang [Fri, 14 Sep 2012 14:42:15 +0000 (22:42 +0800)]
node_memory: Wire up the RPC protocol

* src/rpc/gendispatch.pl: (virNodeSetMemoryParameters is the
  the special one which needs a connection object as the first
  argument, improve the generator to support it).
* daemon/remote.c: (Implement the server side handler for
  virDomainGetMemoryParameters)
* src/remote/remote_driver.c: (Implement the client side handler
  for virDomainGetMemoryParameters)
* src/remote/remote_protocol.x: (New RPC procedures for the two
  new APIs and structs to represent the args and ret for it)
* src/remote_protocol-structs: Likewise

12 years agonode_memory: Define the APIs to get/set memory parameters
Osier Yang [Fri, 14 Sep 2012 14:42:14 +0000 (22:42 +0800)]
node_memory: Define the APIs to get/set memory parameters

* include/libvirt/libvirt.h.in: (Add macros for the param fields,
  declare the APIs).
* src/driver.h: (New methods for the driver struct)
* src/libvirt.c: (Implement the public APIs)
* src/libvirt_public.syms: (Export the public symbols)

12 years agolist: Use virConnectListAllSecrets in virsh
Osier Yang [Fri, 14 Sep 2012 08:38:52 +0000 (16:38 +0800)]
list: Use virConnectListAllSecrets in virsh

This introduces four new options for secret-list, to filter the
returned secrets by whether it's ephemeral or not, and/or by
whether it's private or not.

* tools/virsh-secret.c: (New helper vshSecretSorter,
  vshSecretListFree, and vshCollectSecretList; Use the new
  API for secret-list; error out if flags are specified,
  because there is no way to filter the results when using
  old APIs (no APIs to get the properties (ephemeral, private)
  of a secret yet).

* tools/virsh.pod: Document the 4 new options.

12 years agolist: Expose virConnectListAllSecrets to Python binding
Osier Yang [Fri, 14 Sep 2012 08:38:51 +0000 (16:38 +0800)]
list: Expose virConnectListAllSecrets to Python binding

The implementation is done manually as the generator does not support
wrapping lists of C pointers into Python objects.

python/libvirt-override-api.xml: Document

python/libvirt-override-virConnect.py: Implementation for listAllSecrets.

python/libvirt-override.c: Implementation for the wrapper.

12 years agolist: Implement listAllSecrets
Osier Yang [Fri, 14 Sep 2012 08:38:50 +0000 (16:38 +0800)]
list: Implement listAllSecrets

Simply returns the object list. Supports to filter the secrets
by its storage location, and whether it's private or not.

src/secret/secret_driver.c: Implement listAllSecrets

12 years agolist: Implement RPC calls for virConnectListAllSecrets
Osier Yang [Fri, 14 Sep 2012 08:38:49 +0000 (16:38 +0800)]
list: Implement RPC calls for virConnectListAllSecrets

The RPC generator doesn't support returning list of object yet, this patch
does the work manually.

  * daemon/remote.c:
    Implement the server side handler remoteDispatchConnectListAllSecrets.

  * src/remote/remote_driver.c:
    Add remote driver handler remoteConnectListAllSecrets.

  * src/remote/remote_protocol.x:
    New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_SECRETS and
    structs to represent the args and ret for it.

  * src/remote_protocol-structs: Likewise.

12 years agolist: Define new API virConnectListAllSecrets
Osier Yang [Fri, 14 Sep 2012 08:38:48 +0000 (16:38 +0800)]
list: Define new API virConnectListAllSecrets

This is to list the secret objects. Supports to filter the secrets
by its storage location, and whether it's private or not.

include/libvirt/libvirt.h.in: Declare enum virConnectListAllSecretFlags
                              and virConnectListAllSecrets.
python/generator.py: Skip auto-generating
src/driver.h: (virDrvConnectListAllSecrets)
src/libvirt.c: Implement the public API
src/libvirt_public.syms: Export the symbol to public

12 years agolist: Use virConnectListAllNWFilters in virsh
Osier Yang [Wed, 5 Sep 2012 06:02:07 +0000 (14:02 +0800)]
list: Use virConnectListAllNWFilters in virsh

tools/virsh-nwfilter.c:
  * vshNWFilterSorter to sort network filters by name

  * vshNWFilterListFree to free the network filter objects list.

  * vshNWFilterListCollect to collect the network filter objects, trying
    to use new API first, fall back to older APIs if it's not supported.

12 years agolist: Expose virConnectListAllNWFilters to Python binding
Osier Yang [Wed, 5 Sep 2012 06:02:06 +0000 (14:02 +0800)]
list: Expose virConnectListAllNWFilters to Python binding

The implementation is done manually as the generator does not support
wrapping lists of C pointers into Python objects.

python/libvirt-override-api.xml: Document

python/libvirt-override-virConnect.py:
  * Implementation for listAllNWFilters.

python/libvirt-override.c: Implementation for the wrapper.

12 years agolist: Implement listAllNWFilters
Osier Yang [Wed, 5 Sep 2012 06:02:05 +0000 (14:02 +0800)]
list: Implement listAllNWFilters

Simply returns the object list. No filtering.

src/nwfilter/nwfilter_driver.c: Implement listAllNWFilters

12 years agolist: Implement RPC calls for virConnectListAllNWFilters
Osier Yang [Wed, 5 Sep 2012 06:02:04 +0000 (14:02 +0800)]
list: Implement RPC calls for virConnectListAllNWFilters

The RPC generator doesn't support returning list of object yet, this patch
do the work manually.

  * daemon/remote.c:
    Implemente the server side handler remoteDispatchConnectListAllNWFilters.

  * src/remote/remote_driver.c:
    Add remote driver handler remoteConnectListAllNWFilters.

  * src/remote/remote_protocol.x:
    New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_NWFILTERS and
    structs to represent the args and ret for it.

  * src/remote_protocol-structs: Likewise.

12 years agolist: Define new API virConnectListAllNWFilters
Osier Yang [Wed, 5 Sep 2012 06:02:03 +0000 (14:02 +0800)]
list: Define new API virConnectListAllNWFilters

This is to list the network filter objects. No flags are supported

include/libvirt/libvirt.h.in: Declare enum virConnectListAllNWFilterFlags
                              and virConnectListAllNWFilters.
python/generator.py: Skip auto-generating
src/driver.h: (virDrvConnectListAllNWFilters)
src/libvirt.c: Implement the public API
src/libvirt_public.syms: Export the symbol to public

12 years agolist: Use virConnectListAllNodeDevices in virsh
Osier Yang [Mon, 17 Sep 2012 03:32:53 +0000 (11:32 +0800)]
list: Use virConnectListAllNodeDevices in virsh

tools/virsh-nodedev.c:
  * vshNodeDeviceSorter to sort node devices by name

  * vshNodeDeviceListFree to free the node device objects list.

  * vshNodeDeviceListCollect to collect the node device objects, trying
    to use new API first, fall back to older APIs if it's not supported.

  * Change option --cap to accept multiple capability types.

tools/virsh.pod
  * Update document for --cap

12 years agovirsh: Don't motify the const string
Osier Yang [Fri, 14 Sep 2012 16:21:07 +0000 (00:21 +0800)]
virsh: Don't motify the const string

This improve helper vshStringToArray to accept const string as
argument instead. To not convert the const string when using
vshStringToArray, and thus avoid motifying it.

12 years agolist: Expose virConnectListAllNodeDevices to Python binding
Osier Yang [Wed, 5 Sep 2012 05:34:11 +0000 (13:34 +0800)]
list: Expose virConnectListAllNodeDevices to Python binding

The implementation is done manually as the generator does not support
wrapping lists of C pointers into Python objects.

python/libvirt-override-api.xml: Document

python/libvirt-override-virConnect.py:
  * Implementation for listAllNodeDevices.

python/libvirt-override.c: Implementation for the wrapper.

12 years agolist: Implement listAllNodeDevices
Osier Yang [Wed, 5 Sep 2012 05:34:10 +0000 (13:34 +0800)]
list: Implement listAllNodeDevices

This simply implements listAllNodeDevices using helper virNodeDeviceList

src/node_device/node_device_driver.h:
  * Declare nodeListAllNodeDevices.

src/node_device/node_device_driver.c:
  * Implement nodeListAllNodeDevices.

src/node_device/node_device_hal.c:
  * Hook listAllNodeDevices to nodeListAllNodeDevices.

src/node_device/node_device_udev.c
  * Hook listAllNodeDevices to nodeListAllNodeDevices.

12 years agolist: Add helpers for listing node devices
Osier Yang [Wed, 5 Sep 2012 05:34:09 +0000 (13:34 +0800)]
list: Add helpers for listing node devices

src/conf/node_device_conf.h:
  * New macro VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP
  * Declare virNodeDeviceList

src/conf/node_device_conf.c:
  * New helpers virNodeDeviceCapMatch, virNodeDeviceMatch.
    virNodeDeviceCapMatch looks up the list of all the caps the device
    support, to see if the device support the cap type.
  * Implement virNodeDeviceList

src/libvirt_private.syms:
  * Export virNodeDeviceList
  * Export virNodeDevCapTypeFromString

12 years agolist: Implement RPC calls for virConnectListAllNodeDevices
Osier Yang [Wed, 5 Sep 2012 05:34:08 +0000 (13:34 +0800)]
list: Implement RPC calls for virConnectListAllNodeDevices

The RPC generator doesn't support returning list of object yet, this patch
does the work manually.

  * daemon/remote.c:
    Implemente the server side handler remoteDispatchConnectListAllNodeDevices.

  * src/remote/remote_driver.c:
    Add remote driver handler remoteConnectListAllNodeDevices.

  * src/remote/remote_protocol.x:
    New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES and

12 years agolist: Define new API virConnectListAllNodeDevices
Osier Yang [Thu, 13 Sep 2012 06:54:09 +0000 (14:54 +0800)]
list: Define new API virConnectListAllNodeDevices

This is to list the node device objects, supports to filter the results
by capability types.

include/libvirt/libvirt.h.in: Declare enum virConnectListAllNodeDeviceFlags
                              and virConnectListAllNodeDevices.
python/generator.py: Skip auto-generating
src/driver.h: (virDrvConnectListAllNodeDevices)
src/libvirt.c: Implement the public API
src/libvirt_public.syms: Export the symbol to public

12 years agobuild: fix missing include
Dwight Engen [Fri, 14 Sep 2012 22:55:41 +0000 (22:55 +0000)]
build: fix missing include

virNWFilterSnoopAdjustPoll() uses a struct pollfd but poll.h is never included
nwfilter/nwfilter_dhcpsnoop.c:1297: error: 'struct pollfd' declared inside parameter list

12 years agoAdd missing 'goto error' in QEMU command line building
Daniel P. Berrange [Tue, 11 Sep 2012 13:44:40 +0000 (14:44 +0100)]
Add missing 'goto error' in QEMU command line building

If reporting case of a binary not supporting KVM or kQEMU, libvirt
forgot to jump to the error branch for cleanup

12 years agoFix initialization of virCommandPtr when creating QEMU argv
Daniel P. Berrange [Fri, 14 Sep 2012 14:35:33 +0000 (15:35 +0100)]
Fix initialization of virCommandPtr when creating QEMU argv

If the qemuBuildCommandLine method raised an error before the
virCommandPtr instance was created, the local var would not
be initialized, resulting in a possible SEGV in the error
cleanup branch. Also add some debugging of the method params

12 years agoFix 3 broken test cases which were mistakenly raising errors
Daniel P. Berrange [Fri, 14 Sep 2012 14:34:33 +0000 (15:34 +0100)]
Fix 3 broken test cases which were mistakenly raising errors

Several test cases were mistakenly raising errors due to the
QEMU_CAPS_KVM flag being missed.

12 years agoqemu: fix uninitialized variable in qemuParseCommandLine
Ján Tomko [Fri, 14 Sep 2012 12:50:51 +0000 (14:50 +0200)]
qemu: fix uninitialized variable in qemuParseCommandLine

Newly added if branch for kvm_pv_eoi did not set the ret variable.

12 years agoIntroduce a API for creating QEMU capabilities for a binary
Daniel P. Berrange [Mon, 10 Sep 2012 10:47:56 +0000 (11:47 +0100)]
Introduce a API for creating QEMU capabilities for a binary

Introduce a qemuCapsNewForBinary() API which creates a new
QEMU capabilities object, populated with data relating to
a specific QEMU binary. The qemuCaps object is also given
a timestamp, which makes it possible to detect when the
cached capabilities for a binary are out of date

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove upfront check for hmp - just try it cope with failure
Daniel P. Berrange [Thu, 6 Sep 2012 15:28:53 +0000 (16:28 +0100)]
Remove upfront check for hmp - just try it cope with failure

Don't bother checking for the existance of the HMP passthrough
command. Just try to execute it, and propagate the failure.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDon't overwrite errors raised by qemuMonitorHMPCommand
Daniel P. Berrange [Thu, 13 Sep 2012 12:54:54 +0000 (13:54 +0100)]
Don't overwrite errors raised by qemuMonitorHMPCommand

The qemuMonitorHMPCommand() API and things it calls will report
a wide variety of errors. The QEMU text monitor should not be
overwriting these errors

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemu: Add support for EOI with APIC
Martin Kletzander [Thu, 13 Sep 2012 13:27:07 +0000 (15:27 +0200)]
qemu: Add support for EOI with APIC

This patch adds full support for EOI setting for domains. Because this
is CPU feature (flag), the model needs to be added even when it's not
specified. Fortunately this problem was already solved with kvmclock,
so this patch simply abuses that.

And due to the size of the patch (17 lines) I dared to include the tests.

12 years agoAdd support for EOI with APIC
Martin Kletzander [Wed, 12 Sep 2012 22:10:56 +0000 (00:10 +0200)]
Add support for EOI with APIC

New options is added to support EOI (End of Interrupt) exposure for
guests. As it makes sense only when APIC is enabled, I added this into
the <apic> element in <features> because this should be tri-state
option (cannot be handled as standalone feature).

12 years agosecurity: Fix libvirtd crash possibility
Martin Kletzander [Wed, 12 Sep 2012 21:43:26 +0000 (23:43 +0200)]
security: Fix libvirtd crash possibility

Fix for CVE-2012-4423.

When generating RPC protocol messages, it's strictly needed to have a
continuous line of numbers or RPC messages. However in case anyone
tries backporting some functionality and will skip a number, there is
a possibility to make the daemon segfault with newer virsh (version of
the library, rpc call, etc.) even unintentionally.

The problem is that the skipped numbers will get func filled with
NULLs, but there is no check whether these are set before the daemon
tries to run them. This patch very simply enhances one check and fixes
that.

12 years agosnapshot: fix rollback failure in transaction mode
Guannan Ren [Thu, 13 Sep 2012 10:09:44 +0000 (18:09 +0800)]
snapshot: fix rollback failure in transaction mode

BZ:https://bugzilla.redhat.com/show_bug.cgi?id=843372
when qemu supports the 'transaction' monitor command,
and libvirt's --reuse-ext flag was not specified, libvirt created
a stub file with zero size in first place. After the failure of
QEMU transaction command performing qcow2 snapshots on more than
one drives, the stub file is left behind with non-empty
by the QEMU transaction command.
In order to unlink the file, the patch removes the file size checking.

Steps to reproduce the issue:
Steps:
 1, Create a qemu instance with two drive images of qcow2 type (root user)
    /usr/libexec/qemu-kvm -m 1024 -smp 1 -name "rhel6u1" \
      -drive file=/var/lib/libvirt/images/firstqcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none
      -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
      -drive file=/var/lib/libvirt/images/secondqcow2,if=none,id=drive-virtio-disk1,format=qcow2,cache=none \
      -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk1,id=virtio-disk1 -qmp stdio

 2, Initialize qemu qmp
    {"execute":"qmp_capabilities"}

 3, Remove the second drive image file
    rm -f /var/lib/libvirt/images/secondqcow2

 4, Run 'transaction' command with snapshot qemu commands in.
    {"execute":"transaction","arguments":
      {"actions":
        [{"type":"blockdev-snapshot-sync","data":
          {"device":"drive-virtio-disk0","snapshot-file":"/var/lib/libvirt/images/firstqcow2-snapshot.img","format":"qcow2"}
         },
         {"type":"blockdev-snapshot-sync","data":
          {"device":"drive-virtio-disk1","snapshot-file":"/var/lib/libvirt/images/secondqcow2-snapshot.img","format":"qcow2"}
         }]
      },
   "id":"libvirt-6"}

 5, Got the error as follows:
    {"id": "libvirt-6",
      "error": {"class": "OpenFileFailed", "desc": "Could not open '/var/lib/libvirt/images/secondqcow2-snapshot.img'",
                "data": {"filename": "/var/lib/libvirt/images/secondqcow2-snapshot.img"}
               }
    }

 6, List first newly-created snapshot file:
    -rw-r--r--. 1 root root     262144 Sep 13 11:43 firstqcow2-snapshot.img

12 years agoImprove virTypedParameterValidateSet
Osier Yang [Mon, 10 Sep 2012 12:08:54 +0000 (20:08 +0800)]
Improve virTypedParameterValidateSet

Assume not only domain object will use it.

12 years agoLook in Debian's multiarch libs too
Guido Günther [Thu, 13 Sep 2012 12:27:07 +0000 (14:27 +0200)]
Look in Debian's multiarch libs too

so we don't fail when libnetcf is built as multiarch lib.

12 years agobuild: don't fail if libnl-3 is not found
Eric Blake [Thu, 13 Sep 2012 12:32:41 +0000 (06:32 -0600)]
build: don't fail if libnl-3 is not found

Commit 9298bfb changed configure to split the libnl into two
separate pkg config checks instead of nesting the second check
on the failure path of the first.  But the default pkg config
behavior is to abort configure if a check fails.  Since we have
a second check lined up, we need an explicit failure case that
does not abort if the first check fails.

Meanwhile, commit 51b708c is reverted.  It did not fix any
behavior, and in fact, introduced a regression to the fallback
case when the user explicitly sets $LIBNL_CFLAGS.

* configure.ac: Don't abort if libnl-3 is not found.

12 years agoconf: avoid libvirt crash with empty address guestfwd channel
Alex Jia [Thu, 13 Sep 2012 15:36:17 +0000 (23:36 +0800)]
conf: avoid libvirt crash with empty address guestfwd channel

The 'def->target.addr' hasn't been initialized in virDomainChrDefNew() and
its value is always '0xffffffff', in addition, the following test scenario
hasn't also include 'address' element in channel XML block, so the branch
'if (addrStr == NULL)' is hit in virDomainChrDefParseTargetXML(), the
programming jumps to 'error' label to release relevant resources, and the
statement 'if (VIR_ALLOC(def->target.addr) < 0)' hasn't been executed then
the virDomainChrDefFree() will free 'def->target.addr'(0xffffffff) via
VIR_FREE(), which results in libvirt crash, to use valgrind can also
find a 'Invalid free() / delete / delete[]' error. This patch just adjusts
codes order to initialize 'def->target.addr' firstly.

With this patch, libvirt hasn't crash and can get a expected error message "
XML error: guestfwd channel does not define a target address".

How to reproduce?

1. define a guest with the following channel XML configuration

$ cat foo.xml
<snip>
    <channel type='pty'>
      <target type='guestfwd'/>
    </channel>
</snip>

$ virsh define foo.xml

2. actual result

error: Failed to define domain from /tmp/foo.xml
error: End of file while reading data: Input/output error
error: Failed to reconnect to the hypervisor

GDB debugger information:
<snip>
Breakpoint 1, virDomainChrDefFree (def=0x7f8ab000ec70) at conf/domain_conf.c:1264
...ignore
1264    {
(gdb) p def->target
$2 = {port = -1, addr = 0xffffffff, name = 0xffffffff <Address 0xffffffff out of bounds>}
</snip>

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=856489

Signed-off-by: Alex Jia <ajia@redhat.com>
12 years agoparallels: implement containers creation
Dmitry Guryanov [Wed, 12 Sep 2012 12:40:54 +0000 (16:40 +0400)]
parallels: implement containers creation

Add separate function parallelsCreateCt, which creates container.
Also add example xml configuration domain-parallels-ct-simple.xml.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: fix parallelsDomainDefineXML for existing containers
Dmitry Guryanov [Mon, 10 Sep 2012 15:22:44 +0000 (19:22 +0400)]
parallels: fix parallelsDomainDefineXML for existing containers

Fix code, which checks what is changed in virDomainDef structure.
It looks slightly different for containers and VMs: containers haven't
boot devices, but have init path

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: handle unlimited cpus on containers
Dmitry Guryanov [Mon, 10 Sep 2012 15:22:43 +0000 (19:22 +0400)]
parallels: handle unlimited cpus on containers

User may set "unlimited" cpus for containers, which means to
take all available cpus on the node.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: add support of containers to the driver
Dmitry Guryanov [Mon, 10 Sep 2012 15:22:42 +0000 (19:22 +0400)]
parallels: add support of containers to the driver

This patch makes parallelsLoadDomains to be able to load information
about containers. So functions, which return different information
and change state will work.

parallelsDomainDefineXML will be fixed in separate patch.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoFix data types used for list sizes in QEMU capabilities
Daniel P. Berrange [Wed, 22 Aug 2012 10:56:11 +0000 (11:56 +0100)]
Fix data types used for list sizes in QEMU capabilities

The QEMU capabilities APIs used a misc of 'int' and
'unsigned int' for variables relating to array sizes.
Change all these to use 'size_t'

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd API for copying instances of the qemuCapsPtr object
Daniel P. Berrange [Tue, 11 Sep 2012 12:42:20 +0000 (13:42 +0100)]
Add API for copying instances of the qemuCapsPtr object

To allow each VM instance to record additional capabilities
without affecting other VMs, there needs to be a way to do
a deep copy of the qemuCapsPtr object

12 years agoAdd ability to store other metadata in the qemu capabilities object
Daniel P. Berrange [Wed, 22 Aug 2012 10:11:28 +0000 (11:11 +0100)]
Add ability to store other metadata in the qemu capabilities object

Add struct fields and APIs to allow the qemu capabilities object
to store version, arch, machines & cpu names, etc

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMake qemuCapsProbeCommand static
Daniel P. Berrange [Mon, 20 Aug 2012 15:05:45 +0000 (16:05 +0100)]
Make qemuCapsProbeCommand static

The qemuCapsProbeCommand API is only used by the capabilities
code, so can be static

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoTurn QEMU capabilities object into a full virObjectPtr
Daniel P. Berrange [Mon, 20 Aug 2012 16:44:14 +0000 (17:44 +0100)]
Turn QEMU capabilities object into a full virObjectPtr

The current qemu capabilities are stored in a virBitmapPtr
object, whose type is exposed to callers. We want to store
more data besides just the flags, so we need to move to a
struct type. This object will also need to be reference
counted, since we'll be maintaining a cache of data per
binary. This change introduces a 'qemuCapsPtr' virObject
class. Most of the change is just renaming types and
variables in all the callers

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAllow caps to be NULL when creating virDomainObjPtr instances
Daniel P. Berrange [Thu, 6 Sep 2012 15:32:45 +0000 (16:32 +0100)]
Allow caps to be NULL when creating virDomainObjPtr instances

If no private data needs to be maintained, it can be useful
to create virDomainObjPtr instances without having a virCapsPtr
instance around. Adapt the virDomainObjNew() function to allow
for a NULL caps

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoWait to receive QMP greeting before sending any monitor commands
Daniel P. Berrange [Thu, 6 Sep 2012 15:14:25 +0000 (16:14 +0100)]
Wait to receive QMP greeting before sending any monitor commands

Technically speaking we should wait until we receive the QMP
greeting message before attempting to send any QMP monitor
commands. Mostly we've got away with this, but there is a race
in some QEMU which cause it to SEGV if you sent it data too
soon after startup. Waiting for the QMP greeting avoids the
race

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a virBitmapCopy API
Daniel P. Berrange [Thu, 6 Sep 2012 15:09:32 +0000 (16:09 +0100)]
Add a virBitmapCopy API

Add an API allowing flags from one virBitmapPtr to be copied
into another instance.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agodoc: update usb redirection filter infomation on formatdomain.html
Guannan Ren [Thu, 13 Sep 2012 07:25:48 +0000 (15:25 +0800)]
doc: update usb redirection filter infomation on formatdomain.html

12 years agotest: add xml2argvtest for usb-redir filter and update xml schema
Guannan Ren [Thu, 13 Sep 2012 07:25:47 +0000 (15:25 +0800)]
test: add xml2argvtest for usb-redir filter and update xml schema

12 years agoqemu: build USB redirection filter qemu command line
Guannan Ren [Thu, 13 Sep 2012 07:25:46 +0000 (15:25 +0800)]
qemu: build USB redirection filter qemu command line

Input XML snip:
<redirdev bus='usb' type='spicevmc'>
   <address type='usb' bus='0' port='4'/>
 </redirdev>
<redirfilter>
  <usbdev class='0x08' vendor='0x1234' product='0xbeef' \
          version='2.00' allow='yes'/>
  <usbdev class='-1' vendor='-1' product='-1' version='-1' allow='no'/>
</redirfilter>

will be converted to:
-device usb-redir,chardev=charredir0,id=redir0,\
filter=0x08:0x1234:0xBEEF:0x2000:1|-1:-1:-1:-1:0,bus=usb.0,port=4

12 years agoqemu: define and parse USB redirection filter XML
Guannan Ren [Thu, 13 Sep 2012 07:25:45 +0000 (15:25 +0800)]
qemu: define and parse USB redirection filter XML

https://bugzilla.redhat.com/show_bug.cgi?id=795929
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=6af165892cf900291046f1d25f95416f379504c2

This patch define and parse the input XML of USB redirection filter.
<devices>
...
  <redirdev bus='usb' type='spicevmc'>
    <address type='usb' bus='0' port='4'/>
  </redirdev>
  <redirfilter>
    <usbdev class='0x08' vendor='0x1234' product='0xbeef' \
            version='2.00' allow='yes'/>
    <usbdev allow='no'/>
  </redirfilter>
...
</devices>

There is no 1:1 mapping between ports and redirected devices and
qemu and spicy client couldn't decide into which usbredir ports
the client can 'plug' redirected devices. So it make sense to apply
all of filter rules global to all existing usb redirection devices.
class attribute is USB Class codes. version is bcdDevice value
of USB device. vendor and product is USB vendorId and productId.
-1 can be used to allow any value for a field. Except allow attribute
the other four are optional, default value is -1.

12 years agovirsh: Fix version numbers in comments
Osier Yang [Thu, 13 Sep 2012 08:56:07 +0000 (16:56 +0800)]
virsh: Fix version numbers in comments

And redundant error resetting.

Pushed under trivial rule.

12 years agoqemu: add usb-redir.filter qemu capability flag
Guannan Ren [Sun, 19 Aug 2012 15:42:44 +0000 (23:42 +0800)]
qemu: add usb-redir.filter qemu capability flag

Add a qemu flag for USB redirection filter support.

The output:
usb-redir.chardev=chr
usb-redir.debug=uint8
usb-redir.filter=string
usb-redir.port=string

12 years agobuild: Fix typo which causes build failure
Osier Yang [Thu, 13 Sep 2012 04:44:19 +0000 (12:44 +0800)]
build: Fix typo which causes build failure

Pushed under build-breaker rule.

12 years agobuild: force libnl1 if netcf also used libnl1
Eric Blake [Fri, 7 Sep 2012 22:38:52 +0000 (16:38 -0600)]
build: force libnl1 if netcf also used libnl1

Recent spec file changes ensure that in distro situations, netcf
and libvirt will link against the same libnl in order to avoid
dumping core.  But for every-day development, if you use F17 and
have the libnl3-devel headers available, libvirt was blindly
linking against libnl3 even though F17 netcf still links against
libnl1, making testing a self-built binary on F17 impossible.

By making configure a little bit smarter, we can avoid this
situation - we merely skip the probe of libnl-3 if we can prove
that netcf is still using libnl-1.  I intentionally wrote the
test so that we still favor libnl-3 if netcf is not installed or
if we couldn't use ldd to determine things.

Defaults being what they are, someone will invariably complain
that our smarts were wrong.  Never fear - in that case, just run
./configure LIBNL_CFLAGS=..., where the fact that you set
LIBNL_CFLAGS (even to the empty string) will go back to probing
for libnl-3, regardless of netcf's choice.

* configure.ac (LIBNL): Don't probe libnl3 if netcf doesn't use it.

12 years agomaint: fix missing spaces in message
Eric Blake [Wed, 12 Sep 2012 16:54:42 +0000 (10:54 -0600)]
maint: fix missing spaces in message

I got an off-list report about a bad diagnostic:
Target network card mac 52:54:00:49:07:ccdoes not match source 52:54:00:49:07:b8

True to form, I've added a syntax check rule to prevent it
from recurring, and found several other offenders.

* cfg.mk (sc_require_whitespace_in_translation): New rule.
* src/conf/domain_conf.c (virDomainNetDefCheckABIStability): Add
space.
* src/esx/esx_util.c (esxUtil_ParseUri): Likewise.
* src/qemu/qemu_command.c (qemuCollectPCIAddress): Likewise.
* src/qemu/qemu_driver.c (qemuDomainSetMetadata)
(qemuDomainGetMetadata): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainChangeNetBridge): Likewise.
* src/rpc/virnettlscontext.c
(virNetTLSContextCheckCertDNWhitelist): Likewise.
* src/vmware/vmware_driver.c (vmwareDomainResume): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc, vboxAttachDrives):
Avoid false negatives.
* tools/virsh-domain.c (info_save_image_dumpxml): Reword.
Based on a report by Luwen Su.

12 years agobuild: avoid confusing make with raw name 'undefine'
Eric Blake [Wed, 12 Sep 2012 17:25:51 +0000 (11:25 -0600)]
build: avoid confusing make with raw name 'undefine'

Make has a builtin operator 'undefine', and coupled with latest
automake.git, this test name ended up confusing make into thinking
the file name was meant to be used as the make operator.  Renaming
the file avoids the confusion.

* tests/undefine: Rename...
* tests/virsh-undefine: ...to this.
* tests/Makefile.am (test_scripts): Use new name.
Reported by Jim Meyering.

12 years agoAdd API for opening a QEMU monitor from a socket FD
Daniel P. Berrange [Thu, 6 Sep 2012 15:23:57 +0000 (16:23 +0100)]
Add API for opening a QEMU monitor from a socket FD

Currently qemuMonitorOpen() requires an address of the QEMU
monitor. When doing QMP based capabilities detection it is
easier if a pre-opened FD can be provided, since then the
monitor can be run on the STDIO console. Add a new API
qemuMonitorOpenFD() for such usage

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoparallels: fix parallelsDomainDefineXML for domains with VNC and autoport
Dmitry Guryanov [Mon, 10 Sep 2012 15:23:44 +0000 (19:23 +0400)]
parallels: fix parallelsDomainDefineXML for domains with VNC and autoport

virDomainDefParseString assigns 0 to port if autoport enabled.
So fix code, which check different between old and new
configurations.

12 years agoparallels: fix parallelsDoCmdRun in case of command failure
Dmitry Guryanov [Mon, 10 Sep 2012 15:23:43 +0000 (19:23 +0400)]
parallels: fix parallelsDoCmdRun in case of command failure

Don't try to dereferece NULL pointer.

12 years agoBackcompt for console devices in virDomainDeviceInfoIterate
Li Zhang [Tue, 11 Sep 2012 02:57:28 +0000 (10:57 +0800)]
Backcompt for console devices in virDomainDeviceInfoIterate

Historically, the first <console> element is treated as the
alias of a <serial> device. In the virDomainDeviceInfoIterate,
This situation is not considered. It still handles the first <console>
element as another devices, which means that for console[0] with
serial targetType, it calls callback function another time.
It will cause the problem of address conflicts when assigning
spapr-vio address for serial device on pSeries guest.

For pSeries guest, the serial configuration in the xml file
is as the following:
         <serial type='pty'>
               <target port='0'/>
               <address type='spapr-vio'/>
          </serial>

Console configuration is default, the dumped xml file is as the following:
   <serial type='pty'>
      <source path='/dev/pts/5'/>
      <target port='0'/>
      <alias name='serial0'/>
      <address type='spapr-vio' reg='0x30000000'/>
    </serial>
    <console type='pty' tty='/dev/pts/5'>
      <source path='/dev/pts/5'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
      <address type='spapr-vio' reg='0x30000000'/>
    </console>

It shows that the <console> device is the alias of serial device.
So its address is the same as the serial device. When detecting
the conflicts in the qemuAssignSpaprVIOAddress the first console
and the serial device conflicts because virDomainDeviceInfoIterate()
still handle these as two different devices, and in the qemuAssignSpaprVIOAddress(),
it will compare these two devices' addressed. If they have same address,
it will report address conflict error.

So this patch is to handle the first console which targetType is serial
as the alias of serial device to avoid address conflicts error reported.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
12 years agolist: Expose virConnectListAllInterfaces to Python binding
Osier Yang [Tue, 4 Sep 2012 16:10:19 +0000 (00:10 +0800)]
list: Expose virConnectListAllInterfaces to Python binding

The implementation is done manually as the generator does not support
wrapping lists of C pointers into Python objects.

python/libvirt-override-api.xml: Document

python/libvirt-override-virConnect.py:
  * New file, includes implementation of listAllInterfaces.

python/libvirt-override.c: Implementation for the wrapper.

12 years agolist: Use virConnectListAllInterfaces in virsh
Osier Yang [Tue, 4 Sep 2012 16:10:18 +0000 (00:10 +0800)]
list: Use virConnectListAllInterfaces in virsh

tools/virsh-interface.c:
  * vshInterfaceSorter to sort interfaces by name

  * vshInterfaceListFree to free the interface objects list.

  * vshInterfaceListCollect to collect the interface objects, trying
    to use new API first, fall back to older APIs if it's not supported.

12 years agolist: Implement listAllInterfaces
Osier Yang [Tue, 4 Sep 2012 16:10:17 +0000 (00:10 +0800)]
list: Implement listAllInterfaces

This is not that ideal as API for other objects, as it's still
O(n). Because interface driver uses netcf APIs to manage the
stuffs, instead of by itself. And netcf APIs don't return a object.
It provides APIs like old libvirt APIs:

   ncf_number_of_interfaces
   ncf_list_interfaces
   ncf_lookup_by_name
   ......

Perhaps we should further improve netcf to let it provide an API
to return the object, but it could be a later patch. And anyway,
we will still benefit from the new API for the simplification,
and no race like the old APIs.

src/interface/netcf_driver.c: Implement listAllInterfaces

12 years agolist: Implemente RPC calls for virConnectListAllInterfaces
Osier Yang [Tue, 4 Sep 2012 16:10:16 +0000 (00:10 +0800)]
list: Implemente RPC calls for virConnectListAllInterfaces

The RPC generator doesn't support returning list of object yet, this patch
do the work manually.

  * daemon/remote.c:
    Implemente the server side handler remoteDispatchConnectListAllInterfaces.

  * src/remote/remote_driver.c:
    Add remote driver handler remoteConnectListAllInterfaces.

  * src/remote/remote_protocol.x:
    New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES and
    structs to represent the args and ret for it.

  * src/remote_protocol-structs: Likewise.

12 years agolist: Define new API virConnectListAllInterfaces
Osier Yang [Tue, 4 Sep 2012 16:10:15 +0000 (00:10 +0800)]
list: Define new API virConnectListAllInterfaces

This is to list the interface objects, supported filtering flags
are: active|inactive.

include/libvirt/libvirt.h.in: Declare enum virConnectListAllInterfaceFlags
                              and virConnectListAllInterfaces.
python/generator.py: Skip auto-generating
src/driver.h: (virDrvConnectListAllInterfaces)
src/libvirt.c: Implement the public API
src/libvirt_public.syms: Export the symbol to public

12 years agodocs: mention another iaas app built on libvirt
Eric Blake [Tue, 11 Sep 2012 21:28:32 +0000 (15:28 -0600)]
docs: mention another iaas app built on libvirt

Reported on the libvirt-users list.

* docs/apps.html.in: Add Eucalyptus.
Reported by Eric Choi.

12 years agofix bug in qemuSetupCgroupForEmulator
Hu Tao [Thu, 6 Sep 2012 10:13:52 +0000 (18:13 +0800)]
fix bug in qemuSetupCgroupForEmulator

Should not return 0 when failed to setup cgroup.

12 years agobuild: avoid dirty docs on fresh bootstrap
Eric Blake [Tue, 11 Sep 2012 21:26:10 +0000 (15:26 -0600)]
build: avoid dirty docs on fresh bootstrap

* HACKING: Regenerate.

12 years agopython: Initialize new_params in virDomainSetSchedulerParameters
Federico Simoncelli [Tue, 11 Sep 2012 14:41:49 +0000 (10:41 -0400)]
python: Initialize new_params in virDomainSetSchedulerParameters

The new_params variable must be initialized in case the
virDomainGetSchedulerParameters call fails and we hit the cleanup
section before actually allocating the new parameters.

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
12 years agodocs: page.xsl: fix FAQ link in subdirectories
Ján Tomko [Tue, 11 Sep 2012 14:43:34 +0000 (16:43 +0200)]
docs: page.xsl: fix FAQ link in subdirectories

Links to the FAQ didn't work on pages in subdirectories, like
devhelp/libvirt-virterror.html or internals/command.html, because
they have had href_base prepended to them.

12 years agodocs: hacking.html.in: fix table of contents
Ján Tomko [Tue, 11 Sep 2012 12:01:56 +0000 (14:01 +0200)]
docs: hacking.html.in: fix table of contents

Two sections didn't have a working link in the TOC.

12 years agoBuild: Fix typos which cause build failure
Osier Yang [Tue, 11 Sep 2012 12:11:48 +0000 (20:11 +0800)]
Build: Fix typos which cause build failure

Pushed under trivial rule.

12 years agoDon't invoke the auth callback if all credentials were in config file
Daniel P. Berrange [Mon, 10 Sep 2012 15:47:58 +0000 (16:47 +0100)]
Don't invoke the auth callback if all credentials were in config file

The remote driver first looks at the libvirt auth config file to
fill in any credentials. It then invokes the auth callback for
any remaining credentials. It was accidentally invoking the
auth callback even if there were not any more credentials
required.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoCall virResetLastError in all virConnectOpen* functions
Daniel P. Berrange [Mon, 10 Sep 2012 15:47:15 +0000 (16:47 +0100)]
Call virResetLastError in all virConnectOpen* functions

All public API functions must call virResetLastError to clear
out any previous error. The virConnectOpen* functions forgot
to do this.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoCheck against python None type when filling in auth parameters
Daniel P. Berrange [Mon, 10 Sep 2012 15:45:53 +0000 (16:45 +0100)]
Check against python None type when filling in auth parameters

When deciding whether to provide an auth function callback
in openAuth(), credcb was checked against NULL, when it
really needs to be checked against Py_None

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoPrint any exception that occurs in authentication callback
Daniel P. Berrange [Mon, 10 Sep 2012 15:44:40 +0000 (16:44 +0100)]
Print any exception that occurs in authentication callback

If an exception occurs in the python callback for openAuth()
the stack trace isn't seen by the apps, since this code is
called from libvirt context. To aid diagnostics, print the
error to stderr at least

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix crash passing an empty list to python openAuth() API
Daniel P. Berrange [Mon, 10 Sep 2012 15:00:05 +0000 (16:00 +0100)]
Fix crash passing an empty list to python openAuth() API

If passing a 'credtype' parameter which was an empty list
to the python openAuth() API, the 'credtype' field in
the virConnectAuth struct would not be initialized. This
lead to a crash when later trying to free that field.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agovirsh: Fix the typos
Osier Yang [Tue, 11 Sep 2012 10:48:19 +0000 (18:48 +0800)]
virsh: Fix the typos

* tools/virsh-network.c: s/MATCH/VSH_MATCH/

12 years agolist: Expose virConnectListAllNetworks to Python binding
Osier Yang [Tue, 4 Sep 2012 15:55:21 +0000 (23:55 +0800)]
list: Expose virConnectListAllNetworks to Python binding

The implementation is done manually as the generator does not support
wrapping lists of C pointers into Python objects.

python/libvirt-override-api.xml: Document

python/libvirt-override-virConnect.py: Implement listAllNetworks.

python/libvirt-override.c: Implementation for the wrapper.

12 years agolist: Use virConnectListAllNetworks in virsh
Osier Yang [Tue, 4 Sep 2012 15:55:20 +0000 (23:55 +0800)]
list: Use virConnectListAllNetworks in virsh

tools/virsh-network.c:
  * vshNetworkSorter to sort networks by name

  * vshNetworkListFree to free the network objects list.

  * vshNetworkListCollect to collect the network objects, trying
    to use new API first, fall back to older APIs if it's not supported.

  * New options --persistent, --transient, --autostart, --no-autostart,
    for net-list, and new field 'Persistent' for its output.

tools/virsh.pod:
  * Add documents for the new options.

12 years agolist: Implement listAllNetworks for test driver
Osier Yang [Tue, 4 Sep 2012 15:55:19 +0000 (23:55 +0800)]
list: Implement listAllNetworks for test driver

src/test/test_driver.c: Implement listAllNetworks.

12 years agolist: Implement listAllNetworks for network driver
Osier Yang [Tue, 4 Sep 2012 15:55:18 +0000 (23:55 +0800)]
list: Implement listAllNetworks for network driver

src/network/bridge_driver.c: Implement listAllNetworks.

12 years agolist: Add helpers to list network objects
Osier Yang [Tue, 4 Sep 2012 15:55:17 +0000 (23:55 +0800)]
list: Add helpers to list network objects

src/conf/network_conf.c: Add virNetworkMatch to filter the networks;
and virNetworkList to iterate over all the networks with the filter.

src/conf/network_conf.h: Declare virNetworkList and define the macros
for filters.

src/libvirt_private.syms: Export virNetworkList.

12 years agolist: Implement RPC calls for virConnectListAllNetworks
Osier Yang [Tue, 4 Sep 2012 15:55:16 +0000 (23:55 +0800)]
list: Implement RPC calls for virConnectListAllNetworks

The RPC generator doesn't support returning list of object, this patch
do the work manually.

* daemon/remote.c:
  Implemente the server side handler remoteDispatchConnectListAllNetworks.

* src/remote/remote_driver.c:
  Add remote driver handler remoteConnectListAllNetworks.

* src/remote/remote_protocol.x:
  New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS and
  structs to represent the args and ret for it.

* src/remote_protocol-structs: Likewise.

12 years agolist: Define new API virConnectListAllNetworks
Osier Yang [Tue, 4 Sep 2012 15:55:15 +0000 (23:55 +0800)]
list: Define new API virConnectListAllNetworks

This is to list the network objects, supported filtering flags
are: active|inactive, persistent|transient, autostart|no-autostart.

include/libvirt/libvirt.h.in: Declare enum virConnectListAllNetworkFlags
                              and virConnectListAllNetworks.
python/generator.py: Skip auto-generating
src/driver.h: (virDrvConnectListAllNetworks)
src/libvirt.c: Implement the public API
src/libvirt_public.syms: Export the symbol to public

12 years agoFix unwanted closing of libvirt client connection
Christophe Fergeau [Mon, 10 Sep 2012 10:17:07 +0000 (12:17 +0200)]
Fix unwanted closing of libvirt client connection

e5a1bee07 introduced a regression in Boxes: when Boxes is left idle
(it's still doing some libvirt calls in the background), the
libvirt connection gets closed after a few minutes. What happens is
that this code in virNetClientIOHandleOutput gets triggered:

if (!thecall)
    return -1; /* Shouldn't happen, but you never know... */

and after the changes in e5a1bee07, this causes the libvirt connection
to be closed.

Upon further investigation, what happens is that
virNetClientIOHandleOutput is called from gvir_event_handle_dispatch
in libvirt-glib, which is triggered because the client fd became
writable. However, between the times gvir_event_handle_dispatch
is called, and the time the client lock is grabbed and
virNetClientIOHandleOutput is called, another thread runs and
completes the current call. 'thecall' is then NULL when the first
thread gets to run virNetClientIOHandleOutput.

After describing this situation on IRC, danpb suggested this:

11:37 < danpb> In that case I think the correct thing would be to change
               'return -1' above to 'return 0' since that's not actually an
               error - its a rare, but expected event

which is what this patch is doing. I've tested it against master
libvirt, and I didn't get disconnected in ~10 minutes while this
happens in less than 5 minutes without this patch.

12 years agolist: Expose virStoragePoolListAllVolumes to Python binding
Osier Yang [Tue, 4 Sep 2012 15:32:58 +0000 (23:32 +0800)]
list: Expose virStoragePoolListAllVolumes to Python binding

The implementation is done manually as the generator does not support
wrapping lists of C pointers into Python objects.

python/libvirt-override-api.xml: Document

python/libvirt-override-virStoragePool.py:
  * New file, includes implementation of listAllVolumes.

python/libvirt-override.c: Implementation for the wrapper.

12 years agolist: Use virStoragePoolListAllVolumes in virsh
Osier Yang [Tue, 4 Sep 2012 15:32:57 +0000 (23:32 +0800)]
list: Use virStoragePoolListAllVolumes in virsh

tools/virsh-volume.c:
  * vshStorageVolSorter to sort storage vols by name

  * vshStorageVolumeListFree to free the volume objects list

  * vshStorageVolumeListCollect to collect the volume objects, trying
    to use new API first, fall back to older APIs if it's not supported.

12 years agolist: Implement virStoragePoolListAllVolumes for test driver
Osier Yang [Tue, 4 Sep 2012 15:32:56 +0000 (23:32 +0800)]
list: Implement virStoragePoolListAllVolumes for test driver

src/test/test_driver.c: Implement poolListAllVolumes.

12 years agolist: Implement virStoragePoolListAllVolumes for storage driver
Osier Yang [Tue, 4 Sep 2012 15:32:55 +0000 (23:32 +0800)]
list: Implement virStoragePoolListAllVolumes for storage driver

src/storage/storage_driver.c: Implement poolListAllVolumes.

12 years agolist: Implement RPC calls for virStoragePoolListAllVolumes
Osier Yang [Tue, 4 Sep 2012 15:32:54 +0000 (23:32 +0800)]
list: Implement RPC calls for virStoragePoolListAllVolumes

The RPC generator doesn't returning support list of object, this
patch do the work manually.

  * daemon/remote.c:
    Implemente the server side handler remoteDispatchStoragePoolListAllVolumes

  * src/remote/remote_driver.c:
    Add remote driver handler remoteStoragePoolListAllVolumes

  * src/remote/remote_protocol.x:
    New RPC procedure REMOTE_PROC_STORAGE_POOL_LIST_ALL_VOLUMES and
    structs to represent the args and ret for it.

  * src/remote_protocol-structs: Likewise.