[libvirt] [PATCH] vbox: avoid provoking assertions in VBoxSVC
by Jean-Baptiste Rouault
Passing a NULL pointer to IMachine::delete virtualbox API
causes VBoxSVC to raise an assertion. This patch passes
an empty array instead.
---
src/vbox/vbox_tmpl.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 68e3b05..be25828 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -5294,7 +5294,8 @@ vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags)
((IMachine_Delete)machine->vtbl->Delete)(machine, &safeArray, &progress);
# else
- machine->vtbl->Delete(machine, 0, NULL, &progress);
+ vboxArray array = VBOX_ARRAY_INITIALIZER;
+ machine->vtbl->Delete(machine, 0, (IMedium**)&array, &progress);
# endif
if (progress != NULL) {
progress->vtbl->WaitForCompletion(progress, -1);
--
1.7.9.1
13 years
[libvirt] [PATCH] win32: Properly handle TlsGetValue returning NULL
by Matthias Bolte
virThreadSelf tries to access the virThreadPtr stored in TLS for the
current thread via TlsGetValue. When virThreadSelf is called on a thread
that was not created via virThreadCreate (e.g. the main thread) then
TlsGetValue returns NULL as TlsAlloc initializes TLS slots to NULL.
virThreadSelf can be called on the main thread via this call chain from
virsh
vshDeinit
virEventAddTimeout
virEventPollAddTimeout
virEventPollInterruptLocked
virThreadIsSelf
triggering a segfault as virThreadSelf unconditionally dereferences the
return value of TlsGetValue.
Fix this by making virThreadSelf check the TLS slot value for NULL and
setting the given virThreadPtr accordingly.
Reported by Marcel Müller.
---
src/util/threads-win32.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/util/threads-win32.c b/src/util/threads-win32.c
index 157439c..20756a1 100644
--- a/src/util/threads-win32.c
+++ b/src/util/threads-win32.c
@@ -316,8 +316,15 @@ int virThreadCreate(virThreadPtr thread,
void virThreadSelf(virThreadPtr thread)
{
virThreadPtr self = TlsGetValue(selfkey);
- thread->thread = self->thread;
- thread->joinable = self->joinable;
+
+ if (self == NULL) {
+ /* called on a thread not created by virThreadCreate, e.g. the main thread */
+ thread->thread = 0;
+ thread->joinable = false;
+ } else {
+ thread->thread = self->thread;
+ thread->joinable = self->joinable;
+ }
}
bool virThreadIsSelf(virThreadPtr thread)
--
1.7.4.1
13 years
[libvirt] Python binding APIs strict or loose
by Guannan Ren
Hi
There is a question. we need strict python binding API
or loose one.
For example:
The setSchedulerParameters(), it accepts one of
parameters: 'vcpu_quota'
In C its type is of 'long long', then we need a
conversion from PyInt/PyLong
to 'long long' by using cpython function
'PyLong_AsLongLong'.
The problem is when the user python pass in a value of
type Pyfloat instead
of PyInt/PyLong, the cpython function drops the
fraction part of the value
automatically, Is it what we want or we need to add a
type checking to ensure that
the type of value passed in is PyInt/PyLong, otherwise,
we raise an exception.
> >> dom.schedulerParameters()
{'vcpu_quota': -1L, 'vcpu_period': 100000L,
'cpu_shares': 500L}
> >> dom.setSchedulerParameters({'vcpu_quota': 10.88})
works as dom.setSchedulerParameters({'vcpu_quota': 10})
Any idea?
Guannan Ren
13 years
[libvirt] [PATCH] Win32 compatibility for 0.9.11
by Marcel Müller
Hello everyone,
I tried to build libvirt-0.9.11 for Windows using the MSYS Build Script
provided by Matthias Bolte and noticed that there were two problems which
made libvirt unusable.
1) Whenever a TCP Connection is opened, libvirt will fail with failed
to set close-on-exec (Im using xen+tcp here).
2) The lib will crash most of the time, because it tries to access a
null pointer.
I fixed both issues with a little patch:
1) On Win32 platforms virSetInherit always returns -1, therefore
failing any call which tries to set close-on-exec. I dont know if theres
a Win32 equivalent of close-on-exec, so I just set this to return 0
instead.
2) Libvirt crashes, because TlsGetValue seems to return a NULL value
sometimes. Not sure right now, if this is ok in a way or if it indicates
another problem somewhere... (This might be the case, as Im experience
crashes as soon as libvirt is used in a multithreading application, though I
had this with an old version as well. Will discuss that in another mail).
As this is my first mail to a mailing list, please dont hesitate to tell
me, what I did wrong!
By the way, should I attach the binaries for 0.9.11 in case anyone is
looking for those without the need to compile them?
Best Regards,
Marcel
13 years
[libvirt] ESX driver connection private data fix
by ryan woodsmall
Hi, first time poster, my apologies if this is not the correct avenue.
Since release 0.9.11, I've been getting a segfault in virsh attempting
to access an ESXi 4.1 host. GDB reports it as such:
**
Program received signal SIGSEGV, Segmentation fault.
esxConnectToHost (vCenterIpAddress=0x7fffffffd640,
auth=0x7ffff7fef5e0, conn=0x675780) at esx/esx_driver.c:726
726 if (virAsprintf(&url, "%s://%s:%d/sdk", priv->parsedUri->transport,
(gdb) bt
#0 esxConnectToHost (vCenterIpAddress=0x7fffffffd650,
auth=0x7ffff7fef5e0, conn=0x675780) at esx/esx_driver.c:726
#1 esxOpen (conn=0x675780, auth=0x7ffff7fef5e0, flags=<optimized
out>) at esx/esx_driver.c:1052
#2 0x00007ffff7bc243a in do_open (name=0x6745a0
"esx://XXX/?no_verify=1", auth=0x7ffff7fef5e0, flags=0) at
libvirt.c:1227
#3 0x00007ffff7bc48e6 in virConnectOpenAuth (name=0x6745a0
"esx://XXX/?no_verify=1", auth=0x7ffff7fef5e0, flags=0) at
libvirt.c:1456
#4 0x000000000040ac8f in vshInit (ctl=0x7fffffffe210) at virsh.c:19288
#5 main (argc=<optimized out>, argv=0x7fffffffe508) at virsh.c:20046
**
Digging through the code a bit, I found that in esxOpen(), the "conn"
virConnectPtr var is passed to esxConnectToHost() with a nil pointer
to a virConnect "privateData" pointer. The hypervisor transport type
(among other things in "parsedUri") is stored here, and a
crash/segfault occurs in esxConnectToHost() when attempting to access
the transport for virAsprintf() at line 726 of src/esx/esx_driver.c.
This patch just makes sure we're pointing to something before
attempting to use anything in the struct.
Cleanly applied to git from this afternoon, built and successfully
tested on a Fedora 16/x86_64 VM accessing an ESXi 4.1 node.
--
ryan woodsmall
rwoodsmall(a)gmail.com
13 years
[libvirt] [PATCH v4 0/9] Add basic driver for Parallels Virtuozzo Server
by Dmitry Guryanov
Parallels Virtuozzo Server is a cloud-ready virtualization
solution that allows users to simultaneously run multiple virtual
machines and containers on the same physical server.
Current name of this product is Parallels Server Bare Metal and
more information about it can be found here -
http://www.parallels.com/products/server/baremetal/sp/.
This driver will work with PVS version 6.0 , beta version
scheduled at 2012 Q2.
changes in v4:
* fix errors, found by 'make syntax-check'
Dmitry Guryanov (9):
pvs: add driver skeleton
util: add functions for interating over json object
pvs: add functions to list domains and get info
pvs: implement functions for domain life cycle management
pvs: get info about serial ports
pvs: add support of VNC remote display
pvs: implement virDomainDefineXML operation for existing domains
pvs: add storage driver
pvs: implement VM creation
AUTHORS | 1 +
cfg.mk | 1 +
configure.ac | 23 +
docs/drvpvs.html.in | 28 +
include/libvirt/virterror.h | 1 +
libvirt.spec.in | 7 +
mingw32-libvirt.spec.in | 6 +
po/POTFILES.in | 3 +
src/Makefile.am | 23 +
src/conf/domain_conf.c | 3 +-
src/conf/domain_conf.h | 1 +
src/driver.h | 1 +
src/libvirt.c | 12 +
src/pvs/pvs_driver.c | 1280 +++++++++++++++++++++++++++++++++++++
src/pvs/pvs_driver.h | 75 +++
src/pvs/pvs_storage.c | 1458 +++++++++++++++++++++++++++++++++++++++++++
src/pvs/pvs_utils.c | 143 +++++
src/util/json.c | 30 +
src/util/json.h | 4 +
src/util/virterror.c | 3 +
20 files changed, 3102 insertions(+), 1 deletions(-)
create mode 100644 docs/drvpvs.html.in
create mode 100644 src/pvs/pvs_driver.c
create mode 100644 src/pvs/pvs_driver.h
create mode 100644 src/pvs/pvs_storage.c
create mode 100644 src/pvs/pvs_utils.c
13 years
[libvirt] [libvirt-glib 1/2] Update Libvirt-gconfig-docs.xml
by Christophe Fergeau
It was missing most classes in the GVirConfig namespace.
---
docs/libvirt-gconfig/Libvirt-gconfig-docs.xml | 67 ++++++++++++++++++++++---
1 file changed, 60 insertions(+), 7 deletions(-)
diff --git a/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml b/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml
index 9719734..a05c3f3 100644
--- a/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml
+++ b/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml
@@ -9,24 +9,77 @@
<title>Libvirt-gconfig Reference Manual</title>
</bookinfo>
- <chapter>
+ <part>
<title>Libvirt-gconfig</title>
<xi:include href="xml/libvirt-gconfig-object.xml"/>
- <xi:include href="xml/libvirt-gconfig-domain.xml"/>
+ <chapter>
+ <title>Domain configuration</title>
+ <xi:include href="xml/libvirt-gconfig-domain-address-pci.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-address-usb.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-address.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-channel.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-chardev.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-chardev-source.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-chardev-source-pty.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-chardev-source-spicevmc.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-clock.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-console.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-controller.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-controller-usb.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-device.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-disk.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-filesys.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-graphics.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-graphics-sdl.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-graphics-spice.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-graphics-vnc.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-input.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-interface.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-interface-bridge.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-interface-network.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-interface-user.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-memballoon.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-os.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-parallel.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-redirdev.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-seclabel.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-serial.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-snapshot.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-sound.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-timer.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-timer-pit.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-timer-rtc.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain-video.xml"/>
+ <xi:include href="xml/libvirt-gconfig-domain.xml"/>
+ </chapter>
<xi:include href="xml/libvirt-gconfig-domain-snapshot.xml"/>
<xi:include href="xml/libvirt-gconfig-interface.xml"/>
<xi:include href="xml/libvirt-gconfig-network-filter.xml"/>
<xi:include href="xml/libvirt-gconfig-network.xml"/>
<xi:include href="xml/libvirt-gconfig-node-device.xml"/>
<xi:include href="xml/libvirt-gconfig-secret.xml"/>
- <xi:include href="xml/libvirt-gconfig-storage-pool.xml"/>
- <xi:include href="xml/libvirt-gconfig-storage-vol.xml"/>
+ <chapter>
+ <title>Storage Configuration</title>
+ <xi:include href="xml/libvirt-gconfig-storage-permissions.xml"/>
+ <section>
+ <title>Storage Pools Configuration</title>
+ <xi:include href="xml/libvirt-gconfig-storage-pool.xml"/>
+ <xi:include href="xml/libvirt-gconfig-storage-pool-source.xml"/>
+ <xi:include href="xml/libvirt-gconfig-storage-pool-target.xml"/>
+ </section>
+ <section>
+ <title>Storage Volumes Configuration</title>
+ <xi:include href="xml/libvirt-gconfig-storage-vol.xml"/>
+ <xi:include href="xml/libvirt-gconfig-storage-vol-backing-store.xml"/>
+ <xi:include href="xml/libvirt-gconfig-storage-vol-target.xml"/>
+ </section>
+ </chapter>
<xi:include href="xml/libvirt-gconfig-capabilities.xml"/>
- </chapter>
- <chapter id="object-tree">
+ </part>
+ <part id="object-tree">
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/>
- </chapter>
+ </part>
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
--
1.7.10
13 years
Re: [libvirt] [RH-BZ #595428] 'virsh list' should output more information 'xm list'
by Maxim Sditanov
2012/4/2 Maxim Sditanov <feniksa(a)rambler.ru>:
> Is this new feature request still
> https://bugs.gentoo.org/show_bug.cgi?id=366561 actual?
>
> Because virsh still show not enough information:
>
> $./virsh -c qemu:///system list --all
>
> Id Name State
> ----------------------------------------------------
> 1 " running
> - winxp shut off
>
> And it will be good idea to show more detailed information or add
> additional flag, something like --detail.
> ./virsh -c qemu:///system list --all --detailed
>
>
> Id Name State Memory VCPU Uptime CPU IOPS
> ----------------------------------
> -------------------------------------------------------------
> 1 " running 768M 2 3hours 5% 12.1
> - winxp shut off 512M 1
>
I implemented first part of this task - VCPU and CPU load.
I ported from virt-manager CPU load algorithm
(thanks Cole Robinson for help
https://www.redhat.com/archives/virt-tools-list/2012-April/msg00051.html)
virt manager update graphic in such way:
It create thread, than it take host CPU ticks (how much cpu time take host)
then every 1 sec it update value and calculate percentage.
But this algorithm is bad in virsh, because virsh give information about
domains imidiatly, without delays and thats why i can't caclulate cpu
(also io and
network usage).
I think it will be good idea if libvirtd will hold information about
resource usage and implement interface for this data via libvirt
And virsh and virt-manager will use
the same functions to get cpu, disk and network usage, host uptime
How do you think?
--
With best wishes, Feniks Gordon Freeman
13 years
[libvirt] [PATCH] openvz; wire up getHostname
by Guido Günther
---
Trivial thing missing in the openvz driver.
Cheers,
-- Guido
src/openvz/openvz_driver.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 0451c22..7ec327d 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1679,6 +1679,7 @@ static virDriver openvzDriver = {
.close = openvzClose, /* 0.3.1 */
.type = openvzGetType, /* 0.3.1 */
.version = openvzGetVersion, /* 0.5.0 */
+ .getHostname = virGetHostname, /* 0.9.12 */
.getMaxVcpus = openvzGetMaxVCPUs, /* 0.4.6 */
.nodeGetInfo = nodeGetInfo, /* 0.3.2 */
.nodeGetCPUStats = nodeGetCPUStats, /* 0.9.12 */
--
1.7.10
13 years
[libvirt] [test-API PATCH 0/4]testcases will use xml file directly
by Guannan Ren
Right now, for testcases that needs xml to define domain or storage, etc
they call module *utils/xmlbuilder.py utils/xmlgenerator.py* to get back
a string of xml. These two module create xml string by "xml.dom.minidom"
This approach is hard to maintain and not easy to use. So we will depreciate it
in near furture.
The new way is to use xml file directly. There will be a new folder named
'xmls' in path repos/*/xmls, testcases will use the xmlfile in the foler
directly.
For example: domain:define
required_params = ('guestname', 'diskpath',)
optional_params = {'memory': 1048576,
'vcpu': 1,
'hddriver' : 'virtio',
'nicdriver': 'virtio',
'macaddr': '52:54:00:97:e4:28',
'uuid' : '05867c1a-afeb-300e-e55e-2673391ae080',
'username': None,
'password': None,
'guesttype': 'kvm',
'xml': 'xmls/kvm_guest_define.xml'
}
The define.py will get the xml string of "xmls/kvm_guest_define.xml" and define it
directly.
The framework takes the charge of getting the content of the file, replacing
some TEXT in it and passing the string to define.py for use.
The define.py supports any file in absolute path if the xml option is given in testcase
file like
domain:eventhandler
guestname
fedoraVM
diskpath
/var/lib/libvirt/images/fedoraVM
xml
/PATH/TO/FILE
13 years