{"id":13584789,"url":"https://github.com/proxmox/pve-common","last_synced_at":"2025-12-16T22:58:11.707Z","repository":{"id":5861931,"uuid":"7078931","full_name":"proxmox/pve-common","owner":"proxmox","description":"Proxmox Project's Common Perl Code","archived":false,"fork":false,"pushed_at":"2025-04-04T13:51:53.000Z","size":1440,"stargazers_count":72,"open_issues_count":4,"forks_count":26,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-04T14:35:36.072Z","etag":null,"topics":["perl","proxmox","proxmox-mail-gateway","proxmox-ve"],"latest_commit_sha":null,"homepage":"https://git.proxmox.com","language":"Perl","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/proxmox.png","metadata":{"files":{"readme":"README.dev","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-12-09T13:21:42.000Z","updated_at":"2025-04-04T13:51:57.000Z","dependencies_parsed_at":"2024-04-21T10:31:00.549Z","dependency_job_id":"807df42b-4d3e-4abd-a127-1dd6706f07c4","html_url":"https://github.com/proxmox/pve-common","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proxmox%2Fpve-common","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proxmox%2Fpve-common/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proxmox%2Fpve-common/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proxmox%2Fpve-common/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/proxmox","download_url":"https://codeload.github.com/proxmox/pve-common/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601448,"owners_count":20964862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["perl","proxmox","proxmox-mail-gateway","proxmox-ve"],"created_at":"2024-08-01T15:04:31.434Z","updated_at":"2025-12-16T22:58:11.702Z","avatar_url":"https://github.com/proxmox.png","language":"Perl","funding_links":[],"categories":["Perl"],"sub_categories":[],"readme":"= Setup PVE Development Environment =\n\n0.  Read https://pve.proxmox.com/wiki/Developer_Documentation\n1.  Install Debian 12 Bookworm (you can also start from a PVE installation and\n    skip step 2 - 5, 7 - 11)\n2.  Configure the network interface(s)\n3.  Change the IP address of your hostname for proper name resolution\n    in /etc/hosts\n    Using 127.0.1.1 will not work, so change it to an IP address from your\n    local network!\n\n4:  Check that the Debian repositories are set properly.\n    See https://wiki.debian.org/SourcesList for more information.\n\n5.  Optional: Install openssh-server and connect via ssh to the host.\n\n    run: apt-get update \u0026\u0026 apt-get install openssh-server\n    Connect via ssh to host and switch user to root\n\n6.  Configure 'pvetest' repository in /etc/apt/sources.list.d/:\n\n    run: echo \"deb http://download.proxmox.com/debian bookworm pvetest\" \u003e /etc/apt/sources.list.d/pve-development.list\n\n7.  Add the repository key, run:\n\n    wget -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg \"https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg\"\n\n8.  run: apt-get update \u0026\u0026 apt-get dist-upgrade\n9.  run: apt-get install proxmox-ve\n10. run: mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak\n\n11. You should now have a working Proxmox VE installation.\n    Open a browser: https://\u003chost_IP_address\u003e:8006 e.g. https://10.0.0.90:8006\n\n\n= Install build prerequisites for development environment =\n\nNOTE: this is a huge and probably outdated list intended to be able to build\n(almost) all packages, from the UI/API components to backend components to our\nLinux Kernel.  If you only want to hack on specific topics you won't need most\nof those.\nInstead we try to have a complete list of build dependencies in each source\nrepositories 'debian/control' file. If you run `make deb` dpkg-buildpackage\nwill stop and tell you if you miss some required packages.\n\n12. For installing the most important, always needed, ones run:\n\napt-get install build-essential git git-email debhelper pve-doc-generator\n\nAdditionally, for quickly installing (almost) all build dependencies run:\n\nWARNING: this list is almost for sure outdated! Use the build-deps definitions\ndefined in each package! You could install `devscripts` (huge package, but nice\nhelpers) and use:\n# mk-build-deps --install\nin the top-level directory of a git repository.\n\napt-get install autotools-dev autogen dh-autoreconf dkms doxygen check pkg-config \\\ngroff quilt dpatch automake autoconf libtool lintian libdevel-cycle-perl \\\nlibjson-perl libcommon-sense-perl liblinux-inotify2-perl libio-stringy-perl \\\nlibstring-shellquote-perl dh-systemd rpm2cpio libsqlite3-dev sqlite3 \\\nlibglib2.0-dev librrd-dev librrds-perl rrdcached libdigest-hmac-perl \\\nlibxml-parser-perl gdb libcrypt-openssl-random-perl \\\nlibcrypt-openssl-rsa-perl libnet-ldap-perl libauthen-pam-perl \\\nlibjson-xs-perl libterm-readline-gnu-perl oathtool libmime-base32-perl \\\nliboath0 libpci-dev texi2html libsdl1.2-dev libgnutls28-dev \\\nlibspice-protocol-dev xfslibs-dev libnuma-dev libaio-dev \\\npve-libspice-server-dev libusbredirparser-dev glusterfs-common \\\nlibusb-1.0-0-dev librbd-dev libpopt-dev iproute bridge-utils numactl \\\nglusterfs-common ceph-common python-ceph libgoogle-perftools4 \\\nlibfile-chdir-perl lvm2 glusterfs-client liblockfile-simple-perl \\\nlibsystemd-dev libreadline-gplv2-dev libio-multiplex-perl \\\nlibnetfilter-log-dev libipset3 ipset socat libsasl2-dev libogg-dev \\\npython-pyparsing libfilesys-df-perl libcrypt-ssleay-perl \\\nlibfile-readbackwards-perl libanyevent-perl libanyevent-http-perl \\\nunzip liblocale-po-perl libfile-sync-perl cstream \\\nlzop dtach hdparm gdisk parted ttf-dejavu-core \\\nliblzma-dev dosfstools mtools libxen-dev libfuse-dev libcpg-dev libquorum-dev \\\nlibcmap-dev libuuid-perl libqb-dev libapparmor-dev docbook2x libcap-dev \\\ndh-apparmor graphviz libseccomp-dev libglib-perl libgtk3-perl libnss3-dev \\\nlibdlm-dev libudev-dev asciidoc-dblatex source-highlight libiscsi-dev \\\nlibiscsi7 librsvg2-bin libarchive-dev libgpgme-dev libcurl4-gnutls-dev \\\nlibtest-mockmodule-perl libjemalloc-dev libjpeg-dev\n\n\n= Compile PVE packages from Source =\n\n13: Download and install git repositories as Proxmox modules:\n\n    run: mkdir /root/proxmox \u0026\u0026 cd /root/proxmox\n\n    run: git clone git://git.proxmox.com/git/pve-common.git\n\n    'pve-common.git' is some kind of starting repository and needed for some\n    other repositories as dependency.\n    Install this to get an idea of how the installation process is working.\n\n    See https://git.proxmox.com/ for all available repositories.\n\n14: Most packages can be installed with 'make dinstall' command.\n    run: cd pve-common \u0026\u0026 make dinstall\n\n15: Reboot the system.\n16. Learn to use the quilt patch scripts.\n17. Happy coding!\n\n\n= REST vs. SOAP =\n\nWe decided to change our SOAP API (1.X) and use a REST like API. The\nconcept is described in [1] (Resource Oriented Architecture\n(ROA)). The main advantage is that we are able to remove a lot of code\n(the whole SOAP stack) to reduce software complexity.\n\nWe also moved away from server side content generation. Instead we use\nthe ExtJS Rich Internet Application Framework\n(http://www.sencha.com). \n\nThat framework, like any other AJAX toolkit, can talk directly to the\nREST API using JSON. So we were able to remove the server side\ntemplate toolkit completely.\n\n= JSON and JSON Schema =\n\nWe use JSON as data format, because it is simple and parse-able by any\nweb browser.\n\nAdditionally, we use JSON Schema [2] to formally describe our API. So\nwe can automatically generate the whole API Documentation, and we can\nverify all parameters and return values.\n\nA great side effect was that we are able to use JSON Schema to\nproduce command line argument parsers automatically. In fact, the REST\nAPI and the command line tools use the same code.\n\nObject linkage is done using the JSON Hyper Schema (links property).\n\nA small utility called 'pvesh' exposes the whole REST API on the command\nline.\n\nSo here is a summary of the advantage:\n\n   - easy, human readable data format (native web browser format)\n   - automatic parameter verification (we can also verify return values)\n   - automatic generation of API documentation\n   - easy way to create command line tools (using same API).\n\n= API Implementation (PVE::RESTHandler) =\n\nAll classes exposing methods on the API use PVE::RESTHandler as base class.\n\n  use base qw(PVE::RESTHandler);\n\nTo expose methods, one needs to call register_method():\n\n  __PACKAGE__-\u003eregister_method ($schema);\n\nWhere $schema is a PVE method schema as described in\nPVE::JSONSchema. It includes a description of parameters and return\nvalues, and a reference to the actual code\n\n__PACKAGE__-\u003eregister_method ({\n    name =\u003e 'echo', \n    path =\u003e 'echo', \n    method =\u003e 'GET',\n    description =\u003e \"simple return value of parameter 'text'\",\n    parameters =\u003e {\n\tadditionalProperties =\u003e 0,\n\tproperties =\u003e {\n\t    text =\u003e {\n\t    \t type =\u003e 'string',\n\t    }\t  \n\t},\n    },\n    returns =\u003e {\n\ttype =\u003e 'string',\n    },\n    code =\u003e sub {\n\tmy ($param) = @_;\n\n\treturn $param-\u003e{text};\n    }\n});\n\nThe 'name' property is only used if you want to call the method\ndirectly from Perl. You can do that using:\n\n  print __PACKAGE__-\u003eecho({ text =\u003e \"a test\" });\n\nWe use Perl's AUTOLOAD feature to implement this. Note: You need to\npass parameters a HASH reference.\n\nThere is a special helper method called cli_handler(). This is used by\nthe CLIHandler Class for command line tools, where you want to pass\narguments as array of strings. This uses Getopt::Long to parse parameters.\n\nThere is a second way to map names to methods - using the 'path'\nproperty.  And you can register subclasses. That way you can set up a\nfilesystem like hierarchy to access methods. \n\nHere is an example:\n----------------------------\npackage C1;\n\n__PACKAGE__-\u003eregister_method ({\n    subclass =\u003e \"C2\",  \n    path =\u003e 'sub2',\n});\n\n\n__PACKAGE__-\u003eregister_method ({\n    name =\u003e 'list1',    \n    path =\u003e 'index',\n    method =\u003e 'GET',\n    ...\n});\n\npackage C2;\n\n__PACKAGE__-\u003eregister_method ({\n    name =\u003e 'list2',    \n    path =\u003e 'index',\n    method =\u003e 'GET',\n    ...\n});\n-------------------------------\n\nThe utily method find_handler (in PVE::RESTHandler) can be use to do\n'path' related method lookups.\n\nC1-\u003efind_handler('GET', \"/index\")      =\u003e C1::list1\nC1-\u003efind_handler('GET', \"/sub2/index\") =\u003e C2::list2\n\nThe HTTP server use the URL (a path) to find the corresponding method. \n\n\n= References =\n\n[1] RESTful Web Services\nWeb services for the real world\n\nBy\n    Leonard Richardson, Sam Ruby\nPublisher:\n    O'Reilly Media\nReleased:\n    May 2007 \n\n[2] JSON Schema links: http://json-schema.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproxmox%2Fpve-common","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproxmox%2Fpve-common","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproxmox%2Fpve-common/lists"}