Commit Graph

8629 Commits

Author SHA1 Message Date
Daniel P. Berrange
86b53e59d8 Rewrite LXC I/O forwarding to use main event loop
The current I/O code for LXC uses a hand crafted event loop
to forward I/O between the container & host app, based on
epoll to handle EOF on PTYs. This event loop is not easily
extensible to add more consoles, or monitor other types of
file descriptors.

Remove the custom event loop and replace it with a normal
libvirt event loop. When detecting EOF on a PTY, disable
the event watch on that FD, and fork off a background thread
that does a edge-triggered epoll() on the FD. When the FD
finally shows new incoming data, the thread re-enables the
watch on the FD and exits.

When getting EOF from a read() on the PTY, the existing code
would do waitpid(WNOHANG) to see if the container had exited.
Unfortunately there is a race condition, because even though
the process has closed its stdio handles, it might still
exist.

To deal with this the new event loop uses a SIG_CHILD handler
to perform the waitpid only when the container is known to
have actually exited.

* src/lxc/lxc_controller.c: Rewrite the event loop to use
  the standard APIs.
2011-11-03 12:01:12 +00:00
Daniel P. Berrange
5990d92192 Fix crash formatting virtio console
qemuBuildVirtioSerialPortDevStr was mistakenly accessing the
target.name field in the virDomainChrDef object for chardevs
belonging to a console. Those chardevs only have port set,
and if there's > 1 console, the > 1port number results in
trying to access a target.name with address 0x1

* src/qemu/qemu_command.c: Fix target.name handling and
  make code more robust wrt error reporting

* src/qemu/qemu_command.c: Conditionally access target.name
2011-11-03 12:01:12 +00:00
Daniel P. Berrange
0873b688c6 Allow multiple consoles per virtual guest
While Xen only has a single paravirt console, UML, and
QEMU both support multiple paravirt consoles. The LXC
driver can also be trivially made to support multiple
consoles. This patch extends the XML to allow multiple
<console> elements in the XML. It also makes the UML
and QEMU drivers support this config.

* src/conf/domain_conf.c, src/conf/domain_conf.h: Allow
  multiple <console> devices
* src/lxc/lxc_driver.c, src/xen/xen_driver.c,
  src/xenxs/xen_sxpr.c, src/xenxs/xen_xm.c: Update for
  internal API changes
* src/security/security_selinux.c, src/security/virt-aa-helper.c:
  Only label consoles that aren't a copy of the serial device
* src/qemu/qemu_command.c, src/qemu/qemu_driver.c,
  src/qemu/qemu_process.c, src/uml/uml_conf.c,
  src/uml/uml_driver.c: Support multiple console devices
* tests/qemuxml2xmltest.c, tests/qemuxml2argvtest.c: Extra
  tests for multiple virtio consoles. Set QEMU_CAPS_CHARDEV
  for all console /channel tests
* tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.args,
  tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args
  tests/qemuxml2argvdata/qemuxml2argv-console-virtio.args: Update
  for correct chardev syntax
* tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.args,
  tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml: New
  test file
2011-11-03 12:01:05 +00:00
Daniel P. Berrange
b0a510ad2a Remove translations in socket test case
The test case errors should not be translated since they're only
targetted at developers, not users.

* tests/virnetsockettest.c: Remove error reporting with translations
2011-11-03 10:52:44 +00:00
Guido Günther
745c3e7981 virnetsockettest: Use a temporary directory in /tmp
to avoid exceeding UNIX_PATH_MAX
2011-11-03 09:04:11 +01:00
Guido Günther
6bab30d071 Use ENAMETOOLONG if the the socket path is longer than UNIX_PATH_MAX 2011-11-02 23:01:52 +01:00
Eric Blake
fbae3d6f9e xen: allow getting < max typed parameters
Allow the user to call with nparams too small, per API documentation.

* src/xen/xen_hypervisor.c (xenHypervisorGetSchedulerParameters):
Allow fewer than max.
* src/xen/xend_internal.c (xenDaemonGetSchedulerParameters):
Likewise.
2011-11-02 14:11:44 -06:00
Eric Blake
6d897fc671 test: drop redundant check
libvirt.c guarantees that nparams is non-zero for scheduler parameters.

* src/test/test_driver.c (testDomainGetSchedulerParamsFlags): Drop
redundant check.  Avoid strcpy.
2011-11-02 14:11:36 -06:00
Eric Blake
f4e584decf lxc: allow getting < max typed parameters
Allow the user to call with nparams too small, per API documentation.
Also, libvirt.c filters out nparams of 0 for scheduler parameters.

* src/lxc/lxc_driver.c (lxcDomainGetMemoryParameters): Allow fewer
than max.
(lxcGetSchedulerParametersFlags): Drop redundant check.
2011-11-02 14:00:13 -06:00
Eric Blake
1367954702 libxl: allow getting < max typed parameters
Allow the user to call with nparams too small, per API documentation.

* src/libxl/libxl_driver.c
(libxlDomainGetSchedulerParametersFlags): Allow fewer than max.
2011-11-02 14:00:13 -06:00
Eric Blake
6b98a4b2e6 esx: allow getting < max typed parameters
Allow the user to call with nparams too small, per API documentation.

* src/esx/esx_driver.c (esxDomainGetMemoryParameters): Drop
redundant check.
(esxDomainGetSchedulerParametersFlags): Allow fewer than max.
2011-11-02 14:00:13 -06:00
Eric Blake
319992d4b6 API: document scheduler parameter names
Document the parameter names that will be used by
virDomain{Get,Set}SchedulerParameters{,Flags}, rather than
hard-coding those names in each driver, to match what is
done with memory, blkio, and blockstats parameters.

* include/libvirt/libvirt.h.in (VIR_DOMAIN_SCHEDULER_CPU_SHARES)
(VIR_DOMAIN_SCHEDULER_VCPU_PERIOD)
(VIR_DOMAIN_SCHEDULER_VCPU_QUOTA, VIR_DOMAIN_SCHEDULER_WEIGHT)
(VIR_DOMAIN_SCHEDULER_CAP, VIR_DOMAIN_SCHEDULER_RESERVATION)
(VIR_DOMAIN_SCHEDULER_LIMIT, VIR_DOMAIN_SCHEDULER_SHARES): New
field name macros.
* src/qemu/qemu_driver.c (qemuSetSchedulerParametersFlags)
(qemuGetSchedulerParametersFlags): Use new defines.
* src/test/test_driver.c (testDomainGetSchedulerParamsFlags)
(testDomainSetSchedulerParamsFlags): Likewise.
* src/xen/xen_hypervisor.c (xenHypervisorGetSchedulerParameters)
(xenHypervisorSetSchedulerParameters): Likewise.
* src/xen/xend_internal.c (xenDaemonGetSchedulerParameters)
(xenDaemonSetSchedulerParameters): Likewise.
* src/lxc/lxc_driver.c (lxcSetSchedulerParametersFlags)
(lxcGetSchedulerParametersFlags): Likewise.
* src/esx/esx_driver.c (esxDomainGetSchedulerParametersFlags)
(esxDomainSetSchedulerParametersFlags): Likewise.
* src/libxl/libxl_driver.c (libxlDomainGetSchedulerParametersFlags)
(libxlDomainSetSchedulerParametersFlags): Likewise.
2011-11-02 13:52:56 -06:00
Daniel P. Berrange
26b7430773 Fix off-by-one printing month in logging code
The field 'mon' in 'struct tm' gives months 0-11, where as
humans tend to expect months 1-12. Thus the month number
needing adjusting by 1

* src/util/logging.c: Use human friendly month number
2011-11-02 14:55:35 +00:00
Daniel P. Berrange
f4786c1885 Add missing param initialization in qemuDomainBlockStatsFlags
* src/qemu/qemu_driver.c: Fix use of uninitialized 'params'
2011-11-02 14:55:03 +00:00
Wen Congyang
7ab1c25cc5 fix crash when starting network
commit 27908453 introduces a regression, and it will
cause libvirt crashed when starting network.

The reason is that tapfd may be NULL, but we dereference
it without checking whether it is NULL.
2011-11-02 22:21:59 +08:00
Eric Blake
97656536e7 qemu: allow getting < max typed parameters
Since all virTypedParameter APIs allow us to return the number
of slots we actually populated, we should allow the user to
call with nparams too small (without overrunning their array)
or too large (ignoring the tail of the array that we can't fill),
rather than requiring that they get things exactly right.

Making this change will make it easier for a future patch to
introduce VIR_TYPED_PARAM_STRING, with filtering in libvirt.c
rather than in every single driver, since users already have
to be prepared for *nparams to be smaller on exit than on entry.

* src/qemu/qemu_driver.c (qemuDomainGetBlkioParameters)
(qemuDomainGetMemoryParameters): Allow variable nparams on entry.
(qemuGetSchedulerParametersFlags): Drop redundant check.
(qemudDomainBlockStats, qemudDomainBlockStatsFlags): Rename...
(qemuDomainBlockStats, qemuDomainBlockStatsFlags): ...to this.
Don't return unavailable stats.
2011-11-01 13:20:48 -06:00
Eric Blake
5465bc0c87 docs: improve typed parameter documentation
virDomainBlockStatsFlags was missing a check that was present in
virDomainGetMemoryParameters.  Additionally, I found that the
existing descriptions were a bit hard to read.  A later patch
will fix qemu to return fewer than max parameters if @nparams
was too small on input.

* src/libvirt.c (virDomainGetMemoryParameters)
(virDomainGetBlkioParameters, virDomainGetSchedulerParameters)
(virDomainGetSchedulerParametersFlags):
Tweak documentation wording.
(virDomainBlockStatsFlags): Likewise, and add sanity check.
2011-11-01 13:20:48 -06:00
Daniel P. Berrange
9d201a5c22 Don't overwrite error message during VM cleanup
If an LXC VM fails to start, quite a few cleanup paths will
result in the original error message being overwritten. Some
other cleanup paths also forgot to actually terminate the VM.

* src/lxc/lxc_driver.c: Ensure VM is terminated on startup
  failure and preserve original error
2011-11-01 18:40:37 +00:00
Daniel P. Berrange
26798492e3 Add support for probing filesystem with libblkid
The LXC code for mounting container filesystems from block devices
tries all filesystems in /etc/filesystems and possibly those in
/proc/filesystems. The regular mount binary, however, first tries
using libblkid to detect the format. Add support for doing the same
in libvirt, since Fedora's /etc/filesystems is missing many formats,
most notably ext4 which is the default filesystem Fedora uses!

* src/Makefile.am: Link libvirt_lxc to libblkid
* src/lxc/lxc_container.c: Probe filesystem format with libblkid
2011-11-01 18:40:37 +00:00
Daniel P. Berrange
6828535669 Fix error message when failing to detect filesystem
If we looped through /etc/filesystems trying to mount with each
type and failed all options, we forget to actually raise an
error message.

* src/lxc/lxc_container.c: Raise error if unable to detect
  the filesystems. Also fix existing error message
2011-11-01 18:40:37 +00:00
Daniel P. Berrange
878cc33a6a Workaround for broken kernel autofs mounts
The kernel automounter is mostly broken wrt to containers. Most
notably if you start a new filesystem namespace and then attempt
to unmount any autofs filesystem, it will typically fail with a
weird error message like

  Failed to unmount '/.oldroot/sys/kernel/security':Too many levels of symbolic links

Attempting to detach the autofs mount using umount2(MNT_DETACH)
will also fail with the same error. Therefore if we get any error on
unmount()ing a filesystem from the old root FS when starting a
container, we must immediately break out and detach the entire
old root filesystem (ignoring any mounts below it).

This has the effect of making the old root filesystem inaccessible
to anything inside the container, but at the cost that the mounts
live on in the kernel until the container exits. Given that SystemD
uses autofs by default, we need LXC to be robust this scenario and
thus this tradeoff is worthwhile.

* src/lxc/lxc_container.c: Detach root filesystem if any umount
  operation fails.
2011-11-01 18:40:37 +00:00
Daniel P. Berrange
a02f57faa9 Correctly handle '*' in /etc/filesystems
The /etc/filesystems file can contain a '*' on the last line to
indicate that /proc/filessystems should be tried next. We have
a check that this '*' only occurs on the last line. Unfortunately
when we then start reading /proc/filesystems, we mistakenly think
we've seen '*' in /proc/filesystems and fail

* src/lxc/lxc_container.c: Skip '*' validation when we're reading
  /proc/filesystems
2011-11-01 18:40:37 +00:00
Daniel P. Berrange
065ecf5162 Ensure errno is valid when returning from lxcContainerWaitForContinue
Only some of the return paths of lxcContainerWaitForContinue will
have set errno. In other paths we need to set it manually to avoid
the caller getting a random stale errno value

* src/lxc/lxc_container.c: Set errno in lxcContainerWaitForContinue
2011-11-01 18:40:37 +00:00
Daniel P. Berrange
f33b5792f7 Create /var/lib/libvirt/filesystems for LXC trees
We already have a /var/lib/libvirt/images for OS install images.
We need a separate /var/lib/libvirt/filesystems for OS install
trees, since SELinux labelling will be different

* libvirt.spec.in: Add /var/lib/libvirt/filesystems
* src/Makefile.am: Create /var/lib/libvirt/filesystems
2011-11-01 18:40:37 +00:00
Matthias Bolte
23247a1efd esx: Support folders in the path of vpx:// connection URIs
Allow the datacenter and compute resource parts of the path
to be prefixed with folders. Therefore, the way the path is
parsed has changed. Before, it was split in 2 or 3 items and
the items' meanings were determined by their positions. Now
the path can have 2 or more items and the the vCenter server
is asked whether a folder, datacenter of compute resource
with the specified name exists at the current hierarchy level.

Before the datacenter and compute resource lookup automatically
traversed folders during lookup. This is logic got removed
and folders have to be specified explicitly.

The proper datacenter path including folders is now used when
accessing a datastore over HTTPS. This makes virsh dumpxml
and define work for datacenters in folders.

https://bugzilla.redhat.com/show_bug.cgi?id=732676
2011-11-01 18:45:42 +01:00
Patrice LACHANCE
5759a5ccb5 esx: Support vSphere 5.x
And virtual hardware version 8.
2011-11-01 18:00:34 +01:00
Wen Ruo Lv
8bec4ff2f1 Fix URI alias prefix matching
with /etc/libvirt/libvirt.conf below:
uri_aliases = [
  "hail=qemu:///system",
  "sleet=qemu+ssh://root 9 115 122 57/system",
  "sam=qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock",
]
Neither "virsh -c hailly" nor "hai" should result in matching "hail=qemu:///system"

Fix URI alias prefix matching when connecting

Signed-off-by: Wen Ruo Lv <lvroyce@linux.vnet.ibm.com>
2011-11-01 10:47:35 -06:00
Eric Blake
20e4e9872d docs: fix typo in <disk>/<target> example
* docs/formatdomain.html.in: Use dev, not def.
Reported by Alexander Biryukov.
2011-11-01 10:39:48 -06:00
Michal Privoznik
b7b5e0c833 ServerClient: Flush cached data
If daemon is using SASL it reads client data into a cache. This cache is
big (usually 65KB) and can thus contain 2 or more messages. However,
on socket event we can dispatch only one message. So if we read two
messages at once, the second will not be dispatched as the socket event
goes away with filling the cache.
Moreover, when dispatching the cache we need to remember to take care
of client max requests limit.
2011-11-01 15:58:05 +01:00
Daniel P. Berrange
c85013b90d Fix storage pool source comparison to avoid comparing with self
If we are comparing storage pools we must skip comparing with
ourself, so that re-defining an existing pool works

* conf/storage_conf.c: Skip self when comparing
2011-11-01 11:13:29 +00:00
Sage Weil
243f185742 qemu: pass virConnectPtr into Domain{Attach,Detach}*
The qemu RBD driver needs access to the conn in order to get the secret
needed for connecting to the ceph cluster.

Signed-off-by: Sage Weil <sage@newdream.net>
2011-10-31 13:13:29 -06:00
Alex Jia
381de90375 qemu: plug memory leak
Detected by Coverity. Leak introduced in commit 6cabc0b.

* src/qemu/qemu_command.c: Clean up on failure.

Signed-off-by: Alex Jia <ajia@redhat.com>
2011-10-31 11:20:30 -06:00
Matthias Bolte
d3505ba895 python: Fix documentation of virStream recv
This was fixed in be757a3f7b for libvirt.c.
2011-10-31 18:07:05 +01:00
Michal Privoznik
457d46ca8c startupPolicty: Minor cleanups
This patch does some cleanups to my previous startupPolicy patchset.
2011-10-31 15:25:09 +01:00
Osier Yang
d84b36263c qemu: Restore the original states of PCI device when restarting daemon
To support "managed" mode of host PCI device, we record the original
states (unbind_from_stub, remove_slot, and reprobe) so that could
reattach the device to host with original driver. But there is no XML
for theses attrs, and thus after daemon is restarted, we lose the
original states. It's easy to reproduce:

    1) virsh start domain
    2) virsh attach-device dom hostpci.xml (in 'managed' mode)
    3) service libvirtd restart
    4) virsh destroy domain

    You will see the device won't be bound to the original driver
if there was one.

This patch is to solve the problem by introducing internal XML
(won't be dumped to user, only dumped to status XML). The XML is:
    <origstates>
      <unbind/>
      <remove_slot/>
      <reprobe/>
    </origstates>

Which will be child node of <hostdev><source>...</souce></hostdev>.
(only for PCI device).

A new struct "virDomainHostdevOrigStates" is introduced for the XML,
and the according members are updated when preparing the PCI device.
And function "qemuUpdateActivePciHostdevs" is modified to honor
the original states. Use of qemuGetPciHostDeviceList is removed
in function "qemuUpdateActivePciHostdevs", and the "managed" value of
the device config is honored by the change. This fixes another problem
alongside:

    qemuGetPciHostDeviceList set the device as "managed" force
    regardless of whether the device is configured as "managed='yes'"
    or not in XML, which is not right.
2011-10-30 13:00:06 +08:00
Matthias Bolte
73ce5050e0 vbox: Add support for VirtualBox 4.1
Deal with the incompatible changes in the VirtualBox 4.1 API.

INetworkAdapter has its different AttachTo* method replaced by
a settable attachmentType property.

The maximum number of network adapters is now requestable per
chipset type.

The OpenMedium method got a bool parameter to request opening
a medium under a new IID.
2011-10-29 21:26:57 +02:00
Matthias Bolte
96f28f7f10 vbox: Support shared folders
Shared folders are handled as filesystems and can also be hotplugged.
2011-10-29 19:50:48 +02:00
Matthias Bolte
484460ec46 xenapi: Improve error reporting in xenapiOpen once again
privP->session->error_description is a list and in order to get the
complete error message all parts of the list should be concatenated.
xenapiSessionErrorHandler does this when its third parameter is NULL.
The current code discards all but the first part of the error message
resulting in a potentially incomplete error message.

This partly reverts 006be75ee2, that tried to avoid reporting
a (null) in the error message. The actual problem is more general in
returnErrorFromSession that might return NULL if there is no error.

Make sure that returnErrorFromSession return non-NULL always. Also
don't skip the last error message part.
2011-10-29 18:42:02 +02:00
Roopa Prabhu
228a9ec312 macvtap: Fix error return value convention/inconsistencies
- changed some return 1's to return -1
- changed if (rc) error checks to if (rc < 0)
- fixed some other minor convention violations

I might have missed some. Can fix in another patch or can respin

Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Reported-by: Eric Blake <eblake@redhat.com>
Reported-by: Laine Stump <laine@laine.org>
Signed-off-by: Eric Blake <eblake@redhat.com>
2011-10-28 16:47:28 -06:00
Josh Durgin
7e02076624 Use a common xml type for ceph secret usage.
The types used in domaincommon.rng and secret.rng should be the same.

Move genericName to basictypes.rng, then drop redundant types now
that secret.rng uses basictypes.rng.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2011-10-28 16:01:14 -06:00
Xu He Jie
5fb0de2e4d pci address conflict when virtio disk with drive type
When using the xml as below:
------------------------------------------------------
<devices>
  <emulator>/home/soulxu/data/work-code/qemu-kvm/x86_64-softmmu/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
    <driver name='qemu' type='qcow2'/>
    <source file='/home/soulxu/data/VM/images/linux.img'/>
    <target dev='vda' bus='virtio'/>
    <address type='drive' controller='0' bus='0' unit='0'/>
  </disk>
  <input type='mouse' bus='ps2'/>
  <graphics type='vnc' port='-1' autoport='yes'/>
  <video>
    <model type='cirrus' vram='9216' heads='1'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
  </video>
  <memballoon model='virtio'>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
  </memballoon>
</devices>
------------------------------------------------------

Then can't startup qemu, the error message as below:
virsh # start test-vm
error: Failed to start domain test-vm
error: internal error process exited while connecting to monitor: qemu-system-x86_64: -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3: PCI: slot 3 function 0 not available for virtio-balloon-pci, in use by virtio-blk-pci
qemu-system-x86_64: -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3: Device 'virtio-balloon-pci' could not be initialized

So adding check for bus type and address type. Only the address of pci type support by virtio bus.

Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com>
2011-10-28 13:45:00 -06:00
Eric Blake
44477c57be secret: fix bad patch application
In hand-applying Josh and Sage's patch, I missed out on a break.

* src/conf/secret_conf.c (virSecretDefFree): Fix my botch.
2011-10-28 12:55:04 -06:00
Josh Durgin
5bd6271f59 storage: add auth to virDomainDiskDef
Add additional fields to let you specify the how to authenticate with a disk.
The secret to use may be referenced by a usage string or a UUID, i.e.:

<auth username='myuser'>
 <secret type='ceph' usage='secretname'/>
</auth>

or

<auth username='myuser'>
 <secret type='ceph' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/>
</auth>

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
2011-10-28 12:51:22 -06:00
Sage Weil
536d1f8746 secret: add Ceph secret type
Add a new secret type to store a Ceph authentication key. The name
is simply an identifier for easy human reference.

The xml looks like this:

<secret ephemeral='no' private='no'>
 <uuid>0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f</uuid>
 <usage type='ceph'>
   <name>mycluster_admin</name>
 </usage>
</secret>

Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.net>
2011-10-28 11:34:17 -06:00
Alex Jia
87b7e148e9 qemu: plug memory leak
Leak introduced in commit c1bc3d89.
Detected by valgrind:

==18462== 1,100 bytes in 1 blocks are definitely lost in loss record 183 of 184
==18462==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==18462==    by 0x4A06167: realloc (vg_replace_malloc.c:525)
==18462==    by 0x4AADBB: virReallocN (memory.c:161)
==18462==    by 0x4A975E: virBufferGrow (buf.c:117)
==18462==    by 0x4A9D92: virBufferVasprintf (buf.c:290)
==18462==    by 0x4A9EF7: virBufferAsprintf (buf.c:263)
==18462==    by 0x429488: qemuBuildControllerDevStr (qemu_command.c:1993)
==18462==    by 0x42C4B6: qemuBuildCommandLine (qemu_command.c:3803)
==18462==    by 0x41A604: testCompareXMLToArgvHelper (qemuxml2argvtest.c:124)
==18462==    by 0x41BB81: virtTestRun (testutils.c:141)
==18462==    by 0x416DFF: mymain (qemuxml2argvtest.c:369)
==18462==    by 0x41B277: virtTestMain (testutils.c:696)
==18462==
==18462== LEAK SUMMARY:
==18462==    definitely lost: 1,100 bytes in 1 blocks
==18462==    indirectly lost: 0 bytes in 0 blocks

* src/qemu/qemu_command.c (qemuBuildCommandLine): Clean up on success.

Signed-off-by: Alex Jia <ajia@redhat.com>
2011-10-28 10:22:49 -06:00
Eric Blake
a4ca6e5d0f qemu: avoid leaking uninit data from hotplug to dumpxml
Detected by Coverity.  The fix in 2c27dfa didn't catch all bad
instances of memcpy().  Thankfully, on further analysis, all of
the problematic uses are only triggered by old qemu that lacks
-device.

* src/qemu/qemu_hotplug.c (qemuDomainAttachPciDiskDevice)
(qemuDomainAttachNetDevice, qemuDomainAttachHostPciDevice): Init
all fields since monitor only populates some of them.
2011-10-28 09:12:55 -06:00
Ryota Ozaki
884b98add5 util: Fix virUUIDGeneratePseudoRandomBytes
It forgets to move a pointer to a buffer for UUID and as a result
fills only the first byte of the buffer.
2011-10-28 08:54:34 -06:00
Daniel P. Berrange
d442599a80 Implement RPC driver support for virDomainOpenGraphics
Since it needs to access file descriptors passed in the msg,
the RPC driver for virDomainOpenGraphics needs to be manually
implemented.

* daemon/remote.c: RPC server dispatcher
* src/remote/remote_driver.c: RPC client dispatcher
* src/remote/remote_protocol.x: Define protocol
2011-10-28 10:43:00 +01:00
Daniel P. Berrange
3ae0ab67e6 Extend RPC server to allow FD passing
The RPC server classes are extended to allow FDs to be received
from clients with calls. There is not currently any way for a
procedure to pass FDs back to the client with replies

* daemon/remote.c, src/rpc/gendispatch.pl: Change virNetMessageHeaderPtr
  param to virNetMessagePtr in dispatcher impls
* src/rpc/virnetserver.c, src/rpc/virnetserverclient.c,
  src/rpc/virnetserverprogram.c, src/rpc/virnetserverprogram.h:
  Extend to support FD passing
2011-10-28 10:43:00 +01:00
Daniel P. Berrange
36a9c83de4 Add client side support for FD passing
Extend the RPC client code to allow file descriptors to be sent
to the server with calls, and received back with replies.

* src/remote/remote_driver.c: Stub extra args
* src/libvirt_private.syms, src/rpc/virnetclient.c,
  src/rpc/virnetclient.h, src/rpc/virnetclientprogram.c,
  src/rpc/virnetclientprogram.h: Extend APIs to allow
  FD passing
2011-10-28 10:42:54 +01:00