]> git.proxmox.com Git - pve-common.git/blame - README.dev
README.dev: adopt package list for stretch
[pve-common.git] / README.dev
CommitLineData
a4a9a328 1= Setup PVE Development Environment =
e143e9d8 2
8bc53243
DM
31. Install Debian 'jessie'
42. Configure pvetest repository in apt sources.list
a4a9a328
DM
5
6 deb http://download.proxmox.com/debian jessie pvetest
7
83. Add our repository key with apt-key:
9
10 wget -O- "http://download.proxmox.com/debian/key.asc" | apt-key add -
11
124. make sure you have a read IP address for your hostname in /etc/hosts
8bc53243 13 (using 127.0.1.1 will not work)
8bc53243 14
a4a9a328
DM
155. run: apt-get update
166. run: apt-get dist-upgrade
48e957b9 177. run: apt-get install proxmox-ve
e143e9d8 18
a4a9a328
DM
19You should now have a working Proxmox VE installation.
20
21= Install build prerequisites for development environment =
47e4eb11 22
48e957b9
MR
23apt-get -y install build-essential git-core git-email debhelper \
24autotools-dev autogen dh-autoreconf dkms doxygen check pkg-config \
25groff quilt dpatch automake autoconf libtool lintian libdevel-cycle-perl \
26libjson-perl libcommon-sense-perl liblinux-inotify2-perl libio-stringy-perl \
8bc53243
DM
27libstring-shellquote-perl dh-systemd rpm2cpio libsqlite3-dev sqlite3 \
28libglib2.0-dev librrd-dev librrds-perl rrdcached libdigest-hmac-perl \
29libxml-parser-perl gdb libcrypt-openssl-random-perl \
30libcrypt-openssl-rsa-perl libnet-ldap-perl libauthen-pam-perl \
31libjson-xs-perl libterm-readline-gnu-perl oathtool libmime-base32-perl \
32liboath0 libpci-dev texi2html libsdl1.2-dev libgnutls28-dev \
33libspice-protocol-dev xfslibs-dev libnuma-dev libaio-dev \
1cfd43f6 34pve-libspice-server-dev libusbredirparser-dev glusterfs-common \
8bc53243
DM
35libusb-1.0-0-dev librbd-dev libpopt-dev iproute bridge-utils numactl \
36glusterfs-common ceph-common python-ceph libgoogle-perftools4 \
37libfile-chdir-perl lvm2 glusterfs-client liblockfile-simple-perl \
37640d62 38libsystemd-dev libreadline-gplv2-dev libio-multiplex-perl \
8bc53243
DM
39libnetfilter-log-dev libipset3 ipset socat libsasl2-dev libogg-dev \
40python-pyparsing libfilesys-df-perl libcrypt-ssleay-perl \
41libfile-readbackwards-perl libanyevent-perl libanyevent-http-perl \
42unzip liblocale-po-perl vlan ifenslave-2.6 libfile-sync-perl cstream \
43lzop dtach apt-transport-https hdparm gdisk parted ttf-dejavu-core \
37640d62 44liblzma-dev dosfstools mtools libxen-dev libfuse-dev corosync-dev \
45libqb-dev libapparmor-dev docbook2x libcap-dev dh-apparmor \
fe949d0e
WL
46graphviz libseccomp-dev libglib-perl libgtk3-perl libnss3-dev libdlm-dev \
47libudev-dev
e143e9d8 48
a4a9a328
DM
49= Compile PVE packages from Source =
50
51Download and install the following git modules in order from top to bottom:
e143e9d8 52
7da024b1 53# git clone git://git.proxmox.com/git/<PACKAGE.git>
e143e9d8 54
7da024b1
DM
55You currently need the following packages:
56
7da024b1 57pve-common.git
f77a3f79 58pve-docs.git
7da024b1 59pve-cluster.git
56d42b76 60lvm.git
7da024b1
DM
61pve-access-control.git
62pve-storage.git
63pve-qemu-kvm.git
64qemu-server.git
65vncterm.git
8bc53243
DM
66spiceterm.git
67#vzquota.git
68#vzctl.git
69#fence-agents-pve.git
70#resource-agents-pve.git
7da024b1 71pve-manager.git
fe949d0e 72#pve-kernel-3.10.0.git
37640d62 73#libiscsi.git
8bc53243 74#gfs2-utils.git
60f4e8c7 75ksm-control-daemon.git
fe949d0e
WL
76pve-container.git
77pve-firewall.git
78pve-kernel.git
e143e9d8 79
60f4e8c7 80Most packages can be installed with 'make dinstall' command.
e143e9d8
DM
81
824. Reboot the system.
835. Learn to use the quilt patch scripts.
846. Happy coding.
85
86There is an experimental package containing the API documentation
87as ExtJS application:
88
7da024b1
DM
89pve2-api-doc.git
90
91You can view the source code at:
92
93https://git.proxmox.com
e143e9d8
DM
94
95
a4a9a328 96= REST vs. SOAP =
e143e9d8
DM
97
98We decided to change our SOAP API (1.X) and use a REST like API. The
99concept is described in [1] (Resource Oriented Architecture
100(ROA)). The main advantage is that we are able to remove a lot of code
101(the whole SOAP stack) to reduce software complexity.
102
103We also moved away from server side content generation. Instead we use
104the ExtJS Rich Internet Application Framework
105(http://www.sencha.com).
106
107That framework, like any other AJAX toolkit, can talk directly to the
108REST API using JSON. So we were able to remove the server side
109template toolkit completely.
110
a4a9a328 111= JSON and JSON Schema =
e143e9d8
DM
112
113We use JSON as data format, because it is simple and parse-able by any
114web browser.
115
116Additionally, we use JSON Schema [2] to formally describe our API. So
117we can automatically generate the whole API Documentation, and we can
118verify all parameters and return values.
119
60f4e8c7 120A great side effect was that we are able to use JSON Schema to
e143e9d8
DM
121produce command line argument parsers automatically. In fact, the REST
122API and the command line tools use the same code.
123
124Object linkage is done using the JSON Hyper Schema (links property).
125
126A small utility called 'pvesh' exposes the whole REST API on the command
127line.
128
129So here is a summary of the advantage:
130
131 - easy, human readable data format (native web browser format)
132 - automatic parameter verification (we can also verify return values)
133 - automatic generation of API documentation
134 - easy way to create command line tools (using same API).
135
a4a9a328 136= API Implementation (PVE::RESTHandler) =
e143e9d8
DM
137
138All classes exposing methods on the API use PVE::RESTHandler as base class.
139
140 use base qw(PVE::RESTHandler);
141
142To expose methods, one needs to call register_method():
143
144 __PACKAGE__->register_method ($schema);
145
146Where $schema is a PVE method schema as described in
147PVE::JSONSchema. It includes a description of parameters and return
148values, and a reference to the actual code
149
150__PACKAGE__->register_method ({
151 name => 'echo',
152 path => 'echo',
153 method => 'GET',
154 description => "simple return value of parameter 'text'",
155 parameters => {
156 additionalProperties => 0,
157 properties => {
158 text => {
159 type => 'string',
160 }
161 },
162 },
163 returns => {
164 type => 'string',
165 },
166 code => sub {
ef73f03b 167 my ($param) = @_;
e143e9d8
DM
168
169 return $param->{text};
170 }
171});
172
173The 'name' property is only used if you want to call the method
174directly from Perl. You can do that using:
175
176 print __PACKAGE__->echo({ text => "a test" });
177
178We use Perl's AUTOLOAD feature to implement this. Note: You need to
179pass parameters a HASH reference.
180
181There is a special helper method called cli_handler(). This is used by
182the CLIHandler Class for command line tools, where you want to pass
183arguments as array of strings. This uses Getopt::Long to parse parameters.
184
185There is a second way to map names to methods - using the 'path'
186property. And you can register subclasses. That way you can set up a
187filesystem like hierarchy to access methods.
188
189Here is an example:
190----------------------------
191package C1;
192
193__PACKAGE__->register_method ({
194 subclass => "C2",
195 path => 'sub2',
196});
197
198
199__PACKAGE__->register_method ({
200 name => 'list1',
201 path => 'index',
202 method => 'GET',
203 ...
204});
205
206package C2;
207
208__PACKAGE__->register_method ({
209 name => 'list2',
210 path => 'index',
211 method => 'GET',
212 ...
213});
214-------------------------------
215
216The utily method find_handler (in PVE::RESTHandler) can be use to do
217'path' related method lookups.
218
219C1->find_handler('GET', "/index") => C1::list1
220C1->find_handler('GET', "/sub2/index") => C2::list2
221
222The HTTP server use the URL (a path) to find the corresponding method.
223
224
a4a9a328
DM
225= References =
226
e143e9d8
DM
227[1] RESTful Web Services
228Web services for the real world
229
230By
231 Leonard Richardson, Sam Ruby
232Publisher:
233 O'Reilly Media
234Released:
235 May 2007
236
237[2] JSON Schema links: http://json-schema.org/