From 94bf7e5d8463331afa578d557ced53e306fcb7bb Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Tue, 12 Apr 2016 20:32:33 +0200 Subject: [PATCH] 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. --- tools/Makefile.am | 30 +++------ tools/virt-host-validate.c | 74 --------------------- tools/virt-host-validate.pod | 67 +++++++++++++++++++ tools/virt-pki-validate.in | 64 ------------------- tools/virt-pki-validate.pod | 60 +++++++++++++++++ tools/virt-sanlock-cleanup.in | 52 --------------- tools/virt-sanlock-cleanup.pod | 48 ++++++++++++++ tools/virt-xml-validate.in | 113 --------------------------------- tools/virt-xml-validate.pod | 109 +++++++++++++++++++++++++++++++ 9 files changed, 293 insertions(+), 324 deletions(-) create mode 100644 tools/virt-host-validate.pod create mode 100644 tools/virt-pki-validate.pod create mode 100644 tools/virt-sanlock-cleanup.pod create mode 100644 tools/virt-xml-validate.pod diff --git a/tools/Makefile.am b/tools/Makefile.am index 0c6ab37b0b..e414498bfc 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -45,7 +45,11 @@ EXTRA_DIST = \ virt-sanlock-cleanup.in \ virt-sanlock-cleanup.8 \ virt-admin.pod \ + virt-host-validate.pod \ virt-login-shell.pod \ + virt-pki-validate.pod \ + virt-sanlock-cleanup.pod \ + virt-xml-validate.pod \ virsh.pod \ libvirt-guests.sysconf \ virsh-edit.c \ @@ -101,37 +105,16 @@ virt-xml-validate: virt-xml-validate.in Makefile -e 's|[@]VERSION@|$(VERSION)|g' \ < $< > $@ || (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 $(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|g' \ -e 's|[@]VERSION@|$(VERSION)|g' \ < $< > $@ || (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 $(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|' \ -e 's|[@]localstatedir@|$(localstatedir)|' < $< > $@ \ || (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 libvirt_shell_la_CFLAGS = \ $(AM_CFLAGS) \ @@ -288,6 +271,11 @@ endif WITH_WIN_ICON && if grep 'POD ERROR' $(srcdir)/$@ ; then \ 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 uninstall-local: uninstall-init uninstall-systemd diff --git a/tools/virt-host-validate.c b/tools/virt-host-validate.c index 5b7fe9b4a1..f092824120 100644 --- a/tools/virt-host-validate.c +++ b/tools/virt-host-validate.c @@ -138,77 +138,3 @@ main(int argc, char **argv) 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 or bug tracker C. -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, C, C - -=cut - -*/ diff --git a/tools/virt-host-validate.pod b/tools/virt-host-validate.pod new file mode 100644 index 0000000000..51edf2d4c3 --- /dev/null +++ b/tools/virt-host-validate.pod @@ -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 or bug tracker C. +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, C, C + +=cut diff --git a/tools/virt-pki-validate.in b/tools/virt-pki-validate.in index cda55d158c..92df9ed379 100755 --- a/tools/virt-pki-validate.in +++ b/tools/virt-pki-validate.in @@ -320,67 +320,3 @@ fi 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 or bug tracker C. -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, online PKI setup instructions C - -=cut diff --git a/tools/virt-pki-validate.pod b/tools/virt-pki-validate.pod new file mode 100644 index 0000000000..b216f5636e --- /dev/null +++ b/tools/virt-pki-validate.pod @@ -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 or bug tracker C. +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, online PKI setup instructions C + +=cut diff --git a/tools/virt-sanlock-cleanup.in b/tools/virt-sanlock-cleanup.in index 9855f4244e..6551b0476f 100644 --- a/tools/virt-sanlock-cleanup.in +++ b/tools/virt-sanlock-cleanup.in @@ -59,55 +59,3 @@ do done 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 or bug tracker C. -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, online instructions C - -=cut diff --git a/tools/virt-sanlock-cleanup.pod b/tools/virt-sanlock-cleanup.pod new file mode 100644 index 0000000000..69a2b5d965 --- /dev/null +++ b/tools/virt-sanlock-cleanup.pod @@ -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 or bug tracker C. +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, online instructions C + +=cut diff --git a/tools/virt-xml-validate.in b/tools/virt-xml-validate.in index a04fa06f7a..81fde4d832 100644 --- a/tools/virt-xml-validate.in +++ b/tools/virt-xml-validate.in @@ -102,116 +102,3 @@ fi xmllint --noout --relaxng "$SCHEMA" "$XMLFILE" 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 - -The schema for the XML format used by domain snapshot configuration - -=item C - -The schema for the XML format used by guest domains configuration - -=item C - -The schema for the XML format used by virtual network configuration - -=item C - -The schema for the XML format used by storage pool configuration - -=item C - -The schema for the XML format used by storage volume descriptions - -=item C - -The schema for the XML format used by node device descriptions - -=item C - -The schema for the XML format used to declare driver capabilities - -=item C - -The schema for the XML format used by network traffic filters - -=item C - -The schema for the XML format used by secrets descriptions - -=item C - -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 or bug tracker C. -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, online XML format descriptions C - -=cut diff --git a/tools/virt-xml-validate.pod b/tools/virt-xml-validate.pod new file mode 100644 index 0000000000..1df5a93f7f --- /dev/null +++ b/tools/virt-xml-validate.pod @@ -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 + +The schema for the XML format used by domain snapshot configuration + +=item C + +The schema for the XML format used by guest domains configuration + +=item C + +The schema for the XML format used by virtual network configuration + +=item C + +The schema for the XML format used by storage pool configuration + +=item C + +The schema for the XML format used by storage volume descriptions + +=item C + +The schema for the XML format used by node device descriptions + +=item C + +The schema for the XML format used to declare driver capabilities + +=item C + +The schema for the XML format used by network traffic filters + +=item C + +The schema for the XML format used by secrets descriptions + +=item C + +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 or bug tracker C. +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, online XML format descriptions C + +=cut