generate correct manual page and .pod

This commit is contained in:
Dietmar Maurer
2011-10-20 08:20:37 +02:00
parent 3319f21ce0
commit 630f436a63
3 changed files with 96 additions and 90 deletions

160
pvesm
View File

@ -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,73 +180,13 @@ pvesm - PVE Storage Manager
=head1 SYNOPSIS
pvesm <COMMAND> [OPTIONS]
# scan iscsi host for available targets
pvesm scan iscsi <HOST[:PORT]>
# scan nfs server for available exports
pvesm scan nfs <HOST>
# add storage pools
pvesm add <STORAGE_ID> <TYPE> <OPTIONS>
pvesm add <STORAGE_ID> dir --path <PATH>
pvesm add <STORAGE_ID> nfs --path <PATH> --server <SERVER> --export <EXPORT>
pvesm add <STORAGE_ID> lvm --vgname <VGNAME>
pvesm add <STORAGE_ID> iscsi --portal <HOST[:PORT]> --target <TARGET>
# disable storage pools
pvesm set <STORAGE_ID> --disable 1
# enable storage pools
pvesm set <STORAGE_ID> --disable 0
# change/set storage options
pvesm set <STORAGE_ID> <OPTIONS>
pvesm set <STORAGE_ID> --shared 1
pvesm set local --format qcow2
pvesm set <STORAGE_ID> --content iso
# remove storage pools - does not delete any data
pvesm remove <STORAGE_ID>
# add single devices??
# alloc volumes
pvesm alloc <STORAGE_ID> <VMID> <name> <size> [--format <raw|qcow2>]
# alloc 4G volume in local storage - use auto generated name
pvesm alloc local <VMID> '' 4G
# free volumes (warning: destroy/deletes all volume data)
pvesm free <VOLUME_ID>
# list storage status
pvesm status
# list storage contents
pvesm list <STORAGE_ID> [--vmid <VMID>]
# list volumes allocated by VMID
pvesm list <STORAGE_ID> --vmid <VMID>
# list iso images
pvesm list <STORAGE_ID> --iso
# list openvz templates
pvesm list <STORAGE_ID> --vztmpl
# show filesystem path for a volume
pvesm path <VOLUME_ID>
# import disks ??
=include synopsis
=head1 DESCRIPTION
=head2 Storage pools
Each storage pool is uniquely identified by its <STORAGE_ID>.
Each storage pool is uniquely identified by its <STORAGE_ID>.
=head3 Storage content
@ -270,9 +205,68 @@ dependent volume name, separated by colon. A valid <VOLUME_ID> looks like:
local:vztmpl/debian-5.0-joomla_1.5.9-1_i386.tar.gz
iscsi-storage:0.0.2.scsi-14f504e46494c4500494b5042546d2d646744372d31616d61
iscsi-storage:0.0.2.scsi-14f504e46494c4500494b5042546d2d646744372d31616d61
To get the filesystem path for a <VOLUME_ID> use:
pvesm path <VOLUME_ID>
=head1 EXAMPLES
# scan iscsi host for available targets
pvesm scan iscsi <HOST[:PORT]>
# scan nfs server for available exports
pvesm scan nfs <HOST>
# add storage pools
pvesm add <STORAGE_ID> <TYPE> <OPTIONS>
pvesm add <STORAGE_ID> dir --path <PATH>
pvesm add <STORAGE_ID> nfs --path <PATH> --server <SERVER> --export <EXPORT>
pvesm add <STORAGE_ID> lvm --vgname <VGNAME>
pvesm add <STORAGE_ID> iscsi --portal <HOST[:PORT]> --target <TARGET>
# disable storage pools
pvesm set <STORAGE_ID> --disable 1
# enable storage pools
pvesm set <STORAGE_ID> --disable 0
# change/set storage options
pvesm set <STORAGE_ID> <OPTIONS>
pvesm set <STORAGE_ID> --shared 1
pvesm set local --format qcow2
pvesm set <STORAGE_ID> --content iso
# remove storage pools - does not delete any data
pvesm remove <STORAGE_ID>
# alloc volumes
pvesm alloc <STORAGE_ID> <VMID> <name> <size> [--format <raw|qcow2>]
# alloc 4G volume in local storage - use auto generated name
pvesm alloc local <VMID> '' 4G
# free volumes (warning: destroy/deletes all volume data)
pvesm free <VOLUME_ID>
# list storage status
pvesm status
# list storage contents
pvesm list <STORAGE_ID> [--vmid <VMID>]
# list volumes allocated by VMID
pvesm list <STORAGE_ID> --vmid <VMID>
# list iso images
pvesm list <STORAGE_ID> --iso
# list openvz templates
pvesm list <STORAGE_ID> --vztmpl
# show filesystem path for a volume
pvesm path <VOLUME_ID>
=include pve_copyright