mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-08-22 01:50:06 +03:00
Compare commits
1 Commits
v1.1.2
...
v1.0.1-mai
Author | SHA1 | Date | |
---|---|---|---|
36386a9356 |
5
.ctags
5
.ctags
@ -1,5 +0,0 @@
|
||||
--recurse
|
||||
--exclude=*.orig
|
||||
--exclude=*.html
|
||||
--exclude=*.html.in
|
||||
--langmap=c:+.h.in
|
44
.gitignore
vendored
44
.gitignore
vendored
@ -28,6 +28,7 @@
|
||||
.sc-start-sc_*
|
||||
/ABOUT-NLS
|
||||
/AUTHORS
|
||||
/COPYING
|
||||
/ChangeLog
|
||||
/GNUmakefile
|
||||
/INSTALL
|
||||
@ -58,12 +59,10 @@
|
||||
/daemon/libvirtd.policy
|
||||
/daemon/libvirtd.service
|
||||
/daemon/test_libvirtd.aug
|
||||
/docs/aclperms.htmlinc
|
||||
/docs/apibuild.py.stamp
|
||||
/docs/devhelp/libvirt.devhelp
|
||||
/docs/hvsupport.html.in
|
||||
/docs/libvirt-api.xml
|
||||
/docs/libvirt-lxc-*.xml
|
||||
/docs/libvirt-qemu-*.xml
|
||||
/docs/libvirt-refs.xml
|
||||
/docs/search.php
|
||||
@ -93,34 +92,18 @@
|
||||
/python/generated.stamp
|
||||
/python/generator.py.stamp
|
||||
/python/libvirt-export.c
|
||||
/python/libvirt-lxc-export.c
|
||||
/python/libvirt-lxc.[ch]
|
||||
/python/libvirt-qemu-export.c
|
||||
/python/libvirt-qemu.[ch]
|
||||
/python/libvirt.[ch]
|
||||
/python/libvirt.py
|
||||
/python/libvirt_lxc.py
|
||||
/python/libvirt_qemu.py
|
||||
/run
|
||||
/sc_*
|
||||
/src/.*.stamp
|
||||
/src/access/org.libvirt.api.policy
|
||||
/src/access/viraccessapicheck.c
|
||||
/src/access/viraccessapicheck.h
|
||||
/src/access/viraccessapichecklxc.c
|
||||
/src/access/viraccessapichecklxc.h
|
||||
/src/access/viraccessapicheckqemu.c
|
||||
/src/access/viraccessapicheckqemu.h
|
||||
/src/esx/*.generated.*
|
||||
/src/hyperv/*.generated.*
|
||||
/src/libvirt*.def
|
||||
/src/libvirt.syms
|
||||
/src/libvirt_access.syms
|
||||
/src/libvirt_access.xml
|
||||
/src/libvirt_access_lxc.syms
|
||||
/src/libvirt_access_lxc.xml
|
||||
/src/libvirt_access_qemu.syms
|
||||
/src/libvirt_access_qemu.xml
|
||||
/src/libvirt_*.stp
|
||||
/src/libvirt_*helper
|
||||
/src/libvirt_*probes.h
|
||||
@ -132,9 +115,8 @@
|
||||
/src/locking/test_libvirt_sanlock.aug
|
||||
/src/lxc/lxc_controller_dispatch.h
|
||||
/src/lxc/lxc_monitor_dispatch.h
|
||||
/src/lxc/lxc_monitor_protocol.c
|
||||
/src/lxc/lxc_monitor_protocol.h
|
||||
/src/lxc/lxc_protocol.[ch]
|
||||
/src/lxc/lxc_protocol.c
|
||||
/src/lxc/lxc_protocol.h
|
||||
/src/lxc/test_libvirtd_lxc.aug
|
||||
/src/qemu/test_libvirtd_qemu.aug
|
||||
/src/remote/*_client_bodies.h
|
||||
@ -142,16 +124,12 @@
|
||||
/src/rpc/virkeepaliveprotocol.[ch]
|
||||
/src/rpc/virnetprotocol.[ch]
|
||||
/src/test_libvirt*.aug
|
||||
/src/test_virtlockd.aug
|
||||
/src/util/virkeymaps.h
|
||||
/src/virt-aa-helper
|
||||
/src/virtlockd
|
||||
/src/virtlockd.8
|
||||
/src/virtlockd.8.in
|
||||
/src/virtlockd.init
|
||||
/tests/*.log
|
||||
/tests/*.pid
|
||||
/tests/*.trs
|
||||
/tests/*xml2*test
|
||||
/tests/commandhelper
|
||||
/tests/commandtest
|
||||
@ -160,8 +138,6 @@
|
||||
/tests/domainsnapshotxml2xmltest
|
||||
/tests/esxutilstest
|
||||
/tests/eventtest
|
||||
/tests/fchosttest
|
||||
/tests/fdstreamtest
|
||||
/tests/hashtest
|
||||
/tests/jsontest
|
||||
/tests/libvirtdconftest
|
||||
@ -172,10 +148,8 @@
|
||||
/tests/object-locking-files.txt
|
||||
/tests/object-locking.cm[ix]
|
||||
/tests/openvzutilstest
|
||||
/tests/qemuagenttest
|
||||
/tests/qemuargv2xmltest
|
||||
/tests/qemuhelptest
|
||||
/tests/qemuhotplugtest
|
||||
/tests/qemumonitorjsontest
|
||||
/tests/qemumonitortest
|
||||
/tests/qemuxmlnstest
|
||||
@ -183,7 +157,6 @@
|
||||
/tests/reconnect
|
||||
/tests/secaatest
|
||||
/tests/seclabeltest
|
||||
/tests/securityselinuxlabeltest
|
||||
/tests/securityselinuxtest
|
||||
/tests/sexpr2xmltest
|
||||
/tests/shunloadtest
|
||||
@ -191,28 +164,18 @@
|
||||
/tests/ssh
|
||||
/tests/statstest
|
||||
/tests/storagebackendsheepdogtest
|
||||
/tests/sysinfotest
|
||||
/tests/test_conf
|
||||
/tests/utiltest
|
||||
/tests/viratomictest
|
||||
/tests/virauthconfigtest
|
||||
/tests/virbitmaptest
|
||||
/tests/virbuftest
|
||||
/tests/vircgrouptest
|
||||
/tests/virdbustest
|
||||
/tests/virdrivermoduletest
|
||||
/tests/virendiantest
|
||||
/tests/virhashtest
|
||||
/tests/viridentitytest
|
||||
/tests/virkeycodetest
|
||||
/tests/virkeyfiletest
|
||||
/tests/virlockspacetest
|
||||
/tests/virnet*test
|
||||
/tests/virportallocatortest
|
||||
/tests/virshtest
|
||||
/tests/virstoragetest
|
||||
/tests/virstringtest
|
||||
/tests/virsystemdtest
|
||||
/tests/virtimetest
|
||||
/tests/viruritest
|
||||
/tests/vmx2xmltest
|
||||
@ -222,7 +185,6 @@
|
||||
/tools/libvirt-guests.init
|
||||
/tools/libvirt-guests.service
|
||||
/tools/libvirt-guests.sh
|
||||
/tools/virt-login-shell
|
||||
/tools/virsh
|
||||
/tools/virsh-*-edit.c
|
||||
/tools/virt-*-validate
|
||||
|
2
.gnulib
2
.gnulib
Submodule .gnulib updated: 0ba087759d...d245e6ddd6
@ -11,20 +11,16 @@ Alex Jia <ajia@redhat.com>
|
||||
Anthony Liguori <aliguori@us.ibm.com>
|
||||
Chris Lalancette <clalance@redhat.com>
|
||||
Christophe Fergeau <cfergeau@redhat.com>
|
||||
Claudio Bley <cbley@av-test.de>
|
||||
Cole Robinson <crobinso@redhat.com>
|
||||
Daniel Berrange <berrange@redhat.com>
|
||||
Daniel Veillard <veillard@redhat.com>
|
||||
Dave Allan <dallan@redhat.com>
|
||||
Doug Goldstein <cardoe@gentoo.org>
|
||||
Eric Blake <eblake@redhat.com>
|
||||
Guannan Ren <gren@redhat.com>
|
||||
Guido Günther <agx@sigxcpu.org>
|
||||
Ján Tomko <jtomko@redhat.com>
|
||||
Jim Fehlig <jfehlig@suse.com>
|
||||
Jim Meyering <meyering@redhat.com>
|
||||
Jiří Denemark <jdenemar@redhat.com>
|
||||
John Ferlan <jferlan@redhat.com>
|
||||
John Levon <john.levon@sun.com>
|
||||
Justin Clift <jclift@redhat.com>
|
||||
Laine Stump <laine@redhat.com>
|
||||
|
339
COPYING
339
COPYING
@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
@ -1,8 +1,9 @@
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@ -22,7 +23,8 @@ specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
strategy to use in any particular case, based on the explanations
|
||||
below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
@ -55,7 +57,7 @@ modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
^L
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
@ -87,9 +89,9 @@ libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
encourage the widest possible use of a certain library, so that it
|
||||
becomes a de-facto standard. To achieve this, non-free programs must
|
||||
be allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
@ -111,7 +113,7 @@ modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
^L
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
@ -136,8 +138,8 @@ included without limitation in the term "modification".)
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
interface definition files, plus the scripts used to control
|
||||
compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
@ -216,7 +218,7 @@ instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
^L
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
@ -267,7 +269,7 @@ Library will still fall under Section 6.)
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
^L
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
@ -303,10 +305,10 @@ of these things:
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
c) Accompany the work with a written offer, valid for at least
|
||||
three years, to give the same user the materials specified in
|
||||
Subsection 6a, above, for a charge no more than the cost of
|
||||
performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
@ -329,7 +331,7 @@ restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
^L
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
@ -370,7 +372,7 @@ subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
^L
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
@ -384,9 +386,10 @@ all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply, and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
@ -404,11 +407,11 @@ be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
original copyright holder who places the Library under this License
|
||||
may add an explicit geographical distribution limitation excluding those
|
||||
countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
@ -422,7 +425,7 @@ conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
^L
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
@ -456,19 +459,21 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
^L
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
redistribution under these terms (or, alternatively, under the terms
|
||||
of the ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library.
|
||||
It is safest to attach them to the start of each source file to most
|
||||
effectively convey the exclusion of warranty; and each file should
|
||||
have at least the "copyright" line and a pointer to where the full
|
||||
notice is found.
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
@ -485,16 +490,17 @@ convey the exclusion of warranty; and each file should have at least the
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
your school, if any, to sign a "copyright disclaimer" for the library,
|
||||
if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
library `Frob' (a library for tweaking knobs) written by James
|
||||
Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
227
HACKING
227
HACKING
@ -14,12 +14,7 @@ General tips for contributing patches
|
||||
(1) Discuss any large changes on the mailing list first. Post patches early and
|
||||
listen to feedback.
|
||||
|
||||
(2) Post patches in unified diff format, with git rename detection enabled. You
|
||||
need a one-time setup of:
|
||||
|
||||
git config diff.renames true
|
||||
|
||||
After that, a command similar to this should work:
|
||||
(2) Post patches in unified diff format. A command similar to this should work:
|
||||
|
||||
diff -urp libvirt.orig/ libvirt.modified/ > libvirt-myfeature.patch
|
||||
|
||||
@ -27,17 +22,14 @@ or:
|
||||
|
||||
git diff > libvirt-myfeature.patch
|
||||
|
||||
Also, for code motion patches, you may find that "git diff --patience"
|
||||
provides an easier-to-read patch. However, the usual workflow of libvirt
|
||||
developer is:
|
||||
However, the usual workflow of libvirt developer is:
|
||||
|
||||
git checkout master
|
||||
git pull
|
||||
git checkout -t origin -b workbranch
|
||||
Hack, committing any changes along the way
|
||||
|
||||
More hints on compiling can be found here <compiling.html>. When you want to
|
||||
post your patches:
|
||||
Then, when you want to post your patches:
|
||||
|
||||
git pull --rebase
|
||||
(fix any conflicts)
|
||||
@ -66,19 +58,7 @@ though).
|
||||
|
||||
|
||||
|
||||
(3) In your commit message, make the summary line reasonably short (60 characters
|
||||
is typical), followed by a blank line, followed by any longer description of
|
||||
why your patch makes sense. If the patch fixes a regression, and you know what
|
||||
commit introduced the problem, mentioning that is useful. If the patch
|
||||
resolves a bugzilla report, mentioning the URL of the bug number is useful;
|
||||
but also summarize the issue rather than making all readers follow the link.
|
||||
You can use 'git shortlog -30' to get an idea of typical summary lines.
|
||||
Libvirt does not currently attach any meaning to Signed-off-by: lines, so it
|
||||
is up to you if you want to include or omit them in the commit message.
|
||||
|
||||
|
||||
|
||||
(4) Split large changes into a series of smaller patches, self-contained if
|
||||
(3) Split large changes into a series of smaller patches, self-contained if
|
||||
possible, with an explanation of each patch and an explanation of how the
|
||||
sequence of patches fits together. Moreover, please keep in mind that it's
|
||||
required to be able to compile cleanly (*including* "make check" and "make
|
||||
@ -89,10 +69,10 @@ things).
|
||||
|
||||
|
||||
|
||||
(5) Make sure your patches apply against libvirt GIT. Developers only follow GIT
|
||||
(4) Make sure your patches apply against libvirt GIT. Developers only follow GIT
|
||||
and don't care much about released versions.
|
||||
|
||||
(6) Run the automated tests on your code before submitting any changes. In
|
||||
(5) Run the automated tests on your code before submitting any changes. In
|
||||
particular, configure with compile warnings set to -Werror. This is done
|
||||
automatically for a git checkout; from a tarball, use:
|
||||
|
||||
@ -104,17 +84,7 @@ and run the tests:
|
||||
make syntax-check
|
||||
make -C tests valgrind
|
||||
|
||||
Valgrind <http://valgrind.org/> is a test that checks for memory management
|
||||
issues, such as leaks or use of uninitialized variables.
|
||||
|
||||
Some tests are skipped by default in a development environment, based on the
|
||||
time they take in comparison to the likelihood that those tests will turn up
|
||||
problems during incremental builds. These tests default to being run when when
|
||||
building from a tarball or with the configure option --enable-expensive-tests;
|
||||
you can also force a one-time toggle of these tests by setting
|
||||
VIR_TEST_EXPENSIVE to 0 or 1 at make time, as in:
|
||||
|
||||
make check VIR_TEST_EXPENSIVE=1
|
||||
The latter test checks for memory leaks.
|
||||
|
||||
If you encounter any failing tests, the VIR_TEST_DEBUG environment variable
|
||||
may provide extra information to debug the failures. Larger values of
|
||||
@ -123,105 +93,20 @@ VIR_TEST_DEBUG may provide larger amounts of information:
|
||||
VIR_TEST_DEBUG=1 make check (or)
|
||||
VIR_TEST_DEBUG=2 make check
|
||||
|
||||
When debugging failures during development, it is possible to focus in on just
|
||||
the failing subtests by using TESTS and VIR_TEST_RANGE:
|
||||
|
||||
make check VIR_TEST_DEBUG=1 VIR_TEST_RANGE=3-5 TESTS=qemuxml2argvtest
|
||||
|
||||
Also, individual tests can be run from inside the "tests/" directory, like:
|
||||
|
||||
./qemuxml2xmltest
|
||||
|
||||
There is also a "./run" script at the top level, to make it easier to run
|
||||
programs that have not yet been installed, as well as to wrap invocations of
|
||||
various tests under gdb or Valgrind.
|
||||
|
||||
|
||||
|
||||
(7) The Valgrind test should produce similar output to "make check". If the output
|
||||
has traces within libvirt API's, then investigation is required in order to
|
||||
determine the cause of the issue. Output such as the following indicates some
|
||||
sort of leak:
|
||||
|
||||
==5414== 4 bytes in 1 blocks are definitely lost in loss record 3 of 89
|
||||
==5414== at 0x4A0881C: malloc (vg_replace_malloc.c:270)
|
||||
==5414== by 0x34DE0AAB85: xmlStrndup (in /usr/lib64/libxml2.so.2.7.8)
|
||||
==5414== by 0x4CC97A6: virDomainVideoDefParseXML (domain_conf.c:7410)
|
||||
==5414== by 0x4CD581D: virDomainDefParseXML (domain_conf.c:10188)
|
||||
==5414== by 0x4CD8C73: virDomainDefParseNode (domain_conf.c:10640)
|
||||
==5414== by 0x4CD8DDB: virDomainDefParse (domain_conf.c:10590)
|
||||
==5414== by 0x41CB1D: testCompareXMLToArgvHelper (qemuxml2argvtest.c:100)
|
||||
==5414== by 0x41E20F: virtTestRun (testutils.c:161)
|
||||
==5414== by 0x41C7CB: mymain (qemuxml2argvtest.c:866)
|
||||
==5414== by 0x41E84A: virtTestMain (testutils.c:723)
|
||||
==5414== by 0x34D9021734: (below main) (in /usr/lib64/libc-2.15.so)
|
||||
|
||||
In this example, the "virDomainDefParseXML()" had an error path where the
|
||||
"virDomainVideoDefPtr video" pointer was not properly disposed. By simply
|
||||
adding a "virDomainVideoDefFree(video);" in the error path, the issue was
|
||||
resolved.
|
||||
|
||||
Another common mistake is calling a printing function, such as "VIR_DEBUG()"
|
||||
without initializing a variable to be printed. The following example involved
|
||||
a call which could return an error, but not set variables passed by reference
|
||||
to the call. The solution was to initialize the variables prior to the call.
|
||||
|
||||
==4749== Use of uninitialised value of size 8
|
||||
==4749== at 0x34D904650B: _itoa_word (in /usr/lib64/libc-2.15.so)
|
||||
==4749== by 0x34D9049118: vfprintf (in /usr/lib64/libc-2.15.so)
|
||||
==4749== by 0x34D9108F60: __vasprintf_chk (in /usr/lib64/libc-2.15.so)
|
||||
==4749== by 0x4CAEEF7: virVasprintf (stdio2.h:199)
|
||||
==4749== by 0x4C8A55E: virLogVMessage (virlog.c:814)
|
||||
==4749== by 0x4C8AA96: virLogMessage (virlog.c:751)
|
||||
==4749== by 0x4DA0056: virNetTLSContextCheckCertKeyUsage (virnettlscontext.c:225)
|
||||
==4749== by 0x4DA06DB: virNetTLSContextCheckCert (virnettlscontext.c:439)
|
||||
==4749== by 0x4DA1620: virNetTLSContextNew (virnettlscontext.c:562)
|
||||
==4749== by 0x4DA26FC: virNetTLSContextNewServer (virnettlscontext.c:927)
|
||||
==4749== by 0x409C39: testTLSContextInit (virnettlscontexttest.c:467)
|
||||
==4749== by 0x40AB8F: virtTestRun (testutils.c:161)
|
||||
|
||||
Valgrind will also find some false positives or code paths which cannot be
|
||||
resolved by making changes to the libvirt code. For these paths, it is
|
||||
possible to add a filter to avoid the errors. For example:
|
||||
|
||||
==4643== 7 bytes in 1 blocks are possibly lost in loss record 4 of 20
|
||||
==4643== at 0x4A0881C: malloc (vg_replace_malloc.c:270)
|
||||
==4643== by 0x34D90853F1: strdup (in /usr/lib64/libc-2.15.so)
|
||||
==4643== by 0x34EEC2C08A: ??? (in /usr/lib64/libnl.so.1.1)
|
||||
==4643== by 0x34EEC15B81: ??? (in /usr/lib64/libnl.so.1.1)
|
||||
==4643== by 0x34D8C0EE15: call_init.part.0 (in /usr/lib64/ld-2.15.so)
|
||||
==4643== by 0x34D8C0EECF: _dl_init (in /usr/lib64/ld-2.15.so)
|
||||
==4643== by 0x34D8C01569: ??? (in /usr/lib64/ld-2.15.so)
|
||||
|
||||
|
||||
In this instance, it is acceptable to modify the "tests/.valgrind.supp" file
|
||||
in order to add a suppression filter. The filter should be unique enough to
|
||||
not suppress real leaks, but it should be generic enough to cover multiple
|
||||
code paths. The format of the entry can be found in the documentation found at
|
||||
the Valgrind home page <http://valgrind.org/>. The following trace was added
|
||||
to "tests/.valgrind.supp" in order to suppress the warning:
|
||||
|
||||
{
|
||||
dlInitMemoryLeak1
|
||||
Memcheck:Leak
|
||||
fun:?alloc
|
||||
...
|
||||
fun:call_init.part.0
|
||||
fun:_dl_init
|
||||
...
|
||||
obj:*/lib*/ld-2.*so*
|
||||
}
|
||||
|
||||
|
||||
|
||||
(8) Update tests and/or documentation, particularly if you are adding a new
|
||||
(6) Update tests and/or documentation, particularly if you are adding a new
|
||||
feature or changing the output of a program.
|
||||
|
||||
|
||||
|
||||
There is more on this subject, including lots of links to background reading
|
||||
on the subject, on Richard Jones' guide to working with open source projects
|
||||
<http://et.redhat.com/~rjones/how-to-supply-code-to-open-source-projects/>.
|
||||
on the subject, on
|
||||
|
||||
Richard Jones' guide to working with open source projects
|
||||
http://et.redhat.com/~rjones/how-to-supply-code-to-open-source-projects/
|
||||
|
||||
|
||||
Code indentation
|
||||
@ -297,57 +182,34 @@ declare them at the beginning of a scope, rather than immediately before use.
|
||||
Bracket spacing
|
||||
===============
|
||||
The keywords "if", "for", "while", and "switch" must have a single space
|
||||
following them before the opening bracket. E.g.
|
||||
following them before the opening bracket. eg
|
||||
|
||||
if(foo) // Bad
|
||||
if (foo) // Good
|
||||
|
||||
Function implementations mustnothave any whitespace between the function name and the opening bracket. E.g.
|
||||
Function implementations mustnothave any whitespace between the function name and the opening bracket. eg
|
||||
|
||||
int foo (int wizz) // Bad
|
||||
int foo(int wizz) // Good
|
||||
|
||||
Function calls mustnothave any whitespace between the function name and the opening bracket. E.g.
|
||||
Function calls mustnothave any whitespace between the function name and the opening bracket. eg
|
||||
|
||||
bar = foo (wizz); // Bad
|
||||
bar = foo(wizz); // Good
|
||||
|
||||
Function typedefs mustnothave any whitespace between the closing bracket of the function name and
|
||||
opening bracket of the arg list. E.g.
|
||||
opening bracket of the arg list. eg
|
||||
|
||||
typedef int (*foo) (int wizz); // Bad
|
||||
typedef int (*foo)(int wizz); // Good
|
||||
|
||||
There must not be any whitespace immediately following any opening bracket, or
|
||||
immediately prior to any closing bracket. E.g.
|
||||
immediately prior to any closing bracket
|
||||
|
||||
int foo( int wizz ); // Bad
|
||||
int foo(int wizz); // Good
|
||||
|
||||
|
||||
Semicolons
|
||||
==========
|
||||
Semicolons should never have a space beforehand. Inside the condition of a
|
||||
"for" loop, there should always be a space or line break after each semicolon,
|
||||
except for the special case of an infinite loop (although more infinite loops
|
||||
use "while"). While not enforced, loop counters generally use post-increment.
|
||||
|
||||
for (i = 0 ;i < limit ; ++i) { // Bad
|
||||
for (i = 0; i < limit; i++) { // Good
|
||||
for (;;) { // ok
|
||||
while (1) { // Better
|
||||
|
||||
Empty loop bodies are better represented with curly braces and a comment,
|
||||
although use of a semicolon is not currently rejected.
|
||||
|
||||
while ((rc = waitpid(pid, &st, 0) == -1) &&
|
||||
errno == EINTR); // ok
|
||||
while ((rc = waitpid(pid, &st, 0) == -1) &&
|
||||
errno == EINTR) { // Better
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
|
||||
Curly braces
|
||||
============
|
||||
Omit the curly braces around an "if", "while", "for" etc. body only when that
|
||||
@ -360,7 +222,7 @@ Omitting braces with a single-line body is fine:
|
||||
while (expr) // one-line body -> omitting curly braces is ok
|
||||
single_line_stmt();
|
||||
|
||||
However, the moment your loop/if/else body extends on to a second line, for
|
||||
However, the moment your loop/if/else body extends onto a second line, for
|
||||
whatever reason (even if it's just an added comment), then you should add
|
||||
braces. Otherwise, it would be too easy to insert a statement just before that
|
||||
comment (without adding braces), thinking it is already a multi-statement loop:
|
||||
@ -448,11 +310,6 @@ But if negating a complex condition is too ugly, then at least add braces:
|
||||
|
||||
Preprocessor
|
||||
============
|
||||
Macros defined with an ALL_CAPS name should generally be assumed to be unsafe
|
||||
with regards to arguments with side-effects (that is, MAX(a++, b--) might
|
||||
increment a or decrement b too many or too few times). Exceptions to this rule
|
||||
are explicitly documented for macros in viralloc.h and virstring.h.
|
||||
|
||||
For variadic macros, stick with C99 syntax:
|
||||
|
||||
#define vshPrint(_ctl, ...) fprintf(stdout, __VA_ARGS__)
|
||||
@ -536,14 +393,16 @@ Low level memory management
|
||||
Use of the malloc/free/realloc/calloc APIs is deprecated in the libvirt
|
||||
codebase, because they encourage a number of serious coding bugs and do not
|
||||
enable compile time verification of checks for NULL. Instead of these
|
||||
routines, use the macros from viralloc.h.
|
||||
routines, use the macros from memory.h.
|
||||
|
||||
- To allocate a single object:
|
||||
|
||||
virDomainPtr domain;
|
||||
|
||||
if (VIR_ALLOC(domain) < 0)
|
||||
if (VIR_ALLOC(domain) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -552,8 +411,10 @@ routines, use the macros from viralloc.h.
|
||||
virDomainPtr domains;
|
||||
size_t ndomains = 10;
|
||||
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0)
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -562,8 +423,10 @@ routines, use the macros from viralloc.h.
|
||||
virDomainPtr *domains;
|
||||
size_t ndomains = 10;
|
||||
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0)
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -574,8 +437,10 @@ recommended only for smaller arrays):
|
||||
virDomainPtr domains;
|
||||
size_t ndomains = 0;
|
||||
|
||||
if (VIR_EXPAND_N(domains, ndomains, 1) < 0)
|
||||
if (VIR_EXPAND_N(domains, ndomains, 1) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
domains[ndomains - 1] = domain;
|
||||
|
||||
|
||||
@ -587,8 +452,10 @@ scales better, but requires tracking allocation separately from usage)
|
||||
size_t ndomains = 0;
|
||||
size_t ndomains_max = 0;
|
||||
|
||||
if (VIR_RESIZE_N(domains, ndomains_max, ndomains, 1) < 0)
|
||||
if (VIR_RESIZE_N(domains, ndomains_max, ndomains, 1) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
domains[ndomains++] = domain;
|
||||
|
||||
|
||||
@ -744,17 +611,6 @@ sizeof(dest) returns something meaningful). Note that this is a macro, so
|
||||
arguments could be evaluated more than once. This is equivalent to
|
||||
virStrncpy(dest, src, strlen(src), sizeof(dest)).
|
||||
|
||||
VIR_STRDUP(char *dst, const char *src);
|
||||
VIR_STRNDUP(char *dst, const char *src, size_t n);
|
||||
|
||||
You should avoid using strdup or strndup directly as they do not report
|
||||
out-of-memory error, and do not allow a NULL source. Use VIR_STRDUP or
|
||||
VIR_STRNDUP macros instead, which return 0 for NULL source, 1 for successful
|
||||
copy, and -1 for allocation failure with the error already reported. In very
|
||||
specific cases, when you don't want to report the out-of-memory error, you can
|
||||
use VIR_STRDUP_QUIET or VIR_STRNDUP_QUIET, but such usage is very rare and
|
||||
usually considered a flaw.
|
||||
|
||||
|
||||
Variable length string buffer
|
||||
=============================
|
||||
@ -808,7 +664,7 @@ stick to the following general plan for all *.c source files:
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#if WITH_NUMACTL Some system includes aren't supported
|
||||
#if HAVE_NUMACTL Some system includes aren't supported
|
||||
# include <numa.h> everywhere so need these #if guards.
|
||||
#endif
|
||||
|
||||
@ -822,12 +678,9 @@ stick to the following general plan for all *.c source files:
|
||||
{
|
||||
...
|
||||
|
||||
Of particular note: *Do not* include libvirt/libvirt.h, libvirt/virterror.h,
|
||||
libvirt/libvirt-qemu.h, or libvirt/libvirt-lxc.h. They are included by
|
||||
"internal.h" already and there are some special reasons why you cannot include
|
||||
these files explicitly. One of the special cases, "libvirt/libvirt.h" is
|
||||
included prior to "internal.h" in "remote_protocol.x", to avoid exposing
|
||||
*_LAST enum elements.
|
||||
Of particular note: *Do not* include libvirt/libvirt.h or libvirt/virterror.h.
|
||||
It is included by "internal.h" already and there are some special reasons why
|
||||
you cannot include these files explicitly.
|
||||
|
||||
|
||||
Printf-style functions
|
||||
@ -890,7 +743,9 @@ logic would be better pulled out into a helper function.
|
||||
|
||||
Although libvirt does not encourage the Linux kernel wind/unwind style of
|
||||
multiple labels, there's a good general discussion of the issue archived at
|
||||
KernelTrap <http://kerneltrap.org/node/553/2131>
|
||||
|
||||
KernelTrap
|
||||
http://kerneltrap.org/node/553/2131
|
||||
|
||||
When using goto, please use one of these standard labels if it makes sense:
|
||||
|
||||
|
34
Makefile.am
34
Makefile.am
@ -1,20 +1,7 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
## Copyright (C) 2005-2013 Red Hat, Inc.
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
## License as published by the Free Software Foundation; either
|
||||
## version 2.1 of the License, or (at your option) any later version.
|
||||
##
|
||||
## This library is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public
|
||||
## License along with this library. If not, see
|
||||
## <http://www.gnu.org/licenses/>.
|
||||
## Copyright (C) 2005-2012 Red Hat, Inc.
|
||||
## See COPYING.LIB for the License of this software
|
||||
|
||||
LCOV = lcov
|
||||
GENHTML = genhtml
|
||||
@ -55,13 +42,10 @@ NEWS: $(top_srcdir)/docs/news.xsl $(top_srcdir)/docs/news.html.in
|
||||
| perl -pe 's/[ \t]+$$//' \
|
||||
> $@-t && mv $@-t $@ ; fi
|
||||
|
||||
$(top_srcdir)/HACKING: $(top_srcdir)/docs/hacking1.xsl \
|
||||
$(top_srcdir)/docs/hacking2.xsl \
|
||||
$(top_srcdir)/docs/wrapstring.xsl \
|
||||
$(top_srcdir)/docs/hacking.html.in
|
||||
$(top_srcdir)/HACKING: $(top_srcdir)/docs/hacking1.xsl $(top_srcdir)/docs/hacking2.xsl \
|
||||
$(top_srcdir)/docs/wrapstring.xsl $(top_srcdir)/docs/hacking.html.in
|
||||
$(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \
|
||||
$(XSLTPROC) --nonet $(top_srcdir)/docs/hacking1.xsl \
|
||||
$(top_srcdir)/docs/hacking.html.in | \
|
||||
$(XSLTPROC) --nonet $(top_srcdir)/docs/hacking1.xsl $(top_srcdir)/docs/hacking.html.in | \
|
||||
$(XSLTPROC) --nonet $(top_srcdir)/docs/hacking2.xsl - \
|
||||
| perl -0777 -pe 's/\n\n+$$/\n/' \
|
||||
> $@-t && mv $@-t $@ ; fi;
|
||||
@ -111,9 +95,9 @@ gen-ChangeLog:
|
||||
|
||||
.PHONY: gen-AUTHORS
|
||||
gen-AUTHORS:
|
||||
$(AM_V_GEN)if test -d $(srcdir)/.git; then \
|
||||
out="`cd $(srcdir) && git log --pretty=format:'%aN <%aE>' | sort -u`" && \
|
||||
perl -p -e "s/#authorslist#// and print '$$out'" \
|
||||
< $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp && \
|
||||
$(AM_V_GEN)if test -d .git; then \
|
||||
out="`git log --pretty=format:'%aN <%aE>' | sort -u`" && \
|
||||
cat $(srcdir)/AUTHORS.in | perl -p -e "s/#authorslist#/$$out/" > \
|
||||
$(distdir)/AUTHORS-tmp && \
|
||||
mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS ; \
|
||||
fi
|
||||
|
@ -1,18 +1,3 @@
|
||||
## Copyright (C) 2009-2010, 2013 Red Hat, Inc.
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
## License as published by the Free Software Foundation; either
|
||||
## version 2.1 of the License, or (at your option) any later version.
|
||||
##
|
||||
## This library is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public
|
||||
## License along with this library. If not, see
|
||||
## <http://www.gnu.org/licenses/>.
|
||||
|
||||
#
|
||||
# Generated by running the following on Fedora 9:
|
||||
|
@ -18,11 +18,9 @@ cd build
|
||||
# Run with options not normally exercised by the rpm build, for
|
||||
# more complete code coverage.
|
||||
../autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \
|
||||
--enable-expensive-tests \
|
||||
--enable-test-coverage \
|
||||
--disable-nls \
|
||||
--enable-werror \
|
||||
--enable-static
|
||||
--enable-werror
|
||||
|
||||
# If the MAKEFLAGS envvar does not yet include a -j option,
|
||||
# add -jN where N depends on the number of processors.
|
||||
@ -70,14 +68,12 @@ fi
|
||||
if test -x /usr/bin/i686-w64-mingw32-gcc ; then
|
||||
make distclean
|
||||
|
||||
PKG_CONFIG_LIBDIR="/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-w64-mingw32/sys-root/mingw/share/pkgconfig" \
|
||||
PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig" \
|
||||
CC="i686-w64-mingw32-gcc" \
|
||||
../configure \
|
||||
--build=$(uname -m)-w64-linux \
|
||||
--host=i686-w64-mingw32 \
|
||||
--prefix="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw" \
|
||||
--enable-expensive-tests \
|
||||
--enable-werror \
|
||||
--without-libvirtd \
|
||||
--without-python
|
||||
@ -91,14 +87,12 @@ fi
|
||||
if test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
|
||||
make distclean
|
||||
|
||||
PKG_CONFIG_LIBDIR="/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/x86_64-w64-mingw32/sys-root/mingw/share/pkgconfig" \
|
||||
PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig" \
|
||||
CC="x86_64-w64-mingw32-gcc" \
|
||||
../configure \
|
||||
--build=$(uname -m)-w64-linux \
|
||||
--host=x86_64-w64-mingw32 \
|
||||
--prefix="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw" \
|
||||
--enable-expensive-tests \
|
||||
--enable-werror \
|
||||
--without-libvirtd \
|
||||
--without-python
|
||||
|
12
autogen.sh
12
autogen.sh
@ -49,10 +49,6 @@ fi
|
||||
# we rerun bootstrap to pull in those diffs.
|
||||
bootstrap_hash()
|
||||
{
|
||||
if test "$no_git"; then
|
||||
echo no-git
|
||||
return
|
||||
fi
|
||||
git submodule status | sed 's/^[ +-]//;s/ .*//'
|
||||
git hash-object bootstrap.conf
|
||||
git ls-tree -d HEAD gnulib/local | awk '{print $3}'
|
||||
@ -64,11 +60,9 @@ bootstrap_hash()
|
||||
# like to run 'git clean -x -f po' to fix it; but only ./bootstrap regenerates
|
||||
# the required file po/Makevars.
|
||||
# Only run bootstrap from a git checkout, never from a tarball.
|
||||
if test -d .git || test -f .git; then
|
||||
if test -d .git; then
|
||||
curr_status=.git-module-status t=
|
||||
if test "$no_git"; then
|
||||
t=no-git
|
||||
elif test -d .gnulib; then
|
||||
if test -d .gnulib; then
|
||||
t=$(bootstrap_hash; git diff .gnulib)
|
||||
fi
|
||||
case $t:${CLEAN_SUBMODULE+set} in
|
||||
@ -84,7 +78,7 @@ if test -d .git || test -f .git; then
|
||||
# good, it's up to date, all we need is autoreconf
|
||||
autoreconf -if
|
||||
else
|
||||
if test -z "$no_git" && test ${CLEAN_SUBMODULE+set}; then
|
||||
if test ${CLEAN_SUBMODULE+set}; then
|
||||
echo cleaning up submodules...
|
||||
git submodule foreach 'git clean -dfqx && git reset --hard'
|
||||
fi
|
||||
|
146
bootstrap
146
bootstrap
@ -1,10 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2013-08-15.22; # UTC
|
||||
scriptversion=2012-07-19.14; # UTC
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2012 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -140,21 +140,20 @@ po_download_command_format2=\
|
||||
"wget --mirror -nd -q -np -A.po -P '%s' \
|
||||
http://translationproject.org/latest/%s/"
|
||||
|
||||
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
||||
# fall back to the package name (1st argument with munging)
|
||||
extract_package_name='
|
||||
/^AC_INIT(\[*/{
|
||||
s///
|
||||
/^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{
|
||||
s//\1/
|
||||
s/[],)].*//
|
||||
/^AC_INIT(/{
|
||||
/.*,.*,.*, */{
|
||||
s///
|
||||
s/[][]//g
|
||||
s/)$//
|
||||
p
|
||||
q
|
||||
}
|
||||
s/[],)].*//
|
||||
s/AC_INIT(\[*//
|
||||
s/]*,.*//
|
||||
s/^GNU //
|
||||
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
|
||||
s/[^A-Za-z0-9_]/-/g
|
||||
p
|
||||
}
|
||||
'
|
||||
@ -224,21 +223,27 @@ find_tool ()
|
||||
find_tool_names=$@
|
||||
eval "find_tool_res=\$$find_tool_envvar"
|
||||
if test x"$find_tool_res" = x; then
|
||||
for i; do
|
||||
for i
|
||||
do
|
||||
if ($i --version </dev/null) >/dev/null 2>&1; then
|
||||
find_tool_res=$i
|
||||
break
|
||||
find_tool_res=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
find_tool_error_prefix="\$$find_tool_envvar: "
|
||||
fi
|
||||
if test x"$find_tool_res" = x; then
|
||||
warn_ "one of these is required: $find_tool_names;"
|
||||
die "alternatively set $find_tool_envvar to a compatible tool"
|
||||
fi
|
||||
test x"$find_tool_res" != x \
|
||||
|| die "one of these is required: $find_tool_names"
|
||||
($find_tool_res --version </dev/null) >/dev/null 2>&1 \
|
||||
|| die "${find_tool_error_prefix}cannot run $find_tool_res --version"
|
||||
eval "$find_tool_envvar=\$find_tool_res"
|
||||
eval "export $find_tool_envvar"
|
||||
}
|
||||
|
||||
# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
|
||||
find_tool SHA1SUM sha1sum gsha1sum shasum
|
||||
|
||||
# Override the default configuration, if necessary.
|
||||
# Make sure that bootstrap.conf is sourced from the current directory
|
||||
# if we were invoked as "sh bootstrap".
|
||||
@ -250,12 +255,12 @@ esac
|
||||
# Extra files from gnulib, which override files from other sources.
|
||||
test -z "${gnulib_extra_files}" && \
|
||||
gnulib_extra_files="
|
||||
build-aux/install-sh
|
||||
build-aux/mdate-sh
|
||||
build-aux/texinfo.tex
|
||||
build-aux/depcomp
|
||||
build-aux/config.guess
|
||||
build-aux/config.sub
|
||||
$build_aux/install-sh
|
||||
$build_aux/mdate-sh
|
||||
$build_aux/texinfo.tex
|
||||
$build_aux/depcomp
|
||||
$build_aux/config.guess
|
||||
$build_aux/config.sub
|
||||
doc/INSTALL
|
||||
"
|
||||
|
||||
@ -301,34 +306,34 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
|
||||
die "Bootstrapping from a non-checked-out distribution is risky."
|
||||
fi
|
||||
|
||||
# Strip blank and comment lines to leave significant entries.
|
||||
gitignore_entries() {
|
||||
sed '/^#/d; /^$/d' "$@"
|
||||
# Ensure that lines starting with ! sort last, per gitignore conventions
|
||||
# for whitelisting exceptions after a more generic blacklist pattern.
|
||||
sort_patterns() {
|
||||
sort -u "$@" | sed '/^!/ {
|
||||
H
|
||||
d
|
||||
}
|
||||
$ {
|
||||
P
|
||||
x
|
||||
s/^\n//
|
||||
}' | sed '/^$/d'
|
||||
}
|
||||
|
||||
# If $STR is not already on a line by itself in $FILE, insert it at the start.
|
||||
# Entries are inserted at the start of the ignore list to ensure existing
|
||||
# entries starting with ! are not overridden. Such entries support
|
||||
# whitelisting exceptions after a more generic blacklist pattern.
|
||||
insert_if_absent() {
|
||||
# If $STR is not already on a line by itself in $FILE, insert it,
|
||||
# sorting the new contents of the file and replacing $FILE with the result.
|
||||
insert_sorted_if_absent() {
|
||||
file=$1
|
||||
str=$2
|
||||
test -f $file || touch $file
|
||||
test -r $file || die "Error: failed to read ignore file: $file"
|
||||
duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
|
||||
if [ "$duplicate_entries" ] ; then
|
||||
die "Error: Duplicate entries in $file: " $duplicate_entries
|
||||
fi
|
||||
linesold=$(gitignore_entries $file | wc -l)
|
||||
linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
|
||||
if [ $linesold != $linesnew ] ; then
|
||||
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|
||||
|| die "insert_if_absent $file $str: failed"
|
||||
fi
|
||||
echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
|
||||
|| { echo "$str" | sort_patterns - $file > $file.bak \
|
||||
&& mv $file.bak $file; } \
|
||||
|| die "insert_sorted_if_absent $file $str: failed"
|
||||
}
|
||||
|
||||
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
||||
# insert_if_absent.
|
||||
# insert_sorted_if_absent.
|
||||
insert_vc_ignore() {
|
||||
vc_ignore_file="$1"
|
||||
pattern="$2"
|
||||
@ -339,7 +344,7 @@ insert_vc_ignore() {
|
||||
# .gitignore entry.
|
||||
pattern=$(echo "$pattern" | sed s,^,/,);;
|
||||
esac
|
||||
insert_if_absent "$vc_ignore_file" "$pattern"
|
||||
insert_sorted_if_absent "$vc_ignore_file" "$pattern"
|
||||
}
|
||||
|
||||
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
||||
@ -463,7 +468,7 @@ check_versions() {
|
||||
if [ "$req_ver" = "-" ]; then
|
||||
# Merely require app to exist; not all prereq apps are well-behaved
|
||||
# so we have to rely on $? rather than get_version.
|
||||
$app --version >/dev/null 2>&1 </dev/null
|
||||
$app --version >/dev/null 2>&1
|
||||
if [ 126 -le $? ]; then
|
||||
warn_ "Error: '$app' not found"
|
||||
ret=1
|
||||
@ -497,12 +502,6 @@ print_versions() {
|
||||
# can't depend on column -t
|
||||
}
|
||||
|
||||
# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
|
||||
# Also find the compatible sha1 utility on the BSDs
|
||||
if test x"$SKIP_PO" = x; then
|
||||
find_tool SHA1SUM sha1sum gsha1sum shasum sha1
|
||||
fi
|
||||
|
||||
use_libtool=0
|
||||
# We'd like to use grep -E, to see if any of LT_INIT,
|
||||
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
||||
@ -551,7 +550,7 @@ fi
|
||||
echo "$0: Bootstrapping from checked-out $package sources..."
|
||||
|
||||
# See if we can use gnulib's git-merge-changelog merge driver.
|
||||
if $use_git && test -d .git && (git --version) >/dev/null 2>/dev/null ; then
|
||||
if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
|
||||
if git config merge.merge-changelog.driver >/dev/null ; then
|
||||
:
|
||||
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
|
||||
@ -574,17 +573,13 @@ git_modules_config () {
|
||||
test -f .gitmodules && git config --file .gitmodules "$@"
|
||||
}
|
||||
|
||||
if $use_git; then
|
||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||
fi
|
||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||
|
||||
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
||||
# submodule, for use in the rest of the script.
|
||||
# Get gnulib files.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-)
|
||||
# Note that $use_git is necessarily true in this case.
|
||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule init || exit $?
|
||||
@ -605,8 +600,8 @@ case ${GNULIB_SRCDIR--} in
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
;;
|
||||
*)
|
||||
# Use GNULIB_SRCDIR directly or as a reference.
|
||||
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
|
||||
# Use GNULIB_SRCDIR as a reference.
|
||||
if test -d "$GNULIB_SRCDIR"/.git && \
|
||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
if git submodule -h|grep -- --reference > /dev/null; then
|
||||
@ -632,19 +627,12 @@ case ${GNULIB_SRCDIR--} in
|
||||
;;
|
||||
esac
|
||||
|
||||
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
||||
# we no longer need to use git or $gnulib_path below here.
|
||||
|
||||
if $bootstrap_sync; then
|
||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||
echo "$0: updating bootstrap and restarting..."
|
||||
case $(sh -c 'echo "$1"' -- a) in
|
||||
a) ignored=--;;
|
||||
*) ignored=ignored;;
|
||||
esac
|
||||
exec sh -c \
|
||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||
-- "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||
"$0" "$@" --no-bootstrap-sync
|
||||
}
|
||||
fi
|
||||
@ -692,10 +680,11 @@ update_po_files() {
|
||||
cksum_file="$ref_po_dir/$po.s1"
|
||||
if ! test -f "$cksum_file" ||
|
||||
! test -f "$po_dir/$po.po" ||
|
||||
! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
|
||||
! $SHA1SUM -c --status "$cksum_file" \
|
||||
< "$new_po" > /dev/null; then
|
||||
echo "$me: updated $po_dir/$po.po..."
|
||||
cp "$new_po" "$po_dir/$po.po" \
|
||||
&& $SHA1SUM < "$new_po" > "$cksum_file" || return
|
||||
&& $SHA1SUM < "$new_po" > "$cksum_file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
@ -900,21 +889,20 @@ find "$m4_base" "$source_base" \
|
||||
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
|
||||
-type l -xtype l -delete > /dev/null 2>&1
|
||||
|
||||
# Invoke autoreconf with --force --install to ensure upgrades of tools
|
||||
# such as ylwrap.
|
||||
AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS"
|
||||
|
||||
# Some systems (RHEL 5) are using ancient autotools, for which the
|
||||
# --no-recursive option had not been invented. Detect that lack and
|
||||
# omit the option when it's not supported. FIXME in 2017: remove this
|
||||
# hack when RHEL 5 autotools are updated, or when they become irrelevant.
|
||||
no_recursive=
|
||||
case $($AUTORECONF --help) in
|
||||
*--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";;
|
||||
*--no-recursive*) no_recursive=--no-recursive;;
|
||||
esac
|
||||
|
||||
# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
|
||||
echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS"
|
||||
AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \
|
||||
echo "running: AUTOPOINT=true LIBTOOLIZE=true " \
|
||||
"$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS"
|
||||
AUTOPOINT=true LIBTOOLIZE=true \
|
||||
$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS \
|
||||
|| die "autoreconf failed"
|
||||
|
||||
# Get some extra files from gnulib, overriding existing files.
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Bootstrap configuration.
|
||||
|
||||
# Copyright (C) 2010-2013 Red Hat, Inc.
|
||||
# Copyright (C) 2010-2012 Red Hat, Inc.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@ -20,7 +20,6 @@
|
||||
gnulib_modules='
|
||||
accept
|
||||
areadlink
|
||||
autobuild
|
||||
base64
|
||||
bind
|
||||
bitrotate
|
||||
@ -71,8 +70,6 @@ listen
|
||||
localeconv
|
||||
maintainer-makefile
|
||||
manywarnings
|
||||
mgetgroups
|
||||
mkdtemp
|
||||
mkostemp
|
||||
mkostemps
|
||||
mktempd
|
||||
@ -94,7 +91,6 @@ regex
|
||||
random_r
|
||||
sched
|
||||
send
|
||||
setenv
|
||||
setsockopt
|
||||
sigaction
|
||||
sigpipe
|
||||
@ -233,19 +229,20 @@ touch AUTHORS ChangeLog || exit 1
|
||||
|
||||
# Override bootstrap's list - we don't use mdate-sh or texinfo.tex.
|
||||
gnulib_extra_files="
|
||||
build-aux/install-sh
|
||||
build-aux/depcomp
|
||||
build-aux/config.guess
|
||||
build-aux/config.sub
|
||||
$build_aux/install-sh
|
||||
$build_aux/depcomp
|
||||
$build_aux/config.guess
|
||||
$build_aux/config.sub
|
||||
doc/INSTALL
|
||||
"
|
||||
|
||||
|
||||
bootstrap_post_import_hook()
|
||||
bootstrap_epilogue()
|
||||
{
|
||||
# Change paths in gnulib/tests/gnulib.mk from "../../.." to "../..",
|
||||
# and make tests conditional by changing "TESTS" to "GNULIB_TESTS".
|
||||
# then ensure that gnulib/tests/Makefile.in is up-to-date.
|
||||
m=gnulib/tests/gnulib.mk
|
||||
sed 's,\.\./\.\./\.\.,../..,g; s/^TESTS /GNULIB_TESTS /' $m > $m-t
|
||||
sed 's,\.\./\.\./\.\.,../..,g' $m > $m-t
|
||||
mv -f $m-t $m
|
||||
${AUTOMAKE-automake} gnulib/tests/Makefile
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# bracket-spacing.pl: Report any usage of 'function (..args..)'
|
||||
# Also check for other syntax issues, such as correct use of ';'
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@ -32,11 +31,8 @@ foreach my $file (@ARGV) {
|
||||
while (defined (my $line = <FILE>)) {
|
||||
my $data = $line;
|
||||
|
||||
# Kill any quoted ; or "
|
||||
$data =~ s,'[";]','X',g;
|
||||
|
||||
# Kill any quoted strings
|
||||
$data =~ s,"([^\\\"]|\\.)*","XXX",g;
|
||||
# Kill any quoted strongs
|
||||
$data =~ s,".*?","XXX",g;
|
||||
|
||||
# Kill any C++ style comments
|
||||
$data =~ s,//.*$,//,;
|
||||
@ -92,8 +88,8 @@ foreach my $file (@ARGV) {
|
||||
|
||||
# Require whitespace immediately after keywords,
|
||||
# but none after the opening bracket
|
||||
while ($data =~ /\b(if|for|while|switch|return)\(/ ||
|
||||
$data =~ /\b(if|for|while|switch|return)\s+\(\s/) {
|
||||
while ($data =~ /(if|for|while|switch|return)\(/ ||
|
||||
$data =~ /(if|for|while|switch|return)\s+\(\s/) {
|
||||
print "$file:$.: $line";
|
||||
$ret = 1;
|
||||
last;
|
||||
@ -113,30 +109,6 @@ foreach my $file (@ARGV) {
|
||||
$ret = 1;
|
||||
last;
|
||||
}
|
||||
|
||||
# Forbid whitespace before ";". Things like below are allowed:
|
||||
#
|
||||
# 1) The expression is empty for "for" loop. E.g.
|
||||
# for (i = 0; ; i++)
|
||||
#
|
||||
# 2) An empty statement. E.g.
|
||||
# while (write(statuswrite, &status, 1) == -1 &&
|
||||
# errno == EINTR)
|
||||
# ;
|
||||
#
|
||||
while ($data =~ /[^;\s]\s+;/) {
|
||||
print "$file:$.: $line";
|
||||
$ret = 1;
|
||||
last;
|
||||
}
|
||||
|
||||
# Require EOL, macro line continuation, or whitespace after ";".
|
||||
# Allow "for (;;)" as an exception.
|
||||
while ($data =~ /;[^ \\\n;)]/) {
|
||||
print "$file:$.: $line";
|
||||
$ret = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
}
|
||||
|
239
cfg.mk
239
cfg.mk
@ -1,5 +1,5 @@
|
||||
# Customize Makefile.maint. -*- makefile -*-
|
||||
# Copyright (C) 2008-2013 Red Hat, Inc.
|
||||
# Copyright (C) 2008-2012 Red Hat, Inc.
|
||||
# Copyright (C) 2003-2008 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@ -93,15 +93,11 @@ VC_LIST_ALWAYS_EXCLUDE_REGEX = \
|
||||
|
||||
# Functions like free() that are no-ops on NULL arguments.
|
||||
useless_free_options = \
|
||||
--name=VBOX_UTF16_FREE \
|
||||
--name=VBOX_UTF8_FREE \
|
||||
--name=VBOX_COM_UNALLOC_MEM \
|
||||
--name=VIR_FREE \
|
||||
--name=qemuCapsFree \
|
||||
--name=qemuMigrationCookieFree \
|
||||
--name=qemuMigrationCookieGraphicsFree \
|
||||
--name=sexpr_free \
|
||||
--name=usbFreeDevice \
|
||||
--name=virBandwidthDefFree \
|
||||
--name=virBitmapFree \
|
||||
--name=virCPUDefFree \
|
||||
@ -165,7 +161,6 @@ useless_free_options = \
|
||||
--name=virNodeDeviceObjFree \
|
||||
--name=virObjectUnref \
|
||||
--name=virObjectFreeCallback \
|
||||
--name=virPCIDeviceFree \
|
||||
--name=virSecretDefFree \
|
||||
--name=virStorageEncryptionFree \
|
||||
--name=virStorageEncryptionSecretFree \
|
||||
@ -307,7 +302,6 @@ sc_flags_usage:
|
||||
@test "$$(cat $(srcdir)/include/libvirt/libvirt.h.in \
|
||||
$(srcdir)/include/libvirt/virterror.h \
|
||||
$(srcdir)/include/libvirt/libvirt-qemu.h \
|
||||
$(srcdir)/include/libvirt/libvirt-lxc.h \
|
||||
| grep -c '\(long\|unsigned\) flags')" != 4 && \
|
||||
{ echo '$(ME): new API should use "unsigned int flags"' 1>&2; \
|
||||
exit 1; } || :
|
||||
@ -327,7 +321,7 @@ sc_prohibit_internal_functions:
|
||||
# Avoid raw malloc and free, except in documentation comments.
|
||||
sc_prohibit_raw_allocation:
|
||||
@prohibit='^.[^*].*\<((m|c|re)alloc|free) *\([^)]' \
|
||||
halt='use VIR_ macros from viralloc.h instead of malloc/free' \
|
||||
halt='use VIR_ macros from memory.h instead of malloc/free' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Avoid functions that can lead to double-close bugs.
|
||||
@ -379,19 +373,10 @@ sc_prohibit_strtol:
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Use virAsprintf rather than as'printf since *strp is undefined on error.
|
||||
# But for plain %s, virAsprintf is overkill compared to strdup.
|
||||
sc_prohibit_asprintf:
|
||||
@prohibit='\<v?a[s]printf\>' \
|
||||
halt='use virAsprintf, not as'printf \
|
||||
$(_sc_search_regexp)
|
||||
@prohibit='virAsprintf.*, *"%s",' \
|
||||
halt='use VIR_STRDUP instead of virAsprintf with "%s"' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_strdup:
|
||||
@prohibit='\<strn?dup\> *\(' \
|
||||
halt='use VIR_STRDUP, not strdup' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Prefer virSetUIDGID.
|
||||
sc_prohibit_setuid:
|
||||
@ -399,12 +384,6 @@ sc_prohibit_setuid:
|
||||
halt='use virSetUIDGID, not raw set*id' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Don't compare *id_t against raw -1.
|
||||
sc_prohibit_risky_id_promotion:
|
||||
@prohibit='\b(user|group|[ug]id) *[=!]= *-' \
|
||||
halt='cast -1 to ([ug]id_t) before comparing against id' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Use snprintf rather than s'printf, even if buffer is provably large enough,
|
||||
# since gnulib has more guarantees for snprintf portability
|
||||
sc_prohibit_sprintf:
|
||||
@ -450,11 +429,6 @@ sc_prohibit_nonreentrant:
|
||||
done ; \
|
||||
exit $$fail
|
||||
|
||||
sc_prohibit_select:
|
||||
@prohibit="\\<select *\\(" \
|
||||
halt="use poll(), not se""lect()" \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Prohibit the inclusion of <ctype.h>.
|
||||
sc_prohibit_ctype_h:
|
||||
@prohibit='^# *include *<ctype\.h>' \
|
||||
@ -501,11 +475,6 @@ sc_prohibit_virBufferAdd_with_string_literal:
|
||||
halt='use virBufferAddLit, not virBufferAdd, with a string literal' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_virBufferAsprintf_with_string_literal:
|
||||
@prohibit='\<virBufferAsprintf *\([^,]+, *"([^%"\]|\\.|%%)*"\)' \
|
||||
halt='use virBufferAddLit, not virBufferAsprintf, with a string literal' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Not only do they fail to deal well with ipv6, but the gethostby*
|
||||
# functions are also not thread-safe.
|
||||
sc_prohibit_gethostby:
|
||||
@ -513,12 +482,6 @@ sc_prohibit_gethostby:
|
||||
halt='use getaddrinfo, not gethostby*' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# dirname and basename from <libgen.h> are not required to be thread-safe
|
||||
sc_prohibit_libgen:
|
||||
@prohibit='( (base|dir)name *\(|include .libgen\.h)' \
|
||||
halt='use functions from gnulib "dirname.h", not <libgen.h>' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# raw xmlGetProp requires some nasty casts
|
||||
sc_prohibit_xmlGetProp:
|
||||
@prohibit='\<xmlGetProp *\(' \
|
||||
@ -545,23 +508,6 @@ sc_avoid_attribute_unused_in_header:
|
||||
halt='use ATTRIBUTE_UNUSED in .c rather than .h files' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_int_ijk:
|
||||
@prohibit='\<(int|unsigned) ([^(]* )*(i|j|k)(\s|,|;)' \
|
||||
halt='use size_t, not int/unsigned int for loop vars i, j, k' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_loop_iijjkk:
|
||||
@prohibit='\<(int|unsigned) ([^=]+ )*(ii|jj|kk)(\s|,|;)' \
|
||||
halt='use i, j, k for loop iterators, not ii, jj, kk' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# RHEL 5 gcc can't grok "for (int i..."
|
||||
sc_prohibit_loop_var_decl:
|
||||
@prohibit='\<for *\(\w+[ *]+\w+' \
|
||||
in_vc_files='\.[ch]$$' \
|
||||
halt='declare loop iterators outside the for statement' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Many of the function names below came from this filter:
|
||||
# git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \
|
||||
# |sed 's/.*\.c- *//'|perl -pe 's/ ?\(.*//'|sort -u \
|
||||
@ -675,36 +621,6 @@ sc_preprocessor_indentation:
|
||||
echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
|
||||
fi
|
||||
|
||||
# Enforce similar spec file indentation style, by running cppi on a
|
||||
# (comment-only) C file that mirrors the same layout as the spec file.
|
||||
sc_spec_indentation:
|
||||
@if cppi --version >/dev/null 2>&1; then \
|
||||
for f in $$($(VC_LIST_EXCEPT) | grep '\.spec\.in$$'); do \
|
||||
sed -e 's|#|// #|; s|%ifn*\(arch\)* |#if a // |' \
|
||||
-e 's/%\(else\|endif\|define\)/#\1/' \
|
||||
-e 's/^\( *\)\1\1\1#/#\1/' \
|
||||
-e 's|^\( *[^#/ ]\)|// \1|; s|^\( */[^/]\)|// \1|' $$f \
|
||||
| cppi -a -c 2>&1 | sed "s|standard input|$$f|"; \
|
||||
done | { if grep . >&2; then false; else :; fi; } \
|
||||
|| { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
|
||||
exit 1; }; \
|
||||
else \
|
||||
echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
|
||||
fi
|
||||
|
||||
# Long lines can be harder to diff; too long, and git send-email chokes.
|
||||
# For now, only enforce line length on files where we have intentionally
|
||||
# fixed things and don't want to regress.
|
||||
sc_prohibit_long_lines:
|
||||
@prohibit='.{90}' \
|
||||
in_vc_files='\.arg[sv]' \
|
||||
halt='Wrap long lines in expected output files' \
|
||||
$(_sc_search_regexp)
|
||||
@prohibit='.{80}' \
|
||||
in_vc_files='Makefile\.am' \
|
||||
halt='Wrap long lines in Makefiles' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_copyright_format:
|
||||
@require='Copyright .*Red 'Hat', Inc\.' \
|
||||
containing='Copyright .*Red 'Hat \
|
||||
@ -718,22 +634,11 @@ sc_copyright_format:
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Prefer the new URL listing over the old street address listing when
|
||||
# calling out where to get a copy of the [L]GPL. Also, while we have
|
||||
# to ship COPYING (GPL) alongside COPYING.LESSER (LGPL), we want any
|
||||
# source file that calls out a top-level file to call out the LGPL
|
||||
# version. Note that our typical copyright boilerplate refers to the
|
||||
# license by name, not by reference to a top-level file.
|
||||
sc_copyright_usage:
|
||||
# calling out where to get a copy of the [L]GPL.
|
||||
sc_copyright_address:
|
||||
@prohibit=Boston,' MA' \
|
||||
halt='Point to <http://www.gnu.org/licenses/>, not an address' \
|
||||
$(_sc_search_regexp)
|
||||
@require='COPYING\.LESSER' \
|
||||
containing='COPYING' \
|
||||
halt='Refer to COPYING.LESSER for LGPL' \
|
||||
$(_sc_search_regexp)
|
||||
@prohibit='COPYING\.LIB' \
|
||||
halt='Refer to COPYING.LESSER for LGPL' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Some functions/macros produce messages intended solely for developers
|
||||
# and maintainers. Do not mark them for translation.
|
||||
@ -775,74 +680,6 @@ sc_require_enum_last_marker:
|
||||
{ echo '$(ME): enum impl needs to use _LAST marker' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# In Python files we don't want to end lines with a semicolon like in C
|
||||
sc_prohibit_semicolon_at_eol_in_python:
|
||||
@prohibit='^[^#].*\;$$' \
|
||||
in_vc_files='\.py$$' \
|
||||
halt="Don't use semicolon at eol in python files" \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# mymain() in test files should use return, not exit, for nicer output
|
||||
sc_prohibit_exit_in_tests:
|
||||
@prohibit='\<exit *\(' \
|
||||
in_vc_files='^tests/' \
|
||||
halt='use return, not exit(), in tests' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Don't include duplicate header in the source (either *.c or *.h)
|
||||
sc_prohibit_duplicate_header:
|
||||
@fail=0; for i in $$($(VC_LIST_EXCEPT) | grep '\.[chx]$$'); do \
|
||||
awk '/# *include.*\.h/ { \
|
||||
match($$0, /[<"][^>"]*[">]/); \
|
||||
arr[substr($$0, RSTART + 1, RLENGTH - 2)]++; \
|
||||
} \
|
||||
END { \
|
||||
for (key in arr) { \
|
||||
if (arr[key] > 1) { \
|
||||
fail=1; \
|
||||
printf("%d %s are included\n", arr[key], key); \
|
||||
} \
|
||||
} \
|
||||
if (fail == 1) { \
|
||||
printf("duplicate header(s) in " FILENAME "\n"); \
|
||||
exit 1; \
|
||||
} \
|
||||
}' $$i || fail=1; \
|
||||
done; \
|
||||
if test $$fail -eq 1; then \
|
||||
{ echo '$(ME): avoid duplicate headers' 1>&2; exit 1; } \
|
||||
fi;
|
||||
|
||||
# Don't include "libvirt/*.h" in "" form.
|
||||
sc_prohibit_include_public_headers_quote:
|
||||
@prohibit='# *include *"libvirt/.*\.h"' \
|
||||
in_vc_files='\.[ch]$$' \
|
||||
halt='Do not include libvirt/*.h in internal source' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Don't include "libvirt/*.h" in <> form. Except for external tools,
|
||||
# e.g. Python binding, examples and tools subdirectories.
|
||||
sc_prohibit_include_public_headers_brackets:
|
||||
@prohibit='# *include *<libvirt/.*\.h>' \
|
||||
in_vc_files='\.[ch]$$' \
|
||||
halt='Do not include libvirt/*.h in internal source' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# <config.h> is only needed in .c files; .h files do not need it since
|
||||
# .c files must include config.h before any other .h.
|
||||
sc_prohibit_config_h_in_headers:
|
||||
@prohibit='^# *include\>.*config\.h' \
|
||||
in_vc_files='\.h$$' \
|
||||
halt='headers should not include <config.h>' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_unbounded_arrays_in_rpc:
|
||||
@prohibit='<>' \
|
||||
in_vc_files='\.x$$' \
|
||||
halt='Arrays in XDR must have a upper limit set for <NNN>' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
|
||||
# We don't use this feature of maint.mk.
|
||||
prev_version_file = /dev/null
|
||||
|
||||
@ -864,7 +701,6 @@ ifeq (0,$(MAKELEVEL))
|
||||
test -d .git || { echo 0; exit; }; \
|
||||
test -f po/Makevars || { echo 1; exit; }; \
|
||||
test -f AUTHORS || { echo 1; exit; }; \
|
||||
test "no-git" = "$$(cat $(_curr_status))" && { echo 0; exit; }; \
|
||||
actual=$$(git submodule status | $(_submodule_hash); \
|
||||
git hash-object bootstrap.conf; \
|
||||
git ls-tree -d HEAD gnulib/local | awk '{print $$3}'; \
|
||||
@ -892,8 +728,7 @@ syntax-check: $(top_srcdir)/HACKING bracket-spacing-check
|
||||
bracket-spacing-check:
|
||||
$(AM_V_GEN)files=`$(VC_LIST) | grep '\.c$$'`; \
|
||||
$(PERL) $(top_srcdir)/build-aux/bracket-spacing.pl $$files || \
|
||||
{ echo '$(ME): incorrect whitespace, see HACKING for rules' 1>&2; \
|
||||
exit 1; }
|
||||
(echo $(ME): incorrect whitespace around brackets, see HACKING for rules && exit 1)
|
||||
|
||||
# sc_po_check can fail if generated files are not built first
|
||||
sc_po_check: \
|
||||
@ -910,17 +745,16 @@ $(srcdir)/src/remote/remote_client_bodies.h: $(srcdir)/src/remote/remote_protoco
|
||||
# List all syntax-check exemptions:
|
||||
exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh\.h$$
|
||||
|
||||
_src1=libvirt|fdstream|qemu/qemu_monitor|util/(vircommand|virfile)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller|locking/lock_daemon
|
||||
_test1=shunloadtest|virnettlscontexttest|virnettlssessiontest|vircgroupmock
|
||||
_src1=libvirt|fdstream|qemu/qemu_monitor|util/(command|util)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller|locking/lock_daemon
|
||||
exclude_file_name_regexp--sc_avoid_write = \
|
||||
^(src/($(_src1))|daemon/libvirtd|tools/console|tests/($(_test1)))\.c$$
|
||||
^(src/($(_src1))|daemon/libvirtd|tools/console|tests/(shunload|virnettlscontext)test)\.c$$
|
||||
|
||||
exclude_file_name_regexp--sc_bindtextdomain = ^(tests|examples)/
|
||||
|
||||
exclude_file_name_regexp--sc_copyright_usage = \
|
||||
^COPYING(|\.LESSER)$$
|
||||
exclude_file_name_regexp--sc_copyright_address = \
|
||||
^COPYING\.LIB$$
|
||||
|
||||
exclude_file_name_regexp--sc_flags_usage = ^(docs/|src/util/virnetdevtap\.c$$|tests/vircgroupmock\.c$$)
|
||||
exclude_file_name_regexp--sc_flags_usage = ^(docs/|src/util/virnetdevtap\.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = \
|
||||
^(src/rpc/gendispatch\.pl$$|tests/)
|
||||
@ -928,70 +762,66 @@ exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = \
|
||||
exclude_file_name_regexp--sc_po_check = ^(docs/|src/rpc/gendispatch\.pl$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_VIR_ERR_NO_MEMORY = \
|
||||
^(include/libvirt/virterror\.h|daemon/dispatch\.c|src/util/virerror\.c)$$
|
||||
^(include/libvirt/virterror\.h|daemon/dispatch\.c|src/util/virterror\.c)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_access_xok = ^src/util/virutil\.c$$
|
||||
exclude_file_name_regexp--sc_prohibit_access_xok = ^src/util/util\.c$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
|
||||
^python/(libvirt-(lxc-|qemu-)?override|typewrappers)\.c$$
|
||||
^python/(libvirt-(qemu-)?override|typewrappers)\.c$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_asprintf = \
|
||||
^(bootstrap.conf$$|src/util/virstring\.[ch]$$|examples/domain-events/events-c/event-test\.c$$|tests/vircgroupmock\.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_strdup = \
|
||||
^(docs/|examples/|python/|src/util/virstring\.c$$)
|
||||
^(bootstrap.conf$$|src/util/util\.c$$|examples/domain-events/events-c/event-test\.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_close = \
|
||||
(\.p[yl]$$|^docs/|^(src/util/virfile\.c|src/libvirt\.c|tests/vircgroupmock\.c)$$)
|
||||
(\.p[yl]$$|^docs/|^(src/util/virfile\.c|src/libvirt\.c)$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
|
||||
(^tests/(qemuhelp|nodeinfo)data/|\.(gif|ico|png|diff)$$)
|
||||
|
||||
_src2=src/(util/vircommand|libvirt|lxc/lxc_controller|locking/lock_daemon)
|
||||
_src2=src/(util/command|libvirt|lxc/lxc_controller|locking/lock_daemon)
|
||||
exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
|
||||
(^($(_src2)|tests/testutils|daemon/libvirtd)\.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_gethostname = ^src/util/virutil\.c$$
|
||||
exclude_file_name_regexp--sc_prohibit_gethostname = ^src/util/util\.c$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_internal_functions = \
|
||||
^src/(util/(viralloc|virutil|virfile)\.[hc]|esx/esx_vi\.c)$$
|
||||
^src/(util/(memory|util|virfile)\.[hc]|esx/esx_vi\.c)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_newline_at_end_of_diagnostic = \
|
||||
^src/rpc/gendispatch\.pl$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_nonreentrant = \
|
||||
^((po|tests)/|docs/.*(py|html\.in)|run.in$$)
|
||||
^((po|tests)/|docs/.*py|run.in$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_raw_allocation = \
|
||||
^(docs/hacking\.html\.in)|(src/util/viralloc\.[ch]|examples/.*|tests/securityselinuxhelper\.c|tests/vircgroupmock\.c)$$
|
||||
^(src/util/memory\.[ch]|examples/.*)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_readlink = \
|
||||
^src/(util/virutil|lxc/lxc_container)\.c$$
|
||||
^src/(util/util|lxc/lxc_container)\.c$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_setuid = ^src/util/virutil\.c$$
|
||||
exclude_file_name_regexp--sc_prohibit_setuid = ^src/util/util\.c$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_sprintf = \
|
||||
^(docs/hacking\.html\.in)|(examples/systemtap/.*stp)|(src/dtrace2systemtap\.pl)|(src/rpc/gensystemtap\.pl)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_strncpy = ^src/util/virstring\.c$$
|
||||
exclude_file_name_regexp--sc_prohibit_strncpy = ^src/util/util\.c$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_strtol = \
|
||||
^src/(util/virsexpr|(vbox|xen|xenxs)/.*)\.c$$
|
||||
^src/(util/sexpr|(vbox|xen|xenxs)/.*)\.c$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/virxml\.c$$
|
||||
exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/xml\.c$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_return_as_function = \.py$$
|
||||
|
||||
exclude_file_name_regexp--sc_require_config_h = \
|
||||
^(examples/|tools/virsh-edit\.c$$)
|
||||
_virsh_includes=(edit|domain-monitor|domain|volume|pool|network|interface|nwfilter|secret|snapshot|host|nodedev)
|
||||
exclude_file_name_regexp--sc_require_config_h = ^(examples/|tools/virsh-$(_virsh_includes)\.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_require_config_h_first = \
|
||||
^(examples/|tools/virsh-edit\.c$$)
|
||||
exclude_file_name_regexp--sc_require_config_h_first = ^(examples/|tools/virsh-$(_virsh_includes)\.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_trailing_blank = \
|
||||
(/qemuhelpdata/|/sysinfodata/.*\.data|\.(fig|gif|ico|png)$$)
|
||||
(/qemuhelpdata/|\.(fig|gif|ico|png)$$)
|
||||
|
||||
exclude_file_name_regexp--sc_unmarked_diagnostics = \
|
||||
^(docs/apibuild.py|tests/virt-aa-helper-test)$$
|
||||
@ -1000,14 +830,3 @@ exclude_file_name_regexp--sc_size_of_brackets = cfg.mk
|
||||
|
||||
exclude_file_name_regexp--sc_correct_id_types = \
|
||||
(^src/locking/lock_protocol.x$$)
|
||||
|
||||
exclude_file_name_regexp--sc_m4_quote_check = m4/virt-lib.m4
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_include_public_headers_quote = \
|
||||
^src/internal\.h$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets = \
|
||||
^(python/|tools/|examples/|include/libvirt/(virterror|libvirt-(qemu|lxc))\.h$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_int_ijk = \
|
||||
^(src/remote_protocol-structs|src/remote/remote_protocol.x|cfg.mk|include/)$
|
||||
|
1301
configure.ac
1301
configure.ac
File diff suppressed because it is too large
Load Diff
@ -1,20 +1,7 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
## Copyright (C) 2005-2013 Red Hat, Inc.
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
## License as published by the Free Software Foundation; either
|
||||
## version 2.1 of the License, or (at your option) any later version.
|
||||
##
|
||||
## This library is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public
|
||||
## License along with this library. If not, see
|
||||
## <http://www.gnu.org/licenses/>.
|
||||
## Copyright (C) 2005-2012 Red Hat, Inc.
|
||||
## See COPYING.LIB for the License of this software
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib \
|
||||
@ -24,16 +11,13 @@ INCLUDES = \
|
||||
-I$(top_srcdir)/src/conf \
|
||||
-I$(top_srcdir)/src/rpc \
|
||||
-I$(top_srcdir)/src/remote \
|
||||
-I$(top_srcdir)/src/access \
|
||||
$(GETTEXT_CPPFLAGS)
|
||||
|
||||
CLEANFILES =
|
||||
|
||||
DAEMON_GENERATED = \
|
||||
$(srcdir)/remote_dispatch.h \
|
||||
$(srcdir)/lxc_dispatch.h \
|
||||
$(srcdir)/qemu_dispatch.h \
|
||||
$(NULL)
|
||||
$(srcdir)/qemu_dispatch.h
|
||||
|
||||
DAEMON_SOURCES = \
|
||||
libvirtd.c libvirtd.h \
|
||||
@ -41,21 +25,18 @@ DAEMON_SOURCES = \
|
||||
remote.c remote.h \
|
||||
stream.c stream.h \
|
||||
../src/remote/remote_protocol.c \
|
||||
../src/remote/lxc_protocol.c \
|
||||
../src/remote/qemu_protocol.c \
|
||||
$(DAEMON_GENERATED)
|
||||
|
||||
DISTCLEANFILES =
|
||||
EXTRA_DIST = \
|
||||
remote_dispatch.h \
|
||||
lxc_dispatch.h \
|
||||
qemu_dispatch.h \
|
||||
libvirtd.conf \
|
||||
libvirtd.init.in \
|
||||
libvirtd.upstart \
|
||||
libvirtd.policy.in \
|
||||
libvirtd.sasl \
|
||||
libvirtd.service.in \
|
||||
libvirtd.sysconf \
|
||||
libvirtd.sysctl \
|
||||
libvirtd.aug \
|
||||
@ -72,23 +53,17 @@ EXTRA_DIST = \
|
||||
BUILT_SOURCES =
|
||||
|
||||
REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
|
||||
LXC_PROTOCOL = $(top_srcdir)/src/remote/lxc_protocol.x
|
||||
QEMU_PROTOCOL = $(top_srcdir)/src/remote/qemu_protocol.x
|
||||
|
||||
$(srcdir)/remote_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
|
||||
$(REMOTE_PROTOCOL)
|
||||
$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl \
|
||||
--mode=server remote REMOTE $(REMOTE_PROTOCOL) > $@
|
||||
|
||||
$(srcdir)/lxc_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
|
||||
$(LXC_PROTOCOL)
|
||||
$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl \
|
||||
--mode=server lxc LXC $(LXC_PROTOCOL) > $@
|
||||
$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl -b remote REMOTE \
|
||||
$(REMOTE_PROTOCOL) > $@
|
||||
|
||||
$(srcdir)/qemu_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
|
||||
$(QEMU_PROTOCOL)
|
||||
$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl \
|
||||
--mode=server qemu QEMU $(QEMU_PROTOCOL) > $@
|
||||
$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl -b qemu QEMU \
|
||||
$(QEMU_PROTOCOL) > $@
|
||||
|
||||
if WITH_LIBVIRTD
|
||||
|
||||
@ -109,8 +84,8 @@ CLEANFILES += test_libvirtd.aug
|
||||
|
||||
libvirtd.8: $(srcdir)/libvirtd.8.in
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's!SYSCONFDIR!$(sysconfdir)!g' \
|
||||
-e 's!LOCALSTATEDIR!$(localstatedir)!g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
@ -120,17 +95,13 @@ libvirtd_SOURCES = $(DAEMON_SOURCES)
|
||||
libvirtd_CFLAGS = \
|
||||
$(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) $(SASL_CFLAGS) \
|
||||
$(XDR_CFLAGS) $(POLKIT_CFLAGS) $(DBUS_CFLAGS) $(LIBNL_CFLAGS) \
|
||||
$(WARN_CFLAGS) $(PIE_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(COVERAGE_CFLAGS) \
|
||||
-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\""
|
||||
|
||||
libvirtd_LDFLAGS = \
|
||||
$(RELRO_LDFLAGS) \
|
||||
$(PIE_LDFLAGS) \
|
||||
$(RELRO_LDFLAGS) \
|
||||
$(COVERAGE_LDFLAGS) \
|
||||
$(NO_INDIRECT_LDFLAGS) \
|
||||
$(NULL)
|
||||
$(WARN_CFLAGS) \
|
||||
$(COVERAGE_LDFLAGS)
|
||||
|
||||
libvirtd_LDADD = \
|
||||
$(LIBXML_LIBS) \
|
||||
@ -145,7 +116,6 @@ libvirtd_LDADD += ../src/libvirt_probes.lo
|
||||
endif
|
||||
|
||||
libvirtd_LDADD += \
|
||||
../src/libvirt-lxc.la \
|
||||
../src/libvirt-qemu.la
|
||||
|
||||
if ! WITH_DRIVER_MODULES
|
||||
@ -172,10 +142,6 @@ if WITH_UML
|
||||
libvirtd_LDADD += ../src/libvirt_driver_uml.la
|
||||
endif
|
||||
|
||||
if WITH_VBOX
|
||||
libvirtd_LDADD += ../src/libvirt_driver_vbox.la
|
||||
endif
|
||||
|
||||
if WITH_STORAGE
|
||||
libvirtd_LDADD += ../src/libvirt_driver_storage.la
|
||||
endif
|
||||
@ -203,8 +169,8 @@ endif
|
||||
|
||||
libvirtd_LDADD += ../src/libvirt.la
|
||||
|
||||
if WITH_POLKIT
|
||||
if WITH_POLKIT0
|
||||
if HAVE_POLKIT
|
||||
if HAVE_POLKIT0
|
||||
policydir = $(datadir)/PolicyKit/policy
|
||||
policyauth = auth_admin_keep_session
|
||||
else
|
||||
@ -215,28 +181,26 @@ endif
|
||||
|
||||
libvirtd.policy: libvirtd.policy.in $(top_builddir)/config.status
|
||||
$(AM_V_GEN) sed \
|
||||
-e 's|[@]authaction[@]|$(policyauth)|g' \
|
||||
-e 's![@]authaction[@]!$(policyauth)!g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
BUILT_SOURCES += libvirtd.policy
|
||||
|
||||
install-data-local: install-init-redhat install-init-systemd \
|
||||
install-init-upstart \
|
||||
install-data-local: install-init-redhat install-init-systemd install-init-upstart \
|
||||
install-data-sasl install-data-polkit \
|
||||
install-logrotate install-sysctl
|
||||
$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt \
|
||||
$(DESTDIR)$(localstatedir)/run/libvirt \
|
||||
$(DESTDIR)$(localstatedir)/lib/libvirt
|
||||
|
||||
uninstall-local:: uninstall-init-redhat uninstall-init-systemd \
|
||||
uninstall-init-upstart \
|
||||
uninstall-local:: uninstall-init-redhat uninstall-init-systemd uninstall-init-upstart \
|
||||
uninstall-data-sasl uninstall-data-polkit \
|
||||
uninstall-logrotate uninstall-sysctl
|
||||
rmdir $(DESTDIR)$(localstatedir)/log/libvirt || :
|
||||
rmdir $(DESTDIR)$(localstatedir)/run/libvirt || :
|
||||
rmdir $(DESTDIR)$(localstatedir)/lib/libvirt || :
|
||||
|
||||
if WITH_POLKIT
|
||||
if HAVE_POLKIT
|
||||
install-data-polkit::
|
||||
$(MKDIR_P) $(DESTDIR)$(policydir)
|
||||
$(INSTALL_DATA) libvirtd.policy $(DESTDIR)$(policydir)/org.libvirt.unix.policy
|
||||
@ -258,25 +222,25 @@ BUILT_SOURCES += $(LOGROTATE_CONFS)
|
||||
|
||||
libvirtd.logrotate: libvirtd.logrotate.in
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
libvirtd.lxc.logrotate: libvirtd.lxc.logrotate.in
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
libvirtd.uml.logrotate: libvirtd.uml.logrotate.in
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
@ -285,14 +249,10 @@ install-logrotate: $(LOGROTATE_CONFS)
|
||||
$(DESTDIR)$(localstatedir)/log/libvirt/lxc/ \
|
||||
$(DESTDIR)$(localstatedir)/log/libvirt/uml/ \
|
||||
$(DESTDIR)$(sysconfdir)/logrotate.d/
|
||||
$(INSTALL_DATA) libvirtd.logrotate \
|
||||
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd
|
||||
$(INSTALL_DATA) libvirtd.qemu.logrotate \
|
||||
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu
|
||||
$(INSTALL_DATA) libvirtd.lxc.logrotate \
|
||||
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc
|
||||
$(INSTALL_DATA) libvirtd.uml.logrotate \
|
||||
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
|
||||
$(INSTALL_DATA) libvirtd.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd
|
||||
$(INSTALL_DATA) libvirtd.qemu.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu
|
||||
$(INSTALL_DATA) libvirtd.lxc.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc
|
||||
$(INSTALL_DATA) libvirtd.uml.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
|
||||
|
||||
uninstall-logrotate:
|
||||
rm -f $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd \
|
||||
@ -313,16 +273,14 @@ uninstall-sysconfig:
|
||||
rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
|
||||
|
||||
if WITH_SYSCTL
|
||||
# Use $(prefix)/lib rather than $(libdir), since man sysctl.d insists on
|
||||
# /usr/lib/sysctl.d/ even when libdir is /usr/lib64
|
||||
install-sysctl:
|
||||
$(MKDIR_P) $(DESTDIR)$(prefix)/lib/sysctl.d
|
||||
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysctl.d
|
||||
$(INSTALL_DATA) $(srcdir)/libvirtd.sysctl \
|
||||
$(DESTDIR)$(prefix)/lib/sysctl.d/libvirtd.conf
|
||||
$(DESTDIR)$(sysconfdir)/sysctl.d/libvirtd
|
||||
|
||||
uninstall-sysctl:
|
||||
rm -f $(DESTDIR)$(prefix)/lib/sysctl.d/libvirtd.conf
|
||||
rmdir $(DESTDIR)$(prefix)/lib/sysctl.d || :
|
||||
rm -f $(DESTDIR)$(sysconfdir)/sysctl.d/libvirtd
|
||||
rmdir $(DESTDIR)$(sysconfdir)/sysctl.d || :
|
||||
else
|
||||
install-sysctl:
|
||||
uninstall-sysctl:
|
||||
@ -362,6 +320,7 @@ uninstall-init-upstart:
|
||||
endif # LIBVIRT_INIT_SCRIPT_UPSTART
|
||||
|
||||
|
||||
EXTRA_DIST += libvirtd.service.in
|
||||
if LIBVIRT_INIT_SCRIPT_SYSTEMD
|
||||
|
||||
SYSTEMD_UNIT_DIR = /lib/systemd/system
|
||||
@ -381,20 +340,21 @@ uninstall-init-systemd:
|
||||
endif # LIBVIRT_INIT_SCRIPT_SYSTEMD
|
||||
|
||||
libvirtd.init: libvirtd.init.in $(top_builddir)/config.status
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's|[@]sbindir[@]|$(sbindir)|g' \
|
||||
-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
|
||||
< $< > $@-t && \
|
||||
chmod a+x $@-t && \
|
||||
$(AM_V_GEN)sed \
|
||||
-e s!\@localstatedir\@!$(localstatedir)!g \
|
||||
-e s!\@sbindir\@!$(sbindir)!g \
|
||||
-e s!\@sysconfdir\@!$(sysconfdir)!g \
|
||||
< $< > $@-t && \
|
||||
chmod a+x $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
libvirtd.service: libvirtd.service.in $(top_builddir)/config.status
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's|[@]sbindir[@]|$(sbindir)|g' \
|
||||
-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
|
||||
< $< > $@-t && \
|
||||
$(AM_V_GEN)sed \
|
||||
-e s!\@localstatedir\@!$(localstatedir)!g \
|
||||
-e s!\@sbindir\@!$(sbindir)!g \
|
||||
-e s!\@sysconfdir\@!$(sysconfdir)!g \
|
||||
< $< > $@-t && \
|
||||
chmod a+x $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
|
||||
@ -423,17 +383,16 @@ endif # WITH_LIBVIRTD
|
||||
POD2MAN = pod2man -c "Virtualization Support" \
|
||||
-r "$(PACKAGE)-$(VERSION)" -s 8
|
||||
|
||||
$(srcdir)/libvirtd.8.in: libvirtd.pod.in $(top_srcdir)/configure.ac
|
||||
$(srcdir)/libvirtd.8.in: libvirtd.pod.in
|
||||
$(AM_V_GEN)$(POD2MAN) --name LIBVIRTD $< $@ \
|
||||
&& if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi
|
||||
|
||||
# This is needed for clients too, so can't wrap in
|
||||
# the WITH_LIBVIRTD conditional
|
||||
if WITH_SASL
|
||||
if HAVE_SASL
|
||||
install-data-sasl:
|
||||
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sasl2/
|
||||
$(INSTALL_DATA) $(srcdir)/libvirtd.sasl \
|
||||
$(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
|
||||
$(INSTALL_DATA) $(srcdir)/libvirtd.sasl $(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
|
||||
|
||||
uninstall-data-sasl:
|
||||
rm -f $(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
|
||||
|
@ -40,7 +40,7 @@ The server lock is used in conjunction with a condition variable
|
||||
to pass jobs from the event loop thread to the workers. The main
|
||||
event loop thread handles I/O from the client socket, and once a
|
||||
complete RPC message has been read off the wire (and optionally
|
||||
decrypted), it will be placed on the 'dx' job queue for the
|
||||
decrypted), it will be placed onto the 'dx' job queue for the
|
||||
associated client object. The job condition will be signalled and
|
||||
a worker will wakup and process it.
|
||||
|
||||
|
@ -24,16 +24,14 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "libvirtd-config.h"
|
||||
#include "virconf.h"
|
||||
#include "viralloc.h"
|
||||
#include "virerror.h"
|
||||
#include "virlog.h"
|
||||
#include "conf.h"
|
||||
#include "memory.h"
|
||||
#include "virterror_internal.h"
|
||||
#include "logging.h"
|
||||
#include "rpc/virnetserver.h"
|
||||
#include "configmake.h"
|
||||
#include "remote/remote_protocol.h"
|
||||
#include "remote/remote_driver.h"
|
||||
#include "virstring.h"
|
||||
#include "virutil.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_CONF
|
||||
|
||||
@ -59,16 +57,19 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
|
||||
key);
|
||||
return -1;
|
||||
}
|
||||
if (VIR_STRDUP(list[0], p->str) < 0) {
|
||||
list[0] = strdup(p->str);
|
||||
list[1] = NULL;
|
||||
if (list[0] == NULL) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("failed to allocate memory for %s config list value"),
|
||||
key);
|
||||
VIR_FREE(list);
|
||||
return -1;
|
||||
}
|
||||
list[1] = NULL;
|
||||
break;
|
||||
|
||||
case VIR_CONF_LIST: {
|
||||
int len = 0;
|
||||
size_t i;
|
||||
int i, len = 0;
|
||||
virConfValuePtr pp;
|
||||
for (pp = p->list; pp; pp = pp->next)
|
||||
len++;
|
||||
@ -87,11 +88,15 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
|
||||
VIR_FREE(list);
|
||||
return -1;
|
||||
}
|
||||
if (VIR_STRDUP(list[i], pp->str) < 0) {
|
||||
size_t j;
|
||||
for (j = 0; j < i; j++)
|
||||
list[i] = strdup(pp->str);
|
||||
if (list[i] == NULL) {
|
||||
int j;
|
||||
for (j = 0 ; j < i ; j++)
|
||||
VIR_FREE(list[j]);
|
||||
VIR_FREE(list);
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("failed to allocate memory for %s config list value"),
|
||||
key);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -129,8 +134,8 @@ checkType(virConfValuePtr p, const char *filename,
|
||||
}
|
||||
|
||||
/* If there is no config data for the key, #var_name, then do nothing.
|
||||
If there is valid data of type VIR_CONF_STRING, and VIR_STRDUP succeeds,
|
||||
store the result in var_name. Otherwise, (i.e. invalid type, or VIR_STRDUP
|
||||
If there is valid data of type VIR_CONF_STRING, and strdup succeeds,
|
||||
store the result in var_name. Otherwise, (i.e. invalid type, or strdup
|
||||
failure), give a diagnostic and "goto" the cleanup-and-fail label. */
|
||||
#define GET_CONF_STR(conf, filename, var_name) \
|
||||
do { \
|
||||
@ -139,8 +144,10 @@ checkType(virConfValuePtr p, const char *filename,
|
||||
if (checkType(p, filename, #var_name, VIR_CONF_STRING) < 0) \
|
||||
goto error; \
|
||||
VIR_FREE(data->var_name); \
|
||||
if (VIR_STRDUP(data->var_name, p->str) < 0) \
|
||||
if (!(data->var_name = strdup(p->str))) { \
|
||||
virReportOOMError(); \
|
||||
goto error; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@ -171,7 +178,7 @@ static int remoteConfigGetAuth(virConfPtr conf, const char *key, int *auth, cons
|
||||
|
||||
if (STREQ(p->str, "none")) {
|
||||
*auth = VIR_NET_SERVER_SERVICE_AUTH_NONE;
|
||||
#if WITH_SASL
|
||||
#if HAVE_SASL
|
||||
} else if (STREQ(p->str, "sasl")) {
|
||||
*auth = VIR_NET_SERVER_SERVICE_AUTH_SASL;
|
||||
#endif
|
||||
@ -191,8 +198,8 @@ int
|
||||
daemonConfigFilePath(bool privileged, char **configfile)
|
||||
{
|
||||
if (privileged) {
|
||||
if (VIR_STRDUP(*configfile, SYSCONFDIR "/libvirt/libvirtd.conf") < 0)
|
||||
goto error;
|
||||
if (!(*configfile = strdup(SYSCONFDIR "/libvirt/libvirtd.conf")))
|
||||
goto no_memory;
|
||||
} else {
|
||||
char *configdir = NULL;
|
||||
|
||||
@ -201,13 +208,15 @@ daemonConfigFilePath(bool privileged, char **configfile)
|
||||
|
||||
if (virAsprintf(configfile, "%s/libvirtd.conf", configdir) < 0) {
|
||||
VIR_FREE(configdir);
|
||||
goto error;
|
||||
goto no_memory;
|
||||
}
|
||||
VIR_FREE(configdir);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
no_memory:
|
||||
virReportOOMError();
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
@ -219,18 +228,21 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
|
||||
char *localhost;
|
||||
int ret;
|
||||
|
||||
if (VIR_ALLOC(data) < 0)
|
||||
if (VIR_ALLOC(data) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data->listen_tls = 1;
|
||||
data->listen_tcp = 0;
|
||||
|
||||
if (VIR_STRDUP(data->tls_port, LIBVIRTD_TLS_PORT) < 0 ||
|
||||
VIR_STRDUP(data->tcp_port, LIBVIRTD_TCP_PORT) < 0)
|
||||
goto error;
|
||||
if (!(data->tls_port = strdup(LIBVIRTD_TLS_PORT)))
|
||||
goto no_memory;
|
||||
if (!(data->tcp_port = strdup(LIBVIRTD_TCP_PORT)))
|
||||
goto no_memory;
|
||||
|
||||
/* Only default to PolicyKit if running as root */
|
||||
#if WITH_POLKIT
|
||||
#if HAVE_POLKIT
|
||||
if (privileged) {
|
||||
data->auth_unix_rw = REMOTE_AUTH_POLKIT;
|
||||
data->auth_unix_ro = REMOTE_AUTH_POLKIT;
|
||||
@ -238,16 +250,20 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
|
||||
#endif
|
||||
data->auth_unix_rw = REMOTE_AUTH_NONE;
|
||||
data->auth_unix_ro = REMOTE_AUTH_NONE;
|
||||
#if WITH_POLKIT
|
||||
#if HAVE_POLKIT
|
||||
}
|
||||
#endif
|
||||
|
||||
if (VIR_STRDUP(data->unix_sock_rw_perms,
|
||||
data->auth_unix_rw == REMOTE_AUTH_POLKIT ? "0777" : "0700") < 0 ||
|
||||
VIR_STRDUP(data->unix_sock_ro_perms, "0777") < 0)
|
||||
goto error;
|
||||
if (data->auth_unix_rw == REMOTE_AUTH_POLKIT)
|
||||
data->unix_sock_rw_perms = strdup("0777"); /* Allow world */
|
||||
else
|
||||
data->unix_sock_rw_perms = strdup("0700"); /* Allow user only */
|
||||
data->unix_sock_ro_perms = strdup("0777"); /* Always allow world */
|
||||
if (!data->unix_sock_ro_perms ||
|
||||
!data->unix_sock_rw_perms)
|
||||
goto no_memory;
|
||||
|
||||
#if WITH_SASL
|
||||
#if HAVE_SASL
|
||||
data->auth_tcp = REMOTE_AUTH_SASL;
|
||||
#else
|
||||
data->auth_tcp = REMOTE_AUTH_NONE;
|
||||
@ -274,13 +290,13 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
|
||||
data->keepalive_count = 5;
|
||||
data->keepalive_required = 0;
|
||||
|
||||
localhost = virGetHostname();
|
||||
localhost = virGetHostname(NULL);
|
||||
if (localhost == NULL) {
|
||||
/* we couldn't resolve the hostname; assume that we are
|
||||
* running in disconnected operation, and report a less
|
||||
* useful Avahi string
|
||||
*/
|
||||
ret = VIR_STRDUP(data->mdns_name, "Virtualization Host");
|
||||
ret = virAsprintf(&data->mdns_name, "Virtualization Host");
|
||||
} else {
|
||||
char *tmp;
|
||||
/* Extract the host part of the potentially FQDN */
|
||||
@ -291,11 +307,12 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
|
||||
}
|
||||
VIR_FREE(localhost);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
goto no_memory;
|
||||
|
||||
return data;
|
||||
|
||||
error:
|
||||
no_memory:
|
||||
virReportOOMError();
|
||||
daemonConfigFree(data);
|
||||
return NULL;
|
||||
}
|
||||
@ -311,12 +328,6 @@ daemonConfigFree(struct daemonConfig *data)
|
||||
VIR_FREE(data->listen_addr);
|
||||
VIR_FREE(data->tls_port);
|
||||
VIR_FREE(data->tcp_port);
|
||||
tmp = data->access_drivers;
|
||||
while (tmp && *tmp) {
|
||||
VIR_FREE(*tmp);
|
||||
tmp++;
|
||||
}
|
||||
VIR_FREE(data->access_drivers);
|
||||
|
||||
VIR_FREE(data->unix_sock_ro_perms);
|
||||
VIR_FREE(data->unix_sock_rw_perms);
|
||||
@ -363,14 +374,16 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
||||
|
||||
if (remoteConfigGetAuth(conf, "auth_unix_rw", &data->auth_unix_rw, filename) < 0)
|
||||
goto error;
|
||||
#if WITH_POLKIT
|
||||
#if HAVE_POLKIT
|
||||
/* Change default perms to be wide-open if PolicyKit is enabled.
|
||||
* Admin can always override in config file
|
||||
*/
|
||||
if (data->auth_unix_rw == REMOTE_AUTH_POLKIT) {
|
||||
VIR_FREE(data->unix_sock_rw_perms);
|
||||
if (VIR_STRDUP(data->unix_sock_rw_perms, "0777") < 0)
|
||||
if (!(data->unix_sock_rw_perms = strdup("0777"))) {
|
||||
virReportOOMError();
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (remoteConfigGetAuth(conf, "auth_unix_ro", &data->auth_unix_ro, filename) < 0)
|
||||
@ -380,10 +393,6 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
||||
if (remoteConfigGetAuth(conf, "auth_tls", &data->auth_tls, filename) < 0)
|
||||
goto error;
|
||||
|
||||
if (remoteConfigGetStringList(conf, "access_drivers",
|
||||
&data->access_drivers, filename) < 0)
|
||||
goto error;
|
||||
|
||||
GET_CONF_STR(conf, filename, unix_sock_group);
|
||||
GET_CONF_STR(conf, filename, unix_sock_ro_perms);
|
||||
GET_CONF_STR(conf, filename, unix_sock_rw_perms);
|
||||
@ -414,7 +423,6 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
||||
GET_CONF_INT(conf, filename, min_workers);
|
||||
GET_CONF_INT(conf, filename, max_workers);
|
||||
GET_CONF_INT(conf, filename, max_clients);
|
||||
GET_CONF_INT(conf, filename, max_queued_clients);
|
||||
|
||||
GET_CONF_INT(conf, filename, prio_workers);
|
||||
|
||||
|
@ -45,8 +45,6 @@ struct daemonConfig {
|
||||
int auth_tcp;
|
||||
int auth_tls;
|
||||
|
||||
char **access_drivers;
|
||||
|
||||
int mdns_adv;
|
||||
char *mdns_name;
|
||||
|
||||
@ -63,7 +61,6 @@ struct daemonConfig {
|
||||
int min_workers;
|
||||
int max_workers;
|
||||
int max_clients;
|
||||
int max_queued_clients;
|
||||
|
||||
int prio_workers;
|
||||
|
||||
|
@ -51,12 +51,10 @@ module Libvirtd =
|
||||
| bool_entry "tls_no_sanity_certificate"
|
||||
| str_array_entry "tls_allowed_dn_list"
|
||||
| str_array_entry "sasl_allowed_username_list"
|
||||
| str_array_entry "access_drivers"
|
||||
|
||||
let processing_entry = int_entry "min_workers"
|
||||
| int_entry "max_workers"
|
||||
| int_entry "max_clients"
|
||||
| int_entry "max_queued_clients"
|
||||
| int_entry "max_requests"
|
||||
| int_entry "max_client_requests"
|
||||
| int_entry "prio_workers"
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <locale.h>
|
||||
|
||||
#include "libvirt_internal.h"
|
||||
#include "virerror.h"
|
||||
#include "virterror_internal.h"
|
||||
#include "virfile.h"
|
||||
#include "virpidfile.h"
|
||||
#include "virprocess.h"
|
||||
@ -43,18 +43,20 @@
|
||||
#include "libvirtd.h"
|
||||
#include "libvirtd-config.h"
|
||||
|
||||
#include "viruuid.h"
|
||||
#include "util.h"
|
||||
#include "uuid.h"
|
||||
#include "remote_driver.h"
|
||||
#include "viralloc.h"
|
||||
#include "virconf.h"
|
||||
#include "memory.h"
|
||||
#include "conf.h"
|
||||
#include "virnetlink.h"
|
||||
#include "virnetserver.h"
|
||||
#include "threads.h"
|
||||
#include "remote.h"
|
||||
#include "virhook.h"
|
||||
#include "remote_driver.h"
|
||||
#include "hooks.h"
|
||||
#include "uuid.h"
|
||||
#include "viraudit.h"
|
||||
#include "virstring.h"
|
||||
#include "locking/lock_manager.h"
|
||||
#include "viraccessmanager.h"
|
||||
|
||||
#ifdef WITH_DRIVER_MODULES
|
||||
# include "driver.h"
|
||||
@ -74,9 +76,6 @@
|
||||
# ifdef WITH_UML
|
||||
# include "uml/uml_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_VBOX
|
||||
# include "vbox/vbox_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_NETWORK
|
||||
# include "network/bridge_driver.h"
|
||||
# endif
|
||||
@ -101,12 +100,11 @@
|
||||
|
||||
#include "virdbus.h"
|
||||
|
||||
#if WITH_SASL
|
||||
#if HAVE_SASL
|
||||
virNetSASLContextPtr saslCtxt = NULL;
|
||||
#endif
|
||||
virNetServerProgramPtr remoteProgram = NULL;
|
||||
virNetServerProgramPtr qemuProgram = NULL;
|
||||
virNetServerProgramPtr lxcProgram = NULL;
|
||||
|
||||
enum {
|
||||
VIR_DAEMON_ERR_NONE = 0,
|
||||
@ -245,8 +243,8 @@ daemonPidFilePath(bool privileged,
|
||||
char **pidfile)
|
||||
{
|
||||
if (privileged) {
|
||||
if (VIR_STRDUP(*pidfile, LOCALSTATEDIR "/run/libvirtd.pid") < 0)
|
||||
goto error;
|
||||
if (!(*pidfile = strdup(LOCALSTATEDIR "/run/libvirtd.pid")))
|
||||
goto no_memory;
|
||||
} else {
|
||||
char *rundir = NULL;
|
||||
mode_t old_umask;
|
||||
@ -263,7 +261,7 @@ daemonPidFilePath(bool privileged,
|
||||
|
||||
if (virAsprintf(pidfile, "%s/libvirtd.pid", rundir) < 0) {
|
||||
VIR_FREE(rundir);
|
||||
goto error;
|
||||
goto no_memory;
|
||||
}
|
||||
|
||||
VIR_FREE(rundir);
|
||||
@ -271,6 +269,8 @@ daemonPidFilePath(bool privileged,
|
||||
|
||||
return 0;
|
||||
|
||||
no_memory:
|
||||
virReportOOMError();
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
@ -283,15 +283,16 @@ daemonUnixSocketPaths(struct daemonConfig *config,
|
||||
{
|
||||
if (config->unix_sock_dir) {
|
||||
if (virAsprintf(sockfile, "%s/libvirt-sock", config->unix_sock_dir) < 0)
|
||||
goto error;
|
||||
goto no_memory;
|
||||
if (privileged &&
|
||||
virAsprintf(rosockfile, "%s/libvirt-sock-ro", config->unix_sock_dir) < 0)
|
||||
goto error;
|
||||
goto no_memory;
|
||||
} else {
|
||||
if (privileged) {
|
||||
if (VIR_STRDUP(*sockfile, LOCALSTATEDIR "/run/libvirt/libvirt-sock") < 0 ||
|
||||
VIR_STRDUP(*rosockfile, LOCALSTATEDIR "/run/libvirt/libvirt-sock-ro") < 0)
|
||||
goto error;
|
||||
if (!(*sockfile = strdup(LOCALSTATEDIR "/run/libvirt/libvirt-sock")))
|
||||
goto no_memory;
|
||||
if (!(*rosockfile = strdup(LOCALSTATEDIR "/run/libvirt/libvirt-sock-ro")))
|
||||
goto no_memory;
|
||||
} else {
|
||||
char *rundir = NULL;
|
||||
mode_t old_umask;
|
||||
@ -308,7 +309,7 @@ daemonUnixSocketPaths(struct daemonConfig *config,
|
||||
|
||||
if (virAsprintf(sockfile, "%s/libvirt-sock", rundir) < 0) {
|
||||
VIR_FREE(rundir);
|
||||
goto error;
|
||||
goto no_memory;
|
||||
}
|
||||
|
||||
VIR_FREE(rundir);
|
||||
@ -316,6 +317,8 @@ daemonUnixSocketPaths(struct daemonConfig *config,
|
||||
}
|
||||
return 0;
|
||||
|
||||
no_memory:
|
||||
virReportOOMError();
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
@ -400,9 +403,6 @@ static void daemonInitialize(void)
|
||||
# ifdef WITH_UML
|
||||
virDriverLoadModule("uml");
|
||||
# endif
|
||||
# ifdef WITH_VBOX
|
||||
virDriverLoadModule("vbox");
|
||||
# endif
|
||||
#else
|
||||
# ifdef WITH_NETWORK
|
||||
networkRegister();
|
||||
@ -437,9 +437,6 @@ static void daemonInitialize(void)
|
||||
# ifdef WITH_UML
|
||||
umlRegister();
|
||||
# endif
|
||||
# ifdef WITH_VBOX
|
||||
vboxRegister();
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -454,9 +451,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
virNetServerServicePtr svc = NULL;
|
||||
virNetServerServicePtr svcRO = NULL;
|
||||
virNetServerServicePtr svcTCP = NULL;
|
||||
#if WITH_GNUTLS
|
||||
virNetServerServicePtr svcTLS = NULL;
|
||||
#endif
|
||||
gid_t unix_sock_gid = 0;
|
||||
int unix_sock_ro_mask = 0;
|
||||
int unix_sock_rw_mask = 0;
|
||||
@ -481,12 +476,9 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
unix_sock_rw_mask,
|
||||
unix_sock_gid,
|
||||
config->auth_unix_rw,
|
||||
#if WITH_GNUTLS
|
||||
NULL,
|
||||
#endif
|
||||
false,
|
||||
config->max_queued_clients,
|
||||
config->max_client_requests)))
|
||||
config->max_client_requests,
|
||||
NULL)))
|
||||
goto error;
|
||||
if (sock_path_ro) {
|
||||
VIR_DEBUG("Registering unix socket %s", sock_path_ro);
|
||||
@ -494,12 +486,9 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
unix_sock_ro_mask,
|
||||
unix_sock_gid,
|
||||
config->auth_unix_ro,
|
||||
#if WITH_GNUTLS
|
||||
NULL,
|
||||
#endif
|
||||
true,
|
||||
config->max_queued_clients,
|
||||
config->max_client_requests)))
|
||||
config->max_client_requests,
|
||||
NULL)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -520,12 +509,9 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
if (!(svcTCP = virNetServerServiceNewTCP(config->listen_addr,
|
||||
config->tcp_port,
|
||||
config->auth_tcp,
|
||||
#if WITH_GNUTLS
|
||||
NULL,
|
||||
#endif
|
||||
false,
|
||||
config->max_queued_clients,
|
||||
config->max_client_requests)))
|
||||
config->max_client_requests,
|
||||
NULL)))
|
||||
goto error;
|
||||
|
||||
if (virNetServerAddService(srv, svcTCP,
|
||||
@ -533,7 +519,6 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
goto error;
|
||||
}
|
||||
|
||||
#if WITH_GNUTLS
|
||||
if (config->listen_tls) {
|
||||
virNetTLSContextPtr ctxt = NULL;
|
||||
|
||||
@ -563,10 +548,9 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
virNetServerServiceNewTCP(config->listen_addr,
|
||||
config->tls_port,
|
||||
config->auth_tls,
|
||||
ctxt,
|
||||
false,
|
||||
config->max_queued_clients,
|
||||
config->max_client_requests))) {
|
||||
config->max_client_requests,
|
||||
ctxt))) {
|
||||
virObjectUnref(ctxt);
|
||||
goto error;
|
||||
}
|
||||
@ -577,23 +561,13 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
|
||||
virObjectUnref(ctxt);
|
||||
}
|
||||
#else
|
||||
(void)privileged;
|
||||
if (config->listen_tls) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("This libvirtd build does not support TLS"));
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if WITH_SASL
|
||||
#if HAVE_SASL
|
||||
if (config->auth_unix_rw == REMOTE_AUTH_SASL ||
|
||||
config->auth_unix_ro == REMOTE_AUTH_SASL ||
|
||||
# if WITH_GNUTLS
|
||||
config->auth_tls == REMOTE_AUTH_SASL ||
|
||||
# endif
|
||||
config->auth_tcp == REMOTE_AUTH_SASL) {
|
||||
config->auth_tcp == REMOTE_AUTH_SASL ||
|
||||
config->auth_tls == REMOTE_AUTH_SASL) {
|
||||
saslCtxt = virNetSASLContextNewServer(
|
||||
(const char *const*)config->sasl_allowed_username_list);
|
||||
if (!saslCtxt)
|
||||
@ -604,9 +578,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
return 0;
|
||||
|
||||
error:
|
||||
#if WITH_GNUTLS
|
||||
virObjectUnref(svcTLS);
|
||||
#endif
|
||||
virObjectUnref(svcTCP);
|
||||
virObjectUnref(svc);
|
||||
virObjectUnref(svcRO);
|
||||
@ -666,7 +638,7 @@ daemonSetupLogging(struct daemonConfig *config,
|
||||
char *tmp;
|
||||
if (access("/run/systemd/journal/socket", W_OK) >= 0) {
|
||||
if (virAsprintf(&tmp, "%d:journald", virLogGetDefaultPriority()) < 0)
|
||||
goto error;
|
||||
goto no_memory;
|
||||
virLogParseOutputs(tmp);
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
@ -684,7 +656,7 @@ daemonSetupLogging(struct daemonConfig *config,
|
||||
if (virAsprintf(&tmp, "%d:file:%s/log/libvirt/libvirtd.log",
|
||||
virLogGetDefaultPriority(),
|
||||
LOCALSTATEDIR) == -1)
|
||||
goto error;
|
||||
goto no_memory;
|
||||
} else {
|
||||
char *logdir = virGetUserCacheDirectory();
|
||||
mode_t old_umask;
|
||||
@ -702,13 +674,13 @@ daemonSetupLogging(struct daemonConfig *config,
|
||||
if (virAsprintf(&tmp, "%d:file:%s/libvirtd.log",
|
||||
virLogGetDefaultPriority(), logdir) == -1) {
|
||||
VIR_FREE(logdir);
|
||||
goto error;
|
||||
goto no_memory;
|
||||
}
|
||||
VIR_FREE(logdir);
|
||||
}
|
||||
} else {
|
||||
if (virAsprintf(&tmp, "%d:stderr", virLogGetDefaultPriority()) < 0)
|
||||
goto error;
|
||||
goto no_memory;
|
||||
}
|
||||
virLogParseOutputs(tmp);
|
||||
VIR_FREE(tmp);
|
||||
@ -722,31 +694,13 @@ daemonSetupLogging(struct daemonConfig *config,
|
||||
|
||||
return 0;
|
||||
|
||||
no_memory:
|
||||
virReportOOMError();
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
daemonSetupAccessManager(struct daemonConfig *config)
|
||||
{
|
||||
virAccessManagerPtr mgr;
|
||||
const char *none[] = { "none", NULL };
|
||||
const char **driver = (const char **)config->access_drivers;
|
||||
|
||||
if (!driver ||
|
||||
!driver[0])
|
||||
driver = none;
|
||||
|
||||
if (!(mgr = virAccessManagerNewStack(driver)))
|
||||
return -1;
|
||||
|
||||
virAccessManagerSetDefault(mgr);
|
||||
virObjectUnref(mgr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Display version information. */
|
||||
static void
|
||||
daemonVersion(const char *argv0)
|
||||
@ -891,9 +845,6 @@ handleSystemMessageFunc(DBusConnection *connection ATTRIBUTE_UNUSED,
|
||||
static void daemonRunStateInit(void *opaque)
|
||||
{
|
||||
virNetServerPtr srv = opaque;
|
||||
virIdentityPtr sysident = virIdentityGetSystem();
|
||||
|
||||
virIdentitySetCurrent(sysident);
|
||||
|
||||
/* Since driver initialization can take time inhibit daemon shutdown until
|
||||
we're done so clients get a chance to connect */
|
||||
@ -936,8 +887,6 @@ static void daemonRunStateInit(void *opaque)
|
||||
cleanup:
|
||||
daemonInhibitCallback(false, srv);
|
||||
virObjectUnref(srv);
|
||||
virObjectUnref(sysident);
|
||||
virIdentitySetCurrent(NULL);
|
||||
}
|
||||
|
||||
static int daemonStateInit(virNetServerPtr srv)
|
||||
@ -993,8 +942,7 @@ static int migrateProfile(void)
|
||||
|
||||
config_home = getenv("XDG_CONFIG_HOME");
|
||||
if (config_home && config_home[0] != '\0') {
|
||||
if (VIR_STRDUP(xdg_dir, config_home) < 0)
|
||||
goto cleanup;
|
||||
xdg_dir = strdup(config_home);
|
||||
} else {
|
||||
if (virAsprintf(&xdg_dir, "%s/.config", home) < 0) {
|
||||
goto cleanup;
|
||||
@ -1038,13 +986,12 @@ daemonUsage(const char *argv0, bool privileged)
|
||||
" %s [options]\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
" -h | --help Display program help:\n"
|
||||
" -v | --verbose Verbose messages.\n"
|
||||
" -d | --daemon Run as a daemon & write PID file.\n"
|
||||
" -l | --listen Listen for TCP/IP connections.\n"
|
||||
" -t | --timeout <secs> Exit after timeout period.\n"
|
||||
" -f | --config <file> Configuration file.\n"
|
||||
" -V | --version Display version information.\n"
|
||||
" | --version Display version information.\n"
|
||||
" -p | --pid-file <file> Change name of PID file.\n"
|
||||
"\n"
|
||||
"libvirt management daemon:\n"),
|
||||
@ -1099,6 +1046,10 @@ daemonUsage(const char *argv0, bool privileged)
|
||||
}
|
||||
}
|
||||
|
||||
enum {
|
||||
OPT_VERSION = 129
|
||||
};
|
||||
|
||||
#define MAX_LISTEN 5
|
||||
int main(int argc, char **argv) {
|
||||
virNetServerPtr srv = NULL;
|
||||
@ -1120,14 +1071,14 @@ int main(int argc, char **argv) {
|
||||
mode_t old_umask;
|
||||
|
||||
struct option opts[] = {
|
||||
{ "verbose", no_argument, &verbose, 'v'},
|
||||
{ "daemon", no_argument, &godaemon, 'd'},
|
||||
{ "listen", no_argument, &ipsock, 'l'},
|
||||
{ "verbose", no_argument, &verbose, 1},
|
||||
{ "daemon", no_argument, &godaemon, 1},
|
||||
{ "listen", no_argument, &ipsock, 1},
|
||||
{ "config", required_argument, NULL, 'f'},
|
||||
{ "timeout", required_argument, NULL, 't'},
|
||||
{ "pid-file", required_argument, NULL, 'p'},
|
||||
{ "version", no_argument, NULL, 'V' },
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "version", no_argument, NULL, OPT_VERSION },
|
||||
{ "help", no_argument, NULL, '?' },
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
@ -1148,7 +1099,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
*tmp = '\0';
|
||||
char *driverdir;
|
||||
if (virAsprintfQuiet(&driverdir, "%s/../../src/.libs", argv[0]) < 0) {
|
||||
if (virAsprintf(&driverdir, "%s/../../src/.libs", argv[0]) < 0) {
|
||||
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@ -1170,7 +1121,7 @@ int main(int argc, char **argv) {
|
||||
int c;
|
||||
char *tmp;
|
||||
|
||||
c = getopt_long(argc, argv, "ldf:p:t:vVh", opts, &optidx);
|
||||
c = getopt_long(argc, argv, "ldf:p:t:v", opts, &optidx);
|
||||
|
||||
if (c == -1) {
|
||||
break;
|
||||
@ -1202,7 +1153,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
case 'p':
|
||||
VIR_FREE(pid_file);
|
||||
if (VIR_STRDUP_QUIET(pid_file, optarg) < 0) {
|
||||
if (!(pid_file = strdup(optarg))) {
|
||||
VIR_ERROR(_("Can't allocate memory"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@ -1210,23 +1161,23 @@ int main(int argc, char **argv) {
|
||||
|
||||
case 'f':
|
||||
VIR_FREE(remote_config_file);
|
||||
if (VIR_STRDUP_QUIET(remote_config_file, optarg) < 0) {
|
||||
if (!(remote_config_file = strdup(optarg))) {
|
||||
VIR_ERROR(_("Can't allocate memory"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
case OPT_VERSION:
|
||||
daemonVersion(argv[0]);
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
case 'h':
|
||||
daemonUsage(argv[0], privileged);
|
||||
exit(EXIT_SUCCESS);
|
||||
return 0;
|
||||
|
||||
case '?':
|
||||
default:
|
||||
daemonUsage(argv[0], privileged);
|
||||
return 2;
|
||||
|
||||
default:
|
||||
VIR_ERROR(_("%s: internal error: unknown flag: %c"),
|
||||
argv[0], c);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
@ -1281,11 +1232,6 @@ int main(int argc, char **argv) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (daemonSetupAccessManager(config) < 0) {
|
||||
VIR_ERROR(_("Can't initialize access manager"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!pid_file &&
|
||||
daemonPidFilePath(privileged,
|
||||
&pid_file) < 0) {
|
||||
@ -1322,10 +1268,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
/* Ensure the rundir exists (on tmpfs on some systems) */
|
||||
if (privileged) {
|
||||
if (VIR_STRDUP_QUIET(run_dir, LOCALSTATEDIR "/run/libvirt") < 0) {
|
||||
VIR_ERROR(_("Can't allocate memory"));
|
||||
goto cleanup;
|
||||
}
|
||||
run_dir = strdup(LOCALSTATEDIR "/run/libvirt");
|
||||
} else {
|
||||
run_dir = virGetUserRuntimeDirectory();
|
||||
|
||||
@ -1334,6 +1277,11 @@ int main(int argc, char **argv) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
if (!run_dir) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (privileged)
|
||||
old_umask = umask(022);
|
||||
else
|
||||
@ -1403,18 +1351,6 @@ int main(int argc, char **argv) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(lxcProgram = virNetServerProgramNew(LXC_PROGRAM,
|
||||
LXC_PROTOCOL_VERSION,
|
||||
lxcProcs,
|
||||
lxcNProcs))) {
|
||||
ret = VIR_DAEMON_ERR_INIT;
|
||||
goto cleanup;
|
||||
}
|
||||
if (virNetServerAddProgram(srv, lxcProgram) < 0) {
|
||||
ret = VIR_DAEMON_ERR_INIT;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(qemuProgram = virNetServerProgramNew(QEMU_PROGRAM,
|
||||
QEMU_PROTOCOL_VERSION,
|
||||
qemuProcs,
|
||||
@ -1520,7 +1456,6 @@ int main(int argc, char **argv) {
|
||||
cleanup:
|
||||
virNetlinkEventServiceStopAll();
|
||||
virObjectUnref(remoteProgram);
|
||||
virObjectUnref(lxcProgram);
|
||||
virObjectUnref(qemuProgram);
|
||||
virNetServerClose(srv);
|
||||
virObjectUnref(srv);
|
||||
@ -1546,7 +1481,5 @@ cleanup:
|
||||
|
||||
daemonConfigFree(config);
|
||||
|
||||
virStateCleanup();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -155,15 +155,6 @@
|
||||
#auth_tls = "none"
|
||||
|
||||
|
||||
# Change the API access control scheme
|
||||
#
|
||||
# By default an authenticated user is allowed access
|
||||
# to all APIs. Access drivers can place restrictions
|
||||
# on this. By default the 'nop' driver is enabled,
|
||||
# meaning no access control checks are done once a
|
||||
# client has authenticated with libvirtd
|
||||
#
|
||||
#access_drivers = [ "polkit" ]
|
||||
|
||||
#################################################################
|
||||
#
|
||||
@ -257,12 +248,6 @@
|
||||
# over all sockets combined.
|
||||
#max_clients = 20
|
||||
|
||||
# The maximum length of queue of connections waiting to be
|
||||
# accepted by the daemon. Note, that some protocols supporting
|
||||
# retransmission may obey this so that a later reattempt at
|
||||
# connection succeeds.
|
||||
#max_queued_clients = 1000
|
||||
|
||||
|
||||
# The minimum limit sets the number of workers to start up
|
||||
# initially. If the number of active clients exceeds this,
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* libvirtd.h: daemon data structure definitions
|
||||
*
|
||||
* Copyright (C) 2006-2013 Red Hat, Inc.
|
||||
* Copyright (C) 2006-2012 Red Hat, Inc.
|
||||
* Copyright (C) 2006 Daniel P. Berrange
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -27,14 +27,15 @@
|
||||
|
||||
# define VIR_ENUM_SENTINELS
|
||||
|
||||
# include <config.h>
|
||||
|
||||
# include <rpc/types.h>
|
||||
# include <rpc/xdr.h>
|
||||
# include "remote_protocol.h"
|
||||
# include "lxc_protocol.h"
|
||||
# include "qemu_protocol.h"
|
||||
# include "virlog.h"
|
||||
# include "virthread.h"
|
||||
# if WITH_SASL
|
||||
# include "logging.h"
|
||||
# include "threads.h"
|
||||
# if HAVE_SASL
|
||||
# include "virnetsaslcontext.h"
|
||||
# endif
|
||||
# include "virnetserverprogram.h"
|
||||
@ -51,7 +52,7 @@ struct daemonClientPrivate {
|
||||
|
||||
int domainEventCallbackID[VIR_DOMAIN_EVENT_ID_LAST];
|
||||
|
||||
# if WITH_SASL
|
||||
# if HAVE_SASL
|
||||
virNetSASLSessionPtr sasl;
|
||||
# endif
|
||||
|
||||
@ -65,7 +66,7 @@ struct daemonClientPrivate {
|
||||
bool keepalive_supported;
|
||||
};
|
||||
|
||||
# if WITH_SASL
|
||||
# if HAVE_SASL
|
||||
extern virNetSASLContextPtr saslCtxt;
|
||||
# endif
|
||||
extern virNetServerProgramPtr remoteProgram;
|
||||
|
@ -36,10 +36,6 @@ from the configuration.
|
||||
|
||||
=over
|
||||
|
||||
=item B<-h, --help>
|
||||
|
||||
Display command line help usage then exit.
|
||||
|
||||
=item B<-d, --daemon>
|
||||
|
||||
Run as a daemon & write PID file.
|
||||
|
@ -27,5 +27,5 @@ mech_list: digest-md5
|
||||
|
||||
# If using digest-md5 for username/passwds, then this is the file
|
||||
# containing the passwds. Use 'saslpasswd2 -a libvirt [username]'
|
||||
# to add entries, and 'sasldblistusers2 -f [sasldb_path]' to browse it
|
||||
# to add entries, and 'sasldblistusers2 -a libvirt' to browse it
|
||||
sasldb_path: /etc/libvirt/passwd.db
|
||||
|
@ -8,14 +8,12 @@ Description=Virtualization daemon
|
||||
Before=libvirt-guests.service
|
||||
After=network.target
|
||||
After=dbus.service
|
||||
After=iscsid.service
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/sysconfig/libvirtd
|
||||
ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
KillMode=process
|
||||
Restart=on-failure
|
||||
# Override the maximum number of opened files
|
||||
#LimitNOFILE=2048
|
||||
|
||||
|
1371
daemon/remote.c
1371
daemon/remote.c
File diff suppressed because it is too large
Load Diff
@ -32,9 +32,6 @@
|
||||
extern virNetServerProgramProc remoteProcs[];
|
||||
extern size_t remoteNProcs;
|
||||
|
||||
extern virNetServerProgramProc lxcProcs[];
|
||||
extern size_t lxcNProcs;
|
||||
|
||||
extern virNetServerProgramProc qemuProcs[];
|
||||
extern size_t qemuNProcs;
|
||||
|
||||
|
@ -25,10 +25,10 @@
|
||||
|
||||
#include "stream.h"
|
||||
#include "remote.h"
|
||||
#include "viralloc.h"
|
||||
#include "virlog.h"
|
||||
#include "memory.h"
|
||||
#include "logging.h"
|
||||
#include "virnetserverclient.h"
|
||||
#include "virerror.h"
|
||||
#include "virterror_internal.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_STREAMS
|
||||
|
||||
@ -148,14 +148,6 @@ daemonStreamEvent(virStreamPtr st, int events, void *opaque)
|
||||
virNetServerClientClose(client);
|
||||
goto cleanup;
|
||||
}
|
||||
/* If we detected EOF during read processing,
|
||||
* then clear hangup/error conditions, since
|
||||
* we want the client to see the EOF message
|
||||
* we just sent them
|
||||
*/
|
||||
if (stream->recvEOF)
|
||||
events = events & ~(VIR_STREAM_EVENT_HANGUP |
|
||||
VIR_STREAM_EVENT_ERROR);
|
||||
}
|
||||
|
||||
/* If we have a completion/abort message, always process it */
|
||||
@ -325,8 +317,10 @@ daemonCreateClientStream(virNetServerClientPtr client,
|
||||
VIR_DEBUG("client=%p, proc=%d, serial=%d, st=%p",
|
||||
client, header->proc, header->serial, st);
|
||||
|
||||
if (VIR_ALLOC(stream) < 0)
|
||||
if (VIR_ALLOC(stream) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stream->refs = 1;
|
||||
stream->priv = priv;
|
||||
|
@ -17,9 +17,6 @@ module Test_libvirtd =
|
||||
{ "auth_unix_rw" = "none" }
|
||||
{ "auth_tcp" = "sasl" }
|
||||
{ "auth_tls" = "none" }
|
||||
{ "access_drivers"
|
||||
{ "1" = "polkit" }
|
||||
}
|
||||
{ "key_file" = "/etc/pki/libvirt/private/serverkey.pem" }
|
||||
{ "cert_file" = "/etc/pki/libvirt/servercert.pem" }
|
||||
{ "ca_file" = "/etc/pki/CA/cacert.pem" }
|
||||
@ -35,7 +32,6 @@ module Test_libvirtd =
|
||||
{ "2" = "fred@EXAMPLE.COM" }
|
||||
}
|
||||
{ "max_clients" = "20" }
|
||||
{ "max_queued_clients" = "1000" }
|
||||
{ "min_workers" = "5" }
|
||||
{ "max_workers" = "20" }
|
||||
{ "prio_workers" = "5" }
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>404 page not found</h1>
|
||||
|
||||
|
@ -1,20 +1,7 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
## Copyright (C) 2005-2013 Red Hat, Inc.
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
## License as published by the Free Software Foundation; either
|
||||
## version 2.1 of the License, or (at your option) any later version.
|
||||
##
|
||||
## This library is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public
|
||||
## License along with this library. If not, see
|
||||
## <http://www.gnu.org/licenses/>.
|
||||
## Copyright (C) 2005-2012 Red Hat, Inc.
|
||||
## See COPYING.LIB for the License of this software
|
||||
|
||||
SUBDIRS= schemas
|
||||
|
||||
@ -25,6 +12,8 @@ DOC_SOURCE_DIR=../src
|
||||
|
||||
DEVHELP_DIR=$(datadir)/gtk-doc/html/libvirt
|
||||
|
||||
BUILT_SOURCES=hvsupport.html.in
|
||||
|
||||
apihtml = \
|
||||
html/index.html \
|
||||
html/libvirt-libvirt.html \
|
||||
@ -87,12 +76,6 @@ internals_html_in = \
|
||||
$(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.html.in))
|
||||
internals_html = $(internals_html_in:%.html.in=%.html)
|
||||
|
||||
# todo.html is special - it is shipped in the tarball, but we
|
||||
# have a dedicated 'todo' target to rebuild it from a proper
|
||||
# config file, all other users are able to build it locally.
|
||||
# For all other files, since we ship pre-built html in the
|
||||
# tarball, we must also ship the sources, even when those
|
||||
# sources are themselves generated.
|
||||
dot_html_in = $(notdir $(wildcard $(srcdir)/*.html.in)) \
|
||||
todo.html.in \
|
||||
hvsupport.html.in
|
||||
@ -112,12 +95,8 @@ qemu_xml = \
|
||||
libvirt-qemu-api.xml \
|
||||
libvirt-qemu-refs.xml
|
||||
|
||||
lxc_xml = \
|
||||
libvirt-lxc-api.xml \
|
||||
libvirt-lxc-refs.xml
|
||||
|
||||
apidir = $(pkgdatadir)/api
|
||||
api_DATA = libvirt-api.xml libvirt-qemu-api.xml libvirt-lxc-api.xml
|
||||
api_DATA = libvirt-api.xml libvirt-qemu-api.xml
|
||||
|
||||
fig = \
|
||||
libvirt-net-logical.fig \
|
||||
@ -132,36 +111,28 @@ fig = \
|
||||
migration-unmanaged-direct.fig
|
||||
|
||||
EXTRA_DIST= \
|
||||
apibuild.py genaclperms.pl \
|
||||
apibuild.py \
|
||||
site.xsl newapi.xsl news.xsl page.xsl \
|
||||
hacking1.xsl hacking2.xsl wrapstring.xsl \
|
||||
$(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \
|
||||
$(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \
|
||||
$(xml) $(qemu_xml) $(lxc_xml) $(fig) $(png) $(css) \
|
||||
$(xml) $(qemu_xml) $(fig) $(png) $(css) \
|
||||
$(patches) $(dot_php_in) $(dot_php_code_in) $(dot_php)\
|
||||
$(internals_html_in) $(internals_html) \
|
||||
sitemap.html.in aclperms.htmlinc \
|
||||
sitemap.html.in \
|
||||
todo.pl hvsupport.pl todo.cfg-example
|
||||
|
||||
acl.html:: $(srcdir)/aclperms.htmlinc
|
||||
|
||||
$(srcdir)/aclperms.htmlinc: $(top_srcdir)/src/access/viraccessperm.h \
|
||||
$(srcdir)/genaclperms.pl Makefile.am
|
||||
$(AM_V_GEN)$(PERL) $(srcdir)/genaclperms.pl $< > $@
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
$(addprefix $(srcdir)/,$(dot_html)) \
|
||||
$(addprefix $(srcdir)/,$(apihtml)) \
|
||||
$(addprefix $(srcdir)/,$(devhelphtml)) \
|
||||
$(addprefix $(srcdir)/,$(internals_html)) \
|
||||
$(addprefix $(srcdir)/,$(dot_php)) \
|
||||
$(srcdir)/hvsupport.html.in $(srcdir)/aclperms.htmlinc
|
||||
$(addprefix $(srcdir)/,$(dot_php))
|
||||
|
||||
all-am: web
|
||||
|
||||
api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml
|
||||
qemu_api: $(srcdir)/libvirt-qemu-api.xml $(srcdir)/libvirt-qemu-refs.xml
|
||||
lxc_api: $(srcdir)/libvirt-lxc-api.xml $(srcdir)/libvirt-lxc-refs.xml
|
||||
|
||||
web: $(dot_html) $(internals_html) html/index.html devhelp/index.html \
|
||||
$(dot_php)
|
||||
@ -173,25 +144,16 @@ todo.html.in: todo.pl
|
||||
|| { rm $@ && exit 1; }; \
|
||||
else \
|
||||
echo "Stubbing $@"; \
|
||||
printf "%s\n" \
|
||||
"<html xmlns=\"http://www.w3.org/1999/xhtml\">" \
|
||||
"<body>" \
|
||||
"<h1>Todo list unavailable: no config file</h1>" \
|
||||
"</body></html>" > $@ ; \
|
||||
echo "<html><body><h1>Todo list</h1></body></html>" > $@ ; \
|
||||
fi
|
||||
|
||||
todo:
|
||||
rm -f todo.html.in
|
||||
$(MAKE) todo.html
|
||||
|
||||
hvsupport.html:: $(srcdir)/hvsupport.html.in
|
||||
|
||||
$(srcdir)/hvsupport.html.in: $(srcdir)/hvsupport.pl \
|
||||
$(srcdir)/../src/libvirt_public.syms \
|
||||
$(srcdir)/../src/libvirt_qemu.syms $(srcdir)/../src/libvirt_lxc.syms \
|
||||
$(srcdir)/../src/driver.h
|
||||
$(AM_V_GEN)$(PERL) $(srcdir)/hvsupport.pl $(srcdir)/../src > $@ \
|
||||
|| { rm $@ && exit 1; }
|
||||
hvsupport.html.in: $(srcdir)/hvsupport.pl $(srcdir)/../src/libvirt_public.syms \
|
||||
$(srcdir)/../src/libvirt_qemu.syms $(srcdir)/../src/driver.h
|
||||
$(AM_V_GEN)$(PERL) $(srcdir)/hvsupport.pl $(srcdir)/../src > $@ || { rm $@ && exit 1; }
|
||||
|
||||
.PHONY: todo
|
||||
|
||||
@ -203,7 +165,7 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
|
||||
echo "Generating $@"; \
|
||||
$(MKDIR_P) internals; \
|
||||
name=`echo $@ | sed -e 's/.tmp//'`; \
|
||||
$(XSLTPROC) --stringparam pagename $$name --nonet \
|
||||
$(XSLTPROC) --stringparam pagename $$name --nonet --html \
|
||||
$(top_srcdir)/docs/subsite.xsl $< > $@ \
|
||||
|| { rm $@ && exit 1; }; fi
|
||||
|
||||
@ -211,7 +173,7 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
|
||||
@if [ -x $(XSLTPROC) ] ; then \
|
||||
echo "Generating $@"; \
|
||||
name=`echo $@ | sed -e 's/.tmp//'`; \
|
||||
$(XSLTPROC) --stringparam pagename $$name --nonet \
|
||||
$(XSLTPROC) --stringparam pagename $$name --nonet --html \
|
||||
$(top_srcdir)/docs/site.xsl $< > $@ \
|
||||
|| { rm $@ && exit 1; }; fi
|
||||
|
||||
@ -228,7 +190,7 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
|
||||
%.php.tmp: %.php.in site.xsl page.xsl sitemap.html.in
|
||||
@if [ -x $(XSLTPROC) ] ; then \
|
||||
echo "Generating $@"; \
|
||||
$(XSLTPROC) --stringparam pagename $(@:.tmp=) --nonet \
|
||||
$(XSLTPROC) --stringparam pagename $(@:.tmp=) --nonet --html \
|
||||
$(top_srcdir)/docs/site.xsl $< > $@ \
|
||||
|| { rm $@ && exit 1; }; fi
|
||||
|
||||
@ -258,16 +220,12 @@ $(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl)
|
||||
|
||||
python_generated_files = \
|
||||
$(srcdir)/html/libvirt-libvirt.html \
|
||||
$(srcdir)/html/libvirt-libvirt-lxc.html \
|
||||
$(srcdir)/html/libvirt-libvirt-qemu.html \
|
||||
$(srcdir)/html/libvirt-virterror.html \
|
||||
$(srcdir)/libvirt-api.xml \
|
||||
$(srcdir)/libvirt-refs.xml \
|
||||
$(srcdir)/libvirt-lxc-api.xml \
|
||||
$(srcdir)/libvirt-lxc-refs.xml \
|
||||
$(srcdir)/libvirt-qemu-api.xml \
|
||||
$(srcdir)/libvirt-qemu-refs.xml \
|
||||
$(NULL)
|
||||
$(srcdir)/libvirt-qemu-refs.xml
|
||||
|
||||
APIBUILD=$(srcdir)/apibuild.py
|
||||
APIBUILD_STAMP=$(APIBUILD).stamp
|
||||
@ -277,33 +235,26 @@ $(python_generated_files): $(APIBUILD_STAMP)
|
||||
|
||||
$(APIBUILD_STAMP): $(srcdir)/apibuild.py \
|
||||
$(srcdir)/../include/libvirt/libvirt.h.in \
|
||||
$(srcdir)/../include/libvirt/libvirt-lxc.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-qemu.h \
|
||||
$(srcdir)/../include/libvirt/virterror.h \
|
||||
$(srcdir)/../src/libvirt.c \
|
||||
$(srcdir)/../src/libvirt-lxc.c \
|
||||
$(srcdir)/../src/libvirt-qemu.c \
|
||||
$(srcdir)/../src/util/virerror.c \
|
||||
$(srcdir)/../src/util/virevent.c \
|
||||
$(srcdir)/../src/util/virtypedparam.c
|
||||
$(srcdir)/../src/util/virterror.c
|
||||
$(AM_V_GEN)srcdir=$(srcdir) $(PYTHON) $(APIBUILD)
|
||||
touch $@
|
||||
|
||||
|
||||
check-local: all
|
||||
dist-local: all
|
||||
|
||||
clean-local:
|
||||
rm -f *~ *.bak *.hierarchy *.signals *-unused.txt *.html
|
||||
|
||||
maintainer-clean-local: clean-local
|
||||
rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml \
|
||||
todo.html.in
|
||||
rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml todo.html.in hvsupport.html.in
|
||||
rm -rf $(srcdir)/libvirt-qemu-api.xml $(srcdir)/libvirt-qemu-refs.xml
|
||||
rm -rf $(srcdir)/libvirt-lxc-api.xml $(srcdir)/libvirt-lxc-refs.xml
|
||||
rm -rf $(APIBUILD_STAMP)
|
||||
|
||||
rebuild: api qemu_api lxc_api all
|
||||
rebuild: api qemu_api all
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
|
||||
@ -321,7 +272,6 @@ install-data-local:
|
||||
for file in $(devhelphtml) $(devhelppng) $(devhelpcss); do \
|
||||
$(INSTALL) -m 0644 $(srcdir)/$${file} $(DESTDIR)$(DEVHELP_DIR) ; \
|
||||
done
|
||||
$(INSTALL_DATA) $(srcdir)/libvirtLogo.png $(DESTDIR)$(pkgdatadir)
|
||||
|
||||
uninstall-local:
|
||||
for h in $(apihtml); do rm $(DESTDIR)$(HTML_DIR)/$$h; done
|
||||
|
100
docs/acl.html.in
100
docs/acl.html.in
@ -1,100 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>Client access control</h1>
|
||||
<p>
|
||||
Libvirt's client access control framework allows administrators
|
||||
to setup fine grained permission rules across client users,
|
||||
managed objects and API operations. This allows client connections
|
||||
to be locked down to a minimal set of privileges.
|
||||
</p>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<h2><a name="intro">Access control introduction</a></h2>
|
||||
|
||||
<p>
|
||||
In a default configuration, the libvirtd daemon has three levels
|
||||
of access control. All connections start off in an unauthenticated
|
||||
state, where the only API operations allowed are those required
|
||||
to complete authentication. After successful authentication, a
|
||||
connection either has full, unrestricted access to all libvirt
|
||||
API calls, or is locked down to only "read only" operations,
|
||||
according to what socket a client connection originated on.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The access control framework allows authenticated connections to
|
||||
have fine grained permission rules to be defined by the administrator.
|
||||
Every API call in libvirt has a set of permissions that will
|
||||
be validated against the object being used. For example, the
|
||||
<code>virDomainSetSchedulerParametersFlags</code> method will
|
||||
check whether the client user has the <code>write</code>
|
||||
permission on the <code>domain</code> object instance passed
|
||||
in as a parameter. Further permissions will also be checked
|
||||
if certain flags are set in the API call. In addition to
|
||||
checks on the object passed in to an API call, some methods
|
||||
will filter their results. For example the <code>virConnectListAllDomains</code>
|
||||
method will check the <code>search_domains</code> on the <code>connect</code>
|
||||
object, but will also filter the returned <code>domain</code>
|
||||
objects to only those on which the client user has the
|
||||
<code>getattr</code> permission.
|
||||
</p>
|
||||
|
||||
<h2><a name="drivers">Access control drivers</a></h2>
|
||||
|
||||
<p>
|
||||
The access control framework is designed as a pluggable
|
||||
system to enable future integration with arbitrary access
|
||||
control technologies. By default, the <code>none</code>
|
||||
driver is used, which does no access control checks at
|
||||
all. At this time, libvirt ships with support for using
|
||||
<a href="http://www.freedesktop.org/wiki/Software/polkit/">polkit</a> as a real access
|
||||
control driver. To learn how to use the polkit access
|
||||
driver consult <a href="aclpolkit.html">the configuration
|
||||
docs</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The access driver is configured in the <code>libvirtd.conf</code>
|
||||
configuration file, using the <code>access_drivers</code>
|
||||
parameter. This parameter accepts an array of access control
|
||||
driver names. If more than one access driver is requested,
|
||||
then all must succeed in order for access to be granted.
|
||||
To enable 'polkit' as the driver:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# augtool -s set '/files/etc/libvirt/libvirtd.conf/access_drivers[1]' polkit
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
And to reset back to the default (no-op) driver
|
||||
</p>
|
||||
|
||||
|
||||
<pre>
|
||||
# augtool -s rm /files/etc/libvirt/libvirtd.conf/access_drivers
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<strong>Note:</strong> changes to libvirtd.conf require that
|
||||
the libvirtd daemon be restarted.
|
||||
</p>
|
||||
|
||||
<h2><a name="perms">Objects and permissions</a></h2>
|
||||
|
||||
<p>
|
||||
Libvirt applies access control to all the main object
|
||||
types in its API. Each object type, in turn, has a set
|
||||
of permissions defined. To determine what permissions
|
||||
are checked for specific API call, consult the
|
||||
<a href="html/libvirt-libvirt.html">API reference manual</a>
|
||||
documentation for the API in question.
|
||||
</p>
|
||||
|
||||
<div id="include" filename="aclperms.htmlinc"/>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,408 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>Polkit access control</h1>
|
||||
|
||||
<p>
|
||||
Libvirt's client <a href="acl.html">access control framework</a> allows
|
||||
administrators to setup fine grained permission rules across client users,
|
||||
managed objects and API operations. This allows client connections
|
||||
to be locked down to a minimal set of privileges. The polkit driver
|
||||
provides a simple implementation of the access control framework.
|
||||
</p>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<h2><a name="intro">Introduction</a></h2>
|
||||
|
||||
<p>
|
||||
A default install of libvirt will typically use
|
||||
<a href="http://www.freedesktop.org/wiki/Software/polkit/">polkit</a>
|
||||
to authenticate the initial user connection to libvirtd. This is a
|
||||
very coarse grained check though, either allowing full read-write
|
||||
access to all APIs, or just read-only access. The polkit access
|
||||
control driver in libvirt builds on this capability to allow for
|
||||
fine grained control over the operations a user may perform on an
|
||||
object.
|
||||
</p>
|
||||
|
||||
<h2><a name="perms">Permission names</a></h2>
|
||||
|
||||
<p>
|
||||
The libvirt <a href="acl.html#perms">object names and permission names</a>
|
||||
are mapped onto polkit action names using the simple pattern:
|
||||
</p>
|
||||
|
||||
<pre>org.libvirt.api.$object.$permission
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The only caveat is that any underscore characters in the
|
||||
object or permission names are converted to hyphens. So,
|
||||
for example, the <code>search_storage_vols</code> permission
|
||||
on the <code>storage_pool</code> object maps to the polkit
|
||||
action:
|
||||
</p>
|
||||
<pre>org.libvirt.api.storage-pool.search-storage-vols
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The default policy for any permission which corresponds to
|
||||
a "read only" operation, is to allow access. All other
|
||||
permissions default to deny access.
|
||||
</p>
|
||||
|
||||
<h2><a name="attrs">Object identity attributes</a></h2>
|
||||
|
||||
<p>
|
||||
To allow polkit authorization rules to be written to match
|
||||
against individual object instances, libvirt provides a number
|
||||
of authorization detail attributes when performing a permission
|
||||
check. The set of attributes varies according to the type
|
||||
of object being checked
|
||||
</p>
|
||||
|
||||
<h3><a name="object_connect">virConnectPtr</a></h3>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>connect_driver</td>
|
||||
<td>Name of the libvirt connection driver</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a name="object_domain">virDomainPtr</a></h3>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>connect_driver</td>
|
||||
<td>Name of the libvirt connection driver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>domain_name</td>
|
||||
<td>Name of the domain, unique to the local host</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>domain_uuid</td>
|
||||
<td>UUID of the domain, globally unique</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a name="object_interface">virInterfacePtr</a></h3>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>connect_driver</td>
|
||||
<td>Name of the libvirt connection driver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>interface_name</td>
|
||||
<td>Name of the network interface, unique to the local host</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>interface_mac</td>
|
||||
<td>MAC address of the network interface, not unique</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a name="object_network">virNetworkPtr</a></h3>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>connect_driver</td>
|
||||
<td>Name of the libvirt connection driver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>network_name</td>
|
||||
<td>Name of the network, unique to the local host</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>network_uuid</td>
|
||||
<td>UUID of the network, globally unique</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a name="object_node_device">virNodeDevicePtr</a></h3>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>connect_driver</td>
|
||||
<td>Name of the libvirt connection driver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>node_device_name</td>
|
||||
<td>Name of the node device, unique to the local host</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a name="object_nwfilter">virNWFilterPtr</a></h3>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>connect_driver</td>
|
||||
<td>Name of the libvirt connection driver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>nwfilter_name</td>
|
||||
<td>Name of the network filter, unique to the local host</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>nwfilter_uuid</td>
|
||||
<td>UUID of the network filter, globally unique</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a name="object_secret">virSecretPtr</a></h3>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>connect_driver</td>
|
||||
<td>Name of the libvirt connection driver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>secret_uuid</td>
|
||||
<td>UUID of the secret, globally unique</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>secret_usage_volume</td>
|
||||
<td>Name of the associated volume, if any</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>secret_usage_ceph</td>
|
||||
<td>Name of the associated Ceph server, if any</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>secret_usage_target</td>
|
||||
<td>Name of the associated iSCSI target, if any</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a name="object_storage_pool">virStoragePoolPtr</a></h3>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>connect_driver</td>
|
||||
<td>Name of the libvirt connection driver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>pool_name</td>
|
||||
<td>Name of the storage pool, unique to the local host</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>pool_uuid</td>
|
||||
<td>UUID of the storage pool, globally unique</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a name="object_storage_vol">virStorageVolPtr</a></h3>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>connect_driver</td>
|
||||
<td>Name of the libvirt connection driver</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>pool_name</td>
|
||||
<td>Name of the storage pool, unique to the local host</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>pool_uuid</td>
|
||||
<td>UUID of the storage pool, globally unique</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>vol_name</td>
|
||||
<td>Name of the storage volume, unique to the pool</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>vol_key</td>
|
||||
<td>Key of the storage volume, globally unique</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<h2><a name="user">User identity attributes</a></h2>
|
||||
|
||||
<p>
|
||||
At this point in time, the only attribute provided by
|
||||
libvirt to identify the user invoking the operation
|
||||
is the PID of the client program. This means that the
|
||||
polkit access control driver is only useful if connections
|
||||
to libvirt are restricted to its UNIX domain socket. If
|
||||
connections are being made to a TCP socket, no identifying
|
||||
information is available and access will be denied.
|
||||
Also note that if the client is connecting via an SSH
|
||||
tunnel, it is the local SSH user that will be identified.
|
||||
In future versions, it is expected that more information
|
||||
about the client user will be provided, including the
|
||||
SASL / Kerberos username and/or x509 distinguished
|
||||
name obtained from the authentication provider in use.
|
||||
</p>
|
||||
|
||||
|
||||
<h2><a name="checks">Writing acces control policies</a></h2>
|
||||
|
||||
<p>
|
||||
If using versions of polkit prior to 0.106 then it is only
|
||||
possible to validate (user, permission) pairs via the <code>.pkla</code>
|
||||
files. Fully validation of the (user, permission, object) triple
|
||||
requires the new JavaScript <code>.rules</code> support that
|
||||
was introduced in version 0.106. The latter is what will be
|
||||
described here.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Libvirt does not ship any rules files by default. It merely
|
||||
provides a definition of the default behaviour for each
|
||||
action (permission). As noted earlier, permissions which
|
||||
correspond to read-only operations in libvirt will be allowed
|
||||
to all users by default; everything else is denied by default.
|
||||
Defining custom rules requires creation of a file in the
|
||||
<code>/etc/polkit-1/rules.d</code> directory with a name
|
||||
chosen by the administrator (<code>100-libvirt-acl.rules</code>
|
||||
would be a reasonable choice). See the <code>polkit(8)</code>
|
||||
manual page for a description of how to write these files
|
||||
in general. The key idea is to create a file containing
|
||||
something like
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
polkit.addRule(function(action, subject) {
|
||||
....logic to check 'action' and 'subject'...
|
||||
});
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
In this code snippet above, the <code>action</code> object
|
||||
instance will represent the libvirt permission being checked
|
||||
along with identifying attributes for the object it is being
|
||||
applied to. The <code>subject</code> meanwhile will identify
|
||||
the libvirt client app (with the caveat above about it only
|
||||
dealing with local clients connected via the UNIX socket).
|
||||
On the <code>action</code> object, the permission name is
|
||||
accessible via the <code>id</code> attribute, while the
|
||||
object identifying attributes are exposed via the
|
||||
<code>lookup</code> method.
|
||||
</p>
|
||||
|
||||
<h3><a name="exconnect">Example: restricting ability to connect to drivers</a></h3>
|
||||
|
||||
<p>
|
||||
Consider a local user <code>berrange</code>
|
||||
who has been granted permission to connect to libvirt in
|
||||
full read-write mode. The goal is to only allow them to
|
||||
use the <code>QEMU</code> driver and not the Xen or LXC
|
||||
drivers which are also available in libvirtd.
|
||||
To achieve this we need to write a rule which checks
|
||||
whether the <code>connect_driver</code> attribute
|
||||
is <code>QEMU</code>, and match on an action
|
||||
name of <code>org.libvirt.api.connect.getattr</code>. Using
|
||||
the javascript rules format, this ends up written as
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (action.id == "org.libvirt.api.connect.getattr" &&
|
||||
subject.user == "berrange") {
|
||||
if (action.lookup("connect_driver") == 'QEMU') {
|
||||
return polkit.Result.YES;
|
||||
} else {
|
||||
return polkit.Result.NO;
|
||||
}
|
||||
}
|
||||
});
|
||||
</pre>
|
||||
|
||||
<h3><a name="exdomain">Example: restricting access to a single domain</a></h3>
|
||||
|
||||
<p>
|
||||
Consider a local user <code>berrange</code>
|
||||
who has been granted permission to connect to libvirt in
|
||||
full read-write mode. The goal is to only allow them to
|
||||
see the domain called <code>demo</code> on the LXC driver.
|
||||
To achieve this we need to write a rule which checks
|
||||
whether the <code>connect_driver</code> attribute
|
||||
is <code>LXC</code> and the <code>domain_name</code>
|
||||
attribute is <code>demo</code>, and match on a action
|
||||
name of <code>org.libvirt.api.domain.getattr</code>. Using
|
||||
the javascript rules format, this ends up written as
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (action.id == "org.libvirt.api.domain.getattr" &&
|
||||
subject.user == "berrange") {
|
||||
if (action.lookup("connect_driver") == 'LXC' &&
|
||||
action.lookup("domain_name") == 'demo') {
|
||||
return polkit.Result.YES;
|
||||
} else {
|
||||
return polkit.Result.NO;
|
||||
}
|
||||
}
|
||||
});
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
266
docs/api.html.in
266
docs/api.html.in
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>The libvirt API concepts</h1>
|
||||
|
||||
@ -9,28 +8,26 @@
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<h2><a name="Objects">Objects Exposed</a></h2>
|
||||
<p> As defined in the <a href="goals.html">goals section</a>, the libvirt
|
||||
API is designed to expose all the resources needed to manage the
|
||||
virtualization support of recent operating systems. The first object
|
||||
manipulated through the API is the <code>virConnectPtr</code>, which
|
||||
represents the connection to a hypervisor. Any application using libvirt
|
||||
is likely to start using the
|
||||
<h2><a name="Objects">Objects exposed</a></h2>
|
||||
<p> As defined in the <a href="goals.html">goals section</a>, libvirt
|
||||
API need to expose all the resources needed to manage the virtualization
|
||||
support of recent operating systems. The first object manipulated though
|
||||
the API is <code>virConnectPtr</code> which represent a connection to
|
||||
an hypervisor. Any application using libvirt is likely to start using the
|
||||
API by calling one of <a href="html/libvirt-libvirt.html#virConnectOpen"
|
||||
>the virConnectOpen functions</a>. You will note that those functions take
|
||||
a name argument which is actually a <a href="uri.html">connection URI</a>
|
||||
to select the right hypervisor to open.
|
||||
A URI is needed to allow remote connections and also select between
|
||||
different possible hypervisors. For example, on a Linux system it may be
|
||||
possible to use both KVM and LinuxContainers on the same node. A NULL
|
||||
name will default to a preselected hypervisor, but it's probably not a
|
||||
a name argument which is actually an URI to select the right hypervisor to
|
||||
open, this is needed to allow remote connections and also select between
|
||||
different possible hypervisors (for example on a Linux system it may be
|
||||
possible to use both KVM and LinuxContainers on the same node). A NULL
|
||||
name will default to a preselected hypervisor but it's probably not a
|
||||
wise thing to do in most cases. See the <a href="uri.html">connection
|
||||
URI</a> page for a full descriptions of the values allowed.</p>
|
||||
<p> Once the application obtains a <code class='docref'>virConnectPtr</code>
|
||||
connection to the hypervisor it can then use it to manage the hypervisor's
|
||||
available domains and related virtualization
|
||||
resources, such as storage and networking. All those are
|
||||
exposed as first class objects and connected to the hypervisor connection
|
||||
<p> Once the application obtained a <code class='docref'>virConnectPtr</code>
|
||||
connection to the
|
||||
hypervisor it can then use it to manage domains and related resources
|
||||
available for virtualization like storage and networking. All those are
|
||||
exposed as first class objects, and connected to the hypervisor connection
|
||||
(and the node or cluster where it is available).</p>
|
||||
<p class="image">
|
||||
<img alt="first class objects exposed by the API"
|
||||
@ -38,201 +35,92 @@
|
||||
</p>
|
||||
<p> The figure above shows the five main objects exported by the API:</p>
|
||||
<ul>
|
||||
<li><code class='docref'>virConnectPtr</code>
|
||||
<p>Represents the connection to a hypervisor. Use one of the
|
||||
<a href="html/libvirt-libvirt.html#virConnectOpen">virConnectOpen</a>
|
||||
functions to obtain connection to the hypervisor which is then used
|
||||
as a parameter to other connection API's.</p></li>
|
||||
<li><code class='docref'>virDomainPtr</code>
|
||||
<p>Represents one domain either active or defined (i.e. existing as
|
||||
permanent config file and storage but not currently running on that
|
||||
node). The function <code class='docref'>virConnectListAllDomains</code>
|
||||
lists all the domains for the hypervisor.</p></li>
|
||||
<li><code class='docref'>virNetworkPtr</code>
|
||||
<p>Represents one network either active or defined (i.e. existing
|
||||
as permanent config file and storage but not currently activated).
|
||||
The function <code class='docref'>virConnectListAllNetworks</code>
|
||||
lists all the virtualization networks for the hypervisor.</p></li>
|
||||
<li><code class='docref'>virStorageVolPtr</code>
|
||||
<p>Represents one storage volume generally used
|
||||
<li>virConnectPtr: represent a connection to an hypervisor.</li>
|
||||
<li>virDomainPtr: represent one domain either active or defined (i.e.
|
||||
existing as permanent config file and storage but not currently running
|
||||
on that node). The function <code class='docref'>virConnectListDomains</code>
|
||||
allows to list all the IDs for the domains active on this hypervisor.</li>
|
||||
<li>virNetworkPtr: represent one network either active or defined (i.e.
|
||||
existing as permanent config file and storage but not currently activated.
|
||||
The function <code class='docref'>virConnectListNetworks</code>
|
||||
allows to list all the virtualization networks activated on this node.</li>
|
||||
<li>virStorageVolPtr: represent one storage volume, usually this is used
|
||||
as a block device available to one of the domains. The function
|
||||
<code class="docref">virStorageVolLookupByPath</code> finds
|
||||
the storage volume object based on its path on the node.</p></li>
|
||||
<li><code class='docref'>virStoragePoolPtr</code>
|
||||
<p>Represents a storage pool, which is a logical area
|
||||
used to allocate and store storage volumes. The function
|
||||
<code class='docref'>virConnectListAllStoragePools</code> lists
|
||||
all of the virtualization storage pools on the hypervisor. The function
|
||||
<code class="docref">virStoragePoolLookupByVolume</code> finds
|
||||
the storage pool containing a given storage volume.</p></li>
|
||||
<code class="docref">virStorageVolLookupByPath</code> allows to find
|
||||
the object based on its path on the node.</li>
|
||||
<li>virStoragePoolPtr: represent a storage pool, i.e. a logical area
|
||||
which can be used to allocate and store storage volumes. The function
|
||||
<code class="docref">virStoragePoolLookupByVolume</code> allows to find
|
||||
the storage pool containing a given storage volume.</li>
|
||||
</ul>
|
||||
<p> Most objects manipulated by the library can also be represented using
|
||||
<p> Most object manipulated by the library can also be represented using
|
||||
XML descriptions. This is used primarily to create those object, but is
|
||||
also helpful to modify or save their description back.</p>
|
||||
<p> Domains, networks, and storage pools can be either <code>active</code>
|
||||
<p> Domains, network and storage pools can be either <code>active</code>
|
||||
i.e. either running or available for immediate use, or
|
||||
<code>defined</code> in which case they are inactive but there is
|
||||
a permanent definition available in the system for them. Based on this
|
||||
they can be activated dynamically in order to be used.</p>
|
||||
<p> Most objects can also be named in various ways:</p>
|
||||
thay can be activated dynamically in order to be used.</p>
|
||||
<p> Most kind of object can also be named in various ways:</p>
|
||||
<ul>
|
||||
<li><code>name</code>
|
||||
<p>A user friendly identifier but whose uniqueness
|
||||
cannot be guaranteed between two nodes.</p></li>
|
||||
<li><code>ID</code>
|
||||
<p>A runtime unique identifier
|
||||
provided by the hypervisor for one given activation of the object;
|
||||
however, it becomes invalid once the resource is deactivated.</p></li >
|
||||
<li><code>UUID</code>
|
||||
<p> A 16 byte unique identifier
|
||||
<li>by their <code>name</code>, an user friendly identifier but
|
||||
whose unicity cannot be guaranteed between two nodes.</li>
|
||||
<li>by their <code>ID</code>, which is a runtime unique identifier
|
||||
provided by the hypervisor for one given activation of the object,
|
||||
but it becomes invalid once the resource is deactivated.</li >
|
||||
<li>by their <code>UUID</code>, a 16 bytes unique identifier
|
||||
as defined in <a href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122</a>,
|
||||
which is guaranteed to be unique for long term usage and across a
|
||||
set of nodes.</p></li>
|
||||
set of nodes.</li>
|
||||
</ul>
|
||||
|
||||
<h2><a name="Functions">Functions and Naming Conventions</a></h2>
|
||||
<h2><a name="Functions">Functions and naming
|
||||
conventions</a></h2>
|
||||
<p> The naming of the functions present in the library is usually
|
||||
composed by a prefix describing the object associated to the function
|
||||
made of a prefix describing the object associated to the function
|
||||
and a verb describing the action on that object.</p>
|
||||
<p> For each first class object you will find APIs
|
||||
<p> For each first class object you will find apis
|
||||
for the following actions:</p>
|
||||
<ul>
|
||||
<li><b>Lookup</b> [...LookupBy...]
|
||||
<p>Used to perform lookups on objects by some type of identifier,
|
||||
such as:</p>
|
||||
<ul>
|
||||
<li><code class='docref'>virDomainLookupByID</code></li>
|
||||
<li><code class='docref'>virDomainLookupByName</code></li>
|
||||
<li><code class='docref'>virDomainLookupByUUID</code></li>
|
||||
<li><code class='docref'>virDomainLookupByUUIDString</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>Enumeration</b> [virConnectList..., virConnectNumOf...]
|
||||
<p>Used to enumerate a set of object available to an given
|
||||
hypervisor connection such as:</p>
|
||||
<ul>
|
||||
<li><code class='docref'>virConnectListDomains</code></li>
|
||||
<li><code class='docref'>virConnectNumOfDomains</code></li>
|
||||
<li><code class='docref'>virConnectListNetworks</code></li>
|
||||
<li><code class='docref'>virConnectListStoragePools</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>Description</b> [...GetInfo]
|
||||
<p>Generic accessor providing a set of generic information about an
|
||||
object, such as: </p>
|
||||
<ul>
|
||||
<li><code class='docref'>virNodeGetInfo</code></li>
|
||||
<li><code class='docref'>virDomainGetInfo</code></li>
|
||||
<li><code class='docref'>virStoragePoolGetInfo</code></li>
|
||||
<li><code class='docref'>virStorageVolGetInfo</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>Accessors</b> [...Get..., ...Set...]
|
||||
<p>Specific accessors used to query or modify data for the given object,
|
||||
such as: </p>
|
||||
<ul>
|
||||
<li><code class='docref'>virConnectGetType</code></li>
|
||||
<li><code class='docref'>virDomainGetMaxMemory</code></li>
|
||||
<li><code class='docref'>virDomainSetMemory</code></li>
|
||||
<li><code class='docref'>virDomainGetVcpus</code></li>
|
||||
<li><code class='docref'>virStoragePoolSetAutostart</code></li>
|
||||
<li><code class='docref'>virNetworkGetBridgeName</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>Creation</b> [...Create, ...CreateXML]
|
||||
<p>Used to create and start objects. The ...CreateXML APIs will create
|
||||
the object based on an XML description, while the ...Create APIs will
|
||||
create the object based on existing object pointer, such as: </p>
|
||||
<ul>
|
||||
<li><code class='docref'>virDomainCreate</code></li>
|
||||
<li><code class='docref'>virDomainCreateXML</code></li>
|
||||
<li><code class='docref'>virNetworkCreate</code></li>
|
||||
<li><code class='docref'>virNetworkCreateXML</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>Destruction</b> [...Destroy]
|
||||
<p>Used to shutdown or deactivate and destroy objects, such as: </p>
|
||||
<ul>
|
||||
<li><code class='docref'>virDomainDestroy</code></li>
|
||||
<li><code class='docref'>virNetworkDestroy</code></li>
|
||||
<li><code class='docref'>virStoragePoolDestroy</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>Lookup</b>:...LookupByName,</li>
|
||||
<li><b>Enumeration</b>:virConnectList... and virConnectNumOf...:
|
||||
those are used to enumerate a set of object available to an given
|
||||
hypervisor connection like:
|
||||
<code class='docref'>virConnectListDomains</code>,
|
||||
<code class='docref'>virConnectNumOfDomains</code>,
|
||||
<code class='docref'>virConnectListNetworks</code>,
|
||||
<code class='docref'>virConnectListStoragePools</code>, etc.</li>
|
||||
<li><b>Description</b>: ...GetInfo: those are generic accessor providing
|
||||
a set of informations about an object, they are
|
||||
<code class='docref'>virNodeGetInfo</code>,
|
||||
<code class='docref'>virDomainGetInfo</code>,
|
||||
<code class='docref'>virStoragePoolGetInfo</code>,
|
||||
<code class='docref'>virStorageVolGetInfo</code>.</li>
|
||||
<li><b>Accessors</b>: ...Get... and ...Set...: those are more specific
|
||||
accessors to query or modify the given object, like
|
||||
<code class='docref'>virConnectGetType</code>,
|
||||
<code class='docref'>virDomainGetMaxMemory</code>,
|
||||
<code class='docref'>virDomainSetMemory</code>,
|
||||
<code class='docref'>virDomainGetVcpus</code>,
|
||||
<code class='docref'>virStoragePoolSetAutostart</code>,
|
||||
<code class='docref'>virNetworkGetBridgeName</code>, etc.</li>
|
||||
<li><b>Creation</b>: </li>
|
||||
<li><b>Destruction</b>: ... </li>
|
||||
</ul>
|
||||
<p> For more in-depth details of the storage related APIs see
|
||||
<a href="storage.html">the storage management page</a>.
|
||||
</p>
|
||||
<h2><a name="Drivers">The libvirt Drivers</a></h2>
|
||||
<p>Drivers are the basic building block for libvirt functionality
|
||||
to support the capability to handle specific hypervisor driver calls.
|
||||
Drivers are discovered and registered during connection processing as
|
||||
part of the <code class='docref'>virInitialize</code> API. Each driver
|
||||
has a registration API which loads up the driver specific function
|
||||
references for the libvirt APIs to call. The following is a simplistic
|
||||
view of the hypervisor driver mechanism. Consider the stacked list of
|
||||
drivers as a series of modules that can be plugged into the architecture
|
||||
depending on how libvirt is configured to be built.</p>
|
||||
<h2><a name="Driver">The libvirt drivers</a></h2>
|
||||
<p></p>
|
||||
<p class="image">
|
||||
<img alt="The libvirt driver architecture"
|
||||
src="libvirt-driver-arch.png"/>
|
||||
</p>
|
||||
<p>The driver architecture is also used to support other virtualization
|
||||
components such as storage, storage pools, host device, networking,
|
||||
network interfaces, and network filters.</p>
|
||||
<p>See the <a href="drivers.html">libvirt drivers</a> page for more
|
||||
information on hypervisor and storage specific drivers.</p>
|
||||
<p>Not all drivers support every virtualization function possible.
|
||||
The <a href="hvsupport.html">libvirt API support matrix</a> lists
|
||||
the various functions and support found in each driver by the version
|
||||
support was added into libvirt.
|
||||
</p>
|
||||
<h2><a name="Remote">Daemon and Remote Access</a></h2>
|
||||
<p>Access to libvirt drivers is primarily handled by the libvirtd
|
||||
daemon through the <a href="remote.html">remote</a> driver via an
|
||||
<a href="internals/rpc.html">RPC</a>. Some hypervisors do support
|
||||
client-side connections and responses, such as Test, OpenVZ, VMware,
|
||||
Power VM (phyp), VirtualBox (vbox), ESX, Hyper-V, Xen, and Parallels.
|
||||
The libvirtd daemon service is started on the host at system boot
|
||||
time and can also be restarted at any time by a properly privileged
|
||||
user, such as root. The libvirtd daemon uses the same libvirt API
|
||||
<code class='docref'>virInitialize</code> sequence as applications
|
||||
for client-side driver registrations, but then extends the registered
|
||||
driver list to encompass all known drivers supported for all driver
|
||||
types supported on the host. </p>
|
||||
<p>The libvirt client <a href="apps.html">applications</a> use a
|
||||
<a href="uri.html">URI</a> to obtain the <code>virConnectPtr</code>.
|
||||
The <code>virConnectPtr</code> keeps track of the driver connection
|
||||
plus a variety of other connections (network, interface, storage, etc.).
|
||||
The <code>virConnectPtr</code> is then used as a parameter to other
|
||||
virtualization <a href="#Functions">functions</a>. Depending upon the
|
||||
driver being used, calls will be routed through the remote driver to
|
||||
the libvirtd daemon. The daemon will reference the connection specific
|
||||
driver in order to retreive the requested information and then pass
|
||||
back status and/or data through the connection back to the application.
|
||||
The application can then decide what to do with that data, such as
|
||||
display, write log data, etc. <a href="migration.html">Migration</a>
|
||||
is an example of many facets of the architecture in use.</p>
|
||||
|
||||
<h2><a name="Remote">Daemon and remote access</a></h2>
|
||||
<p></p>
|
||||
<p class="image">
|
||||
<img alt="The libvirt daemon and remote architecture"
|
||||
src="libvirt-daemon-arch.png"/>
|
||||
</p>
|
||||
<p>
|
||||
The key takeaway from the above diagram is that there is a remote driver
|
||||
which handles transactions for a majority of the drivers. The libvirtd
|
||||
daemon running on the host will receive transaction requests from the
|
||||
remote driver and will then query the hypervisor driver as specified in
|
||||
the <code>virConnectPtr</code> in order to fetch the data. The data will
|
||||
then be returned through the remote driver to the client application
|
||||
for processing.
|
||||
</p>
|
||||
<p>If you are interested in contributing to libvirt, read the
|
||||
<a href="http://wiki.libvirt.org/page/FAQ">FAQ</a> and
|
||||
<a href="hacking.html">hacking</a> guidelines to gain an understanding
|
||||
of basic rules and guidelines. In order to add new API functionality
|
||||
follow the instructions regarding
|
||||
<a href="api_extension.html">implementing a new API in libvirt</a>.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Implementing a new API in Libvirt</h1>
|
||||
|
||||
|
392
docs/apibuild.py
392
docs/apibuild.py
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Applications using <strong>libvirt</strong></h1>
|
||||
|
||||
@ -204,13 +202,6 @@
|
||||
<h2><a name="iaas">Infrastructure as a Service (IaaS)</a></h2>
|
||||
|
||||
<dl>
|
||||
<dt><a href="http://cc1.ifj.edu.pl">Cracow Cloud One</a></dt>
|
||||
<dd>The CC1 system provides a complete solution for Private
|
||||
Cloud Computing. An intuitive web access interface with an
|
||||
administration module and simple installation procedure make
|
||||
it easy to benefit from private Cloud Computing technology.
|
||||
</dd>
|
||||
|
||||
<dt><a href="http://www.emotivecloud.net">EMOTIVE Cloud</a></dt>
|
||||
<dd>The EMOTIVE (Elastic Management Of Tasks In Virtualized
|
||||
Environments) middleware allows executing tasks and providing
|
||||
@ -349,7 +340,6 @@
|
||||
<li>Shows you Systems Inventory (based on Facter) and
|
||||
provides real time information about hosts status based on
|
||||
Puppet reports.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Domain management architecture</h1>
|
||||
</body>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1 >libvirt architecture</h1>
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Network management architecture</h1>
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Node device management architecture</h1>
|
||||
</body>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Storage management architecture</h1>
|
||||
|
||||
|
@ -1,15 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Connection authentication</h1>
|
||||
<h1 >Authentication & access control</h1>
|
||||
<p>
|
||||
When connecting to libvirt, some connections may require client
|
||||
authentication before allowing use of the APIs. The set of possible
|
||||
authentication mechanisms is administrator controlled, independent
|
||||
of applications using libvirt. Once authenticated, libvirt can apply
|
||||
fine grained <a href="acl.html">access control</a> to the operations
|
||||
performed by a client.
|
||||
of applications using libvirt.
|
||||
</p>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
@ -256,15 +253,13 @@ Plugin "gssapiv2" [loaded], API version: 4
|
||||
features: WANT_CLIENT_FIRST|PROXY_AUTHENTICATION|NEED_SERVER_FQDN
|
||||
</pre>
|
||||
<p>
|
||||
Next it is necessary for the administrator of the Kerberos realm to
|
||||
issue a principal for the libvirt server. There needs to be one
|
||||
principal per host running the libvirt daemon. The principal should be
|
||||
named <code>libvirt/full.hostname@KERBEROS.REALM</code>. This is
|
||||
typically done by running the <code>kadmin.local</code> command on the
|
||||
Kerberos server, though some Kerberos servers have alternate ways of
|
||||
setting up service principals. Once created, the principal should be
|
||||
exported to a keytab, copied to the host running the libvirt daemon
|
||||
and placed in <code>/etc/libvirt/krb5.tab</code>
|
||||
Next it is necessary for the administrator of the Kerberos realm to issue a principle
|
||||
for the libvirt server. There needs to be one principle per host running the libvirt
|
||||
daemon. The principle should be named <code>libvirt/full.hostname@KERBEROS.REALM</code>.
|
||||
This is typically done by running the <code>kadmin.local</code> command on the Kerberos
|
||||
server, though some Kerberos servers have alternate ways of setting up service principles.
|
||||
Once created, the principle should be exported to a keytab, copied to the host running
|
||||
the libvirt daemon and placed in <code>/etc/libvirt/krb5.tab</code>
|
||||
</p>
|
||||
<pre>
|
||||
# kadmin.local
|
||||
@ -286,7 +281,7 @@ kadmin.local: quit
|
||||
</pre>
|
||||
<p>
|
||||
Any client application wishing to connect to a Kerberos enabled libvirt server
|
||||
merely needs to run <code>kinit</code> to gain a user principal. This may well
|
||||
merely needs to run <code>kinit</code> to gain a user principle. This may well
|
||||
be done automatically when a user logs into a desktop session, if PAM is setup
|
||||
to authenticate against Kerberos.
|
||||
</p>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1 >Bindings for other languages</h1>
|
||||
|
||||
|
@ -1,24 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<h1>Bug reporting</h1>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<h2><a name="security">Security Issues</a></h2>
|
||||
|
||||
<p>
|
||||
If you think that an issue with libvirt may have security
|
||||
implications, <strong>please do not</strong> publically
|
||||
report it in the bug tracker, mailing lists, or irc. Libvirt
|
||||
has <a href="securityprocess.html">a dedicated process for handling (potential) security issues</a>
|
||||
that should be used instead. So if your issue has security
|
||||
implications, ignore the rest of this page and follow the
|
||||
<a href="securityprocess.html">security process</a> instead.
|
||||
</p>
|
||||
|
||||
<h2><a name="bugzilla">Bug Tracking</a></h2>
|
||||
|
||||
<p>
|
||||
|
@ -1,285 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>Control Groups Resource Management</h1>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<p>
|
||||
The QEMU and LXC drivers make use of the Linux "Control Groups" facility
|
||||
for applying resource management to their virtual machines and containers.
|
||||
</p>
|
||||
|
||||
<h2><a name="requiredControllers">Required controllers</a></h2>
|
||||
|
||||
<p>
|
||||
The control groups filesystem supports multiple "controllers". By default
|
||||
the init system (such as systemd) should mount all controllers compiled
|
||||
into the kernel at <code>/sys/fs/cgroup/$CONTROLLER-NAME</code>. Libvirt
|
||||
will never attempt to mount any controllers itself, merely detect where
|
||||
they are mounted.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The QEMU driver is capable of using the <code>cpuset</code>,
|
||||
<code>cpu</code>, <code>memory</code>, <code>blkio</code> and
|
||||
<code>devices</code> controllers. None of them are compulsory.
|
||||
If any controller is not mounted, the resource management APIs
|
||||
which use it will cease to operate. It is possible to explicitly
|
||||
turn off use of a controller, even when mounted, via the
|
||||
<code>/etc/libvirt/qemu.conf</code> configuration file.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The LXC driver is capable of using the <code>cpuset</code>,
|
||||
<code>cpu</code>, <code>cpuset</code>, <code>freezer</code>,
|
||||
<code>memory</code>, <code>blkio</code> and <code>devices</code>
|
||||
controllers. The <code>cpuset</code>, <code>devices</code>
|
||||
and <code>memory</code> controllers are compulsory. Without
|
||||
them mounted, no containers can be started. If any of the
|
||||
other controllers are not mounted, the resource management APIs
|
||||
which use them will cease to operate.
|
||||
</p>
|
||||
|
||||
<h2><a name="currentLayout">Current cgroups layout</a></h2>
|
||||
|
||||
<p>
|
||||
As of libvirt 1.0.5 or later, the cgroups layout created by libvirt has been
|
||||
simplified, in order to facilitate the setup of resource control policies by
|
||||
administrators / management applications. The layout is based on the concepts of
|
||||
"partitions" and "consumers". Each virtual machine or container is a consumer,
|
||||
and has a corresponding cgroup named <code>$VMNAME.libvirt-{qemu,lxc}</code>.
|
||||
Each consumer is associated with exactly one partition, which also have a
|
||||
corresponding cgroup usually named <code>$PARTNAME.partition</code>. The
|
||||
exceptions to this naming rule are the three top level default partitions,
|
||||
named <code>/system</code> (for system services), <code>/user</code> (for
|
||||
user login sessions) and <code>/machine</code> (for virtual machines and
|
||||
containers). By default every consumer will of course be associated with
|
||||
the <code>/machine</code> partition. This leads to a hierarchy that looks
|
||||
like
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ROOT
|
||||
|
|
||||
+- system
|
||||
| |
|
||||
| +- libvirtd.service
|
||||
|
|
||||
+- machine
|
||||
|
|
||||
+- vm1.libvirt-qemu
|
||||
| |
|
||||
| +- emulator
|
||||
| +- vcpu0
|
||||
| +- vcpu1
|
||||
|
|
||||
+- vm2.libvirt-qemu
|
||||
| |
|
||||
| +- emulator
|
||||
| +- vcpu0
|
||||
| +- vcpu1
|
||||
|
|
||||
+- vm3.libvirt-qemu
|
||||
| |
|
||||
| +- emulator
|
||||
| +- vcpu0
|
||||
| +- vcpu1
|
||||
|
|
||||
+- container1.libvirt-lxc
|
||||
|
|
||||
+- container2.libvirt-lxc
|
||||
|
|
||||
+- container3.libvirt-lxc
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The default cgroups layout ensures that, when there is contention for
|
||||
CPU time, it is shared equally between system services, user sessions
|
||||
and virtual machines / containers. This prevents virtual machines from
|
||||
locking the administrator out of the host, or impacting execution of
|
||||
system services. Conversely, when there is no contention from
|
||||
system services / user sessions, it is possible for virtual machines
|
||||
to fully utilize the host CPUs.
|
||||
</p>
|
||||
|
||||
<h2><a name="customPartiton">Using custom partitions</a></h2>
|
||||
|
||||
<p>
|
||||
If there is a need to apply resource constraints to groups of
|
||||
virtual machines or containers, then the single default
|
||||
partition <code>/machine</code> may not be sufficiently
|
||||
flexible. The administrator may wish to sub-divide the
|
||||
default partition, for example into "testing" and "production"
|
||||
partitions, and then assign each guest to a specific
|
||||
sub-partition. This is achieved via a small element addition
|
||||
to the guest domain XML config, just below the main <code>domain</code>
|
||||
element
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<resource>
|
||||
<partition>/machine/production</partition>
|
||||
</resource>
|
||||
...
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Libvirt will not auto-create the cgroups directory to back
|
||||
this partition. In the future, libvirt / virsh will provide
|
||||
APIs / commands to create custom partitions, but currently
|
||||
this is left as an exercise for the administrator. For
|
||||
example, given the XML config above, the admin would need
|
||||
to create a cgroup named '/machine/production.partition'
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# cd /sys/fs/cgroup
|
||||
# for i in blkio cpu,cpuacct cpuset devices freezer memory net_cls perf_event
|
||||
do
|
||||
mkdir $i/machine/production.partition
|
||||
done
|
||||
# for i in cpuset.cpus cpuset.mems
|
||||
do
|
||||
cat cpuset/machine/$i > cpuset/machine/production.partition/$i
|
||||
done
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<strong>Note:</strong> the cgroups directory created as a ".partition"
|
||||
suffix, but the XML config does not require this suffix.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Note:</strong> the ability to place guests in custom
|
||||
partitions is only available with libvirt >= 1.0.5, using
|
||||
the new cgroup layout. The legacy cgroups layout described
|
||||
later did not support customization per guest.
|
||||
</p>
|
||||
|
||||
<h2><a name="resourceAPIs">Resource management APIs/commands</a></h2>
|
||||
|
||||
<p>
|
||||
Since libvirt aims to provide an API which is portable across
|
||||
hypervisors, the concept of cgroups is not exposed directly
|
||||
in the API or XML configuration. It is considered to be an
|
||||
internal implementation detail. Instead libvirt provides a
|
||||
set of APIs for applying resource controls, which are then
|
||||
mapped to corresponding cgroup tunables
|
||||
</p>
|
||||
|
||||
<h3>Scheduler tuning</h3>
|
||||
|
||||
<p>
|
||||
Parameters from the "cpu" controller are exposed via the
|
||||
<code>schedinfo</code> command in virsh.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# virsh schedinfo demo
|
||||
Scheduler : posix
|
||||
cpu_shares : 1024
|
||||
vcpu_period : 100000
|
||||
vcpu_quota : -1
|
||||
emulator_period: 100000
|
||||
emulator_quota : -1</pre>
|
||||
|
||||
|
||||
<h3>Block I/O tuning</h3>
|
||||
|
||||
<p>
|
||||
Parameters from the "blkio" controller are exposed via the
|
||||
<code>bkliotune</code> command in virsh.
|
||||
</p>
|
||||
|
||||
|
||||
<pre>
|
||||
# virsh blkiotune demo
|
||||
weight : 500
|
||||
device_weight : </pre>
|
||||
|
||||
<h3>Memory tuning</h3>
|
||||
|
||||
<p>
|
||||
Parameters from the "memory" controller are exposed via the
|
||||
<code>memtune</code> command in virsh.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# virsh memtune demo
|
||||
hard_limit : 580192
|
||||
soft_limit : unlimited
|
||||
swap_hard_limit: unlimited
|
||||
</pre>
|
||||
|
||||
<h3>Network tuning</h3>
|
||||
|
||||
<p>
|
||||
The <code>net_cls</code> is not currently used. Instead traffic
|
||||
filter policies are set directly against individual virtual
|
||||
network interfaces.
|
||||
</p>
|
||||
|
||||
<h2><a name="legacyLayout">Legacy cgroups layout</a></h2>
|
||||
|
||||
<p>
|
||||
Prior to libvirt 1.0.5, the cgroups layout created by libvirt was different
|
||||
from that described above, and did not allow for administrator customization.
|
||||
Libvirt used a fixed, 3-level hierarchy <code>libvirt/{qemu,lxc}/$VMNAME</code>
|
||||
which was rooted at the point in the hierarchy where libvirtd itself was
|
||||
located. So if libvirtd was placed at <code>/system/libvirtd.service</code>
|
||||
by systemd, the groups for each virtual machine / container would be located
|
||||
at <code>/system/libvirtd.service/libvirt/{qemu,lxc}/$VMNAME</code>. In addition
|
||||
to this, the QEMU drivers further child groups for each vCPU thread and the
|
||||
emulator thread(s). This leads to a hierarchy that looked like
|
||||
</p>
|
||||
|
||||
|
||||
<pre>
|
||||
$ROOT
|
||||
|
|
||||
+- system
|
||||
|
|
||||
+- libvirtd.service
|
||||
|
|
||||
+- libvirt
|
||||
|
|
||||
+- qemu
|
||||
| |
|
||||
| +- vm1
|
||||
| | |
|
||||
| | +- emulator
|
||||
| | +- vcpu0
|
||||
| | +- vcpu1
|
||||
| |
|
||||
| +- vm2
|
||||
| | |
|
||||
| | +- emulator
|
||||
| | +- vcpu0
|
||||
| | +- vcpu1
|
||||
| |
|
||||
| +- vm3
|
||||
| |
|
||||
| +- emulator
|
||||
| +- vcpu0
|
||||
| +- vcpu1
|
||||
|
|
||||
+- lxc
|
||||
|
|
||||
+- container1
|
||||
|
|
||||
+- container2
|
||||
|
|
||||
+- container3
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Although current releases are much improved, historically the use of deep
|
||||
hierarchies has had a significant negative impact on the kernel scalability.
|
||||
The legacy libvirt cgroups layout highlighted these problems, to the detriment
|
||||
of the performance of virtual machines and containers.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1><a name="installation">libvirt Installation</a></h1>
|
||||
|
||||
@ -65,36 +64,8 @@
|
||||
checkout it is necessary to generate the configure script and Makefile.in
|
||||
templates using the <code>autogen.sh</code> command. By default when
|
||||
the <code>configure</code> script is run from within a GIT checkout, it
|
||||
will turn on -Werror for builds. This can be disabled with
|
||||
--disable-werror, but this is not recommended.
|
||||
</p>
|
||||
<p>
|
||||
Libvirt takes advantage of
|
||||
the <a href="http://www.gnu.org/software/gnulib/">gnulib</a>
|
||||
project to provide portability to a number of platforms. This
|
||||
is normally done dynamically via a git submodule in
|
||||
the <code>.gnulib</code> subdirectory, which is auto-updated as
|
||||
needed when you do incremental builds. Setting the environment
|
||||
variable <code>GNULIB_SRCDIR</code> to a local directory
|
||||
containing a git checkout of gnulib will let you reduce local
|
||||
disk space requirements and network download time, regardless of
|
||||
which actual commit you have in that reference directory.
|
||||
</p>
|
||||
<p>
|
||||
However, if you are developing on a platform where git is not
|
||||
available, or are behind a firewall that does not allow for git
|
||||
to easily obtain the gnulib submodule, it is possible to instead
|
||||
use a static mode of operation where you are then responsible
|
||||
for updating the git submodule yourself. In this mode, you must
|
||||
track the exact gnulib commit needed by libvirt (usually not the
|
||||
latest gnulib.git) via alternative means, such as a shared NFS
|
||||
drive or manual download, and run this any time libvirt.git
|
||||
updates the commit stored in the .gnulib submodule:</p>
|
||||
<pre>
|
||||
$ GNULIB_SRCDIR=/path/to/gnulib ./autogen.sh --no-git
|
||||
</pre>
|
||||
|
||||
<p>To build & install libvirt to your home
|
||||
will turn on -Werror for builds. This can be disabled with --disable-werror,
|
||||
but this is not recommended. To build & install libvirt to your home
|
||||
directory the following commands can be run:
|
||||
</p>
|
||||
|
||||
|
@ -1,23 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Contacting the development team</h1>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<h2><a name="security">Security Issues</a></h2>
|
||||
|
||||
<p>
|
||||
If you think that an issue with libvirt may have security
|
||||
implications, <strong>please do not</strong> publically
|
||||
report it in the bug tracker, mailing lists, or irc. Libvirt
|
||||
has <a href="securityprocess.html">a dedicated process for handling (potential) security issues</a>
|
||||
that should be used instead. So if your issue has security
|
||||
implications, ignore the rest of this page and follow the
|
||||
<a href="securityprocess.html">security process</a> instead.
|
||||
</p>
|
||||
|
||||
<h2><a name="email">Mailing lists</a></h2>
|
||||
|
||||
<p>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>C# API bindings</h1>
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Deployment</h1>
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>libvirt Application Development Guide</h1>
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Documentation</h1>
|
||||
</body>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Downloads</h1>
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Internal drivers</h1>
|
||||
|
||||
@ -32,7 +30,6 @@
|
||||
<li><strong><a href="drvxen.html">Xen</a></strong></li>
|
||||
<li><strong><a href="drvhyperv.html">Microsoft Hyper-V</a></strong></li>
|
||||
<li><strong><a href="drvphyp.html">IBM PowerVM (phyp)</a></strong></li>
|
||||
<li><strong><a href="drvparallels.html">Parallels</a></strong></li>
|
||||
</ul>
|
||||
|
||||
<h2><a name="storage">Storage drivers</a></h2>
|
||||
|
@ -1,7 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<html><body>
|
||||
<h1>VMware ESX hypervisor driver</h1>
|
||||
<ul id="toc"></ul>
|
||||
<p>
|
||||
|
@ -1,7 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<html><body>
|
||||
<h1>Microsoft Hyper-V hypervisor driver</h1>
|
||||
<ul id="toc"></ul>
|
||||
<p>
|
||||
|
@ -1,102 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>LXC container driver</h1>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<p>
|
||||
The libvirt LXC driver manages "Linux Containers". At their simplest, containers
|
||||
can just be thought of as a collection of processes, separated from the main
|
||||
host processes via a set of resource namespaces and constrained via control
|
||||
groups resource tunables. The libvirt LXC driver has no dependency on the LXC
|
||||
userspace tools hosted on sourceforge.net. It directly utilizes the relevant
|
||||
kernel features to build the container environment. This allows for sharing
|
||||
of many libvirt technologies across both the QEMU/KVM and LXC drivers. In
|
||||
particular sVirt for mandatory access control, auditing of operations,
|
||||
integration with control groups and many other features.
|
||||
The libvirt LXC driver manages "Linux Containers". Containers are sets of processes
|
||||
with private namespaces which can (but don't always) look like separate machines, but
|
||||
do not have their own OS. Here are two example configurations. The first is a very
|
||||
light-weight "application container" which does not have its own root image.
|
||||
</p>
|
||||
|
||||
<h2><a name="cgroups">Control groups Requirements</a></h2>
|
||||
<h2><a name="project">Project Links</a></h2>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
The <a href="http://lxc.sourceforge.net/">LXC</a> Linux
|
||||
container system
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2>Cgroups Requirements</h2>
|
||||
|
||||
<p>
|
||||
In order to control the resource usage of processes inside containers, the
|
||||
libvirt LXC driver requires that certain cgroups controllers are mounted on
|
||||
the host OS. The minimum required controllers are 'cpuacct', 'memory' and
|
||||
'devices', while recommended extra controllers are 'cpu', 'freezer' and
|
||||
'blkio'. Libvirt will not mount the cgroups filesystem itself, leaving
|
||||
this up to the init system to take care of. Systemd will do the right thing
|
||||
in this respect, while for other init systems the <code>cgconfig</code>
|
||||
init service will be required. For further information, consult the general
|
||||
libvirt <a href="cgroups.html">cgroups documentation</a>.
|
||||
</p>
|
||||
|
||||
<h2><a name="namespaces">Namespace requirements</a></h2>
|
||||
|
||||
<p>
|
||||
In order to separate processes inside a container from those in the
|
||||
primary "host" OS environment, the libvirt LXC driver requires that
|
||||
certain kernel namespaces are compiled in. Libvirt currently requires
|
||||
the 'mount', 'ipc', 'pid', and 'uts' namespaces to be available. If
|
||||
separate network interfaces are desired, then the 'net' namespace is
|
||||
required. In the near future, the 'user' namespace will optionally be
|
||||
supported.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>NOTE: In the absence of support for the 'user' namespace,
|
||||
processes inside containers cannot be securely isolated from host
|
||||
process without the use of a mandatory access control technology
|
||||
such as SELinux or AppArmor.</strong>
|
||||
</p>
|
||||
|
||||
<h2><a name="init">Default container setup</a></h2>
|
||||
|
||||
<h3><a name="cliargs">Command line arguments</a></h3>
|
||||
|
||||
<p>
|
||||
When the container "init" process is started, it will typically
|
||||
not be given any command line arguments (eg the equivalent of
|
||||
the bootloader args visible in <code>/proc/cmdline</code>). If
|
||||
any arguments are desired, then must be explicitly set in the
|
||||
container XML configuration via one or more <code>initarg</code>
|
||||
elements. For example, to run <code>systemd --unit emergency.service</code>
|
||||
would use the following XML
|
||||
The libvirt LXC driver requires that certain cgroups controllers are
|
||||
mounted on the host OS. The minimum required controllers are 'cpuacct',
|
||||
'memory' and 'devices', while recommended extra controllers are
|
||||
'cpu', 'freezer' and 'blkio'. The /etc/cgconfig.conf & cgconfig
|
||||
init service used to mount cgroups at host boot time. To manually
|
||||
mount them use:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<os>
|
||||
<type arch='x86_64'>exe</type>
|
||||
<init>/bin/systemd</init>
|
||||
<initarg>--unit</initarg>
|
||||
<initarg>emergency.service</initarg>
|
||||
</os>
|
||||
# mount -t cgroup cgroup /dev/cgroup -o cpuacct,memory,devices,cpu,freezer,blkio
|
||||
</pre>
|
||||
|
||||
<h3><a name="envvars">Environment variables</a></h3>
|
||||
<p>
|
||||
NB, the blkio controller in some kernels will not allow creation of nested
|
||||
sub-directories which will prevent correct operation of the libvirt LXC
|
||||
driver. On such kernels, it may be necessary to unmount the blkio controller.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>Environment setup for the container init</h2>
|
||||
|
||||
<p>
|
||||
When the container "init" process is started, it will be given several useful
|
||||
environment variables. The following standard environment variables are mandated
|
||||
by <a href="http://www.freedesktop.org/wiki/Software/systemd/ContainerInterface">systemd container interface</a>
|
||||
to be provided by all container technologies on Linux.
|
||||
</p>
|
||||
|
||||
<dl>
|
||||
<dt>container</dt>
|
||||
<dd>The fixed string <code>libvirt-lxc</code> to identify libvirt as the creator</dd>
|
||||
<dt>container_uuid</dt>
|
||||
<dd>The UUID assigned to the container by libvirt</dd>
|
||||
<dt>PATH</dt>
|
||||
<dd>The fixed string <code>/bin:/usr/bin</code></dd>
|
||||
<dt>TERM</dt>
|
||||
<dd>The fixed string <code>linux</code></dd>
|
||||
</dl>
|
||||
|
||||
<p>
|
||||
In addition to the standard variables, the following libvirt specific
|
||||
environment variables are also provided
|
||||
environment variables.
|
||||
</p>
|
||||
|
||||
<dl>
|
||||
@ -105,270 +52,9 @@ environment variables are also provided
|
||||
<dt>LIBVIRT_LXC_UUID</dt>
|
||||
<dd>The UUID assigned to the container by libvirt</dd>
|
||||
<dt>LIBVIRT_LXC_CMDLINE</dt>
|
||||
<dd>The unparsed command line arguments specified in the container configuration.
|
||||
Use of this is discouraged, in favour of passing arguments directly to the
|
||||
container init process via the <code>initarg</code> config element.</dd>
|
||||
<dd>The unparsed command line arguments specified in the container configuration</dd>
|
||||
</dl>
|
||||
|
||||
<h3><a name="fsmounts">Filesystem mounts</a></h3>
|
||||
|
||||
<p>
|
||||
In the absence of any explicit configuration, the container will
|
||||
inherit the host OS filesystem mounts. A number of mount points will
|
||||
be made read only, or re-mounted with new instances to provide
|
||||
container specific data. The following special mounts are setup
|
||||
by libvirt
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li><code>/dev</code> a new "tmpfs" pre-populated with authorized device nodes</li>
|
||||
<li><code>/dev/pts</code> a new private "devpts" instance for console devices</li>
|
||||
<li><code>/sys</code> the host "sysfs" instance remounted read-only</li>
|
||||
<li><code>/proc</code> a new instance of the "proc" filesystem</li>
|
||||
<li><code>/proc/sys</code> the host "/proc/sys" bind-mounted read-only</li>
|
||||
<li><code>/sys/fs/selinux</code> the host "selinux" instance remounted read-only</li>
|
||||
<li><code>/sys/fs/cgroup/NNNN</code> the host cgroups controllers bind-mounted to
|
||||
only expose the sub-tree associated with the container</li>
|
||||
<li><code>/proc/meminfo</code> a FUSE backed file reflecting memory limits of the container</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3><a name="devnodes">Device nodes</a></h3>
|
||||
|
||||
<p>
|
||||
The container init process will be started with <code>CAP_MKNOD</code>
|
||||
capability removed and blocked from re-acquiring it. As such it will
|
||||
not be able to create any device nodes in <code>/dev</code> or anywhere
|
||||
else in its filesystems. Libvirt itself will take care of pre-populating
|
||||
the <code>/dev</code> filesystem with any devices that the container
|
||||
is authorized to use. The current devices that will be made available
|
||||
to all containers are
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li><code>/dev/zero</code></li>
|
||||
<li><code>/dev/null</code></li>
|
||||
<li><code>/dev/full</code></li>
|
||||
<li><code>/dev/random</code></li>
|
||||
<li><code>/dev/urandom</code></li>
|
||||
<li><code>/dev/stdin</code> symlinked to <code>/proc/self/fd/0</code></li>
|
||||
<li><code>/dev/stdout</code> symlinked to <code>/proc/self/fd/1</code></li>
|
||||
<li><code>/dev/stderr</code> symlinked to <code>/proc/self/fd/2</code></li>
|
||||
<li><code>/dev/fd</code> symlinked to <code>/proc/self/fd</code></li>
|
||||
<li><code>/dev/ptmx</code> symlinked to <code>/dev/pts/ptmx</code></li>
|
||||
<li><code>/dev/console</code> symlinked to <code>/dev/pts/0</code></li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
In addition, for every console defined in the guest configuration,
|
||||
a symlink will be created from <code>/dev/ttyN</code> symlinked to
|
||||
the corresponding <code>/dev/pts/M</code> pseudo TTY device. The
|
||||
first console will be <code>/dev/tty1</code>, with further consoles
|
||||
numbered incrementally from there.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Further block or character devices will be made available to containers
|
||||
depending on their configuration.
|
||||
</p>
|
||||
|
||||
<h2><a name="activation">Systemd Socket Activation Integration</a></h2>
|
||||
|
||||
<p>
|
||||
The libvirt LXC driver provides the ability to pass across pre-opened file
|
||||
descriptors when starting LXC guests. This allows for libvirt LXC to support
|
||||
systemd's <a href="http://0pointer.de/blog/projects/socket-activated-containers.html">socket
|
||||
activation capability</a>, where an incoming client connection
|
||||
in the host OS will trigger the startup of a container, which runs another
|
||||
copy of systemd which gets passed the server socket, and then activates the
|
||||
actual service handler in the container.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Let us assume that you already have a LXC guest created, running
|
||||
a systemd instance as PID 1 inside the container, which has an
|
||||
SSHD service configured. The goal is to automatically activate
|
||||
the container when the first SSH connection is made. The first
|
||||
step is to create a couple of unit files for the host OS systemd
|
||||
instance. The <code>/etc/systemd/system/mycontainer.service</code>
|
||||
unit file specifies how systemd will start the libvirt LXC container
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
[Unit]
|
||||
Description=My little container
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/virsh -c lxc:/// start --pass-fds 3 mycontainer
|
||||
ExecStop=/usr/bin/virsh -c lxc:/// destroy mycontainer
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
KillMode=none
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The <code>--pass-fds 3</code> argument specifies that the file
|
||||
descriptor number 3 that <code>virsh</code> inherits from systemd,
|
||||
is to be passed into the container. Since <code>virsh</code> will
|
||||
exit immediately after starting the container, the <code>RemainAfterExit</code>
|
||||
and <code>KillMode</code> settings must be altered from their defaults.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Next, the <code>/etc/systemd/system/mycontainer.socket</code> unit
|
||||
file is created to get the host systemd to listen on port 23 for
|
||||
TCP connections. When this unit file is activated by the first
|
||||
incoming connection, it will cause the <code>mycontainer.service</code>
|
||||
unit to be activated with the FD corresponding to the listening TCP
|
||||
socket passed in as FD 3.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
[Unit]
|
||||
Description=The SSH socket of my little container
|
||||
|
||||
[Socket]
|
||||
ListenStream=23
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Port 23 was picked here so that the container doesn't conflict
|
||||
with the host's SSH which is on the normal port 22. That's it
|
||||
in terms of host side configuration.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Inside the container, the <code>/etc/systemd/system/sshd.socket</code>
|
||||
unit file must be created
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
[Unit]
|
||||
Description=SSH Socket for Per-Connection Servers
|
||||
|
||||
[Socket]
|
||||
ListenStream=23
|
||||
Accept=yes
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The <code>ListenStream</code> value listed in this unit file, must
|
||||
match the value used in the host file. When systemd in the container
|
||||
receives the pre-opened FD from libvirt during container startup, it
|
||||
looks at the <code>ListenStream</code> values to figure out which
|
||||
FD to give to which service. The actual service to start is defined
|
||||
by a correspondingly named <code>/etc/systemd/system/sshd@.service</code>
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
[Unit]
|
||||
Description=SSH Per-Connection Server for %I
|
||||
|
||||
[Service]
|
||||
ExecStart=-/usr/sbin/sshd -i
|
||||
StandardInput=socket
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Finally, make sure this SSH service is set to start on boot of the container,
|
||||
by running the following command inside the container:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# mkdir -p /etc/systemd/system/sockets.target.wants/
|
||||
# ln -s /etc/systemd/system/sshd.socket /etc/systemd/system/sockets.target.wants/
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This example shows how to activate the container based on an incoming
|
||||
SSH connection. If the container was also configured to have an httpd
|
||||
service, it may be desirable to activate it upon either an httpd or a
|
||||
sshd connection attempt. In this case, the <code>mycontainer.socket</code>
|
||||
file in the host would simply list multiple socket ports. Inside the
|
||||
container a separate <code>xxxxx.socket</code> file would need to be
|
||||
created for each service, with a corresponding <code>ListenStream</code>
|
||||
value set.
|
||||
</p>
|
||||
|
||||
<!--
|
||||
<h2>Container configuration</h2>
|
||||
|
||||
<h3>Init process</h3>
|
||||
|
||||
<h3>Console devices</h3>
|
||||
|
||||
<h3>Filesystem devices</h3>
|
||||
|
||||
<h3>Disk devices</h3>
|
||||
|
||||
<h3>Block devices</h3>
|
||||
|
||||
<h3>USB devices</h3>
|
||||
|
||||
<h3>Character devices</h3>
|
||||
|
||||
<h3>Network devices</h3>
|
||||
-->
|
||||
|
||||
<h2>Container security</h2>
|
||||
|
||||
<h3>sVirt SELinux</h3>
|
||||
|
||||
<p>
|
||||
In the absence of the "user" namespace being used, containers cannot
|
||||
be considered secure against exploits of the host OS. The sVirt SELinux
|
||||
driver provides a way to secure containers even when the "user" namespace
|
||||
is not used. The cost is that writing a policy to allow execution of
|
||||
arbitrary OS is not practical. The SELinux sVirt policy is typically
|
||||
tailored to work with an simpler application confinement use case,
|
||||
as provided by the "libvirt-sandbox" project.
|
||||
</p>
|
||||
|
||||
<h3>Auditing</h3>
|
||||
|
||||
<p>
|
||||
The LXC driver is integrated with libvirt's auditing subsystem, which
|
||||
causes audit messages to be logged whenever there is an operation
|
||||
performed against a container which has impact on host resources.
|
||||
So for example, start/stop, device hotplug will all log audit messages
|
||||
providing details about what action occurred and any resources
|
||||
associated with it. There are the following 3 types of audit messages
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li><code>VIRT_MACHINE_ID</code> - details of the SELinux process and
|
||||
image security labels assigned to the container.</li>
|
||||
<li><code>VIRT_CONTROL</code> - details of an action / operation
|
||||
performed against a container. There are the following types of
|
||||
operation
|
||||
<ul>
|
||||
<li><code>op=start</code> - a container has been started. Provides
|
||||
the machine name, uuid and PID of the <code>libvirt_lxc</code>
|
||||
controller process</li>
|
||||
<li><code>op=init</code> - the init PID of the container has been
|
||||
started. Provides the machine name, uuid and PID of the
|
||||
<code>libvirt_lxc</code> controller process and PID of the
|
||||
init process (in the host PID namespace)</li>
|
||||
<li><code>op=stop</code> - a container has been stopped. Provides
|
||||
the machine name, uuid</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><code>VIRT_RESOURCE</code> - details of a host resource
|
||||
associated with a container action.</li>
|
||||
</ul>
|
||||
|
||||
<h3>Device access</h3>
|
||||
|
||||
<p>
|
||||
All containers are launched with the CAP_MKNOD capability cleared
|
||||
and removed from the bounding set. Libvirt will ensure that the
|
||||
/dev filesystem is pre-populated with all devices that a container
|
||||
is allowed to use. In addition, the cgroup "device" controller is
|
||||
configured to block read/write/mknod from all devices except those
|
||||
that a container is authorized to use.
|
||||
</p>
|
||||
|
||||
<h2><a name="exconfig">Example configurations</a></h2>
|
||||
|
||||
<h3>Example config version 1</h3>
|
||||
<p></p>
|
||||
@ -433,158 +119,21 @@ debootstrap, whatever) under /opt/vm-1-root:
|
||||
</domain>
|
||||
</pre>
|
||||
|
||||
|
||||
<h2><a name="usage">Container usage / management</a></h2>
|
||||
|
||||
<p>
|
||||
As with any libvirt virtualization driver, LXC containers can be
|
||||
managed via a wide variety of libvirt based tools. At the lowest
|
||||
level the <code>virsh</code> command can be used to perform many
|
||||
tasks, by passing the <code>-c lxc:///</code> argument. As an
|
||||
alternative to repeating the URI with every command, the <code>LIBVIRT_DEFAULT_URI</code>
|
||||
environment variable can be set to <code>lxc:///</code>. The
|
||||
examples that follow outline some common operations with virsh
|
||||
and LXC. For further details about usage of virsh consult its
|
||||
manual page.
|
||||
</p>
|
||||
|
||||
<h3><a name="usageSave">Defining (saving) container configuration></a></h3>
|
||||
|
||||
<p>
|
||||
The <code>virsh define</code> command takes an XML configuration
|
||||
document and loads it into libvirt, saving the configuration on disk
|
||||
</p>
|
||||
|
||||
In both cases, you can define and start a container using:</p>
|
||||
<pre>
|
||||
# virsh -c lxc:/// define myguest.xml
|
||||
virsh --connect lxc:/// define v1.xml
|
||||
virsh --connect lxc:/// start vm1
|
||||
</pre>
|
||||
|
||||
<h3><a name="usageView">Viewing container configuration</a></h3>
|
||||
|
||||
<p>
|
||||
The <code>virsh dumpxml</code> command can be used to view the
|
||||
current XML configuration of a container. By default the XML
|
||||
output reflects the current state of the container. If the
|
||||
container is running, it is possible to explicitly request the
|
||||
persistent configuration, instead of the current live configuration
|
||||
using the <code>--inactive</code> flag
|
||||
</p>
|
||||
|
||||
and then get a console using:
|
||||
<pre>
|
||||
# virsh -c lxc:/// dumpxml myguest
|
||||
virsh --connect lxc:/// console vm1
|
||||
</pre>
|
||||
|
||||
<h3><a name="usageStart">Starting containers</a></h3>
|
||||
|
||||
<p>
|
||||
The <code>virsh start</code> command can be used to start a
|
||||
container from a previously defined persistent configuration
|
||||
<p>Now doing 'ps -ef' will only show processes in the container, for
|
||||
instance. You can undefine it using
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# virsh -c lxc:/// start myguest
|
||||
virsh --connect lxc:/// undefine vm1
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
It is also possible to start so called "transient" containers,
|
||||
which do not require a persistent configuration to be saved
|
||||
by libvirt, using the <code>virsh create</code> command.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# virsh -c lxc:/// create myguest.xml
|
||||
</pre>
|
||||
|
||||
|
||||
<h3><a name="usageStop">Stopping containers</a></h3>
|
||||
|
||||
<p>
|
||||
The <code>virsh shutdown</code> command can be used
|
||||
to request a graceful shutdown of the container. By default
|
||||
this command will first attempt to send a message to the
|
||||
init process via the <code>/dev/initctl</code> device node.
|
||||
If no such device node exists, then it will send SIGTERM
|
||||
to PID 1 inside the container.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# virsh -c lxc:/// shutdown myguest
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
If the container does not respond to the graceful shutdown
|
||||
request, it can be forceably stopped using the <code>virsh destroy</code>
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# virsh -c lxc:/// destroy myguest
|
||||
</pre>
|
||||
|
||||
|
||||
<h3><a name="usageReboot">Rebooting a container</a></h3>
|
||||
|
||||
<p>
|
||||
The <code>virsh reboot</code> command can be used
|
||||
to request a graceful shutdown of the container. By default
|
||||
this command will first attempt to send a message to the
|
||||
init process via the <code>/dev/initctl</code> device node.
|
||||
If no such device node exists, then it will send SIGHUP
|
||||
to PID 1 inside the container.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# virsh -c lxc:/// reboot myguest
|
||||
</pre>
|
||||
|
||||
<h3><a name="usageDelete">Undefining (deleting) a container configuration</a></h3>
|
||||
|
||||
<p>
|
||||
The <code>virsh undefine</code> command can be used to delete the
|
||||
persistent configuration of a container. If the guest is currently
|
||||
running, this will turn it into a "transient" guest.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# virsh -c lxc:/// undefine myguest
|
||||
</pre>
|
||||
|
||||
<h3><a name="usageConnect">Connecting to a container console</a></h3>
|
||||
|
||||
<p>
|
||||
The <code>virsh console</code> command can be used to connect
|
||||
to the text console associated with a container. If the container
|
||||
has been configured with multiple console devices, then the
|
||||
<code>--devname</code> argument can be used to choose the
|
||||
console to connect to
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# virsh -c lxc:/// console myguest
|
||||
</pre>
|
||||
|
||||
<h3><a name="usageEnter">Running commands in a container</a></h3>
|
||||
|
||||
<p>
|
||||
The <code>virsh lxc-enter-namespace</code> command can be used
|
||||
to enter the namespaces and security context of a container
|
||||
and then execute an arbitrary command.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# virsh -c lxc:/// lxc-enter-namespace myguest -- /bin/ls -al /dev
|
||||
</pre>
|
||||
|
||||
<h3><a name="usageTop">Monitoring container utilization</a></h3>
|
||||
|
||||
<p>
|
||||
The <code>virt-top</code> command can be used to monitor the
|
||||
activity and resource utilization of all containers on a
|
||||
host
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# virt-top -c lxc:///
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html> <!-- -*- html -*- -->
|
||||
<body>
|
||||
<h1>OpenVZ container driver</h1>
|
||||
|
||||
|
@ -1,7 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<html><body>
|
||||
<h1>Parallels Cloud Server driver</h1>
|
||||
<ul id="toc"></ul>
|
||||
<p>
|
||||
|
@ -1,7 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<html><body>
|
||||
<h1>IBM PowerVM hypervisor driver (phyp)</h1>
|
||||
<ul id="toc"></ul>
|
||||
<p>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>KVM/QEMU hypervisor driver</h1>
|
||||
|
||||
@ -19,7 +17,6 @@
|
||||
<li>
|
||||
The <a href="http://www.linux-kvm.org/">KVM</a> Linux
|
||||
hypervisor
|
||||
</li>
|
||||
<li>
|
||||
The <a href="http://wiki.qemu.org/Index.html">QEMU</a> emulator
|
||||
</li>
|
||||
@ -560,7 +557,6 @@ $ virsh domxml-to-native qemu-argv demo.xml
|
||||
possible to add an element <code><qemu:commandline></code>
|
||||
under <code>driver</code>, with the following sub-elements
|
||||
repeated as often as needed:
|
||||
</p>
|
||||
<dl>
|
||||
<dt><code>qemu:arg</code></dt>
|
||||
<dd>Add an additional command-line argument to the qemu
|
||||
@ -573,6 +569,7 @@ $ virsh domxml-to-native qemu-argv demo.xml
|
||||
pair recorded in the attributes <code>name</code>
|
||||
and optional <code>value</code>.</dd>
|
||||
</dl>
|
||||
|
||||
<p>Example:</p><pre>
|
||||
<domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
|
||||
<name>QEmu-fedora-i686</name>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Remote management driver</h1>
|
||||
</body>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Test "mock" driver</h1>
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>User Mode Linux driver</h1>
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>VirtualBox hypervisor driver</h1>
|
||||
<p>
|
||||
@ -31,18 +29,6 @@ vbox+tcp://user@example.com/session (remote access, SASl/Kerberos)
|
||||
vbox+ssh://user@example.com/session (remote access, SSH tunnelled)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<strong>NOTE: as of libvirt 1.0.6, the VirtualBox driver will always
|
||||
run inside the libvirtd daemon, instead of being built-in to the
|
||||
libvirt.so library directly. This change was required due to the
|
||||
fact that VirtualBox code is LGPLv2-only licensed, which is not
|
||||
compatible with the libvirt.so license of LGPLv2-or-later. The
|
||||
daemon will be auto-started when the first connection to VirtualBox
|
||||
is requested. This change also means that it will not be possible
|
||||
to use VirtualBox URIs on the Windows platform, until additional
|
||||
work is completed to get the libvirtd daemon working there.</strong>
|
||||
</p>
|
||||
|
||||
<h2><a name="xmlconfig">Example domain XML config</a></h2>
|
||||
|
||||
<pre>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>VMware Workstation / Player hypervisors driver</h1>
|
||||
<p>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Xen hypervisor driver</h1>
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1 >Handling of errors</h1>
|
||||
<p>The main goals of libvirt when it comes to error handling are:</p>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1 >Firewall and network filtering in libvirt</h1>
|
||||
<p>There are three pieces of libvirt functionality which do network
|
||||
@ -199,7 +198,7 @@ using an XML format. At a high level the format looks like this:
|
||||
</p>
|
||||
<p>The <code><rule></code> element is where all the interesting stuff
|
||||
happens. It has three attributes, an action, a traffic direction and an
|
||||
optional priority. E.g.:
|
||||
optional priority. eg:
|
||||
</p>
|
||||
<pre><rule action='drop' direction='out' priority='500'></pre>
|
||||
<p>Within the rule there are a wide variety of elements allowed, which
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<?xml version="1.0"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1 >XML Format</h1>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Driver capabilities XML format</h1>
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Network XML format</h1>
|
||||
|
||||
@ -138,39 +136,6 @@
|
||||
network, and to/from the host to the guests, are
|
||||
unrestricted and not NATed.<span class="since">Since
|
||||
0.4.2</span>
|
||||
|
||||
<p><span class="since">Since 1.0.3</span> it is possible to
|
||||
specify a public IPv4 address and port range to be used for
|
||||
the NAT by using the <code><nat></code> subelement.
|
||||
The address range is set with the <code><address></code>
|
||||
subelements and <code>start</code> and <code>stop</code>
|
||||
attributes:
|
||||
</p>
|
||||
<pre>
|
||||
...
|
||||
<forward mode='nat'>
|
||||
<nat>
|
||||
<address start='1.2.3.4' end='1.2.3.10'/>
|
||||
</nat>
|
||||
</forward>
|
||||
...</pre>
|
||||
<p>
|
||||
An singe IPv4 address can be set by setting
|
||||
<code>start</code> and <code>end</code> attributes to
|
||||
the same value.
|
||||
</p>
|
||||
<p>
|
||||
The port range to be used for the <code><nat></code> can
|
||||
be set via the subelement <code><port></code>:
|
||||
</p>
|
||||
<pre>
|
||||
...
|
||||
<forward mode='nat'>
|
||||
<nat>
|
||||
<port start='500' end='1000'/>
|
||||
</nat>
|
||||
</forward>
|
||||
...</pre>
|
||||
</dd>
|
||||
|
||||
<dt><code>route</code></dt>
|
||||
@ -281,20 +246,6 @@
|
||||
use the traditional <code>< hostdev></code> device
|
||||
definition. <span class="since"> Since 0.10.0</span>
|
||||
|
||||
<p>
|
||||
To use VFIO device assignment rather than
|
||||
traditional/legacy KVM device assignment (VFIO is a new
|
||||
method of device assignment that is compatible with UEFI
|
||||
Secure Boot), a <forward type='hostdev'> interface
|
||||
can have an optional <code>driver</code> sub-element
|
||||
with a <code>name</code> attribute set to "vfio". To use
|
||||
legacy KVM device assignment you can
|
||||
set <code>name</code> to "kvm" (or simply omit the
|
||||
<driver> element, since "kvm" is currently the
|
||||
default).
|
||||
<span class="since">Since 1.0.5 (QEMU and KVM only, requires kernel 3.6 or newer)</span>
|
||||
</p>
|
||||
|
||||
<p>Note that this "intelligent passthrough" of network
|
||||
devices is very similar to the functionality of a
|
||||
standard <code>< hostdev></code> device, the
|
||||
@ -376,7 +327,6 @@
|
||||
<pre>
|
||||
...
|
||||
<forward mode='hostdev' managed='yes'>
|
||||
<driver name='vfio'/>
|
||||
<address type='pci' domain='0' bus='4' slot='0' function='1'/>
|
||||
<address type='pci' domain='0' bus='4' slot='0' function='2'/>
|
||||
<address type='pci' domain='0' bus='4' slot='0' function='3'/>
|
||||
@ -434,24 +384,20 @@
|
||||
<h5><a name="elementVlanTag">Setting VLAN tag (on supported network types only)</a></h5>
|
||||
|
||||
<pre>
|
||||
<network>
|
||||
<name>ovs-net</name>
|
||||
<forward mode='bridge'/>
|
||||
<bridge name='ovsbr0'/>
|
||||
<virtualport type='openvswitch'>
|
||||
<parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
|
||||
</virtualport>
|
||||
<b><vlan trunk='yes'></b>
|
||||
<b><tag id='42' nativeMode='untagged'/></b>
|
||||
<b><tag id='47'/></b>
|
||||
<b></vlan></b>
|
||||
<portgroup name='dontpanic'>
|
||||
<b><vlan></b>
|
||||
<b><tag id='42'/></b>
|
||||
<b></vlan></b>
|
||||
</portgroup>
|
||||
</network>
|
||||
</pre>
|
||||
...
|
||||
<devices>
|
||||
<interface type='bridge'>
|
||||
<b><vlan trunk='yes'></b>
|
||||
<b><tag id='42'/></b>
|
||||
<b><tag id='47'/></b>
|
||||
<b></vlan></b>
|
||||
<source bridge='ovsbr0'/>
|
||||
<virtualport type='openvswitch'>
|
||||
<parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
|
||||
</virtualport>
|
||||
</interface>
|
||||
<devices>
|
||||
...</pre>
|
||||
|
||||
<p>
|
||||
If (and only if) the network type supports vlan tagging
|
||||
@ -472,14 +418,6 @@
|
||||
is desired, the optional attribute <code>trunk='yes'</code> can
|
||||
be added to the vlan element.
|
||||
</p>
|
||||
<p>
|
||||
For network connections using openvswitch it is possible to
|
||||
configure the 'native-tagged' and 'native-untagged' vlan modes
|
||||
<span class="since">Since 1.1.0</span>. This uses the optional
|
||||
<code>nativeMode</code> attribute on the <code><tag></code>
|
||||
element: <code>nativeMode</code> may be set to 'tagged' or
|
||||
'untagged'. The id atribute of the element sets the native vlan.
|
||||
</p>
|
||||
<p>
|
||||
<code><vlan></code> elements can also be specified in
|
||||
a <code><portgroup></code> element, as well as directly in
|
||||
@ -558,62 +496,6 @@
|
||||
starting.
|
||||
</p>
|
||||
|
||||
<h5><a name="elementsStaticroute">Static Routes</a></h5>
|
||||
<p>
|
||||
Static route definitions are used to provide routing information
|
||||
to the virtualization host for networks which are not directly
|
||||
reachable from the virtualization host, but *are* reachable from
|
||||
a guest domain that is itself reachable from the
|
||||
host <span class="since">since 1.0.6</span>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
As shown in <a href="formatnetwork.html#examplesNoGateway">this
|
||||
example</a>, it is possible to define a virtual network
|
||||
interface with no IPv4 or IPv6 addresses. Such networks are
|
||||
useful to provide host connectivity to networks which are only
|
||||
reachable via a guest. A guest with connectivity both to the
|
||||
guest-only network and to another network that is directly
|
||||
reachable from the host can act as a gateway between the
|
||||
networks. A static route added to the "host-visible" network
|
||||
definition provides the routing information so that IP packets
|
||||
can be sent from the virtualization host to guests on the hidden
|
||||
network.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Here is a fragment of a definition which shows the static
|
||||
route specification as well as the IPv4 and IPv6 definitions
|
||||
for network addresses which are referred to in the
|
||||
<code>gateway</code> gateway address specifications. Note
|
||||
that the third static route specification includes the
|
||||
<code>metric</code> attribute specification with a value of 2.
|
||||
This particular route would *not* be preferred if there was
|
||||
another existing rout on the system with the same address and
|
||||
prefix but with a lower value for the metric. If there is a
|
||||
route in the host system configuration that should be overriden
|
||||
by a route in a virtual network whenever the virtual network is
|
||||
running, the configuration for the system-defined route should
|
||||
be modified to have a higher metric, and the route on the
|
||||
virtual network given a lower metric (for example, the default
|
||||
metric of "1").
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<ip address="192.168.122.1" netmask="255.255.255.0">
|
||||
<dhcp>
|
||||
<range start="192.168.122.128" end="192.168.122.254" />
|
||||
</dhcp>
|
||||
</ip>
|
||||
<route address="192.168.222.0" prefix="24" gateway="192.168.122.2" />
|
||||
<ip family="ipv6" address="2001:db8:ca2:2::1" prefix="64" />
|
||||
<route family="ipv6" address="2001:db8:ca2:3::" prefix="64" gateway="2001:db8:ca2:2::2"/>
|
||||
<route family="ipv6" address="2001:db9:4:1::" prefix="64" gateway="2001:db8:ca2:2::3" metric='2'>
|
||||
</route>
|
||||
...
|
||||
</pre>
|
||||
|
||||
<h3><a name="elementsAddress">Addressing</a></h3>
|
||||
|
||||
<p>
|
||||
@ -645,7 +527,6 @@
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family="ipv6" address="2001:db8:ca2:2::1" prefix="64" />
|
||||
<route family="ipv6" address="2001:db9:ca1:1::" prefix="64" gateway="2001:db8:ca2:2::2" />
|
||||
</network></pre>
|
||||
|
||||
<dl>
|
||||
@ -663,27 +544,10 @@
|
||||
with the idiosyncrasies of the platform where libvirt is
|
||||
running. <span class="since">Since 0.8.8</span>
|
||||
</dd>
|
||||
<dt><code>dns</code></dt>
|
||||
<dd> The dns element of a network contains configuration
|
||||
information for the virtual network's DNS
|
||||
server <span class="since">Since 0.9.3</span>.
|
||||
|
||||
<p>
|
||||
The dns element
|
||||
can have an optional <code>forwardPlainNames</code>
|
||||
attribute <span class="since">Since 1.1.2</span>.
|
||||
If <code>forwardPlainNames</code> is "no", then DNS resolution
|
||||
requests for names that are not qualified with a domain
|
||||
(i.e. names with no "." character) will not be forwarded to
|
||||
the host's upstream DNS server - they will only be resolved if
|
||||
they are known locally within the virtual network's own DNS
|
||||
server. If <code>forwardPlainNames</code> is "yes",
|
||||
unqualified names <b>will</b> be forwarded to the upstream DNS
|
||||
server if they can't be resolved by the virtual network's own
|
||||
DNS server.
|
||||
</p>
|
||||
|
||||
Currently supported sub-elements of <code><dns></code> are:
|
||||
<dt><code>dns</code></dt><dd>
|
||||
The dns element of a network contains configuration information for the
|
||||
virtual network's DNS server. <span class="since">Since 0.9.3</span>
|
||||
Currently supported elements are:
|
||||
<dl>
|
||||
<dt><code>txt</code></dt>
|
||||
<dd>A <code>dns</code> element can have 0 or more <code>txt</code> elements.
|
||||
@ -883,13 +747,8 @@
|
||||
</network></pre>
|
||||
|
||||
<p>
|
||||
Below is another IPv6 variation. Instead of a dhcp range being
|
||||
Below is another IPv6 varition. Instead of a dhcp range being
|
||||
specified, this example has a couple of IPv6 host definitions.
|
||||
Note that most of the dhcp host definitions use an "id" (client
|
||||
id or DUID) since this has proven to be a more reliable way
|
||||
of specifying the interface and its association with an IPv6
|
||||
address. The first is a DUID-LLT, the second a DUID-LL, and
|
||||
the third a DUID-UUID. <span class="since">Since 1.0.3</span>
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
@ -905,40 +764,11 @@
|
||||
<ip family="ipv6" address="2001:db8:ca2:2::1" prefix="64" >
|
||||
<dhcp>
|
||||
<host name="paul" ip="2001:db8:ca2:2:3::1" />
|
||||
<host id="0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66" ip="2001:db8:ca2:2:3::2" />
|
||||
<host id="0:3:0:1:0:16:3e:11:22:33" name="ralph" ip="2001:db8:ca2:2:3::3" />
|
||||
<host id="0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:63" name="badbob" ip="2001:db8:ca2:2:3::4" />
|
||||
<host name="bob" ip="2001:db8:ca2:2:3::2" />
|
||||
</dhcp>
|
||||
</ip>
|
||||
</network></pre>
|
||||
|
||||
<p>
|
||||
Below is yet another IPv6 variation. This variation has only
|
||||
IPv6 defined with DHCPv6 on the primary IPv6 network. A static
|
||||
link if defined for a second IPv6 network which will not be
|
||||
directly visible on the bridge interface but there will be a
|
||||
static route defined for this network via the specified
|
||||
gateway. Note that the gateway address must be directly
|
||||
reachable via (on the same subnet as) one of the <ip>
|
||||
addresses defined for this <network>.
|
||||
<span class="since">Since 1.0.6</span>
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<network>
|
||||
<name>net7</name>
|
||||
<bridge name="virbr7" />
|
||||
<forward mode="route"/>
|
||||
<ip family="ipv6" address="2001:db8:ca2:7::1" prefix="64" >
|
||||
<dhcp>
|
||||
<range start="2001:db8:ca2:7::100" end="2001:db8:ca2::1ff" />
|
||||
<host id="0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:63" name="lucas" ip="2001:db8:ca2:2:3::4" />
|
||||
</dhcp>
|
||||
</ip>
|
||||
<route family="ipv6" address="2001:db8:ca2:8::" prefix="64" gateway="2001:db8:ca2:7::4" >
|
||||
</route>
|
||||
</network></pre>
|
||||
|
||||
<h3><a name="examplesPrivate">Isolated network config</a></h3>
|
||||
|
||||
<p>
|
||||
@ -965,11 +795,6 @@
|
||||
|
||||
<p>
|
||||
This variation of an isolated network defines only IPv6.
|
||||
Note that most of the dhcp host definitions use an "id" (client
|
||||
id or DUID) since this has proven to be a more reliable way
|
||||
of specifying the interface and its association with an IPv6
|
||||
address. The first is a DUID-LLT, the second a DUID-LL, and
|
||||
the third a DUID-UUID. <span class="since">Since 1.0.3</span>
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
@ -979,9 +804,7 @@
|
||||
<ip family="ipv6" address="2001:db8:ca2:6::1" prefix="64" >
|
||||
<dhcp>
|
||||
<host name="peter" ip="2001:db8:ca2:6:6::1" />
|
||||
<host id="0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66" ip="2001:db8:ca2:6:6::2" />
|
||||
<host id="0:3:0:1:0:16:3e:11:22:33" name="dariusz" ip="2001:db8:ca2:6:6::3" />
|
||||
<host id="0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:63" name="anita" ip="2001:db8:ca2:6:6::4" />
|
||||
<host name="dariusz" ip="2001:db8:ca2:6:6::2" />
|
||||
</dhcp>
|
||||
</ip>
|
||||
</network></pre>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Node devices XML format</h1>
|
||||
|
||||
@ -13,7 +11,7 @@
|
||||
prefix <code>virNodeDevice</code>, which deal with management of
|
||||
host devices that can be handed to guests via passthrough as
|
||||
<hostdev> elements
|
||||
in <a href="formatdomain.html#elementsHostDev">the domain XML</a>.
|
||||
in <a href="formatdomain.html#elementsUSB">the domain XML</a>.
|
||||
These devices are represented as a hierarchy, where a device on
|
||||
a bus has a parent of the bus controller device; the root of the
|
||||
hierarchy is the node named "computer".
|
||||
@ -80,36 +78,6 @@
|
||||
<dd>Vendor details from the device ROM, including an
|
||||
attribute <code>id</code> with the hexadecimal vendor
|
||||
id, and an optional text name of that vendor.</dd>
|
||||
<dt><code>iommuGroup</code></dt>
|
||||
<dd>
|
||||
This optional element describes the "IOMMU group" this
|
||||
device belongs to. If the element exists, it has a
|
||||
mandatory <code>number</code> attribute which tells
|
||||
the group number used for management of the group (all
|
||||
devices in group "n" will be found in
|
||||
"/sys/kernel/iommu_groups/n"). It will also have a
|
||||
list of <code>address</code> subelements, each
|
||||
containing the PCI address of a device in the same
|
||||
group. The toplevel device will itself be included in
|
||||
this list.
|
||||
</dd>
|
||||
<dt><code>capability</code></dt>
|
||||
<dd>
|
||||
This optional element can occur multiple times. If it
|
||||
exists, it has a mandatory <code>type</code> attribute
|
||||
which will be set to
|
||||
either <code>physical_function</code>
|
||||
or <code>virtual_functions</code>. If the type
|
||||
is <code>physical_function</code>, there will be a
|
||||
single <code>address</code> subelement which contains
|
||||
the PCI address of the SRIOV Physical Function (PF)
|
||||
that is the parent of this device (and this device is,
|
||||
by implication, an SRIOV Virtual Function (VF)). If
|
||||
the type is <code>virtual_functions</code>, then this
|
||||
device is an SRIOV PF, and the capability element will
|
||||
have a list of <code>address</code> subelements, one
|
||||
for each VF on this PF.
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt><code>usb_device</code></dt>
|
||||
@ -136,11 +104,11 @@
|
||||
<dl>
|
||||
<dt><code>number</code></dt>
|
||||
<dd>The device number.</dd>
|
||||
<dt><code>class</code></dt>
|
||||
<dt><code>number</code></dt>
|
||||
<dd>The device class.</dd>
|
||||
<dt><code>subclass</code></dt>
|
||||
<dt><code>number</code></dt>
|
||||
<dd>The device subclass.</dd>
|
||||
<dt><code>protocol</code></dt>
|
||||
<dt><code>number</code></dt>
|
||||
<dd>The device protocol.</dd>
|
||||
<dt><code>description</code></dt>
|
||||
<dd>If present, a description of the device.</dd>
|
||||
@ -168,13 +136,9 @@
|
||||
<dd>The SCSI host number.</dd>
|
||||
<dt><code>capability</code></dt>
|
||||
<dd>Current capabilities include "vports_ops" (indicates
|
||||
vport operations are supported) and "fc_host". "vport_ops"
|
||||
could contain two optional sub-elements: <code>vports</code>,
|
||||
and <code>max_vports</code>. <code>vports</code> shows the
|
||||
number of vport in use. <code>max_vports</code> shows the
|
||||
maximum vports the HBA supports. "fc_host" implies following
|
||||
sub-elements: <code>wwnn</code>, <code>wwpn</code>, and
|
||||
<code>fabric_wwn</code>.
|
||||
vport operations are supported) and "fc_host", the later
|
||||
implies following sub-elements: <code>wwnn</code>,
|
||||
<code>wwpn</code>, <code>fabric_wwn</code>.
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
@ -262,38 +226,7 @@
|
||||
<address>00:27:13:6a:fe:00</address>
|
||||
<capability type='80203'/>
|
||||
</capability>
|
||||
</device>
|
||||
|
||||
<device>
|
||||
<name>pci_0000_02_00_0</name>
|
||||
<path>/sys/devices/pci0000:00/0000:00:04.0/0000:02:00.0</path>
|
||||
<parent>pci_0000_00_04_0</parent>
|
||||
<driver>
|
||||
<name>igb</name>
|
||||
</driver>
|
||||
<capability type='pci'>
|
||||
<domain>0</domain>
|
||||
<bus>2</bus>
|
||||
<slot>0</slot>
|
||||
<function>0</function>
|
||||
<product id='0x10c9'>82576 Gigabit Network Connection</product>
|
||||
<vendor id='0x8086'>Intel Corporation</vendor>
|
||||
<capability type='virt_functions'>
|
||||
<address domain='0x0000' bus='0x02' slot='0x10' function='0x0'/>
|
||||
<address domain='0x0000' bus='0x02' slot='0x10' function='0x2'/>
|
||||
<address domain='0x0000' bus='0x02' slot='0x10' function='0x4'/>
|
||||
<address domain='0x0000' bus='0x02' slot='0x10' function='0x6'/>
|
||||
<address domain='0x0000' bus='0x02' slot='0x11' function='0x0'/>
|
||||
<address domain='0x0000' bus='0x02' slot='0x11' function='0x2'/>
|
||||
<address domain='0x0000' bus='0x02' slot='0x11' function='0x4'/>
|
||||
</capability>
|
||||
<iommuGroup number='12'>
|
||||
<address domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
|
||||
<address domain='0x0000' bus='0x02' slot='0x00' function='0x1'/>
|
||||
</iommuGroup>
|
||||
</capability>
|
||||
</device>
|
||||
</pre>
|
||||
</device></pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Network Filters</h1>
|
||||
|
||||
@ -115,7 +113,7 @@
|
||||
<p>
|
||||
Filtering rules are organized in filter chains. These chains can be
|
||||
thought of as having a tree structure with packet
|
||||
filtering rules as entries in individual chains (branches). <br/>
|
||||
filtering rules as entries in individual chains (branches). <br>
|
||||
Packets start their filter evaluation in the <code>root</code> chain
|
||||
and can then continue their evaluation in other chains, return from
|
||||
those chains back into the <code>root</code> chain or be
|
||||
@ -229,7 +227,7 @@
|
||||
<p>
|
||||
A chain with a lower priority value is accessed before one with a
|
||||
higher value.
|
||||
<br/>
|
||||
<br><br>
|
||||
<span class="since">Since 0.9.8</span> the above listed chains
|
||||
can be assigned custom priorities by writing a value in the
|
||||
range [-1000, 1000] into the priority (XML) attribute in the filter
|
||||
@ -372,7 +370,7 @@
|
||||
<p>
|
||||
Further, the notation of $VARIABLE is short-hand for $VARIABLE[@0]. The
|
||||
former notation always assumes the iterator with Id '0'.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
<h3><a name="nwfelemsRulesAdvIPAddrDetection">Automatic IP address detection</a></h3>
|
||||
<p>
|
||||
@ -396,7 +394,7 @@
|
||||
When a VM is migrated to another host or resumed after a suspend operation,
|
||||
the first packet sent by the VM will again determine the IP address it can
|
||||
use on a particular interface.
|
||||
<br/>
|
||||
<br/><br>
|
||||
A value of <code>dhcp</code> specifies that libvirt should only honor DHCP
|
||||
server-assigned addresses with valid leases. This method supports the detection
|
||||
and usage of multiple IP address per interface.
|
||||
@ -569,7 +567,7 @@
|
||||
(matching the rule passes this filter, but returns control to
|
||||
the calling filter for further
|
||||
analysis) <span class="since">(since 0.9.7)</span>,
|
||||
or <code>continue</code> (matching the rule goes on to the next
|
||||
or <code>continue<code> (matching the rule goes on to the next
|
||||
rule for further analysis) <span class="since">(since
|
||||
0.9.7)</span>.
|
||||
</li>
|
||||
@ -587,7 +585,7 @@
|
||||
<span class="since">Since 0.9.8</span> this has been extended to cover
|
||||
the range of -1000 to 1000. If this attribute is not
|
||||
provided, priority 500 will automatically be assigned.
|
||||
<br/>
|
||||
<br>
|
||||
Note that filtering rules in the <code>root</code> chain are sorted
|
||||
with filters connected to the <code>root</code> chain following
|
||||
their priorities. This allows to interleave filtering rules with
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Secret XML format</h1>
|
||||
|
||||
@ -41,207 +39,41 @@
|
||||
<dd>
|
||||
Specifies what this secret is used for. A mandatory
|
||||
<code>type</code> attribute specifies the usage category, currently
|
||||
only <code>volume</code>, <code>ceph</code> and <code>iscsi</code>
|
||||
are defined. Specific usage categories are described below.
|
||||
only <code>volume</code> and <code>ceph</code> are defined.
|
||||
Specific usage categories are described below.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h3><a name="VolumeUsageType">Usage type "volume"</a></h3>
|
||||
<h3>Usage type "volume"</h3>
|
||||
|
||||
<p>
|
||||
This secret is associated with a volume, and it is safe to delete the
|
||||
secret after the volume is deleted. The <code><usage
|
||||
type='volume'></code> element must contain a
|
||||
single <code>volume</code> element that specifies the key of the volume
|
||||
this secret is associated with. For example, create a volume-secret.xml
|
||||
file as follows:
|
||||
this secret is associated with.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<secret ephemeral='no' private='yes'>
|
||||
<description>Super secret name of my first puppy</description>
|
||||
<uuid>0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f</uuid>
|
||||
<usage type='volume'>
|
||||
<volume>/var/lib/libvirt/images/puppyname.img</volume>
|
||||
</usage>
|
||||
</secret>
|
||||
</pre>
|
||||
<h3>Usage type "ceph"</h3>
|
||||
|
||||
<p>
|
||||
Define the secret and set the pass phrase as follows:
|
||||
</p>
|
||||
<pre>
|
||||
# virsh secret-define volume-secret.xml
|
||||
Secret 0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f created
|
||||
#
|
||||
# MYSECRET=`printf %s "open sesame" | base64`
|
||||
# virsh secret-set-value 0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f $MYSECRET
|
||||
Secret value set
|
||||
#
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The volume type secret can then be used in the XML for a storage volume
|
||||
<a href="formatstorageencryption.html">encryption</a> as follows:
|
||||
</p>
|
||||
<pre>
|
||||
<encryption format='qcow'>
|
||||
<secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/>
|
||||
</encryption>
|
||||
</pre>
|
||||
|
||||
<h3><a name="CephUsageType">Usage type "ceph"</a></h3>
|
||||
<p>
|
||||
This secret is associated with a Ceph RBD (rados block device).
|
||||
The <code><usage type='ceph'></code> element must contain
|
||||
a single <code>name</code> element that specifies a usage name
|
||||
for the secret. The Ceph secret can then be used by UUID or by
|
||||
this usage name via the <code><auth></code> element of
|
||||
a <a href="formatdomain.html#elementsDisks">disk device</a> or
|
||||
a <a href="formatstorage.html">storage pool (rbd)</a>.
|
||||
<span class="since">Since 0.9.7</span>. The following is an example
|
||||
of the steps to be taken. First create a ceph-secret.xml file:
|
||||
a <a href="domain.html#elementsDisks">disk
|
||||
device</a>. <span class="since">Since 0.9.7</span>.
|
||||
</p>
|
||||
|
||||
<h2><a name="example">Example</a></h2>
|
||||
|
||||
<pre>
|
||||
<secret ephemeral='no' private='yes'>
|
||||
<description>CEPH passphrase example</description>
|
||||
<auth type='ceph' username='myname'/>
|
||||
<usage type='ceph'>
|
||||
<name>ceph_example</name>
|
||||
<description>LUKS passphrase for the main hard drive of our mail server</description>
|
||||
<usage type='volume'>
|
||||
<volume>/var/lib/libvirt/images/mail.img</volume>
|
||||
</usage>
|
||||
</secret>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Next, use <code>virsh secret-define ceph-secret.xml</code> to define
|
||||
the secret and <code>virsh secret-set-value</code> using the generated
|
||||
UUID value and a base64 generated secret value in order to define the
|
||||
chosen secret pass phrase.
|
||||
</p>
|
||||
<pre>
|
||||
# virsh secret-define ceph-secret.xml
|
||||
Secret 1b40a534-8301-45d5-b1aa-11894ebb1735 created
|
||||
#
|
||||
# virsh secret-list
|
||||
UUID Usage
|
||||
-----------------------------------------------------------
|
||||
1b40a534-8301-45d5-b1aa-11894ebb1735 cephx ceph_example
|
||||
#
|
||||
# CEPHPHRASE=`printf %s "pass phrase" | base64`
|
||||
# virsh secret-set-value 1b40a534-8301-45d5-b1aa-11894ebb1735 $CEPHPHRASE
|
||||
Secret value set
|
||||
|
||||
#
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The ceph secret can then be used by UUID or by the
|
||||
usage name via the <code><auth></code> element in a domain's
|
||||
<a href="formatdomain.html#elementsDisks"><code><disk></code></a>
|
||||
element as follows:
|
||||
</p>
|
||||
<pre>
|
||||
<auth username='myname'>
|
||||
<secret type='ceph' usage='ceph_example'/>
|
||||
</auth>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
As well as the <code><auth></code> element in a
|
||||
<a href="formatstorage.html">storage pool (rbd)</a>
|
||||
<code><source></code> element as follows:
|
||||
</p>
|
||||
<pre>
|
||||
<auth type='ceph' username='myname'>
|
||||
<secret usage='ceph_example'/>
|
||||
</auth>
|
||||
</pre>
|
||||
|
||||
<h3><a name="iSCSIUsageType">Usage type "iscsi"</a></h3>
|
||||
|
||||
<p>
|
||||
This secret is associated with an iSCSI target for CHAP authentication.
|
||||
The <code><usage type='iscsi'></code> element must contain
|
||||
a single <code>target</code> element that specifies a usage name
|
||||
for the secret. The iSCSI secret can then be used by UUID or by
|
||||
this usage name via the <code><auth></code> element of
|
||||
a <a href="formatdomain.html#elementsDisks">disk device</a> or
|
||||
a <a href="formatstorage.html">storage pool (iscsi)</a>.
|
||||
<span class="since">Since 1.0.4</span>. The following is an example
|
||||
of the XML that may be used to generate a secret for iSCSI CHAP
|
||||
authentication. Assume the following sample entry in an iSCSI
|
||||
authentication file:
|
||||
</p>
|
||||
<pre>
|
||||
<target iqn.2013-07.com.example:iscsi-pool>
|
||||
backing-store /home/tgtd/iscsi-pool/disk1
|
||||
backing-store /home/tgtd/iscsi-pool/disk2
|
||||
incominguser myname mysecret
|
||||
</target>
|
||||
</pre>
|
||||
<p>
|
||||
Define an iscsi-secret.xml file to describe the secret. Use the
|
||||
<code>incominguser</code> username used in your iSCSI authentication
|
||||
configuration file as the value for the <code>username</code> attribute.
|
||||
The <code>description</code> attribute should contain configuration
|
||||
specific data. The <code>target</code> name may be any name of your
|
||||
choosing to be used as the <code>usage</code> when used in the pool
|
||||
or disk XML description.
|
||||
</p>
|
||||
<pre>
|
||||
<secret ephemeral='no' private='yes'>
|
||||
<description>Passphrase for the iSCSI example.com server</description>
|
||||
<auth type='chap' username='myname'/>
|
||||
<usage type='iscsi'>
|
||||
<target>libvirtiscsi</target>
|
||||
</usage>
|
||||
</secret>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Next, use <code>virsh secret-define iscsi-secret.xml</code> to define
|
||||
the secret and <code>virsh secret-set-value</code> using the generated
|
||||
UUID value and a base64 generated secret value in order to define the
|
||||
chosen secret pass phrase. The pass phrase must match the password
|
||||
used in the iSCSI authentication configuration file.
|
||||
</p>
|
||||
<pre>
|
||||
# virsh secret-define secret.xml
|
||||
Secret c4dbe20b-b1a3-4ac1-b6e6-2ac97852ebb6 created
|
||||
|
||||
# virsh secret-list
|
||||
UUID Usage
|
||||
-----------------------------------------------------------
|
||||
c4dbe20b-b1a3-4ac1-b6e6-2ac97852ebb6 iscsi libvirtiscsi
|
||||
|
||||
# MYSECRET=`printf %s "mysecret" | base64`
|
||||
# virsh secret-set-value c4dbe20b-b1a3-4ac1-b6e6-2ac97852ebb6 $MYSECRET
|
||||
Secret value set
|
||||
#
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The iSCSI secret can then be used by UUID or by the
|
||||
usage name via the <code><auth></code> element in a domain's
|
||||
<a href="formatdomain.html#elementsDisks"><code><disk></code></a>
|
||||
element as follows:
|
||||
</p>
|
||||
<pre>
|
||||
<auth username='myname'>
|
||||
<secret type='iscsi' usage='libvirtiscsi'/>
|
||||
</auth>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
As well as the <code><auth></code> element in a
|
||||
<a href="formatstorage.html">storage pool (iscsi)</a>
|
||||
<code><source></code> element as follows:
|
||||
</p>
|
||||
<pre>
|
||||
<auth type='chap' username='myname'>
|
||||
<secret usage='libvirtiscsi'/>
|
||||
</auth>
|
||||
</pre>
|
||||
</secret></pre>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Snapshot XML format</h1>
|
||||
|
||||
@ -148,9 +146,8 @@
|
||||
the <a href="formatdomain.html#elementsDisks">disk
|
||||
devices</a> specified for the domain at the time of the
|
||||
snapshot. The attribute <code>snapshot</code> is
|
||||
optional, and the possible values are the same as the
|
||||
<code>snapshot</code> attribute for
|
||||
<a href="formatdomain.html#elementsDisks">disk devices</a>
|
||||
optional, and has the same values of the disk device
|
||||
element for a domain
|
||||
(<code>no</code>, <code>internal</code>,
|
||||
or <code>external</code>). Some hypervisors like ESX
|
||||
require that if specified, the snapshot mode must not
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Storage pool and volume XML format</h1>
|
||||
|
||||
@ -17,9 +15,9 @@
|
||||
<p>
|
||||
The top level tag for a storage pool document is 'pool'. It has
|
||||
a single attribute <code>type</code>, which is one of <code>dir</code>,
|
||||
<code>fs</code>, <code>netfs</code>, <code>disk</code>,
|
||||
<code>iscsi</code>, <code>logical</code>. This corresponds to the
|
||||
storage backend drivers listed further along in this document.
|
||||
<code>fs</code>,<code>netfs</code>,<code>disk</code>,<code>iscsi</code>,
|
||||
<code>logical</code>. This corresponds to the storage backend drivers
|
||||
listed further along in this document.
|
||||
The storage pool XML format is available <span class="since">since 0.4.1</span>
|
||||
</p>
|
||||
<h3><a name="StoragePoolFirst">General metadata</a></h3>
|
||||
@ -72,21 +70,11 @@
|
||||
<source>
|
||||
<host name="iscsi.example.com"/>
|
||||
<device path="demo-target"/>
|
||||
<auth type='chap' username='myname'>
|
||||
<secret type='iscsi' usage='mycluster_myname'/>
|
||||
</auth>
|
||||
<vendor name="Acme"/>
|
||||
<product name="model"/>
|
||||
</source>
|
||||
...</pre>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<source>
|
||||
<adapter type='fc_host' parent='scsi_host5' wwnn='20000000c9831b4b' wwpn='10000000c9831b4b'/>
|
||||
</source>
|
||||
...</pre>
|
||||
|
||||
<dl>
|
||||
<dt><code>device</code></dt>
|
||||
<dd>Provides the source for pools backed by physical devices.
|
||||
@ -96,27 +84,12 @@
|
||||
<dt><code>directory</code></dt>
|
||||
<dd>Provides the source for pools backed by directories. May
|
||||
only occur once. Contains a single attribute <code>path</code>
|
||||
which is the fully qualified path to the backing directory.
|
||||
which is the fully qualified path to the block device node.
|
||||
<span class="since">Since 0.4.1</span></dd>
|
||||
<dt><code>adapter</code></dt>
|
||||
<dd>Provides the source for pools backed by SCSI adapters. May
|
||||
only occur once. Attribute <code>name</code> is the SCSI adapter
|
||||
name (ex. "scsi_host1". NB, although a name such as "host1" is
|
||||
still supported for backwards compatibility, it is not recommended).
|
||||
Attribute <code>type</code> (<span class="since">1.0.5</span>)
|
||||
specifies the adapter type. Valid values are "fc_host" and "scsi_host".
|
||||
If omitted and the <code>name</code> attribute is specified, then it
|
||||
defaults to "scsi_host". To keep backwards compatibility, the attribute
|
||||
<code>type</code> is optional for the "scsi_host" adapter, but
|
||||
mandatory for the "fc_host" adapter. Attributes <code>wwnn</code>
|
||||
(Word Wide Node Name) and <code>wwpn</code> (Word Wide Port Name)
|
||||
(<span class="since">1.0.4</span>) are used by the "fc_host" adapter
|
||||
to uniquely identify the device in the Fibre Channel storage fabric
|
||||
(the device can be either a HBA or vHBA). Both wwnn and wwpn should
|
||||
be specified (See command 'virsh nodedev-dumpxml' to known how to get
|
||||
wwnn/wwpn of a (v)HBA). The optional attribute <code>parent</code>
|
||||
(<span class="since">1.0.4</span>) specifies the parent device for
|
||||
the "fc_host" adapter.
|
||||
only occur once. Contains a single attribute <code>name</code>
|
||||
which is the SCSI adapter name (ex. "host1").
|
||||
<span class="since">Since 0.6.2</span></dd>
|
||||
<dt><code>host</code></dt>
|
||||
<dd>Provides the source for pools backed by storage from a
|
||||
@ -125,31 +98,10 @@
|
||||
which is the hostname or IP address of the server. May optionally
|
||||
contain a <code>port</code> attribute for the protocol specific
|
||||
port number. <span class="since">Since 0.4.1</span></dd>
|
||||
<dt><code>auth</code></dt>
|
||||
<dd>If present, the <code>auth</code> element provides the
|
||||
authentication credentials needed to access the source by the
|
||||
setting of the <code>type</code> attribute. The <code>type</code>
|
||||
must be either "chap" or "ceph". Additionally a mandatory attribute
|
||||
<code>username</code> identifies the username to use during
|
||||
authentication as well as a sub-element <code>secret</code> with
|
||||
a mandatory attribute <code>type</code>, to tie back to a
|
||||
<a href="formatsecret.html">libvirt secret object</a> that
|
||||
holds the actual password or other credentials. The domain XML
|
||||
intentionally does not expose the password, only the reference
|
||||
to the object that manages the password. The secret element
|
||||
<code>type</code> must be either "ceph" or "iscsi". Use "ceph" for
|
||||
Ceph RBD (Rados Block Device) network sources and use "iscsi" for CHAP
|
||||
(Challenge-Handshake Authentication Protocol) iSCSI targets.
|
||||
The <code>secret</code> element requires either a <code>uuid</code>
|
||||
attribute with the UUID of the secret object or a <code>usage</code>
|
||||
attribute matching the key that was specified in the
|
||||
secret object. <span class="since">Since 0.9.7 for "ceph" and
|
||||
1.1.1 for "chap"</span>
|
||||
</dd>
|
||||
<dt><code>name</code></dt>
|
||||
<dd>Provides the source for pools backed by storage from a
|
||||
named element (e.g., a logical volume group name).
|
||||
Contains a string identifier.
|
||||
remote server. Contains a string identifier.
|
||||
<span class="since">Since 0.4.5</span></dd>
|
||||
<dt><code>format</code></dt>
|
||||
<dd>Provides information about the format of the pool. This
|
||||
@ -214,10 +166,11 @@
|
||||
<span class="since">Since 0.4.1</span>
|
||||
</dd>
|
||||
<dt><code>permissions</code></dt>
|
||||
<dd>This is currently only useful for directory or filesystem based
|
||||
pools, which are mapped as a directory into the local filesystem
|
||||
namespace. It provides information about the permissions to use for the
|
||||
final directory when the pool is built. The
|
||||
<dd>Provides information about the default permissions to use
|
||||
when creating volumes. This is currently only useful for directory
|
||||
or filesystem based pools, where the volumes allocated are simple
|
||||
files. For pools where the volumes are device nodes, the hotplug
|
||||
scripts determine permissions. It contains 4 child elements. The
|
||||
<code>mode</code> element contains the octal permission set. The
|
||||
<code>owner</code> element contains the numeric user ID. The <code>group</code>
|
||||
element contains the numeric group ID. The <code>label</code> element
|
||||
@ -297,11 +250,7 @@
|
||||
allocated at time of creation. If set to a value smaller than the
|
||||
capacity, the pool has the <strong>option</strong> of deciding
|
||||
to sparsely allocate a volume. It does not have to honour requests
|
||||
for sparse allocation though. Different types of pools may treat
|
||||
sparse volumes differently. For example, the <code>logical</code>
|
||||
pool will not automatically expand volume's allocation when it
|
||||
gets full; the user is responsible for doing that or configuring
|
||||
dmeventd to do so automatically.<br/>
|
||||
for sparse allocation though.<br/>
|
||||
<br/>
|
||||
By default this is specified in bytes, but an optional attribute
|
||||
<code>unit</code> can be specified to adjust the passed value.
|
||||
@ -356,10 +305,6 @@
|
||||
<mode>0744</mode>
|
||||
<label>virt_image_t</label>
|
||||
</permissions>
|
||||
<compat>1.1</compat>
|
||||
<features>
|
||||
<lazy_refcounts/>
|
||||
</features>
|
||||
</target></pre>
|
||||
|
||||
<dl>
|
||||
@ -388,22 +333,6 @@
|
||||
contains the MAC (eg SELinux) label string.
|
||||
<span class="since">Since 0.4.1</span>
|
||||
</dd>
|
||||
<dt><code>compat</code></dt>
|
||||
<dd>Specify compatibility level. So far, this is only used for
|
||||
<code>type='qcow2'</code> volumes. Valid values are <code>0.10</code>
|
||||
and <code>1.1</code> so far, specifying QEMU version the images should
|
||||
be compatible with. If the <code>feature</code> element is present,
|
||||
1.1 is used. If omitted, qemu-img default is used.
|
||||
<span class="since">Since 1.1.0</span>
|
||||
</dd>
|
||||
<dt><code>features</code></dt>
|
||||
<dd>Format-specific features. Only used for <code>qcow2</code> now.
|
||||
Valid sub-elements are:
|
||||
<ul>
|
||||
<li><code><lazy_refcounts/></code> - allow delayed reference
|
||||
counter updates. <span class="since">Since 1.1.0</span></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h3><a name="StorageVolBacking">Backing store elements</a></h3>
|
||||
@ -479,10 +408,7 @@
|
||||
<name>virtimages</name>
|
||||
<source>
|
||||
<host name="iscsi.example.com"/>
|
||||
<device path="iqn.2013-06.com.example:iscsi-pool"/>
|
||||
<auth type='chap' username='myuser'>
|
||||
<secret usage='libvirtiscsi'/>
|
||||
</auth>
|
||||
<device path="demo-target"/>
|
||||
</source>
|
||||
<target>
|
||||
<path>/dev/disk/by-path</path>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Storage volume encryption XML format</h1>
|
||||
|
||||
|
@ -1,124 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my @objects = (
|
||||
"CONNECT", "DOMAIN", "INTERFACE",
|
||||
"NETWORK","NODE_DEVICE", "NWFILTER",
|
||||
"SECRET", "STORAGE_POOL", "STORAGE_VOL",
|
||||
);
|
||||
|
||||
my %class;
|
||||
|
||||
foreach my $object (@objects) {
|
||||
my $class = lc $object;
|
||||
|
||||
$class =~ s/(^\w|_\w)/uc $1/eg;
|
||||
$class =~ s/_//g;
|
||||
$class =~ s/Nwfilter/NWFilter/;
|
||||
$class = "vir" . $class . "Ptr";
|
||||
|
||||
$class{$object} = $class;
|
||||
}
|
||||
|
||||
my $objects = join ("|", @objects);
|
||||
|
||||
my %opts;
|
||||
my $in_opts = 0;
|
||||
|
||||
my %perms;
|
||||
|
||||
while (<>) {
|
||||
if ($in_opts) {
|
||||
if (m,\*/,) {
|
||||
$in_opts = 0;
|
||||
} elsif (/\*\s*\@(\w+):\s*(.*?)\s*$/) {
|
||||
$opts{$1} = $2;
|
||||
}
|
||||
} elsif (m,/\*\*,) {
|
||||
$in_opts = 1;
|
||||
} elsif (/VIR_ACCESS_PERM_($objects)_((?:\w|_)+),/) {
|
||||
my $object = $1;
|
||||
my $perm = lc $2;
|
||||
next if $perm eq "last";
|
||||
|
||||
$perm =~ s/_/-/g;
|
||||
|
||||
$perms{$object} = {} unless exists $perms{$object};
|
||||
$perms{$object}->{$perm} = {
|
||||
desc => $opts{desc},
|
||||
message => $opts{message},
|
||||
anonymous => $opts{anonymous}
|
||||
};
|
||||
%opts = ();
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
EOF
|
||||
|
||||
foreach my $object (sort { $a cmp $b } keys %perms) {
|
||||
my $class = $class{$object};
|
||||
my $olink = lc "object_" . $object;
|
||||
print <<EOF;
|
||||
<h3><a name="$olink">$class</a></h3>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Permission</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
EOF
|
||||
|
||||
foreach my $perm (sort { $a cmp $b } keys %{$perms{$object}}) {
|
||||
my $description = $perms{$object}->{$perm}->{desc};
|
||||
|
||||
die "missing description for $object.$perm" unless
|
||||
defined $description;
|
||||
|
||||
my $plink = lc "perm_" . $object . "_" . $perm;
|
||||
$plink =~ s/-/_/g;
|
||||
|
||||
print <<EOF;
|
||||
<tr>
|
||||
<td><a name="$plink">$perm</a></td>
|
||||
<td>$description</td>
|
||||
</tr>
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
</tbody>
|
||||
</table>
|
||||
EOF
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
@ -4,7 +4,7 @@ body {
|
||||
padding: 0px;
|
||||
color: rgb(0,0,0);
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: smaller;
|
||||
font-size: 80%;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
@ -64,6 +64,8 @@ h6 {
|
||||
dl dt {
|
||||
margin-left: 1em;
|
||||
margin-right: 2em;
|
||||
font-weight: bold;
|
||||
font-size: larger;
|
||||
}
|
||||
|
||||
dl dd {
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Terminology and goals</h1>
|
||||
<p>To avoid ambiguity about the terms used, here are the definitions
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Contributor guidelines</h1>
|
||||
|
||||
@ -11,12 +9,8 @@
|
||||
<li>Discuss any large changes on the mailing list first. Post patches
|
||||
early and listen to feedback.</li>
|
||||
|
||||
<li><p>Post patches in unified diff format, with git rename
|
||||
detection enabled. You need a one-time setup of:</p>
|
||||
<pre>
|
||||
git config diff.renames true
|
||||
</pre>
|
||||
<p>After that, a command similar to this should work:</p>
|
||||
<li><p>Post patches in unified diff format. A command similar to this
|
||||
should work:</p>
|
||||
<pre>
|
||||
diff -urp libvirt.orig/ libvirt.modified/ > libvirt-myfeature.patch
|
||||
</pre>
|
||||
@ -26,18 +20,14 @@
|
||||
<pre>
|
||||
git diff > libvirt-myfeature.patch
|
||||
</pre>
|
||||
<p>Also, for code motion patches, you may find that <code>git
|
||||
diff --patience</code> provides an easier-to-read patch.
|
||||
However, the usual workflow of libvirt developer is:</p>
|
||||
<p>However, the usual workflow of libvirt developer is:</p>
|
||||
<pre>
|
||||
git checkout master
|
||||
git pull
|
||||
git checkout -t origin -b workbranch
|
||||
Hack, committing any changes along the way
|
||||
</pre>
|
||||
<p>More hints on compiling can be
|
||||
found <a href="compiling.html">here</a>. When you want to
|
||||
post your patches:</p>
|
||||
<p>Then, when you want to post your patches:</p>
|
||||
<pre>
|
||||
git pull --rebase
|
||||
(fix any conflicts)
|
||||
@ -69,21 +59,6 @@
|
||||
version if needed though).</p>
|
||||
</li>
|
||||
|
||||
<li><p>In your commit message, make the summary line reasonably
|
||||
short (60 characters is typical), followed by a blank line,
|
||||
followed by any longer description of why your patch makes
|
||||
sense. If the patch fixes a regression, and you know what
|
||||
commit introduced the problem, mentioning that is useful.
|
||||
If the patch resolves a bugzilla report, mentioning the URL
|
||||
of the bug number is useful; but also summarize the issue
|
||||
rather than making all readers follow the link. You can use
|
||||
'git shortlog -30' to get an idea of typical summary lines.
|
||||
Libvirt does not currently attach any meaning to
|
||||
Signed-off-by: lines, so it is up to you if you want to
|
||||
include or omit them in the commit message.
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li><p>Split large changes into a series of smaller patches,
|
||||
self-contained if possible, with an explanation of each patch
|
||||
and an explanation of how the sequence of patches fits
|
||||
@ -113,23 +88,10 @@
|
||||
make syntax-check
|
||||
make -C tests valgrind
|
||||
</pre>
|
||||
<p><a href="http://valgrind.org/">Valgrind</a> is a test that checks
|
||||
for memory management issues, such as leaks or use of uninitialized
|
||||
variables.
|
||||
<p>
|
||||
The latter test checks for memory leaks.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Some tests are skipped by default in a development environment,
|
||||
based on the time they take in comparison to the likelihood
|
||||
that those tests will turn up problems during incremental builds.
|
||||
These tests default to being run when when building from a
|
||||
tarball or with the configure option --enable-expensive-tests;
|
||||
you can also force a one-time toggle of these tests by
|
||||
setting VIR_TEST_EXPENSIVE to 0 or 1 at make time, as in:
|
||||
</p>
|
||||
<pre>
|
||||
make check VIR_TEST_EXPENSIVE=1
|
||||
</pre>
|
||||
<p>
|
||||
If you encounter any failing tests, the VIR_TEST_DEBUG
|
||||
environment variable may provide extra information to debug
|
||||
@ -141,17 +103,6 @@
|
||||
VIR_TEST_DEBUG=1 make check (or)
|
||||
VIR_TEST_DEBUG=2 make check
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
When debugging failures during development, it is possible
|
||||
to focus in on just the failing subtests by using TESTS and
|
||||
VIR_TEST_RANGE:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
make check VIR_TEST_DEBUG=1 VIR_TEST_RANGE=3-5 TESTS=qemuxml2argvtest
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Also, individual tests can be run from inside the <code>tests/</code>
|
||||
directory, like:
|
||||
@ -159,99 +110,7 @@
|
||||
<pre>
|
||||
./qemuxml2xmltest
|
||||
</pre>
|
||||
<p>There is also a <code>./run</code> script at the top level,
|
||||
to make it easier to run programs that have not yet been
|
||||
installed, as well as to wrap invocations of various tests
|
||||
under gdb or Valgrind.
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li><p>The Valgrind test should produce similar output to
|
||||
<code>make check</code>. If the output has traces within libvirt
|
||||
API's, then investigation is required in order to determine the
|
||||
cause of the issue. Output such as the following indicates some
|
||||
sort of leak:
|
||||
</p>
|
||||
<pre>
|
||||
==5414== 4 bytes in 1 blocks are definitely lost in loss record 3 of 89
|
||||
==5414== at 0x4A0881C: malloc (vg_replace_malloc.c:270)
|
||||
==5414== by 0x34DE0AAB85: xmlStrndup (in /usr/lib64/libxml2.so.2.7.8)
|
||||
==5414== by 0x4CC97A6: virDomainVideoDefParseXML (domain_conf.c:7410)
|
||||
==5414== by 0x4CD581D: virDomainDefParseXML (domain_conf.c:10188)
|
||||
==5414== by 0x4CD8C73: virDomainDefParseNode (domain_conf.c:10640)
|
||||
==5414== by 0x4CD8DDB: virDomainDefParse (domain_conf.c:10590)
|
||||
==5414== by 0x41CB1D: testCompareXMLToArgvHelper (qemuxml2argvtest.c:100)
|
||||
==5414== by 0x41E20F: virtTestRun (testutils.c:161)
|
||||
==5414== by 0x41C7CB: mymain (qemuxml2argvtest.c:866)
|
||||
==5414== by 0x41E84A: virtTestMain (testutils.c:723)
|
||||
==5414== by 0x34D9021734: (below main) (in /usr/lib64/libc-2.15.so)
|
||||
</pre>
|
||||
<p>In this example, the <code>virDomainDefParseXML()</code> had
|
||||
an error path where the <code>virDomainVideoDefPtr video</code>
|
||||
pointer was not properly disposed. By simply adding a
|
||||
<code>virDomainVideoDefFree(video);</code> in the error path,
|
||||
the issue was resolved.
|
||||
</p>
|
||||
|
||||
<p>Another common mistake is calling a printing function, such as
|
||||
<code>VIR_DEBUG()</code> without initializing a variable to be
|
||||
printed. The following example involved a call which could return
|
||||
an error, but not set variables passed by reference to the call.
|
||||
The solution was to initialize the variables prior to the call.
|
||||
</p>
|
||||
<pre>
|
||||
==4749== Use of uninitialised value of size 8
|
||||
==4749== at 0x34D904650B: _itoa_word (in /usr/lib64/libc-2.15.so)
|
||||
==4749== by 0x34D9049118: vfprintf (in /usr/lib64/libc-2.15.so)
|
||||
==4749== by 0x34D9108F60: __vasprintf_chk (in /usr/lib64/libc-2.15.so)
|
||||
==4749== by 0x4CAEEF7: virVasprintf (stdio2.h:199)
|
||||
==4749== by 0x4C8A55E: virLogVMessage (virlog.c:814)
|
||||
==4749== by 0x4C8AA96: virLogMessage (virlog.c:751)
|
||||
==4749== by 0x4DA0056: virNetTLSContextCheckCertKeyUsage (virnettlscontext.c:225)
|
||||
==4749== by 0x4DA06DB: virNetTLSContextCheckCert (virnettlscontext.c:439)
|
||||
==4749== by 0x4DA1620: virNetTLSContextNew (virnettlscontext.c:562)
|
||||
==4749== by 0x4DA26FC: virNetTLSContextNewServer (virnettlscontext.c:927)
|
||||
==4749== by 0x409C39: testTLSContextInit (virnettlscontexttest.c:467)
|
||||
==4749== by 0x40AB8F: virtTestRun (testutils.c:161)
|
||||
</pre>
|
||||
<p>Valgrind will also find some false positives or code paths
|
||||
which cannot be resolved by making changes to the libvirt code.
|
||||
For these paths, it is possible to add a filter to avoid the
|
||||
errors. For example:
|
||||
</p>
|
||||
<pre>
|
||||
==4643== 7 bytes in 1 blocks are possibly lost in loss record 4 of 20
|
||||
==4643== at 0x4A0881C: malloc (vg_replace_malloc.c:270)
|
||||
==4643== by 0x34D90853F1: strdup (in /usr/lib64/libc-2.15.so)
|
||||
==4643== by 0x34EEC2C08A: ??? (in /usr/lib64/libnl.so.1.1)
|
||||
==4643== by 0x34EEC15B81: ??? (in /usr/lib64/libnl.so.1.1)
|
||||
==4643== by 0x34D8C0EE15: call_init.part.0 (in /usr/lib64/ld-2.15.so)
|
||||
==4643== by 0x34D8C0EECF: _dl_init (in /usr/lib64/ld-2.15.so)
|
||||
==4643== by 0x34D8C01569: ??? (in /usr/lib64/ld-2.15.so)
|
||||
|
||||
</pre>
|
||||
<p>In this instance, it is acceptable to modify the
|
||||
<code>tests/.valgrind.supp</code> file in order to add a
|
||||
suppression filter. The filter should be unique enough to
|
||||
not suppress real leaks, but it should be generic enough to
|
||||
cover multiple code paths. The format of the entry can be
|
||||
found in the documentation found at the
|
||||
<a href="http://valgrind.org/">Valgrind home page</a>.
|
||||
The following trace was added to <code>tests/.valgrind.supp</code>
|
||||
in order to suppress the warning:
|
||||
</p>
|
||||
<pre>
|
||||
{
|
||||
dlInitMemoryLeak1
|
||||
Memcheck:Leak
|
||||
fun:?alloc
|
||||
...
|
||||
fun:call_init.part.0
|
||||
fun:_dl_init
|
||||
...
|
||||
obj:*/lib*/ld-2.*so*
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
<li>Update tests and/or documentation, particularly if you are adding
|
||||
a new feature or changing the output of a program.</li>
|
||||
@ -261,7 +120,7 @@
|
||||
There is more on this subject, including lots of links to background
|
||||
reading on the subject, on
|
||||
<a href="http://et.redhat.com/~rjones/how-to-supply-code-to-open-source-projects/">
|
||||
Richard Jones' guide to working with open source projects</a>.
|
||||
Richard Jones' guide to working with open source projects</a>
|
||||
</p>
|
||||
|
||||
|
||||
@ -358,7 +217,7 @@
|
||||
<p>
|
||||
The keywords <code>if</code>, <code>for</code>, <code>while</code>,
|
||||
and <code>switch</code> must have a single space following them
|
||||
before the opening bracket. E.g.
|
||||
before the opening bracket. eg
|
||||
</p>
|
||||
<pre>
|
||||
if(foo) // Bad
|
||||
@ -367,7 +226,7 @@
|
||||
|
||||
<p>
|
||||
Function implementations must <strong>not</strong> have any whitespace
|
||||
between the function name and the opening bracket. E.g.
|
||||
between the function name and the opening bracket. eg
|
||||
</p>
|
||||
<pre>
|
||||
int foo (int wizz) // Bad
|
||||
@ -376,7 +235,7 @@
|
||||
|
||||
<p>
|
||||
Function calls must <strong>not</strong> have any whitespace
|
||||
between the function name and the opening bracket. E.g.
|
||||
between the function name and the opening bracket. eg
|
||||
</p>
|
||||
<pre>
|
||||
bar = foo (wizz); // Bad
|
||||
@ -386,7 +245,7 @@
|
||||
<p>
|
||||
Function typedefs must <strong>not</strong> have any whitespace
|
||||
between the closing bracket of the function name and opening
|
||||
bracket of the arg list. E.g.
|
||||
bracket of the arg list. eg
|
||||
</p>
|
||||
<pre>
|
||||
typedef int (*foo) (int wizz); // Bad
|
||||
@ -395,42 +254,13 @@
|
||||
|
||||
<p>
|
||||
There must not be any whitespace immediately following any
|
||||
opening bracket, or immediately prior to any closing bracket. E.g.
|
||||
opening bracket, or immediately prior to any closing bracket
|
||||
</p>
|
||||
<pre>
|
||||
int foo( int wizz ); // Bad
|
||||
int foo(int wizz); // Good
|
||||
</pre>
|
||||
|
||||
<h2><a name="semicolon">Semicolons</a></h2>
|
||||
|
||||
<p>
|
||||
Semicolons should never have a space beforehand. Inside the
|
||||
condition of a <code>for</code> loop, there should always be a
|
||||
space or line break after each semicolon, except for the special
|
||||
case of an infinite loop (although more infinite loops
|
||||
use <code>while</code>). While not enforced, loop counters
|
||||
generally use post-increment.
|
||||
</p>
|
||||
<pre>
|
||||
for (i = 0 ;i < limit ; ++i) { // Bad
|
||||
for (i = 0; i < limit; i++) { // Good
|
||||
for (;;) { // ok
|
||||
while (1) { // Better
|
||||
</pre>
|
||||
<p>
|
||||
Empty loop bodies are better represented with curly braces and a
|
||||
comment, although use of a semicolon is not currently rejected.
|
||||
</p>
|
||||
<pre>
|
||||
while ((rc = waitpid(pid, &st, 0) == -1) &&
|
||||
errno == EINTR); // ok
|
||||
while ((rc = waitpid(pid, &st, 0) == -1) &&
|
||||
errno == EINTR) { // Better
|
||||
/* nothing */
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h2><a name="curly_braces">Curly braces</a></h2>
|
||||
|
||||
<p>
|
||||
@ -450,7 +280,7 @@
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
However, the moment your loop/if/else body extends on to a second
|
||||
However, the moment your loop/if/else body extends onto a second
|
||||
line, for whatever reason (even if it's just an added comment), then
|
||||
you should add braces. Otherwise, it would be too easy to insert a
|
||||
statement just before that comment (without adding braces), thinking
|
||||
@ -573,13 +403,6 @@
|
||||
|
||||
<h2><a name="preprocessor">Preprocessor</a></h2>
|
||||
|
||||
<p>Macros defined with an ALL_CAPS name should generally be
|
||||
assumed to be unsafe with regards to arguments with side-effects
|
||||
(that is, MAX(a++, b--) might increment a or decrement b too
|
||||
many or too few times). Exceptions to this rule are explicitly
|
||||
documented for macros in viralloc.h and virstring.h.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For variadic macros, stick with C99 syntax:
|
||||
</p>
|
||||
@ -677,7 +500,7 @@
|
||||
Use of the malloc/free/realloc/calloc APIs is deprecated in the libvirt
|
||||
codebase, because they encourage a number of serious coding bugs and do
|
||||
not enable compile time verification of checks for NULL. Instead of these
|
||||
routines, use the macros from viralloc.h.
|
||||
routines, use the macros from memory.h.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
@ -686,8 +509,10 @@
|
||||
<pre>
|
||||
virDomainPtr domain;
|
||||
|
||||
if (VIR_ALLOC(domain) < 0)
|
||||
if (VIR_ALLOC(domain) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
|
||||
@ -696,8 +521,10 @@
|
||||
virDomainPtr domains;
|
||||
size_t ndomains = 10;
|
||||
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0)
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
|
||||
@ -706,8 +533,10 @@
|
||||
virDomainPtr *domains;
|
||||
size_t ndomains = 10;
|
||||
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0)
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
|
||||
@ -719,8 +548,10 @@
|
||||
virDomainPtr domains;
|
||||
size_t ndomains = 0;
|
||||
|
||||
if (VIR_EXPAND_N(domains, ndomains, 1) < 0)
|
||||
if (VIR_EXPAND_N(domains, ndomains, 1) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
domains[ndomains - 1] = domain;
|
||||
</pre></li>
|
||||
|
||||
@ -733,8 +564,10 @@
|
||||
size_t ndomains = 0;
|
||||
size_t ndomains_max = 0;
|
||||
|
||||
if (VIR_RESIZE_N(domains, ndomains_max, ndomains, 1) < 0)
|
||||
if (VIR_RESIZE_N(domains, ndomains_max, ndomains, 1) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
domains[ndomains++] = domain;
|
||||
</pre>
|
||||
</li>
|
||||
@ -906,21 +739,6 @@
|
||||
virStrncpy(dest, src, strlen(src), sizeof(dest)).
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
VIR_STRDUP(char *dst, const char *src);
|
||||
VIR_STRNDUP(char *dst, const char *src, size_t n);
|
||||
</pre>
|
||||
<p>
|
||||
You should avoid using strdup or strndup directly as they do not report
|
||||
out-of-memory error, and do not allow a NULL source. Use
|
||||
VIR_STRDUP or VIR_STRNDUP macros instead, which return 0 for
|
||||
NULL source, 1 for successful copy, and -1 for allocation
|
||||
failure with the error already reported. In very
|
||||
specific cases, when you don't want to report the out-of-memory error, you
|
||||
can use VIR_STRDUP_QUIET or VIR_STRNDUP_QUIET, but such usage is very rare
|
||||
and usually considered a flaw.
|
||||
</p>
|
||||
|
||||
<h2><a name="strbuf">Variable length string buffer</a></h2>
|
||||
|
||||
<p>
|
||||
@ -981,7 +799,7 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#if WITH_NUMACTL Some system includes aren't supported
|
||||
#if HAVE_NUMACTL Some system includes aren't supported
|
||||
# include <numa.h> everywhere so need these #if guards.
|
||||
#endif
|
||||
|
||||
@ -997,12 +815,10 @@
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Of particular note: <b>Do not</b> include libvirt/libvirt.h,
|
||||
libvirt/virterror.h, libvirt/libvirt-qemu.h, or libvirt/libvirt-lxc.h.
|
||||
They are included by "internal.h" already and there are some special reasons
|
||||
why you cannot include these files explicitly. One of the special cases,
|
||||
"libvirt/libvirt.h" is included prior to "internal.h" in "remote_protocol.x",
|
||||
to avoid exposing *_LAST enum elements.
|
||||
Of particular note: <b>Do not</b> include libvirt/libvirt.h or
|
||||
libvirt/virterror.h. It is included by "internal.h" already and there
|
||||
are some special reasons why you cannot include these files
|
||||
explicitly.
|
||||
</p>
|
||||
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output method="xml" encoding="UTF-8" indent="no"/>
|
||||
|
||||
@ -23,18 +21,8 @@
|
||||
|
||||
<!-- resolve b/i/code tags in a first pass, because they interfere with line
|
||||
wrapping in the second pass -->
|
||||
<xsl:template match="html:b">*<xsl:apply-templates/>*</xsl:template>
|
||||
<xsl:template match="html:i">'<xsl:apply-templates/>'</xsl:template>
|
||||
<xsl:template match="html:code">"<xsl:apply-templates/>"</xsl:template>
|
||||
|
||||
<!-- likewise, reformat a tags in first pass -->
|
||||
<xsl:template match="html:a">
|
||||
<xsl:text> </xsl:text><xsl:apply-templates/>
|
||||
<xsl:if test="@href">
|
||||
<xsl:text> <</xsl:text><xsl:value-of select="@href"/>
|
||||
<xsl:text>></xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="b">*<xsl:apply-templates/>*</xsl:template>
|
||||
<xsl:template match="i">'<xsl:apply-templates/>'</xsl:template>
|
||||
<xsl:template match="code">"<xsl:apply-templates/>"</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:import href="wrapstring.xsl"/>
|
||||
|
||||
@ -32,7 +30,7 @@ from docs/hacking.html.in!
|
||||
|
||||
|
||||
<!-- title -->
|
||||
<xsl:template match="html:h1">
|
||||
<xsl:template match="h1">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="normalize-space(.)"/>
|
||||
<xsl:text>
|
||||
@ -67,14 +65,14 @@ from docs/hacking.html.in!
|
||||
|
||||
|
||||
|
||||
<xsl:template match="html:h2">
|
||||
<xsl:template match="h2">
|
||||
<xsl:value-of select="$newline"/>
|
||||
<xsl:call-template name="underline"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template match="html:h3">
|
||||
<xsl:template match="h3">
|
||||
<xsl:call-template name="underline">
|
||||
<xsl:with-param name="char" select="'-'"/>
|
||||
</xsl:call-template>
|
||||
@ -93,13 +91,13 @@ from docs/hacking.html.in!
|
||||
|
||||
|
||||
|
||||
<xsl:template match="html:ol|html:ul|html:p">
|
||||
<xsl:template match="ol|ul|p">
|
||||
<xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template match="html:ol/html:li">
|
||||
<xsl:template match="ol/li">
|
||||
<xsl:choose>
|
||||
<xsl:when test=".//node()[position()=last()]/self::pre">(<xsl:value-of select="position()"/>) <xsl:apply-templates/>
|
||||
</xsl:when>
|
||||
@ -111,23 +109,23 @@ from docs/hacking.html.in!
|
||||
|
||||
|
||||
|
||||
<xsl:template match="html:ul/html:li">- <xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
|
||||
<xsl:template match="ul/li">- <xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template match="html:li/html:ul/html:li">-- <xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
|
||||
<xsl:template match="li/ul/li">-- <xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<!-- add newline before nested <ul> -->
|
||||
<xsl:template match="html:li/html:ul"><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/><xsl:apply-templates/>
|
||||
<xsl:template match="li/ul"><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/><xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template match="html:pre">
|
||||
<xsl:template match="pre">
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with(.,'
')"><xsl:value-of select="substring(.,2)"/><xsl:value-of select="$newline"/>
|
||||
</xsl:when>
|
||||
@ -138,4 +136,12 @@ from docs/hacking.html.in!
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template match="a">
|
||||
<xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
|
||||
<xsl:text> </xsl:text><xsl:apply-templates/>
|
||||
<xsl:value-of select="$newline"/>
|
||||
<xsl:text> </xsl:text><xsl:value-of select="@href"/>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Hooks for specific system management</h1>
|
||||
|
||||
@ -240,14 +239,13 @@
|
||||
<p>If a hook script returns with an exit code of 0, the libvirt daemon
|
||||
regards this as successful and performs no logging of it.</p>
|
||||
<p>However, if a hook script returns with a non zero exit code, the libvirt
|
||||
daemon regards this as a failure, logs its return code, and
|
||||
daemon regards this as a failure, logs it with return code 256, and
|
||||
additionally logs anything on stderr the hook script returns.</p>
|
||||
<p>For example, a hook script might use this code to indicate failure,
|
||||
and send a text string to stderr:</p>
|
||||
<pre>echo "Could not find required XYZZY" >&2
|
||||
exit 1</pre>
|
||||
<p>The resulting entry in the libvirt log will appear as:</p>
|
||||
<pre>20:02:40.297: error : virHookCall:285 : Hook script execution failed: internal error Child process (LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
HOME=/root USER=root LOGNAME=root /etc/libvirt/hooks/qemu qemu prepare begin -) unexpected exit status 1: Could not find required XYZZY</pre>
|
||||
<pre>20:02:40.297: error : virHookCall:416 : Hook script execution failed: Hook script /etc/libvirt/hooks/qemu qemu failed with error code 256:Could not find required XYZZY</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -11,14 +11,13 @@ my $srcdir = shift @ARGV;
|
||||
|
||||
my $symslibvirt = "$srcdir/libvirt_public.syms";
|
||||
my $symsqemu = "$srcdir/libvirt_qemu.syms";
|
||||
my $symslxc = "$srcdir/libvirt_lxc.syms";
|
||||
my $drivertable = "$srcdir/driver.h";
|
||||
|
||||
my %groupheaders = (
|
||||
"virDriver" => "Hypervisor APIs",
|
||||
"virNetworkDriver" => "Virtual Network APIs",
|
||||
"virInterfaceDriver" => "Host Interface APIs",
|
||||
"virNodeDeviceDriver" => "Host Device APIs",
|
||||
"virDeviceMonitor" => "Host Device APIs",
|
||||
"virStorageDriver" => "Storage Pool APIs",
|
||||
"virSecretDriver" => "Secret APIs",
|
||||
"virNWFilterDriver" => "Network Filter APIs",
|
||||
@ -113,48 +112,9 @@ while (defined($line = <FILE>)) {
|
||||
close FILE;
|
||||
|
||||
|
||||
# And the same for the LXC specific APIs
|
||||
|
||||
open FILE, "<$symslxc"
|
||||
or die "cannot read $symslxc: $!";
|
||||
|
||||
$prevvers = undef;
|
||||
$vers = undef;
|
||||
while (defined($line = <FILE>)) {
|
||||
chomp $line;
|
||||
next if $line =~ /^\s*#/;
|
||||
next if $line =~ /^\s*$/;
|
||||
next if $line =~ /^\s*(global|local):/;
|
||||
if ($line =~ /^\s*LIBVIRT_LXC_(\d+\.\d+\.\d+)\s*{\s*$/) {
|
||||
if (defined $vers) {
|
||||
die "malformed syms file";
|
||||
}
|
||||
$vers = $1;
|
||||
} elsif ($line =~ /\s*}\s*;\s*$/) {
|
||||
if (defined $prevvers) {
|
||||
die "malformed syms file";
|
||||
}
|
||||
$prevvers = $vers;
|
||||
$vers = undef;
|
||||
} elsif ($line =~ /\s*}\s*LIBVIRT_LXC_(\d+\.\d+\.\d+)\s*;\s*$/) {
|
||||
if ($1 ne $prevvers) {
|
||||
die "malformed syms file $1 != $vers";
|
||||
}
|
||||
$prevvers = $vers;
|
||||
$vers = undef;
|
||||
} elsif ($line =~ /\s*(\w+)\s*;\s*$/) {
|
||||
$apis{$1} = $vers;
|
||||
} else {
|
||||
die "unexpected data $line\n";
|
||||
}
|
||||
}
|
||||
|
||||
close FILE;
|
||||
|
||||
|
||||
# Some special things which aren't public APIs,
|
||||
# but we want to report
|
||||
$apis{virConnectSupportsFeature} = "0.3.2";
|
||||
$apis{virConnectDrvSupportsFeature} = "0.3.2";
|
||||
$apis{virDomainMigratePrepare} = "0.3.2";
|
||||
$apis{virDomainMigratePerform} = "0.3.2";
|
||||
$apis{virDomainMigrateFinish} = "0.3.2";
|
||||
@ -169,13 +129,6 @@ $apis{virDomainMigratePerform3} = "0.9.2";
|
||||
$apis{virDomainMigrateFinish3} = "0.9.2";
|
||||
$apis{virDomainMigrateConfirm3} = "0.9.2";
|
||||
|
||||
$apis{virDomainMigrateBegin3Params} = "1.1.0";
|
||||
$apis{virDomainMigratePrepare3Params} = "1.1.0";
|
||||
$apis{virDomainMigratePrepareTunnel3Params} = "1.1.0";
|
||||
$apis{virDomainMigratePerform3Params} = "1.1.0";
|
||||
$apis{virDomainMigrateFinish3Params} = "1.1.0";
|
||||
$apis{virDomainMigrateConfirm3Params} = "1.1.0";
|
||||
|
||||
|
||||
|
||||
# Now we want to get the mapping between public APIs
|
||||
@ -189,7 +142,7 @@ open FILE, "<$drivertable"
|
||||
my %groups;
|
||||
my $ingrp;
|
||||
while (defined($line = <FILE>)) {
|
||||
if ($line =~ /struct _(vir\w*Driver)/) {
|
||||
if ($line =~ /struct _(vir\w*(?:Driver|Monitor))/) {
|
||||
my $grp = $1;
|
||||
if ($grp ne "virStateDriver" &&
|
||||
$grp ne "virStreamDriver") {
|
||||
@ -197,15 +150,17 @@ while (defined($line = <FILE>)) {
|
||||
$groups{$ingrp} = { apis => {}, drivers => {} };
|
||||
}
|
||||
} elsif ($ingrp) {
|
||||
if ($line =~ /^\s*vir(?:Drv)(\w+)\s+(\w+);\s*$/) {
|
||||
if ($line =~ /^\s*vir(?:Drv|DevMon)(\w+)\s+(\w+);\s*$/) {
|
||||
my $field = $2;
|
||||
my $name = $1;
|
||||
|
||||
my $api;
|
||||
if (exists $apis{"vir$name"}) {
|
||||
$api = "vir$name";
|
||||
} elsif ($name =~ /\w+(Open|Close)/) {
|
||||
next;
|
||||
} elsif (exists $apis{"virConnect$name"}) {
|
||||
$api = "virConnect$name";
|
||||
} elsif (exists $apis{"virNode$name"}) {
|
||||
$api = "virNode$name";
|
||||
} else {
|
||||
die "driver $name does not have a public API";
|
||||
}
|
||||
@ -263,8 +218,6 @@ foreach my $src (@srcs) {
|
||||
die "Driver method for $api is NULL in $src" if $meth eq "NULL";
|
||||
|
||||
if (!exists($groups{$ingrp}->{apis}->{$api})) {
|
||||
next if $api =~ /\w(Open|Close)/;
|
||||
|
||||
die "Found unexpected method $api in $ingrp\n";
|
||||
}
|
||||
|
||||
@ -297,24 +250,24 @@ $groups{virDriver}->{apis}->{"domainMigrate"} = "virDomainMigrate";
|
||||
my $openAuthVers = (0 * 1000 * 1000) + (4 * 1000) + 0;
|
||||
|
||||
foreach my $drv (keys %{$groups{"virDriver"}->{drivers}}) {
|
||||
my $openVersStr = $groups{"virDriver"}->{drivers}->{$drv}->{"connectOpen"};
|
||||
my $openVersStr = $groups{"virDriver"}->{drivers}->{$drv}->{"open"};
|
||||
my $openVers;
|
||||
if ($openVersStr =~ /(\d+)\.(\d+)\.(\d+)/) {
|
||||
$openVers = ($1 * 1000 * 1000) + ($2 * 1000) + $3;
|
||||
}
|
||||
|
||||
# virConnectOpenReadOnly always matches virConnectOpen version
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"connectOpenReadOnly"} =
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"connectOpen"};
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"openReadOnly"} =
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"open"};
|
||||
|
||||
# virConnectOpenAuth is always 0.4.0 if the driver existed
|
||||
# before this time, otherwise it matches the version of
|
||||
# the driver's virConnectOpen entry
|
||||
if ($openVersStr eq "Y" ||
|
||||
$openVers >= $openAuthVers) {
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"connectOpenAuth"} = $openVersStr;
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"openAuth"} = $openVersStr;
|
||||
} else {
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"connectOpenAuth"} = "0.4.0";
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"openAuth"} = "0.4.0";
|
||||
}
|
||||
}
|
||||
|
||||
@ -348,9 +301,7 @@ foreach my $drv (keys %{$groups{"virDriver"}->{drivers}}) {
|
||||
# Finally we generate the HTML file with the tables
|
||||
|
||||
print <<EOF;
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<head>
|
||||
<title>libvirt API support matrix</title>
|
||||
</head>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>The virtualization API</h1>
|
||||
|
||||
@ -63,12 +62,6 @@
|
||||
<li>
|
||||
The <a href="http://libvirt.org/drvhyperv.html">Microsoft Hyper-V</a> hypervisor
|
||||
</li>
|
||||
<li>
|
||||
The <a href="http://libvirt.org/drvphyp.html">IBM PowerVM</a> hypervisor
|
||||
</li>
|
||||
<li>
|
||||
The <a href="http://libvirt.org/drvparallels.html">Parallels</a> hypervisor
|
||||
</li>
|
||||
<li>
|
||||
Virtual networks using bridging, NAT, VEPA and VN-LINK.
|
||||
</li>
|
||||
|
210
docs/index.py
210
docs/index.py
@ -127,9 +127,9 @@ DB=None
|
||||
def createTable(db, name):
|
||||
global TABLES
|
||||
|
||||
if db is None:
|
||||
if db == None:
|
||||
return -1
|
||||
if name is None:
|
||||
if name == None:
|
||||
return -1
|
||||
c = db.cursor()
|
||||
|
||||
@ -147,7 +147,7 @@ def createTable(db, name):
|
||||
def checkTables(db, verbose = 1):
|
||||
global TABLES
|
||||
|
||||
if db is None:
|
||||
if db == None:
|
||||
return -1
|
||||
c = db.cursor()
|
||||
nbtables = c.execute("show tables")
|
||||
@ -166,15 +166,15 @@ def checkTables(db, verbose = 1):
|
||||
print "table %s missing" % (table)
|
||||
createTable(db, table)
|
||||
try:
|
||||
ret = c.execute("SELECT count(*) from %s" % table)
|
||||
ret = c.execute("SELECT count(*) from %s" % table);
|
||||
row = c.fetchone()
|
||||
if verbose:
|
||||
print "Table %s contains %d records" % (table, row[0])
|
||||
except:
|
||||
print "Troubles with table %s : repairing" % (table)
|
||||
ret = c.execute("repair table %s" % table)
|
||||
ret = c.execute("repair table %s" % table);
|
||||
print "repairing returned %d" % (ret)
|
||||
ret = c.execute("SELECT count(*) from %s" % table)
|
||||
ret = c.execute("SELECT count(*) from %s" % table);
|
||||
row = c.fetchone()
|
||||
print "Table %s contains %d records" % (table, row[0])
|
||||
if verbose:
|
||||
@ -191,7 +191,7 @@ def checkTables(db, verbose = 1):
|
||||
def openMySQL(db="libvir", passwd=None, verbose = 1):
|
||||
global DB
|
||||
|
||||
if passwd is None:
|
||||
if passwd == None:
|
||||
try:
|
||||
passwd = os.environ["MySQL_PASS"]
|
||||
except:
|
||||
@ -199,7 +199,7 @@ def openMySQL(db="libvir", passwd=None, verbose = 1):
|
||||
sys.exit(1)
|
||||
|
||||
DB = MySQLdb.connect(passwd=passwd, db=db)
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
return -1
|
||||
ret = checkTables(DB, verbose)
|
||||
return ret
|
||||
@ -207,13 +207,13 @@ def openMySQL(db="libvir", passwd=None, verbose = 1):
|
||||
def updateWord(name, symbol, relevance):
|
||||
global DB
|
||||
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
openMySQL()
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
return -1
|
||||
if name is None:
|
||||
if name == None:
|
||||
return -1
|
||||
if symbol is None:
|
||||
if symbol == None:
|
||||
return -1
|
||||
|
||||
c = DB.cursor()
|
||||
@ -238,15 +238,15 @@ def updateSymbol(name, module, type, desc):
|
||||
global DB
|
||||
|
||||
updateWord(name, name, 50)
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
openMySQL()
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
return -1
|
||||
if name is None:
|
||||
if name == None:
|
||||
return -1
|
||||
if module is None:
|
||||
if module == None:
|
||||
return -1
|
||||
if type is None:
|
||||
if type == None:
|
||||
return -1
|
||||
|
||||
try:
|
||||
@ -299,11 +299,11 @@ def addFunctype(name, module, desc = ""):
|
||||
def addPage(resource, title):
|
||||
global DB
|
||||
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
openMySQL()
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
return -1
|
||||
if resource is None:
|
||||
if resource == None:
|
||||
return -1
|
||||
|
||||
c = DB.cursor()
|
||||
@ -327,17 +327,17 @@ def addPage(resource, title):
|
||||
def updateWordHTML(name, resource, desc, id, relevance):
|
||||
global DB
|
||||
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
openMySQL()
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
return -1
|
||||
if name is None:
|
||||
if name == None:
|
||||
return -1
|
||||
if resource is None:
|
||||
if resource == None:
|
||||
return -1
|
||||
if id is None:
|
||||
if id == None:
|
||||
id = ""
|
||||
if desc is None:
|
||||
if desc == None:
|
||||
desc = ""
|
||||
else:
|
||||
try:
|
||||
@ -367,11 +367,11 @@ def updateWordHTML(name, resource, desc, id, relevance):
|
||||
def checkXMLMsgArchive(url):
|
||||
global DB
|
||||
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
openMySQL()
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
return -1
|
||||
if url is None:
|
||||
if url == None:
|
||||
return -1
|
||||
|
||||
c = DB.cursor()
|
||||
@ -379,7 +379,7 @@ def checkXMLMsgArchive(url):
|
||||
ret = c.execute(
|
||||
"""SELECT ID FROM archives WHERE resource='%s'""" % (url))
|
||||
row = c.fetchone()
|
||||
if row is None:
|
||||
if row == None:
|
||||
return -1
|
||||
except:
|
||||
return -1
|
||||
@ -389,13 +389,13 @@ def checkXMLMsgArchive(url):
|
||||
def addXMLMsgArchive(url, title):
|
||||
global DB
|
||||
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
openMySQL()
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
return -1
|
||||
if url is None:
|
||||
if url == None:
|
||||
return -1
|
||||
if title is None:
|
||||
if title == None:
|
||||
title = ""
|
||||
else:
|
||||
title = string.replace(title, "'", " ")
|
||||
@ -408,7 +408,7 @@ def addXMLMsgArchive(url, title):
|
||||
cmd = """SELECT ID FROM archives WHERE resource='%s'""" % (url)
|
||||
ret = c.execute(cmd)
|
||||
row = c.fetchone()
|
||||
if row is None:
|
||||
if row == None:
|
||||
print "addXMLMsgArchive failed to get the ID: %s" % (url)
|
||||
return -1
|
||||
except:
|
||||
@ -420,13 +420,13 @@ def addXMLMsgArchive(url, title):
|
||||
def updateWordArchive(name, id, relevance):
|
||||
global DB
|
||||
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
openMySQL()
|
||||
if DB is None:
|
||||
if DB == None:
|
||||
return -1
|
||||
if name is None:
|
||||
if name == None:
|
||||
return -1
|
||||
if id is None:
|
||||
if id == None:
|
||||
return -1
|
||||
|
||||
c = DB.cursor()
|
||||
@ -533,9 +533,9 @@ def splitIdentifier(str):
|
||||
def addWord(word, module, symbol, relevance):
|
||||
global wordsDict
|
||||
|
||||
if word is None or len(word) < 3:
|
||||
if word == None or len(word) < 3:
|
||||
return -1
|
||||
if module is None or symbol is None:
|
||||
if module == None or symbol == None:
|
||||
return -1
|
||||
if dropWords.has_key(word):
|
||||
return 0
|
||||
@ -544,7 +544,7 @@ def addWord(word, module, symbol, relevance):
|
||||
|
||||
if wordsDict.has_key(word):
|
||||
d = wordsDict[word]
|
||||
if d is None:
|
||||
if d == None:
|
||||
return 0
|
||||
if len(d) > 500:
|
||||
wordsDict[word] = None
|
||||
@ -559,7 +559,7 @@ def addWord(word, module, symbol, relevance):
|
||||
return relevance
|
||||
|
||||
def addString(str, module, symbol, relevance):
|
||||
if str is None or len(str) < 3:
|
||||
if str == None or len(str) < 3:
|
||||
return -1
|
||||
ret = 0
|
||||
str = cleanupWordsString(str)
|
||||
@ -573,9 +573,9 @@ def addString(str, module, symbol, relevance):
|
||||
def addWordHTML(word, resource, id, section, relevance):
|
||||
global wordsDictHTML
|
||||
|
||||
if word is None or len(word) < 3:
|
||||
if word == None or len(word) < 3:
|
||||
return -1
|
||||
if resource is None or section is None:
|
||||
if resource == None or section == None:
|
||||
return -1
|
||||
if dropWords.has_key(word):
|
||||
return 0
|
||||
@ -586,26 +586,26 @@ def addWordHTML(word, resource, id, section, relevance):
|
||||
|
||||
if wordsDictHTML.has_key(word):
|
||||
d = wordsDictHTML[word]
|
||||
if d is None:
|
||||
if d == None:
|
||||
print "skipped %s" % (word)
|
||||
return 0
|
||||
try:
|
||||
(r,i,s) = d[resource]
|
||||
if i is not None:
|
||||
if i != None:
|
||||
id = i
|
||||
if s is not None:
|
||||
if s != None:
|
||||
section = s
|
||||
relevance = relevance + r
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
wordsDictHTML[word] = {}
|
||||
d = wordsDictHTML[word]
|
||||
d = wordsDictHTML[word];
|
||||
d[resource] = (relevance, id, section)
|
||||
return relevance
|
||||
|
||||
def addStringHTML(str, resource, id, section, relevance):
|
||||
if str is None or len(str) < 3:
|
||||
if str == None or len(str) < 3:
|
||||
return -1
|
||||
ret = 0
|
||||
str = cleanupWordsString(str)
|
||||
@ -626,9 +626,9 @@ def addStringHTML(str, resource, id, section, relevance):
|
||||
def addWordArchive(word, id, relevance):
|
||||
global wordsDictArchive
|
||||
|
||||
if word is None or len(word) < 3:
|
||||
if word == None or len(word) < 3:
|
||||
return -1
|
||||
if id is None or id == -1:
|
||||
if id == None or id == -1:
|
||||
return -1
|
||||
if dropWords.has_key(word):
|
||||
return 0
|
||||
@ -637,7 +637,7 @@ def addWordArchive(word, id, relevance):
|
||||
|
||||
if wordsDictArchive.has_key(word):
|
||||
d = wordsDictArchive[word]
|
||||
if d is None:
|
||||
if d == None:
|
||||
print "skipped %s" % (word)
|
||||
return 0
|
||||
try:
|
||||
@ -647,12 +647,12 @@ def addWordArchive(word, id, relevance):
|
||||
pass
|
||||
else:
|
||||
wordsDictArchive[word] = {}
|
||||
d = wordsDictArchive[word]
|
||||
d = wordsDictArchive[word];
|
||||
d[id] = relevance
|
||||
return relevance
|
||||
|
||||
def addStringArchive(str, id, relevance):
|
||||
if str is None or len(str) < 3:
|
||||
if str == None or len(str) < 3:
|
||||
return -1
|
||||
ret = 0
|
||||
str = cleanupWordsString(str)
|
||||
@ -683,9 +683,9 @@ def loadAPI(filename):
|
||||
return doc
|
||||
|
||||
def foundExport(file, symbol):
|
||||
if file is None:
|
||||
if file == None:
|
||||
return 0
|
||||
if symbol is None:
|
||||
if symbol == None:
|
||||
return 0
|
||||
addFunction(symbol, file)
|
||||
l = splitIdentifier(symbol)
|
||||
@ -697,7 +697,7 @@ def analyzeAPIFile(top):
|
||||
count = 0
|
||||
name = top.prop("name")
|
||||
cur = top.children
|
||||
while cur is not None:
|
||||
while cur != None:
|
||||
if cur.type == 'text':
|
||||
cur = cur.next
|
||||
continue
|
||||
@ -712,7 +712,7 @@ def analyzeAPIFiles(top):
|
||||
count = 0
|
||||
cur = top.children
|
||||
|
||||
while cur is not None:
|
||||
while cur != None:
|
||||
if cur.type == 'text':
|
||||
cur = cur.next
|
||||
continue
|
||||
@ -725,10 +725,10 @@ def analyzeAPIFiles(top):
|
||||
|
||||
def analyzeAPIEnum(top):
|
||||
file = top.prop("file")
|
||||
if file is None:
|
||||
if file == None:
|
||||
return 0
|
||||
symbol = top.prop("name")
|
||||
if symbol is None:
|
||||
if symbol == None:
|
||||
return 0
|
||||
|
||||
addEnum(symbol, file)
|
||||
@ -740,10 +740,10 @@ def analyzeAPIEnum(top):
|
||||
|
||||
def analyzeAPIConst(top):
|
||||
file = top.prop("file")
|
||||
if file is None:
|
||||
if file == None:
|
||||
return 0
|
||||
symbol = top.prop("name")
|
||||
if symbol is None:
|
||||
if symbol == None:
|
||||
return 0
|
||||
|
||||
addConst(symbol, file)
|
||||
@ -755,10 +755,10 @@ def analyzeAPIConst(top):
|
||||
|
||||
def analyzeAPIType(top):
|
||||
file = top.prop("file")
|
||||
if file is None:
|
||||
if file == None:
|
||||
return 0
|
||||
symbol = top.prop("name")
|
||||
if symbol is None:
|
||||
if symbol == None:
|
||||
return 0
|
||||
|
||||
addType(symbol, file)
|
||||
@ -769,10 +769,10 @@ def analyzeAPIType(top):
|
||||
|
||||
def analyzeAPIFunctype(top):
|
||||
file = top.prop("file")
|
||||
if file is None:
|
||||
if file == None:
|
||||
return 0
|
||||
symbol = top.prop("name")
|
||||
if symbol is None:
|
||||
if symbol == None:
|
||||
return 0
|
||||
|
||||
addFunctype(symbol, file)
|
||||
@ -783,10 +783,10 @@ def analyzeAPIFunctype(top):
|
||||
|
||||
def analyzeAPIStruct(top):
|
||||
file = top.prop("file")
|
||||
if file is None:
|
||||
if file == None:
|
||||
return 0
|
||||
symbol = top.prop("name")
|
||||
if symbol is None:
|
||||
if symbol == None:
|
||||
return 0
|
||||
|
||||
addStruct(symbol, file)
|
||||
@ -795,7 +795,7 @@ def analyzeAPIStruct(top):
|
||||
addWord(word, file, symbol, 10)
|
||||
|
||||
info = top.prop("info")
|
||||
if info is not None:
|
||||
if info != None:
|
||||
info = string.replace(info, "'", " ")
|
||||
info = string.strip(info)
|
||||
l = string.split(info)
|
||||
@ -806,17 +806,17 @@ def analyzeAPIStruct(top):
|
||||
|
||||
def analyzeAPIMacro(top):
|
||||
file = top.prop("file")
|
||||
if file is None:
|
||||
if file == None:
|
||||
return 0
|
||||
symbol = top.prop("name")
|
||||
if symbol is None:
|
||||
if symbol == None:
|
||||
return 0
|
||||
symbol = string.replace(symbol, "'", " ")
|
||||
symbol = string.strip(symbol)
|
||||
|
||||
info = None
|
||||
cur = top.children
|
||||
while cur is not None:
|
||||
while cur != None:
|
||||
if cur.type == 'text':
|
||||
cur = cur.next
|
||||
continue
|
||||
@ -829,7 +829,7 @@ def analyzeAPIMacro(top):
|
||||
for word in l:
|
||||
addWord(word, file, symbol, 10)
|
||||
|
||||
if info is None:
|
||||
if info == None:
|
||||
addMacro(symbol, file)
|
||||
print "Macro %s description has no <info>" % (symbol)
|
||||
return 0
|
||||
@ -845,17 +845,17 @@ def analyzeAPIMacro(top):
|
||||
|
||||
def analyzeAPIFunction(top):
|
||||
file = top.prop("file")
|
||||
if file is None:
|
||||
if file == None:
|
||||
return 0
|
||||
symbol = top.prop("name")
|
||||
if symbol is None:
|
||||
if symbol == None:
|
||||
return 0
|
||||
|
||||
symbol = string.replace(symbol, "'", " ")
|
||||
symbol = string.strip(symbol)
|
||||
info = None
|
||||
cur = top.children
|
||||
while cur is not None:
|
||||
while cur != None:
|
||||
if cur.type == 'text':
|
||||
cur = cur.next
|
||||
continue
|
||||
@ -863,23 +863,23 @@ def analyzeAPIFunction(top):
|
||||
info = cur.content
|
||||
elif cur.name == "return":
|
||||
rinfo = cur.prop("info")
|
||||
if rinfo is not None:
|
||||
if rinfo != None:
|
||||
rinfo = string.replace(rinfo, "'", " ")
|
||||
rinfo = string.strip(rinfo)
|
||||
addString(rinfo, file, symbol, 7)
|
||||
elif cur.name == "arg":
|
||||
ainfo = cur.prop("info")
|
||||
if ainfo is not None:
|
||||
if ainfo != None:
|
||||
ainfo = string.replace(ainfo, "'", " ")
|
||||
ainfo = string.strip(ainfo)
|
||||
addString(ainfo, file, symbol, 5)
|
||||
name = cur.prop("name")
|
||||
if name is not None:
|
||||
if name != None:
|
||||
name = string.replace(name, "'", " ")
|
||||
name = string.strip(name)
|
||||
addWord(name, file, symbol, 7)
|
||||
cur = cur.next
|
||||
if info is None:
|
||||
if info == None:
|
||||
print "Function %s description has no <info>" % (symbol)
|
||||
addFunction(symbol, file, "")
|
||||
else:
|
||||
@ -898,7 +898,7 @@ def analyzeAPISymbols(top):
|
||||
count = 0
|
||||
cur = top.children
|
||||
|
||||
while cur is not None:
|
||||
while cur != None:
|
||||
if cur.type == 'text':
|
||||
cur = cur.next
|
||||
continue
|
||||
@ -923,14 +923,14 @@ def analyzeAPISymbols(top):
|
||||
|
||||
def analyzeAPI(doc):
|
||||
count = 0
|
||||
if doc is None:
|
||||
if doc == None:
|
||||
return -1
|
||||
root = doc.getRootElement()
|
||||
if root.name != "api":
|
||||
print "Unexpected root name"
|
||||
return -1
|
||||
cur = root.children
|
||||
while cur is not None:
|
||||
while cur != None:
|
||||
if cur.type == 'text':
|
||||
cur = cur.next
|
||||
continue
|
||||
@ -989,7 +989,7 @@ def analyzeHTML(doc, resource, p, section, id):
|
||||
return words
|
||||
|
||||
def analyzeHTML(doc, resource):
|
||||
para = 0
|
||||
para = 0;
|
||||
ctxt = doc.xpathNewContext()
|
||||
try:
|
||||
res = ctxt.xpathEval("//head/title")
|
||||
@ -1056,7 +1056,7 @@ def analyzeHTMLPages():
|
||||
import time
|
||||
|
||||
def getXMLDateArchive(t = None):
|
||||
if t is None:
|
||||
if t == None:
|
||||
t = time.time()
|
||||
T = time.gmtime(t)
|
||||
month = time.strftime("%B", T)
|
||||
@ -1065,7 +1065,7 @@ def getXMLDateArchive(t = None):
|
||||
return url
|
||||
|
||||
def scanXMLMsgArchive(url, title, force = 0):
|
||||
if url is None or title is None:
|
||||
if url == None or title == None:
|
||||
return 0
|
||||
|
||||
ID = checkXMLMsgArchive(url)
|
||||
@ -1079,10 +1079,10 @@ def scanXMLMsgArchive(url, title, force = 0):
|
||||
|
||||
try:
|
||||
print "Loading %s" % (url)
|
||||
doc = libxml2.htmlParseFile(url, None)
|
||||
doc = libxml2.htmlParseFile(url, None);
|
||||
except:
|
||||
doc = None
|
||||
if doc is None:
|
||||
if doc == None:
|
||||
print "Failed to parse %s" % (url)
|
||||
return 0
|
||||
|
||||
@ -1102,10 +1102,10 @@ def scanXMLDateArchive(t = None, force = 0):
|
||||
url = getXMLDateArchive(t)
|
||||
print "loading %s" % (url)
|
||||
try:
|
||||
doc = libxml2.htmlParseFile(url, None)
|
||||
doc = libxml2.htmlParseFile(url, None);
|
||||
except:
|
||||
doc = None
|
||||
if doc is None:
|
||||
if doc == None:
|
||||
print "Failed to parse %s" % (url)
|
||||
return -1
|
||||
ctxt = doc.xpathNewContext()
|
||||
@ -1114,16 +1114,16 @@ def scanXMLDateArchive(t = None, force = 0):
|
||||
newmsg = 0
|
||||
for anchor in anchors:
|
||||
href = anchor.prop("href")
|
||||
if href is None or href[0:3] != "msg":
|
||||
if href == None or href[0:3] != "msg":
|
||||
continue
|
||||
try:
|
||||
links = links + 1
|
||||
|
||||
msg = libxml2.buildURI(href, url)
|
||||
title = anchor.content
|
||||
if title is not None and title[0:4] == 'Re: ':
|
||||
if title != None and title[0:4] == 'Re: ':
|
||||
title = title[4:]
|
||||
if title is not None and title[0:6] == '[xml] ':
|
||||
if title != None and title[0:6] == '[xml] ':
|
||||
title = title[6:]
|
||||
newmsg = newmsg + scanXMLMsgArchive(msg, title, force)
|
||||
|
||||
@ -1148,9 +1148,9 @@ def analyzeArchives(t = None, force = 0):
|
||||
skipped = 0
|
||||
for word in wordsDictArchive.keys():
|
||||
refs = wordsDictArchive[word]
|
||||
if refs is None:
|
||||
if refs == None:
|
||||
skipped = skipped + 1
|
||||
continue
|
||||
continue;
|
||||
for id in refs.keys():
|
||||
relevance = refs[id]
|
||||
updateWordArchive(word, id, relevance)
|
||||
@ -1168,9 +1168,9 @@ def analyzeHTMLTop():
|
||||
skipped = 0
|
||||
for word in wordsDictHTML.keys():
|
||||
refs = wordsDictHTML[word]
|
||||
if refs is None:
|
||||
if refs == None:
|
||||
skipped = skipped + 1
|
||||
continue
|
||||
continue;
|
||||
for resource in refs.keys():
|
||||
(relevance, id, section) = refs[resource]
|
||||
updateWordHTML(word, resource, section, id, relevance)
|
||||
@ -1197,9 +1197,9 @@ def analyzeAPITop():
|
||||
skipped = 0
|
||||
for word in wordsDict.keys():
|
||||
refs = wordsDict[word]
|
||||
if refs is None:
|
||||
if refs == None:
|
||||
skipped = skipped + 1
|
||||
continue
|
||||
continue;
|
||||
for (module, symbol) in refs.keys():
|
||||
updateWord(word, symbol, refs[(module, symbol)])
|
||||
i = i + 1
|
||||
@ -1228,26 +1228,26 @@ def main():
|
||||
elif args[i] == '--archive':
|
||||
analyzeArchives(None, force)
|
||||
elif args[i] == '--archive-year':
|
||||
i = i + 1
|
||||
i = i + 1;
|
||||
year = args[i]
|
||||
months = ["January" , "February", "March", "April", "May",
|
||||
"June", "July", "August", "September", "October",
|
||||
"November", "December"]
|
||||
"November", "December"];
|
||||
for month in months:
|
||||
try:
|
||||
str = "%s-%s" % (year, month)
|
||||
T = time.strptime(str, "%Y-%B")
|
||||
t = time.mktime(T) + 3600 * 24 * 10
|
||||
t = time.mktime(T) + 3600 * 24 * 10;
|
||||
analyzeArchives(t, force)
|
||||
except:
|
||||
print "Failed to index month archive:"
|
||||
print sys.exc_type, sys.exc_value
|
||||
elif args[i] == '--archive-month':
|
||||
i = i + 1
|
||||
i = i + 1;
|
||||
month = args[i]
|
||||
try:
|
||||
T = time.strptime(month, "%Y-%B")
|
||||
t = time.mktime(T) + 3600 * 24 * 10
|
||||
t = time.mktime(T) + 3600 * 24 * 10;
|
||||
analyzeArchives(t, force)
|
||||
except:
|
||||
print "Failed to index month archive:"
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>libvirt internals</h1>
|
||||
|
||||
@ -11,106 +9,12 @@
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Introduction to basic rules and guidelines for
|
||||
<a href="hacking.html">hacking</a> on libvirt code</li>
|
||||
<li>Introduction to basic rules and guidelines for <a href="hacking.html">hacking</a>
|
||||
on libvirt code</li>
|
||||
<li>Guide to adding <a href="api_extension.html">public APIs</a></li>
|
||||
<li>Approach for <a href="internals/command.html">spawning commands</a>
|
||||
from libvirt driver code</li>
|
||||
<li>The libvirt <a href="internals/rpc.html">RPC infrastructure</a></li>
|
||||
<li>The <a href="internals/locking.html">Resource Lock Manager</a></li>
|
||||
<li>Approach for <a href="internals/command.html">spawning commands</a> from
|
||||
libvirt driver code</li>
|
||||
</ul>
|
||||
|
||||
<p>Before adding new code it will be important to get a basic understanding
|
||||
of the many elements involved with making any call or change to the libvirt
|
||||
code. The architecture <a href="goals.html">goals</a> must be adhered to
|
||||
when submitting new code. Understanding the many places that need to be
|
||||
touched and the interactions between various subsystems within libvirt
|
||||
will directly correlate to the ability to be successful in getting new
|
||||
code accepted.</p>
|
||||
<p>The following diagram depicts code flow from a client application, in
|
||||
this case the libvirt provided <code>virsh</code> command through the
|
||||
various layers to elicit a response from some chosen hypervisor.
|
||||
</p>
|
||||
|
||||
<p class="image">
|
||||
<img alt="virConnectOpen calling sequence"
|
||||
src="libvirt-virConnect-example.png"/>
|
||||
</p>
|
||||
<ul>
|
||||
<li>"virsh -c qemu:///system list --all"
|
||||
<p>After the virsh code processes the input arguments, it eventually
|
||||
will make a call to open the connection using a default set of
|
||||
authentication credentials (virConnectAuthDefault). </p></li>
|
||||
<li>virConnectOpenAuth()
|
||||
<p>Each of the virConnectOpen APIs will first call virInitialize() and
|
||||
then revector through the local "do_open():" call.</p>
|
||||
<ul>
|
||||
<li>virInitialize()
|
||||
<p>Calls the registration API for each of the drivers with
|
||||
client-side only capabilities and then call the remoteRegister()
|
||||
API last. This ensures the virDriverTab[] tries local drivers
|
||||
first before using the remote driver.</p></li>
|
||||
<li>Loop through virDriverTab[] entries trying to call their
|
||||
respective "open" entry point (in our case remoteOpen())</li>
|
||||
<li>After successful return from the virDriverTab[] open()
|
||||
API, attempt to find and open other drivers (network, interface,
|
||||
storage, etc.)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>remoteOpen()
|
||||
<p>After a couple of URI checks, a call to doRemoteOpen() is made</p>
|
||||
<ul>
|
||||
<li>Determine network transport and host/port to use from URI
|
||||
<p>The transport will be either tls, unix, ssh, libssh2, ext,
|
||||
or tcp with the default of tls. Decode the host/port if provided
|
||||
or default to "localhost".</p></li>
|
||||
<li>virNetClientRegisterAsyncIO()
|
||||
<p>Register an I/O callback mechanism to get returned data via
|
||||
virNetClientIncomingEvent()</p></li>
|
||||
<li>"call(...REMOTE_PROC_OPEN...)"
|
||||
<p>Eventually routes into virNetClientProgramCall() which will
|
||||
call virNetClientSendWithReply() and eventually uses
|
||||
virNetClientIO()to send the message to libvirtd and
|
||||
then waits for a response using virNetClientIOEventLoop()</p></li>
|
||||
<li>virNetClientIncomingEvent()
|
||||
<p>Receives the returned packet and processes through
|
||||
virNetClientIOUpdateCallback()</p></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>libvirtd Daemon
|
||||
<p></p>
|
||||
<ul>
|
||||
<li>Daemon Startup
|
||||
<p>The daemon initialization processing will declare itself
|
||||
as a server via a virNetServerNew() call, then use
|
||||
virDriverLoadModule() to find/load all known drivers,
|
||||
set up an RPC server program using the <code>remoteProcs[]</code>
|
||||
table via a virNetServerProgramNew() call. The table is the
|
||||
corollary to the <code>remote_procedure</code> enum list in
|
||||
the client. It lists all the functions to be called in
|
||||
the same order. Once RPC is set up, networking server sockets
|
||||
are opened, the various driver state initialization routines
|
||||
are run from the <code>virStateDriverTab[]</code>, the network
|
||||
links are enabled, and the daemon waits for work.</p></li>
|
||||
<li>RPC
|
||||
<p>When a message is received, the <code>remoteProcs[]</code>
|
||||
table is referenced for the 'REMOTE_PROC_OPEN' call entry.
|
||||
This results in remoteDispatchOpen() being called via the
|
||||
virNetServerProgramDispatchCall().</p></li>
|
||||
<li>remoteDispatchOpen()
|
||||
<p>The API will read the argument passed picking out the
|
||||
<code>name</code> of the driver to be opened. The code
|
||||
will then call virConnectOpen() or virConnectOpenReadOnly()
|
||||
depending on the argument <code>flags</code>.</p></li>
|
||||
<li>virConnectOpen() or virConnectOpenReadOnly()
|
||||
<p>Just like the client except that upon entry the URI
|
||||
is what was passed from the client and will be found
|
||||
and opened to process the data.</p>
|
||||
<p>The returned structure data is returned via the
|
||||
virNetServer interfaces to the remote driver which then
|
||||
returns it to the client application.</p></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Spawning processes / commands from libvirt drivers</h1>
|
||||
|
||||
@ -258,9 +256,8 @@
|
||||
<pre>
|
||||
int sharedfd = open("cmd.log", "w+");
|
||||
int childfd = open("conf.txt", "r");
|
||||
virCommandPassFD(cmd, sharedfd, 0);
|
||||
virCommandPassFD(cmd, childfd,
|
||||
VIR_COMMAND_PASS_FD_CLOSE_PARENT);
|
||||
virCommandPreserveFD(cmd, sharedfd);
|
||||
virCommandTransferFD(cmd, childfd);
|
||||
if (VIR_CLOSE(sharedfd) < 0)
|
||||
goto cleanup;
|
||||
</pre>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>Resource Lock Manager</h1>
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html>
|
||||
<body>
|
||||
<h1>libvirt RPC infrastructure</h1>
|
||||
|
||||
@ -154,7 +152,6 @@
|
||||
<li>continue: for streams this indicates that further data packets
|
||||
will be following</li>
|
||||
</ol>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h3><a href="protocolpayload">Packet payload</a></h3>
|
||||
@ -421,7 +418,7 @@
|
||||
After a complete packet has been read, the header must be decoded
|
||||
and all 6 fields fully validated, before attempting to dispatch
|
||||
the payload. Once dispatched, the payload can be decoded and passed
|
||||
on to the appropriate API for execution. The RPC code must not take
|
||||
onto the appropriate API for execution. The RPC code must not take
|
||||
any action based on the payload, since it has no way to validate
|
||||
the semantics of the payload data. It must delegate this to the
|
||||
execution API (e.g. corresponding libvirt public API).
|
||||
@ -788,7 +785,7 @@
|
||||
return value and output parameters, or error object and encode
|
||||
them into a reply packet. Again it does not attempt to do any
|
||||
semantic validation of output data, aside from variable length
|
||||
field limit checks. The worker thread puts the reply packet on
|
||||
field limit checks. The worker thread puts the reply packet onto
|
||||
the transmission queue for the client. The worker is now finished
|
||||
and goes back to wait for another incoming method call.
|
||||
</p>
|
||||
@ -814,10 +811,10 @@
|
||||
for the worker threads, it is sidetracked into a per-stream
|
||||
processing queue. When the stream becomes writable, queued
|
||||
incoming stream packets will be processed, passing their data
|
||||
payload on the stream. Conversely when the stream becomes
|
||||
payload onto the stream. Conversely when the stream becomes
|
||||
readable, chunks of data will be read from it, encoded into
|
||||
new outgoing packets, and placed on the client's transmit
|
||||
queue.
|
||||
queue
|
||||
</p>
|
||||
|
||||
<h4><a name="apiserverdispatchex1">Example with overlapping methods</a></h4>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Architecture</h1>
|
||||
<p>Libvirt is a C toolkit manage the virtualization capabilities
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<?xml version="1.0"?>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Java API bindings</h1>
|
||||
|
||||
|
@ -1,58 +0,0 @@
|
||||
#FIG 3.2 Produced by xfig version 3.2.5b
|
||||
Landscape
|
||||
Center
|
||||
Inches
|
||||
Letter
|
||||
100.00
|
||||
Single
|
||||
-2
|
||||
1200 2
|
||||
2 2 0 2 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
|
||||
450 375 4575 375 4575 1725 450 1725 450 375
|
||||
2 2 0 2 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
|
||||
1125 2475 4950 2475 4950 3600 1125 3600 1125 2475
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
|
||||
1 0 1.00 60.00 120.00
|
||||
1725 1725 2175 2475
|
||||
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
|
||||
3150 5700 6525 5700 6525 6900 3150 6900 3150 5700
|
||||
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
|
||||
7875 6825 10125 6825 10125 7725 7875 7725 7875 6825
|
||||
2 2 0 2 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
|
||||
2550 4725 10350 4725 10350 7800 2550 7800 2550 4725
|
||||
2 2 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5
|
||||
8850 1950 11550 1950 11550 3360 8850 3360 8850 1950
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
|
||||
1 0 1.00 60.00 120.00
|
||||
3975 3600 5025 4425
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
|
||||
1 0 1.00 60.00 120.00
|
||||
8925 3225 5400 4425
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
|
||||
1 0 1.00 60.00 120.00
|
||||
5625 6900 7875 7425
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 3
|
||||
1 0 1.00 60.00 120.00
|
||||
11400 3375 11400 7575 10125 7575
|
||||
2 2 0 2 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
|
||||
8400 975 12450 975 12450 4125 8400 4125 8400 975
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 6
|
||||
1 0 1.00 60.00 120.00
|
||||
10125 7125 10725 7125 10725 4425 7725 4425 7725 2700 8850 2700
|
||||
4 0 0 50 -1 16 12 0.0000 4 180 2430 1350 2895 virConnectOpenReadOnly(uri)\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 180 3240 1350 3090 virConnectOpenAuth(uri, auth, flags)\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 165 1350 3300 5850 virConnectOpen:\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 165 2070 3300 6045 virConnectOpenReadOnly:\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 165 1710 3300 6240 virConnectOpenAuth:\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 180 900 3975 6600 do_open():\001
|
||||
4 0 0 50 -1 0 14 0.0000 4 135 1260 8025 7125 Rremote driver\001
|
||||
4 0 0 50 -1 16 24 0.0000 4 135 630 5025 4650 libvirt\001
|
||||
4 0 0 50 -1 0 14 0.0000 4 180 1890 9000 2175 remoteDispatchOpen():\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 45 270 9300 2475 ...\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 180 1440 9300 2670 virConnectOpen()\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 180 2160 9300 2865 virConnectOpenReadOnly()\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 45 270 9300 3060 ...\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 180 1080 8250 7350 remoteOpen()\001
|
||||
4 0 0 50 -1 16 16 0.0000 4 165 3240 600 1050 "virsh -c qemu:///system list --all"\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 180 1710 1350 2700 virConnectOpen(uri)\001
|
||||
4 0 0 50 -1 16 24 0.0000 4 135 720 9750 825 libvirtd\001
|
Binary file not shown.
Before Width: | Height: | Size: 10 KiB |
@ -184,25 +184,23 @@ div.api {
|
||||
border: 1px solid #999999;
|
||||
background: #eeeeee;
|
||||
color: black;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
div.api pre {
|
||||
margin: 0px;
|
||||
border: 0px;
|
||||
background: inherit;
|
||||
padding: inherit;
|
||||
}
|
||||
|
||||
div.api table {
|
||||
margin: 0px;
|
||||
padding-left: 2em;
|
||||
border-spacing: 0px;
|
||||
font-family: fixed;
|
||||
whitespace: pre;
|
||||
}
|
||||
|
||||
div.api table td, div.variablelist table td {
|
||||
vertical-align: top;
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
|
||||
@ -414,80 +412,3 @@ table.data tbody td.n {
|
||||
background: rgb(255,220,220);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.api {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.api .type {
|
||||
font-weight: bold;
|
||||
white-space: nowrap;
|
||||
color: darkslateblue;
|
||||
}
|
||||
|
||||
.api .keyword {
|
||||
font-weight: bold;
|
||||
color: #A2F;
|
||||
}
|
||||
|
||||
.api .comment {
|
||||
color: #080;
|
||||
margin-left: 2em;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.api .comment:before {
|
||||
content: ": ";
|
||||
position: absolute;
|
||||
left: -1.3em;
|
||||
}
|
||||
|
||||
.api .undisclosed {
|
||||
font-style: italic;
|
||||
letter-spacing: .3ex;
|
||||
font-weight: bolder;
|
||||
text-transform: uppercase;
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
.api .directive {
|
||||
color: teal;
|
||||
}
|
||||
|
||||
.api :link:hover, .api :link:focus {
|
||||
color: blue;
|
||||
border-color: blue;
|
||||
}
|
||||
|
||||
.api :link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
dl.variablelist > dt {
|
||||
display: block;
|
||||
float: left;
|
||||
font-style: italic;
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
.variablelist dd {
|
||||
padding-left: 10em;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user