From: Dietmar Maurer Date: Thu, 20 Oct 2011 06:20:37 +0000 (+0200) Subject: generate correct manual page and .pod X-Git-Url: https://git.proxmox.com/?p=pve-storage.git;a=commitdiff_plain;h=630f436a632db0268fc7e53a3e56e12b1071dd07 generate correct manual page and .pod --- diff --git a/.gitignore b/.gitignore index c00df13..d2ed212 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ *.deb +*.1.pod +*.1.gz diff --git a/Makefile b/Makefile index 5ac516b..44beb00 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,8 @@ PREFIX=/usr BINDIR=${PREFIX}/bin SBINDIR=${PREFIX}/sbin MANDIR=${PREFIX}/share/man -DOCDIR=${PREFIX}/share/doc +DOCDIR=${PREFIX}/share/doc/${PACKAGE} +PODDIR=${DOCDIR}/pod MAN1DIR=${MANDIR}/man1/ export PERLDIR=${PREFIX}/share/perl5 @@ -24,13 +25,22 @@ all: ${DEB} dinstall: deb dpkg -i ${DEB} +%.1.gz: %.1.pod + rm -f $@ + cat $<|pod2man -n $* -s 1 -r ${VERSION} -c "Proxmox Documentation"|gzip -c9 >$@ + +pvesm.1.pod: pvesm PVE/Storage.pm + perl -I. ./pvesm printmanpod >$@ + .PHONY: install -install: +install: pvesm.1.pod pvesm.1.gz install -d ${DESTDIR}${SBINDIR} install -m 0755 pvesm ${DESTDIR}${SBINDIR} make -C PVE install install -d ${DESTDIR}/usr/share/man/man1 - pod2man -n pvesm -s 1 -r "proxmox 1.0" -c "Proxmox Documentation" ${DESTDIR}/usr/share/man/man1/pvesm.1.gz + install -d ${DESTDIR}${PODDIR} + install -m 0644 pvesm.1.gz ${DESTDIR}/usr/share/man/man1/ + install -m 0644 pvesm.1.pod ${DESTDIR}/${PODDIR} .PHONY: deb ${DEB} deb ${DEB}: @@ -40,9 +50,9 @@ deb ${DEB}: perl -I. ./pvesm verifyapi install -d -m 0755 debian/DEBIAN sed -e s/@@VERSION@@/${VERSION}/ -e s/@@PKGRELEASE@@/${PKGREL}/ -e s/@@ARCH@@/${ARCH}/ debian/DEBIAN/control - install -D -m 0644 copyright debian/${DOCDIR}/${PACKAGE}/copyright - install -m 0644 changelog.Debian debian/${DOCDIR}/${PACKAGE}/ - gzip -9 debian/${DOCDIR}/${PACKAGE}/changelog.Debian + install -D -m 0644 copyright debian/${DOCDIR}/copyright + install -m 0644 changelog.Debian debian/${DOCDIR}/ + gzip -9 debian/${DOCDIR}/changelog.Debian dpkg-deb --build debian mv debian.deb ${DEB} rm -rf debian @@ -50,7 +60,7 @@ deb ${DEB}: .PHONY: clean clean: - rm -rf debian *.deb ${PACKAGE}-*.tar.gz dist + rm -rf debian *.deb ${PACKAGE}-*.tar.gz dist *.1.pod *.1.gz find . -name '*~' -exec rm {} ';' .PHONY: distclean diff --git a/pvesm b/pvesm index dbee738..47113ca 100755 --- a/pvesm +++ b/pvesm @@ -32,10 +32,10 @@ my $rpcenv = PVE::RPCEnvironment->init('cli'); $rpcenv->init_request(); $rpcenv->set_language($ENV{LANG}); -$rpcenv->set_user('root@pam'); +$rpcenv->set_user('root@pam'); __PACKAGE__->register_method ({ - name => 'path', + name => 'path', path => 'path', method => 'GET', description => "Get filesystem path for specified volume", @@ -49,7 +49,7 @@ __PACKAGE__->register_method ({ }, }, returns => { type => 'null' }, - + code => sub { my ($param) = @_; @@ -78,16 +78,16 @@ my $print_content = sub { next if !$info->{vmid}; my $volid = $info->{volid}; - printf "%-${maxlenname}s %5s %10d %d\n", $volid, - $info->{format}, $info->{size}, $info->{vmid}; + printf "%-${maxlenname}s %5s %10d %d\n", $volid, + $info->{format}, $info->{size}, $info->{vmid}; } foreach my $info (sort { $a->{format} cmp $b->{format} } @$list) { next if $info->{vmid}; my $volid = $info->{volid}; - printf "%-${maxlenname}s %5s %10d\n", $volid, - $info->{format}, $info->{size}; + printf "%-${maxlenname}s %5s %10d\n", $volid, + $info->{format}, $info->{size}; } }; @@ -100,16 +100,16 @@ my $print_status = sub { $maxlen = length ($storeid) if length ($storeid) > $maxlen; } $maxlen+=1; - + foreach my $res (sort { $a->{storage} cmp $b->{storage} } @$res) { my $storeid = $res->{storage}; my $sum = $res->{used} + $res->{avail}; my $per = $sum ? (0.5 + ($res->{used}*100)/$sum) : 100; - printf "%-${maxlen}s %5s %1d %15d %15d %15d %.2f%%\n", $storeid, + printf "%-${maxlen}s %5s %1d %15d %15d %15d %.2f%%\n", $storeid, $res->{type}, $res->{active}, - $res->{total}/1024, $res->{used}/1024, $res->{avail}/1024, $per; + $res->{total}/1024, $res->{used}/1024, $res->{avail}/1024, $per; } }; @@ -119,11 +119,11 @@ my $cmddef = { add => [ "PVE::API2::Storage::Config", 'create', ['storage'] ], set => [ "PVE::API2::Storage::Config", 'update', ['storage'] ], remove => [ "PVE::API2::Storage::Config", 'delete', ['storage'] ], - status => [ "PVE::API2::Storage::Status", 'index', [], + status => [ "PVE::API2::Storage::Status", 'index', [], { node => $nodename }, $print_status ], - list => [ "PVE::API2::Storage::Content", 'index', ['storage'], + list => [ "PVE::API2::Storage::Content", 'index', ['storage'], { node => $nodename }, $print_content ], - alloc => [ "PVE::API2::Storage::Content", 'create', ['storage', 'vmid', 'filename', 'size'], + alloc => [ "PVE::API2::Storage::Content", 'create', ['storage', 'vmid', 'filename', 'size'], { node => $nodename }, sub { my $volid = shift; print "sucessfuly created '$volid'\n"; @@ -168,12 +168,7 @@ my $cmddef = { my $cmd = shift; -if ($cmd && $cmd eq 'verifyapi') { - PVE::RESTHandler::validate_method_schemas(); - exit 0; -} - -PVE::CLIHandler::handle_cmd($cmddef, "pvesm", $cmd, \@ARGV); +PVE::CLIHandler::handle_cmd($cmddef, "pvesm", $cmd, \@ARGV, undef, $0); exit 0; @@ -185,94 +180,93 @@ pvesm - PVE Storage Manager =head1 SYNOPSIS - pvesm [OPTIONS] +=include synopsis - # scan iscsi host for available targets - pvesm scan iscsi +=head1 DESCRIPTION - # scan nfs server for available exports - pvesm scan nfs +=head2 Storage pools - # add storage pools - pvesm add - pvesm add dir --path - pvesm add nfs --path --server --export - pvesm add lvm --vgname - pvesm add iscsi --portal --target +Each storage pool is uniquely identified by its . - # disable storage pools - pvesm set --disable 1 +=head3 Storage content - # enable storage pools - pvesm set --disable 0 +A storage can support several content types, for example virtual disk +images, cdrom iso images, openvz templates or openvz root directories +(C, C, C, C). - # change/set storage options - pvesm set - pvesm set --shared 1 - pvesm set local --format qcow2 - pvesm set --content iso +=head2 Volumes - # remove storage pools - does not delete any data - pvesm remove - - # add single devices?? +A volume is identified by the , followed by a storage type +dependent volume name, separated by colon. A valid looks like: - # alloc volumes - pvesm alloc [--format ] + local:230/example-image.raw - # alloc 4G volume in local storage - use auto generated name - pvesm alloc local '' 4G + local:iso/debian-501-amd64-netinst.iso - # free volumes (warning: destroy/deletes all volume data) - pvesm free + local:vztmpl/debian-5.0-joomla_1.5.9-1_i386.tar.gz - # list storage status - pvesm status + iscsi-storage:0.0.2.scsi-14f504e46494c4500494b5042546d2d646744372d31616d61 - # list storage contents - pvesm list [--vmid ] +To get the filesystem path for a use: - # list volumes allocated by VMID - pvesm list --vmid + pvesm path - # list iso images - pvesm list --iso - # list openvz templates - pvesm list --vztmpl +=head1 EXAMPLES - # show filesystem path for a volume - pvesm path + # scan iscsi host for available targets + pvesm scan iscsi - # import disks ?? + # scan nfs server for available exports + pvesm scan nfs + # add storage pools + pvesm add + pvesm add dir --path + pvesm add nfs --path --server --export + pvesm add lvm --vgname + pvesm add iscsi --portal --target -=head1 DESCRIPTION + # disable storage pools + pvesm set --disable 1 -=head2 Storage pools + # enable storage pools + pvesm set --disable 0 -Each storage pool is uniquely identified by its . + # change/set storage options + pvesm set + pvesm set --shared 1 + pvesm set local --format qcow2 + pvesm set --content iso -=head3 Storage content + # remove storage pools - does not delete any data + pvesm remove -A storage can support several content types, for example virtual disk -images, cdrom iso images, openvz templates or openvz root directories -(C, C, C, C). + # alloc volumes + pvesm alloc [--format ] -=head2 Volumes + # alloc 4G volume in local storage - use auto generated name + pvesm alloc local '' 4G -A volume is identified by the , followed by a storage type -dependent volume name, separated by colon. A valid looks like: + # free volumes (warning: destroy/deletes all volume data) + pvesm free - local:230/example-image.raw + # list storage status + pvesm status - local:iso/debian-501-amd64-netinst.iso + # list storage contents + pvesm list [--vmid ] - local:vztmpl/debian-5.0-joomla_1.5.9-1_i386.tar.gz + # list volumes allocated by VMID + pvesm list --vmid - iscsi-storage:0.0.2.scsi-14f504e46494c4500494b5042546d2d646744372d31616d61 + # list iso images + pvesm list --iso -To get the filesystem path for a use: - + # list openvz templates + pvesm list --vztmpl + + # show filesystem path for a volume pvesm path +=include pve_copyright