[libvirt] [PATCH] configure: fix formatting of missing pkg-config modules error
by Giuseppe Scrivano
It adds an empty space after the package version. Previously the error
message looked like:
"You must install the dbus-1 >= 1.0.0pkg-config module to compile libvirt"
Signed-off-by: Giuseppe Scrivano <gscrivan(a)redhat.com>
---
m4/virt-lib.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/m4/virt-lib.m4 b/m4/virt-lib.m4
index 778cd40..70400a1 100644
--- a/m4/virt-lib.m4
+++ b/m4/virt-lib.m4
@@ -336,7 +336,7 @@ AC_DEFUN([LIBVIRT_CHECK_PKG],[
fi
if test $fail = 1; then
- AC_MSG_ERROR([You must install the ]pc_name[ >= ]pc_version[pkg-config module to compile libvirt])
+ AC_MSG_ERROR([You must install the ]pc_name[ >= ]pc_version[ pkg-config module to compile libvirt])
fi
if test "x$with_var" = "xyes" ; then
--
1.8.3.1
11 years, 4 months
[libvirt] [PATCH] maint: the compiler is not always named gcc
by Eric Blake
https://bugzilla.redhat.com/show_bug.cgi?id=994589 complained that
even when using a cross-compiler not named 'gcc', the configure
output confusingly referred to gcc.
* m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Use a
more generic statement in configure output.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the trivial rule.
m4/virt-compile-warnings.m4 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 8731b70..6bf797f 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -62,7 +62,7 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
# gcc 4.2 treats attribute(format) as an implicit attribute(nonnull),
# which triggers spurious warnings for our usage
- AC_CACHE_CHECK([whether gcc -Wformat allows NULL strings],
+ AC_CACHE_CHECK([whether the C compiler's -Wformat allows NULL strings],
[lv_cv_gcc_wformat_null_works], [
save_CFLAGS=$CFLAGS
CFLAGS='-Wunknown-pragmas -Werror -Wformat'
@@ -101,7 +101,7 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
dnl Check whether strchr(s, char variable) causes a bogus compile
dnl warning, which is the case with GCC < 4.6 on some glibc
- AC_CACHE_CHECK([whether GCC -Wlogical-op gives bogus warnings],
+ AC_CACHE_CHECK([whether the C compiler's -Wlogical-op gives bogus warnings],
[lv_cv_gcc_wlogical_op_broken], [
save_CFLAGS="$CFLAGS"
CFLAGS="-O2 -Wlogical-op -Werror"
--
1.8.3.1
11 years, 4 months
[libvirt] [PATCH] Add support for detecting PPC little endian arches
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The recent patch series proposing the addition of PPC little endian
arch support to Linux defines new arch names 'ppcle' and 'ppc64le':
https://lists.ozlabs.org/pipermail/linuxppc-dev/2013-August/109908.html
This just makes libvirt know about these arch names, so it doesn't
immediately trip up if it seems these new names from uname.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/util/virarch.c | 7 +++++--
src/util/virarch.h | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/util/virarch.c b/src/util/virarch.c
index 81558e5..815ad29 100644
--- a/src/util/virarch.c
+++ b/src/util/virarch.c
@@ -55,18 +55,21 @@ static const struct virArchData {
{ "parisc", 32, VIR_ARCH_BIG_ENDIAN },
{ "parisc64", 64, VIR_ARCH_BIG_ENDIAN },
{ "ppc", 32, VIR_ARCH_BIG_ENDIAN },
+ { "ppcle", 32, VIR_ARCH_LITTLE_ENDIAN },
{ "ppc64", 64, VIR_ARCH_BIG_ENDIAN },
- { "ppcemb", 32, VIR_ARCH_BIG_ENDIAN },
+ { "ppc64le", 64, VIR_ARCH_LITTLE_ENDIAN },
+ { "ppcemb", 32, VIR_ARCH_BIG_ENDIAN },
{ "s390", 32, VIR_ARCH_BIG_ENDIAN },
{ "s390x", 64, VIR_ARCH_BIG_ENDIAN },
{ "sh4", 32, VIR_ARCH_LITTLE_ENDIAN },
+
{ "sh4eb", 64, VIR_ARCH_BIG_ENDIAN },
{ "sparc", 32, VIR_ARCH_BIG_ENDIAN },
-
{ "sparc64", 64, VIR_ARCH_BIG_ENDIAN },
{ "unicore32", 32, VIR_ARCH_LITTLE_ENDIAN },
{ "x86_64", 64, VIR_ARCH_LITTLE_ENDIAN },
+
{ "xtensa", 32, VIR_ARCH_LITTLE_ENDIAN },
{ "xtensaeb", 32, VIR_ARCH_BIG_ENDIAN },
};
diff --git a/src/util/virarch.h b/src/util/virarch.h
index 0d8ae25..c64012d 100644
--- a/src/util/virarch.h
+++ b/src/util/virarch.h
@@ -47,18 +47,21 @@ typedef enum {
VIR_ARCH_PARISC, /* PA-Risc 32 BE http://en.wikipedia.org/wiki/PA-RISC */
VIR_ARCH_PARISC64, /* PA-Risc 64 BE http://en.wikipedia.org/wiki/PA-RISC */
VIR_ARCH_PPC, /* PowerPC 32 BE http://en.wikipedia.org/wiki/PowerPC */
+ VIR_ARCH_PPCLE, /* PowerPC 32 LE http://en.wikipedia.org/wiki/PowerPC */
VIR_ARCH_PPC64, /* PowerPC 64 BE http://en.wikipedia.org/wiki/PowerPC */
- VIR_ARCH_PPCEMB, /* PowerPC 32 BE http://en.wikipedia.org/wiki/PowerPC */
+ VIR_ARCH_PPC64LE, /* PowerPC 64 LE http://en.wikipedia.org/wiki/PowerPC */
+ VIR_ARCH_PPCEMB, /* PowerPC 32 BE http://en.wikipedia.org/wiki/PowerPC */
VIR_ARCH_S390, /* S390 32 BE http://en.wikipedia.org/wiki/S390 */
VIR_ARCH_S390X, /* S390 64 BE http://en.wikipedia.org/wiki/S390x */
VIR_ARCH_SH4, /* SuperH4 32 LE http://en.wikipedia.org/wiki/SuperH */
+
VIR_ARCH_SH4EB, /* SuperH4 32 BE http://en.wikipedia.org/wiki/SuperH */
VIR_ARCH_SPARC, /* Sparc 32 BE http://en.wikipedia.org/wiki/Sparc */
-
VIR_ARCH_SPARC64, /* Sparc 64 BE http://en.wikipedia.org/wiki/Sparc */
VIR_ARCH_UNICORE32, /* UniCore 32 LE http://en.wikipedia.org/wiki/Unicore*/
VIR_ARCH_X86_64, /* x86 64 LE http://en.wikipedia.org/wiki/X86 */
+
VIR_ARCH_XTENSA, /* XTensa 32 LE http://en.wikipedia.org/wiki/Xtensa#Processor_Cores */
VIR_ARCH_XTENSAEB, /* XTensa 32 BE http://en.wikipedia.org/wiki/Xtensa#Processor_Cores */
--
1.8.3.1
11 years, 4 months
Re: [libvirt] [PATCH 2/2] qemu: Support setting the 'removable' flag for USB disks
by intrigeri
Hi,
> Add an attribute named 'removable' to the 'target' element of disks,
> which controls the removable flag. For instance, on a Linux guest it
> controls the value of /sys/block/$dev/removable. This option is only
> valid for USB disks (i.e. bus='usb'), and its default value is 'off',
> which is the same behaviour as before.
For what it's worth, I have been successfully using this patchset in
production since March, in its various incarnations.
More specifically, I have been running libvirt 1.1.0 + the latest
patches proposed on July 25th since they were submitted, have been
heavily using emulated USB devices, and I have not experienced
any issue.
My reading of the situation is that the patches submitter has improved
his patches months ago after receiving initial feedback, and since
then the only activity I have seen was him porting his patches to the
latest libvirt code and re-submitting.
What is missing to get these patches merged, then?
(Apart of porting them to the latest version again, of course :)
Regards,
--
intrigeri
| GnuPG key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc
| OTR fingerprint @ https://gaffer.ptitcanardnoir.org/intrigeri/otr.asc
11 years, 4 months
[libvirt] With different libvirt version, lxc-enter-namespace return Different Execution results.
by hzguanqiang@corp.netease.com
Hi Alex,
I noticed you did lots of work about lxc-enter-namespace function. There is one thing really confusing me and I really want to consult with you about it.
When I execute lxc-enter-namespace to get disk space info for lxc container under different libvirt version, It return different execution results. Details are as following:
Under libvirt of version 1.0.2 with unbuntu host OS:
# disk space info of Host
ubuntu@lxc-gq:~$ df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/loop7 20G 16G 3.2G 84% /
udev 2.0G 12K 2.0G 1% /dev
tmpfs 791M 300K 791M 1% /run
none 5.0M 4.0K 5.0M 1% /run/lock
none 2.0G 0 2.0G 0% /run/shm
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/nbd5 93M 1.6M 87M 2% /home/ubuntu/test
ubuntu@lxc-gq:~$ vir version
Compiled against library: libvirt 1.0.2
Using library: libvirt 1.0.2
Using API: LXC 1.0.2
Running hypervisor: LXC 3.8.0
ubuntu@lxc-gq:~$ vir list
Id Name State
----------------------------------------------------
3241 instance-0000004b running
# disk space info of instance
ubuntu@lxc-gq:~$ vir lxc-enter-namespace 3241 /bin/df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/nbd1 1.4G 956M 329M 75% /
devfs 64K 8.0K 56K 13% /dev
tmpfs 64K 0 64K 0% /sys/fs/cgroup
none 396M 12M 384M 3% /run
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 0 2.0G 0% /run/shm
Then I logged into the lxc container :
ubuntu@lxc-gq:~$ ssh -i id_rsa_lxc ubuntu(a)10.0.0.4
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 3.8.0-25-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information disabled due to load higher than 2.0
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
Use Juju to deploy your cloud instances and workloads:
https://juju.ubuntu.com/#cloud-precise
0 packages can be updated.
0 updates are security updates.
Last login: Thu Aug 8 07:30:04 2013 from 10.0.0.1
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
ubuntu@lxc3:~$ df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/nbd1 1.4G 956M 328M 75% /
devfs 64K 8.0K 56K 13% /dev
tmpfs 64K 0 64K 0% /sys/fs/cgroup
none 396M 12M 384M 3% /run
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 0 2.0G 0% /run/shm
From above, We can see under libvirt version 1.0.2, through lxc-enter-namespace, disk space info can be obtained and it's the same as info got from lxc inside.
But when I did the same thing under libvirt of version 1.1.0 with debian host OS, the execution result changed:
#disk info of host
hzguanqiang@debian:~$ df -hl
Filesystem Size Used Avail Use% Mounted on
rootfs 4.0G 1.6G 2.2G 42% /
udev 10M 0 10M 0% /dev
tmpfs 4.8G 468K 4.8G 1% /run
/dev/disk/by-uuid/12bb656b-4f80-4386-aa07-4bf90a3111b4 4.0G 1.6G 2.2G 42% /
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 9.9G 0 9.9G 0% /run/shm
/dev/sda8 428G 112G 313G 27% /home
/dev/sda6 7.9G 159M 7.8G 2% /tmp
/dev/sda5 16G 2.7G 14G 17% /var
cgroup_root 24G 0 24G 0% /sys/fs/cgroup
/dev/nbd5 1.4G 851M 466M 65% /home/openstack/stack/data/nova/instances/eed45ccb-3707-4815-9ae4-c7a2f56adb64/rootfs
hzguanqiang@debian:~$ vir version
Compiled against library: libvirt 1.1.0
Using library: libvirt 1.1.0
Using API: LXC 1.1.0
Running hypervisor: LXC 3.2.46
hzguanqiang@debian:~$ vir list
Id Name State
----------------------------------------------------
6096 instance-00000037 running
27981 instance-00000038 running
30846 instance-0000001a running
hzguanqiang@debian:~$ vir lxc-enter-namespace instance-00000037 /bin/df -hl
libvirt: error : argument unsupported: Security model cannot be entered
hzguanqiang@debian:~$ vir lxc-enter-namespace instance-00000037 --noseclabel /bin/df -hl
Filesystem Size Used Avail Use% Mounted on
rootfs 4.0G 1.6G 2.2G 42% /
udev 10M 0 10M 0% /dev
tmpfs 4.8G 468K 4.8G 1% /run
/dev/disk/by-uuid/12bb656b-4f80-4386-aa07-4bf90a3111b4 4.0G 1.6G 2.2G 42% /
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 9.9G 0 9.9G 0% /run/shm
/dev/sda8 428G 112G 313G 27% /home
/dev/sda6 7.9G 159M 7.8G 2% /tmp
/dev/sda5 16G 2.7G 14G 17% /var
cgroup_root 24G 0 24G 0% /sys/fs/cgroup
/dev/nbd5 1.4G 851M 466M 65% /home/openstack/stack/data/nova/instances/eed45ccb-3707-4815-9ae4-c7a2f56adb64/rootfs
Then I logged into the lxc container :
hzguanqiang@debian:~$ ssh -i id_rsa ubuntu(a)10.160.70.2
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 3.2.46-openstack-amd64 x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Wed Aug 7 10:49:35 UTC 2013
System load: 0.62 Processes: 31
Usage of /: 20.9% of 19.69GB Users logged in: 1
Memory usage: 51% IP address for eth0: 10.160.70.2
Swap usage: 0%
Graph this data and manage this system at https://landscape.canonical.com/
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
Use Juju to deploy your cloud instances and workloads:
https://juju.ubuntu.com/#cloud-precise
Last login: Wed Aug 7 10:49:35 2013 from 10.160.70.3
ubuntu@lxc1:~$ df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/loop2 20G 11G 8.3G 57% /
devfs 64K 8.0K 56K 13% /dev
tmpfs 64K 0 64K 0% /sys/fs/cgroup
none 4.8G 6.4M 4.8G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 24G 0 24G 0% /run/shm
From above, We can see under libvirt version 1.1.0, disk space info of lxc container gotten through lxc-enter-namespace are different from info got from lxc inside, but the same as host.
Why does this happen? Is there a bug or anything?
Thanks
--------------------------------------------------------------------------------
------------------
Best regards!
GuanQiang
11 years, 4 months
[libvirt] [PATCH] Record the where the auto-generated data comes from
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The gendispatch.pl script puts comments at the top of files
it creates, saying that it auto-generated them. Also include
the name of the source data file which it reads when doing
the auto-generation.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/rpc/gendispatch.pl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index ac0c7ab..ceb1ad8 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -348,19 +348,19 @@ sub hyper_to_long
if ($mode eq "aclsym") {
print <<__EOF__;
-# Automatically generated by gendispatch.pl.
+# Automatically generated from $protocol by gendispatch.pl.
# Do not edit this file. Any changes you make will be lost.
__EOF__
} elsif ($mode eq "aclapi") {
print <<__EOF__;
<!--
- - Automatically generated by gendispatch.pl.
+ - Automatically generated from $protocol by gendispatch.pl.
- Do not edit this file. Any changes you make will be lost.
-->
__EOF__
} else {
print <<__EOF__;
-/* Automatically generated by gendispatch.pl.
+/* Automatically generated from $protocol by gendispatch.pl.
* Do not edit this file. Any changes you make will be lost.
*/
__EOF__
--
1.8.1.4
11 years, 4 months
[libvirt] [PATCH] qemu: Allow hotplug of multiple SCSI devices
by Viktor Mihajlovski
From: Eric Farman <farman(a)linux.vnet.ibm.com>
Hotplugging a single SCSI device works, but adding additional ones
result in an error from QEMU:
[root@gpok197 ~]# virsh attach-device guest01 blah.xml
Device attached successfully
[root@gpok197 ~]# virsh attach-device guest01 blah2.xml
error: Failed to attach device from blah2.xml
error: internal error unable to execute QEMU command 'device_add': Duplicate ID 'hostdev0' for device
The hostdev ID that is created is always set to zero, regardless
of the contents of the XML. Changing the index in the hotplug case
to a negative one so the next available index is used.
Signed-off-by: Eric Farman <farman(a)linux.vnet.ibm.com>
Reviewed-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/qemu/qemu_hotplug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7a6946e..c9748d9 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1362,7 +1362,7 @@ qemuDomainAttachHostScsiDevice(virQEMUDriverPtr driver,
return -1;
}
- if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, 0) < 0)
+ if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
goto cleanup;
if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev, priv->qemuCaps,
--
1.7.9.5
11 years, 4 months
[libvirt] [PATCH] Add info about access control checks into API reference
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
So that app developers / admins know what access control checks
are performed for each API, this patch extends the API docs
generator to include details of the ACLs for each.
The gendispatch.pl script is extended so that it generates
a simple XML describing ACL rules, eg.
<aclinfo>
...
<api name='virConnectNumOfDomains'>
<check object='connect' perm='search_domains'/>
<filter object='domain' perm='getattr'/>
</api>
<api name='virDomainAttachDeviceFlags'>
<check object='domain' perm='write'/>
<check object='domain' perm='save' flags='!VIR_DOMAIN_AFFECT_CONFIG|VIR_DOMAIN_AFFECT_LIVE'/>
<check object='domain' perm='save' flags='VIR_DOMAIN_AFFECT_CONFIG'/>
</api>
...
</aclinfo>
The newapi.xsl template loads the XML files containing the ACL
rules and generates a short block of HTML for each API describing
the parameter checks and return value filters (if any).
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
docs/libvirt.css | 14 +++++++++++
docs/newapi.xsl | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/Makefile.am | 22 ++++++++++++++--
src/rpc/gendispatch.pl | 59 ++++++++++++++++++++++++++++++++++++++++---
4 files changed, 157 insertions(+), 6 deletions(-)
diff --git a/docs/libvirt.css b/docs/libvirt.css
index 8a00d12..ed67b2f 100644
--- a/docs/libvirt.css
+++ b/docs/libvirt.css
@@ -477,3 +477,17 @@ dl.variablelist > dt {
dl.variablelist > dt:after {
content: ": ";
}
+
+table.acl {
+ margin: 1em;
+ border-spacing: 0px;
+ border: 1px solid #ccc;
+}
+
+table.acl tr, table.acl td {
+ padding: 0.3em;
+}
+
+table.acl thead {
+ background: #ddd;
+}
diff --git a/docs/newapi.xsl b/docs/newapi.xsl
index d5b210e..58f12eb 100644
--- a/docs/newapi.xsl
+++ b/docs/newapi.xsl
@@ -29,6 +29,69 @@
<xsl:variable name="htmldir">html</xsl:variable>
<xsl:variable name="href_base">../</xsl:variable>
+ <xsl:variable name="acls">
+ <xsl:copy-of select="document('../src/libvirt_access.xml')/aclinfo/api"/>
+ </xsl:variable>
+ <xsl:variable name="qemuacls">
+ <xsl:copy-of select="document('../src/libvirt_access_qemu.xml')/aclinfo/api"/>
+ </xsl:variable>
+ <xsl:variable name="lxcacls">
+ <xsl:copy-of select="document('../src/libvirt_access_lxc.xml')/aclinfo/api"/>
+ </xsl:variable>
+
+ <xsl:template name="aclinfo">
+ <xsl:param name="api"/>
+
+ <xsl:if test="count(exsl:node-set($acls)/api[@name=$api]/check) > 0">
+ <h5>Access control parameter checks</h5>
+ <table class="acl">
+ <thead>
+ <tr>
+ <th>Object</th>
+ <th>Permission</th>
+ <th>Condition</th>
+ </tr>
+ </thead>
+ <xsl:apply-templates select="exsl:node-set($acls)/api[@name=$api]/check" mode="acl"/>
+ </table>
+ </xsl:if>
+ <xsl:if test="count(exsl:node-set($acls)/api[@name=$api]/filter) > 0">
+ <h5>Access control return value filters</h5>
+ <table class="acl">
+ <thead>
+ <tr>
+ <th>Object</th>
+ <th>Permission</th>
+ </tr>
+ </thead>
+ <xsl:apply-templates select="exsl:node-set($acls)/api[@name=$api]/filter" mode="acl"/>
+ </table>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="check" mode="acl">
+ <tr>
+ <td><xsl:value-of select="@object"/></td>
+ <td><xsl:value-of select="@perm"/></td>
+ <xsl:choose>
+ <xsl:when test="@flags">
+ <td><xsl:value-of select="@flags"/></td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td>-</td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="filter" mode="acl">
+ <tr>
+ <td><xsl:value-of select="@object"/></td>
+ <td><xsl:value-of select="@perm"/></td>
+ </tr>
+ </xsl:template>
+
+
<xsl:template name="navbar">
<xsl:variable name="previous" select="preceding-sibling::file[1]"/>
<xsl:variable name="next" select="following-sibling::file[1]"/>
@@ -553,6 +616,11 @@
</xsl:if>
</dl>
</xsl:if>
+ <div class="acl">
+ <xsl:call-template name="aclinfo">
+ <xsl:with-param name="api" select="$name"/>
+ </xsl:call-template>
+ </div>
</xsl:template>
<xsl:template match="exports" mode="toc">
diff --git a/src/Makefile.am b/src/Makefile.am
index ac66ecf..277f749 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -830,6 +830,11 @@ ACCESS_DRIVER_SYM_FILES = \
libvirt_access_qemu.syms \
libvirt_access_lxc.syms
+ACCESS_DRIVER_API_FILES = \
+ libvirt_access.xml \
+ libvirt_access_qemu.xml \
+ libvirt_access_lxc.xml
+
ACCESS_DRIVER_SOURCES = \
access/viraccessperm.h access/viraccessperm.c \
access/viraccessmanager.h access/viraccessmanager.c \
@@ -1496,8 +1501,8 @@ EXTRA_DIST += $(ACCESS_DRIVER_POLKIT_SOURCES)
endif
-BUILT_SOURCES += $(ACCESS_DRIVER_GENERATED)
-CLEANFILES += $(ACCESS_DRIVER_GENERATED)
+BUILT_SOURCES += $(ACCESS_DRIVER_GENERATED) $(ACCESS_DRIVER_API_FILES)
+CLEANFILES += $(ACCESS_DRIVER_GENERATED) $(ACCESS_DRIVER_API_FILES)
libvirt_access.syms: $(srcdir)/rpc/gendispatch.pl \
$(REMOTE_PROTOCOL) Makefile.am
@@ -1512,6 +1517,19 @@ libvirt_access_lxc.syms: $(srcdir)/rpc/gendispatch.pl \
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclsym \
lxc LXC $(LXC_PROTOCOL) > $@
+libvirt_access.xml: $(srcdir)/rpc/gendispatch.pl \
+ $(REMOTE_PROTOCOL) Makefile.am
+ $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclapi \
+ remote REMOTE $(REMOTE_PROTOCOL) > $@
+libvirt_access_qemu.xml: $(srcdir)/rpc/gendispatch.pl \
+ $(QEMU_PROTOCOL) Makefile.am
+ $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclapi \
+ qemu QEMU $(QEMU_PROTOCOL) > $@
+libvirt_access_lxc.xml: $(srcdir)/rpc/gendispatch.pl \
+ $(LXC_PROTOCOL) Makefile.am
+ $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclapi \
+ lxc LXC $(LXC_PROTOCOL) > $@
+
$(srcdir)/access/viraccessapicheck.h: $(srcdir)/rpc/gendispatch.pl \
$(REMOTE_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclheader \
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 8f41771..ac0c7ab 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -41,8 +41,8 @@ my $res = GetOptions("mode=s" => \$mode);
die "cannot parse command line options" unless $res;
die "unknown mode '$mode', expecting 'client', 'server', " .
- "'aclheader', 'aclbody', 'aclsym' or 'debug'"
- unless $mode =~ /^(client|server|aclheader|aclbody|aclsym|debug)$/;
+ "'aclheader', 'aclbody', 'aclsym', 'aclapi' or 'debug'"
+ unless $mode =~ /^(client|server|aclheader|aclbody|aclsym|aclapi|debug)$/;
my $structprefix = shift or die "missing struct prefix argument";
my $procprefix = shift or die "missing procedure prefix argument";
@@ -351,6 +351,13 @@ if ($mode eq "aclsym") {
# Automatically generated by gendispatch.pl.
# Do not edit this file. Any changes you make will be lost.
__EOF__
+} elsif ($mode eq "aclapi") {
+ print <<__EOF__;
+<!--
+ - Automatically generated by gendispatch.pl.
+ - Do not edit this file. Any changes you make will be lost.
+ -->
+__EOF__
} else {
print <<__EOF__;
/* Automatically generated by gendispatch.pl.
@@ -1641,7 +1648,8 @@ elsif ($mode eq "client") {
}
} elsif ($mode eq "aclheader" ||
$mode eq "aclbody" ||
- $mode eq "aclsym") {
+ $mode eq "aclsym" ||
+ $mode eq "aclapi") {
my %generate = map { $_ => 1 } @autogen;
my @keys = keys %calls;
@@ -1667,6 +1675,7 @@ elsif ($mode eq "client") {
foreach my $hdr (@headers) {
print "#include \"$hdr\"\n";
}
+ print "\n";
} elsif ($mode eq "aclbody") {
my $header = shift;
print "#include <config.h>\n";
@@ -1676,8 +1685,12 @@ elsif ($mode eq "client") {
print "#include \"virerror.h\"\n";
print "\n";
print "#define VIR_FROM_THIS VIR_FROM_ACCESS\n";
+ print "\n";
+ } elsif ($mode eq "aclapi") {
+ print "<aclinfo>\n";
+ } else {
+ print "\n";
}
- print "\n";
foreach (@keys) {
my $call = $calls{$_};
@@ -1699,6 +1712,8 @@ elsif ($mode eq "client") {
print $apiname . "CheckACL;\n";
}
print $apiname . "EnsureACL;\n";
+ } elsif ($mode eq "aclapi") {
+ &generate_aclapi($call);
} else {
&generate_acl($call, $call->{acl}, "Ensure");
if (defined $call->{aclfilter}) {
@@ -1835,5 +1850,41 @@ elsif ($mode eq "client") {
print "}\n\n";
}
}
+
+ sub generate_aclapi {
+ my $call = shift;
+
+ my $apiname = "vir" . $call->{ProcName};
+ if ($structprefix eq "qemu") {
+ $apiname =~ s/virDomain/virDomainQemu/;
+ } elsif ($structprefix eq "lxc") {
+ $apiname =~ s/virDomain/virDomainLxc/;
+ }
+
+ print " <api name='$apiname'>\n";
+
+ my $acl = $call->{acl};
+ foreach (@{$acl}) {
+ my @bits = split /:/;
+ print " <check object='$bits[0]' perm='$bits[1]'";
+ if (defined $bits[2]) {
+ print " flags='$bits[2]'";
+ }
+ print "/>\n";
+ }
+
+ my $aclfilter = $call->{aclfilter};
+ foreach (@{$aclfilter}) {
+ my @bits = split /:/;
+ print " <filter object='$bits[0]' perm='$bits[1]'/>\n";
+ }
+
+ print " </api>\n";
+ }
+
+ }
+
+ if ($mode eq "aclapi") {
+ print "</aclinfo>\n";
}
}
--
1.8.1.4
11 years, 4 months
[libvirt] [sandbox][PATCH v3] Fix delete of running container
by Wayne Sun
Delete running container is not supprted and will report an error.
Related to bug:
https://bugzilla.redhat.com/show_bug.cgi?id=994495
v1: Fix stop function and delete running container.
v2: Delete running container is not allowed, spawn virsh to get
domain status.
v3: Using exist libvirt connection to get dom status.
Signed-off-by: Wayne Sun <gsun(a)redhat.com>
---
bin/virt-sandbox-service | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index 550d46c..03873c9 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -254,11 +254,11 @@ class Container:
def delete(self):
self.connect()
- # Stop service if it is running
- try:
- self.stop()
- except:
- pass
+ self.conn.fetch_domains(None)
+ dom = self.conn.find_domain_by_name(self.name)
+ info = dom.get_info()
+ if info.state == LibvirtGObject.DomainState.RUNNING:
+ raise ValueError([_("Cannot delete running container")])
# Not sure we should remove content
if os.path.exists(self.dest):
--
1.7.1
11 years, 4 months
[libvirt] virDomainCreateWithFlags error
by Wangpan
Hi all,
I'm using 'libvirt 1.1.1-1 amd64' undef debian wheezy, I found that the return code is 139 when I run command:
$ sudo virsh start df1c4670-18eb-4520-b5d8-aa8a492eb876 --paused; echo $?
139
but the return code is OK(0) when run command:
$ sudo virsh start df1c4670-18eb-4520-b5d8-aa8a492eb876; echo $?
I found there is an error in libvirtd.log:
2013-08-08 05:40:23.983+0000: 16626: error : virNetSocketReadWire:1377 : End of file while reading data: Input/output error
I found this issue by using openstack nova folsom, if I create an VM by nova, it will use dom.createWithFlags(0) to create the VM, but then the nova-compute process exited when this function is called, then I changed the createWithFlags(0) to create(), everything become OK.
I also tried the function under python, and the python process exited, too. but the dom.create() method is OK, so I think this is a problem about libvirt.
I want to know is this a reported bug?
libvirt and kvm hypervisor version:
Compiled against library: libvirt 1.1.1
Using library: libvirt 1.1.1
Using API: QEMU 1.1.1
Running hypervisor: QEMU 1.1.2
Thanks
2012-08-16
Wangpan
11 years, 4 months