build: Extract pod from source files

Instead of embedding the pod information inside the respective
source files, store them in separate files.

This allows us to reduce the number of custom build rules as
most of the information can be inferred for the file name;
moreover, text editors are more likely to use proper syntax
highlighting for standalone pod files.
This commit is contained in:
Andrea Bolognani 2016-04-12 20:32:33 +02:00
parent 2d1269605c
commit 94bf7e5d84
9 changed files with 293 additions and 324 deletions

View File

@ -45,7 +45,11 @@ EXTRA_DIST = \
virt-sanlock-cleanup.in \ virt-sanlock-cleanup.in \
virt-sanlock-cleanup.8 \ virt-sanlock-cleanup.8 \
virt-admin.pod \ virt-admin.pod \
virt-host-validate.pod \
virt-login-shell.pod \ virt-login-shell.pod \
virt-pki-validate.pod \
virt-sanlock-cleanup.pod \
virt-xml-validate.pod \
virsh.pod \ virsh.pod \
libvirt-guests.sysconf \ libvirt-guests.sysconf \
virsh-edit.c \ virsh-edit.c \
@ -101,37 +105,16 @@ virt-xml-validate: virt-xml-validate.in Makefile
-e 's|[@]VERSION@|$(VERSION)|g' \ -e 's|[@]VERSION@|$(VERSION)|g' \
< $< > $@ || (rm $@ && exit 1) && chmod +x $@ < $< > $@ || (rm $@ && exit 1) && chmod +x $@
virt-xml-validate.1: virt-xml-validate.in $(top_srcdir)/configure.ac
$(AM_V_GEN)$(POD2MAN) --name VIRT-XML-VALIDATE $< $(srcdir)/$@ \
&& if grep 'POD ERROR' $(srcdir)/$@ ; then \
rm $(srcdir)/$@; exit 1; fi
virt-pki-validate: virt-pki-validate.in Makefile virt-pki-validate: virt-pki-validate.in Makefile
$(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|g' \ $(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|g' \
-e 's|[@]VERSION@|$(VERSION)|g' \ -e 's|[@]VERSION@|$(VERSION)|g' \
< $< > $@ || (rm $@ && exit 1) && chmod +x $@ < $< > $@ || (rm $@ && exit 1) && chmod +x $@
virt-pki-validate.1: virt-pki-validate.in $(top_srcdir)/configure.ac
$(AM_V_GEN)$(POD2MAN) --name VIRT-PKI-VALIDATE $< $(srcdir)/$@ \
&& if grep 'POD ERROR' $(srcdir)/$@ ; then \
rm $(srcdir)/$@; exit 1; fi
virt-host-validate.1: virt-host-validate.c $(top_srcdir)/configure.ac
$(AM_V_GEN)$(POD2MAN) --name VIRT-HOST-VALIDATE $< $(srcdir)/$@ \
&& if grep 'POD ERROR' $(srcdir)/$@ ; then \
rm $(srcdir)/$@; exit 1; fi
virt-sanlock-cleanup: virt-sanlock-cleanup.in Makefile virt-sanlock-cleanup: virt-sanlock-cleanup.in Makefile
$(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|' \ $(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|' \
-e 's|[@]localstatedir@|$(localstatedir)|' < $< > $@ \ -e 's|[@]localstatedir@|$(localstatedir)|' < $< > $@ \
|| (rm $@ && exit 1) && chmod +x $@ || (rm $@ && exit 1) && chmod +x $@
virt-sanlock-cleanup.8: virt-sanlock-cleanup.in $(top_srcdir)/configure.ac
$(AM_V_GEN)$(POD2MAN) --name VIRT-SANLOCK-CLEANUP --section=8 \
$< $(srcdir)/$@ \
&& if grep 'POD ERROR' $(srcdir)/$@ ; then \
rm $(srcdir)/$@; exit 1; fi
noinst_LTLIBRARIES = libvirt_shell.la noinst_LTLIBRARIES = libvirt_shell.la
libvirt_shell_la_CFLAGS = \ libvirt_shell_la_CFLAGS = \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
@ -288,6 +271,11 @@ endif WITH_WIN_ICON
&& if grep 'POD ERROR' $(srcdir)/$@ ; then \ && if grep 'POD ERROR' $(srcdir)/$@ ; then \
rm $(srcdir)/$@; exit 1; fi rm $(srcdir)/$@; exit 1; fi
%.8: %.pod $(top_srcdir)/configure.ac
$(AM_V_GEN)$(POD2MAN) --section=8 $< $(srcdir)/$@ \
&& if grep 'POD ERROR' $(srcdir)/$@ ; then \
rm $(srcdir)/$@; exit 1; fi
install-data-local: install-init install-systemd install-data-local: install-init install-systemd
uninstall-local: uninstall-init uninstall-systemd uninstall-local: uninstall-init uninstall-systemd

View File

@ -138,77 +138,3 @@ main(int argc, char **argv)
return ret; return ret;
} }
/*
=pod
=head1 NAME
virt-host-validate - validate host virtualization setup
=head1 SYNOPSIS
virt-host-validate [OPTIONS...] [HV-TYPE]
=head1 DESCRIPTION
This tool validates that the host is configured in a suitable
way to run libvirt hypervisor drivers. If invoked without any
arguments it will check support for all hypervisor drivers it
is aware of. Optionally it can be given a particular hypervisor
type ('qemu' or 'lxc') to restrict the checks to those relevant
for that virtualization technology
=head1 OPTIONS
=over 4
=item C<-v>, C<--version>
Display the command version
=item C<-h>, C<--help>
Display the command line help
=item C<-q>, C<--quiet>
Don't display details of individual checks being performed.
Only display output if a check does not pass.
=back
=head1 EXIT STATUS
Upon successful validation, an exit status of 0 will be set. Upon
failure a non-zero status will be set.
=head1 AUTHOR
Daniel P. Berrange
=head1 BUGS
Report any bugs discovered to the libvirt community via the
mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
Alternatively report bugs to your software distributor / vendor.
=head1 COPYRIGHT
Copyright (C) 2012 by Red Hat, Inc.
=head1 LICENSE
virt-host-validate is distributed under the terms of the GNU GPL v2+.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE
=head1 SEE ALSO
C<virsh(1)>, C<virt-pki-validate>, C<virt-xml-validate>
=cut
*/

View File

@ -0,0 +1,67 @@
=head1 NAME
virt-host-validate - validate host virtualization setup
=head1 SYNOPSIS
virt-host-validate [OPTIONS...] [HV-TYPE]
=head1 DESCRIPTION
This tool validates that the host is configured in a suitable
way to run libvirt hypervisor drivers. If invoked without any
arguments it will check support for all hypervisor drivers it
is aware of. Optionally it can be given a particular hypervisor
type ('qemu' or 'lxc') to restrict the checks to those relevant
for that virtualization technology
=head1 OPTIONS
=over 4
=item C<-v>, C<--version>
Display the command version
=item C<-h>, C<--help>
Display the command line help
=item C<-q>, C<--quiet>
Don't display details of individual checks being performed.
Only display output if a check does not pass.
=back
=head1 EXIT STATUS
Upon successful validation, an exit status of 0 will be set. Upon
failure a non-zero status will be set.
=head1 AUTHOR
Daniel P. Berrange
=head1 BUGS
Report any bugs discovered to the libvirt community via the
mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
Alternatively report bugs to your software distributor / vendor.
=head1 COPYRIGHT
Copyright (C) 2012 by Red Hat, Inc.
=head1 LICENSE
virt-host-validate is distributed under the terms of the GNU GPL v2+.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE
=head1 SEE ALSO
C<virsh(1)>, C<virt-pki-validate>, C<virt-xml-validate>
=cut

View File

@ -320,67 +320,3 @@ fi
exit 0 exit 0
: <<=cut
=pod
=head1 NAME
virt-pki-validate - validate libvirt PKI files are configured correctly
=head1 SYNOPSIS
virt-pki-validate [OPTION]
=head1 DESCRIPTION
This tool validates that the necessary PKI files are configured for
a secure libvirt server or client using the TLS encryption protocol.
It will report any missing certificate or key files on the host. It
should be run as root to ensure it can read all the necessary files
=head1 OPTIONS
=over
=item B<-h, --help>
Display command line help usage then exit.
=item B<-V, --version>
Display version information then exit.
=back
=head1 EXIT STATUS
Upon successful validation, an exit status of 0 will be set. Upon
failure a non-zero status will be set.
=head1 AUTHOR
Richard Jones
=head1 BUGS
Report any bugs discovered to the libvirt community via the
mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
Alternatively report bugs to your software distributor / vendor.
=head1 COPYRIGHT
Copyright (C) 2006-2012 by Red Hat, Inc.
=head1 LICENSE
virt-pki-validate is distributed under the terms of the GNU GPL v2+.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE
=head1 SEE ALSO
C<virsh(1)>, online PKI setup instructions C<http://libvirt.org/remote.html>
=cut

View File

@ -0,0 +1,60 @@
=head1 NAME
virt-pki-validate - validate libvirt PKI files are configured correctly
=head1 SYNOPSIS
virt-pki-validate [OPTION]
=head1 DESCRIPTION
This tool validates that the necessary PKI files are configured for
a secure libvirt server or client using the TLS encryption protocol.
It will report any missing certificate or key files on the host. It
should be run as root to ensure it can read all the necessary files
=head1 OPTIONS
=over
=item B<-h, --help>
Display command line help usage then exit.
=item B<-V, --version>
Display version information then exit.
=back
=head1 EXIT STATUS
Upon successful validation, an exit status of 0 will be set. Upon
failure a non-zero status will be set.
=head1 AUTHOR
Richard Jones
=head1 BUGS
Report any bugs discovered to the libvirt community via the
mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
Alternatively report bugs to your software distributor / vendor.
=head1 COPYRIGHT
Copyright (C) 2006-2012 by Red Hat, Inc.
=head1 LICENSE
virt-pki-validate is distributed under the terms of the GNU GPL v2+.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE
=head1 SEE ALSO
C<virsh(1)>, online PKI setup instructions C<http://libvirt.org/remote.html>
=cut

View File

@ -59,55 +59,3 @@ do
done done
exit 0 exit 0
: <<=cut
=pod
=head1 NAME
virt-sanlock-cleanup - remove stale sanlock resource lease files
=head1 SYNOPSIS
virt-sanlock-cleanup
=head1 DESCRIPTION
This tool removes any resource lease files created by the sanlock
lock manager plugin. The resource lease files only need to exist
on disks when a guest using the resource is active. This script
reclaims the disk space used by resources which are not currently
active.
=head1 EXIT STATUS
Upon successful processing of leases cleanup, an exit status
of 0 will be set. Upon fatal error a non-zero status will
be set.
=head1 AUTHOR
Daniel Berrange
=head1 BUGS
Report any bugs discovered to the libvirt community via the
mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
Alternatively report bugs to your software distributor / vendor.
=head1 COPYRIGHT
Copyright (C) 2011, 2013 Red Hat, Inc.
=head1 LICENSE
virt-sanlock-cleanup is distributed under the terms of the GNU GPL v2+.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE
=head1 SEE ALSO
C<virsh(1)>, online instructions C<http://libvirt.org/locking.html>
=cut

View File

@ -0,0 +1,48 @@
=head1 NAME
virt-sanlock-cleanup - remove stale sanlock resource lease files
=head1 SYNOPSIS
virt-sanlock-cleanup
=head1 DESCRIPTION
This tool removes any resource lease files created by the sanlock
lock manager plugin. The resource lease files only need to exist
on disks when a guest using the resource is active. This script
reclaims the disk space used by resources which are not currently
active.
=head1 EXIT STATUS
Upon successful processing of leases cleanup, an exit status
of 0 will be set. Upon fatal error a non-zero status will
be set.
=head1 AUTHOR
Daniel Berrange
=head1 BUGS
Report any bugs discovered to the libvirt community via the
mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
Alternatively report bugs to your software distributor / vendor.
=head1 COPYRIGHT
Copyright (C) 2011, 2013 Red Hat, Inc.
=head1 LICENSE
virt-sanlock-cleanup is distributed under the terms of the GNU GPL v2+.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE
=head1 SEE ALSO
C<virsh(1)>, online instructions C<http://libvirt.org/locking.html>
=cut

View File

@ -102,116 +102,3 @@ fi
xmllint --noout --relaxng "$SCHEMA" "$XMLFILE" xmllint --noout --relaxng "$SCHEMA" "$XMLFILE"
exit exit
: <<=cut
=pod
=head1 NAME
virt-xml-validate - validate libvirt XML files against a schema
=head1 SYNOPSIS
virt-xml-validate XML-FILE [SCHEMA-NAME]
virt-xml-validate OPTION
=head1 DESCRIPTION
Validates a libvirt XML for compliance with the published schema.
The first compulsory argument is the path to the XML file to be
validated. The optional second argument is the name of the schema
to validate against. If omitted, the schema name will be inferred
from the name of the root element in the XML document.
Valid schema names currently include
=over 4
=item C<domainsnapshot>
The schema for the XML format used by domain snapshot configuration
=item C<domain>
The schema for the XML format used by guest domains configuration
=item C<network>
The schema for the XML format used by virtual network configuration
=item C<storagepool>
The schema for the XML format used by storage pool configuration
=item C<storagevol>
The schema for the XML format used by storage volume descriptions
=item C<nodedev>
The schema for the XML format used by node device descriptions
=item C<capability>
The schema for the XML format used to declare driver capabilities
=item C<nwfilter>
The schema for the XML format used by network traffic filters
=item C<secret>
The schema for the XML format used by secrets descriptions
=item C<interface>
The schema for the XML format used by physical host interfaces
=back
=head1 OPTIONS
=over
=item B<-h, --help>
Display command line help usage then exit.
=item B<-V, --version>
Display version information then exit.
=back
=head1 EXIT STATUS
Upon successful validation, an exit status of 0 will be set. Upon
failure a non-zero status will be set.
=head1 AUTHOR
Daniel P.Berrange
=head1 BUGS
Report any bugs discovered to the libvirt community via the
mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
Alternatively report bugs to your software distributor / vendor.
=head1 COPYRIGHT
Copyright (C) 2009-2013 by Red Hat, Inc.
Copyright (C) 2009 by Daniel P. Berrange
=head1 LICENSE
virt-xml-validate is distributed under the terms of the GNU GPL v2+.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE
=head1 SEE ALSO
C<virsh(1)>, online XML format descriptions C<http://libvirt.org/format.html>
=cut

109
tools/virt-xml-validate.pod Normal file
View File

@ -0,0 +1,109 @@
=head1 NAME
virt-xml-validate - validate libvirt XML files against a schema
=head1 SYNOPSIS
virt-xml-validate XML-FILE [SCHEMA-NAME]
virt-xml-validate OPTION
=head1 DESCRIPTION
Validates a libvirt XML for compliance with the published schema.
The first compulsory argument is the path to the XML file to be
validated. The optional second argument is the name of the schema
to validate against. If omitted, the schema name will be inferred
from the name of the root element in the XML document.
Valid schema names currently include
=over 4
=item C<domainsnapshot>
The schema for the XML format used by domain snapshot configuration
=item C<domain>
The schema for the XML format used by guest domains configuration
=item C<network>
The schema for the XML format used by virtual network configuration
=item C<storagepool>
The schema for the XML format used by storage pool configuration
=item C<storagevol>
The schema for the XML format used by storage volume descriptions
=item C<nodedev>
The schema for the XML format used by node device descriptions
=item C<capability>
The schema for the XML format used to declare driver capabilities
=item C<nwfilter>
The schema for the XML format used by network traffic filters
=item C<secret>
The schema for the XML format used by secrets descriptions
=item C<interface>
The schema for the XML format used by physical host interfaces
=back
=head1 OPTIONS
=over
=item B<-h, --help>
Display command line help usage then exit.
=item B<-V, --version>
Display version information then exit.
=back
=head1 EXIT STATUS
Upon successful validation, an exit status of 0 will be set. Upon
failure a non-zero status will be set.
=head1 AUTHOR
Daniel P.Berrange
=head1 BUGS
Report any bugs discovered to the libvirt community via the
mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
Alternatively report bugs to your software distributor / vendor.
=head1 COPYRIGHT
Copyright (C) 2009-2013 by Red Hat, Inc.
Copyright (C) 2009 by Daniel P. Berrange
=head1 LICENSE
virt-xml-validate is distributed under the terms of the GNU GPL v2+.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE
=head1 SEE ALSO
C<virsh(1)>, online XML format descriptions C<http://libvirt.org/format.html>
=cut