[pve-devel] r6484 - in qemu-server/pve2: . PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Aug 17 12:13:30 CEST 2011


Author: dietmar
Date: 2011-08-17 12:13:30 +0200 (Wed, 17 Aug 2011)
New Revision: 6484

Added:
   qemu-server/pve2/gen-vmconf-pod.pl
Modified:
   qemu-server/pve2/ChangeLog
   qemu-server/pve2/Makefile
   qemu-server/pve2/PVE/QemuServer.pm
   qemu-server/pve2/qm
Log:
generate better documentation


Modified: qemu-server/pve2/ChangeLog
===================================================================
--- qemu-server/pve2/ChangeLog	2011-08-17 09:43:55 UTC (rev 6483)
+++ qemu-server/pve2/ChangeLog	2011-08-17 10:13:30 UTC (rev 6484)
@@ -1,3 +1,8 @@
+2011-08-17  Proxmox Support Team  <support at proxmox.com>
+
+	* PVE/QemuServer.pm (load_defaults): only read 'keyboard' from
+	datacenter.cfg
+
 2011-08-15  Proxmox Support Team  <support at proxmox.com>
 
 	* PVE/QemuServer.pm (config_to_command): use -device instead of

Modified: qemu-server/pve2/Makefile
===================================================================
--- qemu-server/pve2/Makefile	2011-08-17 09:43:55 UTC (rev 6483)
+++ qemu-server/pve2/Makefile	2011-08-17 10:13:30 UTC (rev 6484)
@@ -13,6 +13,7 @@
 VARLIBDIR=/var/lib/${PACKAGE}
 MANDIR=${PREFIX}/share/man
 DOCDIR=${PREFIX}/share/doc
+PODDIR=${PREFIX}/share/doc/${PACKAGE}/pod
 MAN1DIR=${MANDIR}/man1/
 export PERLDIR=${PREFIX}/share/perl5
 PERLINCDIR=${PERLDIR}/asm-x86_64
@@ -42,26 +43,38 @@
 sparsecp: sparsecp.c utils.c
 	gcc -O2 -Wall -o sparsecp sparsecp.c
 
-%.1.gz: %
-	rm -f $*.1.gz
-	pod2man -n $* -s 1 -r ${VERSION} -c "Proxmox Documentation"  <$* |gzip -c9 >$*.1.gz
+%.1.gz: %.1.pod
+	rm -f $@
+	cat $<|pod2man -n $* -s 1 -r ${VERSION} -c "Proxmox Documentation"|gzip -c9 >$@
 
-qm.1.gz: qm
-	perl -I. ./qm printmanpod|pod2man -n qm -s 1 -r ${VERSION} -c "Proxmox Documentation"|gzip -c9 >$@
+%.5.gz: %.5.pod
+	rm -f $@
+	cat $<|pod2man -n $* -s 5 -r ${VERSION} -c "Proxmox Documentation"|gzip -c9 >$@
 
-PKGSOURCES=qm qm.1.gz qmigrate qmigrate.1.gz qmrestore qmrestore.1.gz sparsecp vmtar qemu.init.d qmupdate control
+%.1.pod: %
+	podselect $*>$@
 
+qm.1.pod: qm PVE/QemuServer.pm
+	perl -I. ./qm printmanpod >$@
+
+vm.conf.5.pod: gen-vmconf-pod.pl PVE/QemuServer.pm 
+	perl -I. ./gen-vmconf-pod.pl >$@
+
+PKGSOURCES=qm qm.1.gz qm.1.pod qmigrate qmigrate.1.gz qmrestore qmrestore.1.gz sparsecp vmtar qemu.init.d qmupdate control vm.conf.5.pod vm.conf.5.gz
+
 .PHONY: install
 install: ${PKGSOURCES}
 	install -d ${DESTDIR}/${SBINDIR}
 	install -d ${DESTDIR}/etc/${PACKAGE}
 	install -d ${DESTDIR}${LIBDIR}
 	install -d ${DESTDIR}${VARLIBDIR}
+	install -d ${DESTDIR}${PODDIR}
 	install -d ${DESTDIR}/usr/share/man/man1
-	install -d ${DESTDIR}/usr/share/qemu-server
-	install -m 0644 pve-usb.cfg ${DESTDIR}/usr/share/qemu-server
-	install -d ${DESTDIR}/var/run/qemu-server
-	install -d ${DESTDIR}/var/lock/qemu-server
+	install -d ${DESTDIR}/usr/share/man/man5
+	install -d ${DESTDIR}/usr/share/${PACKAGE}
+	install -m 0644 pve-usb.cfg ${DESTDIR}/usr/share/${PACKAGE}
+	install -d ${DESTDIR}/var/run/${PACKAGE}
+	install -d ${DESTDIR}/var/lock/${PACKAGE}
 	make -C PVE install
 	install -m 0755 qm ${DESTDIR}${SBINDIR}
 	install -m 0755 qmigrate ${DESTDIR}${SBINDIR}
@@ -73,8 +86,11 @@
 	install -s -m 0755 sparsecp ${DESTDIR}${LIBDIR}
 #	pod2man -n qemu-server -s 1 -r "proxmox 1.0" -c "Proxmox Documentation" <qemu-server.pod | gzip -9 > ${DESTDIR}/usr/share/man/man1/qemu-server.1.gz
 	install -m 0644 qm.1.gz ${DESTDIR}/usr/share/man/man1/
+	install -m 0644 qm.1.pod ${DESTDIR}/${PODDIR}
 	install -m 0644 qmigrate.1.gz ${DESTDIR}/usr/share/man/man1/
 	install -m 0644 qmrestore.1.gz ${DESTDIR}/usr/share/man/man1/
+	install -m 0644 vm.conf.5.pod ${DESTDIR}/${PODDIR}
+	install -m 0644 vm.conf.5.gz ${DESTDIR}/usr/share/man/man5/
 
 .PHONY: deb ${DEB}
 deb ${DEB}: ${PKGSOURCES}
@@ -107,7 +123,7 @@
 
 .PHONY: clean
 clean: 	
-	rm -rf debian *.deb qm.1.gz control vzsyscalls.ph _h2ph_pre.ph ${PACKAGE}-*.tar.gz dist
+	rm -rf debian *.deb qm.1.gz control vzsyscalls.ph _h2ph_pre.ph ${PACKAGE}-*.tar.gz dist *.1,gz *.pod
 	find . -name '*~' -exec rm {} ';'
 
 

Modified: qemu-server/pve2/PVE/QemuServer.pm
===================================================================
--- qemu-server/pve2/PVE/QemuServer.pm	2011-08-17 09:43:55 UTC (rev 6483)
+++ qemu-server/pve2/PVE/QemuServer.pm	2011-08-17 10:13:30 UTC (rev 6484)
@@ -155,8 +155,9 @@
     cpulimit => {
 	optional => 1,
 	type => 'integer',
-	description => "Limit of CPU usage in per cent. Note if the computer has 2 CPUs, it has total of 200% CPU time. Default CPU limit is 0 (no CPU limit).\n\nNOTE: This option is currently ignored.",
+	description => "Limit of CPU usage in per cent. Note if the computer has 2 CPUs, it has total of 200% CPU time. Value '0' indicates no CPU limit.\n\nNOTE: This option is currently ignored.",
 	minimum => 0,
+	default => 0,
     },
     cpuunits => {
 	optional => 1,
@@ -178,7 +179,7 @@
 	type => 'string',
 	description => "Keybord layout for vnc server. Default is read from the datacenter configuration file.",
 	enum => [ keys %$keymaphash ],
-	default => 'en',
+	default => 'en-us',
     },
     name => {
 	optional => 1,
@@ -215,7 +216,7 @@
     boot => {
 	optional => 1,
 	type => 'string',
-	description => "Boot on floppy (a), hard disk (c), CD-ROM (d), or network (n). Default is 'cad' (disk, floppy, cdrom)",
+	description => "Boot on floppy (a), hard disk (c), CD-ROM (d), or network (n).",
 	pattern => '[acdn]{1,4}',
 	default => 'cad',
     },
@@ -228,8 +229,9 @@
     smp => {
 	optional => 1,
 	type => 'integer',
-	description => "The number of CPUs (default=1). Please use option -sockets instead.",
+	description => "The number of CPUs. Please use option -sockets instead.",
 	minimum => 1,
+	default => 1,
     },
     sockets => {
 	optional => 1,
@@ -276,7 +278,7 @@
     vga => {
 	optional => 1,
 	type => 'string',
-	description => "Select VGA type. Default is a Cirrus Logic GD5446 PCI VGA card ('cirrus'). If you want to use high resolution modes (>= 1280x1024x16) then you should use option 'std' or 'vmware'. Default is 'std' for win7/w2k8, and 'cirrur' for other ostype.",
+	description => "Select VGA type. If you want to use high resolution modes (>= 1280x1024x16) then you should use option 'std' or 'vmware'. Default is 'std' for win7/w2k8, and 'cirrur' for other OS types",
 	enum => [qw(std cirrus vmware)],
     },
     hostpci => {
@@ -323,8 +325,9 @@
 	optional => 1,
 	type => 'string', 
 	typetext => "(now | YYYY-MM-DD | YYYY-MM-DDTHH:MM:SS)",
-	description => "Set the initial date of the real time clock. Valid format for date are: 'now' or '2006-06-17T16:01:21' or '2006-06-17'. The default value is 'now'.",
-	pattern => '(now|\d{4}-\d{1,2}-\d{1,2}(T\d{1,2}:\d{1,2}:\d{1,2})?)',	    
+	description => "Set the initial date of the real time clock. Valid format for date are: 'now' or '2006-06-17T16:01:21' or '2006-06-17'.",
+	pattern => '(now|\d{4}-\d{1,2}-\d{1,2}(T\d{1,2}:\d{1,2}:\d{1,2})?)',
+	default => 'now',
     },
     args => {
 	optional => 1,
@@ -1507,39 +1510,9 @@
 	}
     }
    
-    # and only allow a few values to be overwritten by
-    # seetings in the datacenter option file.
-    my $allow_overwrite = {
-	keyboard => 1,
-    };
+    my $conf = PVE::Cluster::cfs_read_file('datacenter.cfg');
+    $res->{keyboard} = $conf->{keyboard} if $conf->{keyboard};
 
-    my $filename = "/etc/pve/datacenter.cfg";
-
-    my $fh = new IO::File ($filename, "r") || return $res;
-
-    while (my $line = <$fh>) {	
-	next if $line =~ m/^\#/;
-	next if $line =~ m/^\s*$/;
-
-	if ($line =~ m/^([a-z][a-z_]*):\s*(\S+)\s*$/) {
-	    my $key = $1;
-	    my $value = $2;
-
-	    next if !$allow_overwrite->{$key};
-
-	    if ($confdesc->{$key} && $confdesc->{$key}->{default}) {
-		eval { $value = check_type($key, $value); };
-		if ($@) {
-		    warn "load_defaults - unable to parse value of '$key' -  $@";
-		} else {
-		    $res->{$key} = $value;
-		}
-	    } else {
-		warn "load_defaults - unknown setting '$key'\n";
-	    }
-	}
-    }
-
     return $res;
 }
 

Added: qemu-server/pve2/gen-vmconf-pod.pl
===================================================================
--- qemu-server/pve2/gen-vmconf-pod.pl	                        (rev 0)
+++ qemu-server/pve2/gen-vmconf-pod.pl	2011-08-17 10:13:30 UTC (rev 6484)
@@ -0,0 +1,48 @@
+#!/usr/bin/perl -w
+
+package main;
+
+use strict;
+use PVE::Tools;
+use PVE::Cluster;
+use PVE::PodParser;
+use PVE::QemuServer;
+
+my $prop = PVE::QemuServer::json_config_properties();
+my $format = PVE::PodParser::dump_properties($prop);
+
+my $parser = PVE::PodParser->new();
+$parser->{include}->{format} = $format;
+$parser->parse_from_file($0);
+
+exit 0;
+
+__END__
+
+=head1 NAME
+
+vm.conf - Proxmox VE virtual machine (qemu/kvm) configuration files.
+
+=head1 SYNOPSYS
+
+The F</etc/pve/qemu-server/C<VMID>.conf> files stores VM
+configuration, where C<VMID> is the numeric ID of the given VM. Note
+that C<VMID <= 100> are reserved for internal purposes.
+
+=head1 FILE FORMAT
+
+Configuration file use a simple colon separated key/value format. Each
+line has the following format:
+
+ OPTION: value
+
+Blank lines in the file are ignored, and lines starting with a C<#>
+character are treated as comments and are also ignored.
+
+One can use the F<qm> command to generate and modify those files.
+
+=head1 OPTIONS
+
+=include format
+
+=include pve_copyright


Property changes on: qemu-server/pve2/gen-vmconf-pod.pl
___________________________________________________________________
Added: svn:executable
   + *

Modified: qemu-server/pve2/qm
===================================================================
--- qemu-server/pve2/qm	2011-08-17 09:43:55 UTC (rev 6483)
+++ qemu-server/pve2/qm	2011-08-17 10:13:30 UTC (rev 6484)
@@ -466,6 +466,8 @@
 
 =head1 SYNOPSIS
 
+=include synopsis
+
 =head1 DESCRIPTION
 
 qm is a script to manage virtual machines with qemu/kvm. You can
@@ -474,3 +476,4 @@
 parameters in the associated config file. It is also possible to
 create and delete virtual disks.
 
+=include pve_copyright



More information about the pve-devel mailing list