[libvirt] [PATCH]: Fix allocation of tapfds when starting qemu
by Chris Lalancette
All,
When doing the conversion to danpb's new memory API, a small bug was
introduced into the qemudNetworkIfaceConnect() function. In particular, there
is a call:
if (VIR_ALLOC_N(vm->tapfds, vm->ntapfds+2) < 0)
goto no_memory;
However, the tapfds structure is used to track *all* of the tap fds, and is
called once for each network that is being attached to the domain. VIR_ALLOC_N
maps to calloc(). So the first network would work just fine, but if you had
more than one network, subsequent calls to this function would blow away the
stored fd's that were already there and fill them all in with zeros. This
causes multiple problems, from the qemu domains not starting properly to
improper cleanup on shutdown. The attached patch just changes the VIR_ALLOC_N()
to a VIR_REALLOC_N(), and everything is happy again.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
16 years, 6 months
[libvirt] [PATCH]: Fix VIR_ALLOC_N for 0 byte arrays
by Chris Lalancette
Hello,
For 0.4.3, danpb's new memory management scheme went into libvirt. This is
fine, except that is subtly alters the semantics of malloc(), calloc(), and
realloc(). In particular, if you say:
foo = malloc(0);
glibc will happily return a non-NULL pointer to you. However, with the new
memory management stuff, if you say:
foo = VIR_ALLOC(0);
you will actually get a NULL pointer back. Personally, I think this is a
dangerous deviation from malloc() semantics that everyone is used to, and is
indeed causing problems with the remote driver. The short of it is that the
remote driver allocates memory on behalf of the remote side using VIR_ALLOC_N,
and this call is returning NULL so that the NULL checks elsewhere in the code
fire and return failure.
The attached patch fixes this situation by removing the 0 checks from the memory
allocation paths, and just lets them fall through to the normal malloc(),
calloc(), or realloc() routines, restoring old semantics.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
16 years, 6 months
[libvirt] How does libvirt access kvm infomation?
by Akio Takebe
Hi,
AFAIK kvm has only an interface of qemu console when we use device
hotplug, migration and so on. How does libvirt access the interface
of qemu console?
Best Regards,
Akio Takebe
16 years, 6 months
[libvirt] [PATCH 5/5]: Rewrite findLuns function
by Chris Lalancette
This rather large patch rewrites the virStorageBackendISCSIFindLUNs() function
to only rely on sysfs for finding LUNs, given a session number. Along the way,
it also fixes the bug where we wouldn't find LUNs for older kernels (with the
block:sda format), and also (possibly) fixes a race condition where we could try
to find the LUN before udev has finished connecting it. I say it "possibly"
fixes it because I haven't been able to hit it so far, but I definitely need
more testing to try and confirm.
Changes since last time:
1) Don't blindly ignore the 0'th LUN (thanks Stefan). Instead, look if the
LUNs are Direct-Access devices (as defined by the kernel); if so, they are LUNs
we can use.
2) Fix up whitespace damage.
3) Check the return value of the scsidev strdup as pointed out by Jim.
4) Change all ISCSIADM commands to be const char *const as pointed out by Jim.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
16 years, 6 months
[libvirt] [PATCH 4/5]: Move the sendtarget command into the login command
by Chris Lalancette
A small bugfix; we only need to call the iscsiadm sendtarget command when we are
first logging in; we don't need to do it for logout. Move the sendtarget
command into the Login() function.
Changes since last time:
1) Make const char *cmdsendtarget into const char *const cmdsendtarget based on
feedback from Jim.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
16 years, 6 months
[libvirt] [PATCH 3/5]: Fix up the call to iscsiadm --mode session
by Chris Lalancette
Older versions of iscsiadm didn't support the "-P 0" flag to the "iscsiadm
--mode session" command. However, just running "iscsiadm --mode session" seems
to work on all version of iscsiadm commands back to FC-6, so just use that.
Changes since last time:
None
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
16 years, 6 months