diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index e0e94a5..0000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,70 +0,0 @@ -# Getting Started with Github - -## Setting up your environment - -Setting up your environment is essential to becoming a contributor using Github. Once your environment is set, you can monitor your activity through the [website](https://github.com/) or [mobile app](https://github.com/mobile). To contribute to this website, you need to set up your own GitHub account. - -## Create a GitHub account and set up your profile - -Need a GitHub account? [Create one](https://github.com/join). Here's an opportunity to get creative with a username that describes your best qualities. You can use an existing GitHub account to contribute to the website repo or any other repo you are currently using. Don't forget to complete the profile associated with your account. The profile is a way of communicating your interest and what you like to do technically. - ->[!NOTE] -> Profiles are public. Please do not put any personal information in your profile. The entire GitHub community can view what you have written. - -## Setting up the GitHub Stack - -The recommendations provided are based on the setup used by professionals contributors. - -### Install Git - -[Git](https://git-scm.com/downloads) (also known as Git Bash) A command-line-based tool that allows you to submit pull requests, manipulate the branches you created and update your local(forked) copy of the repo. The documentation for [how to use Git](https://git-scm.com/doc) is available online. This tool is available on Linux. - -Free CodeCamp recommends this [list](https://www.freecodecamp.org/news/10-important-git-commands-that-every-developer-should-know/) of Git commands developers should know. - -### Visual Code - -[Visual code](https://code.visualstudio.com/) is available in Windows, Mac, and Linux. It is a lean editing tool that has multiple uses for development. The installation is simple and documented on the site. There is an extensive marketplace for extensions to enhance your experience using this tool built right into the application! Extensions allow you to work more closely with Github and publish branches without leaving the Visual code. - -[Walkthrough using Visual Code for your first Pull Request](https://code.visualstudio.com/docs/editor/github). -It is crucial to **get a local copy of the repo before you start working on the site's content.** - ->[!NOTE] ->New branches and pull requests should only be created in your copy of the repo. You will not be making commits directly to **main**. However, you should pull **main** into your local repo to ensure you are working with the latest published content. It will reduce the risk of conflicts and unintentionally overwriting published content once your pull request merges. - -In the documentation, user groups, and support channels, you'll see the terms like **master** and **origin**. Our content will reference the actual names within the repo whenever possible. - -### Refresh your local repo often - -It is essential to regularly update your local copy of the repo to ensure you have the latest changes. All of the updates approved by the reviewer and merged into the repo will be part of this update. A good routine is to update your local repo before you create or update any open pull requests. - -For example, use Git Bash to update your local repo. Change the current working directory to your local project. - -```bash -/c/github/bc/website (main) - -$ git checkout main -$ git pull upstream main -``` - -Completing this step before you edit or create content will reduce the possibility of a [merge conflict](https://docs.github.com/en/github/collaborating-with-pull-requests/addressing-merge-conflicts/about-merge-conflicts#resolving-merge-conflicts). - -### Github Desktop - -If you are new to Github or would like a quick visual of what's going on in the repo, this is the tool for you. At a glance, you can see the history of changes in the repo you are working in, your latest changes as well as branches you've created. You can use the Github desktop application to get a copy of any repo you are working in. The GitHub website can connect directly to your desktop. The tool also can publish your branch instantly to the repo. - -Want to leverage Github Desktop? See [Contributing and collaborating using GitHub Desktop](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop) - -### Gitpod - -Interesting in trying the online experience? Try https://www.gitpod.io/docs/quickstart - -### Tips - - The information will be helpful as you being a journey with Github or to refresh your skills. This list is subject to change based on availability. If one of the links no longer works, please advise us, or share a link you've found useful. - -- [GitHub Docs](https://docs.github.com/en) -- [Markdown Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) -- [Basic syntax of markdown](https://www.markdownguide.org/basic-syntax/) -- [GitHub markdown syntax PDF](https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf) -- [Create an issue or Pull Request](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/working-with-your-remote-repository-on-github-or-github-enterprise/creating-an-issue-or-pull-request) - diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/workflow/github-actions-demo.yml b/.github/workflow/github-actions-demo.yml deleted file mode 100644 index 711d62e..0000000 --- a/.github/workflow/github-actions-demo.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: GitHub Actions Demo -on: [push] -jobs: - Explore-GitHub-Actions: - runs-on: ubuntu-latest - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - - name: Check out repository code - uses: actions/checkout@v2 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ github.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml deleted file mode 100644 index ee1cb11..0000000 --- a/.github/workflows/greetings.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Greetings - -on: [pull_request, issues] - -jobs: - greeting: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: 'Message that will be displayed on users first issue' - pr-message: 'Message that will be displayed on users first pull request' diff --git a/README.md b/README.md index ef29e7a..f314ff2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ## **Speak Code** -SpeakCode - Let's create something useful. +SpeakCode - A collection of code samples created and shared by the community ## **Do you speak code?** @@ -7,55 +7,15 @@ Developers reuse code as part of maintenance, new development, or upgrades. Auto Using an existing library of code, developers can develop new functions or features within the application. These changes are made for accessibility or a change in standards or needs of the business. -### **Examples of code that can be recycled or reused** - -**Microservices** (A distinctive method of developing software systems that focus on building single-function modules with well-defined interfaces and operations.). -```java -/* HelloWorld.java - */ - -public class HelloWorld -{ - public static void main(String[] args) { - System.out.println("Hello World!"); - } -} -``` -**Web APIs** (an application programming interface for either a web server or a web browser) and other web-related components often reuse code. -```json -var xhr = new XMLHttpRequest(); -xhr.open("GET", "https://reqres.in/api/products/3", true); -xhr.onload = function(){ - console.log(xhr.responseText); -}; -xhr.send(); -``` - - -**Object-oriented programming (OOP)** organizes software design around data, or objects, rather than functions and logic +### **Usecases for recycling or reusing Code** + +**Microservices** (A distinctive method of developing software systems that focus on building single-function modules with well-defined interfaces and operations.). **Web APIs** (an application programming interface for either a web server or a web browser) and other web-related components often reuse code. + + **Object-oriented programming (OOP)** organizes software design around data, or objects, rather than functions and logic **Modular programming** is a design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality. -```python -def greet(name): - """ - This function greets to - the person passed in as - a parameter - """ - print("Hello, " + name + ". Good morning!") -``` - -```python -def my_func(): - x = 12 - print("Value inside function:",x) - -x = 24 -my_func() -print("Value outside function:",x) -``` -### **Tips for building your code library** +### **Tips for building a code library** * Choose a consistent method for storing and editing modified code. Github is an excellent example of retaining code ownership, history, and change. @@ -73,6 +33,8 @@ print("Value outside function:",x) Developers can literally spend hours look through blogs, forums, and support for useable code. -**Speak Code** We are working on a special project that has been in the works for years. Decided to take a leap from notebook to screen. So we are working with people that speak the language of code. Our features and project list should be available soon. +### **We need your help** +**Speak Code** is a way to share your learnings with the community. We are collecting code from the global developer community to share with the world. We are community driven and just getting started so we appreciate your support. +Check out our shopping list to see what we are looking for. \ No newline at end of file diff --git a/hacktoberfest.md b/hacktoberfest.md deleted file mode 100644 index 6c8b053..0000000 --- a/hacktoberfest.md +++ /dev/null @@ -1,10 +0,0 @@ -# Hacktoberfest 2021 - -Over 100k people from all over the world participate in Hacktoberfest every October by going to GitHub, choosing a repository, and contributing to it. - -Contributions are made by submitting a pull request (PR) to any Hacktoberfest-affiliated repository. Your participation in Hacktoberfest will be counted once your pull request is judged acceptable (we'll go over how that works in the upcoming sections). - -To be eligible to participate in Hacktoberfest, you must submit at least four accepted pull requests to any of the participating repositories. - - - diff --git a/images/hacktoberfest.png b/images/hacktoberfest.png deleted file mode 100644 index 020b102..0000000 Binary files a/images/hacktoberfest.png and /dev/null differ diff --git a/images/many-roads.jpg b/images/many-roads.jpg deleted file mode 100644 index 08289d8..0000000 Binary files a/images/many-roads.jpg and /dev/null differ diff --git a/images/placeholder.txt b/images/placeholder.txt deleted file mode 100644 index 8b13789..0000000 --- a/images/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/learning-path.md b/learning-path.md deleted file mode 100644 index 0408e43..0000000 --- a/learning-path.md +++ /dev/null @@ -1,42 +0,0 @@ -# Learning Path - -## The road you choose - -![image info](./images/many-roads.jpg) - -Many pathways have led or are leading you to your technical career. Some are traditional or non-traditional, others a mix of both. Some of us learn by doing, others by attending boot camps or another type of training or certification. -Whatever your learning path is, it must be continuous because technology is not constant. It is constantly changing. -Because there are so many factors involved in learning about the technology, we wanted to take the opportunity -to explore technical roles and how you got there. College, Bootcamp, self-taught, certifications. - -For this contribution **(Pull Request)**, we need the following information. - - -You can paste this into a blank `markdown` file and being editing. Want a Quick Start? Try [gitpod](https://www.gitpod.io/docs/quickstart). - -```txt -### Your current role - -### How many year in that role - -### List your path to Learning -* How did you discover your current role? -* What skills did you need? -* What did you have to learn? -* What are you still learning? - -### Recommendations: books, camps, online courses -Provide links whenever possible. - -### One or more key things you have discovered while you are learning. - -### A Positive message for those that are starting out. -``` - -## Last words - -Please name your PR based on your technical role (i.e. system-admin, data-scientist, engineer,e tc) - -Our goal is to share this wealth of knowledge on our site when it goes LIVE. Our bigger goal is to show that many paths lead to technology. Hopefully, it will inspire others to continue or pursue it. For us means a job WELL DONE. - -**NOTE:** during "[Hacktoberfest](https://hacktoberfest.digitalocean.com/) these **Pull Requests** will be counted as *approved*. \ No newline at end of file diff --git a/openQRM-5.3.50-CE/install-openqrm.sh b/openQRM-5.3.50-CE/install-openqrm.sh deleted file mode 100644 index bf25331..0000000 --- a/openQRM-5.3.50-CE/install-openqrm.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -# installs openQRM Community -# - -clear -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this install script as root!" - exit 1 -fi -export OPENQRM_SERVER_INSTALL_DIR=`pushd \`dirname $0\` 1>/dev/null && pwd && popd 1>/dev/null` -cd $OPENQRM_SERVER_INSTALL_DIR -clear -more openQRM-releasenotes.txt -echo -echo -echo -echo "===========================================================" -echo "Welcome to the openQRM Community installation" -echo "===========================================================" -echo "This script will install openQRM and additional required" -echo "third-party software on this system. By using this software" -echo "you accept the GPL License version 2 available at" -echo "http://www.gnu.org/licenses/gpl-2.0.html" -echo - -read -p "Do you accept the above license terms? [y/n] " -n 1 -r CONFIRM -if [[ $CONFIRM =~ ^[Yy]$ ]]; then - if [ -f /etc/debian_version ]; then - apt-get update && apt-get install -y make - elif [ -f /etc/redhat-release ]; then - yum -y install make - elif [ -f /etc/SuSE-release ]; then - zypper --non-interactive install make - else - echo "ERROR: You are trying to install openQRM on an unsupported Linux Distribution!" - exit 1 - fi - cd src/ - make && make install && make start -fi - -echo -cd - -exit 0 - diff --git a/openQRM-5.3.50-CE/openQRM-changelog.txt b/openQRM-5.3.50-CE/openQRM-changelog.txt deleted file mode 100644 index 92ccb61..0000000 --- a/openQRM-5.3.50-CE/openQRM-changelog.txt +++ /dev/null @@ -1,155 +0,0 @@ -openQRM 5.3.40 - 5.3.41 Changelog ------------------------------------ -* updates and refactoring -* deprecated nagios3, added nagios4 - -openQRM 5.3.8 - 5.3.40 Changelog ------------------------------------ -* package dependency updates -* major updates for Debian Buster compatability - -openQRM 5.3.3 - 5.3.8 Changelog ------------------------------------ -* New Community release 5.3.8 -* Added bandwidth monitoring plugin in Enterprise version - -openQRM 5.3.2 Changelog ------------------------------------ -* New Community release 5.3.2 -* Enhanced package dependencies for latest Ubuntu, Debian and CentOS -* removed rpmforge repository dependencies - -openQRM 5.3.1 Changelog ------------------------------------ -* New Community release 5.3 -* Important security update -* Many bugfixes and lots of enhancements especially for KVM and Cloud plugin - -openQRM 5.2.15 Changelog ------------------------------------ -* Amazon EC2 plugin one-VPC-per User -* Amazon EC2 plugin Windows automated Application deployment - -openQRM 5.2.11 - 5.2.14 Changelog ------------------------------------ -* New Amazon EC2 plugin -* Improved VMware vSphere integration -* Improved CentOS Support -* Improved KVM + VMware-vSphere VNC handling - - -openQRM 5.2.1 - 5.2.11 Changelog ------------------------------------ -* New VMware ESX bulk-install plugin -* New (beta) VMware vSphere integration -* New Azure hybrid-cloud support -* Added Cloud Image-to-Host and Image-Billing to reduce Windows VM license costs -* Improved usability - - -openQRM 5.2.1 Changelog ------------------------------------ -* Increased robustness and efficiency for the complete Cloud work-flow -* Enhanced deprovision management intelligence -* Improved usability of the VMware and KVM VM Wizard -* Refined error management for the OpenStack and Hybrid Cloud integration - - -openQRM 5.1.0 - 5.1.4 Changelog ------------------------------------ -Featured changes/highlights: -* new user interface design: Enhanced usability, better user guidance/texts, easier workflows, new wizards -* new openQRM dashboard: important operational information (datacenter load, events, statistics) and plugin-provided QuickLink buttons at a glance -* greatly enhanced KVM support (GlusterFS storage for KVM volumes, virtio disk settings can be configured in the UI) -* greatly enhanced VMWare support (manage existing VMWare ESX systems, install and manage local and network-booted ESX VMs) -* Ansible Support as additional Configuration Management System next to Puppet - The Ansible integration eases up Playbook administration. - Ansible is now also integrated in the openQRM Enterprise Cloud in the same way as Puppet -* windows, cloud integration, puppet, admin pass, hostname, ip-addresses -* new libvirt plugin to manage VMs using libvirt -* new hybrid cloud plugin with enhanced funtionality -- Amazon Web Services and Eucalyptus API compatibility -- manage EC2/Eucalyptus instances in the same way as local resources -- import/export AMIs/VMs from/to AWS or Eucalyptus -- WebSSHTerm for web-based instance logins -- automated application deployment via puppet in EC2/Eucalyptus VMs -- automated monitoring of EC2/Eucalyptus VMs via nagios -- Self-Service via the openQRM cloud - easy option to "re-sell" EC2 as private cloud resource -* all virtualization plugins were merged, old *-storage plugins were removed -* the term "Appliance" was renamed to "Server" (easier to understand) -* new spanish translation - big thanks to Larry Rider/Pablo Gonzalez (Activa IT) and Julio Mino -* cloud: cloudstability plus db consistency check -* user-friendly single sign-on for the nagios/icinga integration -* cloud: application deployment abstrations cloud (ansible and puppet, integration option for other Configuration Management Tools like e.g. check, fog ? -* Cloud: optional direct and secured VNC access to the Cloud VMs Console -* base: tab-in-tab breadcrumps -* plugins: configure UI action -* windows, cloud integration, puppet, admin pass, hostname, ip-addresses - - -Changes in openQRM Base: -* enhanced server wizard, possibility to skip unneeded steps -* improved boot-service configuration, the boot-services now can also be configured through the openqrm commandline utility -* initrds for network-deployment and configuration files in plugin boot-services are automatically updated during regular openQRM updates -* enhanced packaging (deb/rpm), implemented robust package update -* enhanced virtual-resource-command hook allowing to shutdown hosts via API calls -* easily make existing physical/logical storage volumes available for use with any virtualization type - - -Plugin changes: -* lcmc: updated the cluster management console lcmc to version 1.5.4 -* local-storage: plugin renamed from local-storage to clonezilla -* cloud: -- added option to specify the load balancing algorithm for finding the next available cloud virtualization host (by host load, memory utilization, random, resource limits per host) -- added option to specify a VM provisioning delay in the cloud to reduce load spikes -- added option in the openQRM cloud portal to change resource parameters (cpu/memory) in own cloud requests -* dhcpd: enhanced dhcpd plugin -- support for all classes of networks (A/B/C) for use as openQRM management network -- support for multi-homed setups with several managed networks -* sshterm: patched bug in webshell (sshterm plugin) to work with python 2.7 -* kvm: -- implemented option to set the VNC keyboard mapping for KVM VMs -- enhanced monitoring for local-deployment VMs -- configuration changes now possible for running VMs (changes applied at next VM reboot) -- using qemu-img now to create kvm volumes providing different qemu disk formats (raw, cow, qcow, qcow2) -- now supports native qemu-img snapshots for blockfiles (kvm-bf-deployment and kvm-gluster-deployment) -- now supports native Gluster integration (new deployment type kvm-gluster-deployment) -- added option to automatically shutdown the openQRM management network link after deployment and startup of VMs (for enhanced security) -* hybrid-cloud: now talking transparently to AWS EC2 and Eucalyptus APIs to manage instances, EBS volumes/snapshots, etc. -* all plugins: added and enhanced included online documentation - - -New plugins (Enterprise Edition only): -* new event-mailer plugin to send event notifications to openQRM administrators by email -* new role-administration plugin: -- allows to setup fine-grained administrator permissions on every aspect of the openQRM system -- allows to map the business topology to openQRM roles (e.g. only allow storage departments to allocate/manage storage) - - -New plugins (in Enterprise and Community Edition): -* Ansible Support as additional Configuration Management System next to Puppet - The Ansible integration eases up Playbook administration. - Ansible is now also integrated in the openQRM Enterprise Cloud in the same way as Puppet -* new device-manager plugin provides easy LVM pre-configuration for storage setup (create/manage LVM physical volumes and volume groups) -* new network-manager plugin provides easy network and bridging pre-configuration for virtualization hosts -* new development plugin to automatically generate documentation of the REST API, templates, translation status, css and js in openQRM -* new template plugin implementing all available plugin-hooks in openQRM (as a base to easily create your own custom plugins) -* new libvirt plugin integrates libvirt as additional resource provider - - -Bugfixes: -* security: only allow openQRM's update-stats to trigger the plugin hooks -* security: fixed bug in iframe to not allow any remote URLs to be loaded -* security: fixed bug in [plugin]-action.php to not allow remote access to the stat directories -* minor fixes in nfs-storage for manually configured/unmanaged NAS/NFS systems -* fixed many typos and wording issues -* base: avoid remove initial base objects (resource 0, default kernel, openqrm and idle image) -* cloud-zones: fixed register user url - - -Deprecated functionality: -- deprecated coraid-storage, equallogic-storage, netapp-storage, vbox and zfs-storage plugins - - - - diff --git a/openQRM-5.3.50-CE/openQRM-releasenotes.txt b/openQRM-5.3.50-CE/openQRM-releasenotes.txt deleted file mode 100644 index 2054c53..0000000 --- a/openQRM-5.3.50-CE/openQRM-releasenotes.txt +++ /dev/null @@ -1,38 +0,0 @@ -openQRM Community 5.3.50 Release Notes ---------------------------------------------- -OPENQRM AUSTRALIA PTY LTD - ->> Welcome to the openQRM Community Edition 5.3.50 - ->> openQRM Installation - How to get started -Install a minimal latest 64bit Ubuntu or Debian system on a physical machine. -Login to the system, get root access and download a copy of openQRM-5.3.50-Community-Edition.tar.gz to the system. - -Extract it using these commands: - - tar xvzfp openQRM-5.3.50-Community-Edition.tar.gz - cd openQRM-5.3.50-Community-Edition - ./install-openqrm.sh - -The installation script will guide you through the process. You will be prompted for some password or setup choices. Please answer these questions according to your requirements. - - -After the installation has completed, go to the web-based openQRM setup. - -Open this URL in a browser: http:///openqrm -Username: openqrm -Password: openqrm - -Follow the instructions and enter the desired network settings and database credentials. - ->> Hardware recommendations for evaluation -* 1 physical system (for openQRM server and required network, virtualization and storage services) -* Intel or AMD 64bit dual/quad core CPU -* VT CPU extension (full virtualization support) activated -* at least 1 GB RAM (the more the better) -* at least 20 GB of free harddisk/partition space to store server images on -* 1 network interface card (1 Gbit/s) -* Internet access to download required software - -Please visit our website https://openqrm-enterprise.com -Community Support is available at http://sourceforge.net/p/openqrm/discussion diff --git a/openQRM-5.3.50-CE/src/Makefile b/openQRM-5.3.50-CE/src/Makefile deleted file mode 100644 index 2d3c6ac..0000000 --- a/openQRM-5.3.50-CE/src/Makefile +++ /dev/null @@ -1,138 +0,0 @@ -# this is the main openQRM Makefile -#.SILENT: -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/etc/openqrm-server.conf -export OPENQRM_SOURCE_DIR=$(shell pwd) - -all: buildrequirements configure compile - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn" -not -name "debian" -not -name "rpm" -not -name "thirdparty"`; do cd $$SRC_DIR && make all -s && cd ..; done - -configure: - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn" -not -name "debian" -not -name "rpm" -not -name "thirdparty"`; do cd $$SRC_DIR && make configure -s && cd ..; done - -compile: - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn" -not -name "debian" -not -name "rpm" -not -name "thirdparty"`; do cd $$SRC_DIR && make -s && cd ..; done - -initrd: - @chmod +x make-assistant - @. $(OPENQRM_SERVER_CONF) && ./make-assistant openqrm_create_default_initrd_template - @. $(OPENQRM_SERVER_CONF) && ./make-assistant openqrm_pack_default_initrd_template - -install: - @chmod +x make-assistant - @. $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn" -not -name "debian" -not -name "rpm" -not -name "thirdparty"`; do cd $$SRC_DIR && make install -s && cd ..; done - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *.php | xargs -r chmod -x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *.css | xargs -r chmod -x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *.conf | xargs -r chmod -x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *.png | xargs -r chmod -x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *.gif | xargs -r chmod -x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *.jpg | xargs -r chmod -x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *.spec | xargs -r chmod -x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *configuration.template | xargs -r chmod -x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *deb.control | xargs -r chmod -x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name openqrm-pxelinux | xargs -r chmod -x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *-functions | xargs -r chmod +x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *-hook | xargs -r chmod +x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *-deployment | xargs -r chmod +x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name root-mount* | xargs -r chmod +x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *-maintenance | xargs -r chmod +x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *-ifup | xargs -r chmod +x - @. $(OPENQRM_SERVER_CONF) && find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm -name *commit.tmpl | xargs -r chmod +x - @. $(OPENQRM_SERVER_CONF) && if [ -d $(DESTINATION_DIR)/etc/openqrm ]; then find $(DESTINATION_DIR)/etc/openqrm -name *.conf | xargs -r chmod -x; fi - @. $(OPENQRM_SERVER_CONF) && if [ -d $(DESTINATION_DIR)/etc/openqrm ]; then find $(DESTINATION_DIR)/etc/openqrm -name *deb.control | xargs -r chmod -x; fi - @. $(OPENQRM_SERVER_CONF) && if [ -d $(DESTINATION_DIR)/etc/openqrm ]; then find $(DESTINATION_DIR)/etc/openqrm -name openqrm-pxelinux | xargs -r chmod -x; fi - @. $(OPENQRM_SERVER_CONF) && if [ -d $(DESTINATION_DIR)/etc/openqrm ]; then find $(DESTINATION_DIR)/etc/openqrm -name *.spec | xargs -r chmod -x; fi - @. $(OPENQRM_SERVER_CONF) && if [ -d $(DESTINATION_DIR)/etc/openqrm ]; then find $(DESTINATION_DIR)/etc/openqrm -name *-functions | xargs -r chmod +x; fi - @. $(OPENQRM_SERVER_CONF) && if [ -d $(DESTINATION_DIR)/etc/openqrm ]; then find $(DESTINATION_DIR)/etc/openqrm -name *-maintenance | xargs -r chmod +x; fi - - -start: check - @whoami | grep root 1>/dev/null 2>&1 || (echo "Please run 'make start' as root" && exit 1) - @. $(OPENQRM_SERVER_CONF) && chmod +x $$OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/openqrm - @. $(OPENQRM_SERVER_CONF) && ln -sf $$OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/openqrm /etc/init.d/openqrm - @/etc/init.d/openqrm start - -stop: - @whoami | grep root 1>/dev/null 2>&1 || (echo "Please run 'make stop' as root" && exit 1) - @if [ -x /etc/init.d/openqrm ]; then /etc/init.d/openqrm stop; fi - -uninstall: stop - @whoami | grep root 1>/dev/null 2>&1 || (echo "Please run 'make uninstall' as root" && exit 1) - @. $(OPENQRM_SERVER_CONF) && if [ ! -d $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm ]; then echo "openQRM not installed"; exit 1; fi - @if [ -x /etc/init.d/openqrm ]; then /etc/init.d/openqrm uninstall; fi - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn" -not -name "debian" -not -name "rpm"`; do cd $$SRC_DIR && make uninstall -s && cd ..; done - @. $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm - -clean: - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn" -not -name "debian" -not -name "rpm" -not -name "thirdparty"`; do cd $$SRC_DIR && make clean -s && cd ..; done - -realclean: clean - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn" -not -name "debian" -not -name "rpm" -not -name "thirdparty"`; do cd $$SRC_DIR && make realclean -s && cd ..; done - -rpm: all - @whoami | grep root 1>/dev/null 2>&1 || (echo "Please run 'make rpm' as root" && exit 1) - @chmod +x make-assistant - @. $(OPENQRM_SERVER_CONF) && ./make-assistant openqrm_rpm_package - -reinstall: - make uninstall -s - make clean -s - make all -s - make install -s - make start -s - -debsource: all - @chmod +x make-assistant - @. $(OPENQRM_SERVER_CONF) && ./make-assistant openqrm_create_deb_source - -deb: - @whoami | grep root 1>/dev/null 2>&1 || (echo "Please run 'make deb' as root" && exit 1) - @chmod +x make-assistant - @. $(OPENQRM_SERVER_CONF) && ./make-assistant openqrm_pbuilder - -packages: - @whoami | grep root 1>/dev/null 2>&1 || (echo "Please run 'make deb' as root" && exit 1) - @chmod +x make-assistant - @. $(OPENQRM_SERVER_CONF) && ./make-assistant openqrm_packages - -check: - @chmod +x make-assistant - @. $(OPENQRM_SERVER_CONF) && ./make-assistant openqrm_check_requirements - -buildrequirements: - @chmod +x make-assistant - @. $(OPENQRM_SERVER_CONF) && ./make-assistant openqrm_check_build_requirements - if [ -d ./thirdparty ]; then mkdir -p ../buildtmp; cp -aR ./thirdparty/* ../buildtmp/; fi - -updatesrc: - @if [ -d .svn ]; then svn update;fi - -update: all - @. $(OPENQRM_SERVER_CONF) && if [ ! -d $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/bin ]; then echo "openQRM is not installed - $(DESTINATION_DIR) $$OPENQRM_SERVER_BASE_DIR $(OPENQRM_SERVER_CONF)" && exit 1; fi - @chmod +x make-assistant - @. $(OPENQRM_SERVER_CONF) && cp -f bin/openqrm-update $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm-update && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm-update - @. $(OPENQRM_SERVER_CONF) && cp -f include/openqrm-build-functions $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/include/ - @. $(OPENQRM_SERVER_CONF) && ./make-assistant openqrm_pre_update - @. $(OPENQRM_SERVER_CONF) && ./make-assistant make install - @. $(OPENQRM_SERVER_CONF) && ./make-assistant openqrm_base_update - @. $(OPENQRM_SERVER_CONF) && ./make-assistant openqrm_post_update - @. $(OPENQRM_SERVER_CONF) && ./make-assistant openqrm_initrd_update - - -.PHONY: all configure compile install start uninstall clean realclean reinstall rpm deb debsource packages check initrd buildrequirements updatesrc update - diff --git a/openQRM-5.3.50-CE/src/bin/Makefile b/openQRM-5.3.50-CE/src/bin/Makefile deleted file mode 100644 index 2139006..0000000 --- a/openQRM-5.3.50-CE/src/bin/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# this is the openQRM bin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/bin - . $(OPENQRM_SERVER_CONF) && cp openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/bin/ && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/bin/* - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/bin/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/bin - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/bin/openqrm b/openQRM-5.3.50-CE/src/bin/openqrm deleted file mode 100644 index ccc89bc..0000000 --- a/openQRM-5.3.50-CE/src/bin/openqrm +++ /dev/null @@ -1,581 +0,0 @@ -#!/bin/bash -# this is the openQRM commandline client -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../.. - OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -fi -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -# unblock starting command queue early for non-blocking + ui commands -OPENQRM_COMMAND=$1 -if [ "$OPENQRM_COMMAND" == "license" ] || [ "$OPENQRM_COMMAND" == "boot-service" ]; then - openqrm_unblock_starting_queue $@ - NON_BLOCKING=true -fi - -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -export OPENQRM_SERVER_BASE_DIR - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - - -function openqrm_usage() { - echo - echo "Usage:" - echo "`basename $0` help - This help screen" - echo - echo "- openQRM Console -" - echo "`basename $0` console" - echo - echo "- Managing boot-images -" - echo "`basename $0` kernel add -n -v -u -p [-l -i -t -m ]" - echo "`basename $0` kernel remove -n -u -p " - echo - echo "- Managing server-states -" - echo "`basename $0` state backup -n " - echo "`basename $0` state restore -n " - echo "`basename $0` state remove -n " - echo "`basename $0` state list" - echo - echo "- Managing server-configuration -" - echo "`basename $0` init_config [restore]" - echo - echo "- Managing Plugin Boot-Services -" - echo "`basename $0` boot-service configure -n -a default -k -v " - echo "`basename $0` boot-service configure -n -a -k -v " - echo - echo "`basename $0` boot-service view -n -a default" - echo "`basename $0` boot-service view -n -a " - echo - echo "- Login to resources -" - echo "`basename $0` login -i " - echo - echo "- Managing Licenses -" - echo "`basename $0` license -l " - - -} - -# logs for init_config -function init_config_log() { - local MESSAGE=$@ - logger -i -t "openQRM init-config" "$MESSAGE" -} - - - -# main -case "$1" in - kernel) - shift - if [ $# == 0 ]; then - openqrm_usage - exit 0 - fi - - case "$1" in - add) - shift - if [ $# == 0 ]; then - openqrm_usage - exit 0 - fi - while [ $# -ne 0 ]; do - case "$1" in - -n) - BOOT_IMAGE_NAME=$2 - shift - ;; - -v) - BOOT_IMAGE_VERSION=$2 - shift - ;; - -l) - BOOT_IMAGE_LOCATION=$2 - shift - ;; - -i) - BOOT_IMAGE_INITRD_TYPE=$2 - shift - ;; - -t) - BOOT_IMAGE_INITRD_TEMPLATE=$2 - shift - ;; - -u) - OPENQRM_USERNAME=$2 - shift - ;; - -p) - OPENQRM_PASSWORD=$2 - shift - ;; - -m) - OPENQRM_UNWANTED_MODULES_PARAM=$2 - shift - ;; - esac - shift - done - if [ "$BOOT_IMAGE_NAME" == "" ] || [ "$BOOT_IMAGE_VERSION" == "" ] || [ "$OPENQRM_USERNAME" == "" ] || [ "$OPENQRM_PASSWORD" == "" ]; then - openqrm_usage - exit 1 - fi - if [ "$BOOT_IMAGE_LOCATION" == "" ]; then - BOOT_IMAGE_LOCATION=/ - fi - if [ "$BOOT_IMAGE_INITRD_TYPE" == "" ]; then - BOOT_IMAGE_INITRD_TYPE="initramfs" - fi - if [ "$BOOT_IMAGE_INITRD_TEMPLATE" == "" ]; then - BOOT_IMAGE_INITRD_TEMPLATE=$OPENQRM_DEFAULT_INITRD_TEMPLATE - fi - openqrm_server_create_kernel $BOOT_IMAGE_NAME $BOOT_IMAGE_VERSION $BOOT_IMAGE_LOCATION $BOOT_IMAGE_INITRD_TYPE $BOOT_IMAGE_INITRD_TEMPLATE $OPENQRM_UNWANTED_MODULES_PARAM - if ! openqrm_server_manage_kernel add $OPENQRM_USERNAME $OPENQRM_PASSWORD $BOOT_IMAGE_NAME $BOOT_IMAGE_VERSION; then - echo "WARNING: Could not add the kernel to the openQRM-server!" - exit -1 - fi - ;; - - remove) - shift - if [ $# == 0 ]; then - openqrm_usage - exit 0 - fi - while [ $# -ne 0 ]; do - case "$1" in - -n) - BOOT_IMAGE_NAME=$2 - shift - ;; - -u) - OPENQRM_USERNAME=$2 - shift - ;; - -p) - OPENQRM_PASSWORD=$2 - shift - ;; - esac - shift - done - if [ "$BOOT_IMAGE_NAME" == "" ] || [ "$OPENQRM_USERNAME" == "" ] || [ "$OPENQRM_PASSWORD" == "" ]; then - openqrm_usage - exit 1 - fi - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/vmlinuz-$BOOT_IMAGE_NAME - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/System.map-$BOOT_IMAGE_NAME - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/modules-$BOOT_IMAGE_NAME.tgz - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-$BOOT_IMAGE_NAME.img - if ! openqrm_server_manage_kernel remove $OPENQRM_USERNAME $OPENQRM_PASSWORD $BOOT_IMAGE_NAME $BOOT_IMAGE_VERSION; then - echo "WARNING: Could not remove the kernel to the openQRM-server!" - exit -1 - fi - ;; - - esac - ;; - - - state) - shift - if [ $# == 0 ]; then - openqrm_usage - exit 0 - fi - export OPENQRM_SERVER_BASE_DIR - - case "$1" in - backup) - shift - if [ $# == 0 ]; then - openqrm_usage - exit 0 - fi - while [ $# -ne 0 ]; do - case "$1" in - -n) - BACKUP_STATE_NAME=$2 - shift - ;; - esac - shift - done - if [ "$BACKUP_STATE_NAME" == "" ]; then - openqrm_usage - exit 1 - fi - openqrm_server_state backup $BACKUP_STATE_NAME - ;; - - restore) - shift - if [ $# == 0 ]; then - openqrm_usage - exit 0 - fi - while [ $# -ne 0 ]; do - case "$1" in - -n) - BACKUP_STATE_NAME=$2 - shift - ;; - esac - shift - done - if [ "$BACKUP_STATE_NAME" == "" ]; then - openqrm_usage - exit 1 - fi - openqrm_server_state restore $BACKUP_STATE_NAME - ;; - - remove) - shift - if [ $# == 0 ]; then - openqrm_usage - exit 0 - fi - while [ $# -ne 0 ]; do - case "$1" in - -n) - BACKUP_STATE_NAME=$2 - shift - ;; - esac - shift - done - if [ "$BACKUP_STATE_NAME" == "" ]; then - openqrm_usage - exit 1 - fi - openqrm_server_state remove $BACKUP_STATE_NAME - ;; - - list) - openqrm_server_state list - ;; - esac - ;; - - - login) - shift - if [ $# == 0 ]; then - openqrm_usage - exit 0 - fi - while [ $# -ne 0 ]; do - case "$1" in - -i) - RESOURCE_IP_ADDRESS=$2 - shift - ;; - esac - shift - done - if [ "$RESOURCE_IP_ADDRESS" == "" ]; then - openqrm_usage - exit 1 - fi - echo "Login to resource $RESOURCE_IP_ADDRESS ..." - dbclient -K 10 -y -i $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/dropbear_rsa_host_key -p $OPENQRM_EXEC_PORT root@$RESOURCE_IP_ADDRESS - ;; - - - license) - shift - if [ $# == 0 ]; then - openqrm_usage - exit 0 - fi - while [ $# -ne 0 ]; do - case "$1" in - -l) - LICENSE_FILE=$2 - shift - ;; - esac - shift - done - if [ "$LICENSE_FILE" == "" ]; then - openqrm_usage - exit 1 - fi - if [ ! -f "$LICENSE_FILE" ]; then - echo "ERROR: License file $LICENSE_FILE does not exist!" - exit 1 - fi - if [ ! -d $OPENQRM_SERVER_BASE_DIR/openqrm/etc/license ]; then - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/etc/license - fi - if /bin/cp -f $LICENSE_FILE $OPENQRM_SERVER_BASE_DIR/openqrm/etc/license/; then - echo "Activating License file $LICENSE_FILE" - rm -f $LICENSE_FILE - else - echo "ERROR: Could not activate License file $LICENSE_FILE" - rm -f $LICENSE_FILE - exit 1 - fi - - ;; - - - console) - echo "starting the openQRM Console" - export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions - export FORCE_INSTALL=true - openqrm_install_os_dependency lynx - lynx http://localhost/openqrm - ;; - - - init_config) - shift - RESTORE_LAST_STATE=$1 - INIT_CONFIG_LOCK="$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/running_init_config" - if [ -f $INIT_CONFIG_LOCK ]; then - init_config_log "init_config already running. Skipping re-init" - exit 0 - fi - if [ -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/unconfigured ]; then - - # setup traps, make sure we do not get stopped by timeout - trap "" HUP - trap "" INT - trap "" QUIT - trap "" KILL - trap "" TSTP - - # create lock - touch $INIT_CONFIG_LOCK - init_config_log "Initializing the openQRM Database" - - # initialize the database - chmod +x $OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/$OPENQRM_DATABASE_TYPE/openqrm-$OPENQRM_DATABASE_TYPE-functions - if ! $OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/$OPENQRM_DATABASE_TYPE/openqrm-$OPENQRM_DATABASE_TYPE-functions init; then - init_config_log "ERROR: Initializing the openQRM Database failed !" - rm -f $INIT_CONFIG_LOCK - exit -1 - fi - - # check if we should restore the last state - if [ "$RESTORE_LAST_STATE" == "restore" ]; then - init_config_log "Restoring last openQRM state backup" - # check if backups are not locked - if [ ! -f $OPENQRM_SERVER_STATE_DIR/locked ]; then - if [ "$OPENQRM_RESTORE_STATE" != "false" ]; then - # check if there is a server state to restore - LAST_SERVER_STATE_BACKUP=`ls -tr $OPENQRM_SERVER_STATE_DIR/uninstall-* 2>/dev/null | tail -n1 | sed -s "s/\.tgz//g"` - if [ "$LAST_SERVER_STATE_BACKUP" != "" ]; then - LAST_SERVER_STATE_BACKUP=`basename $LAST_SERVER_STATE_BACKUP` - init_config_log "Found backup of last openQRM Server state $LAST_SERVER_STATE_BACKUP, restoring it" - openqrm_server_state restore $LAST_SERVER_STATE_BACKUP - fi - fi - else - init_config_log "Found openQRM Server state backups locked by $OPENQRM_SERVER_STATE_DIR/locked" - fi - fi - - # create $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/default - init_config_log "Creating default PXE-configuration" - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/ - openqrm_server_create_pxe_config -1 default default - - # add automatic startup to init - if [ -e /etc/init.d/openqrm-enterprise ]; then - openqrm_chkconfig add openqrm-enterprise - elif [ -e /etc/init.d/openqrm ]; then - openqrm_chkconfig add openqrm - fi - - # here we create + add the default kernel+kernel-version to the openQRM Server - # via the kernel-action.form. If this returns bad something is wrong - DEFAULT_KERNEL_VERSION=`uname -r` - - IS_WSL=`uname -r | grep WSL` - #not a WSL environment - if [ -z "$IS_WSL" ]; then - init_config_log "Creating the default kernel version $DEFAULT_KERNEL_VERSION" - INITRD_TYPE="initramfs" - openqrm_server_create_kernel default $DEFAULT_KERNEL_VERSION / $INITRD_TYPE - if ! openqrm_server_manage_kernel add openqrm openqrm default $DEFAULT_KERNEL_VERSION; then - init_config_log "Could not create/add the default kernel ! Initialization failed !" - exit -1 - rm -f $INIT_CONFIG_LOCK - fi - - fi - - # remove configure lock - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/unconfigured - - # start monitoring subsystem and plugins - if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" - else - RUNSCREEN=`which screen` - fi - SCREEN_NAME=`date +%T%x | sed -e "s/://g" | sed -e "s#/##g"` - $RUNSCREEN -dmS $SCREEN_NAME $OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-monitord - if [ -d $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/ ]; then - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN ]; then - $RUNSCREEN -dmS $OPENQRM_PLUGIN $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN start - fi - done - fi - init_config_log "Successfully initialized and started the openQRM Server" - rm -f $INIT_CONFIG_LOCK - exit 0 - - else - init_config_log "This openQRM Server is already configured. Skipping re-init" - exit 0 - fi - ;; - - - - boot-service) - shift - if [ $# == 0 ]; then - openqrm_usage - exit 0 - fi - BOOT_SERVICE_COMMAND=$1 - shift - while [ $# -ne 0 ]; do - case "$1" in - -a) - APPLIANCE_NAME=$2 - shift - ;; - -n) - PLUGIN_NAME=$2 - shift - ;; - -v) - BOOT_SERVICE_VALUE=$2 - shift - ;; - -k) - BOOT_SERVICE_KEY=$2 - shift - ;; - esac - shift - done - - case "$BOOT_SERVICE_COMMAND" in - configure) - if [ "$APPLIANCE_NAME" == "" ] || [ "$PLUGIN_NAME" == "" ] || [ "$BOOT_SERVICE_VALUE" == "" ] || [ "$BOOT_SERVICE_KEY" == "" ]; then - openqrm_usage - exit 1 - fi - # create empty value - if [ $BOOT_SERVICE_VALUE == "NoValue" ]; then - BOOT_SERVICE_VALUE="" - fi - if [ ! -f "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/openqrm-plugin-$PLUGIN_NAME.conf" ]; then - echo "ERROR: Cannot find Boot-Service configuration of Plugin $PLUGIN_NAME!" - exit -1 - fi - if ! grep -w ^$BOOT_SERVICE_KEY $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/openqrm-plugin-$PLUGIN_NAME.conf 2>&1 1>/dev/null; then - echo "ERROR: Cannot find key in Boot-Service configuration of Plugin $PLUGIN_NAME!" - exit -1 - fi - - if [ "$APPLIANCE_NAME" == "default" ]; then - echo "Setting up default Boot-Service Konfiguration of plugin $PLUGIN_NAME" - BOOT_SERVICE_CONFIG_FILE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/openqrm-plugin-$PLUGIN_NAME.conf" - if [ -f "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service-$PLUGIN_NAME.tgz" ]; then - # adjust the config in the boot-service.tgz file - echo "- adjusting boot-service of plugin $PLUGIN_NAME at $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service-$PLUGIN_NAME.tgz" - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service.tmp - mkdir $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service.tmp - if ! tar -C $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service.tmp -xzf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service-$PLUGIN_NAME.tgz; then - echo "ERROR: Could not unpack boot-service of of Plugin $PLUGIN_NAME at $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service-$PLUGIN_NAME.tgz!" - exit -1 - fi - if [ -f "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service.tmp/etc/openqrm-plugin-$PLUGIN_NAME.conf" ]; then - sed -i -e "s#$BOOT_SERVICE_KEY.*#$BOOT_SERVICE_KEY=\"$BOOT_SERVICE_VALUE\"#g" $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service.tmp/etc/openqrm-plugin-$PLUGIN_NAME.conf - TIMESTAMP=`date +%s` - mv -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service-$PLUGIN_NAME.tgz $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service-$PLUGIN_NAME.tgz.$TIMESTAMP - cd $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service.tmp/ && tar -czf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service-$PLUGIN_NAME.tgz * && cd - - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/web/boot-service.tmp - fi - fi - else - echo "Setting up custom Boot-Service Konfiguration of plugin $PLUGIN_NAME for Appliance $APPLIANCE_NAME" - if [ ! -f "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/appliances/openqrm-plugin-$PLUGIN_NAME.$APPLIANCE_NAME.conf" ]; then - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/appliances - /bin/cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/openqrm-plugin-$PLUGIN_NAME.conf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/appliances/openqrm-plugin-$PLUGIN_NAME.$APPLIANCE_NAME.conf - fi - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/plugins - if [ ! -h $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/plugins/$PLUGIN_NAME ]; then - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/plugins/$PLUGIN_NAME - ln -s $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/appliances $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/plugins/$PLUGIN_NAME - fi - BOOT_SERVICE_CONFIG_FILE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/appliances/openqrm-plugin-$PLUGIN_NAME.$APPLIANCE_NAME.conf" - fi - sed -i -e "s#$BOOT_SERVICE_KEY.*#$BOOT_SERVICE_KEY=\"$BOOT_SERVICE_VALUE\"#g" $BOOT_SERVICE_CONFIG_FILE - ;; - - - view) - if [ "$APPLIANCE_NAME" == "" ] || [ "$PLUGIN_NAME" == "" ]; then - openqrm_usage - exit 1 - fi - - if [ "$APPLIANCE_NAME" == "default" ]; then - if [ ! -f "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/openqrm-plugin-$PLUGIN_NAME.conf" ]; then - echo "ERROR: Cannot find Boot-Service configuration of Plugin $PLUGIN_NAME!" - exit -1 - fi - BOOT_SERVICE_CONFIG_FILE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/openqrm-plugin-$PLUGIN_NAME.conf" - else - if [ ! -f "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/appliances/openqrm-plugin-$PLUGIN_NAME.$APPLIANCE_NAME.conf" ]; then - echo "NOTCIE: Boot-Service configuration of Plugin $PLUGIN_NAME for Appliance $APPLIANCE_NAME not configured yet" - exit 0 - fi - BOOT_SERVICE_CONFIG_FILE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/appliances/openqrm-plugin-$PLUGIN_NAME.$APPLIANCE_NAME.conf" - fi - cat $BOOT_SERVICE_CONFIG_FILE - ;; - esac - ;; - - - - *) - openqrm_usage - ;; - -esac - - diff --git a/openQRM-5.3.50-CE/src/bin/openqrm-cmd b/openQRM-5.3.50-CE/src/bin/openqrm-cmd deleted file mode 100644 index 4eda647..0000000 --- a/openQRM-5.3.50-CE/src/bin/openqrm-cmd +++ /dev/null @@ -1,219 +0,0 @@ -#!/bin/bash -# this is the openQRM commandline client -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../.. - OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -fi -export OPENQRM_SERVER_BASE_DIR -# check if running on the server or on a managed resource -if [ -f "$OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions" ]; then - # we are running on the server - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS - resource_id=0 - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -else - # we are running on a managed resource - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - . $OPENQRM_RESOURCE_PARAMETER_FILE -fi -WHOAMI=`whoami` -FULL_COMMAND=`echo $@ | sed -e 's/-u [^ ]* /-u xxxxxxxx /g' -e 's/-p [^ ]*/-p xxxxxxxx /g'` -export LANGUAGE=C -export LANG=C -export LC_ALL=C - -function stop_openqrm_monitord() { - killall openqrm-monitord 1>/dev/null 2>&1 - # in case we do not have killall (e.g. on debian-minimal install) be sure to stop the openqrm-agents anyway - for OPENQRM_PID in `ps ax 2>/dev/null | grep openqrm-monitord | grep -v grep | awk {' print $1 '}`; do - kill $OPENQRM_PID - done -} - - - -# check which command queue to use -# ui-queue : all commands running on behalf of a ui user -# bg-queue : all commands initiated from the plugins or the base engine - -UI_CMD_QUEUE="ui-cmd-queue" -BG_CMD_QUEUE="bg-cmd-queue" -CMD_QUEUE=$BG_CMD_QUEUE -if echo $@ | grep "\-\-openqrm\-ui\-user" 1>/dev/null; then - CMD_QUEUE=$UI_CMD_QUEUE -fi - -# check the command mode to use -# raw -# - shell command executed by the receiver in foreground -# - receiver queue waits until command finished -# - output is set to stdout -# - good for commands with a short execution time -# -# regular (or not set) -# - shell command executed by the receiver in foreground -# - receiver queue waits until command finished -# - good for commands with a short execution time -# -# background -# - shell command executed by the receiver in background (with &) -# - receiver queue does not wait until command finished -# - good for commands with a medium to long to execution time (and using screen themselves) -# -# fork -# - shell command executed by the receiver in background (with a detached screen) -# - receiver queue does not wait until command finished -# - good for commands with a medium to long to execution time (and not using screen themselves) - -CMD_EXEC_MODE_DEFAULT="regular" -if echo $@ | grep "\-\-openqrm\-cmd\-mode" 1>/dev/null; then - CMD_MODE=`echo $@ | sed -e "s#.*--openqrm-cmd-mode##g" | awk '{ print $1 }' 2>/dev/null` - if [ "$CMD_MODE" == "" ]; then - CMD_MODE=$CMD_EXEC_MODE_DEFAULT - fi -else - CMD_MODE=$CMD_EXEC_MODE_DEFAULT -fi - -# aquire lock for the global receiver command bg queue -LOCK_TIME=`openqrm_lock_queue aquire $CMD_QUEUE` -trap "openqrm_lock_queue release $CMD_QUEUE $LOCK_TIME" EXIT -# aquire global command-starting-lock, scripts have 10 sec. to -# eventually fork and aquire a lock on their subsection -lockfile -s 1 -r 1 -l 10 $OPENQRM_CMD_QUEUE_STARTING_LOCK.$CMD_QUEUE -echo "$FULL_COMMAND" > $OPENQRM_CMD_QUEUE_STARTING_LOCK.$CMD_QUEUE -echo "openQRM engine: Running exec mode $CMD_MODE: $FULL_COMMAND" | logger - -################################################################################ -# special handling for reboot + halt -################################################################################ -case "$@" in - reboot) - rm -f $OPENQRM_CMD_QUEUE_STARTING_LOCK.$CMD_QUEUE - openqrm_lock_queue release $CMD_QUEUE $LOCK_TIME - trap '' EXIT - stop_openqrm_monitord - sleep 2 && /sbin/reboot & - exit 0 - ;; - halt) - rm -f $OPENQRM_CMD_QUEUE_STARTING_LOCK.$CMD_QUEUE - openqrm_lock_queue release $CMD_QUEUE $LOCK_TIME - trap '' EXIT - stop_openqrm_monitord - sleep 2 && /sbin/poweroff & - exit 0 - ;; -esac - - -################################################################################ -# run openqrm functions in foreground -################################################################################ -if [ ! -x "$1" ]; then - CMD_OUTPUT=$($@ 2>&1) - CMD_RESULT=$? - sleep 0.5 - # if we ran a function remove the starting lock now - rm -f $OPENQRM_CMD_QUEUE_STARTING_LOCK.$CMD_QUEUE - -else - - ################################################################################ - # run commands according their exec-mode - ################################################################################ - - case "$CMD_MODE" in - # regular mode - raw) - $@ - CMD_RESULT=$? - sleep 0.5 - ;; - - # regular mode - regular) - CMD_OUTPUT=$($@ 2>&1) - CMD_RESULT=$? - sleep 0.5 - ;; - - # background mode - background) - $@ 1>/dev/null 2>/dev/null & - CMD_OUTPUT="" - CMD_RESULT=0 - sleep 0.5 - ;; - - # fork mode - fork) - if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" - else - RUNSCREEN=`which screen` - fi - SCREEN_NAME=`date +%s%N` - $RUNSCREEN -dmS $SCREEN_NAME "$@" - CMD_OUTPUT="" - CMD_RESULT=0 - sleep 0.5 - ;; - esac - -fi - -################################################################################ -# releaselock for the global receiver command bg queue -openqrm_lock_queue release $CMD_QUEUE $LOCK_TIME -trap '' EXIT - - -# error reporting -if [ "$CMD_RESULT" != "0" ]; then - if [ ! -d /var/log/openqrm ]; then - mkdir -p /var/log/openqrm - fi - FORMAT_COMMAND=`echo $FULL_COMMAND | cut -b1-100`".." - FORMAT_COMMAND_OUTPUT=`openqrm_format_error_msg $CMD_OUTPUT` - rm -f /var/log/openqrm/$$.log - echo "ERROR: openqrm-cmd failed with $CMD_OUTPUT while running: $FULL_COMMAND" | logger - openqrm_post_event 0 "base-engine" 2 "openqrm-cmd" "ERROR $FORMAT_COMMAND_OUTPUT on resource $resource_id running: $FORMAT_COMMAND" - exit 1 -fi - - - - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/bin/openqrm-command-queue-ctl b/openQRM-5.3.50-CE/src/bin/openqrm-command-queue-ctl deleted file mode 100644 index c959043..0000000 --- a/openQRM-5.3.50-CE/src/bin/openqrm-command-queue-ctl +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# this is the openQRM command queue control utility -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../.. - OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -fi -export OPENQRM_SERVER_BASE_DIR -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -NEWLINE=' -' - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - - -function openqrm_cq_ctl_usage() { - echo - echo "Usage:" - echo "`basename $0` help - This help screen" - echo - echo "- openQRM switch command queuing mechanism to Dropbear (default) -" - echo "`basename $0` command-queue dropbear" - echo - echo "- openQRM switch command queuing mechanism to RabbitMQ (enterprise) -" - echo "`basename $0` command-queue rabbitmq" - echo -} - - - - -# main -case "$1" in - command-queue) - case "$2" in - dropbear) - echo "Switching openQRM command queue to dropbear" - sed -i -e 's/OPENQRM_EXECUTION_LAYER.*/OPENQRM_EXECUTION_LAYER="dropbear"/'g $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - /etc/init.d/openqrm restart - ;; - - - rabbitmq) - - BASE_DIR=$(dirname $0) - BASE_DIR=$(pushd $BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) - - - echo "Switching openQRM command queue to rabbitmq" - echo "- installing RabbitMQ server" - if ! openqrm_full_fill_os_dependency rabbitmq-server rabbitmq-server; then - echo "ERROR: Failed to install RabbitMQ Server!" - exit 1 - fi - echo "- installing python pip installer" - if ! openqrm_full_fill_os_dependency pip python3-pip; then - echo "ERROR: Failed to install python3-pip!" - exit 1 - fi - echo "- installing python pika" - if ! pip install pika==0.9.8; then - echo "ERROR: Failed to install python pika!" - exit 1 - fi - echo "-installing php-amqplib" - # install php-amqplib - # rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/php-amqplib - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/php-amqplib - cd $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/php-amqplib - # install composer - if [ ! -x ./composer.phar ]; then - curl -sS https://getcomposer.org/installer | php - fi - echo "{$NEWLINE\"require\": {$NEWLINE\"videlalvaro/php-amqplib\": \"2.2.*\"$NEWLINE}$NEWLINE}" > $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/php-amqplib/composer.json - # install php-amqplib - ./composer.phar install - - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/$OPENQRM_DATABASE_TYPE/openqrm-$OPENQRM_DATABASE_TYPE-functions - OPENQRM_PASSWORD=`run_sql "select user_password from user_info where user_name='openqrm'"` - if [ "$OPENQRM_PASSWORD" == "" ]; then - echo "ERROR: Could not gather openqrm user password to configure the rabbitmq-server" - exit 1 - fi - rabbitmqctl delete_user openqrm 2>/dev/null - if ! rabbitmqctl add_user openqrm "$OPENQRM_PASSWORD"; then - echo "ERROR: Failed to add user openqrm!" - exit 1 - fi - if ! rabbitmqctl set_user_tags openqrm administrator; then - echo "ERROR: Failed to set user openqrm as administrator!" - exit 1 - fi - if ! rabbitmqctl set_permissions -p / openqrm ".*" ".*" ".*"; then - echo "ERROR: Failed to set permission for user openqrm!" - exit 1 - fi - if ! rabbitmqctl list_user_permissions openqrm; then - echo "ERROR: Failed to list permissions!" - exit 1 - fi - echo "enabling SSL" - mkdir -p /etc/rabbitmq/ssl - - echo "generating SSL certificates" - rm -rf /tmp/rabbitmqssl/ - mkdir -p /tmp/rabbitmqssl/ - cd /tmp/rabbitmqssl/ - cp $OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-openssl-configuration openqrm-openssl.cnf - mkdir -p openqrmca/private - mkdir -p openqrmca/certs - touch openqrmca/index.txt - echo 01 > openqrmca/serial - cd openqrmca - openssl req -x509 -config ../openqrm-openssl.cnf -newkey rsa:2048 -days 40000 -out cacert.pem -outform PEM -subj /CN=openqrmca/ -nodes - openssl x509 -in cacert.pem -out cacert.cer -outform DER - cd .. - openssl genrsa -out server_key.pem 2048 - openssl req -new -key server_key.pem -out server_req.pem -outform PEM -subj /CN=$(hostname)/O=server/ -nodes - cd openqrmca - openssl ca -config ../openqrm-openssl.cnf -in ../server_req.pem -out ../server_cert.pem -notext -batch -extensions server_ca_extensions - cd .. - openssl pkcs12 -export -out server_keycert.p12 -in server_cert.pem -inkey server_key.pem -passout pass:OpenQRMPass - openssl genrsa -out client_key.pem 2048 - openssl req -new -key client_key.pem -out client_req.pem -outform PEM -subj /CN=$(hostname)/O=client/ -nodes - cd openqrmca - openssl ca -config ../openqrm-openssl.cnf -in ../client_req.pem -out ../client_cert.pem -notext -batch -extensions client_ca_extensions - cd .. - openssl pkcs12 -export -out client_keycert.p12 -in client_cert.pem -inkey client_key.pem -passout pass:OpenQRMPass - - cp server_key.pem /etc/rabbitmq/ssl/ - cp server_cert.pem /etc/rabbitmq/ssl/ - cp openqrmca/cacert.pem /etc/rabbitmq/ssl/ - cd $BASE_DIR - rm -rf /tmp/rabbitmqssl/ - - echo "adding SSL listener" - cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-rabbitmq-ssl-configuration /etc/rabbitmq/rabbitmq.config - - if ! /etc/init.d/rabbitmq-server restart; then - echo "ERROR: Failed to enable SSL in the RabbitMQ server!" - exit 1 - fi - - echo "enabling rabbitmq management plugin" - /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management - - echo "reconfiguring $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf" - sed -i -e 's/OPENQRM_EXECUTION_LAYER.*/OPENQRM_EXECUTION_LAYER="rabbitmq"/'g $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - - /etc/init.d/openqrm restart - ;; - - *) - openqrm_cq_ctl_usage - ;; - - esac - ;; - - - - *) - openqrm_cq_ctl_usage - ;; - -esac - - diff --git a/openQRM-5.3.50-CE/src/bin/openqrm-create-plugin b/openQRM-5.3.50-CE/src/bin/openqrm-create-plugin deleted file mode 100644 index 299cbb1..0000000 --- a/openQRM-5.3.50-CE/src/bin/openqrm-create-plugin +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -SOURCE_PLUGIN=$1 -DESTINATION_PLUGIN=$2 -WORKSPACE=`dirname $0`/../plugins - -export LANGUAGE=C -export LANG=C -export LC_ALL=C - -if [ "$#" != "2" ]; then - echo "Usage : $0 " - exit 1 -fi -if [ ! -d $WORKSPACE/$SOURCE_PLUGIN ]; then - echo "Error : Source plugin $SOURCE_PLUGIN does not exit at $WORKSPACE" - exit 1 -fi -if [ -d $WORKSPACE/$DESTINATION_PLUGIN ]; then - echo "Error : Destination plugin $WORKSPACE/$DESTINATION_PLUGIN already exist !" - echo -n "Continue ? (y/n) " - read CONFIRM - if [ "$CONFIRM" != "y" ]; then - exit 1 - else - echo "...Continuing" - sleep 2 - fi -fi - - -echo "creating plugin $DESTINATION_PLUGIN from the $SOURCE_PLUGIN plugin" - -# genearating the strings to change -SOURCE_NAME_UPPER_CASE=`echo $SOURCE_PLUGIN | tr '[:lower:]:' '[:upper:]-'` -SOURCE_NAME_LOWER_CASE=`echo $SOURCE_PLUGIN | tr '[:upper:]:' '[:lower:]-'` -SOURCE_NAME_STRLEN=${#SOURCE_PLUGIN} -SOURCE_NAME_FIRST_CHAR=`echo ${SOURCE_PLUGIN:0:1} | tr a-z A-Z` -SOURCE_NAME_END=`echo ${SOURCE_PLUGIN:1:$(( SOURCE_NAME_STRLEN - 1 )) } | tr A-Z a-z` -SOURCE_NAME_START_UPPER_CASE="$SOURCE_NAME_FIRST_CHAR$SOURCE_NAME_END" - -DESTINATION_NAME_UPPER_CASE=`echo $DESTINATION_PLUGIN | tr '[:lower:]:' '[:upper:]-'` -DESTINATION_NAME_LOWER_CASE=`echo $DESTINATION_PLUGIN | tr '[:upper:]:' '[:lower:]-'` -DESTINATION_NAME_STRLEN=${#DESTINATION_PLUGIN} -DESTINATION_NAME_FIRST_CHAR=`echo ${DESTINATION_PLUGIN:0:1} | tr a-z A-Z` -DESTINATION_NAME_END=`echo ${DESTINATION_PLUGIN:1:$(( DESTINATION_NAME_STRLEN - 1 )) } | tr A-Z a-z` -DESTINATION_NAME_START_UPPER_CASE="$DESTINATION_NAME_FIRST_CHAR$DESTINATION_NAME_END" - -echo "transforming : $SOURCE_NAME_UPPER_CASE to $DESTINATION_NAME_UPPER_CASE" -echo " $SOURCE_NAME_LOWER_CASE to $DESTINATION_NAME_LOWER_CASE" -echo " $SOURCE_NAME_START_UPPER_CASE to $DESTINATION_NAME_START_UPPER_CASE" - -# copy sources -/bin/cp -aR $WORKSPACE/$SOURCE_PLUGIN $WORKSPACE/$DESTINATION_PLUGIN - - -# re-name files and content -cd $WORKSPACE -for OLD_FILE in `find $DESTINATION_PLUGIN/ -type f`; do - - # content - if `grep -i $SOURCE_PLUGIN $OLD_FILE 1>/dev/null`; then - if [ ! -z "$DEBUG" ]; then - echo "adjusting content in $OLD_FILE" - fi - cat $OLD_FILE | \ - sed -i -e "s/$SOURCE_NAME_UPPER_CASE/$DESTINATION_NAME_UPPER_CASE/g" $OLD_FILE - sed -i -e "s/$SOURCE_NAME_LOWER_CASE/$DESTINATION_NAME_LOWER_CASE/g" $OLD_FILE - sed -i -e "s/$SOURCE_NAME_START_UPPER_CASE/$DESTINATION_NAME_START_UPPER_CASE/g" $OLD_FILE - else - if [ ! -z "$DEBUG" ]; then - echo "skipping to adjust the content of $OLD_FILE" - fi - fi - - # name - if `echo $OLD_FILE | grep -i $SOURCE_PLUGIN 1>/dev/null`; then - NEW_FILE=`echo $OLD_FILE | \ - sed -e "s/$SOURCE_NAME_UPPER_CASE/$DESTINATION_NAME_UPPER_CASE/g" | \ - sed -e "s/$SOURCE_NAME_LOWER_CASE/$DESTINATION_NAME_LOWER_CASE/g" | \ - sed -e "s/$SOURCE_NAME_START_UPPER_CASE/$DESTINATION_NAME_START_UPPER_CASE/g"` - if [ ! -z "$DEBUG" ]; then - echo "renaming $OLD_FILE to $NEW_FILE" - fi - mkdir -p `dirname $NEW_FILE` - /bin/mv $OLD_FILE $NEW_FILE - else - if [ ! -z "$DEBUG" ]; then - echo "skipping file $OLD_FILE" - fi - fi - -done - -# remove .svn dir -for svn in `find $WORKSPACE/$DESTINATION_PLUGIN/* -name .svn`; do - if [ ! -z "$DEBUG" ]; then - echo "removing $svn" - fi - rm -rf $svn -done -if [ ! -z "$DEBUG" ]; then - echo "removing $WORKSPACE/$DESTINATION_PLUGIN/.svn" -fi -rm -rf $WORKSPACE/$DESTINATION_PLUGIN/.svn - -echo "Finished creating new plugin template $DESTINATION_PLUGIN" - - - diff --git a/openQRM-5.3.50-CE/src/bin/openqrm-package~ b/openQRM-5.3.50-CE/src/bin/openqrm-package~ deleted file mode 100644 index f095dc1..0000000 --- a/openQRM-5.3.50-CE/src/bin/openqrm-package~ +++ /dev/null @@ -1,283 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -PACKAGE_TYPE=$1 -VIRT_1=$2 -VIRT_2=$3 -WORKSPACE=`dirname $0`/../ -NOW=`date +%Y%m%d%H%M%S` - -#ALL_VIRT_TECHNOLOGIES="citrix libvirt lxc openvz kvm vmware-esx vmware-vsphere xen" -ALL_VIRT_TECHNOLOGIES="citrix libvirt lxc kvm vmware-esx vmware-vsphere xen" -COMMUNITY_VIRT_TECHNOLOGIES="kvm" - -CURRENTDIR=`pwd` - -export LANGUAGE=C -export LANG=C -export LC_ALL=C - -if [ "$#" == "0" ]; then - echo "Usage : $0 [virt-technology1] [virt-technology2]" - exit 1 -fi - -case "$PACKAGE_TYPE" in - smb) - if [ "$#" != "2" ]; then - echo "Usage : $0 [virt-technology1]" - exit 1 - fi - PACKAGE_FILENAME="Enterprise-Edition-Eval-$PACKAGE_TYPE" - ;; - large) - if [ "$#" != "3" ]; then - echo "Usage : $0 [virt-technology1] [virt-technology2]" - exit 1 - fi - PACKAGE_FILENAME="Enterprise-Edition-Eval-$PACKAGE_TYPE" - ;; - amazon) - if [ "$#" != "1" ]; then - echo "Usage : $0 " - exit 1 - fi - PACKAGE_FILENAME="Enterprise-Edition-Eval-$PACKAGE_TYPE" - ;; - enterprise) - if [ "$#" != "1" ]; then - echo "Usage : $0 " - exit 1 - fi - PACKAGE_FILENAME="Enterprise-Edition-Eval-$PACKAGE_TYPE" - ;; - community) - if [ "$#" != "1" ]; then - echo "Usage : $0 " - exit 1 - fi - PACKAGE_FILENAME="Community-Edition" - ;; - *) - echo "Usage : $0 " - exit 1 -esac - -if [ "$VIRT_1" == "" ]; then - VIRT_TECH_1="kvm" -else - VIRT_TECH_1="$VIRT_1" -fi -if [ "$VIRT_2" == "" ]; then - VIRT_TECH_2="vmware" -else - VIRT_TECH_2="$VIRT_2" -fi - - -if [ ! -e $WORKSPACE/etc/enterprise/$PACKAGE_TYPE.conf ]; then - echo "Error : Config file $WORKSPACE/etc/enterprise/$PACKAGE_TYPE.conf does not exit" - exit 1 -fi - -# source openqrm-server.conf to get the version -. $WORKSPACE/etc/openqrm-server.conf - -VERSION_STRING="openQRM-$OPENQRM_SERVER_VERSION.$OPENQRM_MINOR_RELEASE_VERSION-$PACKAGE_FILENAME" -echo "Packaging $VERSION_STRING" - -TMPBUILD_DIR=`mktemp -d /tmp/openqrm-enterprise.XXXXXXXXXX` || exit 1 -mkdir -p $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING - -cp -aR $WORKSPACE/../src $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/ - -# copy docs -cp -aR $WORKSPACE/../src/etc/enterprise/txt/openQRM-changelog.txt $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/ - -# license file for enterprise editions -# community edition with diffrent scripts -if [ "$PACKAGE_TYPE" == "community" ]; then - cat $WORKSPACE/../src/etc/enterprise/txt/openQRM-releasenotes-community.txt | - sed -e "s/@@OPENQRM_VERSION@@/$OPENQRM_SERVER_VERSION.$OPENQRM_MINOR_RELEASE_VERSION/g" | - sed -e "s/@@PACKAGE_TYPE@@/$PACKAGE_TYPE/g" > $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/openQRM-releasenotes.txt - cp -aR $WORKSPACE/../src/etc/enterprise/txt/install-openqrm-community.sh $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/install-openqrm.sh - rm -f $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/doc/openQRM-Enterprise-Server-and-Client-License.txt - echo "Downloading GPL 2 license file" - if ! wget -O $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/doc/LICENSE.txt http://support.openqrm-enterprise.com/openqrm-build/LICENSE.txt; then - echo "!!! ERROR: Failed downloading !!! exiting now" - rm -rf $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING - fi - # community logo - rm -f $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/img/logo.png - if ! wget -O $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/img/logo.png http://support.openqrm-enterprise.com/openqrm-build/logo-community.png; then - echo "!!! ERROR: Failed downloading Community Logo!!! exiting now" - rm -rf $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING - fi -else - mkdir -p $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/licensekeys - cp -aR $WORKSPACE/../src/etc/enterprise/txt/openQRM-Enterprise-License.txt $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/ - cat $WORKSPACE/../src/etc/enterprise/txt/openQRM-releasenotes.txt | - sed -e "s/@@OPENQRM_VERSION@@/$OPENQRM_SERVER_VERSION.$OPENQRM_MINOR_RELEASE_VERSION/g" | - sed -e "s/@@PACKAGE_TYPE@@/$PACKAGE_TYPE/g" > $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/openQRM-releasenotes.txt - cp -aR $WORKSPACE/../src/etc/enterprise/txt/install-openqrm.sh $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/ -fi -chmod +x $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/install-openqrm.sh - - -# adjust plugins -rm -rf $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/* -cp -aR $WORKSPACE/../src/plugins/Makefile $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/ - -for PLUGY in `cat $WORKSPACE/etc/enterprise/$PACKAGE_TYPE.conf`; do - if [ -d $WORKSPACE/../src/plugins/$PLUGY ]; then - cp -aR $WORKSPACE/../src/plugins/$PLUGY $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/ - fi -done - -# add virt -case "$PACKAGE_TYPE" in - smb) - echo "- adding virtualization $VIRT_TECH_1" - cp -aR $WORKSPACE/../src/plugins/$VIRT_TECH_1 $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/ - ;; - large) - echo "- adding virtualization $VIRT_TECH_1" - cp -aR $WORKSPACE/../src/plugins/$VIRT_TECH_1 $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/ - echo "- adding virtualization $VIRT_TECH_2" - cp -aR $WORKSPACE/../src/plugins/$VIRT_TECH_2 $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/ - ;; - enterprise) - for VIRT_TECH_N in `echo $ALL_VIRT_TECHNOLOGIES`; do - if [ -d $WORKSPACE/../src/plugins/$VIRT_TECH_N ]; then - echo "- adding virtualization $VIRT_TECH_N" - cp -aR $WORKSPACE/../src/plugins/$VIRT_TECH_N $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/ - fi - done - ;; - community) - for VIRT_TECH_N in `echo $COMMUNITY_VIRT_TECHNOLOGIES`; do - if [ -d $WORKSPACE/../src/plugins/$VIRT_TECH_N ]; then - echo "- adding virtualization $VIRT_TECH_N" - cp -aR $WORKSPACE/../src/plugins/$VIRT_TECH_N $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/ - fi - done - - # enterprise plugins - echo "Filling in empty enterprise plugins" - for P in `ls $WORKSPACE/../src/plugins/ | grep -v Makefile`; do - if [ ! -d "$TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P" ]; then - echo "Adding empty enterprise plugin $P" - . $WORKSPACE/../src/plugins/$P/etc/openqrm-plugin-$P.conf - mkdir -p $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/etc - > $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/etc/openqrm-plugin-$P.conf - echo "OPENQRM_PLUGIN_DESCRIPTION=\"$OPENQRM_PLUGIN_DESCRIPTION
This plugin is only available in the openQRM Enterprise version!
Please check http://www.openqrm-enterprise.com\"" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/etc/openqrm-plugin-$P.conf - echo "OPENQRM_PLUGIN_TYPE=\"$OPENQRM_PLUGIN_TYPE\"" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/etc/openqrm-plugin-$P.conf - # empty makefille - > $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/Makefile - echo "configure:" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/Makefile - echo "compile:" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/Makefile - echo "install:" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/Makefile - echo -e "\tmkdir -p /usr/share/openqrm/plugins/$P/etc" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/Makefile - echo -e "\tcp etc/openqrm-plugin-$P.conf /usr/share/openqrm/plugins/$P/etc/" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/Makefile - echo "uninstall:" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/Makefile - echo "clean:" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/Makefile - echo "all:" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/$P/Makefile - fi - done - - # adapting base template footer - sed -i -e "s/openQRM Enterprise Edition/openQRM Community Edition/g" $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/tpl/index.tpl.php - sed -i -e "s/openQRM Enterprise Cloud/openQRM Community Cloud/g" $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/cloud/cloud-portal/web/user/tpl/index.default.tpl.php - - # adapt to GPL 2 License - cd $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/ - for FILE in `find -type f | grep -v .svn`; do - echo ".. adapting $FILE" - sed -i -e "s/GNU General Public License version 2/GNU General Public License version 2/g" $FILE - sed -i -e "s#src/doc/LICENSE.txt#src/doc/LICENSE.txt#g" $FILE - done - echo "- finished GPL License adaption" - - # remove local-server integration script - echo "- adapting local-server integration" - mkdir -p "$TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/local-server/bin" - LOCAL_SERVER="$TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/plugins/local-server/bin/openqrm-local-server" - - echo "clear" > $LOCAL_SERVER - echo "echo '#################### Please notice !! #################'" >> $LOCAL_SERVER - echo "echo '# The distributed system management openQRM feature #'" >> $LOCAL_SERVER - echo "echo '# local-server is available in the Enterprise Edtion! #'" >> $LOCAL_SERVER - echo "echo '# #'" >> $LOCAL_SERVER - echo "echo '# Please check http://www.openqrm-enterprise.com/ #'" >> $LOCAL_SERVER - echo "echo '#######################################################'" >> $LOCAL_SERVER - echo "echo ''" >> $LOCAL_SERVER - echo "- finished adapting local-server integration" - chmod +x $LOCAL_SERVER - cat $LOCAL_SERVER - - # adapt the info box - sed -i -e "s/openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD/openQRM Community developed by OPENQRM AUSTRALIA PTY LTD/g" $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.api.class.php - grep -B 10000 "openQRM Enterprise Server License" $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.api.class.php | grep -v "openQRM Enterprise Server License" > /tmp/openqrm.api.class.php.1 - grep -A 10000 "Buy additional licenses" $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.api.class.php | grep -v "Buy additional licenses" > /tmp/openqrm.api.class.php.2 - cat /tmp/openqrm.api.class.php.1 > $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.api.class.php - cat /tmp/openqrm.api.class.php.2 >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.api.class.php - rm -f /tmp/openqrm.api.class.php.1 /tmp/openqrm.api.class.php.2 - - # disable license check in openqrm.class.php - sed -i -e "s/\$this->lc()\;//g" $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.class.php - grep -B 10000 "function lc" $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.class.php | grep -v "function lc" > /tmp/openqrm.class.php.1 - cat /tmp/openqrm.class.php.1 > $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.class.php - echo "}" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.class.php - echo "?>" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.class.php - rm -f /tmp/openqrm.class.php.1 - - # disable license check in openqrm.content.class.php - sed -i -e "s/\$lc = \$this->lcc()\;//g" $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.content.class.php - grep -B 10000 "function lcc" $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.content.class.php | grep -v "function lcc" > /tmp/openqrm.content.class.php.1 - cat /tmp/openqrm.content.class.php.1 > $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.content.class.php - echo "}" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.content.class.php - echo "?>" >> $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/class/openqrm.content.class.php - rm -f /tmp/openqrm.content.class.php.1 - - # buy us a coffee in index_top - cp -af $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/etc/enterprise/tpl/index_top.tpl.php $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/web/base/tpl/index_top.tpl.php - ;; -esac - - -cd $CURRENTDIR - -# remove .svn dir -for svn in `find $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/* -name .svn`; do - rm -rf $svn -done -# remove package config dir -rm -rf $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/etc/enterprise -rm -f $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW/$VERSION_STRING/src/bin/openqrm-package - - -# package -cd $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW -tar -C $TMPBUILD_DIR/buildtmp/openqrm-enterprise-$PACKAGE_TYPE-edition-$NOW -czf /tmp/$VERSION_STRING.tgz $VERSION_STRING - - -# clean up -rm -rf $TMPBUILD_DIR/buildtmp -rmdir $TMPBUILD_DIR - -cd $CURRENTDIR -echo "Finished creating openQRM Enteprise package $VERSION_STRING at /tmp/$VERSION_STRING.tgz" - diff --git a/openQRM-5.3.50-CE/src/bin/openqrm-rabbitmq-cmd-queue-ctl b/openQRM-5.3.50-CE/src/bin/openqrm-rabbitmq-cmd-queue-ctl deleted file mode 100644 index a087652..0000000 --- a/openQRM-5.3.50-CE/src/bin/openqrm-rabbitmq-cmd-queue-ctl +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash -# this script automatically manages the lvm volumes for the kvm virtual machines -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - eval appliance_capabilities - export RABBITMQ_SERVER="$resource_openqrmserver" - export RABBITMQ_PASSWORD="$RABBITMQ_PASSWORD" - export RABBITMQ_QUEUE_NAME="$resource_ip" - export OPENQRM_EXECUTION_LAYER=$openqrm_execution_layer -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - export RABBITMQ_SERVER="$OPENQRM_SERVER_IP_ADDRESS" - export RABBITMQ_PASSWORD="$OPENQRM_RABBITMQ_PASSWORD" - export RABBITMQ_QUEUE_NAME="$OPENQRM_SERVER_IP_ADDRESS" -fi -export LANG=C - -if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" -else - RUNSCREEN=`which screen` -fi -if [ "$RUNSCREEN" == "" ]; then - echo "ERROR: screen utility not installed! Please install screen" - exit 1 -fi -if [ "$OPENQRM_EXECUTION_LAYER" != "rabbitmq" ]; then - echo "ERROR: Only useful for RabbitMQ command layer!" - exit 1 -fi -if [ "$RABBITMQ_PASSWORD" == "" ]; then - echo "ERROR: RABBITMQ_PASSWORD not set!" - exit 1 -fi -if [ "$RABBITMQ_SERVER" == "" ]; then - echo "ERROR: RABBITMQ_SERVER not set!" - exit 1 -fi -if [ "$RABBITMQ_QUEUE_NAME" == "" ]; then - echo "ERROR: RABBITMQ_QUEUE_NAME not set!" - exit 1 -fi - -function openqrm_rabbitmq_client_start() { - $RUNSCREEN -dmS cmdqueue $OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-rabbitmq-cmd-queue - echo "Started openqrm-rabbitmq-cmd-queue client" -} - - -function openqrm_rabbitmq_client_stop() { - kill `ps ax | grep openqrm-rabbitmq-cmd-queue | grep python | awk '{ print $1 }'` - echo "Stopped openqrm-rabbitmq-cmd-queue client" -} - - -function openqrm_rabbitmq_client_status() { - if ps ax | grep -w openqrm-rabbitmq-cmd-queue | grep python 1>/dev/null; then - echo "openqrm-rabbitmq-cmd-queue client running" - else - echo "openqrm-rabbitmq-cmd-queue client stopped" - fi -} - - - -case "$1" in - start) - openqrm_rabbitmq_client_start - ;; - stop) - openqrm_rabbitmq_client_stop - ;; - status) - openqrm_rabbitmq_client_status - ;; - restart) - openqrm_rabbitmq_client_stop - sleep 1 - openqrm_rabbitmq_client_start - ;; - *) - echo "Usage: $0 {start|stop|status|restart}" - exit 1 - -esac diff --git a/openQRM-5.3.50-CE/src/bin/openqrm-update b/openQRM-5.3.50-CE/src/bin/openqrm-update deleted file mode 100644 index fb5eb39..0000000 --- a/openQRM-5.3.50-CE/src/bin/openqrm-update +++ /dev/null @@ -1,560 +0,0 @@ -#!/bin/bash -# this is the openQRM commandline client -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../.. - OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -fi -export OPENQRM_SERVER_BASE_DIR -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - - -function update_usage() { - echo - echo "Usage:" - echo "`basename $0` help - This help screen" - echo - echo "`basename $0` pre <-f>" - echo "`basename $0` base <-f>" - echo "`basename $0` post <-f>" - echo "`basename $0` initrds <-f>" - echo -} - - - -function openqrm_apply_old_config() { - local NEW_CONF=$1 - local OLD_CONF=$2 - local ALL_CONFIG_FILES="" - if [ -f "$NEW_CONF" ]; then - ALL_CONFIG_FILES="$NEW_CONF" - fi - if [ -f "$OLD_CONF" ]; then - ALL_CONFIG_FILES="$ALL_CONFIG_FILES $OLD_CONF" - fi - - # checking new config against old - for OPENQRM_CONFIG_PARAM in `cat $ALL_CONFIG_FILES | grep -v ^"#" | grep "[A-Z][A-Z][A-Z][A-Z].*=.*" | cut -d'=' -f1 | uniq`; do - #echo " - checking parameter $OPENQRM_CONFIG_PARAM" - # do net adapt version values - if [ "$OPENQRM_CONFIG_PARAM" == "OPENQRM_SERVER_VERSION" ] || [ "$OPENQRM_CONFIG_PARAM" == "OPENQRM_MINOR_RELEASE_VERSION" ] || [ "$OPENQRM_CONFIG_PARAM" == "OPENQRM_PLUGIN_VERSION" ] || [ "$OPENQRM_CONFIG_PARAM" == "#" ]; then - continue - fi - # do not adapt deps + requires + descriptions - if echo $OPENQRM_CONFIG_PARAM | grep DEPENDENCIES 1>/dev/null; then - continue - fi - if echo $OPENQRM_CONFIG_PARAM | grep REQUIREMENTS 1>/dev/null; then - continue - fi - if echo $OPENQRM_CONFIG_PARAM | grep DESCRIPTION 1>/dev/null; then - continue - fi - - unset OLD_CONFIG_VALUE - unset NEW_CONFIG_VALUE - unset $OPENQRM_CONFIG_PARAM - if [ -f "$OLD_CONF" ]; then - . $OLD_CONF - else - echo "NOTICE: $OLD_CONF does not exist!" - fi - eval OLD_CONFIG_VALUE=\$$OPENQRM_CONFIG_PARAM - unset $OPENQRM_CONFIG_PARAM - if [ -f "$NEW_CONF" ]; then - . $NEW_CONF - else - echo "NOTICE: $NEW_CONF does not exist!" - fi - eval NEW_CONFIG_VALUE=\$$OPENQRM_CONFIG_PARAM - - # existing in old config but not in new ! - if [ "$OLD_CONFIG_VALUE" != "" ] && [ "$NEW_CONFIG_VALUE" == "" ]; then - if [ -f "$NEW_CONF" ]; then - if ! grep -w $OPENQRM_CONFIG_PARAM $NEW_CONF 1>/dev/null; then - echo " - Config parameter $OPENQRM_CONFIG_PARAM does not exist any more!" - else - echo " - Config parameter $OPENQRM_CONFIG_PARAM was set in old configuration." - if [ "$FORCE_UPDATE" == "false" ]; then - echo " - e - Edit configuration" - echo " - k - Keep new configuration" - echo - read -n1 APPLY_CONFIG_PARAM - case "$APPLY_CONFIG_PARAM" in - e) - echo - echo " - Editing configuration parameter $OPENQRM_CONFIG_PARAM" - echo - echo -n " $OPENQRM_CONFIG_PARAM=" - read USER_INPUT_OPENQRM_CONFIG_PARAM - if [ -f "$NEW_CONF" ]; then - sed -i -e "s#$OPENQRM_CONFIG_PARAM.*=.*#$OPENQRM_CONFIG_PARAM=\"$USER_INPUT_OPENQRM_CONFIG_PARAM\"#g" $NEW_CONF - else - echo "NOTICE: $NEW_CONF does not exist!" - fi - break - ;; - k) - echo - echo " - Keeping new configuration for parameter $OPENQRM_CONFIG_PARAM" - break - ;; - esac - else - echo " - Applying old configuration for config parameter $OPENQRM_CONFIG_PARAM" - sed -i -e "s#$OPENQRM_CONFIG_PARAM=.*#$OPENQRM_CONFIG_PARAM=\"$OLD_CONFIG_VALUE\"#g" $NEW_CONF - fi - fi - fi - continue - fi - # existing in new config but not in old ! - if [ "$OLD_CONFIG_VALUE" == "" ] && [ "$NEW_CONFIG_VALUE" != "" ]; then - while (true); do - echo " - Config parameter $OPENQRM_CONFIG_PARAM is new!" - echo " $OPENQRM_CONFIG_PARAM=$NEW_CONFIG_VALUE" - - if [ "$FORCE_UPDATE" == "false" ]; then - echo " - e - Edit configuration" - echo " - k - Keep new configuration" - echo - read -n1 APPLY_CONFIG_PARAM - - case "$APPLY_CONFIG_PARAM" in - e) - echo - echo " - Editing configuration parameter $OPENQRM_CONFIG_PARAM" - echo - echo -n " $OPENQRM_CONFIG_PARAM=" - read USER_INPUT_OPENQRM_CONFIG_PARAM - if [ -f "$NEW_CONF" ]; then - sed -i -e "s#$OPENQRM_CONFIG_PARAM.*=.*#$OPENQRM_CONFIG_PARAM=\"$USER_INPUT_OPENQRM_CONFIG_PARAM\"#g" $NEW_CONF - else - echo "NOTICE: $NEW_CONF does not exist!" - fi - break - ;; - k) - echo - echo " - Keeping new configuration for parameter $OPENQRM_CONFIG_PARAM" - break - ;; - esac - else - echo " - Force enabled. Keeping new configuration for parameter $OPENQRM_CONFIG_PARAM" - break - fi - done - - elif [ "$OLD_CONFIG_VALUE" != "$NEW_CONFIG_VALUE" ]; then - # existing in both configs but with different value - - while (true); do - echo " - Change detected for parameter $OPENQRM_CONFIG_PARAM" - echo - echo " old = $OLD_CONFIG_VALUE" - echo " new = $NEW_CONFIG_VALUE" - echo - - if [ "$FORCE_UPDATE" == "false" ]; then - echo " - o - Apply old configuration" - echo " - k - Keep new configuration" - echo - read -n1 APPLY_CONFIG_PARAM - - case "$APPLY_CONFIG_PARAM" in - o) - echo " - Applying old configuration" - if [ -f "$NEW_CONF" ]; then - sed -i -e "s#$OPENQRM_CONFIG_PARAM.*=.*#$OPENQRM_CONFIG_PARAM=\"$OLD_CONFIG_VALUE\"#g" $NEW_CONF - else - echo "NOTICE: $NEW_CONF does not exist!" - fi - break - ;; - k) - echo " - Keeping new configuration" - break - ;; - esac - else - echo " - Force enabled. Applying old configuration" - if [ -f "$NEW_CONF" ]; then - sed -i -e "s#$OPENQRM_CONFIG_PARAM.*=.*#$OPENQRM_CONFIG_PARAM=\"$OLD_CONFIG_VALUE\"#g" $NEW_CONF - else - echo "NOTICE: $NEW_CONF does not exist!" - fi - break - fi - done - fi - done -} - - - -function pre_update() { - echo "- Running pre update phase" - # full backup of basedir - echo " - Taking full backup of $OPENQRM_SERVER_BASE_DIR/openqrm" - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update - cp -aR $OPENQRM_SERVER_BASE_DIR/openqrm $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update - # db + state backup - echo " - Taking state + db backup" - rm -rf $OPENQRM_SERVER_STATE_DIR/openqrm_pre_update* - $OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm state backup -n openqrm_pre_update - # now we are save to update files and db - # remove all old plugin php classes + tpl - echo " - Removing old plugins php classes" - find $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ -type f -wholename "*/plugins/*/web/class/*.class.php" -delete - find $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ -type f -wholename "*/plugins/*/web/tpl/*.tpl.php" -delete - # clean web base + plugins - find $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/plugins/aa_plugins/ -type f -wholename "*/web/base/plugins/aa_plugins/class/*.class.php" -delete - find $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/plugins/aa_plugins/ -type f -wholename "*/web/base/plugins/aa_plugins/tpl/*.tpl.php" -delete - find $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/server/ -type f -wholename "*/web/base/server/*/class/*.class.php" -delete - find $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/server/ -type f -wholename "*/web/base/server/*/tpl/*.tpl.php" -delete - # custom updates from openQRM 4.9 to 5.0 - # clean up old/removed files - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/local-storage-state.php - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/root-mount.local-storage - - # custom updates from openQRM 4.9 to 5.0 - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/server/aa_server/js/jqplot.donutRenderer.min.js - return 0 -} - - - -function post_update() { - echo "- Running post update phase" - # keeping origin in state dir - mv $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update $OPENQRM_SERVER_STATE_DIR/ - # restart openQRM - OPENQRM_INIT="" - if [ -x /etc/init.d/openqrm ]; then - OPENQRM_INIT="/etc/init.d/openqrm" - elif [ -x /etc/init.d/openqrm-enterprise ]; then - OPENQRM_INIT="/etc/init.d/openqrm-enterprise" - fi - if [ "$OPENQRM_INIT" != "" ]; then - $OPENQRM_INIT stop - fi - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/unconfigured ]; then - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/unconfigured - fi - $OPENQRM_INIT start - echo "- post update finished successfully" -} - - - -function base_update() { - echo "- Running base update phase" - # re-source main config - if [ ! -f "$OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/etc/openqrm-server.conf" ]; then - echo "ERROR: Applying base-update before pre-update phase ! Trying to continue ..." - sleep 5 - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - else - . $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/etc/openqrm-server.conf - fi - # source db-functions according db-type - echo "- Database shema sanity check (databasetype $OPENQRM_DATABASE_TYPE)" - $OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/$OPENQRM_DATABASE_TYPE/openqrm-$OPENQRM_DATABASE_TYPE-functions update - # wait to check by the user if not in force mode - if [ "$FORCE_UPDATE" == "false" ]; then - echo "=> Please press to go on" - read - fi - - # unpack all new boot-services - for OPENQRM_BOOTSERVICE in `find $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ -name boot-service-*.tgz`; do - OPENQRM_BOOTSERVICE_FILENAME=`basename $OPENQRM_BOOTSERVICE` - OPENQRM_BOOTSERVICE_DIRNAME=`dirname $OPENQRM_BOOTSERVICE` - rm -rf $OPENQRM_BOOTSERVICE_DIRNAME/boot-service.tmp - mkdir $OPENQRM_BOOTSERVICE_DIRNAME/boot-service.tmp - if ! tar -C $OPENQRM_BOOTSERVICE_DIRNAME/boot-service.tmp -xzf $OPENQRM_BOOTSERVICE; then - echo "ERROR: Could not unpack boot-service $OPENQRM_BOOTSERVICE !" - sleep 5 - rm -rf $OPENQRM_BOOTSERVICE_DIRNAME/boot-service.tmp - fi - done - - # unpack all old boot-services - for OPENQRM_OLD_BOOTSERVICE in `find $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/plugins/ -name boot-service-*.tgz`; do - OPENQRM_OLD_BOOTSERVICE_FILENAME=`basename $OPENQRM_OLD_BOOTSERVICE` - OPENQRM_OLD_BOOTSERVICE_DIRNAME=`dirname $OPENQRM_OLD_BOOTSERVICE` - rm -rf $OPENQRM_OLD_BOOTSERVICE_DIRNAME/boot-service.tmp - mkdir $OPENQRM_OLD_BOOTSERVICE_DIRNAME/boot-service.tmp - if ! tar -C $OPENQRM_OLD_BOOTSERVICE_DIRNAME/boot-service.tmp -xzf $OPENQRM_OLD_BOOTSERVICE; then - echo "ERROR: Could not unpack boot-service $OPENQRM_OLD_BOOTSERVICE !" - sleep 5 - rm -rf $OPENQRM_OLD_BOOTSERVICE_DIRNAME/boot-service.tmp - fi - done - - # config file sanity check - for OPENQRM_CONF_FILE in `find $OPENQRM_SERVER_BASE_DIR/openqrm/ -name *.conf | cut -d'/' -f5-`; do - if [ -f "$OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/$OPENQRM_CONF_FILE" ]; then - echo " - Checking config file $OPENQRM_SERVER_BASE_DIR/openqrm/$OPENQRM_CONF_FILE" - if ! diff $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/$OPENQRM_CONF_FILE $OPENQRM_SERVER_BASE_DIR/openqrm/$OPENQRM_CONF_FILE 1>/dev/null 2>/dev/null; then - while (true); do - echo " - Changes detected for config file $OPENQRM_SERVER_BASE_DIR/openqrm/$OPENQRM_CONF_FILE" - if [ "$FORCE_UPDATE" == "false" ]; then - echo " - v - View changes" - echo " - a - Try to apply old configuration" - echo " - k - Apply new config file" - echo - - read -n1 APPLY_OLD_CONFIG - case "$APPLY_OLD_CONFIG" in - v) - echo " - Displaying changes" - echo - if [ ! -f "$OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/$OPENQRM_CONF_FILE" ]; then - echo "NOTICE: $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/$OPENQRM_CONF_FILE does not exist" - elif [ !-f "$OPENQRM_SERVER_BASE_DIR/openqrm/$OPENQRM_CONF_FILE" ]; then - echo "NOTICE: $OPENQRM_SERVER_BASE_DIR/openqrm/$OPENQRM_CONF_FILE does not exist" - else - diff $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/$OPENQRM_CONF_FILE $OPENQRM_SERVER_BASE_DIR/openqrm/$OPENQRM_CONF_FILE - fi - ;; - a) - echo " - Trying to apply old configuration" - openqrm_apply_old_config $OPENQRM_SERVER_BASE_DIR/openqrm/$OPENQRM_CONF_FILE $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/$OPENQRM_CONF_FILE - echo - break - ;; - k) - echo " - Keeping new configuration" - break - ;; - esac - else - echo - echo " - Force enabled. Trying to apply old configuration" - openqrm_apply_old_config $OPENQRM_SERVER_BASE_DIR/openqrm/$OPENQRM_CONF_FILE $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/$OPENQRM_CONF_FILE - echo - break - fi - done - fi - fi - done - - # pack all new boot-services - for OPENQRM_BOOTSERVICE in `find $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ -name boot-service-*.tgz`; do - OPENQRM_BOOTSERVICE_FILENAME=`basename $OPENQRM_BOOTSERVICE` - OPENQRM_BOOTSERVICE_DIRNAME=`dirname $OPENQRM_BOOTSERVICE` - TIMESTAMP=`date +%s` - mv -f $OPENQRM_BOOTSERVICE $OPENQRM_BOOTSERVICE.$TIMESTAMP - cd $OPENQRM_BOOTSERVICE_DIRNAME/boot-service.tmp/ - if ! tar -czf $OPENQRM_BOOTSERVICE *; then - echo "ERROR: Could not re-pack boot-service $OPENQRM_BOOTSERVICE !" - sleep 5 - fi - cd - 1>/dev/null - rm -rf $OPENQRM_BOOTSERVICE_DIRNAME/boot-service.tmp - done - - # clean up old boot-services - for OPENQRM_OLD_BOOTSERVICE in `find $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/plugins/ -name boot-service-*.tgz`; do - OPENQRM_OLD_BOOTSERVICE_FILENAME=`basename $OPENQRM_OLD_BOOTSERVICE` - OPENQRM_OLD_BOOTSERVICE_DIRNAME=`dirname $OPENQRM_OLD_BOOTSERVICE` - rm -rf $OPENQRM_OLD_BOOTSERVICE_DIRNAME/boot-service.tmp - done - - # custom updates from openQRM 4.6 to 4.7 - # link the tftpboot/boot dir to the boot-services - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/boot - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/ $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/boot - - # custom update actions for various plugins - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/bin/openqrm-cloud-manager update-soap - # update from 4.9 to 5.0 - lock for the command-queueu - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/var/lock/ - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/var/lock/ - # update from 4.9 to 5.0 - upload dir - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/tmp - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/tmp - # remove deprecated boot-services - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/boot-service-cloud.tgz - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/boot-service-linuxcoe.tgz - # create htaccess files for storage and virt-stat dirs if not existing already - for PLUGIN in `ls $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/`; do - if [ -d $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN/web/storage ]; then - if [ ! -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN/web/storage/.htaccess ]; then - echo "Order deny,allow" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN/web/storage/.htaccess - echo "Deny from all" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN/web/storage/.htaccess - fi - fi - if [ -d $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN/web/$PLUGIN-stat ]; then - if [ ! -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN/web/$PLUGIN-stat/.htaccess ]; then - echo "Order deny,allow" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN/web/$PLUGIN-stat/.htaccess - echo "Deny from all" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN/web/$PLUGIN-stat/.htaccess - fi - fi - done - # libvirt hosts need remote access to the storage and stat dir - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/libvirt/web/libvirt-stat/.htaccess - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/libvirt/web/storage/.htaccess - # cleanup css - find $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/ -name calendar.css -delete - -} - -function do_initrd_update() { - - INITRD_FILENAME=`basename $INITRD_FILE` - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/openqrm-initrd-update - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/openqrm-initrd-update - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/openqrm-initrd-update/$INITRD_FILENAME - cp -f $INITRD_FILE $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/openqrm-initrd-update/$INITRD_FILENAME.gz - cd $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/openqrm-initrd-update/ - # unpack - if ! gunzip < $INITRD_FILENAME.gz | cpio --extract --preserve; then - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/openqrm-initrd-update - echo "ERROR: Could not gunzip $INITRD_FILE. Continuing ..." - continue - fi - rm -f $INITRD_FILENAME.gz - # update linuxrc - cp -af $OPENQRM_SERVER_BASE_DIR/openqrm//etc/templates/openqrm-linuxrc init - chmod +x init - # pack again - if ! find . | cpio -o -H newc | gzip -9 > $INITRD_FILE.new; then - rm -f $INITRD_FILE.new - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/openqrm-initrd-update - echo "ERROR: Could not re-pack $INITRD_FILE. Continuing ..." - continue - fi - cp -f $INITRD_FILE.new $INITRD_FILE - rm -f $INITRD_FILE.new - # cleanup - cd $CURRENT_UPDATE_DIR - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/openqrm-initrd-update - - -} - - -function initrd_update() { - echo "- Updating initrds" - CURRENT_UPDATE_DIR=`pwd` - - if [ "$INITRD_FILE" != "" ]; then - - do_initrd_update - - else - - for INITRD_FILE in `ls $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-*.img`; do - UPDATE_OPENQRM_INITRD=false - - if [ "$FORCE_UPDATE" == "false" ]; then - echo " - y - Update $INITRD_FILE" - echo " - n - Skip update of $INITRD_FILE" -# echo - read -n1 APPLY_INITRD_UPDATE - - case "$APPLY_INITRD_UPDATE" in - y) - echo " - Updating $INITRD_FILE" - UPDATE_OPENQRM_INITRD=true - ;; - *) - echo " - Keeping old initrd $INITRD_FILE" - UPDATE_OPENQRM_INITRD=false - ;; - esac - else - echo " - Force enabled. Updating $INITRD_FILE" - UPDATE_OPENQRM_INITRD=true - fi - - if [ "$UPDATE_OPENQRM_INITRD" == "true" ]; then - - do_initrd_update - - fi - - echo - - done - fi -} - - - - - -# debug -# openqrm_apply_old_config /usr/share/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf /usr/share/openqrm_pre_update/plugins/kvm/etc/openqrm-plugin-kvm.conf - -if [ "$2" == "-f" ]; then - export FORCE_UPDATE=true -else - export FORCE_UPDATE=false - - if [ "$2" != "" ]; then - export INITRD_FILE=$OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/$2 - fi -fi - - -# main -case "$1" in - pre) - pre_update - ;; - post) - post_update - ;; - base) - base_update - ;; - initrds) - initrd_update - ;; - *) - update_usage - ;; -esac - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/debian/changelog b/openQRM-5.3.50-CE/src/debian/changelog deleted file mode 100644 index d4dba54..0000000 --- a/openQRM-5.3.50-CE/src/debian/changelog +++ /dev/null @@ -1,215 +0,0 @@ -openqrm (5.3.2-ubuntu1) xenial; urgency=low - - [ Matthias Rechenburg ] - * New Community release 5.3.2 - * Enhanced package dependencies for latest Ubuntu, Debian and CentOS - * removed rpmforge repository dependencies - - -- OPENQRM AUSTRALIA PTY LTD Wed, 18 Jan 2017 15:00:00 +0200 - -openqrm (5.3.1-ubuntu1) xenial; urgency=low - - [ Matthias Rechenburg ] - * New Community release 5.3 - * Important security update - * Many bugfixes and lots of enhancements especially for KVM and Cloud plugin - - -- OPENQRM AUSTRALIA PTY LTD Wed, 18 Oct 2016 15:00:00 +0200 - -openqrm (5.2.15-ubuntu1) xenial; urgency=low - - [ Matthias Rechenburg ] - * New Amazon features in 5.2.15 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 9 Jun 2016 15:00:00 +0200 - -openqrm (5.2.14-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New Amazon plugin in 5.2.14 - - -- OPENQRM AUSTRALIA PTY LTD Mon, 18 Apr 2016 15:00:00 +0200 - -openqrm (5.2.13-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * VMware vSphere integration 5.2.13 - - -- OPENQRM AUSTRALIA PTY LTD Mon, 25 Jan 2016 15:00:00 +0200 - -openqrm (5.2.12-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New VMware vSphere integration 5.2.12 beta1 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 05 Jan 2016 15:00:00 +0200 - -openqrm (5.2.11-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New VMware vSphere integration 5.2.11 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 29 Dec 2015 15:00:00 +0200 - -openqrm (5.2.10-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.10 - - -- OPENQRM AUSTRALIA PTY LTD Thu, 30 Aug 2015 15:00:00 +0200 - -openqrm (5.2.9-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.9 - - -- OPENQRM AUSTRALIA PTY LTD Thu, 16 Jul 2015 15:00:00 +0200 - -openqrm (5.2.8-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.8 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 6 Jul 2015 15:00:00 +0200 - -openqrm (5.2.7-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.7 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 25 Jun 2015 15:00:00 +0200 - -openqrm (5.2.6-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.6 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 22 Jun 2015 15:00:00 +0200 - -openqrm (5.2.5-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.5 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 19 Jun 2015 15:00:00 +0200 - -openqrm (5.2.4-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.4 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 12 Jun 2015 15:00:00 +0200 - -openqrm (5.2.3-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.3-beta - - -- OPENQRM AUSTRALIA PTY LTD Tue, 18 May 2015 15:00:00 +0200 - -openqrm (5.2.1-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.1 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 31 Jan 2015 15:00:00 +0200 - -openqrm (5.1.4-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.4 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 22 Jul 2014 15:00:00 +0200 - -openqrm (5.1.3-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.3 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 30 Apr 2014 15:00:00 +0200 - -openqrm (5.1.2-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.2 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 12 Mar 2014 15:00:00 +0200 - -openqrm (5.1.1-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.1 - - -- OPENQRM AUSTRALIA PTY LTD Fr, 6 Dec 2013 15:00:00 +0200 - -openqrm (5.1.0-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New stable release 5.1.0 - - -- OPENQRM AUSTRALIA PTY LTD Sat, 31 Aug 2013 15:00:00 +0200 - -openqrm (5.1-beta.0-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New beta release 5.1-beta.0 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 31 Jul 2013 15:00:00 +0200 - -openqrm (5.0.3-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New minor release 5.0.3 - * fixed nasty bug preventing dhcpd/dns to start on Ubuntu - - -- OPENQRM AUSTRALIA PTY LTD Thur, 7 Mar 2013 15:00:00 +0200 - -openqrm (5.0.2-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New minor release 5.0.2 - - -- OPENQRM AUSTRALIA PTY LTD Thur, 24 Jan 2013 15:00:00 +0200 - -openqrm (5.0.1-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New minor release 5.0.1 - - -- OPENQRM AUSTRALIA PTY LTD Sat, 31 May 2012 15:00:00 +0200 - -openqrm (5.0-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New stable release 5.0 - - -- OPENQRM AUSTRALIA PTY LTD Sat, 31 May 2012 15:00:00 +0200 - -openqrm (4.9-ubuntu1) lucid; urgency=low - - [ Matthias Rechenburg ] - * New stable release 4.9 - - -- Matthias Rechenburg Sat, 31 Oct 2011 15:00:00 +0200 - -openqrm (4.8-ubuntu1) maverick; urgency=low - - [ Matthias Rechenburg ] - * New stable release 4.8 - - -- Matthias Rechenburg Sat, 31 Mar 2011 15:00:00 +0200 - -openqrm (4.7-ubuntu1) maverick; urgency=low - - [ Matthias Rechenburg ] - * New stable release 4.7 - - -- Matthias Rechenburg Sat, 30 Oct 2010 16:43:35 +0200 - -openqrm (4.6-ubuntu1) karmic; urgency=low - - [ Matthias Rechenburg ] - * Initial release - - -- Matthias Rechenburg Sat, 05 Sep 2009 21:14:45 +0200 - diff --git a/openQRM-5.3.50-CE/src/debian/changelog.debian b/openQRM-5.3.50-CE/src/debian/changelog.debian deleted file mode 100644 index da08599..0000000 --- a/openQRM-5.3.50-CE/src/debian/changelog.debian +++ /dev/null @@ -1,242 +0,0 @@ -openqrm (5.3.50-debian1) buster; urgency=low - - [ Roger Mangraviti ] - * Debian 11 Bullseye - * ATU plugin revision - * linuxrc ixgbe module dependency pre-loading - - -- OPENQRM AUSTRALIA PTY LTD Tue, 28 Aug 2021 12:41:12 +1000 - -openqrm (5.3.42-debian1) buster; urgency=low - - [ Roger Mangraviti ] - * Deprecated x86 32bit support - * integrated systemd - * Adjustments & Refactoring - - -- OPENQRM AUSTRALIA PTY LTD Tue, 17 Aug 2021 11:30:29 +1000 - -openqrm (5.3.41-debian1) buster; urgency=low - - [ Roger Mangraviti ] - * Deprecated Nagios3 - * New Nagios4 - * Adjustments & Refactoring - - -- OPENQRM AUSTRALIA PTY LTD Wed, 4 Jul 2021 17:56:14 +1000 - -openqrm (5.3.40-debian1) buster; urgency=low - - [ Roger Mangraviti ] - * Repackaged for Debian Buster - - -- OPENQRM AUSTRALIA PTY LTD Wed, 3 Feb 2021 20:12:02 +1000 - -openqrm (5.3.2-debian1) jessie; urgency=low - - [ Matthias Rechenburg ] - * New Community release 5.3.2 - * Enhanced package dependencies for latest Ubuntu, Debian and CentOS - * removed rpmforge repository dependencies - - -- OPENQRM AUSTRALIA PTY LTD Wed, 18 January 2017 15:00:00 +0200 - -openqrm (5.3.1-debian1) jessie; urgency=low - - [ Matthias Rechenburg ] - * New Community release 5.3 - * Important security update - * Many bugfixes and lots of enhancements especially for KVM and Cloud plugin - - -- OPENQRM AUSTRALIA PTY LTD Wed, 18 October 2016 15:00:00 +0200 - -openqrm (5.2.15-debian1) jessie; urgency=low - - [ Matthias Rechenburg ] - * New Amazon plugin in 5.2.15 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 9 June 2016 15:00:00 +0200 - -openqrm (5.2.14-debian1) jessie; urgency=low - - [ Matthias Rechenburg ] - * New Amazon plugin in 5.2.14 - - -- OPENQRM AUSTRALIA PTY LTD Mon, 18 April 2016 15:00:00 +0200 - -openqrm (5.2.13-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * VMware vSphere integration 5.2.13 - - -- OPENQRM AUSTRALIA PTY LTD Mon, 25 January 2016 15:00:00 +0200 - -openqrm (5.2.11-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New VMware vSphere integration 5.2.11 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 29 December 2015 15:00:00 +0200 - -openqrm (5.2.10-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.10 - - -- OPENQRM AUSTRALIA PTY LTD Thu, 30 August 2015 15:00:00 +0200 - -openqrm (5.2.9-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.9 - - -- OPENQRM AUSTRALIA PTY LTD Thu, 16 July 2015 15:00:00 +0200 - -openqrm (5.2.8-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.8 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 6 July 2015 15:00:00 +0200 - -openqrm (5.2.7-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.7 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 25 June 2015 15:00:00 +0200 - -openqrm (5.2.6-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.6 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 22 June 2015 15:00:00 +0200 - -openqrm (5.2.5-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.5 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 19 June 2015 15:00:00 +0200 - -openqrm (5.2.4-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.4 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 12 June 2015 15:00:00 +0200 - -openqrm (5.2.3-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.3-beta - - -- OPENQRM AUSTRALIA PTY LTD Tue, 18 May 2015 15:00:00 +0200 - -openqrm (5.2.1-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.1 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 31 January 2015 15:00:00 +0200 - -openqrm (5.1.4-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.4 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 22 July 2014 15:00:00 +0200 - -openqrm (5.1.3-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.3 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 30 April 2014 15:00:00 +0200 - -openqrm (5.1.2-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.2 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 12 March 2014 15:00:00 +0200 - -openqrm (5.1.1-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.1 - - -- OPENQRM AUSTRALIA PTY LTD Fr, 6 December 2013 15:00:00 +0200 - -openqrm (5.1.0-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New stable release 5.1.0 - - -- OPENQRM AUSTRALIA PTY LTD Sat, 31 August 2013 15:00:00 +0200 - -openqrm (5.1-beta.0-debian1) squeeze; urgency=low - - [ Matthias Rechenburg ] - * New beta release 5.1-beta.0 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 31 July 2013 15:00:00 +0200 - -openqrm (5.0.3-debian1) squeeze; urgency=low - - [ Matthias Rechenburg ] - * New minor release 5.0.3 - * fixed nasty bug preventing dhcpd/dns to start on Ubuntu - - -- OPENQRM AUSTRALIA PTY LTD Thur, 7 March 2013 15:00:00 +0200 - -openqrm (5.0.2-debian1) squeeze; urgency=low - - [ Matthias Rechenburg ] - * New minor release 5.0.2 - - -- OPENQRM AUSTRALIA PTY LTD Thur, 24 January 2013 15:00:00 +0200 - -openqrm (5.0.1-debian1) squeeze; urgency=low - - [ Matthias Rechenburg ] - * New minor release 5.0.1 - - -- OPENQRM AUSTRALIA PTY LTD Sat, 31 May 2012 15:00:00 +0200 - -openqrm (5.0-debian1) squeeze; urgency=low - - [ Matthias Rechenburg ] - * New stable release 5.0 - - -- OPENQRM AUSTRALIA PTY LTD Sat, 31 May 2012 15:00:00 +0200 - -openqrm (4.9-debian1) lenny; urgency=low - - [ Matthias Rechenburg ] - * New stable release 4.9 - - -- Matthias Rechenburg Sat, 31 Oct 2011 15:00:00 +0200 - -openqrm (4.8-debian1) lenny; urgency=low - - [ Matthias Rechenburg ] - * New stable release 4.8 - - -- Matthias Rechenburg Sat, 31 Mar 2011 15:00:00 +0200 - -openqrm (4.7-debian1) lenny; urgency=low - - [ Matthias Rechenburg ] - * New stable release 4.7 - - -- Matthias Rechenburg Sat, 30 Oct 2010 16:43:35 +0200 - -openqrm (4.6-debian1) lenny; urgency=low - - [ Matthias Rechenburg ] - * Initial release - - -- Matthias Rechenburg Sat, 05 Sep 2009 21:14:45 +0200 - diff --git a/openQRM-5.3.50-CE/src/debian/changelog.debian~ b/openQRM-5.3.50-CE/src/debian/changelog.debian~ deleted file mode 100644 index 26a2bd1..0000000 --- a/openQRM-5.3.50-CE/src/debian/changelog.debian~ +++ /dev/null @@ -1,233 +0,0 @@ -openqrm (5.3.42-debian1) buster; urgency=low - - [ Roger Mangraviti ] - * Deprecated x86 32bit support - * integrated systemd - * Adjustments & Refactoring - - -- OPENQRM AUSTRALIA PTY LTD Tue, 17 Aug 2021 11:30:29 +1000 - -openqrm (5.3.41-debian1) buster; urgency=low - - [ Roger Mangraviti ] - * Deprecated Nagios3 - * New Nagios4 - * Adjustments & Refactoring - - -- OPENQRM AUSTRALIA PTY LTD Wed, 4 Jul 2021 17:56:14 +1000 - -openqrm (5.3.40-debian1) buster; urgency=low - - [ Roger Mangraviti ] - * Repackaged for Debian Buster - - -- OPENQRM AUSTRALIA PTY LTD Wed, 3 Feb 2021 20:12:02 +1000 - -openqrm (5.3.2-debian1) jessie; urgency=low - - [ Matthias Rechenburg ] - * New Community release 5.3.2 - * Enhanced package dependencies for latest Ubuntu, Debian and CentOS - * removed rpmforge repository dependencies - - -- OPENQRM AUSTRALIA PTY LTD Wed, 18 January 2017 15:00:00 +0200 - -openqrm (5.3.1-debian1) jessie; urgency=low - - [ Matthias Rechenburg ] - * New Community release 5.3 - * Important security update - * Many bugfixes and lots of enhancements especially for KVM and Cloud plugin - - -- OPENQRM AUSTRALIA PTY LTD Wed, 18 October 2016 15:00:00 +0200 - -openqrm (5.2.15-debian1) jessie; urgency=low - - [ Matthias Rechenburg ] - * New Amazon plugin in 5.2.15 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 9 June 2016 15:00:00 +0200 - -openqrm (5.2.14-debian1) jessie; urgency=low - - [ Matthias Rechenburg ] - * New Amazon plugin in 5.2.14 - - -- OPENQRM AUSTRALIA PTY LTD Mon, 18 April 2016 15:00:00 +0200 - -openqrm (5.2.13-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * VMware vSphere integration 5.2.13 - - -- OPENQRM AUSTRALIA PTY LTD Mon, 25 January 2016 15:00:00 +0200 - -openqrm (5.2.11-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New VMware vSphere integration 5.2.11 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 29 December 2015 15:00:00 +0200 - -openqrm (5.2.10-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.10 - - -- OPENQRM AUSTRALIA PTY LTD Thu, 30 August 2015 15:00:00 +0200 - -openqrm (5.2.9-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.9 - - -- OPENQRM AUSTRALIA PTY LTD Thu, 16 July 2015 15:00:00 +0200 - -openqrm (5.2.8-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.8 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 6 July 2015 15:00:00 +0200 - -openqrm (5.2.7-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.7 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 25 June 2015 15:00:00 +0200 - -openqrm (5.2.6-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.6 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 22 June 2015 15:00:00 +0200 - -openqrm (5.2.5-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.5 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 19 June 2015 15:00:00 +0200 - -openqrm (5.2.4-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.4 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 12 June 2015 15:00:00 +0200 - -openqrm (5.2.3-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.3-beta - - -- OPENQRM AUSTRALIA PTY LTD Tue, 18 May 2015 15:00:00 +0200 - -openqrm (5.2.1-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.1 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 31 January 2015 15:00:00 +0200 - -openqrm (5.1.4-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.4 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 22 July 2014 15:00:00 +0200 - -openqrm (5.1.3-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.3 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 30 April 2014 15:00:00 +0200 - -openqrm (5.1.2-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.2 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 12 March 2014 15:00:00 +0200 - -openqrm (5.1.1-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.1 - - -- OPENQRM AUSTRALIA PTY LTD Fr, 6 December 2013 15:00:00 +0200 - -openqrm (5.1.0-debian1) wheezy; urgency=low - - [ Matthias Rechenburg ] - * New stable release 5.1.0 - - -- OPENQRM AUSTRALIA PTY LTD Sat, 31 August 2013 15:00:00 +0200 - -openqrm (5.1-beta.0-debian1) squeeze; urgency=low - - [ Matthias Rechenburg ] - * New beta release 5.1-beta.0 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 31 July 2013 15:00:00 +0200 - -openqrm (5.0.3-debian1) squeeze; urgency=low - - [ Matthias Rechenburg ] - * New minor release 5.0.3 - * fixed nasty bug preventing dhcpd/dns to start on Ubuntu - - -- OPENQRM AUSTRALIA PTY LTD Thur, 7 March 2013 15:00:00 +0200 - -openqrm (5.0.2-debian1) squeeze; urgency=low - - [ Matthias Rechenburg ] - * New minor release 5.0.2 - - -- OPENQRM AUSTRALIA PTY LTD Thur, 24 January 2013 15:00:00 +0200 - -openqrm (5.0.1-debian1) squeeze; urgency=low - - [ Matthias Rechenburg ] - * New minor release 5.0.1 - - -- OPENQRM AUSTRALIA PTY LTD Sat, 31 May 2012 15:00:00 +0200 - -openqrm (5.0-debian1) squeeze; urgency=low - - [ Matthias Rechenburg ] - * New stable release 5.0 - - -- OPENQRM AUSTRALIA PTY LTD Sat, 31 May 2012 15:00:00 +0200 - -openqrm (4.9-debian1) lenny; urgency=low - - [ Matthias Rechenburg ] - * New stable release 4.9 - - -- Matthias Rechenburg Sat, 31 Oct 2011 15:00:00 +0200 - -openqrm (4.8-debian1) lenny; urgency=low - - [ Matthias Rechenburg ] - * New stable release 4.8 - - -- Matthias Rechenburg Sat, 31 Mar 2011 15:00:00 +0200 - -openqrm (4.7-debian1) lenny; urgency=low - - [ Matthias Rechenburg ] - * New stable release 4.7 - - -- Matthias Rechenburg Sat, 30 Oct 2010 16:43:35 +0200 - -openqrm (4.6-debian1) lenny; urgency=low - - [ Matthias Rechenburg ] - * Initial release - - -- Matthias Rechenburg Sat, 05 Sep 2009 21:14:45 +0200 - diff --git a/openQRM-5.3.50-CE/src/debian/changelog.ubuntu b/openQRM-5.3.50-CE/src/debian/changelog.ubuntu deleted file mode 100644 index 9ea38a4..0000000 --- a/openQRM-5.3.50-CE/src/debian/changelog.ubuntu +++ /dev/null @@ -1,215 +0,0 @@ -openqrm (5.3.2-ubuntu1) xenial; urgency=low - - [ Matthias Rechenburg ] - * New Community release 5.3.2 - * Enhanced package dependencies for latest Ubuntu, Debian and CentOS - * removed rpmforge repository dependencies - - -- OPENQRM AUSTRALIA PTY LTD Wed, 18 January 2017 15:00:00 +0200 - -openqrm (5.3.1-ubuntu1) xenial; urgency=low - - [ Matthias Rechenburg ] - * New Community release 5.3 - * Important security update - * Many bugfixes and lots of enhancements especially for KVM and Cloud plugin - - -- OPENQRM AUSTRALIA PTY LTD Wed, 18 October 2016 15:00:00 +0200 - -openqrm (5.2.15-ubuntu1) xenial; urgency=low - - [ Matthias Rechenburg ] - * New Amazon features in 5.2.15 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 9 June 2016 15:00:00 +0200 - -openqrm (5.2.14-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New Amazon plugin in 5.2.14 - - -- OPENQRM AUSTRALIA PTY LTD Mon, 18 April 2016 15:00:00 +0200 - -openqrm (5.2.13-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * VMware vSphere integration 5.2.13 - - -- OPENQRM AUSTRALIA PTY LTD Mon, 25 January 2016 15:00:00 +0200 - -openqrm (5.2.12-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New VMware vSphere integration 5.2.12 beta1 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 05 January 2016 15:00:00 +0200 - -openqrm (5.2.11-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New VMware vSphere integration 5.2.11 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 29 December 2015 15:00:00 +0200 - -openqrm (5.2.10-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.10 - - -- OPENQRM AUSTRALIA PTY LTD Thu, 30 August 2015 15:00:00 +0200 - -openqrm (5.2.9-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.9 - - -- OPENQRM AUSTRALIA PTY LTD Thu, 16 July 2015 15:00:00 +0200 - -openqrm (5.2.8-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.8 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 6 July 2015 15:00:00 +0200 - -openqrm (5.2.7-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.7 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 25 June 2015 15:00:00 +0200 - -openqrm (5.2.6-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.6 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 22 June 2015 15:00:00 +0200 - -openqrm (5.2.5-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.5 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 19 June 2015 15:00:00 +0200 - -openqrm (5.2.4-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.4 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 12 June 2015 15:00:00 +0200 - -openqrm (5.2.3-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.3 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 18 May 2015 15:00:00 +0200 - -openqrm (5.2.1-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.2.1 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 31 January 2015 15:00:00 +0200 - -openqrm (5.1.4-ubuntu1) trusty; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.4 - - -- OPENQRM AUSTRALIA PTY LTD Tue, 22 July 2014 15:00:00 +0200 - -openqrm (5.1.3-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.3 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 30 April 2014 15:00:00 +0200 - -openqrm (5.1.2-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.2 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 12 March 2014 15:00:00 +0200 - -openqrm (5.1.1-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New hardened release 5.1.1 - - -- OPENQRM AUSTRALIA PTY LTD Fr, 6 December 2013 15:00:00 +0200 - -openqrm (5.1.0-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New stable release 5.1.0 - - -- OPENQRM AUSTRALIA PTY LTD Sat, 31 August 2013 15:00:00 +0200 - -openqrm (5.1-beta.0-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New beta release 5.1-beta.0 - - -- OPENQRM AUSTRALIA PTY LTD Wed, 31 July 2013 15:00:00 +0200 - -openqrm (5.0.3-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New minor release 5.0.3 - * fixed nasty bug preventing dhcpd/dns to start on Ubuntu - - -- OPENQRM AUSTRALIA PTY LTD Thur, 7 March 2013 15:00:00 +0200 - -openqrm (5.0.2-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New minor release 5.0.2 - - -- OPENQRM AUSTRALIA PTY LTD Thur, 24 January 2013 15:00:00 +0200 - -openqrm (5.0.1-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New minor release 5.0.1 - - -- OPENQRM AUSTRALIA PTY LTD Sat, 31 May 2012 15:00:00 +0200 - -openqrm (5.0-ubuntu1) precise; urgency=low - - [ Matthias Rechenburg ] - * New stable release 5.0 - - -- OPENQRM AUSTRALIA PTY LTD Sat, 31 May 2012 15:00:00 +0200 - -openqrm (4.9-ubuntu1) lucid; urgency=low - - [ Matthias Rechenburg ] - * New stable release 4.9 - - -- Matthias Rechenburg Sat, 31 Oct 2011 15:00:00 +0200 - -openqrm (4.8-ubuntu1) maverick; urgency=low - - [ Matthias Rechenburg ] - * New stable release 4.8 - - -- Matthias Rechenburg Sat, 31 Mar 2011 15:00:00 +0200 - -openqrm (4.7-ubuntu1) maverick; urgency=low - - [ Matthias Rechenburg ] - * New stable release 4.7 - - -- Matthias Rechenburg Sat, 30 Oct 2010 16:43:35 +0200 - -openqrm (4.6-ubuntu1) karmic; urgency=low - - [ Matthias Rechenburg ] - * Initial release - - -- Matthias Rechenburg Sat, 05 Sep 2009 21:14:45 +0200 - diff --git a/openQRM-5.3.50-CE/src/debian/compat b/openQRM-5.3.50-CE/src/debian/compat deleted file mode 100644 index 1e8b314..0000000 --- a/openQRM-5.3.50-CE/src/debian/compat +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/openQRM-5.3.50-CE/src/debian/control b/openQRM-5.3.50-CE/src/debian/control deleted file mode 100644 index d2fb751..0000000 --- a/openQRM-5.3.50-CE/src/debian/control +++ /dev/null @@ -1,16 +0,0 @@ -Source: OPENQRM_PACKAGE_NAME -Section: admin -Priority: extra -Maintainer: OPENQRM AUSTRALIA PTY LTD -Build-Depends: debhelper, bzip2, sudo, rpcbind, rsync, zlib1g-dev, wget, tar, bzip2, unzip, wget, netbase, patch, udev, lvm2, ethtool -Standards-Version: 3.8.2 -Homepage: http://www.openqrm.org - -Package: OPENQRM_PACKAGE_NAME -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, OPENQRM_PACKAGE_DEPENDENCIES -Conflicts: OPENQRM_PACKAGE_CONFLICTS -Description: Cloud Computing Platform - openQRM is a fully automated, rapid deployment system including - VM-Management, Monitoring, High-Availability and Storage-Management. - It provides a plug-able open-source Cloud Computing platform. diff --git a/openQRM-5.3.50-CE/src/debian/copyright b/openQRM-5.3.50-CE/src/debian/copyright deleted file mode 100644 index 452d8bd..0000000 --- a/openQRM-5.3.50-CE/src/debian/copyright +++ /dev/null @@ -1,509 +0,0 @@ -Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=143 -Upstream-Name: openQRM -Upstream-Source: http://www.openqrm.org -Upstream Authors: OPENQRM AUSTRALIA PTY LTD - -This package was debianized by OPENQRM AUSTRALIA PTY LTD - -Files: * -Copyright: Copyright 2021, OPENQRM AUSTRALIA PTY LTD -License: GPL-2 -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 - -Files: debian/* -Copyright: Copyright 2011, OPENQRM AUSTRALIA PTY LTD -License: GPL-2 -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 - -Files: thirdparty/openqrm-build/busybox/source/busybox-1.14.2.tar.gz -License: GPL-2 -Copyright: 1999-2005 Erik Andersen -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 - -Files: thirdparty/openqrm-build/pciutils//source/pciutils-3.1.4.tar.gz -License: GPL-2 -Copyright (c) 1997--2009 Martin Mares -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 - -Files: thirdparty/openqrm-build/jquery/source/jquery-1.3.2.tgz -License: GPL-2 / MIT -Copyright: Copyright (c) 2009 John Resig -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 -X-Comment: The MIT license text is included below - -Files: thirdparty/openqrm-build/js-interface/source/interface_1.2.zip -License: GPL2 / MIT -Copyright: Copyright (c) 2006 Stefan Petre -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 -X-Comment: The MIT license text is included below - -Files: thirdparty/openqrm-build/adodb/ -License: GPL2 / MIT -Copyright (c) 2000, 2001, 2002, 2003, 2004 John Lim -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 -X-Comment: The MIT license text is included below - -Files: plugins/cloud/cloud-portal/web/js/datetimepicker.js -Copyright: Copyright (c) 2003 TengYong Ng -X-Comment: License text from the file header: - "Permission given to use and modify this script in ANY kind of - applications if header lines are left unchanged." - -Files: plugins/nagios3/bin/nmap2nagios-ng.pl -License: Perl/Artistic -Copyright: Copyright (c) 2001-2002 Todd A. Green - Copyright (c) 2008 Michel Sigloch -X-Comment: On Debian GNU/Linux systems, the complete text of the - Artistic License can be found in /usr/share/common-licenses/Artistic - - - -Additional license texts : - - -XFree86 License (version 1.1) - -The text of the XFree86 1.1 license is included below. A FAQ for this licence -can be found at the XFree86 web site - -Copyright (C) 1994-2006 The XFree86 Project, Inc. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in the -Software without restriction, including without limitation the rights to use, copy, -modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, -and to permit persons to whom the Software is furnished to do so, subject to the -following conditions: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions, and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution, and in the same place and form as other - copyright, license and disclaimer information. - -3. The end-user documentation included with the redistribution, if any, must include - the following acknowledgment: "This product includes software developed by The - XFree86 Project, Inc (http://www.xfree86.org/) and its contributors", in the same - place and form as other third-party acknowledgments. Alternately, this acknowledgment - may appear in the software itself, in the same form and location as other such - third-party acknowledgments. - -4. Except as contained in this notice, the name of The XFree86 Project, Inc shall - not be used in advertising or otherwise to promote the sale, use or other dealings - in this Software without prior written authorization from The XFree86 Project, Inc. - -THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -The MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -The Perl License - -For those of you that choose to use the GNU General Public License, my -interpretation of the GNU General Public License is that no Perl script -falls under the terms of the GPL unless you explicitly put said script -under the terms of the GPL yourself. - -Furthermore, any object code linked with perl does not automatically fall -under the terms of the GPL, provided such object code only adds definitions -of subroutines and variables, and does not otherwise impair the resulting -interpreter from executing any standard Perl script. I consider linking in -C subroutines in this manner to be the moral equivalent of defining subroutines -in the Perl language itself. You may sell such an object file as proprietary -provided that you provide or offer to provide the Perl source, as specified by -the GNU General Public License. (This is merely an alternate way of specifying -input to the program.) You may also sell a binary produced by the dumping of a -running Perl script that belongs to you, provided that you provide or offer to -provide the Perl source as specified by the GPL. (The fact that a Perl -interpreter and your code are in the same binary file is, in this case, a form -of mere aggregation.) - -This is my interpretation of the GPL. If you still have concerns or difficulties -understanding my intent, feel free to contact me. Of course, the Artistic License -spells all this out for your protection, so you may prefer to use that. --- Larry Wall - - - -GPL2 - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - diff --git a/openQRM-5.3.50-CE/src/debian/copyright.enterprise b/openQRM-5.3.50-CE/src/debian/copyright.enterprise deleted file mode 100644 index d46d57f..0000000 --- a/openQRM-5.3.50-CE/src/debian/copyright.enterprise +++ /dev/null @@ -1,508 +0,0 @@ -Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=143 -Upstream-Name: openQRM -Upstream-Source: http://www.openqrm.org -Upstream Authors: OPENQRM AUSTRALIA PTY LTD - -This package was debianized by OPENQRM AUSTRALIA PTY LTD - -Files: * -Copyright: Copyright 2021, OPENQRM AUSTRALIA PTY LTD -License: GNU General Public License version 2 -X-Comment: The latest version of this license can be found at: src/doc/LICENSE.txt - -Files: debian/* -Copyright: Copyright 2011, OPENQRM AUSTRALIA PTY LTD -License: GPL-2 -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 - -Files: thirdparty/openqrm-build/busybox/source/busybox-1.14.2.tar.gz -License: GPL-2 -Copyright: 1999-2005 Erik Andersen -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 - -Files: thirdparty/openqrm-build/pciutils//source/pciutils-3.1.4.tar.gz -License: GPL-2 -Copyright (c) 1997--2009 Martin Mares -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 - -Files: thirdparty/openqrm-build/jquery/source/jquery-1.3.2.tgz -License: GPL-2 / MIT -Copyright: Copyright (c) 2009 John Resig -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 -X-Comment: The MIT license text is included below - -Files: thirdparty/openqrm-build/js-interface/source/interface_1.2.zip -License: GPL2 / MIT -Copyright: Copyright (c) 2006 Stefan Petre -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 -X-Comment: The MIT license text is included below - -Files: thirdparty/openqrm-build/adodb/ -License: GPL2 / MIT -Copyright (c) 2000, 2001, 2002, 2003, 2004 John Lim -X-Comment: On Debian GNU/Linux systems, the complete text of the - GNU General Public License can be found in /usr/share/common-licenses/GPL-2 -X-Comment: The MIT license text is included below - -Files: plugins/cloud/cloud-portal/web/js/datetimepicker.js -Copyright: Copyright (c) 2003 TengYong Ng -X-Comment: License text from the file header: - "Permission given to use and modify this script in ANY kind of - applications if header lines are left unchanged." - -Files: plugins/nagios3/bin/nmap2nagios-ng.pl -License: Perl/Artistic -Copyright: Copyright (c) 2001-2002 Todd A. Green - Copyright (c) 2008 Michel Sigloch -X-Comment: On Debian GNU/Linux systems, the complete text of the - Artistic License can be found in /usr/share/common-licenses/Artistic - - - -Additional license texts : - - -XFree86 License (version 1.1) - -The text of the XFree86 1.1 license is included below. A FAQ for this licence -can be found at the XFree86 web site - -Copyright (C) 1994-2006 The XFree86 Project, Inc. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in the -Software without restriction, including without limitation the rights to use, copy, -modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, -and to permit persons to whom the Software is furnished to do so, subject to the -following conditions: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions, and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution, and in the same place and form as other - copyright, license and disclaimer information. - -3. The end-user documentation included with the redistribution, if any, must include - the following acknowledgment: "This product includes software developed by The - XFree86 Project, Inc (http://www.xfree86.org/) and its contributors", in the same - place and form as other third-party acknowledgments. Alternately, this acknowledgment - may appear in the software itself, in the same form and location as other such - third-party acknowledgments. - -4. Except as contained in this notice, the name of The XFree86 Project, Inc shall - not be used in advertising or otherwise to promote the sale, use or other dealings - in this Software without prior written authorization from The XFree86 Project, Inc. - -THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -The MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -The Perl License - -For those of you that choose to use the GNU General Public License, my -interpretation of the GNU General Public License is that no Perl script -falls under the terms of the GPL unless you explicitly put said script -under the terms of the GPL yourself. - -Furthermore, any object code linked with perl does not automatically fall -under the terms of the GPL, provided such object code only adds definitions -of subroutines and variables, and does not otherwise impair the resulting -interpreter from executing any standard Perl script. I consider linking in -C subroutines in this manner to be the moral equivalent of defining subroutines -in the Perl language itself. You may sell such an object file as proprietary -provided that you provide or offer to provide the Perl source, as specified by -the GNU General Public License. (This is merely an alternate way of specifying -input to the program.) You may also sell a binary produced by the dumping of a -running Perl script that belongs to you, provided that you provide or offer to -provide the Perl source as specified by the GPL. (The fact that a Perl -interpreter and your code are in the same binary file is, in this case, a form -of mere aggregation.) - -This is my interpretation of the GPL. If you still have concerns or difficulties -understanding my intent, feel free to contact me. Of course, the Artistic License -spells all this out for your protection, so you may prefer to use that. --- Larry Wall - - - -GPL2 - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - diff --git a/openQRM-5.3.50-CE/src/debian/man/openqrm-cmd-queue.1 b/openQRM-5.3.50-CE/src/debian/man/openqrm-cmd-queue.1 deleted file mode 100644 index 89e8891..0000000 --- a/openQRM-5.3.50-CE/src/debian/man/openqrm-cmd-queue.1 +++ /dev/null @@ -1,20 +0,0 @@ -.TH OPENQRM-CMD-QUEUE 1 - -.SH NAME openqrm-cmd-queue \- The openQRM command queue - -.SH SYNOPSIS openqrm-cmd-queue - -.SH DESCRIPTION \fIopenqrm-cmd-queue\fP provides a queue for executing commands - -.PP It was written for http://www.openqrm.org - -.SH COPYRIGHT Copyright 2021, OPENQRM AUSTRALIA PTY LTD - -openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -The latest version of this license can be found here: src/doc/LICENSE.txt -By using this software, you acknowledge having read this license and agree to be bound thereby. - -.SH AUTHORS OPENQRM AUSTRALIA PTY LTD -E-mail : diff --git a/openQRM-5.3.50-CE/src/debian/man/openqrm-cmd.1 b/openQRM-5.3.50-CE/src/debian/man/openqrm-cmd.1 deleted file mode 100644 index 19f9ce7..0000000 --- a/openQRM-5.3.50-CE/src/debian/man/openqrm-cmd.1 +++ /dev/null @@ -1,20 +0,0 @@ -.TH OPENQRM-CMD 1 - -.SH NAME openqrm-cmd \- The openQRM command util - -.SH SYNOPSIS openqrm-cmd - -.SH DESCRIPTION \fIopenqrm-cmd\fP runs commands from the openQRM command queue. - -.PP It was written for http://www.openqrm.org - -.SH COPYRIGHT Copyright 2021, OPENQRM AUSTRALIA PTY LTD - -openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -The latest version of this license can be found here: src/doc/LICENSE.txt -By using this software, you acknowledge having read this license and agree to be bound thereby. - -.SH AUTHORS OPENQRM AUSTRALIA PTY LTD -E-mail : diff --git a/openQRM-5.3.50-CE/src/debian/man/openqrm-create-plugin.1 b/openQRM-5.3.50-CE/src/debian/man/openqrm-create-plugin.1 deleted file mode 100644 index 997c7f6..0000000 --- a/openQRM-5.3.50-CE/src/debian/man/openqrm-create-plugin.1 +++ /dev/null @@ -1,21 +0,0 @@ -.TH OPENQRM-CREATE-PLUGIN 1 - -.SH NAME openqrm-create-plugin \- The openQRM plugin utility - -.SH SYNOPSIS openqrm-create-plugin - -.SH DESCRIPTION \fIopenqrm-create-plugin\fP provides a initial skeleton for -based on an existing plugin.. - -.PP It was written for http://www.openqrm.org - -.SH COPYRIGHT Copyright 2021, OPENQRM AUSTRALIA PTY LTD - -openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -The latest version of this license can be found here: src/doc/LICENSE.txt -By using this software, you acknowledge having read this license and agree to be bound thereby. - -.SH AUTHORS OPENQRM AUSTRALIA PTY LTD -E-mail : diff --git a/openQRM-5.3.50-CE/src/debian/man/openqrm-crypt.1 b/openQRM-5.3.50-CE/src/debian/man/openqrm-crypt.1 deleted file mode 100644 index 6ad3949..0000000 --- a/openQRM-5.3.50-CE/src/debian/man/openqrm-crypt.1 +++ /dev/null @@ -1,21 +0,0 @@ -.TH OPENQRM-CRYPT 1 - -.SH NAME openqrm-crypt \- The openQRM password utility - -.SH SYNOPSIS openqrm-crypt - -.SH DESCRIPTION \fIopenqrm-crypt\fP generates passwords for systems managed -by openQRM. - -.PP It was written for http://www.openqrm.org - -.SH COPYRIGHT Copyright 2021, OPENQRM AUSTRALIA PTY LTD - -openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -The latest version of this license can be found here: src/doc/LICENSE.txt -By using this software, you acknowledge having read this license and agree to be bound thereby. - -.SH AUTHORS OPENQRM AUSTRALIA PTY LTD -E-mail : diff --git a/openQRM-5.3.50-CE/src/debian/man/openqrm-exec.1 b/openQRM-5.3.50-CE/src/debian/man/openqrm-exec.1 deleted file mode 100644 index c7df9db..0000000 --- a/openQRM-5.3.50-CE/src/debian/man/openqrm-exec.1 +++ /dev/null @@ -1,22 +0,0 @@ -.TH OPENQRM-EXEC 1 - -.SH NAME openqrm-exec \- The openQRM exec utility - -.SH SYNOPSIS openqrm-exec [\-option ...] - - openqrm-exec -i -t -c - -.SH DESCRIPTION \fIopenqrm-exec\fP puts commands into the openQRM command queue. - -.PP It was written for http://www.openqrm.org - -.SH COPYRIGHT Copyright 2021, OPENQRM AUSTRALIA PTY LTD - -openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -The latest version of this license can be found here: src/doc/LICENSE.txt -By using this software, you acknowledge having read this license and agree to be bound thereby. - -.SH AUTHORS OPENQRM AUSTRALIA PTY LTD -E-mail : diff --git a/openQRM-5.3.50-CE/src/debian/man/openqrm-execd.1 b/openQRM-5.3.50-CE/src/debian/man/openqrm-execd.1 deleted file mode 100644 index 13efedc..0000000 --- a/openQRM-5.3.50-CE/src/debian/man/openqrm-execd.1 +++ /dev/null @@ -1,20 +0,0 @@ -.TH OPENQRM-EXECD 1 - -.SH NAME openqrm-execd \- The openQRM execution daemon - -.SH SYNOPSIS openqrm-execd - -.SH DESCRIPTION \fIopenqrm-execd\fP is the openQRM remove execution daemon. - -.PP It was written for http://www.openqrm.org - -.SH COPYRIGHT Copyright 2021, OPENQRM AUSTRALIA PTY LTD - -openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -The latest version of this license can be found here: src/doc/LICENSE.txt -By using this software, you acknowledge having read this license and agree to be bound thereby. - -.SH AUTHORS OPENQRM AUSTRALIA PTY LTD -E-mail : diff --git a/openQRM-5.3.50-CE/src/debian/man/openqrm-monitord.1 b/openQRM-5.3.50-CE/src/debian/man/openqrm-monitord.1 deleted file mode 100644 index 5e5d6eb..0000000 --- a/openQRM-5.3.50-CE/src/debian/man/openqrm-monitord.1 +++ /dev/null @@ -1,22 +0,0 @@ -.TH OPENQRM-MONITORD 1 - -.SH NAME openqrm-monitord \- The openQRM monitoring daemon - -.SH SYNOPSIS openqrm-monitord - -.SH DESCRIPTION \fIopenqrm-monitord\fP monitors all systems managed -by openQRM. - -.PP It was written for http://www.openqrm.org - -.SH COPYRIGHT Copyright 2021, OPENQRM AUSTRALIA PTY LTD - -openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -The latest version of this license can be found here: src/doc/LICENSE.txt -By using this software, you acknowledge having read this license and agree to be bound thereby. - -.SH AUTHORS OPENQRM AUSTRALIA PTY LTD -E-mail : - diff --git a/openQRM-5.3.50-CE/src/debian/man/openqrm-postencode.1 b/openQRM-5.3.50-CE/src/debian/man/openqrm-postencode.1 deleted file mode 100644 index 6613e8e..0000000 --- a/openQRM-5.3.50-CE/src/debian/man/openqrm-postencode.1 +++ /dev/null @@ -1,22 +0,0 @@ -.TH OPENQRM-POSTENCODE 1 - -.SH NAME openqrm-postencode \- The openQRM postencode utility - -.SH SYNOPSIS openqrm-postencode - -.SH DESCRIPTION \fIopenqrm-postencode\fP postencodes files for transmiting -them to the openQRM server via http post. - -.PP It was written for http://www.openqrm.org - -.SH COPYRIGHT Copyright 2021, OPENQRM AUSTRALIA PTY LTD - -openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -The latest version of this license can be found here: src/doc/LICENSE.txt -By using this software, you acknowledge having read this license and agree to be bound thereby. - -.SH AUTHORS OPENQRM AUSTRALIA PTY LTD -E-mail : - diff --git a/openQRM-5.3.50-CE/src/debian/man/openqrm.1 b/openQRM-5.3.50-CE/src/debian/man/openqrm.1 deleted file mode 100644 index ba3f900..0000000 --- a/openQRM-5.3.50-CE/src/debian/man/openqrm.1 +++ /dev/null @@ -1,33 +0,0 @@ -.TH OPENQRM 1 - -.SH NAME openqrm \- The openQRM commandline utility - -.SH SYNOPSIS openqrm [\-option ...] - - openqrm kernel add -n -v -u -p [-l -i -t ] - - openqrm kernel remove -n -u -p - - openqrm state backup -n - - openqrm state restore -n - - openqrm state remove -n - - openqrm state list - -.SH DESCRIPTION \fIopenqrm\fP is the openQRM commandline util. -It manages kernels and the openQRM state. - -.PP It was written for http://www.openqrm.org - -.SH COPYRIGHT Copyright 2021, OPENQRM AUSTRALIA PTY LTD - -openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -The latest version of this license can be found here: src/doc/LICENSE.txt -By using this software, you acknowledge having read this license and agree to be bound thereby. - -.SH AUTHORS OPENQRM AUSTRALIA PTY LTD -E-mail : diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.default b/openQRM-5.3.50-CE/src/debian/openqrm.default deleted file mode 100644 index 4d25f52..0000000 --- a/openQRM-5.3.50-CE/src/debian/openqrm.default +++ /dev/null @@ -1,20 +0,0 @@ -# defaults file for openQRM -# -# This file is part of openQRM. -# -# openQRM is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 -# as published by the Free Software Foundation. -# -# openQRM is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with openQRM. If not, see . -# -# Copyright 2011, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR="/usr/share" - diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.dirs b/openQRM-5.3.50-CE/src/debian/openqrm.dirs deleted file mode 100644 index bff22c0..0000000 --- a/openQRM-5.3.50-CE/src/debian/openqrm.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/share/openqrm diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.docs b/openQRM-5.3.50-CE/src/debian/openqrm.docs deleted file mode 100644 index afe6da2..0000000 --- a/openQRM-5.3.50-CE/src/debian/openqrm.docs +++ /dev/null @@ -1 +0,0 @@ -doc/README diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.files b/openQRM-5.3.50-CE/src/debian/openqrm.files deleted file mode 100644 index e69de29..0000000 diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.init b/openQRM-5.3.50-CE/src/debian/openqrm.init deleted file mode 100644 index 4b9ae71..0000000 --- a/openQRM-5.3.50-CE/src/debian/openqrm.init +++ /dev/null @@ -1,277 +0,0 @@ -#!/bin/sh -# -# openQRM init.d script -# -# This file is part of openQRM. -# -# openQRM is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 -# as published by the Free Software Foundation. -# -# openQRM is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with openQRM. If not, see . -# -# Copyright 2011, OPENQRM AUSTRALIA PTY LTD -# -### BEGIN INIT INFO -# Provides: openqrm -# Required-Start: $local_fs $network $remote_fs -# Required-Stop: $local_fs $network $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Cloud Computing Platform -# Description: openQRM is a fully automated, rapid deployment system -# including VM-Management, Monitoring, High-Availability -# and Storage-Management. It provides a plug-able open-source -# Cloud Computing platform. -### END INIT INFO - -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - -NAME="openqrm" -DESC="openQRM Cloud Computing Platform" -LOGDIR=/var/log/$NAME - -. /lib/lsb/init-functions -DAEMON_OPTS="" -DIETIME=20 -LOGFILE=$LOGDIR/$NAME.log -LOCKDIR=/var/lock/subsys/ -LOCKFILE=$LOCKDIR/$NAME -LANG=C - -# unset http_proxy environment -unset http_proxy -unset https_proxy - -if [ ! -d "$LOCKDIR" ]; then - mkdir -p $LOCKDIR -fi -if [ -f /etc/default/$NAME ] ; then - . /etc/default/$NAME -else - OPENQRM_SERVER_BASE_DIR="/usr/share" -fi -export OPENQRM_SERVER_BASE_DIR -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -export OPENQRM_WEBSERVER_DOCUMENT_ROOT - -set -e - -stop_exec_subsystem() { - if ps ax | grep dropbear | grep -v grep | grep openqrm 1>/dev/null; then - if ! kill `ps ax | grep dropbear | grep -v grep | grep openqrm | awk {' print $1 '}` 2>/dev/null; then - return 1 - fi - fi - if ps ax | grep openqrm-cmd-queue | grep -v grep 1>/dev/null; then - if ! kill `ps ax | grep openqrm-cmd-queue | grep -v grep | awk {' print $1 '}` 2>/dev/null; then - return 1 - fi - fi - if ps ax | grep openqrm-monitord | grep -v grep 1>/dev/null; then - if ! kill `ps ax | grep openqrm-monitord | grep -v grep | awk {' print $1 '}` 2>/dev/null; then - return 1 - fi - fi - return 0 -} - -stop_exec_subsystem_force() { - kill `ps ax | grep dropbear | grep -v grep | grep openqrm | awk {' print $1 '}` 2>/dev/null || true - kill `ps ax | grep openqrm-cmd-queue | grep -v grep | awk {' print $1 '}` 2>/dev/null || true - kill `ps ax | grep openqrm-monitord | grep -v grep | awk {' print $1 '}` 2>/dev/null || true - return 0 -} - -running() { - [ ! -f "$LOCKFILE" ] && return 1 - return 0 -} - -start_server() { - if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" - else - RUNSCREEN=`which screen` - fi - stop_exec_subsystem_force - if ! dropbear -p $OPENQRM_EXEC_PORT -r $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/dropbear_rsa_host_key; then - log_failure_msg "Could not start openQRM exec-subsystem!" - stop_exec_subsystem_force - return 1 - fi - $RUNSCREEN -dmS cmdqueue $OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-cmd-queue - touch ${LOCKFILE} - - if [ -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/unconfigured ]; then - log_success_msg "Please configure your openQRM Server at : $OPENQRM_WEB_PROTOCOL://[server-ip-address]/openqrm/" - log_success_msg "-> User : openqrm" - log_success_msg "-> Password : openqrm" - sleep 2 - return 0 - else - if ! ifconfig "$OPENQRM_SERVER_INTERFACE" | grep inet 1>/dev/null 2>&1; then - log_failure_msg "Interface $OPENQRM_SERVER_INTERFACE is down. Please configure and activate it. Then try again." - stop_exec_subsystem_force - rm -f ${LOCKFILE} - return 1 - fi - CONFIGURED_IP=`cat $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/default | grep "openqrm=" | sed -e "s/.*openqrm=//" | awk {' print $1 '}` - OPENQRM_SERVER_IP_ADDRESS=`ip a s $OPENQRM_SERVER_INTERFACE | grep -w $OPENQRM_SERVER_INTERFACE$ | grep -w inet | awk '{ print $2 }' | cut -d'/' -f1` - if [ "$OPENQRM_SERVER_IP_ADDRESS" != "$CONFIGURED_IP" ]; then - ip a s | grep ^[0-9] | cut -d':' -f2 | awk '{ print $1 }' | grep -v lo > $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/unconfigured - log_failure_msg "Interface $OPENQRM_SERVER_INTERFACE has the wrong ip-configuration" - stop_exec_subsystem_force - rm -f ${LOCKFILE} - return 1 - fi - $RUNSCREEN -dmS monitord $OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-monitord - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.running ]; then - if [ -x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN stop 1>/dev/null 2>/dev/null - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.openqrm_stopped - fi - fi - if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.openqrm_stopped ]; then - if [ -x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN start - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.openqrm_stopped - fi - fi - done - return 0 - fi -} - - -stop_server() { - if [ -d $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/ ]; then - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.running ]; then - if [ -x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN stop - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.openqrm_stopped - fi - fi - done - fi - stop_exec_subsystem - errcode=$? - /bin/rm -f ${LOCKFILE} - return $errcode -} - - - -force_stop() { - if [ -d $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/ ]; then - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.running ]; then - if [ -x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN stop - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.openqrm_stopped - fi - fi - done - fi - stop_exec_subsystem_force - errcode=$? - /bin/rm -f ${LOCKFILE} - return $errcode -} - - -case "$1" in - start) - log_daemon_msg "Starting $DESC " "$NAME" - # Check if it's running first - if running ; then - log_progress_msg "apparently already running" - log_end_msg 0 - exit 0 - fi - if start_server ; then - # NOTE: Some servers might die some time after they start, - # this code will detect this issue if STARTTIME is set - # to a reasonable value - [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time - if running ; then - # It's ok, the server started and is running - log_end_msg 0 - else - # It is not running after we did start - log_end_msg 1 - fi - else - # Either we could not start it - log_end_msg 1 - fi - ;; - stop) - log_daemon_msg "Stopping $DESC" "$NAME" - if running ; then - # Only stop the server if we see it running - errcode=0 - stop_server || errcode=$? - log_end_msg $errcode - else - # If it's not running don't do anything - log_progress_msg "apparently not running" - log_end_msg 0 - exit 0 - fi - ;; - force-stop) - # First try to stop gracefully the program - $0 stop - if running; then - # If it's still running try to kill it more forcefully - log_daemon_msg "Stopping (force) $DESC" "$NAME" - errcode=0 - force_stop || errcode=$? - log_end_msg $errcode - fi - ;; - restart|force-reload) - log_daemon_msg "Restarting $DESC" "$NAME" - errcode=0 - stop_server || errcode=$? - # Wait some sensible amount, some server need this - [ -n "$DIETIME" ] && sleep $DIETIME - start_server || errcode=$? - [ -n "$STARTTIME" ] && sleep $STARTTIME - running || errcode=$? - log_end_msg $errcode - ;; - status) - - log_daemon_msg "Checking status of $DESC" "$NAME" - if running ; then - log_progress_msg "running" - log_end_msg 0 - else - log_progress_msg "apparently not running" - log_end_msg 1 - exit 1 - fi - ;; - reload) - log_warning_msg "Reloading $NAME daemon: not implemented, as openQRM" - log_warning_msg "immediately re-reads changes in its configuration files." - ;; - - *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.install b/openQRM-5.3.50-CE/src/debian/openqrm.install deleted file mode 100644 index bff22c0..0000000 --- a/openQRM-5.3.50-CE/src/debian/openqrm.install +++ /dev/null @@ -1 +0,0 @@ -usr/share/openqrm diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.links b/openQRM-5.3.50-CE/src/debian/openqrm.links deleted file mode 100644 index e69de29..0000000 diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.lintian-overrides b/openQRM-5.3.50-CE/src/debian/openqrm.lintian-overrides deleted file mode 100644 index e69de29..0000000 diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.manpages b/openQRM-5.3.50-CE/src/debian/openqrm.manpages deleted file mode 100644 index f0ca1a7..0000000 --- a/openQRM-5.3.50-CE/src/debian/openqrm.manpages +++ /dev/null @@ -1,9 +0,0 @@ -debian/man/openqrm-cmd-queue.1 -debian/man/openqrm-cmd.1 -debian/man/openqrm-create-plugin.1 -debian/man/openqrm-crypt.1 -debian/man/openqrm-exec.1 -debian/man/openqrm-execd.1 -debian/man/openqrm-monitord.1 -debian/man/openqrm-postencode.1 -debian/man/openqrm.1 diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.postinst b/openQRM-5.3.50-CE/src/debian/openqrm.postinst deleted file mode 100644 index 69c3119..0000000 --- a/openQRM-5.3.50-CE/src/debian/openqrm.postinst +++ /dev/null @@ -1,254 +0,0 @@ -#!/bin/bash -# openQRM postinstall script - needs bash to source openqrm-functions -# -# This file is part of openQRM. -# -# openQRM is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 -# as published by the Free Software Foundation. -# -# openQRM is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with openQRM. If not, see . -# -# Copyright 2011, OPENQRM AUSTRALIA PTY LTD - -NAME="openqrm" -DESC="openQRM Cloud Computing Platform" -LOGDIR=/var/log/$NAME -LANG=C -. /lib/lsb/init-functions - -if [ -f /etc/default/$NAME ] ; then - . /etc/default/$NAME -else - OPENQRM_SERVER_BASE_DIR="/usr/share" -fi -export OPENQRM_SERVER_BASE_DIR -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - -set -e - - -# a function to validate an ip address -openqrm_validate_ip() { - IP_A=$1 - OLDIFS=$IFS - IFS=. - set -- $IP_A - if [ "$#" -ne "4" ]; then - return 1 - fi - - for oct in $1 $2 $3 $4; do - echo $oct | egrep "^[0-9]+$" >/dev/null 2>&1 - if [ "$?" -ne "0" ]; then - return 1 - else - if [ "$oct" -lt "0" -o "$oct" -gt "255" ]; then - return 1 - fi - fi - done - echo "$IP_A" | grep "\.$" >/dev/null 2>&1 - if [ "$?" -eq "0" ]; then - return 1 - fi - IFS=$OLDIFS - return 0 -} - - -case "$1" in - configure) - - # is this an update ? - if [ -f "$OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/etc/openqrm-server.conf" ]; then - if [ -x "$OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm-update" ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm-update base -f - $OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm-update post -f - $OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm-update initrds -f - fi - else - # it is a fresh install - # make sure apache is up + running - if ! ps ax | grep apache2 | grep -v grep 1>/dev/null; then - openqrm_webserver start - fi - - # link the web application directory to the documentroot - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/web/ $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm - - # the default apache config normally does not allow to override the authconfig (needed for basic auth) - # so we allow it for the openqrm directory - APACHE_CUSTOM_CONFIG_DIR="/etc/apache2/conf.d" - # support for Ubuntu 14.04 - new apache enabled-conf dir - if [ -d /etc/apache2/conf-enabled ]; then - APACHE_CUSTOM_CONFIG_DIR="/etc/apache2/conf-enabled" - # preserve backwards compatibility for other projects e.g. linuxcoe - ln -sf /etc/apache2/conf-enabled /etc/apache2/conf.d - cat $OPENQRM_SERVER_BASE_DIR/openqrm/etc/httpd/openqrm-httpd-vhost.conf | \ - sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | \ - sed -e "s#@@OPENQRM_WEBSERVER_DOCUMENT_ROOT@@#$OPENQRM_WEBSERVER_DOCUMENT_ROOT#g" \ - > $APACHE_CUSTOM_CONFIG_DIR/openqrm-httpd.conf - else - cat $OPENQRM_SERVER_BASE_DIR/openqrm/etc/httpd/openqrm-httpd.conf | sed -e "s#OPENQRM_WEBSERVER_DOCUMENT_ROOT#$OPENQRM_WEBSERVER_DOCUMENT_ROOT#g" >> $APACHE_CUSTOM_CONFIG_DIR/openqrm-httpd.conf - fi - echo ".$APACHE_CUSTOM_CONFIG_DIR/openqrm-httpd.conf" - # care about php disable_functions in php.ini - if [ -f /etc/php5/apache2/php.ini ]; then - sed -i -e "s/^disable_functions/;disable_functions/g" /etc/php5/apache2/php.ini - fi - - # ssl ? - if [ "$OPENQRM_WEB_PROTOCOL" = "https" ]; then - echo "Setting up SSL secured openQRM Website" - # apache ssl setup - if ! a2enmod ssl; then - echo "ERROR: Could not enable SSL in the Apache webserver ! Exiting." - exit 1 - fi - # check for hostname settings - ETCHOSTS=/etc/hosts - MYHOSTNAME=`hostname` - if grep $MYHOSTNAME $ETCHOSTS | grep 127.0. 1>/dev/null || ! grep $MYHOSTNAME $ETCHOSTS 1>/dev/null; then - echo "Found system hostname $MYHOSTNAME connected to loopback interface" - echo "! This causes troubles while enabling SSL for the apache webserver !" - -# AVAIL_IPS=`ifconfig -a | grep -v inet6 | grep -B1 inet | grep -i -A1 link | grep -v lo | grep inet | grep -v 127.0.0.1 | cut -d':' -f2 | awk {' print $1 '}` - AVAIL_IPS=`ip -4 addr | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v 127.0.0.1` - - while (true); do - echo "Please select one of the following ip-addresses" - echo "to be connected to the systems hostname $MYHOSTNAME :" - echo "$AVAIL_IPS" - echo -n " : " - read HOSTIP - if openqrm_validate_ip "$HOSTIP"; then - if echo $AVAIL_IPS | grep "$HOSTIP" 1>/dev/null; then - break; - else - echo "$HOSTIP is not available on this system!" - fi - else - echo "$HOSTIP is invalid!" - fi - done - echo "Connecting $HOSTIP to $MYHOSTNAME in $ETCHOSTS" - # remove first - sed -i -e "s/.*$MYHOSTNAME.*//g" $ETCHOSTS - sed -i -e "s/.*openQRM.*//g" $ETCHOSTS - # make sure we did not remove the loopback entry copmletely - if ! grep "127.0.*.localhost" $ETCHOSTS 1>/dev/null; then - echo "127.0.0.1 localhost" >> $ETCHOSTS.new - cat $ETCHOSTS >> $ETCHOSTS.new - mv -f $ETCHOSTS.new $ETCHOSTS - fi - echo "# added by openQRM" >> $ETCHOSTS - echo "$HOSTIP $MYHOSTNAME" >> $ETCHOSTS - - fi - - # creating the cert + key - PRIVATE_KEY=$OPENQRM_SERVER_BASE_DIR/openqrm/etc/ssl/private/openqrm-private.key - CERTIFICATE_FILE=$OPENQRM_SERVER_BASE_DIR/openqrm/etc/ssl/cert/openqrm.crt - VALID_DAYS=3650 - mkdir -p `dirname $PRIVATE_KEY` - mkdir -p `dirname $CERTIFICATE_FILE` - echo "-> Creating new private/public-keys without passphrase for server" - rm -f $PRIVATE_KEY - openssl genrsa -out $PRIVATE_KEY 1024 - echo "-> Creating selfsigned certificate" - rm -f $CERTIFICATE_FILE - openssl req -new -days $VALID_DAYS -key $PRIVATE_KEY -x509 -out $CERTIFICATE_FILE - # openQRM apache ssl config - cat $OPENQRM_SERVER_BASE_DIR/openqrm/etc/httpd/openqrm-https.conf | \ - sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | \ - sed -e "s#@@OPENQRM_WEBSERVER_DOCUMENT_ROOT@@#$OPENQRM_WEBSERVER_DOCUMENT_ROOT#g" \ - > /etc/apache2/conf.d/openqrm-https.conf - fi - - openqrm_webserver reload - - # create the .htaccess file - cat $OPENQRM_SERVER_BASE_DIR/openqrm/etc/httpd/openqrm-htaccess.conf | sed -e "s#OPENQRM_WEBSERVER_DOCUMENT_ROOT#$OPENQRM_WEBSERVER_DOCUMENT_ROOT#g" > $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/.htaccess - - # create the default admin user - htpasswd -bc $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/.htpasswd openqrm openqrm - chmod 666 $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/.htpasswd - - # create the image-auth dir - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/web/action/image-auth - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/web/action/image-auth - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/tmp - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/tmp - - # link the tftpboot/boot dir to the boot-services - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/boot - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/ $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/boot - - # init the remote execution layer - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/var/spool/ - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/var/spool - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/ - dropbearkey -t rsa -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/dropbear_rsa_host_key - - # allow the webserver user to read it - chmod 600 $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/dropbear_rsa_host_key - - # create authorized_keys - PUBLIC_KEY=`dropbearkey -y -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/dropbear_rsa_host_key | grep ssh` - if [ ! -d /root/.ssh ]; then - mkdir -p /root/.ssh - chmod 700 /root/.ssh - fi - if [ ! -f /root/.ssh/authorized_keys ]; then - echo "$PUBLIC_KEY" > /root/.ssh/authorized_keys - chmod 600 /root/.ssh/authorized_keys - else - OPENQRM_HOST=`echo $PUBLIC_KEY | awk {' print $3 '}` - if grep $OPENQRM_HOST /root/.ssh/authorized_keys 1>/dev/null; then - sed -i -e "s#.*$OPENQRM_HOST.*##g" /root/.ssh/authorized_keys - fi - echo "$PUBLIC_KEY" >> /root/.ssh/authorized_keys - chmod 600 /root/.ssh/authorized_keys - fi - # and put it in the boot-service dir for the resources to download - echo "$PUBLIC_KEY" > $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/openqrm-server-public-rsa-key - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/openqrm-server-public-rsa-key $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/openqrm-server-public-rsa-key - # create the command-queue dir - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/var/spool/ $OPENQRM_SERVER_BASE_DIR/openqrm/var/lock/ - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/var/spool $OPENQRM_SERVER_BASE_DIR/openqrm/var/lock/ - - # create unconfigured file containing a list of available network cards to setup openQRM on - ip a s | grep ^[0-9] | cut -d':' -f2 | awk '{ print $1 }' | grep -v lo > $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/unconfigured - - # use the first nic to preconfigure the openqrm-server.conf - FIRST_NIC=`ip a s | grep ^[0-9] | cut -d':' -f2 | awk '{ print $1 }' | grep -v lo | head -n 1` - if [ "$FIRST_NIC" != "" ]; then - sed -i -e "s/OPENQRM_SERVER_INTERFACE=.*/OPENQRM_SERVER_INTERFACE=$FIRST_NIC/g" $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - fi - - fi - - ;; - - abort-upgrade|abort-remove|abort-deconfigure|upgrade) - ;; - - *) - echo "postinst called with argument \`$1'" >&2 - exit 0 - ;; -esac - - -#DEBHELPER# - -exit 0 diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.postrm b/openQRM-5.3.50-CE/src/debian/openqrm.postrm deleted file mode 100644 index fef3ee2..0000000 --- a/openQRM-5.3.50-CE/src/debian/openqrm.postrm +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# postrm script for openqrm -# -# This file is part of openQRM. -# -# openQRM is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 -# as published by the Free Software Foundation. -# -# openQRM is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with openQRM. If not, see . -# -# Copyright 2011, OPENQRM AUSTRALIA PTY LTD -# - -NAME="openqrm" -DESC="openQRM Cloud Computing Platform" -LOGDIR=/var/log/$NAME -LANG=C -. /lib/lsb/init-functions - -if [ -f /etc/default/$NAME ] ; then - . /etc/default/$NAME -else - OPENQRM_SERVER_BASE_DIR="/usr/share" -fi - -set -e - -case "$1" in - remove) - rm -f /etc/init.d/openqrm* - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm - ;; - - purge) - rm -f /etc/init.d/openqrm* - rm -f /etc/default/openqrm - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm - ;; - - - abort-upgrade|failed-upgrade|abort-install|upgrade) - ;; - - *) - echo "postrm called with argument \`$1'" >&2 - exit 0 - ;; -esac - - -#DEBHELPER# - -exit 0 diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.preinst b/openQRM-5.3.50-CE/src/debian/openqrm.preinst deleted file mode 100644 index 12d096f..0000000 --- a/openQRM-5.3.50-CE/src/debian/openqrm.preinst +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# openQRM prerm script -# -# This file is part of openQRM. -# -# openQRM is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 -# as published by the Free Software Foundation. -# -# openQRM is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with openQRM. If not, see . -# -# Copyright 2011, OPENQRM AUSTRALIA PTY LTD - -NAME="openqrm" -DESC="openQRM Cloud Computing Platform" -LOGDIR=/var/log/$NAME -LANG=C -. /lib/lsb/init-functions - -if [ -f /etc/default/$NAME ] ; then - . /etc/default/$NAME -else - OPENQRM_SERVER_BASE_DIR="/usr/share" -fi - -set -e - -case "$1" in - install|upgrade) - if [ -f "$OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf" ]; then - # this is an update - if [ -x "$OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm-update" ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm-update pre -f - fi - fi - ;; - - *) - echo "preinst called with argument \`$1'" >&2 - exit 0 - ;; -esac - - -#DEBHELPER# - -exit 0 diff --git a/openQRM-5.3.50-CE/src/debian/openqrm.prerm b/openQRM-5.3.50-CE/src/debian/openqrm.prerm deleted file mode 100644 index f25ee17..0000000 --- a/openQRM-5.3.50-CE/src/debian/openqrm.prerm +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# openQRM prerm script - needs bash to source openqrm-functions -# -# This file is part of openQRM. -# -# openQRM is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 -# as published by the Free Software Foundation. -# -# openQRM is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with openQRM. If not, see . -# -# Copyright 2011, OPENQRM AUSTRALIA PTY LTD - -NAME="openqrm" -DESC="openQRM Cloud Computing Platform" -LOGDIR=/var/log/$NAME -LANG=C -. /lib/lsb/init-functions - -if [ -f /etc/default/$NAME ] ; then - . /etc/default/$NAME -else - OPENQRM_SERVER_BASE_DIR="/usr/share" -fi -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - -set -e - -case "$1" in - remove|deconfigure) - /etc/init.d/openqrm stop 2>/dev/null || true - /etc/init.d/openqrm-enterprise stop 2>/dev/null || true - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm - rm -f /etc/apache2/conf.d/openqrm-httpd.conf - rm -f /etc/apache2/conf.d/openqrm-https.conf - openqrm_webserver reload - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/default - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear - ;; - - abort-upgrade|failed-upgrade|abort-install|upgrade) - ;; - - *) - echo "prerm called with argument \`$1'" >&2 - exit 0 - ;; -esac - - -#DEBHELPER# - -exit 0 diff --git a/openQRM-5.3.50-CE/src/debian/rules b/openQRM-5.3.50-CE/src/debian/rules deleted file mode 100644 index 5fb8674..0000000 --- a/openQRM-5.3.50-CE/src/debian/rules +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/make -f -export DH_VERBOSE=1 - -export DH_ALWAYS_EXCLUDE=CVS:.svn:.git - -configure:: configure-stamp -configure-stamp: - dh_testdir - touch configure-stamp - -build: build-stamp - -build-stamp: configure-stamp - dh_testdir - make -clean:: - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - rm -fr $(CURDIR)/debian/openqrm-ng - - [ ! -f Makefile ] || $(MAKE) clean - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - [ ! -f Makefile ] || $(MAKE) install DESTINATION_DIR=$(CURDIR)/debian/openqrm-ng - -binary-indep: build install - -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs doc/Changelog - dh_installdocs - dh_installexamples - dh_install --sourcedir=debian/openqrm-ng - dh_installmenu - dh_installdebconf - dh_installinit - dh_installman - dh_lintian - dh_link - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/openQRM-5.3.50-CE/src/debian/rules.plugin b/openQRM-5.3.50-CE/src/debian/rules.plugin deleted file mode 100644 index 1c414dd..0000000 --- a/openQRM-5.3.50-CE/src/debian/rules.plugin +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/make -f -export DH_VERBOSE=1 - -configure:: configure-stamp -configure-stamp: - dh_testdir - touch configure-stamp - -build: build-stamp - -build-stamp: configure-stamp - dh_testdir - make -clean:: - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - rm -fr $(CURDIR)/debian/openqrm-ng - - [ ! -f Makefile ] || $(MAKE) clean - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - [ ! -f Makefile ] || $(MAKE) install DESTINATION_DIR=$(CURDIR)/debian/openqrm-ng - -binary-indep: build install - -binary-arch: build install - dh_testdir - dh_testroot - dh_installexamples - dh_install --sourcedir=debian/openqrm-ng - dh_installmenu - dh_installdebconf - dh_lintian - dh_link - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/openQRM-5.3.50-CE/src/debian/source.lintian-overrides b/openQRM-5.3.50-CE/src/debian/source.lintian-overrides deleted file mode 100644 index e69de29..0000000 diff --git a/openQRM-5.3.50-CE/src/debian/watch b/openQRM-5.3.50-CE/src/debian/watch deleted file mode 100644 index 4ac4edf..0000000 --- a/openQRM-5.3.50-CE/src/debian/watch +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -http://sf.net/openqrm/openqrm-(.+)\.tgz - diff --git a/openQRM-5.3.50-CE/src/doc/COPYING b/openQRM-5.3.50-CE/src/doc/COPYING deleted file mode 100644 index cecc12d..0000000 --- a/openQRM-5.3.50-CE/src/doc/COPYING +++ /dev/null @@ -1,10 +0,0 @@ -openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. - -All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. - -This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -The latest version of this license can be found here: src/doc/LICENSE.txt - -By using this software, you acknowledge having read this license and agree to be bound thereby. - - http://openqrm-enterprise.com diff --git a/openQRM-5.3.50-CE/src/doc/Changelog b/openQRM-5.3.50-CE/src/doc/Changelog deleted file mode 100644 index 2e8933c..0000000 --- a/openQRM-5.3.50-CE/src/doc/Changelog +++ /dev/null @@ -1,762 +0,0 @@ -# this is the changelog for the openQRM-server project - -31.01.2015 - openQRM 5.2.0 ------------------------------------ - - Increased robustness and efficiency for the complete Cloud work-flow - - Enhanced deprovision management intelligence - - Improved usability of the VMware and KVM VM Wizard - - Refined error management for the OpenStack and Hybrid Cloud integration - - -01.09.2013 - openQRM 5.1 - - Community/Base: - - - Appliance ==> Server rename - - virtualization plugin merge - - new design, much enhanced usability, easier workflows - - much enhanced kvm support - - much enhanced vmware support - - new libvirt plugin - - native Gluster/GlusterFS integration for KVM - http://raobharata.wordpress.com/2012/10/29/qemu-glusterfs-native-integration/ - - new much enhanced Hybrid-Cloud funtionalities - - WebSSHTerm for instances login via webrowser - - Automated Application deployment via puppet - - Automated Monitoring via Nagios - - Self-Service via the openQRM Cloud - easy option to "re-sell" EC2 as private Cloud resource - - base: - - base: enhanced Server wizard / skip steps if possible (openqrm image+kernel, local-vm kernel) - - base: improved boot-service configuration, the boot-services now can also be configured through the openqrm commandline utility - - base: implemented to also update the configuration files in plugin boot-services during make update - - base: enhanced update to automatically update the openQRM initrds for network-deployment - - base: enhanced packaging (deb/rpm), implemented robust package update - - base: enhanced virtual-resource-command hook allowing to shutdown Hosts via their custom API - - plugins: - - lcmc: updated lcmc to 1.5.4 - - local-storage: rename local-storage -> clonezilla - - cloud: added option to specify the Loadbalancing Algorithm for finding the next available Cloud Virtualization Host - - cloud: added option to specify a VM Provisioning delay in the Cloud - - cloud: added option in the openQRM Cloud to dynamically change resource parameter (cpu/memory) in the Cloudrequest - - dhcpd: enhanced dhcpd plugin - - supporting any type of network classes for the openQRM Management Network now - - added support for a multi-homed setup with several managed networks - - sshterm: patched bug in webshell (sshterm plugin) to work with python 2.7 - - kvm: implemented option to set the VNC keymapping for KVM and KVM-Storage VMs - - kvm: enhanced VM monitoring for local-deployment VMs - - kvm: enhanced VM update - - kvm: using qemu-img now to create kvm volume providing different qemu disk formats (raw, cow, qcow, qcow2) - - kvm: supports now snapshot action for blockfiles (kvm-bf-deployment and kvm-gluster-deployment) - - kvm: now supports native Gluster integration -> new deployment type kvm-gluster-deployment - -> http://raobharata.wordpress.com/2012/10/29/qemu-glusterfs-native-integration/ - - kvm - added option to automatic shutdown the openQRM management interface after deployment and startup of VMs - - hybrid-cloud: now talking transparently to AWS EC2 and Eucalyptus - - all-plugins: added and enhanced documentation - - new plugins Community Edition: - - new device-manager plugin provides easy LVM pre-configuration for Storages - - new network-manager plugin provides easy Network + Bridging pre-configuration for Virtualization Host - - new development plugin automatically self-documenting the REST API, templates, translations, css and js of openQRM - - new template plugin implementing all available plugin-hooks in openQRM with noop -> template for creating own custom plugin - - new libvirt plugin - integrating libvirt as additional resource provider - - - Bugfixes: - - fixed critical: only allow openQRM's update-stats trigger the plugin hooks - - fixed critical bug in iframe, not allowing any remote urls - - fixed cirtical bug in [plugin]-action.php - not allowing remote access to the stat directories - - fixed several typos - - fixed nfs-storage with manual NAS/NFS configuration - - - Enterprise Edition: - - new Event-Mailer Plugin sending events to openQRM Adminstrators - - new Role-Administration plugin for detailed adjustment of openQRM Adminstrator permissions - - allows to map the business topology against openQRM Roles - - - deprecated: - - deprecated coraid-storage equallogic-storage, netapp-storage, vbox and zfs-storage - -> those plugin will stay available and working in their current state, we just not yet plan to further enhance them. - - -31.05.2012 - openQRM 5.0 - - - -31.10.2011 - for the 4.9 release - released 31. October 2011 - - ############################################################################################################### - Base: - - - enhanced openQRM's "appliance model" with an "install from template" work-flow - This new, additional work-flow in openQRM is again fully modular and can be implemented by a plugin. - It now supports to "plug in" different automatic-installation tools (like e.g. the install server Cobbler) - to provide the deployment actions for physical and virtual systems. - Currently the following plugins are already available to be used with this new "install from template" work-flow : - - * Clonezilla Automated local provision by disk-imaging (cloning of the disk-content) for Windows and Linux - http://clonezilla.org/ - - * Cobbler Unattended local Linux installation (focus on RedHat/CentOS) - https://fedorahosted.org/cobbler/ - - * FAI Unattended local Linux installation (focus on Debian/Ubuntu) - http://fai-project.org/ - - * LinuxCOE Unattended local Linux installation (supports a variety of different Linux distributions) - http://linuxcoe.sourceforge.net/ - - * Opsi Unattended local installation for Windows Systems (including Hardware/Software-Inventory, Package- and License-Management) - http://www.opsi.org/ - - All above mentioned functionalities and features are also automatically available in the openQRM Cloud! - That means that openQRM can be used as the Middleware to attach an existing Cobbler, FAI, LinuxCOE and/or Opsi environments to Cloud Computing. - - More infos at http://www.openqrm-enterprise.com/news/details/article/openqrm-brings-clonezilla-cobbler-fai-linuxcoe-and-opsi-into-the-cloud.html - - - ############################################################################################################### - Cloud: - - - added option allowing the Cloud User to set the hostname for a requested Cloud system - - - minor changes in the SOAP API "provision" method - - - fixed provision error : failed adding authblocker! - - - added to update the SOAP API wsdl configuration during base update - - - deprecated multiple appliance per single request - - - ############################################################################################################### - New Plugins: - - - completely rewritten VMware ESX integration using the native VMware vSphere API - - ESX Auto-discovery, automatically discover ESX hosts with one mouse click - - new VM Management - - new DataStore Management, easily connect NAS or iSCSI DataStores - - new vSwitch/Network Management to manage vSwitches, Portgroups, Uplinks and VLANs - - fully integrated with the "novnc" plugin for VM console access via VNC - - a better Cloud integration now allows to easily use ESX in the openQRM Cloud - - supports ESX 4.1 and 5.0 - - - rewritten the linuxcoe plugin, adapted it to the "install from template" work-flow - - - rewritten the local-storage plugin, adapted it to the "install from template" work-flow - - - new "cobbler" integration using the "install from template" work-flow - - - new "fai" integration using the "install from template" work-flow - - - new "opsi" integration using the "install from template" work-flow - - - new nfs-storage plugin -> now using the new htmlobjects, enhanced work-flows and usability - - - new lvm-storage plugin -> now using the new htmlobjects, enhanced work-flows and usability - - - new citrix-storage plugin supporting the local-deployment for Citrix XenServer VMs - - - new "i-doit" CMDB integration (http://www.i-doit.org/) to automatically generate and update the System-Documentation - - - addtional support for Icinga in the Nagios plugin - - - with focus on the the new ESX integration we have deprecated the old vmware-server and vmware-server2 plugins - - - ############################################################################################################### - New Features: - - - added support for Glusterfs for kvm-storage, xen-storage and citrix-storage. - Those virtualization plugin now include an additional deployment-type using generic blockfile backends. - - - added "bridged-vlan" option (addtional to "bridge" and "Open vSwitch") - Additional to the regular bridged network topology and the support for Open vSwitch (http://openvswitch.org/) - we have added the "bridged-vlan" option which is using the standard linux tools (brctl, vlan) to automatically - and dynamically manage the virtual network interfaces VLAN configuration. - - - added "openQRM-client-for-local-VMs" to local-server plugin - - - ############################################################################################################### - New Commercial features: - - - Cloud Zone - openQRM Enterprise Cloud Zones is the layer on top of an openQRM Cloud infrastructure. - It has the capability to partition multiple datacenter locations into logical zones and map access - and permissions for each zone regarding your companies business topology. - openQRM Enterprise Cloud Zones comes with a central, multilingual and intuitive Cloud portal with a plug-able Google-maps integration - providing a detailed overview of where your data is located and your systems are running. - - More details plus video available at http://www.openqrm-enterprise.com/news/details/article/openqrm-enterprise-cloud-zones-the-next-level-of-cloud-computing.html - - - added hook in the ip-mgmt plugin to support external DNS server - This now provides the capability to automatically manage hostnames and their public ip-addresses on external DNS server. - - - ############################################################################################################### - Sponsored plugins and features: - - For the openQRM 4.9 release the following new plugins are sponsored by openQRM Enterprise: - - - citrix-storage (new) - - cobbler (new) - - fai (new) - - i-doit (new) - - linuxcoe (rewritten) - - local-storage (rewritten) - - lvm-storage (rewritten) - - nfs-storage (rewritten) - - opsi (new) - - vmware-esx (rewritten) - - - - ############################################################################################################### - Bug fixes: - - [ openqrm-Bugs-3288258 ] make deb fails - TODO - [ openqrm-Bugs-3296928 ] V4.8, make deb: aws plugin can't be packaged, build stops - TODO - [ openqrm-Bugs-3297274 ] make rpm problems - TODO - - [ openqrm-Bugs-3288982 ] dropbear not downloadable - [ openqrm-Bugs-3282328 ] Puppet has .svn folders after make install - [ openqrm-Bugs-3301594 ] Cloud - VM creation, always adds extra NIC - [ openqrm-Bugs-3295326 ] V4.8: DMC-applet not downloadable - - - - ############################################################################################################### - openQRM plugins included in the 4.9 release: - - - Aoe-Storage - Integrates Aoe/Coraid storage server and features the capability to boot resources directly from the Aoe-storage. - - Citrix - Manages Citrix-Xen server (network-deployment) - - Citrix-storage - Manages Citrix-Xen server (local-deployment) - - Cloud - Datacenter Self-service portal providing a fully automated request and provisioning deployment-cycle. - - Cobbler - integrates Cobbler server for automatic Linux installations. - - Collectd - Automated monitoring and statistics for appliances. - - Dhcpd - Automatically manages ip-address assignment and network-boot deployment. - - Dns - Automatically manages ip-address to hostname resolving. - - Drbdmc - Provides a user-friendly UI for setting up HA-Services on appliances with pacemaker/corosync/heartbeat. - - Equallogic-Storage - Native support for Dell Equallogic Storage. - - FAI - integrates Fai server for automatic Linux installations. - - Highavailability - Automated highavailability with N-to-1 and even N-to-0 Fail-over. - - Hybrid-Cloud - Integration with the Amazon Public Cloud, the Ubuntu Enterprise Cloud and Eucalyptus. - - I-Doit - The idoit plugin automatically documents systems and services managed by the openQRM-server. - - Image-Shelf - Provides an easy way to add pre-made server-images to openQRM. - - Iscsi-Storage - Integrates the Enterprise iSCSI Target and features the capability to boot resources directly from iSCSI Luns. - - Kvm - Support for rapid network-deployment of KVM Virtual Machines. - - Kvm-Storage - Support for rapid local-deployment of KVM Virtual Machines. - - Linuxcoe - Fully automated OS installation. - - Local-Server - Integration with existing, local-installed Systems. - - Local-Storage - Support for image-based Local-deployment . - - Lvm-Storage - Transforms a standard Linux-box into a rapid-fast-cloning storage-server (AOE, iSCSI and NFS). - - Lxc-Storage - Support for the container based Virtualization technology LCX -> http://lxc.sourceforge.net/ - - Nagios3 - Fully automated system and service monitoring with Nagios3 and Icinga. - - Netapp-Storage - Native support for NetApp-Filer Storage systems. - - Nfs-storage - Integrates NFS server and features the capability to boot resources directly from NFS. - - NoVNC - Provides a remote web-console for Virtual Machines and physical systems. - - OpenVZ-Storage - Support for the OpenVZ Virtualization technology - - Opsi - This openQRM plugin automatically installs Windows System. - - Puppet - Fully automated configuration management for appliances. - - Sanboot-Storage - Booting Windows (and other OS'es) directly from an iSCSI or AOE SAN. - - Solx86 - Integration for openSolaris/Solaris X86 systems. - - Sshterm - Provides a secure login to the managed resources through the Web-interface. - - Tftpd - Provides a tftp-server for network-deployment. - - Tmpfs-Storage - Features the capability to boot resources in memory (tmpfs). - - Vbox - Integrates the Virtualbox Virtualization Technology. - - Vmware-esx - Integrates the VMware-ESX virtualization technology. - - Wakeuponlan - Automatically starts (power on) physical systems via the Wake-up-on-LAN technology. - - Windows - Support for the Windows Operating System. - - Xen - Support for rapid network-deployment of Xen Virtual Machines. - - Xen-Storage - Support for rapid local-deployment of Xen Virtual Machines. - - Zabbix - Automated monitoring for systems and services - - Zfs-Storage - Integrates ZFS storage server and features the capability to boot from ZFS. - - - ############################################################################################################### - Installation of openQRM - - For a way easy installation (and/or udpate) of openQRM please install directly from the openQRM projects subversion repository! - The installation from the sources will guarantee simple, seamless and mature updates based on the principle of "Continuous integration" -> http://en.wikipedia.org/wiki/Continuous_integration - - Installation on Debian/Ubuntu: - 1) run "apt-get install subversion make" - 2) run "svn co https://openqrm.svn.sourceforge.net/svnroot/openqrm openqrm" - 3) run "cd openqrm/trunk/src" - 4) run "make && make install && make start" - - Update to openQRM 4.9 on Debian/Ubuntu: - 1) Follow steps 1-3) of "Installation openQRM 4.9 on Debian/Ubuntu" - 2) Instead of step 4) run "make && make update" - - - Installation openQRM 4.9 on CentOS/RHEL: - 1) Add the RPMforge repository -> http://wiki.centos.org/AdditionalResources/Repositories/RPMForge - 2) run "yum install subversion make" - 3) run "svn co https://openqrm.svn.sourceforge.net/svnroot/openqrm openqrm" - 4) run "cd openqrm/trunk/src" - 5) run "make && make install && make start" - - Update to openQRM 4.9 on CentOS/RHEL: - 1) Follow steps 1-4) of "Installation openQRM 4.9 on CentOS/RHEL" - 2) Instead of step 5) run "make && make update" - - - - ############################################################################################################### - QA Report - Supported Distribution for the openQRM Server - - For the openQRM Server itself we recommend a Debian or Ubuntu (LTS) Linux distribution! - -> Especially for the openQRM 4.9 release we have included a set of improvements and QA to enhance the "user experience" of openQRM also on CentOS. - - For the managed physical systems and the deployment of Virtual Machines openQRM supports all mainstream Linux and Windows Distributions (and versions) - -> independent from the Linux Distribution the openQRM Server is running on. - - - Supported Distribution Matrix - - ------------------------------------ build -- install -- init -- works -- packaging -- - Debian 5 (Lenny) i386 OK OK OK OK OK - Debian 5 (Lenny) amd64 OK OK OK OK OK - - Debian 6 (Squeeze) i386 OK OK OK OK OK - Debian 6 (Squeeze) amd64 OK OK OK OK OK - - Ubuntu 10.04 LTS (Lucid) i386 OK OK OK OK OK - Ubuntu 10.04 LTS (Lucid) amd64 OK OK OK OK OK - - Ubuntu 10.10 (Maverick) i386 OK OK OK OK OK - Ubuntu 10.10 (Maverick) amd64 OK OK OK OK OK - - Centos 5.5 i386 OK OK OK OK X - Centos 5.5 amd64 OK OK OK OK X - - Centos 6 i386 OK OK OK OK OK - Centos 6 amd64 OK OK OK OK OK - ------------------------------------------------------------------------- - - Not supported (for now) : - Ubuntu 11.04 i386/amd64 - busybox and dropbear compile errors caused by 3.x kernel version - Ubuntu 11.10 i386/amd64 - busybox and dropbear compile errors caused by 3.x kernel version - - Known Bugs: - Debian 6 (Squeeze) i386/amd64 - deb packaging does not work for Squeeze because of portmap/rpcbind conflict - Centos 5.5 i386/amd64 - rpm packaging does not work, glibc-static + zlib-static build dep error -> packages not existing for CentOS 5.5 (not even rpmforge) - - - ############################################################################################################### - Enjoy openQRM 4.9! - - your openQRM Team - - - - -31.03.2011 - for the 4.8 release : - - Fixed code indention (complete source code) - - Fixed php warnings/errors (complete source code) - - Updated openqrm-initrd-templates and openqrm-clients - - Updated pciutils + pcimodules patch to version 3.1.7 - - Added option to overwrite resource-parameter (useful for storage cluster resources with a global cluster ip) - - New OpenVZ-Storage Plugin (Support for OpenVZ as an additional Virtualization technology in openQRM) - - Added support for live-migration for OpenVZ VMs - - Integration with Open vSwitch for automated VLAN Management -> http://openvswitch.org/ - - Improved kvm and kvm-storage Plugins - - Added support for live-migration of KVM/KVM-Storage VMs - - Integration with Open vSwitch for automated VLAN Management - - Improved xen and xen-storage Plugins - - Added support for live-migration of Xen/Xen-Storage VMs - - Integration with Open vSwitch for automated VLAN Management - - Enhanced Nagios integration (Nagios3 Plugin) - - Added custom service-check configuration for appliances - - Initial integration of Icinga (via the Nagios3 Plugin) - - New DRBD MC Plugin incorporating Linbit's DRBD Management Console - - Improved autostarting VMs after Host reboot - - Added "appliance-link-section" hook allowing plugins to add actions to the appliance overview - - Improved plugin notification and error event handling - - Enhanced usability and user-friendliness - - Better "appliance-create" workflow displaying only relevant configuration items - - Improved "resource-new" form - - Added support to Auto-scale the openQRM Cloud via "Out-of-Band-Management" Plugins (IPMI/WakeUpOnLan) - - Progressed with ongoing migration to MVC (removing the frames) - - Ported the first plugins (ip-mgmt, ipmi and wakeuponlan) to the - new version of the PHP framework from A. Kuballa -> http://htmlobjects.kuballa.net/ - - Fully Object oriented - - Fully translatable (multiple language support) - - Fully templatable (css and javascript integration) - - Automated user-friendly input checking - - openQRM 4.8 Bug fixes: - 3061951 - openqrm-client service on ubuntu - 2947742 - Create variable for /etc/exports - 2819000 - snapshot of a LV - 3153469 - Ubuntu, LXC, Reboot the physical machine - 2926602 - OpenQRM 4.6 linuxcoe plugin on Centos5.4 64 bit - 2958647 - OpenSuSE packaging - 2958640 - OpenSuSE NFS storage - 2956532 - openqrm-plugin-local-storage-functions not working in sles - 2803760 - lvm aoe vblade creation - 3106507 - issue when enabling plugin - 3111519 - .ssh/authorized_keys wird überschrieben - 3153471 - LXC_VM_NETWORK param - 3153463 - Ubuntu, LXC, Reverse DNS - 3164681 - Templates from shelf, pivot_root error message - 3170533 - DNS Plugin bug(s), corrupted reverse-zonefile - 2808601 - xen vm creation with same name - 3028333 - Renaming kernel in GUI doesn't rename on FS - 3165328 - WOL Manager is not accessible - 3195300 - Xen VM cannot be started in Xen 4 with debian 6 - 3195313 - xen plugin Error File descriptor leaked on lvscan invocation - 3195318 - xen-storage plugin error Volume group "noop" not found - 3192452 - typo in xen-storage startup script - 3165331 - Plenty of "Undefined index" messages in Apache/PHP log - 3157399 - HA plug-in - If more then 1 NIC assigned not creating new VM - 3156441 - in Nagios werden nicht alle Systeme mit Namen angezeigt - 3132483 - NAT ist falsch geschrieben - 3122276 - Build path wrong - 3118427 - mehere gleichnamige Images möglich - 2953421 - apt-get problem on Ubuntu at demo - 2925545 - Different error mess. with integration plugins - 2897181 - Double IP-Assignment (new ressource) - 2897175 - New Linux Kernel - 2840285 - NFS mounting from novell netware server fails - 2781087 - cloud: turn of avahi service on the ubuntu server-templates - -30.09.2010 - for the 4.7 release : - - changed halt to poweroff - - implemented seamless update - - link the tftpboot/boot dir to the boot-services - - updated openqrm-client and openqrm-initrd-templates - - increased column event_description in event_info table - - added database-update functions for mysql - - remove the tftpboot link on uninstall - - refresh resource-parameters during openqrm-client restart - - enhanced openqrm-client start phase for HA - - avoid starting bootservices on idle resource for faster startup - - clean udev rules on startup to have persistant interface names - - heavily increased performance for import_kernel phase - - added to detect lvm volumes within the initrd-stage - - increased version number, added configuable timeout and retry values for the cmd-queue - - added lvm to the initrd - - enhanced package-manager update - - better handling of setting the default kernel - - cmd-queue now using configurable timeout, increased default timeout to 120s - - fixed incorrect sequence in the cmd-queue actions - - removed sequentially processing-statistics event for better performance - - added updated htmlobjects in preparation for the ongoing move to MVC - - added authblocker to the appliance.class to enforce the correct start sequence - - better handling of adding events avoiding the time of the maintenance cron job - - added get_ids_by_storage method to image.class - - added additional virtualization and storage infos to resource-parameters - - added methods to get and set resource-capabilities - - implemented configurable HA timeout per resource - - added get_ids_by_storage_type method to storage.class - - added constraint-checks for object removal, increasing the useability - - updated links to the current documentation - - disabled postgres, oracle and db2 support for now, scheduled to be re-worked for version 5.0 - - added menu section for enterprise plugins - - using official htmlobjects release from sf.net - - added update target to main Makefile - aoe-storage : - - added to remove the authblocker when the device is existing auth succeeded - - made auto-starting the storage configurable for better HA handling - - improved remount_fs for Ubuntu Lucid and Maverick - - added cloud-deployment hook, making the Cloud Storage types completely plug-able - citrix: - - added fencing function, improve HA handling - - added constraint-checks for object removal - - added cloud-hook, making the Virtualization types completely plug-able - - added ha-hook to auto-create and fence VMs - cloud: - - improved html for the Cloud-portal - - added UI-compatible wdsl - - implemented Cloud-Profiles including custom-icon-upload for user-friendly deployment - - added Visual-Infrastructure-Designer for profile deployment - - restructured menu of the Cloud-portal - - improved account details - - implemented CloudUserGroups - - implemented configurable host-limits per resource - - implemented CloudPowerSaver for automatic power-off of not-utilized resources - - implemented ResourcePools to allow assignment of dedicated Cloud-resources to CloudUserGroups - - restructured cloud-actions in the cloud-monitor-hook for much better performance and scalability - - added configurable performance parameter - - implemented HostStartFromOff, allow the Cloud to automatically power-on Host systems via a plugin-hook for the new out-of-band management plug-ins - - improved AutoCreateVMs, monitoring the start-up phase of the VMs - - made Cloud-Ip management plug-able - - implemented Cloud auto-scaling - dhcpd: - - improved new-resource action - equallogic-storage: - - added to remove the authblocker when the device is existing auth succeeded - - improved remount_fs for Ubuntu Lucid and Maverick - - added cloud-deployment hook, making the Cloud Storage types completely plug-able - - fixed gathering the correct 32 or 64bit lib-depenencies for the resize-components - highavailability: - - added configurable HA time-out per resource - - improved to automatically create VMs and to automatically power-on Hosts - - added fencing-hook - iscsi-storage: - - added to remove the authblocker when the device is existing auth succeeded - - made auto-starting the storage configurable for better HA handling - - improved remount_fs for Ubuntu Lucid and Maverick - - added cloud-deployment hook, making the Cloud Storage types completely plug-able - kvm: - - added fencing function, improve HA handling - - added constraint-checks for object removal - - added cloud-hook, making the Virtualization types completely plug-able - - added ha-hook to auto-create and fence VMs - kvm-storage: - - added to remove the authblocker when the device is existing auth succeeded - - added cloud-deployment hook, making the Cloud Storage types completely plug-able - - added support for shared SAN storage - - added fencing function, improve HA handling - - added constraint-checks for object removal - - added cloud-hook, making the Virtualization types completely plug-able - - added ha-hook to auto-create and fence VMs - local-storage: - - added to remove the authblocker when the device is existing auth succeeded - - added cloud-deployment hook, making the Cloud Storage types completely plug-able - lvm-storage: - - added to remove the authblocker when the device is existing auth succeeded - - made auto-starting the storage configurable for better HA handling - - improved remount_fs for Ubuntu Lucid and Maverick - - added cloud-deployment hook, making the Cloud Storage types completely plug-able - lxc-storage: - - This is the new lxc-storage plugin integrating lxc-containers into openQRM and the openQRM Cloud - netapp-storage: - - added to remove the authblocker when the device is existing auth succeeded - - improved remount_fs for Ubuntu Lucid and Maverick - - added cloud-deployment hook, making the Cloud Storage types completely plug-able - nfs-storage: - - added to remove the authblocker when the device is existing auth succeeded - - improved remount_fs for Ubuntu Lucid and Maverick - - added cloud-deployment hook, making the Cloud Storage types completely plug-able - sanboot-storage: - - added to remove the authblocker when the device is existing auth succeeded - - added cloud-deployment hook, making the Cloud Storage types completely plug-able - sshterm: - - a brand-new sshterm plugin using WebShell, improved usability - tmpfs-storage: - - This new plugin allows to deploy systems directly into memory (RAM) - - added to remove the authblocker when the device is existing auth succeeded - vbox: - - added Virtualbox as additional Virtualization type into openQRM, initial version - vmware-esx: - - improved VM actions - - added fencing function, improve HA handling - - added constraint-checks for object removal - - added cloud-hook, making the Virtualization types completely plug-able - - added ha-hook to auto-create and fence VMs - vmware-server: - - added fencing function, improve HA handling - - added constraint-checks for object removal - - added cloud-hook, making the Virtualization types completely plug-able - - added ha-hook to auto-create and fence VMs - vmware-server2: - - added fencing function, improve HA handling - - added constraint-checks for object removal - - added cloud-hook, making the Virtualization types completely plug-able - - added ha-hook to auto-create and fence VMs - wakeuponlan: - - intgrating WOL (wake-up-on-Lan) as out-of-band management option - - providing the capability to automatically power-on Hosts (-> auto-scaling) - windows: - - updated Windows openQRM-Client.exe - - fixing sf.net bug 3028337 - Windows openQRM Client setup fails - xen: - - added fencing function, improve HA handling - - added constraint-checks for object removal - - added cloud-hook, making the Virtualization types completely plug-able - - added ha-hook to auto-create and fence VMs - xen-storage: - - added to remove the authblocker when the device is existing auth succeeded - - added cloud-deployment hook, making the Cloud Storage types completely plug-able - - added support for shared SAN storage - - added fencing function, improve HA handling - - added constraint-checks for object removal - - added cloud-hook, making the Virtualization types completely plug-able - - added ha-hook to auto-create and fence VMs - zfs-storage: - - added to remove the authblocker when the device is existing auth succeeded - - improved remount_fs for Ubuntu Lucid and Maverick - - added cloud-deployment hook, making the Cloud Storage types completely plug-able - -05.01.2010 - for the 4.6 release : - - fixed [ openqrm-Bugs-2544993 ] nagios2/nagios3 dependencies are broken for Ubuntu Intrepid - - fixed [ openqrm-Bugs-2612552 ] generated debian package breaks dpkg - - fixed [ openqrm-Bugs-2781083 ] cloud: requesting 2 appliances ip-config gets confused - - fixed [ openqrm-Bugs-2697298 ] restarting appliance in the cloud sets CR to done - - fixed [ openqrm-Bugs-2741804 ] openQRM and multiple locations - - fixed [ openqrm-Bugs-2897168 ] Rebooting ressources - - fixed [ openqrm-Bugs-2806794 ] aoe-lvm not restart after rebooting appliance on remote - - fixed [ openqrm-Bugs-2879884 ] Bug in citrix-auth.php - - fixed [ openqrm-Bugs-2923976 ] RPM Build: mod_ssl is missing so https doesn't work - - fixed [ openqrm-Bugs-2925571 ] Missed File Appliance Manager - - implemented [ openqrm-Feature Requests-2053329 ] ng: do we need the run-time dependency mysql-server ? - - implemented [ openqrm-Feature Requests-2818510 + 2818521 ] integrate already existing NFS server - - implemented [ openqrm-Feature Requests-2874621 ] moving openQRM to https - - implemented [ openqrm-Feature Requests-2874620 ] creating complex vms on the fly - - implemented [ openqrm-Feature Requests-2871220 ] Autostart feature for all virtualization technolgoies - implemented [ openqrm-Feature Requests-2778127 ] Amazon EC2 API Adapter - - new web-based installer - - added virtio support to the kvm-plugin - - Integration with Amazone EC2 - - lvm + equallogic storage disk resize - - Cloud appliance resize - - heavy packaging updates and improvements - - new basedir /usr/share !! - - focus and QA for Debian, Ubuntu and CentOS (latest versions) - - deprecated old non-maintained plugins (windows) - - new build system for debian/ubuntu (debian packaging conform, using pbuilder) - - new build system for Centos (much better rpms, much QA) - - pimped local-server to allow booting a remote kernel and running a local root-fs (on local-disk) - - image resize for cloud appliances - - private image feature for the cloud - - table sorting + paging fixes all over base + plugins - - applied [ openqrm-Patches-2879745 ] solx86 plugin update for derivatives without CSWtop - - fixed linuxCOE bugs, updated LinuxCOE to latest 4.2, retested with new LinuxCOE version - - added a Cloud Selector to define Cloud Products - - implemented automatic billing according to the user-defined Cloud Product prices - - implemented seamless support different server architectures (i386 + x86_64) - - added initrd-templates for Debian, CentOS and Ubuntu (i386 + x86_64 architecture) - - added openqrm-client packages for Debian, CentOS and Ubuntu (i386 + x86_64 architecture) - - restructured base and plugin menu, added menu icons - - a brand new much better automated hardware detection - - .... plus lots of cosmetics - - a new local deployment mode for KVM and Xen vms via the kvm-storage and xen-storage plugin - -> this plugin supports easy deployment "as you are used" on local logical volumes on the KVM/Xen host. - -> ... this one adds support for Windows operating system to openQRM - -28.06.2009 - for the 4.5 release : - - implemented "the Cloud billing should be plug-able" - - implemented Cloud NAT feature - - improved iSCSI boot for the iscsi-storage and lvm-storage plugin - - added Cloud-Mailer - - added Cloud VCD - Visual Cloud Designer - - added Zabbix monitoring plugin - - added Equallogic suppport, plugin development sponsored by XXLWebHosting - - re-organized the left tree menu -> plus subsections - - re-worked lvm-storage plugin - - re-worked ALL storage plugins - - completely re-worked the netapp-storage plugin - -> added netapp authentication hooks to fit into the storage security framework - -> tested with ontap 7.0 - - added support not "un-managed" nfs-storage server via an option to manually set the export-list - - reworked VMware ESX plugin - -> tested with VMware ESX 3.5 - ESXi 4.0 - - reworked VMware Server 2 plugin - -> tested with VMware-server-2.0.1-156745.i386 - - reworked VMware Server plugin - -> tested with VMware-server 1 - - reworked Xen plugin - -> tested with Xen 3.2 - 3.4 - - reworked and finalyzed Citrix XenServer plugin - -> tested with Citrix XenServer 5.5.0 - - reworked KVM plugin - -> tested with kvm-62 - - New landing page with Data-Center summary - - Fixed bugs : 2527643, 2636465, 2806793, 2709553, 2806816, 2781100, 2812712 - - Implemented/Closed Feature requests : 2208009, 2785130, 2208012, 2153370, 2697291 - -14.03.2009 - for the 4.4 release : - - debian build system updated - - added nagios3 plugin - - enhanced nagios2 integration, provding new automap option - - implemented [ 2474672 ] persistant appliances for the cloud - - fixed [ 2509597 ] requesting multiple resource does not free up cloud-ips - - fixed [ 2520734 ] in openqrm 4.3 xen plugin there's a typo - - fixed [ 2529860 ] umounting of /lib/modules before init - - fixed [ 2524342 ] xen plugin does not find xen.gz in redhat based installs - - fixed [ 2524370 ] xen plugin: xm/new.py requires xen 3.1+ - - implemented [ 2513579 ] integration of the Puppet groups into the Cloud - - fixed [ openqrm-Bugs-2544987 ] xen plugin xm list avoiding dom0 entry - - fixed [ openqrm-Bugs-2509728 ] growing event_info table slows down base engine - - implemented [ openqrm-Feature Requests-2542613 ] xen-plugin make the location of the cfg files configurable - - implemented [ openqrm-Feature Requests-1875784 ] enhancing the LinuxCOE integration - - made the command-execution layer plug-able - - added new command-execution layer based on dropbear (ssl + shared keys) - - implemented [ openqrm-Feature Requests-2468844 ] cloud: on/off switch for the cloud -> being able to take it offline - - puppet + webmin - - added per-User Cloud-resource limits (quantity, memory, disk, network, cpus) - - enhanced sshterm plugin, implemented secure remote access via ajaxterm and pound reverse-ssl-proxy - - integrated sshterm-plugin into the Cloud - - implemented [ openqrm-Feature Requests-1881578 ] ng: automatic loadbalancing for Xen vms - - implemented [ openqrm-Feature Requests-1921180 ] ng: need a way to execute commands on the managed resources - - implemented [ openqrm-Feature Requests-2502207 ] Web service plugin. - -30.12.2008 - for the 4.3 release : - - improved usability for the storage management - - implemented storage security features - - new debian build system - - fixed [ openqrm-Bugs-2298162 ] Selecting the resource-type in the overview is tricky - - implemented [ openqrm-Feature Requests-2342603 ] Cloud Plugin Enhancement - - implemented "auto-create-virtual-machines" for the Cloud Plugin - - implemented [ 2147701 ] Support for VMware-server 2.x - - fixed [ 2153376 ] Image-Shelf not extendable - - xen plugin enhancements [ openqrm-Feature Requests-1949902 ] ng: booting xen domains via pypxeboot - - fixed [ openqrm-Bugs-2413524 ] Nagios on Centos uses wrong dir - - implemented [ 2250673 ] assigning default-image - - implemented [ 2468842 ] state backups of the openQRM-server -29.08.2008 - fixed [ 1934416 ] ng: template-based Image-Installer -24.08.2008 - security fixes, GUI- and Usablility improvements -08.08.2008 - fixed [ 1992378 ] ng: iscsi- + aoe-storage deployment should auto-partititon -09.07.2008 - fixed [ 1992381 ] ng: add option for resources to add events -06.07.2008 - fixed [ openqrm-Bugs-1999014 ] ng: recheck permissions of the boot-service files on Centos - [ openqrm-Feature Requests-1940898 ] ng: update path / backup/restore for plugins -05.07.2008 - fixed - [ openqrm-Bugs-1999026 ] ng: increase field-length of hostname in resource_info - [ openqrm-Bugs-1992353 ] ng: iscsi-storage plugin needs unique disk-identifier - [ openqrm-Feature Requests-1992366 ] ng: udev on the initrd - [ openqrm-Feature Requests-1992371 ] ng: clean up install-from-local + install-from-local-device - -18.06.2008 - initial release version 4.0 -11.04.2008 - moved cvs repository to svn and added svn-commit mails -up to the -18.06.2008 - full steam ahead on preparing the initial release version -16.03.2008 - major updates on the basic framework - introduced user management and plugg-ability - added local, nfs and iscsi deployment types (also plugg-able) - added appliance based deployment mechanism -21.01.2008 - added basic monitoring framework -20.01.2008 - cleaned-up init process on the initrd - made reboot/halt working -19.01.2008 - added root-execution environemnt for the server - added to add new detected resources automatically - added starting the openrm-client on the booted resources -17.01.2008 - added to init network on the intird - added build-requirements check -16.01.2008 - added creating default initrd template - added creating default boot-image -14.01.2008 - made tftpd plugin working - made dhcpd plugin working -13.01.2008 - added support for rpm-packaging -12.01.2008 - created initial framework - designed dependencies setup - implemented deb-packaging - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/doc/DESIGN-NOTES b/openQRM-5.3.50-CE/src/doc/DESIGN-NOTES deleted file mode 100644 index 254ad9b..0000000 --- a/openQRM-5.3.50-CE/src/doc/DESIGN-NOTES +++ /dev/null @@ -1,83 +0,0 @@ -openQRM - - Being pluggable in nature openQRM has a design that allows and enables developers to add features or plugins. The enviroment is full of technologies and software that is discussed here. - -PHP - PHP5 enables the majority of openQRM in its web interface and in normal programing. Additionally PHP runs along with Apache2, ADODB (MySQL, DB2, Oracle, or PostgreSQL) and a host of other technologies like XML, AJAX and more. - -Base - The base of openQRM describes the components that are required to run and offer the API to the plugins. The base is the infrastructure that allows the plugins to interact with the resources in openQRM. Local administration and the plugin management system are parts of the base. - -Plugins - Many plugins offer features and access to resources. Some plugins offer monitoring, storage management, deployment or other service to the openQRM system. The list of plugins will change and grow faster than this document. Please check the website for up to date information. - - To write a plugin you will need certian required and optional structures. - - Required: - - base-directory - base-dir/openqrm/plugins/[plugin-name] - All plugins specific source code should go here. - - plugin etc directory - base-dir/openqrm/plugins/[plugin-name]/etc - All plugins specific configuration files should go here. - - plugin etc/init.d directory - base-dir/openqrm/plugins/[plugin-name]/etc/init.d - All plugins specific init scripts should go here. - The plugins init script should be named "openqrm-plugin-[plugin-name]" and accept at least the start/stop parameters. - - plugins postinstall stage - base-dir/openqrm/plugins/[plugin-name]/etc/init.d/openqrm-plugin-[plugin-name].postinstall - This postinstall script must exist for packaging. It should run the commands needed for initialyzing the plugin after installation. - (it does not enable the plugin but just prepare it so it could get enabled) - - plugins preremove stage - base-dir/openqrm/plugins/[plugin-name]/etc/init.d/openqrm-plugin-[plugin-name].preremove - This preremove script must exist for packaging. It should run the commands needed to stop and uninitialyze the plugin after installation. - (it does not disable the plugin but just prepare it so it could get disabled) - - plugins configuration file - base-dir/openqrm/plugins/[plugin-name]/etc/openqrm-plugin-[plugin-name].conf - This main plugins configuration file must exists. - It should set the following variables - # plugin version - OPENQRM_PLUGIN_VERSION="[openqrm-server-version]-[plugin-version]" - # plugin dependencies for redhat-, suse- and debian-based systems - OPENQRM_PLUGIN_DEPENDENCIES_REDHAT - OPENQRM_PLUGIN_DEPENDENCIES_SUSE - OPENQRM_PLUGIN_DEPENDENCIES_DEBIAN - This OPENQRM_PLUGIN_DEPENDENCIES variables should be set to a comma-separated - list of required components (dependencies) for redhat-, suse- and debian-based systems. - - plugins Makefile - base-dir/openqrm/plugins/[plugin-name]/Makefile - This Makefile compiles and packages the plugin. - It should implement the following targets - configure, compile, install, uninstall, clean, realclean and all - - Optional: - - bin directory - base-dir/openqrm/plugins/[plugin-name]/bin - All plugins specific binaries should go here. - - plugin sbin directory - base-dir/openqrm/plugins/[plugin-name]/sbin - All plugins specific daemons/server-binaries should go here. - - plugin include directory - base-dir/openqrm/plugins/[plugin-name]/include - All plugins specific functions files should go here. - The plugin specific functions files should be named "openqrm-plugin-[plugin-name]-functions" - - plugin etc/templates directory - base-dir/openqrm/plugins/[plugin-name]/etc/templates - All plugins specific template files should go here. - The plugins templates should be named "openqrm-plugin-[plugin-name]..." - - plugin web directory - base-dir/openqrm/plugins/[plugin-name]/web - All plugins specific web-pages should go here. - diff --git a/openQRM-5.3.50-CE/src/doc/Developers b/openQRM-5.3.50-CE/src/doc/Developers deleted file mode 100644 index f459e3b..0000000 --- a/openQRM-5.3.50-CE/src/doc/Developers +++ /dev/null @@ -1,29 +0,0 @@ - -For developers or persons interested in submitting a patch for -consideration please note the following guide. - -1. Setup the enviroment - cd /usr/src - svn co https://openqrm.svn.sourceforge.net/svnroot/openqrm/trunk/src openqrm - -2. Work inside the openqrm folder - cd openqrm - -3. Sync with branch just in case - cd /usr/src/openqrm - make update - -4. Create SVN Diff - svn diff > /usr/src/all_openqrm_changes.patch - or - svn diff folder/folder/file.php > /usr/src/file.php_openqrm.patch - or - svn diff folder/folder/file.php Makefile doc/README \ - doc/INSTALL > /usr/src/misc_openqrm_changes.patch - -5. Politely forward this file with a description of what it is doing and why to -openqrm-developer@lists.sourceforge.net and don't forget the attachment. -For large patches you may want to link to the file on the Internet or ask for -further instructions on the list. - -Thanks ! diff --git a/openQRM-5.3.50-CE/src/doc/INSTALL b/openQRM-5.3.50-CE/src/doc/INSTALL deleted file mode 100644 index 45f3f84..0000000 --- a/openQRM-5.3.50-CE/src/doc/INSTALL +++ /dev/null @@ -1,62 +0,0 @@ -How to build and install openQRM - -To build please run : - - make - --> this automatically checks the requirements for the compilation --> it builds the base server and plugins --> it will download and compile some third-party components --> it will cache downloads and compile results --> build-location can be configured in ../src/etc/openqrm-server.conf - -To install run : - - make && make install - --> this installs openQRM-ng --> install-location can be configured in ../src/etc/openqrm-server.conf - -To start run : - - make start - --> this basically just runs "/etc/init.d/openqrm start" --> installation phase is not needed any more and got eliminated --> initialization happens automatically on first-start --> initialization automatically checks for runtime-requirements - -To check the install requirements run : - - make check - --> this checks the requirements for the compilation --> if this checks fails it will display the exact missing package requirement - Then just install the listed package via apt-get/yum/.. and try again. - -To package (rpm/deb) run : - - make package - --> this automatically build .deb or .rpm packages --> package location can be configured in ../src/etc/openqrm-server.conf - -To reinstall e.g. after making changes to the sources run : - - make reinstall - --> this runs stop, uninstall, clean, all, install, start - -Please notice that all make-targets (especially "install") should be executed as root. - -After compiling and installing openQRM-ng it automatically -initialises itself during first-start according the configuration -parameters set in the main (and single) configuration file BASEDIR/openqrm/etc/openqrm-server.conf - -The openQRM-server is now ready for login at : http://[ip-of-the-openQRM-server]/openqrm - -Default username and password after installation are : -User : openqrm -Password : openqrm - --> please change the default password immediately to prevent unauthorized access. diff --git a/openQRM-5.3.50-CE/src/doc/LICENSE.txt b/openQRM-5.3.50-CE/src/doc/LICENSE.txt deleted file mode 100644 index 60549be..0000000 --- a/openQRM-5.3.50-CE/src/doc/LICENSE.txt +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/openQRM-5.3.50-CE/src/doc/Makefile b/openQRM-5.3.50-CE/src/doc/Makefile deleted file mode 100644 index 22aef53..0000000 --- a/openQRM-5.3.50-CE/src/doc/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# this is the openQRM bin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/doc - . $(OPENQRM_SERVER_CONF) && cp COPYING Changelog DESIGN-NOTES Developers INSTALL README $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/doc/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/doc/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/doc - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/doc/README b/openQRM-5.3.50-CE/src/doc/README deleted file mode 100644 index 3d99615..0000000 --- a/openQRM-5.3.50-CE/src/doc/README +++ /dev/null @@ -1,38 +0,0 @@ -openQRM is the next generation, open-source Data-center management platform. -Its fully pluggable architecture focuses on automatic, rapid- and appliance-based -deployment, monitoring, high-availability and especially on supporting and -conforming multiple virtualization technologies. -openQRM is a single-management console for the complete IT-infra structure and -provides a well defined API which can be used to integrate third-party tools as -additional plugins. - -Its goal is it to achieve the following specifications : - -- KIS (keep it simple) -- run everywhere (support for every linux distribution, especially Debian+Ubuntu) -- clean up (remove all not needed code) -- reduce code base (less code = less bugs) -- using existing components (instead of providing own binaries/libs) -- better packaging and dependencies -- enabling/disabling plugins via the GUI -- support for multiple databases (db2, mysql, oracle, postgres) -- porting from java to php -- focusing on virtualization -- removing the installer-stage, do the inititialization during firststart -- ... and some more - -openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. - -All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -The latest version of this license can be found here: src/doc/LICENSE.txt -By using this software, you acknowledge having read this license and agree to be bound thereby. - - http://openqrm-enterprise.com - - - - - - - diff --git a/openQRM-5.3.50-CE/src/etc/Makefile b/openQRM-5.3.50-CE/src/etc/Makefile deleted file mode 100644 index f8e632d..0000000 --- a/openQRM-5.3.50-CE/src/etc/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -# this is the openQRM etc Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../etc/openqrm-server.conf - -configure: - -compile: - . $(OPENQRM_SERVER_CONF) && ../make-assistant openqrm_get_initrd_templates - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc - . $(OPENQRM_SERVER_CONF) && cp openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/httpd - . $(OPENQRM_SERVER_CONF) && cp httpd/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/httpd/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates - . $(OPENQRM_SERVER_CONF) && cp templates/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/db2 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/mysql $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/oracle $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/postgres - . $(OPENQRM_SERVER_CONF) && cp db/db2/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/db2/ - . $(OPENQRM_SERVER_CONF) && cp db/db2/README $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/db2/ - . $(OPENQRM_SERVER_CONF) && cp db/mysql/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/mysql/ - . $(OPENQRM_SERVER_CONF) && cp db/mysql/README $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/mysql/ - . $(OPENQRM_SERVER_CONF) && cp db/oracle/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/oracle/ - . $(OPENQRM_SERVER_CONF) && cp db/oracle/README $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/oracle/ - . $(OPENQRM_SERVER_CONF) && cp db/postgres/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/postgres/ - . $(OPENQRM_SERVER_CONF) && cp db/postgres/README $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/postgres/ - . $(OPENQRM_SERVER_CONF) && ../make-assistant openqrm_install_initrd_templates - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/etc - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean - - diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/README b/openQRM-5.3.50-CE/src/etc/build.conf/README deleted file mode 100644 index eaacfe8..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/README +++ /dev/null @@ -1,21 +0,0 @@ -In this directory stores configuration items for third-party components - -Third-party components used by openQRM : - -busybox --> we will compile our own, busybox binary since - we need special features of busybox which are not - enabled/available on (most) standard linux-distributions - -hwsetup --> for hardware detection during the initrd stage - -kudzu-knoppix --> requried by hwsetup - -hwdata-knoppix --> required by hwsetup - -defaultkernel --> this is the kernel for creating the default boot-image from - diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/adodb.conf b/openQRM-5.3.50-CE/src/etc/build.conf/adodb.conf deleted file mode 100644 index dfb2c37..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/adodb.conf +++ /dev/null @@ -1,21 +0,0 @@ -# Below the download locations for third-party components are defined -# adodb -# -> for debian/ubuntu + redhat systems adodb packages are available -# sadly not for suse so we bring our own adodb on suse systems only -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="498" -OPENQRM_SOURCE_DOWNLOAD="http://downloads.sourceforge.net/adodb/adodb$OPENQRM_SOURCE_VERSION.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/busybox.conf b/openQRM-5.3.50-CE/src/etc/build.conf/busybox.conf deleted file mode 100644 index 2e9308b..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/busybox.conf +++ /dev/null @@ -1,25 +0,0 @@ -# Below the download locations for third-party components are defined -# busybox -# -> we will compile our own, busybox binary since we need special -# features of busybox which are not enabled/available on (most) standard -# linux-distributions -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="1.19.4" -#OPENQRM_SOURCE_DOWNLOAD="http://busybox.net/downloads/busybox-$OPENQRM_SOURCE_VERSION.tar.bz2" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/base/busybox-$OPENQRM_SOURCE_VERSION.tar.bz2" -OPENQRM_SOURCE_BINARY_RESULT="busybox-$OPENQRM_SOURCE_VERSION/_install/bin/busybox" - - diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/busybox.configuration b/openQRM-5.3.50-CE/src/etc/build.conf/busybox.configuration deleted file mode 100644 index 44b4d2b..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/busybox.configuration +++ /dev/null @@ -1,1013 +0,0 @@ -# -# Automatically generated make config: don't edit -# Busybox version: 1.19.4 -# Tue Mar 6 19:31:06 2012 -# -CONFIG_HAVE_DOT_CONFIG=y - -# -# Busybox Settings -# - -# -# General Configuration -# -# CONFIG_DESKTOP is not set -# CONFIG_EXTRA_COMPAT is not set -CONFIG_INCLUDE_SUSv2=y -# CONFIG_USE_PORTABLE_CODE is not set -CONFIG_PLATFORM_LINUX=y -CONFIG_FEATURE_BUFFERS_USE_MALLOC=y -# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set -# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set -CONFIG_SHOW_USAGE=y -CONFIG_FEATURE_VERBOSE_USAGE=y -CONFIG_FEATURE_COMPRESS_USAGE=y -CONFIG_FEATURE_INSTALLER=y -# CONFIG_INSTALL_NO_USR is not set -CONFIG_LOCALE_SUPPORT=y -CONFIG_UNICODE_SUPPORT=y -# CONFIG_UNICODE_USING_LOCALE is not set -# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set -CONFIG_SUBST_WCHAR=63 -CONFIG_LAST_SUPPORTED_WCHAR=767 -# CONFIG_UNICODE_COMBINING_WCHARS is not set -# CONFIG_UNICODE_WIDE_WCHARS is not set -# CONFIG_UNICODE_BIDI_SUPPORT is not set -# CONFIG_UNICODE_NEUTRAL_TABLE is not set -# CONFIG_UNICODE_PRESERVE_BROKEN is not set -CONFIG_LONG_OPTS=y -CONFIG_FEATURE_DEVPTS=y -# CONFIG_FEATURE_CLEAN_UP is not set -CONFIG_FEATURE_UTMP=y -CONFIG_FEATURE_WTMP=y -CONFIG_FEATURE_PIDFILE=y -CONFIG_FEATURE_SUID=y -CONFIG_FEATURE_SUID_CONFIG=y -CONFIG_FEATURE_SUID_CONFIG_QUIET=y -# CONFIG_SELINUX is not set -# CONFIG_FEATURE_PREFER_APPLETS is not set -CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" -CONFIG_FEATURE_SYSLOG=y -CONFIG_FEATURE_HAVE_RPC=y - -# -# Build Options -# -# CONFIG_STATIC is not set -# CONFIG_PIE is not set -# CONFIG_NOMMU is not set -# CONFIG_BUILD_LIBBUSYBOX is not set -# CONFIG_FEATURE_INDIVIDUAL is not set -# CONFIG_FEATURE_SHARED_BUSYBOX is not set -CONFIG_LFS=y -CONFIG_CROSS_COMPILER_PREFIX="" -CONFIG_EXTRA_CFLAGS="" - -# -# Debugging Options -# -# CONFIG_DEBUG is not set -# CONFIG_DEBUG_PESSIMIZE is not set -# CONFIG_WERROR is not set -CONFIG_NO_DEBUG_LIB=y -# CONFIG_DMALLOC is not set -# CONFIG_EFENCE is not set - -# -# Installation Options ("make install" behavior) -# -CONFIG_INSTALL_APPLET_SYMLINKS=y -# CONFIG_INSTALL_APPLET_HARDLINKS is not set -# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set -# CONFIG_INSTALL_APPLET_DONT is not set -# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set -# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set -# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set -CONFIG_PREFIX="./_install" - -# -# Busybox Library Tuning -# -CONFIG_FEATURE_SYSTEMD=y -CONFIG_FEATURE_RTMINMAX=y -CONFIG_PASSWORD_MINLEN=6 -CONFIG_MD5_SIZE_VS_SPEED=2 -CONFIG_FEATURE_FAST_TOP=y -# CONFIG_FEATURE_ETC_NETWORKS is not set -CONFIG_FEATURE_USE_TERMIOS=y -CONFIG_FEATURE_EDITING=y -CONFIG_FEATURE_EDITING_MAX_LEN=1024 -# CONFIG_FEATURE_EDITING_VI is not set -CONFIG_FEATURE_EDITING_HISTORY=15 -# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set -# CONFIG_FEATURE_REVERSE_SEARCH is not set -CONFIG_FEATURE_TAB_COMPLETION=y -# CONFIG_FEATURE_USERNAME_COMPLETION is not set -# CONFIG_FEATURE_EDITING_FANCY_PROMPT is not set -# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set -CONFIG_FEATURE_NON_POSIX_CP=y -# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set -CONFIG_FEATURE_COPYBUF_KB=4 -CONFIG_FEATURE_SKIP_ROOTFS=y -# CONFIG_MONOTONIC_SYSCALL is not set -CONFIG_IOCTL_HEX2STR_ERROR=y -CONFIG_FEATURE_HWIB=y - -# -# Applets -# - -# -# Archival Utilities -# -CONFIG_FEATURE_SEAMLESS_XZ=y -CONFIG_FEATURE_SEAMLESS_LZMA=y -CONFIG_FEATURE_SEAMLESS_BZ2=y -CONFIG_FEATURE_SEAMLESS_GZ=y -CONFIG_FEATURE_SEAMLESS_Z=y -CONFIG_AR=y -CONFIG_FEATURE_AR_LONG_FILENAMES=y -CONFIG_FEATURE_AR_CREATE=y -CONFIG_BUNZIP2=y -CONFIG_BZIP2=y -CONFIG_CPIO=y -CONFIG_FEATURE_CPIO_O=y -# CONFIG_FEATURE_CPIO_P is not set -# CONFIG_DPKG is not set -# CONFIG_DPKG_DEB is not set -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set -CONFIG_GUNZIP=y -CONFIG_GZIP=y -CONFIG_FEATURE_GZIP_LONG_OPTIONS=y -CONFIG_LZOP=y -# CONFIG_LZOP_COMPR_HIGH is not set -CONFIG_RPM2CPIO=y -CONFIG_RPM=y -CONFIG_TAR=y -CONFIG_FEATURE_TAR_CREATE=y -CONFIG_FEATURE_TAR_AUTODETECT=y -CONFIG_FEATURE_TAR_FROM=y -CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y -CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY=y -CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y -CONFIG_FEATURE_TAR_LONG_OPTIONS=y -CONFIG_FEATURE_TAR_TO_COMMAND=y -# CONFIG_FEATURE_TAR_UNAME_GNAME is not set -CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y -# CONFIG_FEATURE_TAR_SELINUX is not set -CONFIG_UNCOMPRESS=y -CONFIG_UNLZMA=y -CONFIG_FEATURE_LZMA_FAST=y -CONFIG_LZMA=y -CONFIG_UNXZ=y -CONFIG_XZ=y -CONFIG_UNZIP=y - -# -# Coreutils -# -CONFIG_BASENAME=y -CONFIG_CAT=y -CONFIG_DATE=y -CONFIG_FEATURE_DATE_ISOFMT=y -# CONFIG_FEATURE_DATE_NANO is not set -CONFIG_FEATURE_DATE_COMPAT=y -CONFIG_ID=y -CONFIG_GROUPS=y -CONFIG_TEST=y -CONFIG_FEATURE_TEST_64=y -CONFIG_TOUCH=y -CONFIG_TR=y -CONFIG_FEATURE_TR_CLASSES=y -CONFIG_FEATURE_TR_EQUIV=y -CONFIG_BASE64=y -CONFIG_WHO=y -CONFIG_USERS=y -CONFIG_CAL=y -CONFIG_CATV=y -CONFIG_CHGRP=y -CONFIG_CHMOD=y -CONFIG_CHOWN=y -CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y -CONFIG_CHROOT=y -CONFIG_CKSUM=y -CONFIG_COMM=y -CONFIG_CP=y -CONFIG_FEATURE_CP_LONG_OPTIONS=y -CONFIG_CUT=y -CONFIG_DD=y -CONFIG_FEATURE_DD_SIGNAL_HANDLING=y -CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y -CONFIG_FEATURE_DD_IBS_OBS=y -CONFIG_DF=y -CONFIG_FEATURE_DF_FANCY=y -CONFIG_DIRNAME=y -CONFIG_DOS2UNIX=y -CONFIG_UNIX2DOS=y -CONFIG_DU=y -CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y -CONFIG_ECHO=y -CONFIG_FEATURE_FANCY_ECHO=y -CONFIG_ENV=y -CONFIG_FEATURE_ENV_LONG_OPTIONS=y -CONFIG_EXPAND=y -CONFIG_FEATURE_EXPAND_LONG_OPTIONS=y -CONFIG_EXPR=y -CONFIG_EXPR_MATH_SUPPORT_64=y -CONFIG_FALSE=y -CONFIG_FOLD=y -CONFIG_FSYNC=y -CONFIG_HEAD=y -CONFIG_FEATURE_FANCY_HEAD=y -CONFIG_HOSTID=y -CONFIG_INSTALL=y -CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y -CONFIG_LN=y -CONFIG_LOGNAME=y -CONFIG_LS=y -CONFIG_FEATURE_LS_FILETYPES=y -CONFIG_FEATURE_LS_FOLLOWLINKS=y -CONFIG_FEATURE_LS_RECURSIVE=y -CONFIG_FEATURE_LS_SORTFILES=y -CONFIG_FEATURE_LS_TIMESTAMPS=y -CONFIG_FEATURE_LS_USERNAME=y -CONFIG_FEATURE_LS_COLOR=y -CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y -CONFIG_MD5SUM=y -CONFIG_MKDIR=y -CONFIG_FEATURE_MKDIR_LONG_OPTIONS=y -CONFIG_MKFIFO=y -CONFIG_MKNOD=y -CONFIG_MV=y -CONFIG_FEATURE_MV_LONG_OPTIONS=y -CONFIG_NICE=y -CONFIG_NOHUP=y -CONFIG_OD=y -CONFIG_PRINTENV=y -CONFIG_PRINTF=y -CONFIG_PWD=y -CONFIG_READLINK=y -CONFIG_FEATURE_READLINK_FOLLOW=y -CONFIG_REALPATH=y -CONFIG_RM=y -CONFIG_RMDIR=y -# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set -CONFIG_SEQ=y -CONFIG_SHA1SUM=y -# CONFIG_SHA256SUM is not set -# CONFIG_SHA512SUM is not set -CONFIG_SLEEP=y -CONFIG_FEATURE_FANCY_SLEEP=y -# CONFIG_FEATURE_FLOAT_SLEEP is not set -CONFIG_SORT=y -CONFIG_FEATURE_SORT_BIG=y -CONFIG_SPLIT=y -CONFIG_FEATURE_SPLIT_FANCY=y -CONFIG_STAT=y -CONFIG_FEATURE_STAT_FORMAT=y -CONFIG_STTY=y -CONFIG_SUM=y -CONFIG_SYNC=y -CONFIG_TAC=y -CONFIG_TAIL=y -CONFIG_FEATURE_FANCY_TAIL=y -CONFIG_TEE=y -CONFIG_FEATURE_TEE_USE_BLOCK_IO=y -CONFIG_TRUE=y -CONFIG_TTY=y -CONFIG_UNAME=y -CONFIG_UNEXPAND=y -CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS=y -CONFIG_UNIQ=y -CONFIG_USLEEP=y -CONFIG_UUDECODE=y -CONFIG_UUENCODE=y -CONFIG_WC=y -CONFIG_FEATURE_WC_LARGE=y -CONFIG_WHOAMI=y -CONFIG_YES=y - -# -# Common options for cp and mv -# -CONFIG_FEATURE_PRESERVE_HARDLINKS=y - -# -# Common options for ls, more and telnet -# -CONFIG_FEATURE_AUTOWIDTH=y - -# -# Common options for df, du, ls -# -CONFIG_FEATURE_HUMAN_READABLE=y - -# -# Common options for md5sum, sha1sum, sha256sum, sha512sum -# -CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y - -# -# Console Utilities -# -CONFIG_CHVT=y -CONFIG_FGCONSOLE=y -CONFIG_CLEAR=y -CONFIG_DEALLOCVT=y -CONFIG_DUMPKMAP=y -CONFIG_KBD_MODE=y -CONFIG_LOADFONT=y -CONFIG_LOADKMAP=y -CONFIG_OPENVT=y -CONFIG_RESET=y -CONFIG_RESIZE=y -CONFIG_FEATURE_RESIZE_PRINT=y -CONFIG_SETCONSOLE=y -CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y -# CONFIG_SETFONT is not set -# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set -CONFIG_DEFAULT_SETFONT_DIR="" -CONFIG_SETKEYCODES=y -CONFIG_SETLOGCONS=y -# CONFIG_SHOWKEY is not set - -# -# Common options for loadfont and setfont -# -CONFIG_FEATURE_LOADFONT_PSF2=y -CONFIG_FEATURE_LOADFONT_RAW=y - -# -# Debian Utilities -# -CONFIG_MKTEMP=y -CONFIG_PIPE_PROGRESS=y -CONFIG_RUN_PARTS=y -CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y -CONFIG_FEATURE_RUN_PARTS_FANCY=y -CONFIG_START_STOP_DAEMON=y -CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y -CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y -CONFIG_WHICH=y - -# -# Editors -# -CONFIG_PATCH=y -CONFIG_VI=y -CONFIG_FEATURE_VI_MAX_LEN=4096 -# CONFIG_FEATURE_VI_8BIT is not set -CONFIG_FEATURE_VI_COLON=y -CONFIG_FEATURE_VI_YANKMARK=y -CONFIG_FEATURE_VI_SEARCH=y -# CONFIG_FEATURE_VI_REGEX_SEARCH is not set -CONFIG_FEATURE_VI_USE_SIGNALS=y -CONFIG_FEATURE_VI_DOT_CMD=y -CONFIG_FEATURE_VI_READONLY=y -CONFIG_FEATURE_VI_SETOPTS=y -CONFIG_FEATURE_VI_SET=y -CONFIG_FEATURE_VI_WIN_RESIZE=y -CONFIG_FEATURE_VI_ASK_TERMINAL=y -CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y -CONFIG_AWK=y -# CONFIG_FEATURE_AWK_LIBM is not set -CONFIG_CMP=y -CONFIG_DIFF=y -CONFIG_FEATURE_DIFF_LONG_OPTIONS=y -CONFIG_FEATURE_DIFF_DIR=y -CONFIG_ED=y -CONFIG_SED=y -CONFIG_FEATURE_ALLOW_EXEC=y - -# -# Finding Utilities -# -CONFIG_FIND=y -CONFIG_FEATURE_FIND_PRINT0=y -CONFIG_FEATURE_FIND_MTIME=y -CONFIG_FEATURE_FIND_MMIN=y -CONFIG_FEATURE_FIND_PERM=y -CONFIG_FEATURE_FIND_TYPE=y -CONFIG_FEATURE_FIND_XDEV=y -CONFIG_FEATURE_FIND_MAXDEPTH=y -CONFIG_FEATURE_FIND_NEWER=y -CONFIG_FEATURE_FIND_INUM=y -CONFIG_FEATURE_FIND_EXEC=y -CONFIG_FEATURE_FIND_USER=y -CONFIG_FEATURE_FIND_GROUP=y -CONFIG_FEATURE_FIND_NOT=y -CONFIG_FEATURE_FIND_DEPTH=y -CONFIG_FEATURE_FIND_PAREN=y -CONFIG_FEATURE_FIND_SIZE=y -CONFIG_FEATURE_FIND_PRUNE=y -CONFIG_FEATURE_FIND_DELETE=y -CONFIG_FEATURE_FIND_PATH=y -CONFIG_FEATURE_FIND_REGEX=y -# CONFIG_FEATURE_FIND_CONTEXT is not set -CONFIG_FEATURE_FIND_LINKS=y -CONFIG_GREP=y -CONFIG_FEATURE_GREP_EGREP_ALIAS=y -CONFIG_FEATURE_GREP_FGREP_ALIAS=y -CONFIG_FEATURE_GREP_CONTEXT=y -CONFIG_XARGS=y -CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y -CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y -CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y -CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y - -# -# Init Utilities -# -CONFIG_BOOTCHARTD=y -CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER=y -CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE=y -CONFIG_HALT=y -# CONFIG_FEATURE_CALL_TELINIT is not set -CONFIG_TELINIT_PATH="" -CONFIG_INIT=y -CONFIG_FEATURE_USE_INITTAB=y -CONFIG_FEATURE_KILL_REMOVED=y -CONFIG_FEATURE_KILL_DELAY=0 -CONFIG_FEATURE_INIT_SCTTY=y -# CONFIG_FEATURE_INIT_SYSLOG is not set -CONFIG_FEATURE_EXTRA_QUIET=y -CONFIG_FEATURE_INIT_COREDUMPS=y -CONFIG_FEATURE_INITRD=y -CONFIG_INIT_TERMINAL_TYPE="linux" -CONFIG_MESG=y -CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y - -# -# Login/Password Management Utilities -# -# CONFIG_ADD_SHELL is not set -# CONFIG_REMOVE_SHELL is not set -CONFIG_FEATURE_SHADOWPASSWDS=y -CONFIG_USE_BB_PWD_GRP=y -CONFIG_USE_BB_SHADOW=y -CONFIG_USE_BB_CRYPT=y -# CONFIG_USE_BB_CRYPT_SHA is not set -CONFIG_ADDUSER=y -# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set -# CONFIG_FEATURE_CHECK_NAMES is not set -CONFIG_FIRST_SYSTEM_ID=100 -CONFIG_LAST_SYSTEM_ID=999 -CONFIG_ADDGROUP=y -CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS=y -CONFIG_FEATURE_ADDUSER_TO_GROUP=y -CONFIG_DELUSER=y -CONFIG_DELGROUP=y -CONFIG_FEATURE_DEL_USER_FROM_GROUP=y -CONFIG_GETTY=y -CONFIG_LOGIN=y -# CONFIG_PAM is not set -CONFIG_LOGIN_SCRIPTS=y -CONFIG_FEATURE_NOLOGIN=y -CONFIG_FEATURE_SECURETTY=y -CONFIG_PASSWD=y -CONFIG_FEATURE_PASSWD_WEAK_CHECK=y -CONFIG_CRYPTPW=y -CONFIG_CHPASSWD=y -CONFIG_SU=y -CONFIG_FEATURE_SU_SYSLOG=y -CONFIG_FEATURE_SU_CHECKS_SHELLS=y -CONFIG_SULOGIN=y -CONFIG_VLOCK=y - -# -# Linux Ext2 FS Progs -# -CONFIG_CHATTR=y -CONFIG_FSCK=y -CONFIG_LSATTR=y -# CONFIG_TUNE2FS is not set - -# -# Linux Module Utilities -# -CONFIG_MODINFO=y -# CONFIG_MODPROBE_SMALL is not set -# CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set -# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set -CONFIG_INSMOD=y -CONFIG_RMMOD=y -CONFIG_LSMOD=y -CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y -CONFIG_MODPROBE=y -# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set -# CONFIG_DEPMOD is not set - -# -# Options common to multiple modutils -# -CONFIG_FEATURE_2_4_MODULES=y -# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set -CONFIG_FEATURE_INSMOD_VERSION_CHECKING=y -CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS=y -CONFIG_FEATURE_INSMOD_LOADINKMEM=y -CONFIG_FEATURE_INSMOD_LOAD_MAP=y -CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL=y -CONFIG_FEATURE_CHECK_TAINTED_MODULE=y -CONFIG_FEATURE_MODUTILS_ALIAS=y -CONFIG_FEATURE_MODUTILS_SYMBOLS=y -CONFIG_DEFAULT_MODULES_DIR="/lib/modules" -CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" - -# -# Linux System Utilities -# -CONFIG_BLOCKDEV=y -CONFIG_REV=y -# CONFIG_ACPID is not set -# CONFIG_FEATURE_ACPID_COMPAT is not set -# CONFIG_BLKID is not set -# CONFIG_FEATURE_BLKID_TYPE is not set -CONFIG_DMESG=y -CONFIG_FEATURE_DMESG_PRETTY=y -CONFIG_FBSET=y -CONFIG_FEATURE_FBSET_FANCY=y -CONFIG_FEATURE_FBSET_READMODE=y -CONFIG_FDFLUSH=y -CONFIG_FDFORMAT=y -CONFIG_FDISK=y -# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set -CONFIG_FEATURE_FDISK_WRITABLE=y -# CONFIG_FEATURE_AIX_LABEL is not set -# CONFIG_FEATURE_SGI_LABEL is not set -# CONFIG_FEATURE_SUN_LABEL is not set -# CONFIG_FEATURE_OSF_LABEL is not set -# CONFIG_FEATURE_GPT_LABEL is not set -CONFIG_FEATURE_FDISK_ADVANCED=y -# CONFIG_FINDFS is not set -CONFIG_FLOCK=y -CONFIG_FREERAMDISK=y -CONFIG_FSCK_MINIX=y -CONFIG_MKFS_EXT2=y -CONFIG_MKFS_MINIX=y -CONFIG_FEATURE_MINIX2=y -# CONFIG_MKFS_REISER is not set -# CONFIG_MKFS_VFAT is not set -CONFIG_GETOPT=y -CONFIG_FEATURE_GETOPT_LONG=y -CONFIG_HEXDUMP=y -# CONFIG_FEATURE_HEXDUMP_REVERSE is not set -# CONFIG_HD is not set -CONFIG_HWCLOCK=y -CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y -CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y -CONFIG_IPCRM=y -CONFIG_IPCS=y -CONFIG_LOSETUP=y -CONFIG_LSPCI=y -CONFIG_LSUSB=y -CONFIG_MDEV=y -CONFIG_FEATURE_MDEV_CONF=y -# CONFIG_FEATURE_MDEV_RENAME is not set -# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set -CONFIG_FEATURE_MDEV_EXEC=y -CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y -CONFIG_MKSWAP=y -CONFIG_FEATURE_MKSWAP_UUID=y -CONFIG_MORE=y -CONFIG_MOUNT=y -# CONFIG_FEATURE_MOUNT_FAKE is not set -# CONFIG_FEATURE_MOUNT_VERBOSE is not set -# CONFIG_FEATURE_MOUNT_HELPERS is not set -CONFIG_FEATURE_MOUNT_LABEL=y -CONFIG_FEATURE_MOUNT_NFS=y -CONFIG_FEATURE_MOUNT_CIFS=y -CONFIG_FEATURE_MOUNT_FLAGS=y -CONFIG_FEATURE_MOUNT_FSTAB=y -CONFIG_PIVOT_ROOT=y -CONFIG_RDATE=y -# CONFIG_RDEV is not set -CONFIG_READPROFILE=y -# CONFIG_RTCWAKE is not set -# CONFIG_SCRIPT is not set -CONFIG_SCRIPTREPLAY=y -CONFIG_SETARCH=y -CONFIG_SWAPONOFF=y -# CONFIG_FEATURE_SWAPON_PRI is not set -CONFIG_SWITCH_ROOT=y -CONFIG_UMOUNT=y -CONFIG_FEATURE_UMOUNT_ALL=y - -# -# Common options for mount/umount -# -CONFIG_FEATURE_MOUNT_LOOP=y -CONFIG_FEATURE_MOUNT_LOOP_CREATE=y -# CONFIG_FEATURE_MTAB_SUPPORT is not set -CONFIG_VOLUMEID=y - -# -# Filesystem/Volume identification -# -CONFIG_FEATURE_VOLUMEID_EXT=y -CONFIG_FEATURE_VOLUMEID_BTRFS=y -# CONFIG_FEATURE_VOLUMEID_REISERFS is not set -# CONFIG_FEATURE_VOLUMEID_FAT is not set -# CONFIG_FEATURE_VOLUMEID_HFS is not set -# CONFIG_FEATURE_VOLUMEID_JFS is not set -# CONFIG_FEATURE_VOLUMEID_XFS is not set -# CONFIG_FEATURE_VOLUMEID_NTFS is not set -# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set -# CONFIG_FEATURE_VOLUMEID_UDF is not set -# CONFIG_FEATURE_VOLUMEID_LUKS is not set -# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set -# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set -# CONFIG_FEATURE_VOLUMEID_ROMFS is not set -# CONFIG_FEATURE_VOLUMEID_SYSV is not set -# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set -# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set - -# -# Miscellaneous Utilities -# -# CONFIG_CONSPY is not set -CONFIG_LESS=y -CONFIG_FEATURE_LESS_MAXLINES=9999999 -CONFIG_FEATURE_LESS_BRACKETS=y -CONFIG_FEATURE_LESS_FLAGS=y -CONFIG_FEATURE_LESS_MARKS=y -CONFIG_FEATURE_LESS_REGEXP=y -# CONFIG_FEATURE_LESS_WINCH is not set -# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set -# CONFIG_FEATURE_LESS_DASHCMD is not set -# CONFIG_FEATURE_LESS_LINENUMS is not set -# CONFIG_NANDWRITE is not set -# CONFIG_NANDDUMP is not set -CONFIG_SETSERIAL=y -CONFIG_UBIATTACH=y -CONFIG_UBIDETACH=y -CONFIG_UBIMKVOL=y -CONFIG_UBIRMVOL=y -CONFIG_UBIRSVOL=y -CONFIG_UBIUPDATEVOL=y -CONFIG_ADJTIMEX=y -# CONFIG_BBCONFIG is not set -# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set -CONFIG_BEEP=y -CONFIG_FEATURE_BEEP_FREQ=4000 -CONFIG_FEATURE_BEEP_LENGTH_MS=30 -# CONFIG_CHAT is not set -# CONFIG_FEATURE_CHAT_NOFAIL is not set -# CONFIG_FEATURE_CHAT_TTY_HIFI is not set -# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set -# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set -# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set -# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set -# CONFIG_FEATURE_CHAT_CLR_ABORT is not set -CONFIG_CHRT=y -CONFIG_CROND=y -# CONFIG_FEATURE_CROND_D is not set -CONFIG_FEATURE_CROND_CALL_SENDMAIL=y -CONFIG_FEATURE_CROND_DIR="/var/spool/cron" -CONFIG_CRONTAB=y -CONFIG_DC=y -# CONFIG_FEATURE_DC_LIBM is not set -# CONFIG_DEVFSD is not set -# CONFIG_DEVFSD_MODLOAD is not set -# CONFIG_DEVFSD_FG_NP is not set -# CONFIG_DEVFSD_VERBOSE is not set -# CONFIG_FEATURE_DEVFS is not set -# CONFIG_DEVMEM is not set -CONFIG_EJECT=y -# CONFIG_FEATURE_EJECT_SCSI is not set -# CONFIG_FBSPLASH is not set -# CONFIG_FLASHCP is not set -# CONFIG_FLASH_LOCK is not set -# CONFIG_FLASH_UNLOCK is not set -# CONFIG_FLASH_ERASEALL is not set -# CONFIG_IONICE is not set -# CONFIG_INOTIFYD is not set -CONFIG_LAST=y -CONFIG_FEATURE_LAST_SMALL=y -# CONFIG_FEATURE_LAST_FANCY is not set -CONFIG_HDPARM=y -CONFIG_FEATURE_HDPARM_GET_IDENTITY=y -CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF=y -CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF=y -CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET=y -CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF=y -CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA=y -CONFIG_MAKEDEVS=y -# CONFIG_FEATURE_MAKEDEVS_LEAF is not set -CONFIG_FEATURE_MAKEDEVS_TABLE=y -# CONFIG_MAN is not set -CONFIG_MICROCOM=y -CONFIG_MOUNTPOINT=y -CONFIG_MT=y -CONFIG_RAIDAUTORUN=y -CONFIG_READAHEAD=y -# CONFIG_RFKILL is not set -CONFIG_RUNLEVEL=y -CONFIG_RX=y -CONFIG_SETSID=y -CONFIG_STRINGS=y -# CONFIG_TASKSET is not set -# CONFIG_FEATURE_TASKSET_FANCY is not set -CONFIG_TIME=y -# CONFIG_TIMEOUT is not set -CONFIG_TTYSIZE=y -CONFIG_VOLNAME=y -CONFIG_WALL=y -CONFIG_WATCHDOG=y - -# -# Networking Utilities -# -CONFIG_NAMEIF=y -# CONFIG_FEATURE_NAMEIF_EXTENDED is not set -CONFIG_NBDCLIENT=y -CONFIG_NC=y -CONFIG_NC_SERVER=y -CONFIG_NC_EXTRA=y -# CONFIG_NC_110_COMPAT is not set -CONFIG_PING=y -CONFIG_PING6=y -CONFIG_FEATURE_FANCY_PING=y -CONFIG_WHOIS=y -CONFIG_FEATURE_IPV6=y -# CONFIG_FEATURE_UNIX_LOCAL is not set -CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y -# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set -CONFIG_ARP=y -CONFIG_ARPING=y -CONFIG_BRCTL=y -# CONFIG_FEATURE_BRCTL_FANCY is not set -# CONFIG_FEATURE_BRCTL_SHOW is not set -CONFIG_DNSD=y -# CONFIG_ETHER_WAKE is not set -CONFIG_FAKEIDENTD=y -# CONFIG_FTPD is not set -# CONFIG_FEATURE_FTP_WRITE is not set -# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set -CONFIG_FTPGET=y -CONFIG_FTPPUT=y -CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y -CONFIG_HOSTNAME=y -CONFIG_HTTPD=y -CONFIG_FEATURE_HTTPD_RANGES=y -CONFIG_FEATURE_HTTPD_USE_SENDFILE=y -CONFIG_FEATURE_HTTPD_SETUID=y -CONFIG_FEATURE_HTTPD_BASIC_AUTH=y -CONFIG_FEATURE_HTTPD_AUTH_MD5=y -CONFIG_FEATURE_HTTPD_CGI=y -CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y -CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y -CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y -CONFIG_FEATURE_HTTPD_ERROR_PAGES=y -CONFIG_FEATURE_HTTPD_PROXY=y -CONFIG_FEATURE_HTTPD_GZIP=y -CONFIG_IFCONFIG=y -CONFIG_FEATURE_IFCONFIG_STATUS=y -CONFIG_FEATURE_IFCONFIG_SLIP=y -CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y -CONFIG_FEATURE_IFCONFIG_HW=y -CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y -CONFIG_IFENSLAVE=y -CONFIG_IFPLUGD=y -CONFIG_IFUPDOWN=y -CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate" -CONFIG_FEATURE_IFUPDOWN_IP=y -CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y -# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set -CONFIG_FEATURE_IFUPDOWN_IPV4=y -CONFIG_FEATURE_IFUPDOWN_IPV6=y -CONFIG_FEATURE_IFUPDOWN_MAPPING=y -# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set -CONFIG_INETD=y -CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO=y -CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD=y -CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME=y -CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME=y -CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN=y -# CONFIG_FEATURE_INETD_RPC is not set -CONFIG_IP=y -CONFIG_FEATURE_IP_ADDRESS=y -CONFIG_FEATURE_IP_LINK=y -CONFIG_FEATURE_IP_ROUTE=y -CONFIG_FEATURE_IP_TUNNEL=y -CONFIG_FEATURE_IP_RULE=y -CONFIG_FEATURE_IP_SHORT_FORMS=y -# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set -CONFIG_IPADDR=y -CONFIG_IPLINK=y -CONFIG_IPROUTE=y -CONFIG_IPTUNNEL=y -CONFIG_IPRULE=y -CONFIG_IPCALC=y -CONFIG_FEATURE_IPCALC_FANCY=y -CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y -CONFIG_NETSTAT=y -CONFIG_FEATURE_NETSTAT_WIDE=y -# CONFIG_FEATURE_NETSTAT_PRG is not set -CONFIG_NSLOOKUP=y -CONFIG_NTPD=y -CONFIG_FEATURE_NTPD_SERVER=y -CONFIG_PSCAN=y -CONFIG_ROUTE=y -CONFIG_SLATTACH=y -CONFIG_TCPSVD=y -CONFIG_TELNET=y -CONFIG_FEATURE_TELNET_TTYPE=y -CONFIG_FEATURE_TELNET_AUTOLOGIN=y -CONFIG_TELNETD=y -CONFIG_FEATURE_TELNETD_STANDALONE=y -CONFIG_FEATURE_TELNETD_INETD_WAIT=y -CONFIG_TFTP=y -# CONFIG_TFTPD is not set - -# -# Common options for tftp/tftpd -# -CONFIG_FEATURE_TFTP_GET=y -CONFIG_FEATURE_TFTP_PUT=y -CONFIG_FEATURE_TFTP_BLOCKSIZE=y -CONFIG_FEATURE_TFTP_PROGRESS_BAR=y -# CONFIG_TFTP_DEBUG is not set -CONFIG_TRACEROUTE=y -CONFIG_TRACEROUTE6=y -# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set -# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set -# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set -# CONFIG_TUNCTL is not set -# CONFIG_FEATURE_TUNCTL_UG is not set -CONFIG_UDHCPD=y -CONFIG_DHCPRELAY=y -CONFIG_DUMPLEASES=y -CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y -# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set -CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases" -CONFIG_UDHCPC=y -CONFIG_FEATURE_UDHCPC_ARPING=y -# CONFIG_FEATURE_UDHCP_PORT is not set -CONFIG_UDHCP_DEBUG=9 -# CONFIG_FEATURE_UDHCP_RFC3397 is not set -CONFIG_FEATURE_UDHCP_8021Q=y -CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script" -CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80 -CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n" -CONFIG_UDPSVD=y -CONFIG_VCONFIG=y -CONFIG_WGET=y -CONFIG_FEATURE_WGET_STATUSBAR=y -CONFIG_FEATURE_WGET_AUTHENTICATION=y -CONFIG_FEATURE_WGET_LONG_OPTIONS=y -CONFIG_FEATURE_WGET_TIMEOUT=y -CONFIG_ZCIP=y - -# -# Print Utilities -# -# CONFIG_LPD is not set -# CONFIG_LPR is not set -# CONFIG_LPQ is not set - -# -# Mail Utilities -# -# CONFIG_MAKEMIME is not set -CONFIG_FEATURE_MIME_CHARSET="" -# CONFIG_POPMAILDIR is not set -# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set -# CONFIG_REFORMIME is not set -# CONFIG_FEATURE_REFORMIME_COMPAT is not set -# CONFIG_SENDMAIL is not set - -# -# Process Utilities -# -CONFIG_IOSTAT=y -CONFIG_MPSTAT=y -CONFIG_NMETER=y -CONFIG_PMAP=y -CONFIG_POWERTOP=y -CONFIG_PSTREE=y -CONFIG_PWDX=y -CONFIG_SMEMCAP=y -CONFIG_UPTIME=y -CONFIG_FEATURE_UPTIME_UTMP_SUPPORT=y -CONFIG_FREE=y -CONFIG_FUSER=y -CONFIG_KILL=y -CONFIG_KILLALL=y -CONFIG_KILLALL5=y -CONFIG_PGREP=y -CONFIG_PIDOF=y -CONFIG_FEATURE_PIDOF_SINGLE=y -CONFIG_FEATURE_PIDOF_OMIT=y -CONFIG_PKILL=y -CONFIG_PS=y -CONFIG_FEATURE_PS_WIDE=y -# CONFIG_FEATURE_PS_TIME is not set -# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set -# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set -CONFIG_RENICE=y -CONFIG_BB_SYSCTL=y -CONFIG_TOP=y -CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y -CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y -# CONFIG_FEATURE_TOP_SMP_CPU is not set -# CONFIG_FEATURE_TOP_DECIMALS is not set -# CONFIG_FEATURE_TOP_SMP_PROCESS is not set -CONFIG_FEATURE_TOPMEM=y -CONFIG_FEATURE_SHOW_THREADS=y -CONFIG_WATCH=y - -# -# Runit Utilities -# -CONFIG_RUNSV=y -CONFIG_RUNSVDIR=y -# CONFIG_FEATURE_RUNSVDIR_LOG is not set -CONFIG_SV=y -CONFIG_SV_DEFAULT_SERVICE_DIR="/var/service" -CONFIG_SVLOGD=y -CONFIG_CHPST=y -CONFIG_SETUIDGID=y -CONFIG_ENVUIDGID=y -CONFIG_ENVDIR=y -CONFIG_SOFTLIMIT=y -# CONFIG_CHCON is not set -# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set -# CONFIG_GETENFORCE is not set -# CONFIG_GETSEBOOL is not set -# CONFIG_LOAD_POLICY is not set -# CONFIG_MATCHPATHCON is not set -# CONFIG_RESTORECON is not set -# CONFIG_RUNCON is not set -# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set -# CONFIG_SELINUXENABLED is not set -# CONFIG_SETENFORCE is not set -# CONFIG_SETFILES is not set -# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set -# CONFIG_SETSEBOOL is not set -# CONFIG_SESTATUS is not set - -# -# Shells -# -CONFIG_ASH=y -CONFIG_ASH_BASH_COMPAT=y -# CONFIG_ASH_IDLE_TIMEOUT is not set -CONFIG_ASH_JOB_CONTROL=y -# CONFIG_ASH_ALIAS is not set -# CONFIG_ASH_GETOPTS is not set -CONFIG_ASH_BUILTIN_ECHO=y -CONFIG_ASH_BUILTIN_PRINTF=y -CONFIG_ASH_BUILTIN_TEST=y -CONFIG_ASH_CMDCMD=y -# CONFIG_ASH_MAIL is not set -CONFIG_ASH_OPTIMIZE_FOR_SIZE=y -CONFIG_ASH_RANDOM_SUPPORT=y -# CONFIG_ASH_EXPAND_PRMT is not set -# CONFIG_CTTYHACK is not set -# CONFIG_HUSH is not set -# CONFIG_HUSH_BASH_COMPAT is not set -# CONFIG_HUSH_BRACE_EXPANSION is not set -# CONFIG_HUSH_HELP is not set -# CONFIG_HUSH_INTERACTIVE is not set -# CONFIG_HUSH_SAVEHISTORY is not set -# CONFIG_HUSH_JOB is not set -# CONFIG_HUSH_TICK is not set -# CONFIG_HUSH_IF is not set -# CONFIG_HUSH_LOOPS is not set -# CONFIG_HUSH_CASE is not set -# CONFIG_HUSH_FUNCTIONS is not set -# CONFIG_HUSH_LOCAL is not set -# CONFIG_HUSH_RANDOM_SUPPORT is not set -# CONFIG_HUSH_EXPORT_N is not set -# CONFIG_HUSH_MODE_X is not set -# CONFIG_MSH is not set -CONFIG_FEATURE_SH_IS_ASH=y -# CONFIG_FEATURE_SH_IS_HUSH is not set -# CONFIG_FEATURE_SH_IS_NONE is not set -# CONFIG_FEATURE_BASH_IS_ASH is not set -# CONFIG_FEATURE_BASH_IS_HUSH is not set -CONFIG_FEATURE_BASH_IS_NONE=y -CONFIG_SH_MATH_SUPPORT=y -# CONFIG_SH_MATH_SUPPORT_64 is not set -CONFIG_FEATURE_SH_EXTRA_QUIET=y -# CONFIG_FEATURE_SH_STANDALONE is not set -# CONFIG_FEATURE_SH_NOFORK is not set -CONFIG_FEATURE_SH_HISTFILESIZE=y - -# -# System Logging Utilities -# -CONFIG_SYSLOGD=y -CONFIG_FEATURE_ROTATE_LOGFILE=y -CONFIG_FEATURE_REMOTE_LOG=y -# CONFIG_FEATURE_SYSLOGD_DUP is not set -CONFIG_FEATURE_SYSLOGD_CFG=y -CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 -CONFIG_FEATURE_IPC_SYSLOG=y -CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 -CONFIG_LOGREAD=y -CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y -CONFIG_KLOGD=y -CONFIG_FEATURE_KLOGD_KLOGCTL=y -CONFIG_LOGGER=y diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/dropbear.conf b/openQRM-5.3.50-CE/src/etc/build.conf/dropbear.conf deleted file mode 100644 index 7866604..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/dropbear.conf +++ /dev/null @@ -1,23 +0,0 @@ -# Below the download locations for third-party components are defined -# dropbear -# -> we compile our own dropbear static binary -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="2012.55" -#OPENQRM_SOURCE_DOWNLOAD="http://matt.ucc.asn.au/dropbear/releases/dropbear-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/base/dropbear-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_BINARY_RESULT="dropbear-$OPENQRM_SOURCE_VERSION/dropbear" - - diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/htmlobjects.conf b/openQRM-5.3.50-CE/src/etc/build.conf/htmlobjects.conf deleted file mode 100644 index e8eaa81..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/htmlobjects.conf +++ /dev/null @@ -1,21 +0,0 @@ -# this is the config file for the htmlobjects -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_BASE_VERSION="1.1" -OPENQRM_SOURCE_VERSION="v1.1_r193" -#OPENQRM_SOURCE_DOWNLOAD="http://downloads.sourceforge.net/project/htmlobjects/htmlobjects/v.$OPENQRM_BASE_VERSION/htmlobjects_$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/base/htmlobjects_$OPENQRM_SOURCE_VERSION.tar.gz" -#OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/base/htmlobjects_v1.1_r193.tar.gz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/initrd-devices.conf b/openQRM-5.3.50-CE/src/etc/build.conf/initrd-devices.conf deleted file mode 100644 index cfceeda..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/initrd-devices.conf +++ /dev/null @@ -1,143 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# -# common devices -/dev d 755 0 0 - - - - - -#/dev/console c 666 0 0 5 1 - - - -/dev/null c 666 0 0 1 3 0 0 - -/dev/zero c 666 0 0 1 5 0 0 - -/dev/mem c 666 0 0 1 1 - - - -/dev/ram b 660 0 0 1 1 1 1 4 -/dev/tty c 660 0 0 4 0 0 1 10 -/dev/root b 660 0 0 0 255 0 0 - -/dev/nfs b 660 0 0 0 255 0 0 - -/dev/psaux c 666 0 0 10 1 0 0 - -/dev/loop b 660 0 0 7 0 0 1 6 -# special devices (cciss) -/dev/cciss d 755 0 0 - - - - - -/dev/cciss/c0d0 b 644 0 0 104 0 0 0 - -/dev/cciss/c0d0p b 644 0 0 104 1 1 1 15 -/dev/cciss/c0d1 b 644 0 0 104 16 0 0 - -/dev/cciss/c0d1p b 644 0 0 104 17 1 1 15 -/dev/cciss/c0d2 b 644 0 0 104 32 0 0 - -/dev/cciss/c0d2p b 644 0 0 104 33 1 1 15 -/dev/cciss/c0d3 b 644 0 0 104 48 0 0 - -/dev/cciss/c0d3p b 644 0 0 104 49 1 1 15 -/dev/cciss/c1d0 b 644 0 0 105 0 0 0 - -/dev/cciss/c1d0p b 644 0 0 105 1 1 1 15 -/dev/cciss/c1d1 b 644 0 0 105 16 0 0 - -/dev/cciss/c1d1p b 644 0 0 105 17 1 1 15 -/dev/cciss/c1d2 b 644 0 0 105 32 0 0 - -/dev/cciss/c1d2p b 644 0 0 105 33 1 1 15 -/dev/cciss/c1d3 b 644 0 0 105 48 0 0 - -/dev/cciss/c1d3p b 644 0 0 105 49 1 1 15 -# ide disks -/dev/hda b 640 0 0 3 0 0 0 - -/dev/hda b 640 0 0 3 1 1 1 24 -/dev/hdb b 640 0 0 3 64 0 0 - -/dev/hdb b 640 0 0 3 65 1 1 24 -/dev/hdc b 640 0 0 22 0 0 0 - -/dev/hdc b 640 0 0 22 1 1 1 24 -/dev/hdd b 640 0 0 22 64 0 0 - -/dev/hdd b 640 0 0 22 65 1 1 24 -/dev/hde b 640 0 0 33 0 0 0 - -/dev/hde b 640 0 0 33 1 1 1 24 -/dev/hdf b 640 0 0 33 64 0 0 - -/dev/hdf b 640 0 0 33 65 1 1 24 -/dev/hdg b 640 0 0 34 0 0 0 - -/dev/hdg b 640 0 0 34 1 1 1 24 -/dev/hdh b 640 0 0 34 64 0 0 - -/dev/hdh b 640 0 0 34 65 1 1 24 -# scsi disks -/dev/sda b 660 0 0 8 0 0 1 - -/dev/sda b 660 0 0 8 1 1 1 15 -/dev/sdb b 660 0 0 8 16 0 1 - -/dev/sdb b 660 0 0 8 17 1 1 15 -/dev/sdc b 660 0 0 8 32 0 1 - -/dev/sdc b 660 0 0 8 33 1 1 15 -/dev/sdd b 660 0 0 8 48 0 1 - -/dev/sdd b 660 0 0 8 49 1 1 15 -/dev/sde b 660 0 0 8 64 0 1 - -/dev/sde b 660 0 0 8 65 1 1 15 -/dev/sdf b 660 0 0 8 80 0 1 - -/dev/sdf b 660 0 0 8 81 1 1 15 -/dev/sdg b 660 0 0 8 96 0 1 - -/dev/sdg b 660 0 0 8 97 1 1 15 -/dev/sdh b 660 0 0 8 112 0 1 - -/dev/sdh b 660 0 0 8 113 1 1 15 -/dev/sdi b 660 0 0 8 128 0 1 - -/dev/sdi b 660 0 0 8 129 1 1 15 -/dev/sdj b 660 0 0 8 144 0 1 - -/dev/sdj b 660 0 0 8 145 1 1 15 -/dev/sdk b 660 0 0 8 160 0 1 - -/dev/sdk b 660 0 0 8 161 1 1 15 -/dev/sdl b 660 0 0 8 176 0 1 - -/dev/sdl b 660 0 0 8 177 1 1 15 -/dev/sdm b 660 0 0 8 192 0 1 - -/dev/sdm b 660 0 0 8 193 1 1 15 -/dev/sdn b 660 0 0 8 208 0 1 - -/dev/sdn b 660 0 0 8 209 1 1 15 -/dev/sdo b 660 0 0 8 224 0 1 - -/dev/sdo b 660 0 0 8 225 1 1 15 -/dev/sdp b 660 0 0 8 240 0 1 - -/dev/sdp b 660 0 0 8 241 1 1 15 -/dev/sdq b 660 0 0 65 0 0 1 - -/dev/sdq b 660 0 0 65 1 1 1 15 -/dev/sdr b 660 0 0 65 16 0 1 - -/dev/sdr b 660 0 0 65 17 1 1 15 -/dev/sds b 660 0 0 65 32 0 1 - -/dev/sds b 660 0 0 65 33 1 1 15 -/dev/sdt b 660 0 0 65 48 0 1 - -/dev/sdt b 660 0 0 65 49 1 1 15 -/dev/sdu b 660 0 0 65 64 0 1 - -/dev/sdu b 660 0 0 65 65 1 1 15 -/dev/sdv b 660 0 0 65 80 0 1 - -/dev/sdv b 660 0 0 65 81 1 1 15 -/dev/sdw b 660 0 0 65 96 0 1 - -/dev/sdw b 660 0 0 65 97 1 1 15 -/dev/sdx b 660 0 0 65 112 0 1 - -/dev/sdx b 660 0 0 65 113 1 1 15 -/dev/sdy b 660 0 0 65 128 0 1 - -/dev/sdy b 660 0 0 65 129 1 1 15 -/dev/sdz b 660 0 0 65 144 0 1 - -/dev/sdz b 660 0 0 65 145 1 1 15 -/dev/sdaa b 660 0 0 65 160 0 1 - -/dev/sdaa b 660 0 0 65 161 1 1 15 -/dev/sdab b 660 0 0 65 176 0 1 - -/dev/sdab b 660 0 0 65 177 1 1 15 -/dev/sdac b 660 0 0 65 192 0 1 - -/dev/sdac b 660 0 0 65 193 1 1 15 -/dev/sdad b 660 0 0 65 208 0 1 - -/dev/sdad b 660 0 0 65 209 1 1 15 -/dev/sdae b 660 0 0 65 224 0 1 - -/dev/sdae b 660 0 0 65 225 1 1 15 -/dev/sdaf b 660 0 0 65 240 0 1 - -/dev/sdaf b 660 0 0 65 241 1 1 15 - - - - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/jqclock.conf b/openQRM-5.3.50-CE/src/etc/build.conf/jqclock.conf deleted file mode 100644 index fa5f2e2..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/jqclock.conf +++ /dev/null @@ -1,18 +0,0 @@ -# this is the config file for the jqClock plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="2.0.1" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/base/jqclock-$OPENQRM_SOURCE_VERSION.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/jquery.conf b/openQRM-5.3.50-CE/src/etc/build.conf/jquery.conf deleted file mode 100644 index 526fe26..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/jquery.conf +++ /dev/null @@ -1,18 +0,0 @@ -# this is the config file for the jquery bundle -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="1.3.2" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/base/jquery-$OPENQRM_SOURCE_VERSION.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/js-interface.conf b/openQRM-5.3.50-CE/src/etc/build.conf/js-interface.conf deleted file mode 100644 index 095bc6d..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/js-interface.conf +++ /dev/null @@ -1,19 +0,0 @@ -# this is the config file for the js interface -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="1.2" -#OPENQRM_SOURCE_DOWNLOAD="http://interface.eyecon.ro/interface/interface_$OPENQRM_SOURCE_VERSION.zip" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/base/interface_$OPENQRM_SOURCE_VERSION.zip" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-client.centos.x86_64.conf b/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-client.centos.x86_64.conf deleted file mode 100644 index 3cfd842..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-client.centos.x86_64.conf +++ /dev/null @@ -1,19 +0,0 @@ -# this is the config file for the centos x86_64 openqrm-client -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="5.3" -OPENQRM_SOURCE_SUB_VERSION="5.3.0" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/$OPENQRM_SOURCE_VERSION/base/openqrm-client/openqrm-client.$OPENQRM_SOURCE_SUB_VERSION.centos.x86_64.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-client.debian.x86_64.conf b/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-client.debian.x86_64.conf deleted file mode 100644 index 51769c8..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-client.debian.x86_64.conf +++ /dev/null @@ -1,19 +0,0 @@ -# this is the config file for the debian x86_64 openqrm-client -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="5.3" -OPENQRM_SOURCE_SUB_VERSION="5.3.0" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/$OPENQRM_SOURCE_VERSION/base/openqrm-client/openqrm-client.$OPENQRM_SOURCE_SUB_VERSION.debian.x86_64.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-client.ubuntu.x86_64.conf b/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-client.ubuntu.x86_64.conf deleted file mode 100644 index 1a12f0e..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-client.ubuntu.x86_64.conf +++ /dev/null @@ -1,19 +0,0 @@ -# this is the config file for the ubuntu x86_64 openqrm-client -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="5.3" -OPENQRM_SOURCE_SUB_VERSION="5.3.0" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/$OPENQRM_SOURCE_VERSION/base/openqrm-client/openqrm-client.$OPENQRM_SOURCE_SUB_VERSION.ubuntu.x86_64.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-initrd-template.centos.x86_64.conf b/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-initrd-template.centos.x86_64.conf deleted file mode 100644 index 09d610e..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-initrd-template.centos.x86_64.conf +++ /dev/null @@ -1,19 +0,0 @@ -# this is the config file for the centos x86_64 initrd template -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="5.3" -OPENQRM_SOURCE_SUB_VERSION="5.3.1" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/$OPENQRM_SOURCE_VERSION/base/openqrm-initrd-templates/openqrm-initrd-template.$OPENQRM_SOURCE_SUB_VERSION.centos.x86_64.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-initrd-template.debian.x86_64.conf b/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-initrd-template.debian.x86_64.conf deleted file mode 100644 index ae1cec6..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-initrd-template.debian.x86_64.conf +++ /dev/null @@ -1,19 +0,0 @@ -# this is the config file for the debian x86_64 initrd template -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="5.3" -OPENQRM_SOURCE_SUB_VERSION="5.3.1" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/$OPENQRM_SOURCE_VERSION/base/openqrm-initrd-templates/openqrm-initrd-template.$OPENQRM_SOURCE_SUB_VERSION.debian.x86_64.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-initrd-template.ubuntu.x86_64.conf b/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-initrd-template.ubuntu.x86_64.conf deleted file mode 100644 index 3b180c5..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/openqrm-initrd-template.ubuntu.x86_64.conf +++ /dev/null @@ -1,19 +0,0 @@ -# this is the config file for the ubuntu x86_64 initrd template -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="5.3" -OPENQRM_SOURCE_SUB_VERSION="5.3.1" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/$OPENQRM_SOURCE_VERSION/base/openqrm-initrd-templates/openqrm-initrd-template.$OPENQRM_SOURCE_SUB_VERSION.ubuntu.x86_64.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/pciutils-pcimodules.patch b/openQRM-5.3.50-CE/src/etc/build.conf/pciutils-pcimodules.patch deleted file mode 100644 index 79176dd..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/pciutils-pcimodules.patch +++ /dev/null @@ -1,217 +0,0 @@ -diff -rupN pciutils-3.1.7/Makefile pciutils-3.1.7-pcimodules-patch/Makefile ---- pciutils-3.1.7/Makefile 2010-01-31 18:42:12.000000000 +0100 -+++ pciutils-3.1.7-pcimodules-patch/Makefile 2011-01-24 16:36:21.276060766 +0100 -@@ -52,7 +52,7 @@ PCIINC_INS=lib/config.h lib/header.h lib - - export - --all: lib/$(PCILIB) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS) -+all: lib/$(PCILIB) lspci setpci pcimodules example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS) - - lib/$(PCILIB): $(PCIINC) force - $(MAKE) -C lib all -@@ -62,6 +62,7 @@ force: - lib/config.h lib/config.mk: - cd lib && ./configure - -+pcimodules: pcimodules.o common.o lib/$(PCILIB) - lspci: lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/$(PCILIB) - setpci: setpci.o common.o lib/$(PCILIB) - -@@ -74,6 +75,7 @@ ls-kernel.o: ls-kernel.c $(LSPCIINC) - ls-tree.o: ls-tree.c $(LSPCIINC) - ls-map.o: ls-map.c $(LSPCIINC) - -+pcimodules.o: pcimodules.c pciutils.h $(PCIINC) - setpci.o: setpci.c pciutils.h $(PCIINC) - common.o: common.c pciutils.h $(PCIINC) - -diff -rupN pciutils-3.1.7/pcimodules.c pciutils-3.1.7-pcimodules-patch/pcimodules.c ---- pciutils-3.1.7/pcimodules.c 1970-01-01 01:00:00.000000000 +0100 -+++ pciutils-3.1.7-pcimodules-patch/pcimodules.c 2011-01-24 16:34:02.607310722 +0100 -@@ -0,0 +1,185 @@ -+/* -+ * pcimodules: Load all kernel modules for PCI device currently -+ * plugged into any PCI slot. -+ * -+ * Copyright 2000 Yggdrasil Computing, Incorporated -+ * This file may be copied under the terms and conditions of version -+ * two of the GNU General Public License, as published by the Free -+ * Software Foundation (Cambridge, Massachusetts, USA). -+ * -+ * This file is based on pciutils/lib/example.c, which has the following -+ * authorship and copyright statement: -+ * -+ * Written by Martin Mares and put to public domain. You can do -+ * with it anything you want, but I don't give you any warranty. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define _GNU_SOURCE -+#include -+ -+#include "pciutils.h" -+ -+#define MODDIR "/lib/modules" -+#define PCIMAP "modules.pcimap" -+ -+#define LINELENGTH 8000 -+ -+#define DEVICE_ANY 0xffffffff -+#define VENDOR_ANY 0xffffffff -+ -+#include "lib/pci.h" -+ -+const char program_name[] = "pcimodules"; -+ -+struct pcimap_entry { -+ unsigned int vendor, subsys_vendor, dev, subsys_dev, class, class_mask; -+ char *module; -+ struct pcimap_entry *next; -+}; -+ -+static struct pcimap_entry *pcimap_list = NULL; -+ -+#define OPT_STRING "h" -+static struct option long_options[] = { -+ {"class", required_argument, NULL, 'c'}, -+ {"classmask", required_argument, NULL, 'm'}, -+ {"help", no_argument, NULL, 'h'}, -+ { 0, 0, 0, 0} -+}; -+ -+static unsigned long desired_class; -+static unsigned long desired_classmask; /* Default is 0: accept all classes.*/ -+ -+void -+read_pcimap(void) -+{ -+ struct utsname utsname; -+ char filename[MAXPATHLEN]; -+ FILE *pcimap_file; -+ char line[LINELENGTH]; -+ struct pcimap_entry *entry; -+ unsigned int driver_data; -+ char *prevmodule = ""; -+ char module[LINELENGTH]; -+ -+ if (uname(&utsname) < 0) { -+ perror("uname"); -+ exit(1); -+ } -+ sprintf(filename, "%s/%s/%s", MODDIR, utsname.release, PCIMAP); -+ if ((pcimap_file = fopen(filename, "r")) == NULL) { -+ perror(filename); -+ exit(1); -+ } -+ -+ while(fgets(line, LINELENGTH, pcimap_file) != NULL) { -+ if (line[0] == '#') -+ continue; -+ -+ entry = xmalloc(sizeof(struct pcimap_entry)); -+ -+ if (sscanf(line, "%s 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", -+ module, -+ &entry->vendor, &entry->dev, -+ &entry->subsys_vendor, &entry->subsys_dev, -+ &entry->class, &entry->class_mask, -+ &driver_data) != 8) { -+ fprintf (stderr, -+ "modules.pcimap unparsable line: %s.\n", line); -+ free(entry); -+ continue; -+ } -+ -+ /* Optimize memory allocation a bit, in case someday we -+ have Linux systems with ~100,000 modules. It also -+ allows us to just compare pointers to avoid trying -+ to load a module twice. */ -+ if (strcmp(module, prevmodule) != 0) { -+ prevmodule = xmalloc(strlen(module)+1); -+ strcpy(prevmodule, module); -+ } -+ entry->module = prevmodule; -+ entry->next = pcimap_list; -+ pcimap_list = entry; -+ } -+ fclose(pcimap_file); -+} -+ -+/* Return a filled in pci_access->dev tree, with the device classes -+ stored in dev->aux. -+*/ -+static void -+match_pci_modules(void) -+{ -+ struct pci_access *pacc; -+ struct pci_dev *dev; -+ unsigned int class, subsys_dev, subsys_vendor; -+ struct pcimap_entry *map; -+ const char *prevmodule = ""; -+ -+ pacc = pci_alloc(); /* Get the pci_access structure */ -+ /* Set all options you want -- here we stick with the defaults */ -+ pci_init(pacc); /* Initialize the PCI library */ -+ pci_scan_bus(pacc); /* We want to get the list of devices */ -+ for(dev=pacc->devices; dev; dev=dev->next) { -+ pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES); -+ class = (pci_read_word(dev, PCI_CLASS_DEVICE) << 8) -+ | pci_read_byte(dev, PCI_CLASS_PROG); -+ subsys_dev = pci_read_word(dev, PCI_SUBSYSTEM_ID); -+ subsys_vendor = pci_read_word(dev,PCI_SUBSYSTEM_VENDOR_ID); -+ for(map = pcimap_list; map != NULL; map = map->next) { -+ if (((map->class ^ class) & map->class_mask) == 0 && -+ ((desired_class ^ class) & desired_classmask)==0 && -+ (map->dev == DEVICE_ANY || -+ map->dev == dev->device_id) && -+ (map->vendor == VENDOR_ANY || -+ map->vendor == dev->vendor_id) && -+ (map->subsys_dev == DEVICE_ANY || -+ map->subsys_dev == subsys_dev) && -+ (map->subsys_vendor == VENDOR_ANY || -+ map->subsys_vendor == subsys_vendor) && -+ prevmodule != map->module) { -+ printf("%s\n", map->module); -+ prevmodule = map->module; -+ } -+ } -+ -+ } -+ pci_cleanup(pacc); -+} -+ -+int -+main (int argc, char **argv) -+{ -+ int opt_index = 0; -+ int opt; -+ -+ while ((opt = getopt_long(argc, argv, OPT_STRING, long_options, -+ &opt_index)) != -1) { -+ switch(opt) { -+ case 'c': -+ desired_class = strtol(optarg, NULL, 0); -+ break; -+ case 'm': -+ desired_classmask = strtol(optarg, NULL, 0); -+ break; -+ case 'h': -+ printf ("Usage: pcimodules [--help]\n" -+ " Lists kernel modules corresponding to PCI devices currently plugged" -+ " into the computer.\n"); -+ } -+ } -+ -+ read_pcimap(); -+ match_pci_modules(); -+ return 0; -+} diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/pciutils.conf b/openQRM-5.3.50-CE/src/etc/build.conf/pciutils.conf deleted file mode 100644 index 44a1995..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/pciutils.conf +++ /dev/null @@ -1,22 +0,0 @@ -# Below the download locations for third-party components are defined -# pciutils -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="3.1.7" -#OPENQRM_SOURCE_DOWNLOAD="http://www.kernel.org/pub/software/utils/pciutils/pciutils-$OPENQRM_SOURCE_VERSION.tar.gz" -#OPENQRM_SOURCE_DOWNLOAD="http://pkgs.fedoraproject.org/repo/pkgs/pciutils/pciutils-3.1.7.tar.gz/f3e349d22a3714b4272b171649ad5235/pciutils-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/base/pciutils-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_BINARY_RESULT="pciutils-$OPENQRM_SOURCE_VERSION/pcimodules" - diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/phplib.conf b/openQRM-5.3.50-CE/src/etc/build.conf/phplib.conf deleted file mode 100644 index 3d0efe5..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/phplib.conf +++ /dev/null @@ -1,18 +0,0 @@ -# this is the config file for the phplib class -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/base/phplib.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/treemenuicons.conf b/openQRM-5.3.50-CE/src/etc/build.conf/treemenuicons.conf deleted file mode 100644 index 08e373f..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/treemenuicons.conf +++ /dev/null @@ -1,18 +0,0 @@ -# this is the config file for the treemenu icons -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="0.1" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/base/treemenu-icons.$OPENQRM_SOURCE_VERSION.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/build.conf/treemenujs.conf b/openQRM-5.3.50-CE/src/etc/build.conf/treemenujs.conf deleted file mode 100644 index 67d1ddf..0000000 --- a/openQRM-5.3.50-CE/src/etc/build.conf/treemenujs.conf +++ /dev/null @@ -1,18 +0,0 @@ -# this is the config file for the treemenu js -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="0.1" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/base/treemenu-js.$OPENQRM_SOURCE_VERSION.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/etc/db/db2/README b/openQRM-5.3.50-CE/src/etc/db/db2/README deleted file mode 100644 index 6fe971a..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/db2/README +++ /dev/null @@ -1,19 +0,0 @@ -openqrm-server.conf setup for db2 database : - -OPENQRM_DATABASE_TYPE="db2" # supported are : mysql, oracle, db2, postgres -OPENQRM_DATABASE_SERVER="localhost" # ip-address of the database server -OPENQRM_DATABASE_NAME="openqrm" # database name -OPENQRM_DATABASE_USER="db2inst1" # database user -OPENQRM_DATABASE_PASSWORD="" # database password - - -Hints to compile php + db2 support : - -# configure and compile php -./configure i386-redhat-linux --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-config-file-path=/etc --enable-track-vars --with-apxs=/usr/sbin/apxs --with-ibm-db2=/home/db2inst1/sqllib/ --no-create --no-recursion -make -make install - -in db2cc create database e.g. "openqrm" -add user apache to openqrm-database users, add shema db2inst1 to user apachhe, grant all, allow usage of all tablespaces. - diff --git a/openQRM-5.3.50-CE/src/etc/db/db2/openqrm-db2-functions b/openQRM-5.3.50-CE/src/etc/db/db2/openqrm-db2-functions deleted file mode 100644 index 67a883a..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/db2/openqrm-db2-functions +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash -# openQRM db2-specfic functions -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SERVER_BASE_DIR before sourcing $0" - exit 1 -fi - -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -OPENQRM_DATABASE_INIT="$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/db2/openqrm-db2-init.sql" - - -function initialize_database() { - - if ! which db2 1>/dev/null 2>&1; then - echo "ERROR: DB2 client 'db2' not installed/found on this system" - return 1 - else - DB2_CLIENT=`which db2` - fi - - echo "Initializing the openQRM-database" - cat $OPENQRM_DATABASE_INIT | \ - sed -e "s/connect to OPENQRM_DB/connect to $OPENQRM_DATABASE_NAME/g" | \ - sed -e "s/OPENQRM_SERVER_IP_ADDRESS/$OPENQRM_SERVER_IP_ADDRESS/g" \ - > /tmp/openqrm-db2-init.sql - chmod 777 /tmp/openqrm-db2-init.sql - su - $OPENQRM_DATABASE_USER -c "$DB2_CLIENT -vf /tmp/openqrm-db2-init.sql" - rm -f /tmp/openqrm-db2-init.sql - # db2 client does not return good - return 0 - -} - - -function backup_database() { - local SQL=$1 - echo "Creating backup of the openQRM-database at $SQL" - echo "NOTICE: Backup for DB2 databases not yet implemented" - return $RET - -} - -function restore_database() { - local SQL=$1 - echo "Restoring the openQRM-database from $SQL" - echo "NOTICE: Restore for DB2 databases not yet implemented" - return $RET - -} - -function drop_database() { - echo "Dropping the openQRM-database" - echo "NOTICE: Drop for DB2 databases not yet implemented" - return $RET -} - -case "$1" in - init) - initialize_database - ;; - backup) - backup_database $2 - ;; - restore) - restore_database $2 - ;; - drop) - drop_database - ;; -esac diff --git a/openQRM-5.3.50-CE/src/etc/db/db2/openqrm-db2-init.sql b/openQRM-5.3.50-CE/src/etc/db/db2/openqrm-db2-init.sql deleted file mode 100644 index 6d072e2..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/db2/openqrm-db2-init.sql +++ /dev/null @@ -1,240 +0,0 @@ -connect to OPENQRM_DB - -drop table resource_info -create table resource_info( \ - resource_id bigint not null, \ - resource_localboot bigint, \ - resource_kernel varchar(50), \ - resource_kernelid bigint, \ - resource_image varchar(50), \ - resource_imageid bigint, \ - resource_openqrmserver varchar(20), \ - resource_basedir varchar(100), \ - resource_applianceid bigint, \ - resource_ip varchar(20), \ - resource_subnet varchar(20), \ - resource_broadcast varchar(20), \ - resource_network varchar(20), \ - resource_mac varchar(20), \ - resource_nics bigint, \ - resource_uptime bigint, \ - resource_cpunumber bigint, \ - resource_cpuspeed bigint, \ - resource_cpumodel varchar(255), \ - resource_memtotal bigint, \ - resource_memused bigint, \ - resource_swaptotal bigint, \ - resource_swapused bigint, \ - resource_hostname varchar(60), \ - resource_vtype bigint, \ - resource_vhostid bigint, \ - resource_vname varchar(255), \ - resource_vnc varchar(30), \ - resource_load decimal(4,2), \ - resource_execdport bigint, \ - resource_senddelay bigint, \ - resource_capabilities varchar(255), \ - resource_lastgood varchar(10), \ - resource_state varchar(20), \ - resource_event varchar(20), \ - primary key(resource_id) \ -) - - -drop table kernel_info -create table kernel_info( \ - kernel_id bigint not null, \ - kernel_name varchar(255), \ - kernel_version varchar(50), \ - kernel_capabilities varchar(255), \ - kernel_comment varchar(255), \ - primary key(kernel_id) \ -) - - - -drop table image_info -create table image_info( \ - image_id bigint not null, \ - image_name varchar(255), \ - image_version varchar(30), \ - image_type varchar(255), \ - image_rootdevice varchar(255), \ - image_rootfstype varchar(255), \ - image_size bigint, \ - image_storageid bigint, \ - image_deployment_parameter varchar(1000), \ - image_isshared bigint, \ - image_isactive bigint, \ - image_comment varchar(255), \ - image_capabilities varchar(255), \ - primary key(image_id) \ -) - - -drop table appliance_info -create table appliance_info( \ - appliance_id bigint not null, \ - appliance_name varchar(50), \ - appliance_kernelid bigint, \ - appliance_imageid bigint, \ - appliance_starttime bigint, \ - appliance_stoptime bigint, \ - appliance_cpunumber bigint, \ - appliance_cpuspeed bigint, \ - appliance_cpumodel varchar(255), \ - appliance_memtotal bigint, \ - appliance_swaptotal bigint, \ - appliance_nics bigint, \ - appliance_capabilities varchar(1000), \ - appliance_cluster bigint, \ - appliance_ssi bigint, \ - appliance_resources bigint, \ - appliance_highavailable bigint, \ - appliance_virtual bigint, \ - appliance_virtualization varchar(20), \ - appliance_virtualization_host bigint, \ - appliance_state varchar(20), \ - appliance_comment varchar(255), \ - appliance_wizard varchar(255), \ - appliance_event varchar(20), \ - primary key(appliance_id) \ -) - - -drop table event_info -create table event_info( \ - event_id bigint not null, \ - event_name varchar(50), \ - event_time varchar(50), \ - event_priority bigint, \ - event_source varchar(50), \ - event_description varchar(255), \ - event_comment varchar(100), \ - event_capabilities varchar(255), \ - event_status bigint, \ - event_image_id bigint, \ - event_resource_id bigint, \ - primary key(event_id) \ -) - - - -drop table user_info -create table user_info( \ - user_id bigint not null, \ - user_name varchar(20), \ - user_password varchar(20), \ - user_gender varchar(1), \ - user_first_name varchar(50), \ - user_last_name varchar(50), \ - user_department varchar(50), \ - user_office varchar(50), \ - user_role bigint, \ - user_last_update_time varchar(50), \ - user_description varchar(255), \ - user_capabilities varchar(255), \ - user_wizard_name varchar(255), \ - user_wizard_step bigint, \ - user_wizard_id bigint, \ - user_state varchar(20), \ - user_lang varchar(5), \ - primary key(user_id) \ -) - -drop table role_info -create table role_info( \ - role_id bigint not null, \ - role_name varchar(20) \ -) - -drop table storage_info -create table storage_info( \ - storage_id bigint not null, \ - storage_name varchar(255), \ - storage_resource_id bigint, \ - storage_type bigint, \ - storage_comment varchar(100), \ - storage_capabilities varchar(255), \ - storage_state varchar(20), \ - primary key(storage_id) \ -) - - -drop table resource_service -create table resource_service ( \ - resource_id bigint not null, \ - service varchar(50), \ - primary key(resource_id) \ -) - -drop table image_service -create table image_service ( \ - image_id bigint not null, \ - service varchar(50), \ - primary key(image_id) \ -) - -drop table image_authentication_info -create table image_authentication_info ( \ - ia_id bigint not null, \ - ia_image_id bigint, \ - ia_resource_id bigint, \ - ia_auth_type bigint \ -) - -drop table auth_blocker_info -create table auth_blocker_info ( \ - ab_id bigint not null, \ - ab_image_id bigint, \ - ab_image_name varchar(255), \ - ab_start_time varchar(20) \ -) - -drop table deployment_info -create table deployment_info( \ - deployment_id bigint not null, \ - deployment_storagetype_id bigint \ - deployment_name varchar(50), \ - deployment_type varchar(50) \ - deployment_description varchar(50) \ - deployment_storagetype varchar(50) \ - deployment_storagedescription varchar(50) \ - deployment_mapping varchar(255) \ -) - -drop table virtualization_info -create table virtualization_info( \ - virtualization_id bigint not null, \ - virtualization_name varchar(50), \ - virtualization_type varchar(50), \ - virtualization_mapping varchar(255) \ -) - - -drop table datacenter_info -create table datacenter_info( \ - datacenter_id bigint not null, \ - datacenter_load_overall varchar(50), \ - datacenter_load_server varchar(50), \ - datacenter_load_storage varchar(50), \ - datacenter_cpu_total varchar(50), \ - datacenter_mem_total varchar(50), \ - datacenter_mem_used varchar(50) \ -) - - -insert into kernel_info (kernel_id, kernel_name, kernel_version) values (0, 'openqrm', 'openqrm'); -insert into image_info (image_id, image_name, image_version, image_type, image_rootdevice, image_isshared) values (0, 'openqrm', 'openqrm', 'ram', 'ram', 0); - -insert into image_info (image_id, image_name, image_version, image_type, image_rootdevice, image_rootfstype, image_isshared) values (1, 'idle', 'openqrm', 'ram', 'ram', 'ext2', 1) -insert into resource_info (resource_id, resource_localboot, resource_kernel, resource_image, resource_openqrmserver, resource_ip) values (0, 1, 'local', 'local', 'OPENQRM_SERVER_IP_ADDRESS', 'OPENQRM_SERVER_IP_ADDRESS') -insert into deployment_info (deployment_id, deployment_name, deployment_type, deployment_description, deployment_storagetype, deployment_storagedescription ) values (1, 'ramdisk', 'ram', 'Ramdisk Deployment', 'none', 'none'); -insert into virtualization_info (virtualization_id, virtualization_name, virtualization_type) values (1, 'Physical System', 'physical') -insert into user_info (user_id, user_name, user_password, user_gender, user_first_name, user_last_name, user_department, user_office, user_role, user_last_update_time, user_description, user_capabilities, user_state, user_lang) values (0, 'openqrm', 'openqrm', '-', '-', '-', '-', '-', 0, '-', 'default admin user', '', 'activated', 'en') -insert into user_info (user_id, user_name, user_password, user_gender, user_first_name, user_last_name, user_department, user_office, user_role, user_last_update_time, user_description, user_capabilities, user_state, user_lang) values (1, 'anonymous', 'openqrm', '-', '-', '-', '-', '-', 1, '-', 'default readonly user', '', 'activated', 'en') -insert into role_info (role_id, role_name) values (0, 'administrator') -insert into role_info (role_id, role_name) values (1, 'readonly') - - - diff --git a/openQRM-5.3.50-CE/src/etc/db/mysql/README b/openQRM-5.3.50-CE/src/etc/db/mysql/README deleted file mode 100644 index 6462472..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/mysql/README +++ /dev/null @@ -1,7 +0,0 @@ -LAMP setup for openqrm-server.conf : - -OPENQRM_DATABASE_TYPE="mysql" # supported are : mysql, oracle, db2 and postgres -OPENQRM_DATABASE_SERVER="localhost" # ip-address of the database server -OPENQRM_DATABASE_NAME="openqrm" # database name -OPENQRM_DATABASE_USER="root" # database user -OPENQRM_DATABASE_PASSWORD="" # database password diff --git a/openQRM-5.3.50-CE/src/etc/db/mysql/openqrm-mysql-functions b/openQRM-5.3.50-CE/src/etc/db/mysql/openqrm-mysql-functions deleted file mode 100644 index b8c51b6..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/mysql/openqrm-mysql-functions +++ /dev/null @@ -1,772 +0,0 @@ -#!/bin/bash -# openQRM mysql-specfic functions -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SERVER_BASE_DIR before sourcing $0" - exit 1 -fi - -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - -# get full server config -openqrm_server_get_config -OPENQRM_DATABASE_INIT="$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/mysql/openqrm-mysql-init.sql" - -OPENQRM_DATABASE_MAINTENANCE="$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/mysql/openqrm-mysql-maintenance" -OPENQRM_DATABASE_MAINTENANCE_FNAME=`basename $OPENQRM_DATABASE_MAINTENANCE` - -if ! which mysql 1>/dev/null 2>&1; then - echo "ERROR: Mysql client 'mysql' not installed/found on this system" - exit 1 -else - export MYSQL_CLIENT=`which mysql` -fi -if ! which mysqldump 1>/dev/null 2>&1; then - echo "ERROR: Mysql 'mysqldump' not installed/found on this system" - exit 1 -else - export MYSQL_DUMP=`which mysqldump` -fi -if ! which mysqladmin 1>/dev/null 2>&1; then - echo "ERROR: Mysql 'mysqladmin' not installed/found on this system" - exit 1 -else - export MYSQL_ADMIN=`which mysqladmin` -fi - - - -function initialize_database() { - # set the dbname in the sql init-script - OPENQRM_DATABASE_INIT_TMP=/tmp/openqrm-mysql-init.sql - cat $OPENQRM_DATABASE_INIT | \ - sed -e "s/OPENQRM_DB/$OPENQRM_DATABASE_NAME/g" | \ - sed -e "s/OPENQRM_SERVER_IP_ADDRESS/$OPENQRM_SERVER_IP_ADDRESS/g" \ - > $OPENQRM_DATABASE_INIT_TMP - - echo "Initializing the openQRM-database" - - if [ -z "$OPENQRM_DATABASE_PASSWORD" ]; then - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER --host $OPENQRM_DATABASE_SERVER -e "drop database $OPENQRM_DATABASE_NAME" 1>/dev/null 2>&1 - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER --host $OPENQRM_DATABASE_SERVER < $OPENQRM_DATABASE_INIT_TMP 2>&1 - RET="${PIPESTATUS[0]}" - else - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER -p$OPENQRM_DATABASE_PASSWORD --host $OPENQRM_DATABASE_SERVER -e "drop database $OPENQRM_DATABASE_NAME" 1>/dev/null 2>&1 - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER -p$OPENQRM_DATABASE_PASSWORD --host $OPENQRM_DATABASE_SERVER < $OPENQRM_DATABASE_INIT_TMP 2>&1 - RET="${PIPESTATUS[0]}" - fi - - rm -f $OPENQRM_DATABASE_INIT_TMP - - # check for mariadb authentication - if [ -z "$OPENQRM_DATABASE_PASSWORD" ]; then - OPENQRM_DATABASE_PASSWORD_PARAM="" - PASSWORD_SET="0" - else - OPENQRM_DATABASE_PASSWORD_PARAM="-p$OPENQRM_DATABASE_PASSWORD" - PASSWORD_SET="1" - fi - - # this is only needed for Debian -# if [ -f /etc/debian_version ]; then -# if $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER $OPENQRM_DATABASE_PASSWORD_PARAM --host $OPENQRM_DATABASE_SERVER -e "status" | grep -i maria 1>/dev/null; then -# echo "openQRM init database: Mariadb detected, applying mysql_native_password authentication" | logger -# if [ "$PASSWORD_SET" == "1" ]; then -# $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER $OPENQRM_DATABASE_PASSWORD_PARAM --host $OPENQRM_DATABASE_SERVER -e "update mysql.user set Password=PASSWORD(\"$OPENQRM_DATABASE_PASSWORD\") where User=\"$OPENQRM_DATABASE_USER\";flush privileges;" -# fi -# $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER $OPENQRM_DATABASE_PASSWORD_PARAM --host $OPENQRM_DATABASE_SERVER -e "update mysql.user set plugin='mysql_native_password';flush privileges;" -# fi -# fi - - # add the db maintenance to cron - cat $OPENQRM_DATABASE_MAINTENANCE | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" > /etc/cron.daily/$OPENQRM_DATABASE_MAINTENANCE_FNAME - chmod +x /etc/cron.daily/$OPENQRM_DATABASE_MAINTENANCE_FNAME - if [ -x "/etc/init.d/cron" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d cron reload - else - /etc/init.d/cron reload - fi - elif [ -x "/etc/init.d/crond" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d crond reload - else - /etc/init.d/crond reload - fi - else - echo "Could not find cron init script in /etc/init.d/. Please reload cron manually!" - fi - - return $RET -} - -function backup_database() { - local SQL=$1 - echo "Creating backup of the openQRM-database at $SQL" - if [ -z "$OPENQRM_DATABASE_PASSWORD" ]; then - $MYSQL_DUMP -u $OPENQRM_DATABASE_USER --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME > $SQL - RET=$? - else - $MYSQL_DUMP -u $OPENQRM_DATABASE_USER -p$OPENQRM_DATABASE_PASSWORD --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME > $SQL - RET=$? - fi - return $RET - -} - -function restore_database() { - local SQL=$1 - echo "Restoring the openQRM-database from $SQL" - if [ -z "$OPENQRM_DATABASE_PASSWORD" ]; then - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME < $SQL - RET=$? - else - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER -p$OPENQRM_DATABASE_PASSWORD --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME < $SQL - RET=$? - fi - return $RET - -} - -function drop_database() { - echo "Dropping the openQRM-database" - if [ -z "$OPENQRM_DATABASE_PASSWORD" ]; then - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER --host $OPENQRM_DATABASE_SERVER -e "drop database $OPENQRM_DATABASE_NAME" 1>/dev/null 2>&1 - RET=$? - else - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER -p$OPENQRM_DATABASE_PASSWORD --host $OPENQRM_DATABASE_SERVER -e "drop database $OPENQRM_DATABASE_NAME" 1>/dev/null 2>&1 - RET=$? - fi - - # remove maintenance cron job - rm -f /etc/cron.daily/$OPENQRM_DATABASE_MAINTENANCE_FNAME - if [ -x "/etc/init.d/cron" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d cron reload - else - /etc/init.d/cron reload - fi - elif [ -x "/etc/init.d/crond" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d crond reload - else - /etc/init.d/crond reload - fi - else - echo "Could not find cron init script in /etc/init.d/. Please reload cron manually!" - fi - - return $RET -} - - - -########################### functions to update the db shema ########################### - -function check_table_exists(){ - local DB_TABLE=$1 - if [ -z "$OPENQRM_DATABASE_PASSWORD" ]; then - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "select * from $DB_TABLE" 1>/dev/null 2>&1 - RET=$? - else - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER -p$OPENQRM_DATABASE_PASSWORD --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "select * from $DB_TABLE" 1>/dev/null 2>&1 - RET=$? - fi - return $RET -} - - -function check_column_in_table_exists(){ - local DB_TABLE=$1 - local DB_COLUMN=$2 - if [ -z "$OPENQRM_DATABASE_PASSWORD" ]; then - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "select $DB_COLUMN from $DB_TABLE" 1>/dev/null 2>&1 - RET=$? - else - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER -p$OPENQRM_DATABASE_PASSWORD --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "select $DB_COLUMN from $DB_TABLE" 1>/dev/null 2>&1 - RET=$? - fi - return $RET -} - - -function check_if_data_in_column_of_table_exists(){ - local DB_TABLE=$1 - local DB_COLUMN=$2 - local DB_DATA=$3 - local DB_OUTPUT_LOG="/tmp/dboutput.log" - if [ -z "$OPENQRM_DATABASE_PASSWORD" ]; then - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "select * from $DB_TABLE where $DB_COLUMN=$DB_DATA" > $DB_OUTPUT_LOG - RET=$? - else - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER -p$OPENQRM_DATABASE_PASSWORD --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "select * from $DB_TABLE where $DB_COLUMN=$DB_DATA" > $DB_OUTPUT_LOG - RET=$? - fi - DB_OUTPUT=`cat $DB_OUTPUT_LOG` - if [ "$RET" == 0 ]; then - if [ "$DB_OUTPUT" == "" ]; then - return 1 - else - return 0 - fi - else - return $RET - fi -} - - - -function run_sql(){ - local DB_SQL=$@ - if [ -z "$OPENQRM_DATABASE_PASSWORD" ]; then - $MYSQL_CLIENT -sN -u $OPENQRM_DATABASE_USER --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "$DB_SQL" 2>&1 - RET=$? - else - $MYSQL_CLIENT -sN -u $OPENQRM_DATABASE_USER -p$OPENQRM_DATABASE_PASSWORD --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "$DB_SQL" 2>&1 - RET=$? - fi - return $RET -} - - - - -function db_update() { - - # this function applies needed updates to the db-shema if needed in an idempotent way - if [ -f "$OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/etc/openqrm-server.conf" ]; then - # for update we have to source the old configuration - . $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/etc/openqrm-server.conf - else - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - fi - - #--------------------------------------------------------------------------- - # from 4.9 to 5.0 the following db changes are needed - #--------------------------------------------------------------------------- - # 1 > ALTER TABLE cloud_users ADD cu_lang VARCHAR(4); - # 2 > UPDATE user_info set user_lang = 'en'; - # 3 > ALTER TABLE user_info ADD user_wizard_name VARCHAR(255) AFTER user_capabilities; - # 4 > ALTER TABLE user_info ADD user_wizard_step INT(5) AFTER user_wizard_name; - # 5 > ALTER TABLE user_info ADD user_wizard_id INT(5) AFTER user_wizard_step; - # 6 > ALTER TABLE appliance_info ADD appliance_wizard VARCHAR(255) AFTER appliance_comment; - # 7 > ALTER TABLE appliance_info MODIFY appliance_cpumodel VARCHAR(255); - # 8 > ALTER TABLE resource_info MODIFY resource_cpumodel VARCHAR(255); - # 9 > ALTER TABLE cloud_config MODIFY cc_value VARCHAR(255); - # 10 > ALTER TABLE event_info MODIFY event_id BIGINT; - # 11 > insert into cloud_config(cc_id, cc_key, cc_value) values (38, 'deprovision_warning', '100'); - # 12 > insert into cloud_config(cc_id, cc_key, cc_value) values (39, 'deprovision_pause', '50') - - - echo "- Checking database shema ..." - - # if cloud enabled ..... - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/cloud" ]; then - - # 1 > ALTER TABLE cloud_users ADD cu_lang VARCHAR(4); - if ! check_column_in_table_exists cloud_users cu_lang; then - echo " -- db change : ALTER TABLE cloud_users ADD cu_lang VARCHAR(4)" - run_sql "ALTER TABLE cloud_users ADD cu_lang VARCHAR(4);" - fi - # 9 > ALTER TABLE cloud_config MODIFY cc_value VARCHAR(255); - echo " -- db change : ALTER TABLE cloud_config MODIFY cc_value VARCHAR(255)" - run_sql "ALTER TABLE cloud_config MODIFY cc_value VARCHAR(255);" - - # 11 > insert into cloud_config(cc_id, cc_key, cc_value) values (38, 'deprovision_warning', '100'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 38; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (38, 'deprovision_warning', '100')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (38, 'deprovision_warning', '100');" - fi - fi - - # 12 > insert into cloud_config(cc_id, cc_key, cc_value) values (39, 'deprovision_pause', '50') - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 39; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (39, 'deprovision_pause', '50')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (39, 'deprovision_pause', '50');" - fi - fi - fi - - # 2 > UPDATE user_info set user_lang = 'en'; - echo " -- db change : UPDATE user_info set user_lang = 'en'" - run_sql "UPDATE user_info set user_lang = 'en';" - - # 3 > ALTER TABLE user_info ADD user_wizard_name VARCHAR(255) AFTER user_capabilities; - if ! check_column_in_table_exists user_info user_wizard_name; then - echo " -- db change : ALTER TABLE user_info ADD user_wizard_name VARCHAR(255) AFTER user_capabilities" - run_sql "ALTER TABLE user_info ADD user_wizard_name VARCHAR(255) AFTER user_capabilities;" - fi - - # 4 > ALTER TABLE user_info ADD user_wizard_step INT(5) AFTER user_wizard_name; - if ! check_column_in_table_exists user_info user_wizard_step; then - echo " -- db change : ALTER TABLE user_info ADD user_wizard_step INT(5) AFTER user_wizard_name" - run_sql "ALTER TABLE user_info ADD user_wizard_step INT(5) AFTER user_wizard_name;" - fi - - # 5 > ALTER TABLE user_info ADD user_wizard_id INT(5) AFTER user_wizard_step; - if ! check_column_in_table_exists user_info user_wizard_id; then - echo " -- db change : ALTER TABLE user_info ADD user_wizard_id INT(5) AFTER user_wizard_step" - run_sql "ALTER TABLE user_info ADD user_wizard_id INT(5) AFTER user_wizard_step;" - fi - - # 6 > ALTER TABLE appliance_info ADD appliance_wizard VARCHAR(255) AFTER appliance_comment; - if ! check_column_in_table_exists appliance_info appliance_wizard; then - echo " -- db change : ALTER TABLE appliance_info ADD appliance_wizard VARCHAR(255) AFTER appliance_comment" - run_sql "ALTER TABLE appliance_info ADD appliance_wizard VARCHAR(255) AFTER appliance_comment;" - fi - - # 7 > ALTER TABLE appliance_info MODIFY appliance_cpumodel VARCHAR(255); - echo " -- db change : ALTER TABLE appliance_info MODIFY appliance_cpumodel VARCHAR(255)" - run_sql "ALTER TABLE appliance_info MODIFY appliance_cpumodel VARCHAR(255);" - - # 8 > ALTER TABLE resource_info MODIFY resource_cpumodel VARCHAR(255); - echo " -- db change : ALTER TABLE resource_info MODIFY resource_cpumodel VARCHAR(255)" - run_sql "ALTER TABLE resource_info MODIFY resource_cpumodel VARCHAR(255);" - - # 10 > ALTER TABLE event_info MODIFY event_id BIGINT; - echo " -- db change : ALTER TABLE event_info MODIFY event_id BIGINT" - run_sql "ALTER TABLE event_info MODIFY event_id BIGINT;" - - echo "- Database sanity check for version 4.9 to 5.0 finished" - - # from 5.0 to 5.1 - #--------------------------------------------------------------------------- - # from 5.0 to 5.1 the following db changes are needed - #--------------------------------------------------------------------------- - # 1 > insert into cloud_config(cc_id, cc_key, cc_value) values (40, 'vm_provision_delay', '0'); - # 2 > insert into cloud_config(cc_id, cc_key, cc_value) values (41, 'vm_loadbalance_algorithm', '0'); - # 3 > ALTER TABLE role_info ADD role_comment VARCHAR(255); - # 4 > ALTER TABLE virtualization_info MODIFY virtualization_type VARCHAR(50); - # 5 > ALTER TABLE image_info MODIFY image_type VARCHAR(255); - # 6 > update virtualization_info set virtualization_name = 'KVM VM (networkboot)', virtualization_type='kvm-vm-net' where virtualization_type='kvm-vm'; - # 7 > update virtualization_info set virtualization_name = 'KVM VM (localboot)', virtualization_type='kvm-vm-local' where virtualization_type='kvm-storage-vm'; - # 8 > insert into deployment_info(deployment_id, deployment_name, deployment_type, deployment_description, deployment_storagetype, deployment_storagedescription) values ($NEW_DEPLOYMENT_ID, 'kvm-gluster-deployment', 'kvm-gluster-deployment', 'Glusterfs deployment for KVM', 'kvm', 'KVM Gluster Storage'); - # 9 > update virtualization_info set virtualization_name = 'Citrix VM (networkboot)', virtualization_type='citrix-vm-net' where virtualization_type='citrix-vm'; - # 10 > update virtualization_info set virtualization_name = 'Citrix VM (localboot)', virtualization_type='citrix-vm-local' where virtualization_type='citrix-storage-vm'; - # 11 > update virtualization_info set virtualization_name = 'LXC VM (localboot)', virtualization_type='lxc-vm-local' where virtualization_type='lxc-storage-vm'; - # 12 > update virtualization_info set virtualization_name = 'OpenVZ VM (localboot)', virtualization_type='openvz-vm-local' where virtualization_type='openvz-storage-vm'; - # 13 > update virtualization_info set virtualization_name = 'ESX VM (networkboot)', virtualization_type='vmware-esx-vm-net' where virtualization_type='vmware-esx-vm'; - # 14 > update virtualization_info set virtualization_name = 'Xen VM (networkboot)', virtualization_type='xen-vm-net' where virtualization_type='xen-vm'; - # 15 > update virtualization_info set virtualization_name = 'Xen VM (localboot)', virtualization_type='xen-vm-local' where virtualization_type='xen-storage-vm'; - # 16 > create table datacenter_info(datacenter_id BIGINT NOT NULL PRIMARY KEY, datacenter_load_overall VARCHAR(50), datacenter_load_server VARCHAR(50), datacenter_load_storage VARCHAR(50), datacenter_cpu_total VARCHAR(50), datacenter_mem_total VARCHAR(50), datacenter_mem_used VARCHAR(50)); - # 17 > ALTER TABLE appliance_info MODIFY appliance_comment VARCHAR(255); - - # 3 > ALTER TABLE role_info ADD role_comment VARCHAR(255); - if ! check_column_in_table_exists role_info role_comment; then - echo " -- db change : ALTER TABLE role_info ADD role_comment VARCHAR(255)" - run_sql "ALTER TABLE role_info ADD role_comment VARCHAR(255);" - fi - # 4 > ALTER TABLE virtualization_info MODIFY virtualization_type VARCHAR(50); - echo " -- db change : ALTER TABLE virtualization_info MODIFY virtualization_type VARCHAR(50)" - run_sql "ALTER TABLE virtualization_info MODIFY virtualization_type VARCHAR(50);" - # 5 > ALTER TABLE image_info MODIFY image_type VARCHAR(255); - echo " -- db change : ALTER TABLE image_info MODIFY image_type VARCHAR(255)" - run_sql "ALTER TABLE image_info MODIFY image_type VARCHAR(255);" - - # virtualization plugin merge - # citrix - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/citrix" ]; then - # 9 > update virtualization_info set virtualization_name = 'Citrix VM (networkboot)', virtualization_type='citrix-vm-net' where virtualization_type='citrix-vm'; - echo " -- db change : update virtualization_info set virtualization_name = 'Citrix VM (networkboot)', virtualization_type='citrix-vm-net' where virtualization_type='citrix-vm'" - run_sql "update virtualization_info set virtualization_name = 'Citrix VM (networkboot)', virtualization_type='citrix-vm-net' where virtualization_type='citrix-vm';" - fi - # citrix-storage - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/citrix-storage" ]; then - # 10 > update virtualization_info set virtualization_name = 'Citrix VM (localboot)', virtualization_type='citrix-vm-local' where virtualization_type='citrix-storage-vm'; - run_sql "update virtualization_info set virtualization_name = 'Citrix VM (localboot)', virtualization_type='citrix-vm-local' where virtualization_type='citrix-storage-vm';" - fi - # kvm - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/kvm" ]; then - echo "- adapting KVM Plugin database tables" - # 6 > update virtualization_info set virtualization_name = 'KVM VM (networkboot)', virtualization_type='kvm-vm-net' where virtualization_type='kvm-vm'; - echo " -- db change : update virtualization_info set virtualization_name = 'KVM VM (networkboot)', virtualization_type='kvm-vm-net' where virtualization_type='kvm-vm';" - run_sql "update virtualization_info set virtualization_name = 'KVM VM (networkboot)', virtualization_type='kvm-vm-net' where virtualization_type='kvm-vm';" - # 8 > insert into deployment_info(deployment_id, deployment_name, deployment_type, deployment_description, deployment_storagetype, deployment_storagedescription) values ($NEW_DEPLOYMENT_ID, 'kvm-gluster-deployment', 'kvm-gluster-deployment', 'Glusterfs deployment for KVM', 'kvm', 'KVM Gluster Storage'); - # glusterfs deployment - DEPLOYMENT_EXISTS=`run_sql "select deployment_id from deployment_info where deployment_type='kvm-gluster-deployment';"` - if [ "$DEPLOYMENT_EXISTS" == "" ]; then - NEW_DEPLOYMENT_ID=`run_sql "select count(deployment_id) from deployment_info;"` - NEW_DEPLOYMENT_ID=$(( NEW_DEPLOYMENT_ID + 1 )) - echo " -- db change : insert into deployment_info(deployment_id, deployment_name, deployment_type, deployment_description, deployment_storagetype, deployment_storagedescription) values ($NEW_DEPLOYMENT_ID, 'kvm-gluster-deployment', 'kvm-gluster-deployment', 'Glusterfs deployment for KVM', 'kvm', 'KVM Gluster Storage')" - run_sql "insert into deployment_info(deployment_id, deployment_name, deployment_type, deployment_description, deployment_storagetype, deployment_storagedescription) values ($NEW_DEPLOYMENT_ID, 'kvm-gluster-deployment', 'kvm-gluster-deployment', 'Glusterfs deployment for KVM', 'kvm', 'KVM Gluster Storage');" - fi - fi - # kvm-storage - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/kvm-storage" ]; then - # 7 > update virtualization_info set virtualization_name = 'KVM VM (localboot)', virtualization_type='kvm-vm-local' where virtualization_type='kvm-storage-vm'; - echo " -- db change : update virtualization_info set virtualization_name = 'KVM VM (localboot)', virtualization_type='kvm-vm-local' where virtualization_type='kvm-storage-vm';" - run_sql "update virtualization_info set virtualization_name = 'KVM VM (localboot)', virtualization_type='kvm-vm-local' where virtualization_type='kvm-storage-vm';" - fi - # lxc-storage - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/lxc-storage" ]; then - # 11 > update virtualization_info set virtualization_name = 'LXC VM (localboot)', virtualization_type='lxc-vm-local' where virtualization_type='lxc-storage-vm'; - run_sql "update virtualization_info set virtualization_name = 'LXC VM (localboot)', virtualization_type='lxc-vm-local' where virtualization_type='lxc-storage-vm';" - fi - # openvz - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/openvz-storage" ]; then - # 12 > update virtualization_info set virtualization_name = 'OpenVZ VM (localboot)', virtualization_type='openvz-vm-local' where virtualization_type='openvz-storage-vm'; - run_sql "update virtualization_info set virtualization_name = 'OpenVZ VM (localboot)', virtualization_type='openvz-vm-local' where virtualization_type='openvz-storage-vm';" - fi - # vmware-esx - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/vmware-esx" ]; then - # 13 > update virtualization_info set virtualization_name = 'ESX VM (networkboot)', virtualization_type='vmware-esx-vm-net' where virtualization_type='vmware-esx-vm'; - run_sql "update virtualization_info set virtualization_name = 'ESX VM (networkboot)', virtualization_type='vmware-esx-vm-net' where virtualization_type='vmware-esx-vm';" - fi - # xen - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/xen" ]; then - # 14 > update virtualization_info set virtualization_name = 'Xen VM (networkboot)', virtualization_type='xen-vm-net' where virtualization_type='xen-vm'; - run_sql "update virtualization_info set virtualization_name = 'Xen VM (networkboot)', virtualization_type='xen-vm-net' where virtualization_type='xen-vm';" - fi - # xen-storage - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/xen-storage" ]; then - # 15 > update virtualization_info set virtualization_name = 'Xen VM (localboot)', virtualization_type='xen-vm-local' where virtualization_type='xen-storage-vm'; - run_sql "update virtualization_info set virtualization_name = 'Xen VM (localboot)', virtualization_type='xen-vm-local' where virtualization_type='xen-storage-vm';" - fi - # if cloud enabled ..... - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/cloud" ]; then - # 1 > insert into cloud_config(cc_id, cc_key, cc_value) values (40, 'vm_provision_delay', '0'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 40; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (40, 'vm_provision_delay', '0')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (40, 'vm_provision_delay', '0');" - fi - fi - # 2 > insert into cloud_config(cc_id, cc_key, cc_value) values (41, 'vm_loadbalance_algorithm', '0'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 41; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (41, 'vm_loadbalance_algorithm', '0')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (41, 'vm_loadbalance_algorithm', '0');" - fi - fi - fi - # 16 > create table datacenter_info(datacenter_id INT(5) NOT NULL PRIMARY KEY, datacenter_load_overall VARCHAR(50), datacenter_load_server VARCHAR(50), datacenter_load_storage VARCHAR(50), datacenter_cpu_total VARCHAR(50), datacenter_mem_total VARCHAR(50), datacenter_mem_used VARCHAR(50)); - if ! check_table_exists datacenter_info; then - echo " -- db change : create table datacenter_info(datacenter_id BIGINT NOT NULL PRIMARY KEY, datacenter_load_overall VARCHAR(50), datacenter_load_server VARCHAR(50), datacenter_load_storage VARCHAR(50), datacenter_cpu_total VARCHAR(50), datacenter_mem_total VARCHAR(50), datacenter_mem_used VARCHAR(50))" - run_sql "create table datacenter_info(datacenter_id BIGINT NOT NULL PRIMARY KEY, datacenter_load_overall VARCHAR(50), datacenter_load_server VARCHAR(50), datacenter_load_storage VARCHAR(50), datacenter_cpu_total VARCHAR(50), datacenter_mem_total VARCHAR(50), datacenter_mem_used VARCHAR(50));" - fi - - # 17 > ALTER TABLE appliance_info MODIFY appliance_comment VARCHAR(255); - echo " -- db change : ALTER TABLE appliance_info MODIFY appliance_comment VARCHAR(255)" - run_sql "ALTER TABLE appliance_info MODIFY appliance_comment VARCHAR(255);" - - echo "- Database sanity check for version 5.0 to 5.1 finished" - - # from 5.1 to 5.2 - #--------------------------------------------------------------------------- - # from 5.1 to 5.2 the following db changes are needed - #--------------------------------------------------------------------------- - # 1 > insert into cloud_config(cc_id, cc_key, cc_value) values (42, 'allow_vnc_access', 'true'); - # 2 > ALTER TABLE cloud_requests ADD cr_image_password VARCHAR(255); - # 3 > create table lock_info(lock_id BIGINT NOT NULL PRIMARY KEY,lock_time VARCHAR(50),lock_section VARCHAR(50),lock_resource_id INT(5),lock_token VARCHAR(50),lock_description VARCHAR(255)); - # 4 > adjust all base objects id to BIGINT - # 5 > adjust all cloud objects id to BIGINT - # 6 > adjust all plugin objects id to BIGINT - # 7 > ALTER TABLE appliance_info MODIFY appliance_capabilities VARCHAR(1000); - # 8 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_username VARCHAR(255); - # 9 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_password VARCHAR(255); - # 10 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_host VARCHAR(255); - # 11 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_port VARCHAR(255); - # 12 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_tenant VARCHAR(255); - # 13 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_endpoint VARCHAR(255); - # 14 > ALTER TABLE cloud_create_vm_lc MODIFY vc_cr_resource_number BIGINT; - # 15 > ALTER TABLE kernel_info MODIFY kernel_name VARCHAR(255); - # 16 > ALTER TABLE image_info MODIFY image_name VARCHAR(255); - # 17 > ALTER TABLE storage_info MODIFY storage_name VARCHAR(255); - # 18 > ALTER TABLE auth_blocker_info MODIFY ab_image_name VARCHAR(255); - # 19 > ALTER TABLE resource_info ADD resource_vname VARCHAR(255); - # 20 > ALTER TABLE resource_info ADD resource_vnc VARCHAR(30); - # 21 > insert into cloud_config(cc_id, cc_key, cc_value) values (43, 'max_network', '1000'); - # 22 > insert into cloud_config(cc_id, cc_key, cc_value) values (44, 'max_memory', '10000'); - # 23 > insert into cloud_config(cc_id, cc_key, cc_value) values (45, 'max_cpu', '100'); - # 24 > ALTER TABLE cloud_selector MODIFY name VARCHAR(255); - # 25 > ALTER TABLE cloud_requests ADD cr_appliance_capabilities VARCHAR(1000); - # 26 > ALTER TABLE cloud_profiles ADD pr_appliance_capabilities VARCHAR(1000); - # 27 > update resource_info set resource_vtype=1 where resource_id=0 and resource_vtype IS NULL; - # 28 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_subscription_id VARCHAR(255); - # 29 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_keyfile VARCHAR(5000); - - - # if cloud enabled ..... - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/cloud" ]; then - # 1 > insert into cloud_config(cc_id, cc_key, cc_value) values (42, 'allow_vnc_access', 'true'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 42; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (42, 'allow_vnc_access', 'true')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (42, 'allow_vnc_access', 'false');" - fi - fi - # 21 > insert into cloud_config(cc_id, cc_key, cc_value) values (43, 'max_network', '1000'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 43; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (43, 'max_network', '1000')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (43, 'max_network', '1000');" - fi - fi - # 22 > insert into cloud_config(cc_id, cc_key, cc_value) values (44, 'max_memory', '10000'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 44; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (44, 'max_memory', '10000')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (44, 'max_memory', '10000');" - fi - fi - # 23 > insert into cloud_config(cc_id, cc_key, cc_value) values (45, 'max_cpu', '100'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 45; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (45, 'max_cpu', '100')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (45, 'max_cpu', '100');" - fi - fi - # 24 > ALTER TABLE cloud_selector MODIFY name VARCHAR(255); - if check_table_exists cloud_selector; then - echo " -- db change : ALTER TABLE cloud_selector MODIFY name VARCHAR(255);" - run_sql "ALTER TABLE cloud_selector MODIFY name VARCHAR(255);" - fi - # 2 > ALTER TABLE cloud_requests ADD cr_image_password VARCHAR(255); - if check_table_exists cloud_requests; then - if ! check_column_in_table_exists cloud_requests cr_image_password; then - echo " -- db change : ALTER TABLE cloud_requests ADD cr_image_password VARCHAR(255)" - run_sql "ALTER TABLE cloud_requests ADD cr_image_password VARCHAR(255);" - fi - fi - # 14 > ALTER TABLE cloud_create_vm_lc MODIFY vc_cr_resource_number BIGINT; - if check_table_exists cloud_create_vm_lc; then - echo " -- db change : ALTER TABLE cloud_create_vm_lc MODIFY vc_cr_resource_number BIGINT;" - run_sql "ALTER TABLE cloud_create_vm_lc MODIFY vc_cr_resource_number BIGINT;" - fi - - - # 25 > ALTER TABLE cloud_requests ADD cr_appliance_capabilities VARCHAR(1000); - if check_table_exists cloud_requests; then - if ! check_column_in_table_exists cloud_requests cr_appliance_capabilities; then - echo " -- db change : ALTER TABLE cloud_requests ADD cr_appliance_capabilities VARCHAR(1000);" - run_sql "ALTER TABLE cloud_requests ADD cr_appliance_capabilities VARCHAR(1000);" - fi - fi - # 26 > ALTER TABLE cloud_profiles ADD pr_appliance_capabilities VARCHAR(1000); - if check_table_exists cloud_profiles; then - if ! check_column_in_table_exists cloud_profiles pr_appliance_capabilities; then - echo " -- db change : ALTER TABLE cloud_profiles ADD pr_appliance_capabilities VARCHAR(1000);" - run_sql "ALTER TABLE cloud_profiles ADD pr_appliance_capabilities VARCHAR(1000);" - fi - fi - fi - - - # 3 > create table lock_info(lock_id BIGINT NOT NULL PRIMARY KEY,lock_time VARCHAR(50),lock_section VARCHAR(50),lock_resource_id INT(5),lock_token VARCHAR(50),lock_description VARCHAR(255)); - if ! check_table_exists lock_info; then - echo " -- db change : create table lock_info(lock_id BIGINT NOT NULL PRIMARY KEY,lock_time VARCHAR(50),lock_section VARCHAR(50),lock_resource_id INT(5),lock_token VARCHAR(50),lock_description VARCHAR(255))" - run_sql "create table lock_info(lock_id BIGINT NOT NULL PRIMARY KEY,lock_time VARCHAR(50),lock_section VARCHAR(50),lock_resource_id INT(5),lock_token VARCHAR(50),lock_description VARCHAR(255));" - fi - - - # 4 > adjust all base objects id to BIGINT - echo " -- db change : adjusting all base object ids to BIGINT" - run_sql "ALTER TABLE resource_info MODIFY resource_id BIGINT;" - run_sql "ALTER TABLE resource_info MODIFY resource_imageid BIGINT;" - run_sql "ALTER TABLE resource_info MODIFY resource_applianceid BIGINT;" - run_sql "ALTER TABLE resource_info MODIFY resource_vtype BIGINT;" - run_sql "ALTER TABLE resource_info MODIFY resource_vhostid BIGINT;" - run_sql "ALTER TABLE resource_info MODIFY resource_execdport BIGINT;" - run_sql "ALTER TABLE resource_info MODIFY resource_senddelay BIGINT;" - run_sql "ALTER TABLE kernel_info MODIFY kernel_id BIGINT;" - run_sql "ALTER TABLE image_info MODIFY image_id BIGINT;" - run_sql "ALTER TABLE image_info MODIFY image_storageid BIGINT;" - run_sql "ALTER TABLE appliance_info MODIFY appliance_id BIGINT;" - run_sql "ALTER TABLE appliance_info MODIFY appliance_imageid BIGINT;" - run_sql "ALTER TABLE appliance_info MODIFY appliance_cluster BIGINT;" - run_sql "ALTER TABLE appliance_info MODIFY appliance_ssi BIGINT;" - run_sql "ALTER TABLE appliance_info MODIFY appliance_resources BIGINT;" - run_sql "ALTER TABLE appliance_info MODIFY appliance_highavailable BIGINT;" - run_sql "ALTER TABLE appliance_info MODIFY appliance_virtual BIGINT;" - run_sql "ALTER TABLE appliance_info MODIFY appliance_virtualization_host BIGINT;" - run_sql "ALTER TABLE event_info MODIFY event_image_id BIGINT;" - run_sql "ALTER TABLE event_info MODIFY event_resource_id BIGINT;" - run_sql "ALTER TABLE user_info MODIFY user_id BIGINT;" - run_sql "ALTER TABLE user_info MODIFY user_role BIGINT;" - run_sql "ALTER TABLE user_info MODIFY user_wizard_step BIGINT;" - run_sql "ALTER TABLE user_info MODIFY user_wizard_id BIGINT;" - run_sql "ALTER TABLE role_info MODIFY role_id BIGINT;" - run_sql "ALTER TABLE storage_info MODIFY storage_id BIGINT;" - run_sql "ALTER TABLE storage_info MODIFY storage_type BIGINT;" - run_sql "ALTER TABLE storage_info MODIFY storage_resource_id BIGINT;" - run_sql "ALTER TABLE resource_service MODIFY resource_id BIGINT;" - run_sql "ALTER TABLE image_service MODIFY image_id BIGINT;" - run_sql "ALTER TABLE image_authentication_info MODIFY ia_id BIGINT;" - run_sql "ALTER TABLE image_authentication_info MODIFY ia_image_id BIGINT;" - run_sql "ALTER TABLE image_authentication_info MODIFY ia_resource_id BIGINT;" - run_sql "ALTER TABLE image_authentication_info MODIFY ia_auth_type BIGINT;" - run_sql "ALTER TABLE auth_blocker_info MODIFY ab_id BIGINT;" - run_sql "ALTER TABLE auth_blocker_info MODIFY ab_image_id BIGINT;" - run_sql "ALTER TABLE deployment_info MODIFY deployment_id BIGINT;" - run_sql "ALTER TABLE virtualization_info MODIFY virtualization_id BIGINT;" - run_sql "ALTER TABLE lock_info MODIFY lock_resource_id BIGINT;" - - # 6 > adjust all plugin objects id to BIGINT - if check_table_exists wakeuponlan; then - run_sql "ALTER TABLE wakeuponlan MODIFY wakeuponlan_id BIGINT;" - run_sql "ALTER TABLE wakeuponlan MODIFY wakeuponlan_user_id BIGINT;" - run_sql "ALTER TABLE wakeuponlan MODIFY wakeuponlan_appliance_id BIGINT;" - run_sql "ALTER TABLE wakeuponlan MODIFY wakeuponlan_nic_id BIGINT;" - run_sql "ALTER TABLE wakeuponlan MODIFY wakeuponlan_state BIGINT;" - fi - - # 7 > ALTER TABLE appliance_info MODIFY appliance_capabilities VARCHAR(1000); - echo " -- db change : ALTER TABLE appliance_info MODIFY appliance_capabilities VARCHAR(1000);" - run_sql "ALTER TABLE appliance_info MODIFY appliance_capabilities VARCHAR(1000);" - - # if hybrid-cloud enabled ..... - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/hybrid-cloud" ]; then - if check_table_exists hybrid_cloud_accounts; then - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_username; then - # 8 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_username VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_username VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_password; then - # 9 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_password VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_password VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_host; then - # 10 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_host VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_host VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_port; then - # 11 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_port VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_port VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_tenant; then - # 12 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_tenant VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_tenant VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_endpoint; then - # 13 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_endpoint VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_endpoint VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_subscription_id; then - # 28 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_subscription_id VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_subscription_id VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_keyfile; then - # 29 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_keyfile VARCHAR(5000); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_keyfile VARCHAR(5000);" - fi - fi - fi - - # 15 > ALTER TABLE kernel_info MODIFY kernel_name VARCHAR(255); - run_sql "ALTER TABLE kernel_info MODIFY kernel_name VARCHAR(255);" - # 16 > ALTER TABLE image_info MODIFY image_name VARCHAR(255); - run_sql "ALTER TABLE image_info MODIFY image_name VARCHAR(255);" - # 17 > ALTER TABLE storage_info MODIFY storage_name VARCHAR(255); - run_sql "ALTER TABLE storage_info MODIFY storage_name VARCHAR(255);" - # 18 > ALTER TABLE auth_blocker_info MODIFY ab_image_name VARCHAR(255); - run_sql "ALTER TABLE auth_blocker_info MODIFY ab_image_name VARCHAR(255);" - - if ! check_column_in_table_exists resource_info resource_vname; then - # 19 > ALTER TABLE resource_info ADD resource_vname VARCHAR(255); - run_sql "ALTER TABLE resource_info ADD resource_vname VARCHAR(255);" - fi - if ! check_column_in_table_exists resource_info resource_vnc; then - # 20 > ALTER TABLE resource_info ADD resource_vnc VARCHAR(30); - run_sql "ALTER TABLE resource_info ADD resource_vnc VARCHAR(30);" - fi - - # 27 > update resource_info set resource_vtype=1 where resource_id=0 and resource_vtype IS NULL; - run_sql "update resource_info set resource_vtype=1 where resource_id=0 and resource_vtype IS NULL;" - - echo "- Database sanity check for version 5.1 to 5.2 finished" - - - # from 5.2 to 5.3 - #--------------------------------------------------------------------------- - # from 5.2 to 5.3 the following db changes are needed - #--------------------------------------------------------------------------- - # 1 > ALTER TABLE image_info ADD image_size BIGINT(30); - # 2 > ALTER TABLE image_info MODIFY image_deployment_parameter VARCHAR(1000); - # 3 > ALTER TABLE cloud_requests ADD cr_size_req VARCHAR(255); - # 4 > ALTER TABLE cloud_profiles ADD pr_size_req VARCHAR(255); - # 5 > ALTER TABLE ip_mgmt ADD ip_mgmt_resource_id BIGINT(30); - # 6 > ALTER TABLE ip_mgmt ADD ip_mgmt_bridge_name VARCHAR(50); - # 7 > insert into cloud_config(cc_id, cc_key, cc_value) values (46, 'bandwidth_metering', 'true'); - - if ! check_column_in_table_exists image_info image_size; then - # 1 > ALTER TABLE image_info ADD image_size BIGINT(30); - run_sql "ALTER TABLE image_info ADD image_size BIGINT(30);" - fi - - # 2 > ALTER TABLE image_info MODIFY image_deployment_parameter VARCHAR(1000); - echo " -- db change : ALTER TABLE image_info MODIFY image_deployment_parameter VARCHAR(1000);" - run_sql "ALTER TABLE image_info MODIFY image_deployment_parameter VARCHAR(1000);" - - if ! check_column_in_table_exists cloud_requests cr_size_req; then - # 3 > ALTER TABLE cloud_requests ADD cr_size_req VARCHAR(255); - run_sql "ALTER TABLE cloud_requests ADD cr_size_req VARCHAR(255);" - fi - if ! check_column_in_table_exists cloud_profiles pr_size_req; then - # 4 > ALTER TABLE cloud_profiles ADD pr_size_req VARCHAR(255); - run_sql "ALTER TABLE cloud_profiles ADD pr_size_req VARCHAR(255);" - fi - - if ! check_column_in_table_exists ip_mgmt ip_mgmt_resource_id; then - # 5 > ALTER TABLE ip_mgmt ADD ip_mgmt_resource_id BIGINT(30); - run_sql "ALTER TABLE ip_mgmt ADD ip_mgmt_resource_id BIGINT(30);" - fi - - if ! check_column_in_table_exists ip_mgmt ip_mgmt_bridge_name; then - # 6 > ALTER TABLE ip_mgmt ADD ip_mgmt_bridge_name VARCHAR(50); - run_sql "ALTER TABLE ip_mgmt ADD ip_mgmt_bridge_name VARCHAR(50);" - fi - - # 7 > insert into cloud_config(cc_id, cc_key, cc_value) values (46, 'bandwidth_metering', 'true'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 46; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (46, 'bandwidth_metering', 'true')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (46, 'bandwidth_metering', 'true');" - fi - fi - - - echo "- Database sanity check for version 5.2 to 5.3 finished" - - -} - - - - - - - -case "$1" in - init) - initialize_database - ;; - backup) - backup_database $2 - ;; - restore) - restore_database $2 - ;; - drop) - drop_database - ;; - update) - db_update - ;; -esac diff --git a/openQRM-5.3.50-CE/src/etc/db/mysql/openqrm-mysql-init.sql b/openQRM-5.3.50-CE/src/etc/db/mysql/openqrm-mysql-init.sql deleted file mode 100644 index c5e1b09..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/mysql/openqrm-mysql-init.sql +++ /dev/null @@ -1,251 +0,0 @@ -# initializes the openqrm db - -create database OPENQRM_DB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; -use OPENQRM_DB; - - -# resource table -create table resource_info( - resource_id BIGINT NOT NULL PRIMARY KEY, - resource_localboot INT(1), - resource_kernel VARCHAR(50), - resource_kernelid BIGINT(3), - resource_image VARCHAR(50), - resource_imageid BIGINT, - resource_openqrmserver VARCHAR(20), - resource_basedir VARCHAR(100), - resource_applianceid BIGINT, - resource_ip VARCHAR(20), - resource_subnet VARCHAR(20), - resource_broadcast VARCHAR(20), - resource_network VARCHAR(20), - resource_mac VARCHAR(20), - resource_nics INT(2), - resource_uptime BIGINT(10), - resource_cpunumber INT(2), - resource_cpuspeed BIGINT(10), - resource_cpumodel VARCHAR(255), - resource_memtotal BIGINT(10), - resource_memused BIGINT(10), - resource_swaptotal BIGINT(10), - resource_swapused BIGINT(10), - resource_hostname VARCHAR(60), - resource_vtype BIGINT, - resource_vhostid BIGINT, - resource_vname VARCHAR(255), - resource_vnc VARCHAR(30), - resource_load DOUBLE(3,2), - resource_execdport BIGINT, - resource_senddelay INT(3), - resource_capabilities VARCHAR(255), - resource_lastgood VARCHAR(10), - resource_state VARCHAR(20), - resource_event VARCHAR(20) -); - - -# kernel table -create table kernel_info( - kernel_id BIGINT NOT NULL PRIMARY KEY, - kernel_name VARCHAR(255), - kernel_version VARCHAR(50), - kernel_capabilities VARCHAR(255), - kernel_comment VARCHAR(255) -); - - -# image table -create table image_info( - image_id BIGINT NOT NULL PRIMARY KEY, - image_name VARCHAR(255), - image_version VARCHAR(30), - # can be : ramdisk, nfs, local, iscsi - image_type VARCHAR(255), - # can be : ram, /dev/hdX, /dev/sdX, nfs, iscsi - image_rootdevice VARCHAR(255), - image_size BIGINT(30), - # can be : ext2/3, nfs - image_rootfstype VARCHAR(255), - image_storageid BIGINT, - # freetext parameter for the deployment plugin - image_deployment_parameter VARCHAR(1000), - image_isshared INT(1), - image_isactive INT(1), - image_comment VARCHAR(255), - image_capabilities VARCHAR(255) -); - - -# appliance table -create table appliance_info( - appliance_id BIGINT NOT NULL PRIMARY KEY, - appliance_name VARCHAR(50), - appliance_kernelid BIGINT(3), - appliance_imageid BIGINT, - appliance_starttime BIGINT(10), - appliance_stoptime BIGINT(10), - appliance_cpunumber INT(2), - appliance_cpuspeed BIGINT(10), - appliance_cpumodel VARCHAR(255), - appliance_memtotal BIGINT(10), - appliance_swaptotal BIGINT(10), - appliance_nics INT(2), - appliance_capabilities VARCHAR(1000), - appliance_cluster BIGINT, - appliance_ssi BIGINT, - appliance_resources BIGINT, - appliance_highavailable BIGINT, - appliance_virtual BIGINT, - appliance_virtualization VARCHAR(20), - appliance_virtualization_host BIGINT, - appliance_state VARCHAR(20), - appliance_comment VARCHAR(255), - appliance_wizard VARCHAR(255), - appliance_event VARCHAR(20) -); - - - - -# event table -create table event_info( - event_id BIGINT NOT NULL PRIMARY KEY, - event_name VARCHAR(50), - event_time VARCHAR(50), - event_priority INT(4), - event_source VARCHAR(50), - event_description VARCHAR(255), - event_comment VARCHAR(100), - event_capabilities VARCHAR(255), - event_status INT(4), - event_image_id BIGINT, - event_resource_id BIGINT -); - - -create table user_info( - user_id BIGINT NOT NULL PRIMARY KEY, - user_name VARCHAR(20), - user_password VARCHAR(20), - user_gender VARCHAR(1), - user_first_name VARCHAR(50), - user_last_name VARCHAR(50), - user_department VARCHAR(50), - user_office VARCHAR(50), - user_role BIGINT, - user_last_update_time VARCHAR(50), - user_description VARCHAR(255), - user_capabilities VARCHAR(255), - user_wizard_name VARCHAR(255), - user_wizard_step BIGINT, - user_wizard_id BIGINT, - user_state VARCHAR(20), - user_lang VARCHAR(5) -); - -create table role_info( - role_id BIGINT NOT NULL PRIMARY KEY, - role_name VARCHAR(20), - role_comment VARCHAR(255) -); - - -create table storage_info( - storage_id BIGINT NOT NULL PRIMARY KEY, - storage_name VARCHAR(255), - storage_resource_id BIGINT, - storage_type BIGINT, - storage_comment VARCHAR(100), - storage_capabilities VARCHAR(255), - storage_state VARCHAR(20) -); - - -create table resource_service ( - resource_id BIGINT NOT NULL PRIMARY KEY, - service VARCHAR(50) NOT NULL, - INDEX(service) -); - -create table image_service ( - image_id BIGINT NOT NULL PRIMARY KEY, - service VARCHAR(50) NOT NULL, - INDEX(service) -); - - -# image_authentication table -create table image_authentication_info( - ia_id BIGINT NOT NULL PRIMARY KEY, - ia_image_id BIGINT, - ia_resource_id BIGINT, - ia_auth_type BIGINT -); - -# storage_authentication_blocker table -create table auth_blocker_info( - ab_id BIGINT NOT NULL PRIMARY KEY, - ab_image_id BIGINT, - ab_image_name VARCHAR(255), - ab_start_time VARCHAR(20) -); - -# plugg-able deployment types -create table deployment_info( - deployment_id BIGINT NOT NULL PRIMARY KEY, - deployment_name VARCHAR(50), - deployment_type VARCHAR(50), - deployment_description VARCHAR(50), - deployment_storagetype VARCHAR(50), - deployment_storagedescription VARCHAR(50), - deployment_mapping VARCHAR(255) -); - -# plugg-able virtualization types -create table virtualization_info( - virtualization_id BIGINT NOT NULL PRIMARY KEY, - virtualization_name VARCHAR(50), - virtualization_type VARCHAR(50), - virtualization_mapping VARCHAR(255) -); - -# datacenter statistics -create table datacenter_info( - datacenter_id BIGINT NOT NULL PRIMARY KEY, - datacenter_load_overall VARCHAR(50), - datacenter_load_server VARCHAR(50), - datacenter_load_storage VARCHAR(50), - datacenter_cpu_total VARCHAR(50), - datacenter_mem_total VARCHAR(50), - datacenter_mem_used VARCHAR(50) -); - -# global lock -create table lock_info( - lock_id BIGINT NOT NULL PRIMARY KEY, - lock_time VARCHAR(50), - lock_section VARCHAR(50), - lock_resource_id BIGINT, - lock_token VARCHAR(50), - lock_description VARCHAR(255) -); - - -# initial data -insert into kernel_info (kernel_id, kernel_name, kernel_version) values ('0', 'openqrm', 'openqrm'); -insert into image_info (image_id, image_name, image_version, image_type, image_rootdevice, image_isshared) values ('0', 'openqrm', 'openqrm', 'ram', 'ram', '0'); - -insert into image_info (image_id, image_name, image_version, image_type, image_rootdevice, image_rootfstype, image_isshared) values ('1', 'idle', 'openqrm', 'ram', 'ram', 'ext2', '1'); -insert into resource_info (resource_id, resource_localboot, resource_kernel, resource_image, resource_openqrmserver, resource_ip, resource_vtype) values ('0', '1', 'local', 'local', 'OPENQRM_SERVER_IP_ADDRESS', 'OPENQRM_SERVER_IP_ADDRESS', '1'); -# base deployment type ram -insert into deployment_info (deployment_id, deployment_name, deployment_type, deployment_description, deployment_storagetype, deployment_storagedescription ) values (1, 'ramdisk', 'ram', 'Ramdisk Deployment', 'none', 'none'); -# base virtualization type physical -insert into virtualization_info (virtualization_id, virtualization_name, virtualization_type ) values (1, 'Physical System', 'physical'); -# user openqrm -insert into user_info (user_id, user_name, user_password, user_gender, user_first_name, user_last_name, user_department, user_office, user_role, user_last_update_time, user_description, user_capabilities, user_state, user_lang) values (0, 'openqrm', 'openqrm', '-', '-', '-', '-', '-', 0, '-', 'default admin user', '', 'activated', 'en'); -insert into user_info (user_id, user_name, user_password, user_gender, user_first_name, user_last_name, user_department, user_office, user_role, user_last_update_time, user_description, user_capabilities, user_state, user_lang) values (1, 'anonymous', 'openqrm', '-', '-', '-', '-', '-', 1, '-', 'default readonly user', '', 'activated', 'en'); -insert into role_info (role_id, role_name) values (0, 'administrator'); -insert into role_info (role_id, role_name) values (1, 'readonly'); - -insert into appliance_info (appliance_id, appliance_name, appliance_kernelid, appliance_imageid, appliance_starttime, appliance_resources, appliance_virtualization, appliance_state, appliance_comment) values (1, 'openqrm', 0, 0, '10', 0, 1, 'active', 'openQRM server'); - diff --git a/openQRM-5.3.50-CE/src/etc/db/mysql/openqrm-mysql-maintenance b/openQRM-5.3.50-CE/src/etc/db/mysql/openqrm-mysql-maintenance deleted file mode 100644 index 5fc8ecd..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/mysql/openqrm-mysql-maintenance +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -# openQRM maintenance script, runs once a day via cron -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -. @@OPENQRM_SERVER_BASE_DIR@@/openqrm/etc/openqrm-server.conf -. @@OPENQRM_SERVER_BASE_DIR@@/openqrm/include/openqrm-server-functions -# get full server config -openqrm_server_get_config - -# define maintenance dir for mysql backup files -DB_MAINTENANCE_DIR="/var/spool/openqrm_db/" - - -if ! which mysql 1>/dev/null 2>&1; then - echo "ERROR: Mysql client 'mysql' not installed/found on this system" | logger - exit 1 -else - export MYSQL_CLIENT=`which mysql` -fi -if ! which mysqldump 1>/dev/null 2>&1; then - echo "ERROR: Mysql 'mysqldump' not installed/found on this system" | logger - exit 1 -else - export MYSQL_DUMP=`which mysqldump` -fi - -BACKUP_TIME=`date +%T--%x | sed -e "s/:/-/g" | sed -e "s#/#-#g"` -if [ "$OPENQRM_DATABASE_PASSWORD" != "" ]; then - DB_PASS="-p$OPENQRM_DATABASE_PASSWORD" -fi - -if [ ! -d "$DB_MAINTENANCE_DIR" ]; then - mkdir -p $DB_MAINTENANCE_DIR -fi - -# backup event_info table -echo "NOTICE: Saving event_info table to $DB_MAINTENANCE_DIR/openqrm_db_event_info_$BACKUP_TIME.sql" | logger -$MYSQL_DUMP -u $OPENQRM_DATABASE_USER $DB_PASS --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME event_info > $DB_MAINTENANCE_DIR/openqrm_db_event_info_$BACKUP_TIME.sql -gzip $DB_MAINTENANCE_DIR/openqrm_db_event_info_$BACKUP_TIME.sql -# clean up event_info table -echo "NOTICE: Cleaning event_info table" | logger -$MYSQL_CLIENT -u $OPENQRM_DATABASE_USER $DB_PASS --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "delete from event_info" -# clean up datacenter_info table -echo "NOTICE: Cleaning datacenter_info" | logger -$MYSQL_CLIENT -u $OPENQRM_DATABASE_USER $DB_PASS --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "delete from datacenter_info" - -# backup cloud_transaction -if $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER $DB_PASS --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "show tables" | grep cloud_transaction 1>/dev/null; then - echo "NOTICE: Saving cloud_transaction table to $DB_MAINTENANCE_DIR/openqrm_db_cloud_transaction_$BACKUP_TIME.sql" | logger - $MYSQL_DUMP -u $OPENQRM_DATABASE_USER $DB_PASS --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME cloud_transaction > $DB_MAINTENANCE_DIR/openqrm_db_cloud_transaction_$BACKUP_TIME.sql - gzip $DB_MAINTENANCE_DIR/openqrm_db_cloud_transaction_$BACKUP_TIME.sql - # clean up cloud_transaction - echo "NOTICE: Cleaning cloud_transaction table" | logger - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER $DB_PASS --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "delete from cloud_transaction" -fi - -# backup cloud_zones_transaction -if $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER $DB_PASS --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "show tables" | grep cloud_zones_transaction 1>/dev/null; then - echo "NOTICE: Saving cloud_zones_transaction table to $DB_MAINTENANCE_DIR/openqrm_db_cloud_zones_transaction_$BACKUP_TIME.sql" | logger - $MYSQL_DUMP -u $OPENQRM_DATABASE_USER $DB_PASS --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME cloud_zones_transaction > $DB_MAINTENANCE_DIR/openqrm_db_cloud_zones_transaction_$BACKUP_TIME.sql - gzip $DB_MAINTENANCE_DIR/openqrm_db_cloud_zones_transaction_$BACKUP_TIME.sql - # clean up cloud_zones_transaction - echo "NOTICE: Cleaning cloud_zones_transaction table" | logger - $MYSQL_CLIENT -u $OPENQRM_DATABASE_USER $DB_PASS --host $OPENQRM_DATABASE_SERVER $OPENQRM_DATABASE_NAME -e "delete from cloud_zones_transaction" -fi - diff --git a/openQRM-5.3.50-CE/src/etc/db/oracle/README b/openQRM-5.3.50-CE/src/etc/db/oracle/README deleted file mode 100644 index 1194c31..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/oracle/README +++ /dev/null @@ -1,20 +0,0 @@ -openqrm-server.conf setup for oracle database : - -OPENQRM_DATABASE_TYPE="oracle" # supported are : mysql, oracle, db2, postgres -OPENQRM_DATABASE_SERVER="localhost" # ip-address of the database server -OPENQRM_DATABASE_NAME="oratest" # database name -OPENQRM_DATABASE_USER="scott" # database user -OPENQRM_DATABASE_PASSWORD="tiger" # database password - - -Hints to compile php + oracle support : - -install oracle -source /home/oracle/.bashrc (add to /root/.bashrc) -create database e.g. "oratest" - -configure + compile php with oracle/oci support : -./configure i386-redhat-linux --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --prefix=/usr --with-config-file-path=/etc --enable-force-cgi-redirect --disable-debug --with-oci8=/opt/oracle/product/9.2.0/ --with-oracle=/opt/oracle/product/9.2.0/ --with-mysql=shared,/usr --with-apxs=/usr/sbin/apxs --enable-sigchild --no-create --no-recursion -make -make install - diff --git a/openQRM-5.3.50-CE/src/etc/db/oracle/openqrm-oracle-functions b/openQRM-5.3.50-CE/src/etc/db/oracle/openqrm-oracle-functions deleted file mode 100644 index 831c56f..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/oracle/openqrm-oracle-functions +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# openQRM oracle-specfic functions -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SERVER_BASE_DIR before sourcing $0" - exit 1 -fi - -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -OPENQRM_DATABASE_INIT="$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/oracle/openqrm-oracle-init.sql" -OPENQRM_DATABASE_INIT_TMP="/tmp/openqrm-oracle-init.sql" - - -function initialize_database() { - - if ! which sqlplus 1>/dev/null 2>&1; then - echo "ERROR: Oracle client 'sqlplus' not installed/found on this system" - return 1 - else - ORACLE_CLIENT=`which sqlplus` - fi - - echo "Initializing the openQRM-database" - cat $OPENQRM_DATABASE_INIT | \ - sed -e "s/OPENQRM_SERVER_IP_ADDRESS/$OPENQRM_SERVER_IP_ADDRESS/g" \ - > $OPENQRM_DATABASE_INIT_TMP - $ORACLE_CLIENT $OPENQRM_DATABASE_USER/$OPENQRM_DATABASE_PASSWORD@$OPENQRM_DATABASE_NAME @$OPENQRM_DATABASE_INIT_TMP - return $? -} - - -function backup_database() { - local SQL=$1 - echo "Creating backup of the openQRM-database at $SQL" - echo "NOTICE: Backup for Oracle databases not yet implemented" - return $RET - -} - -function restore_database() { - local SQL=$1 - echo "Restoring the openQRM-database from $SQL" - echo "NOTICE: Restore for Oracle databases not yet implemented" - return $RET - -} - -function drop_database() { - echo "Dropping the openQRM-database" - echo "NOTICE: Drop for Oracle databases not yet implemented" - return $RET -} - - - -case "$1" in - init) - initialize_database - ;; - backup) - backup_database $2 - ;; - restore) - restore_database $2 - ;; - drop) - drop_database - ;; -esac diff --git a/openQRM-5.3.50-CE/src/etc/db/oracle/openqrm-oracle-init.sql b/openQRM-5.3.50-CE/src/etc/db/oracle/openqrm-oracle-init.sql deleted file mode 100644 index c4e9194..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/oracle/openqrm-oracle-init.sql +++ /dev/null @@ -1,229 +0,0 @@ - -drop table resource_info; -create table resource_info( - resource_id INTEGER NOT NULL PRIMARY KEY, - resource_localboot INTEGER, - resource_kernel VARCHAR2(50), - resource_kernelid INTEGER, - resource_image VARCHAR2(50), - resource_imageid INTEGER, - resource_openqrmserver VARCHAR2(20), - resource_basedir VARCHAR2(100), - resource_applianceid INTEGER, - resource_ip VARCHAR2(20), - resource_subnet VARCHAR2(20), - resource_broadcast VARCHAR2(20), - resource_network VARCHAR2(20), - resource_mac VARCHAR2(20), - resource_nics INTEGER, - resource_uptime INTEGER, - resource_cpunumber INTEGER, - resource_cpuspeed INTEGER, - resource_cpumodel VARCHAR2(255), - resource_memtotal INTEGER, - resource_memused INTEGER, - resource_swaptotal INTEGER, - resource_swapused INTEGER, - resource_hostname VARCHAR2(60), - resource_vtype INTEGER, - resource_vhostid INTEGER, - resource_vname VARCHAR2(255), - resource_vnc VARCHAR2(30), - resource_load FLOAT, - resource_execdport INTEGER, - resource_senddelay INTEGER, - resource_capabilities VARCHAR2(255), - resource_lastgood VARCHAR2(10), - resource_state VARCHAR2(20), - resource_event VARCHAR2(20) -); - - - -drop table kernel_info; -create table kernel_info( - kernel_id INTEGER NOT NULL PRIMARY KEY, - kernel_name VARCHAR2(255), - kernel_version VARCHAR2(50), - kernel_capabilities VARCHAR2(255), - kernel_comment VARCHAR2(255) -); - - - -drop table image_info; -create table image_info( - image_id INTEGER NOT NULL PRIMARY KEY, - image_name VARCHAR2(255), - image_version VARCHAR2(30), - image_type VARCHAR2(255), - image_rootdevice VARCHAR2(255), - image_rootfstype VARCHAR2(255), - image_size INTEGER, - image_storageid INTEGER, - image_deployment_parameter VARCHAR2(1000), - image_isshared INTEGER, - image_isactive INTEGER, - image_comment VARCHAR2(255), - image_capabilities VARCHAR2(255) -); - -drop table appliance_info; -create table appliance_info( - appliance_id INTEGER NOT NULL PRIMARY KEY, - appliance_name VARCHAR2(50), - appliance_kernelid INTEGER, - appliance_imageid INTEGER, - appliance_starttime INTEGER, - appliance_stoptime INTEGER, - appliance_cpunumber INTEGER, - appliance_cpuspeed INTEGER, - appliance_cpumodel VARCHAR2(255), - appliance_memtotal INTEGER, - appliance_swaptotal INTEGER, - appliance_nics INTEGER, - appliance_capabilities VARCHAR2(1000), - appliance_cluster INTEGER, - appliance_ssi INTEGER, - appliance_resources INTEGER, - appliance_highavailable INTEGER, - appliance_virtual INTEGER, - appliance_virtualization VARCHAR2(20), - appliance_virtualization_host INTEGER, - appliance_state VARCHAR2(20), - appliance_comment VARCHAR2(255), - appliance_wizard VARCHAR2(255), - appliance_event VARCHAR2(20) -); - -drop table event_info; -create table event_info( - event_id INTEGER NOT NULL PRIMARY KEY, - event_name VARCHAR2(50), - event_time VARCHAR2(50), - event_priority INTEGER, - event_source VARCHAR2(50), - event_description VARCHAR2(255), - event_comment VARCHAR2(100), - event_capabilities VARCHAR2(255), - event_status INTEGER, - event_image_id INTEGER, - event_resource_id INTEGER -); - - - -drop table user_info; -create table user_info( - user_id INTEGER NOT NULL PRIMARY KEY, - user_name VARCHAR2(20), - user_password VARCHAR2(20), - user_gender VARCHAR2(1), - user_first_name VARCHAR2(50), - user_last_name VARCHAR2(50), - user_department VARCHAR2(50), - user_office VARCHAR2(50), - user_role INTEGER, - user_last_update_time VARCHAR2(50), - user_description VARCHAR2(255), - user_capabilities VARCHAR2(255), - user_wizard_name VARCHAR2(255), - user_wizard_step INTEGER, - user_wizard_id INTEGER, - user_state VARCHAR2(20), - user_lang VARCHAR2(5) -); - - -drop table role_info; -create table role_info( - role_id INTEGER NOT NULL PRIMARY KEY, - role_name VARCHAR2(20) -); - - -drop table storage_info; -create table storage_info( - storage_id INTEGER NOT NULL PRIMARY KEY, - storage_name VARCHAR2(255), - storage_resource_id INTEGER, - storage_type INTEGER, - storage_comment VARCHAR2(100), - storage_capabilities VARCHAR2(255), - storage_state VARCHAR2(20) -); - - -drop table resource_service; -create table resource_service( - resource_id INTEGER NOT NULL PRIMARY KEY, - service VARCHAR2(50) -); - -drop table image_service; -create table image_service( - image_id INTEGER NOT NULL PRIMARY KEY, - service VARCHAR2(50) -); - -drop table image_authentication_info; -create table image_authentication_info( - ia_id INTEGER NOT NULL PRIMARY KEY, - ia_image_id INTEGER, - ia_resource_id INTEGER, - ia_auth_type INTEGER -); - -drop table auth_blocker_info; -create table auth_blocker_info( - ab_id INTEGER NOT NULL PRIMARY KEY, - ab_image_id INTEGER, - ab_image_name VARCHAR2(255), - ab_start_time VARCHAR2(20) -); - -drop table deployment_info; -create table deployment_info( - deployment_id INTEGER NOT NULL PRIMARY KEY, - deployment_storagetype_id INTEGER, - deployment_name VARCHAR2(50), - deployment_type VARCHAR2(50), - deployment_description VARCHAR2(50), - deployment_storagetype VARCHAR2(50), - deployment_storagedescription VARCHAR2(50), - deployment_mapping VARCHAR2(255) -); - -drop table virtualization_info; -create table virtualization_info( - virtualization_id INTEGER NOT NULL PRIMARY KEY, - virtualization_name VARCHAR2(50), - virtualization_type VARCHAR2(50), - virtualization_mapping VARCHAR2(255) -); - -drop table datacenter_info; -create table datacenter_info( - datacenter_id INTEGER NOT NULL PRIMARY KEY, - datacenter_load_overall VARCHAR2(50), - datacenter_load_server VARCHAR2(50), - datacenter_load_storage VARCHAR2(50), - datacenter_cpu_total VARCHAR2(50), - datacenter_mem_total VARCHAR2(50), - datacenter_mem_used VARCHAR2(50) -); - -insert into kernel_info (kernel_id, kernel_name, kernel_version) values (0, 'openqrm', 'openqrm'); -insert into image_info (image_id, image_name, image_version, image_type, image_rootdevice, image_isshared) values (0, 'openqrm', 'openqrm', 'ram', 'ram', 0); - -insert into image_info (image_id, image_name, image_version, image_type, image_rootdevice, image_rootfstype, image_isshared) values ('1', 'idle', 'openqrm', 'ram', 'ram', 'ext2', '1'); -insert into resource_info (resource_id, resource_localboot, resource_kernel, resource_image, resource_openqrmserver, resource_ip) values ('0', '1', 'local', 'local', 'OPENQRM_SERVER_IP_ADDRESS', 'OPENQRM_SERVER_IP_ADDRESS'); -insert into deployment_info (deployment_id, deployment_name, deployment_type, deployment_description, deployment_storagetype, deployment_storagedescription ) values ('1', 'ramdisk', 'ram', 'Ramdisk Deployment', 'none', 'none'); -insert into virtualization_info (virtualization_id, virtualization_name, virtualization_type) values ('1', 'Physical System', 'physical'); -insert into user_info (user_id, user_name, user_password, user_gender, user_first_name, user_last_name, user_department, user_office, user_role, user_last_update_time, user_description, user_capabilities, user_state, user_lang) values (0, 'openqrm', 'openqrm', '-', '-', '-', '-', '-', 0, '-', 'default admin user', '-', 'activated', 'en'); -insert into user_info (user_id, user_name, user_password, user_gender, user_first_name, user_last_name, user_department, user_office, user_role, user_last_update_time, user_description, user_capabilities, user_state, user_lang) values (1, 'anonymous', 'openqrm', '-', '-', '-', '-', '-', 1, '-', 'default readonly user', '-', 'activated', 'en'); -insert into role_info (role_id, role_name) values (0, 'administrator'); -insert into role_info (role_id, role_name) values (1, 'readonly'); - - -quit diff --git a/openQRM-5.3.50-CE/src/etc/db/postgres/README b/openQRM-5.3.50-CE/src/etc/db/postgres/README deleted file mode 100644 index aca33b4..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/postgres/README +++ /dev/null @@ -1,28 +0,0 @@ -openqrm-server.conf setup for postgres database : - -OPENQRM_DATABASE_TYPE="postgres" # supported are : mysql, oracle, db2, ... -OPENQRM_DATABASE_SERVER="localhost" # ip-address of the database server -OPENQRM_DATABASE_NAME="openqrm" # database name -OPENQRM_DATABASE_USER="openqrm" # database user -OPENQRM_DATABASE_PASSWORD="test" # database password - - -Hints for compiling php + postgress support : - -Use the standart php with postgres support -start postgres and create db by : - -su - postgres --bash-2.05b$ dropdb openqrm -DROP DATABASE --bash-2.05b$ createdb openqrm -CREATE DATABASE --bash-2.05b$ dropuser openqrm -DROP USER --bash-2.05b$ createuser -a -D -P openqrm -Enter password for user "openqrm": -Enter it again: -CREATE USER --bash-2.05b$ - - diff --git a/openQRM-5.3.50-CE/src/etc/db/postgres/openqrm-postgres-functions b/openQRM-5.3.50-CE/src/etc/db/postgres/openqrm-postgres-functions deleted file mode 100644 index e4bb598..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/postgres/openqrm-postgres-functions +++ /dev/null @@ -1,642 +0,0 @@ -#!/bin/bash -# openQRM postgres-specfic functions -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SERVER_BASE_DIR before sourcing $0" - exit 1 -fi - -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -OPENQRM_DATABASE_INIT="$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/postgres/openqrm-postgres-init.sql" -OPENQRM_DATABASE_INIT_TMP=/tmp/openqrm-postgres-init.sql -OPENQRM_DATABASE_MAINTENANCE="$OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/postgres/openqrm-postgres-maintenance" -OPENQRM_DATABASE_MAINTENANCE_FNAME=`basename $OPENQRM_DATABASE_MAINTENANCE` - - -if ! which psql 1>/dev/null 2>&1; then - echo "ERROR: Postgres client 'psql' not installed/found on this system" - exit 1 -else - POSTGRES_CLIENT=`which psql` -fi -if ! which pg_dump 1>/dev/null 2>&1; then - echo "ERROR: Postgres 'pg_dump' not installed/found on this system" - exit 1 -else - POSTGRES_DUMP=`which pg_dump` -fi - - -function initialize_database() { - echo "Initializing the openQRM-database" - cat $OPENQRM_DATABASE_INIT | \ - sed -e "s/OPENQRM_SERVER_IP_ADDRESS/$OPENQRM_SERVER_IP_ADDRESS/g" \ - > $OPENQRM_DATABASE_INIT_TMP - chmod 777 $OPENQRM_DATABASE_INIT_TMP - su - postgres -c "kill `ps ax | grep postgres | grep -w $OPENQRM_DATABASE_NAME | awk '{ print $1}'` && dropdb $OPENQRM_DATABASE_NAME" 1>/dev/null 2>&1 - su - postgres -c "dropuser $OPENQRM_DATABASE_USER" 1>/dev/null 2>&1 - su - postgres -c "createdb $OPENQRM_DATABASE_NAME" - su - postgres -c "createuser -s $OPENQRM_DATABASE_USER" - su - postgres -c "$POSTGRES_CLIENT -d $OPENQRM_DATABASE_NAME --set openqrmdbuser=$OPENQRM_DATABASE_USER -f $OPENQRM_DATABASE_INIT_TMP" - RET=$? - if [ "$OPENQRM_DATABASE_PASSWORD" != "" ]; then - su - postgres -c "$POSTGRES_CLIENT -c \"ALTER USER $OPENQRM_DATABASE_USER WITH PASSWORD '$OPENQRM_DATABASE_PASSWORD'\"" - fi - rm -f $OPENQRM_DATABASE_INIT_TMP - # add the db maintenance to cron - cat $OPENQRM_DATABASE_MAINTENANCE | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" > /etc/cron.daily/$OPENQRM_DATABASE_MAINTENANCE_FNAME - chmod +x /etc/cron.daily/$OPENQRM_DATABASE_MAINTENANCE_FNAME - if [ -x "/etc/init.d/cron" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d cron reload - else - /etc/init.d/cron reload - fi - elif [ -x "/etc/init.d/crond" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d crond reload - else - /etc/init.d/crond reload - fi - else - echo "Could not find cron init script in /etc/init.d/. Please reload cron manually!" - fi - return $RET -} - - - -function backup_database() { - local SQL=$1 - local PG_BACKUP_DIR=`dirname $SQL` - chown -R postgres $PG_BACKUP_DIR - echo "Creating backup of the openQRM-database at $SQL" - su - postgres -c "$POSTGRES_DUMP -w $OPENQRM_DATABASE_NAME > $SQL" - return $RET - -} - -function restore_database() { - local SQL=$1 - echo "Restoring the openQRM-database from $SQL" - su - postgres -c "$POSTGRES_CLIENT -d $OPENQRM_DATABASE_NAME --set openqrmdbuser=$OPENQRM_DATABASE_USER -f $SQL" - return $RET -} - -function drop_database() { - echo "Dropping the openQRM-database" - su - postgres -c "dropdb $OPENQRM_DATABASE_NAME" 1>/dev/null 2>&1 - RET=$? - # remove maintenance cron job - rm -f /etc/cron.daily/$OPENQRM_DATABASE_MAINTENANCE_FNAME - if [ -x "/etc/init.d/cron" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d cron reload - else - /etc/init.d/cron reload - fi - elif [ -x "/etc/init.d/crond" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d crond reload - else - /etc/init.d/crond reload - fi - else - echo "Could not find cron init script in /etc/init.d/. Please reload cron manually!" - fi - return $RET -} - - - -########################### functions to update the db shema ########################### - -function check_table_exists(){ - local DB_TABLE=$1 - local SQL="select * from $DB_TABLE" - su - postgres -c "$POSTGRES_CLIENT -d $OPENQRM_DATABASE_NAME --set openqrmdbuser=$OPENQRM_DATABASE_USER --command \"$SQL\"" 1>/dev/null 2>&1 -} - - -function check_column_in_table_exists(){ - local DB_TABLE=$1 - local DB_COLUMN=$2 - local SQL="select $DB_COLUMN from $DB_TABLE" - su - postgres -c "$POSTGRES_CLIENT -d $OPENQRM_DATABASE_NAME --set openqrmdbuser=$OPENQRM_DATABASE_USER --command \"$SQL\"" 1>/dev/null 2>&1 -} - - -function check_if_data_in_column_of_table_exists(){ - local DB_TABLE=$1 - local DB_COLUMN=$2 - local DB_DATA=$3 - local DB_OUTPUT_LOG="/tmp/dboutput.log" - local SQL="select * from $DB_TABLE where $DB_COLUMN=$DB_DATA" - su - postgres -c "$POSTGRES_CLIENT -d $OPENQRM_DATABASE_NAME --set openqrmdbuser=$OPENQRM_DATABASE_USER --command \"$SQL\"" | head -n3 | grep -v "(.*)" | tail -n+3 | awk '{ print $1 }' > $DB_OUTPUT_LOG - RET=$? - DB_OUTPUT=`cat $DB_OUTPUT_LOG` - if [ "$RET" == 0 ]; then - if [ "$DB_OUTPUT" == "" ]; then - return 1 - else - return 0 - fi - else - return $RET - fi -} - - - -function run_sql(){ - local DB_SQL=$@ - su - postgres -c "$POSTGRES_CLIENT -d $OPENQRM_DATABASE_NAME --set openqrmdbuser=$OPENQRM_DATABASE_USER --command \"$DB_SQL\"" -} - - - - -function db_update() { - - # this function applies needed updates to the db-shema if needed in an idempotent way - if [ -f "$OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/etc/openqrm-server.conf" ]; then - # for update we have to source the old configuration - . $OPENQRM_SERVER_BASE_DIR/openqrm_pre_update/etc/openqrm-server.conf - else - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - fi - - - #--------------------------------------------------------------------------- - # from 4.9 to 5.0 the following db changes are needed - #--------------------------------------------------------------------------- - # 1 > ALTER TABLE cloud_users ADD cu_lang varchar(4); - # 2 > UPDATE user_info set user_lang = 'en'; - # 3 > ALTER TABLE user_info ADD user_wizard_name varchar(255); - # 4 > ALTER TABLE user_info ADD user_wizard_step int8; - # 5 > ALTER TABLE user_info ADD user_wizard_id int8; - # 6 > ALTER TABLE appliance_info ADD appliance_wizard varchar(255); - # 7 > ALTER TABLE appliance_info ALTER appliance_cpumodel type varchar(255); - # 8 > ALTER TABLE resource_info ALTER resource_cpumodel type varchar(255); - # 9 > ALTER TABLE cloud_config ALTER cc_value type varchar(255); - # 10 > ALTER TABLE event_info ALTER event_id type int8; - # 11 > insert into cloud_config(cc_id, cc_key, cc_value) values (38, 'deprovision_warning', '100'); - # 12 > insert into cloud_config(cc_id, cc_key, cc_value) values (39, 'deprovision_pause', '50') - - - echo "- Checking database shema ..." - - # if cloud enabled ..... - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/cloud" ]; then - - # 1 > ALTER TABLE cloud_users ADD cu_lang varchar(4); - if ! check_column_in_table_exists cloud_users cu_lang; then - echo " -- db change : ALTER TABLE cloud_users ADD cu_lang varchar(4)" - run_sql "ALTER TABLE cloud_users ADD cu_lang varchar(4);" - fi - # 9 > ALTER TABLE cloud_config ALTER cc_value type varchar(255); - echo " -- db change : ALTER TABLE cloud_config ALTER cc_value type varchar(255)" - run_sql "ALTER TABLE cloud_config ALTER cc_value type varchar(255);" - - # 11 > insert into cloud_config(cc_id, cc_key, cc_value) values (38, 'deprovision_warning', '100'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 38; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (38, 'deprovision_warning', '100')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (38, 'deprovision_warning', '100');" - fi - fi - - # 12 > insert into cloud_config(cc_id, cc_key, cc_value) values (39, 'deprovision_pause', '50') - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 39; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (39, 'deprovision_pause', '50')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (39, 'deprovision_pause', '50');" - fi - fi - fi - - # 2 > UPDATE user_info set user_lang = 'en'; - echo " -- db change : UPDATE user_info set user_lang = 'en'" - run_sql "UPDATE user_info set user_lang = 'en';" - - # 3 > ALTER TABLE user_info ADD user_wizard_name varchar(255); - if ! check_column_in_table_exists user_info user_wizard_name; then - echo " -- db change : ALTER TABLE user_info ADD user_wizard_name varchar(255)" - run_sql "ALTER TABLE user_info ADD user_wizard_name varchar(255);" - fi - - # 4 > ALTER TABLE user_info ADD user_wizard_step int8; - if ! check_column_in_table_exists user_info user_wizard_step; then - echo " -- db change : ALTER TABLE user_info ADD user_wizard_step int8" - run_sql "ALTER TABLE user_info ADD user_wizard_step int8;" - fi - - # 5 > ALTER TABLE user_info ADD user_wizard_id int8; - if ! check_column_in_table_exists user_info user_wizard_id; then - echo " -- db change : ALTER TABLE user_info ADD user_wizard_id int8" - run_sql "ALTER TABLE user_info ADD user_wizard_id int8;" - fi - - # 6 > ALTER TABLE appliance_info ADD appliance_wizard varchar(255); - if ! check_column_in_table_exists appliance_info appliance_wizard; then - echo " -- db change : ALTER TABLE appliance_info ADD appliance_wizard varchar(255)" - run_sql "ALTER TABLE appliance_info ADD appliance_wizard varchar(255);" - fi - - # 7 > ALTER TABLE appliance_info ALTER appliance_cpumodel type varchar(255); - echo " -- db change : ALTER TABLE appliance_info ALTER appliance_cpumodel type varchar(255)" - run_sql "ALTER TABLE appliance_info ALTER appliance_cpumodel type varchar(255);" - - # 8 > ALTER TABLE resource_info ALTER resource_cpumodel type varchar(255); - echo " -- db change : ALTER TABLE resource_info ALTER resource_cpumodel type varchar(255)" - run_sql "ALTER TABLE resource_info ALTER resource_cpumodel type varchar(255);" - - # 10 > ALTER TABLE event_info ALTER event_id type int8; - echo " -- db change : ALTER TABLE event_info ALTER event_id type int8" - run_sql "ALTER TABLE event_info ALTER event_id type int8;" - - echo "- Database sanity check for version 4.9 to 5.0 finished" - - # from 5.0 to 5.1 - #--------------------------------------------------------------------------- - # from 5.0 to 5.1 the following db changes are needed - #--------------------------------------------------------------------------- - # 1 > insert into cloud_config(cc_id, cc_key, cc_value) values (40, 'vm_provision_delay', '0'); - # 2 > insert into cloud_config(cc_id, cc_key, cc_value) values (41, 'vm_loadbalance_algorithm', '0'); - # 3 > ALTER TABLE role_info ADD role_comment VARCHAR(255); - # 4 > ALTER TABLE virtualization_info ALTER virtualization_type type varchar(50); - # 5 > ALTER TABLE image_info ALTER image_type type varchar(255); - # 6 > update virtualization_info set virtualization_name = 'KVM VM (networkboot)', virtualization_type='kvm-vm-net' where virtualization_type='kvm-vm'; - # 7 > update virtualization_info set virtualization_name = 'KVM VM (localboot)', virtualization_type='kvm-vm-local' where virtualization_type='kvm-storage-vm'; - # 8 > insert into deployment_info(deployment_id, deployment_name, deployment_type, deployment_description, deployment_storagetype, deployment_storagedescription) values ($NEW_DEPLOYMENT_ID, 'kvm-gluster-deployment', 'kvm-gluster-deployment', 'Glusterfs deployment for KVM', 'kvm', 'KVM Gluster Storage'); - # 9 > update virtualization_info set virtualization_name = 'Citrix VM (networkboot)', virtualization_type='citrix-vm-net' where virtualization_type='citrix-vm'; - # 10 > update virtualization_info set virtualization_name = 'Citrix VM (localboot)', virtualization_type='citrix-vm-local' where virtualization_type='citrix-storage-vm'; - # 11 > update virtualization_info set virtualization_name = 'LXC VM (localboot)', virtualization_type='lxc-vm-local' where virtualization_type='lxc-storage-vm'; - # 12 > update virtualization_info set virtualization_name = 'OpenVZ VM (localboot)', virtualization_type='openvz-vm-local' where virtualization_type='openvz-storage-vm'; - # 13 > update virtualization_info set virtualization_name = 'ESX VM (networkboot)', virtualization_type='vmware-esx-vm-net' where virtualization_type='vmware-esx-vm'; - # 14 > update virtualization_info set virtualization_name = 'Xen VM (networkboot)', virtualization_type='xen-vm-net' where virtualization_type='xen-vm'; - # 15 > update virtualization_info set virtualization_name = 'Xen VM (localboot)', virtualization_type='xen-vm-local' where virtualization_type='xen-storage-vm'; - # 16 > create table datacenter_info(datacenter_id int8 NOT NULL PRIMARY KEY, datacenter_load_overall varchar(50), datacenter_load_server varchar(50), datacenter_load_storage varchar(50), datacenter_cpu_total varchar(50), datacenter_mem_total varchar(50), datacenter_mem_used varchar(50)); - # 17 > ALTER TABLE appliance_info ALTER appliance_comment type varchar(255); - - - # 3 > ALTER TABLE role_info ADD role_comment VARCHAR(255); - if ! check_column_in_table_exists role_info role_comment; then - echo " -- db change : ALTER TABLE role_info ADD role_comment VARCHAR(255)" - run_sql "ALTER TABLE role_info ADD role_comment VARCHAR(255);" - fi - # 4 > ALTER TABLE virtualization_info ALTER virtualization_type type varchar(50); - echo " -- db change : ALTER TABLE virtualization_info ALTER virtualization_type type varchar(50)" - run_sql "ALTER TABLE virtualization_info ALTER virtualization_type type varchar(50);" - # 5 > ALTER TABLE image_info ALTER image_type type varchar(255); - echo " -- db change : ALTER TABLE image_info ALTER image_type type varchar(255)" - run_sql "ALTER TABLE image_info ALTER image_type type varchar(255);" - - # virtualization plugin merge - # citrix - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/citrix" ]; then - # 9 > update virtualization_info set virtualization_name = 'Citrix VM (networkboot)', virtualization_type='citrix-vm-net' where virtualization_type='citrix-vm'; - run_sql "update virtualization_info set virtualization_name = 'Citrix VM (networkboot)', virtualization_type='citrix-vm-net' where virtualization_type='citrix-vm';" - fi - # citrix-storage - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/citrix-storage" ]; then - # 10 > update virtualization_info set virtualization_name = 'Citrix VM (localboot)', virtualization_type='citrix-vm-local' where virtualization_type='citrix-storage-vm'; - run_sql "update virtualization_info set virtualization_name = 'Citrix VM (localboot)', virtualization_type='citrix-vm-local' where virtualization_type='citrix-storage-vm';" - fi - # kvm - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/kvm" ]; then - echo "- adapting KVM Plugin database tables" - # 6 > update virtualization_info set virtualization_name = 'KVM VM (networkboot)', virtualization_type='kvm-vm-net' where virtualization_type='kvm-vm'; - echo " -- db change : update virtualization_info set virtualization_name = 'KVM VM (networkboot)', virtualization_type='kvm-vm-net' where virtualization_type='kvm-vm';" - run_sql "update virtualization_info set virtualization_name = 'KVM VM (networkboot)', virtualization_type='kvm-vm-net' where virtualization_type='kvm-vm';" - # 8 > insert into deployment_info(deployment_id, deployment_name, deployment_type, deployment_description, deployment_storagetype, deployment_storagedescription) values ($NEW_DEPLOYMENT_ID, 'kvm-gluster-deployment', 'kvm-gluster-deployment', 'Glusterfs deployment for KVM', 'kvm', 'KVM Gluster Storage'); - # glusterfs deployment - DEPLOYMENT_EXISTS=`run_sql "select deployment_id from deployment_info where deployment_type='kvm-gluster-deployment';" | head -n3 | grep -v "(.*)" | tail -n+3 | awk '{ print $1 }'` - if [ "$DEPLOYMENT_EXISTS" == "" ]; then - NEW_DEPLOYMENT_ID=`run_sql "select count(deployment_id) from deployment_info;" | head -n3 | grep -v "(.*)" | tail -n+3 | awk '{ print $1 }'` - NEW_DEPLOYMENT_ID=$(( NEW_DEPLOYMENT_ID + 1 )) - echo " -- db change : insert into deployment_info(deployment_id, deployment_name, deployment_type, deployment_description, deployment_storagetype, deployment_storagedescription) values ($NEW_DEPLOYMENT_ID, 'kvm-gluster-deployment', 'kvm-gluster-deployment', 'Glusterfs deployment for KVM', 'kvm', 'KVM Gluster Storage')" - run_sql "insert into deployment_info(deployment_id, deployment_name, deployment_type, deployment_description, deployment_storagetype, deployment_storagedescription) values ($NEW_DEPLOYMENT_ID, 'kvm-gluster-deployment', 'kvm-gluster-deployment', 'Glusterfs deployment for KVM', 'kvm', 'KVM Gluster Storage');" - fi - fi - # kvm-storage - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/kvm-storage" ]; then - # 7 > update virtualization_info set virtualization_name = 'KVM VM (localboot)', virtualization_type='kvm-vm-local' where virtualization_type='kvm-storage-vm'; - echo " -- db change : update virtualization_info set virtualization_name = 'KVM VM (localboot)', virtualization_type='kvm-vm-local' where virtualization_type='kvm-storage-vm';" - run_sql "update virtualization_info set virtualization_name = 'KVM VM (localboot)', virtualization_type='kvm-vm-local' where virtualization_type='kvm-storage-vm';" - fi - # lxc-storage - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/lxc-storage" ]; then - # 11 > update virtualization_info set virtualization_name = 'LXC VM (localboot)', virtualization_type='lxc-vm-local' where virtualization_type='lxc-storage-vm'; - run_sql "update virtualization_info set virtualization_name = 'LXC VM (localboot)', virtualization_type='lxc-vm-local' where virtualization_type='lxc-storage-vm';" - fi - # openvz - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/openvz-storage" ]; then - # 12 > update virtualization_info set virtualization_name = 'OpenVZ VM (localboot)', virtualization_type='openvz-vm-local' where virtualization_type='openvz-storage-vm'; - run_sql "update virtualization_info set virtualization_name = 'OpenVZ VM (localboot)', virtualization_type='openvz-vm-local' where virtualization_type='openvz-storage-vm';" - fi - # vmware-esx - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/vmware-esx" ]; then - # 13 > update virtualization_info set virtualization_name = 'ESX VM (networkboot)', virtualization_type='vmware-esx-vm-net' where virtualization_type='vmware-esx-vm'; - run_sql "update virtualization_info set virtualization_name = 'ESX VM (networkboot)', virtualization_type='vmware-esx-vm-net' where virtualization_type='vmware-esx-vm';" - fi - # xen - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/xen" ]; then - # 14 > update virtualization_info set virtualization_name = 'Xen VM (networkboot)', virtualization_type='xen-vm-net' where virtualization_type='xen-vm'; - run_sql "update virtualization_info set virtualization_name = 'Xen VM (networkboot)', virtualization_type='xen-vm-net' where virtualization_type='xen-vm';" - fi - # xen-storage - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/xen-storage" ]; then - # 15 > update virtualization_info set virtualization_name = 'Xen VM (localboot)', virtualization_type='xen-vm-local' where virtualization_type='xen-storage-vm'; - run_sql "update virtualization_info set virtualization_name = 'Xen VM (localboot)', virtualization_type='xen-vm-local' where virtualization_type='xen-storage-vm';" - fi - - # if cloud enabled ..... - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/cloud" ]; then - # 1 > insert into cloud_config(cc_id, cc_key, cc_value) values (40, 'vm_provision_delay', '0'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 40; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (40, 'vm_provision_delay', '0')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (40, 'vm_provision_delay', '0');" - fi - fi - # 2 > insert into cloud_config(cc_id, cc_key, cc_value) values (41, 'vm_loadbalance_algorithm', '0'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 41; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (41, 'vm_loadbalance_algorithm', '0')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (41, 'vm_loadbalance_algorithm', '0');" - fi - fi - fi - - # datacenter statistics - # 16 > create table datacenter_info(datacenter_id int8 NOT NULL PRIMARY KEY, datacenter_load_overall varchar(50), datacenter_load_server varchar(50), datacenter_load_storage varchar(50), datacenter_cpu_total varchar(50), datacenter_mem_total varchar(50), datacenter_mem_used varchar(50)); - if ! check_table_exists datacenter_info; then - echo " -- db change : create table datacenter_info(datacenter_id int8 NOT NULL PRIMARY KEY, datacenter_load_overall varchar(50), datacenter_load_server varchar(50), datacenter_load_storage varchar(50), datacenter_cpu_total varchar(50), datacenter_mem_total varchar(50), datacenter_mem_used varchar(50))" - run_sql "create table datacenter_info(datacenter_id int8 NOT NULL PRIMARY KEY, datacenter_load_overall varchar(50), datacenter_load_server varchar(50), datacenter_load_storage varchar(50), datacenter_cpu_total varchar(50), datacenter_mem_total varchar(50), datacenter_mem_used varchar(50));" - fi - - # 17 > ALTER TABLE appliance_info ALTER appliance_comment type varchar(255); - echo " -- db change : ALTER TABLE appliance_info ALTER appliance_comment type varchar(255)" - run_sql "ALTER TABLE appliance_info ALTER appliance_comment type varchar(255);" - - echo "- Database sanity check for version 5.0 to 5.1 finished" - - # from 5.1 to 5.2 - #--------------------------------------------------------------------------- - # from 5.1 to 5.2 the following db changes are needed - #--------------------------------------------------------------------------- - # 1 > insert into cloud_config(cc_id, cc_key, cc_value) values (42, 'allow_vnc_access', 'true'); - # 2 > ALTER TABLE cloud_requests ADD cr_image_password VARCHAR(255); - # 3 > create table lock_info(lock_id int8 NOT NULL PRIMARY KEY,lock_time varchar(50),lock_section varchar(50),lock_resource_id int8,lock_token varchar(50),lock_description varchar(255)); - # 4 > ALTER TABLE appliance_info ALTER appliance_capabilities type varchar(1000); - # 5 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_username VARCHAR(255); - # 6 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_password VARCHAR(255); - # 7 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_host VARCHAR(255); - # 8 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_port VARCHAR(255); - # 9 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_tenant VARCHAR(255); - # 10 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_endpoint VARCHAR(255); - # 11 > ALTER TABLE cloud_create_vm_lc ALTER vc_cr_resource_number type BIGINT; - # 12 > ALTER TABLE kernel_info ALTER kernel_name type VARCHAR(255); - # 13 > ALTER TABLE image_info ALTER image_name type VARCHAR(255); - # 14 > ALTER TABLE storage_info ALTER storage_name type VARCHAR(255); - # 15 > ALTER TABLE auth_blocker_info ALTER ab_image_name type VARCHAR(255); - # 16 > ALTER TABLE resource_info ADD resource_vname VARCHAR(255); - # 17 > ALTER TABLE resource_info ADD resource_vnc VARCHAR(30); - # 18 > insert into cloud_config(cc_id, cc_key, cc_value) values (43, 'max_network', '1000'); - # 19 > insert into cloud_config(cc_id, cc_key, cc_value) values (44, 'max_memory', '10000'); - # 20 > insert into cloud_config(cc_id, cc_key, cc_value) values (45, 'max_cpu', '100'); - # 21 > ALTER TABLE cloud_selector ALTER name type VARCHAR(255); - # 22 > ALTER TABLE cloud_requests ADD cr_appliance_capabilities VARCHAR(1000); - # 23 > ALTER TABLE cloud_profiles ADD pr_appliance_capabilities VARCHAR(1000); - # 24 > update resource_info set resource_vtype=1 where resource_id=0 and resource_vtype IS NULL; - # 25 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_subscription_id VARCHAR(255); - # 26 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_keyfile VARCHAR(5000); - - - # if cloud enabled ..... - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/cloud" ]; then - # 1 > insert into cloud_config(cc_id, cc_key, cc_value) values (42, 'allow_vnc_access', 'true'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 42; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (42, 'allow_vnc_access', 'true')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (42, 'allow_vnc_access', 'true')" - fi - fi - # 18 > insert into cloud_config(cc_id, cc_key, cc_value) values (43, 'max_network', '1000'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 43; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (43, 'max_network', '1000')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (43, 'max_network', '1000');" - fi - fi - # 19 > insert into cloud_config(cc_id, cc_key, cc_value) values (44, 'max_memory', '10000'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 44; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (44, 'max_memory', '10000')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (44, 'max_memory', '10000');" - fi - fi - # 20 > insert into cloud_config(cc_id, cc_key, cc_value) values (45, 'max_cpu', '100'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 45; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (45, 'max_cpu', '100')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (45, 'max_cpu', '100');" - fi - fi - - # 21 > ALTER TABLE cloud_selector ALTER name type VARCHAR(255); - if check_table_exists cloud_selector; then - echo " -- db change : ALTER TABLE cloud_selector ALTER name type VARCHAR(255);" - run_sql "ALTER TABLE cloud_selector ALTER name type VARCHAR(255);" - fi - - # 2 > ALTER TABLE cloud_requests ADD cr_image_password VARCHAR(255); - if check_table_exists cloud_requests; then - if ! check_column_in_table_exists cloud_requests cr_image_password; then - echo " -- db change : ALTER TABLE cloud_requests ADD cr_image_password VARCHAR(255)" - run_sql "ALTER TABLE cloud_requests ADD cr_image_password VARCHAR(255);" - fi - fi - # 11 > ALTER TABLE cloud_create_vm_lc ALTER vc_cr_resource_number type BIGINT; - if check_table_exists cloud_create_vm_lc; then - echo " -- db change : ALTER TABLE cloud_create_vm_lc ALTER vc_cr_resource_number type BIGINT" - run_sql "ALTER TABLE cloud_create_vm_lc ALTER vc_cr_resource_number type BIGINT;" - fi - # 22 > ALTER TABLE cloud_requests ADD cr_appliance_capabilities VARCHAR(1000); - if check_table_exists cloud_requests; then - if ! check_column_in_table_exists cloud_requests cr_appliance_capabilities; then - echo " -- db change : ALTER TABLE cloud_requests ADD cr_appliance_capabilities VARCHAR(1000)" - run_sql "ALTER TABLE cloud_requests ADD cr_appliance_capabilities VARCHAR(1000);" - fi - fi - # 23 > ALTER TABLE cloud_profiles ADD pr_appliance_capabilities VARCHAR(1000); - if check_table_exists cloud_profiles; then - if ! check_column_in_table_exists cloud_profiles pr_appliance_capabilities; then - echo " -- db change : ALTER TABLE cloud_profiles ADD pr_appliance_capabilities VARCHAR(1000)" - run_sql "ALTER TABLE cloud_profiles ADD pr_appliance_capabilities VARCHAR(1000);" - fi - fi - fi - - # 3 > create table lock_info(lock_id int8 NOT NULL PRIMARY KEY,lock_time varchar(50),lock_section varchar(50),lock_resource_id int8,lock_token varchar(50),lock_description varchar(255)); - if ! check_table_exists lock_info; then - echo " -- db change : create table lock_info(lock_id int8 NOT NULL PRIMARY KEY,lock_time varchar(50),lock_section varchar(50),lock_resource_id int8,lock_token varchar(50),lock_description varchar(255))" - run_sql "create table lock_info(lock_id int8 NOT NULL PRIMARY KEY,lock_time varchar(50),lock_section varchar(50),lock_resource_id int8,lock_token varchar(50),lock_description varchar(255));" - fi - - # 4 > ALTER TABLE appliance_info ALTER appliance_capabilities type varchar(1000); - echo " -- db change : ALTER TABLE appliance_info ALTER appliance_capabilities type varchar(1000);" - run_sql "ALTER TABLE appliance_info ALTER appliance_capabilities type varchar(1000);" - - # if hybrid-cloud enabled ..... - if [ -e "$OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/hybrid-cloud" ]; then - if check_table_exists hybrid_cloud_accounts; then - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_username; then - # 5 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_username VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_username VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_password; then - # 6 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_password VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_password VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_host; then - # 7 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_host VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_host VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_port; then - # 8 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_port VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_port VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_tenant; then - # 9 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_tenant VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_tenant VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_endpoint; then - # 10 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_endpoint VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_endpoint VARCHAR(255);" - fi - - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_subscription_id; then - # 25 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_subscription_id VARCHAR(255); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_subscription_id VARCHAR(255);" - fi - if ! check_column_in_table_exists hybrid_cloud_accounts hybrid_cloud_keyfile; then - # 26 > ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_keyfile VARCHAR(5000); - run_sql "ALTER TABLE hybrid_cloud_accounts ADD hybrid_cloud_keyfile VARCHAR(5000);" - fi - fi - fi - - # 12 > ALTER TABLE kernel_info ALTER kernel_name type VARCHAR(255); - run_sql "ALTER TABLE kernel_info ALTER kernel_name type VARCHAR(255);" - # 13 > ALTER TABLE image_info ALTER image_name type VARCHAR(255); - run_sql "ALTER TABLE image_info ALTER image_name type VARCHAR(255);" - # 14 > ALTER TABLE storage_info ALTER storage_name type VARCHAR(255); - run_sql "ALTER TABLE storage_info ALTER storage_name type VARCHAR(255);" - # 15 > ALTER TABLE auth_blocker_info ALTER ab_image_name type VARCHAR(255); - run_sql "ALTER TABLE auth_blocker_info ALTER ab_image_name type VARCHAR(255);" - - if ! check_column_in_table_exists resource_info resource_vname; then - # 16 > ALTER TABLE resource_info ADD resource_vname VARCHAR(255); - run_sql "ALTER TABLE resource_info ADD resource_vname VARCHAR(255);" - fi - if ! check_column_in_table_exists resource_info resource_vnc; then - # 17 > ALTER TABLE resource_info ADD resource_vnc VARCHAR(30); - run_sql "ALTER TABLE resource_info ADD resource_vnc VARCHAR(30);" - fi - - # 24 > update resource_info set resource_vtype=1 where resource_id=0 and resource_vtype IS NULL; - run_sql "update resource_info set resource_vtype=1 where resource_id=0 and resource_vtype IS NULL;" - - echo "- Database sanity check for version 5.1 to 5.2 finished" - - # from 5.2 to 5.3 - #--------------------------------------------------------------------------- - # from 5.2 to 5.3 the following db changes are needed - #--------------------------------------------------------------------------- - # 1 > ALTER TABLE image_info ADD image_size int8 - # 2 > ALTER TABLE image_info ALTER image_deployment_parameter type varchar(1000); - # 3 > ALTER TABLE cloud_requests ADD cr_size_req VARCHAR(255); - # 4 > ALTER TABLE cloud_profiles ADD pr_size_req VARCHAR(255); - # 5 > ALTER TABLE ip_mgmt ADD ip_mgmt_resource_id BIGINT; - # 6 > ALTER TABLE ip_mgmt ADD ip_mgmt_bridge_name VARCHAR(50); - # 7 > insert into cloud_config(cc_id, cc_key, cc_value) values (46, 'bandwidth_metering', 'true'); - - if ! check_column_in_table_exists image_info image_size; then - # 1 > ALTER TABLE image_info ADD image_size int8 - run_sql "ALTER TABLE image_info ADD image_size int8;" - fi - - # 2 > ALTER TABLE image_info ALTER image_deployment_parameter type varchar(1000); - echo " -- db change : ALTER TABLE image_info ALTER image_deployment_parameter type varchar(1000);" - run_sql "ALTER TABLE image_info ALTER image_deployment_parameter type varchar(1000);" - - if ! check_column_in_table_exists cloud_requests cr_size_req; then - # 3 > ALTER TABLE cloud_requests ADD cr_size_req VARCHAR(255); - run_sql "ALTER TABLE cloud_requests ADD cr_size_req VARCHAR(255);" - fi - if ! check_column_in_table_exists cloud_profiles pr_size_req; then - # 4 > ALTER TABLE cloud_profiles ADD pr_size_req VARCHAR(255); - run_sql "ALTER TABLE cloud_profiles ADD pr_size_req VARCHAR(255);" - fi - - if ! check_column_in_table_exists ip_mgmt ip_mgmt_resource_id; then - # 5 > ALTER TABLE ip_mgmt ADD ip_mgmt_resource_id BIGINT(30); - run_sql "ALTER TABLE ip_mgmt ADD ip_mgmt_resource_id BIGINT(30);" - fi - - if ! check_column_in_table_exists ip_mgmt ip_mgmt_bridge_name; then - # 6 > ALTER TABLE ip_mgmt ADD ip_mgmt_bridge_name VARCHAR(50); - run_sql "ALTER TABLE ip_mgmt ADD ip_mgmt_bridge_name VARCHAR(50);" - fi - - # 7 > insert into cloud_config(cc_id, cc_key, cc_value) values (46, 'bandwidth_metering', 'true'); - if check_table_exists cloud_config; then - if ! check_if_data_in_column_of_table_exists cloud_config cc_id 46; then - echo " -- db change : insert into cloud_config(cc_id, cc_key, cc_value) values (46, 'bandwidth_metering', 'true')" - run_sql "insert into cloud_config(cc_id, cc_key, cc_value) values (46, 'bandwidth_metering', 'true');" - fi - fi - - - echo "- Database sanity check for version 5.2 to 5.3 finished" - - - -} - - - - -case "$1" in - init) - initialize_database - ;; - backup) - backup_database $2 - ;; - restore) - restore_database $2 - ;; - drop) - drop_database - ;; - update) - db_update - ;; -esac diff --git a/openQRM-5.3.50-CE/src/etc/db/postgres/openqrm-postgres-init.sql b/openQRM-5.3.50-CE/src/etc/db/postgres/openqrm-postgres-init.sql deleted file mode 100644 index 17469ee..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/postgres/openqrm-postgres-init.sql +++ /dev/null @@ -1,252 +0,0 @@ - -drop table resource_info; -create table resource_info( - resource_id int8 NOT NULL PRIMARY KEY, - resource_localboot int8, - resource_kernel varchar(50), - resource_kernelid int8, - resource_image varchar(50), - resource_imageid int8, - resource_openqrmserver varchar(20), - resource_basedir varchar(100), - resource_applianceid int8, - resource_ip varchar(20), - resource_subnet varchar(20), - resource_broadcast varchar(20), - resource_network varchar(20), - resource_mac varchar(20), - resource_nics int8, - resource_uptime int8, - resource_cpunumber int8, - resource_cpuspeed int8, - resource_cpumodel varchar(255), - resource_memtotal int8, - resource_memused int8, - resource_swaptotal int8, - resource_swapused int8, - resource_hostname varchar(60), - resource_vtype int8, - resource_vhostid int8, - resource_vname varchar(255), - resource_vnc varchar(30), - resource_load decimal(4,2), - resource_execdport int8, - resource_senddelay int8, - resource_capabilities varchar(255), - resource_lastgood varchar(10), - resource_state varchar(20), - resource_event varchar(20) -); - - -drop table kernel_info; -create table kernel_info( - kernel_id int8 NOT NULL PRIMARY KEY, - kernel_name varchar(255), - kernel_version varchar(50), - kernel_capabilities varchar(255), - kernel_comment varchar(255) -); - - -drop table image_info; -create table image_info( - image_id int8 NOT NULL PRIMARY KEY, - image_name varchar(255), - image_version varchar(30), - image_type varchar(255), - image_rootdevice varchar(255), - image_rootfstype varchar(255), - image_size int8, - image_storageid int8, - image_deployment_parameter varchar(1000), - image_isshared int8, - image_isactive int8, - image_comment varchar(255), - image_capabilities varchar(255) -); - - -drop table appliance_info; -create table appliance_info( - appliance_id int8 NOT NULL PRIMARY KEY, - appliance_name varchar(50), - appliance_kernelid int8, - appliance_imageid int8, - appliance_starttime int8, - appliance_stoptime int8, - appliance_cpunumber int8, - appliance_cpuspeed int8, - appliance_cpumodel varchar(255), - appliance_memtotal int8, - appliance_swaptotal int8, - appliance_nics int8, - appliance_capabilities varchar(1000), - appliance_cluster int8, - appliance_ssi int8, - appliance_resources int8, - appliance_highavailable int8, - appliance_virtual int8, - appliance_virtualization varchar(20), - appliance_virtualization_host int8, - appliance_state varchar(20), - appliance_comment varchar(255), - appliance_wizard varchar(255), - appliance_event varchar(20) -); - -drop table event_info; -create table event_info( - event_id int8 NOT NULL PRIMARY KEY, - event_name varchar(255), - event_time varchar(50), - event_priority int8, - event_source varchar(255), - event_description varchar(255), - event_comment varchar(255), - event_capabilities varchar(255), - event_status int8, - event_image_id int8, - event_resource_id int8 -); - - - -drop table user_info; -create table user_info( - user_id int8 NOT NULL PRIMARY KEY, - user_name varchar(20), - user_password varchar(20), - user_gender varchar(1), - user_first_name varchar(50), - user_last_name varchar(50), - user_department varchar(50), - user_office varchar(50), - user_role int8, - user_last_update_time varchar(50), - user_description varchar(255), - user_capabilities varchar(255), - user_wizard_name varchar(255), - user_wizard_step int8, - user_wizard_id int8, - user_state varchar(20), - user_lang varchar(5) -); - - -drop table role_info; -create table role_info( - role_id int8 NOT NULL PRIMARY KEY, - role_name varchar(20), - role_comment varchar(255) -); - - -drop table storage_info; -create table storage_info( - storage_id int8 NOT NULL PRIMARY KEY, - storage_name varchar(255), - storage_resource_id int8, - storage_type int8, - storage_comment varchar(255), - storage_capabilities varchar(255), - storage_state varchar(20) -); - -drop table resource_service; -create table resource_service( - resource_id int8 NOT NULL PRIMARY KEY, - service varchar(50) -); - -drop table image_service; -create table image_service( - image_id int8 NOT NULL PRIMARY KEY, - service varchar(50) -); - -drop table image_authentication_info; -create table image_authentication_info( - ia_id int8 NOT NULL PRIMARY KEY, - ia_image_id int8, - ia_resource_id int8, - ia_auth_type int8 -); - -drop table auth_blocker_info; -create table auth_blocker_info( - ab_id int8 NOT NULL PRIMARY KEY, - ab_image_id int8, - ab_image_name varchar(255), - ab_start_time varchar(20) -); - -drop table deployment_info; -create table deployment_info( - deployment_id int8 NOT NULL PRIMARY KEY, - deployment_storagetype_id int8, - deployment_name varchar(50), - deployment_type varchar(50), - deployment_description varchar(50), - deployment_storagetype varchar(50), - deployment_storagedescription varchar(50), - deployment_mapping varchar(255) -); - -drop table virtualization_info; -create table virtualization_info( - virtualization_id int8 NOT NULL PRIMARY KEY, - virtualization_name varchar(50), - virtualization_type varchar(50), - virtualization_mapping varchar(255) -); - -drop table datacenter_info; -create table datacenter_info( - datacenter_id int8 NOT NULL PRIMARY KEY, - datacenter_load_overall varchar(50), - datacenter_load_server varchar(50), - datacenter_load_storage varchar(50), - datacenter_cpu_total varchar(50), - datacenter_mem_total varchar(50), - datacenter_mem_used varchar(50) -); - -drop table lock_info; -create table lock_info( - lock_id int8 NOT NULL PRIMARY KEY, - lock_time varchar(50), - lock_section varchar(50), - lock_resource_id int8, - lock_token varchar(50), - lock_description varchar(255) -); - - -insert into kernel_info (kernel_id, kernel_name, kernel_version) values (0, 'openqrm', 'openqrm'); -insert into image_info (image_id, image_name, image_version, image_type, image_rootdevice, image_isshared) values (0, 'openqrm', 'openqrm', 'ram', 'ram', 0); - -insert into image_info (image_id, image_name, image_version, image_type, image_rootdevice, image_rootfstype, image_isshared) values ('1', 'idle', 'openQRM', 'ram', 'ram', 'ext2', '1'); -insert into resource_info (resource_id, resource_localboot, resource_kernel, resource_image, resource_openqrmserver, resource_ip, resource_vtype) values ('0', '1', 'local', 'local', 'OPENQRM_SERVER_IP_ADDRESS', 'OPENQRM_SERVER_IP_ADDRESS', '1'); -insert into deployment_info (deployment_id, deployment_name, deployment_type, deployment_description, deployment_storagetype, deployment_storagedescription ) values ('1', 'ramdisk', 'ram', 'Ramdisk Deployment', 'none', 'none'); -insert into virtualization_info (virtualization_id, virtualization_name, virtualization_type) values ('1', 'Physical System', 'physical'); -insert into user_info (user_id, user_name, user_password, user_gender, user_first_name, user_last_name, user_department, user_office, user_role, user_last_update_time, user_description, user_capabilities, user_state, user_lang) values (0, 'openqrm', 'openqrm', '-', '-', '-', '-', '-', 0, '-', 'default admin user', '', 'activated', 'en'); -insert into user_info (user_id, user_name, user_password, user_gender, user_first_name, user_last_name, user_department, user_office, user_role, user_last_update_time, user_description, user_capabilities, user_state, user_lang) values (1, 'anonymous', 'openqrm', '-', '-', '-', '-', '-', 1, '-', 'default readonly user', '', 'activated', 'en'); -insert into role_info (role_id, role_name) values (0, 'administrator'); -insert into role_info (role_id, role_name) values (1, 'readonly'); - -insert into appliance_info (appliance_id, appliance_name, appliance_kernelid, appliance_imageid, appliance_starttime, appliance_resources, appliance_virtualization, appliance_state, appliance_comment) values (1, 'openqrm', 0, 0, '10', 0, 1, 'active', 'openQRM server'); - -grant all on resource_info to :openqrmdbuser; -grant all on kernel_info to :openqrmdbuser; -grant all on image_info to :openqrmdbuser; -grant all on event_info to :openqrmdbuser; -grant all on user_info to :openqrmdbuser; -grant all on appliance_info to :openqrmdbuser; -grant all on role_info to :openqrmdbuser; -grant all on storage_info to :openqrmdbuser; -grant all on resource_service to :openqrmdbuser; -grant all on image_service to :openqrmdbuser; -grant all on deployment_info to :openqrmdbuser; -grant all on virtualization_info to :openqrmdbuser; -grant all on storage_info to :openqrmdbuser; diff --git a/openQRM-5.3.50-CE/src/etc/db/postgres/openqrm-postgres-maintenance b/openQRM-5.3.50-CE/src/etc/db/postgres/openqrm-postgres-maintenance deleted file mode 100644 index fbee099..0000000 --- a/openQRM-5.3.50-CE/src/etc/db/postgres/openqrm-postgres-maintenance +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# openQRM maintenance script, runs once a day via cron -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -. @@OPENQRM_SERVER_BASE_DIR@@/openqrm/etc/openqrm-server.conf -. @@OPENQRM_SERVER_BASE_DIR@@/openqrm/include/openqrm-server-functions -# get full server config -openqrm_server_get_config - -# define maintenance dir for postgres backup files -DB_MAINTENANCE_DIR="/var/spool/openqrm_db/" - -if ! which psql 1>/dev/null 2>&1; then - echo "ERROR: Postgres client 'psql' not installed/found on this system" - exit 1 -else - POSTGRES_CLIENT=`which psql` -fi -if ! which pg_dump 1>/dev/null 2>&1; then - echo "ERROR: Postgres 'pg_dump' not installed/found on this system" - exit 1 -else - POSTGRES_DUMP=`which pg_dump` -fi - -BACKUP_TIME=`date +%T--%x | sed -e "s/:/-/g" | sed -e "s#/#-#g"` -if [ ! -d "$DB_MAINTENANCE_DIR" ]; then - mkdir -p $DB_MAINTENANCE_DIR -fi - -# backup event_info table -echo "NOTICE: Saving event_info table to $DB_MAINTENANCE_DIR/openqrm_db_event_info_$BACKUP_TIME.sql" | logger -su - $OPENQRM_DATABASE_USER -c "$POSTGRES_DUMP -w -t event_info $OPENQRM_DATABASE_NAME" > $DB_MAINTENANCE_DIR/openqrm_db_event_info_$BACKUP_TIME.sql -gzip $DB_MAINTENANCE_DIR/openqrm_db_event_info_$BACKUP_TIME.sql -# clean up event_info table -echo "NOTICE: Cleaning event_info table" | logger -su - $OPENQRM_DATABASE_USER -c "$POSTGRES_CLIENT -d $OPENQRM_DATABASE_NAME --set openqrmdbuser=$OPENQRM_DATABASE_USER -c 'delete from event_info'" -# clean up datacenter_info table -echo "NOTICE: Cleaning datacenter_info" | logger -su - $OPENQRM_DATABASE_USER -c "$POSTGRES_CLIENT -d $OPENQRM_DATABASE_NAME --set openqrmdbuser=$OPENQRM_DATABASE_USER -c 'delete from datacenter_info'" - -# backup cloud_transaction -if su - $OPENQRM_DATABASE_USER -c "$POSTGRES_CLIENT -d $OPENQRM_DATABASE_NAME --set openqrmdbuser=$OPENQRM_DATABASE_USER -c 'select * from pg_tables'" | grep cloud_transaction 1>/dev/null; then - echo "NOTICE: Saving cloud_transaction table to $DB_MAINTENANCE_DIR/openqrm_db_cloud_transaction_$BACKUP_TIME.sql" | logger - su - $OPENQRM_DATABASE_USER -c "$POSTGRES_DUMP -w -t cloud_transaction $OPENQRM_DATABASE_NAME" > $DB_MAINTENANCE_DIR/openqrm_db_cloud_transaction_$BACKUP_TIME.sql - gzip $DB_MAINTENANCE_DIR/openqrm_db_cloud_transaction_$BACKUP_TIME.sql - # clean up cloud_transaction - echo "NOTICE: Cleaning cloud_transaction table" | logger - su - $OPENQRM_DATABASE_USER -c "$POSTGRES_CLIENT -d $OPENQRM_DATABASE_NAME --set openqrmdbuser=$OPENQRM_DATABASE_USER -c 'delete from cloud_transaction'" -fi - -# backup cloud_zones_transaction -if su - $OPENQRM_DATABASE_USER -c "$POSTGRES_CLIENT -d $OPENQRM_DATABASE_NAME --set openqrmdbuser=$OPENQRM_DATABASE_USER -c 'select * from pg_tables'" | grep cloud_zones_transaction 1>/dev/null; then - echo "NOTICE: Saving cloud_zones_transaction table to $DB_MAINTENANCE_DIR/openqrm_db_cloud_zones_transaction_$BACKUP_TIME.sql" | logger - su - $OPENQRM_DATABASE_USER -c "$POSTGRES_DUMP -w -t cloud_zones_transaction $OPENQRM_DATABASE_NAME" > $DB_MAINTENANCE_DIR/openqrm_db_cloud_zones_transaction_$BACKUP_TIME.sql - gzip $DB_MAINTENANCE_DIR/openqrm_db_cloud_zones_transaction_$BACKUP_TIME.sql - # clean up cloud_zones_transaction - echo "NOTICE: Cleaning cloud_zones_transaction table" | logger - su - $OPENQRM_DATABASE_USER -c "$POSTGRES_CLIENT -d $OPENQRM_DATABASE_NAME --set openqrmdbuser=$OPENQRM_DATABASE_USER -c 'delete from cloud_zones_transaction'" -fi - diff --git a/openQRM-5.3.50-CE/src/etc/httpd/openqrm-htaccess.conf b/openQRM-5.3.50-CE/src/etc/httpd/openqrm-htaccess.conf deleted file mode 100644 index 79c1806..0000000 --- a/openQRM-5.3.50-CE/src/etc/httpd/openqrm-htaccess.conf +++ /dev/null @@ -1,4 +0,0 @@ -AuthType Basic -AuthName "openQRM-Server Login" -AuthUserFile OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/.htpasswd -require valid-user diff --git a/openQRM-5.3.50-CE/src/etc/httpd/openqrm-httpd-vhost.conf b/openQRM-5.3.50-CE/src/etc/httpd/openqrm-httpd-vhost.conf deleted file mode 100644 index 04e3097..0000000 --- a/openQRM-5.3.50-CE/src/etc/httpd/openqrm-httpd-vhost.conf +++ /dev/null @@ -1,39 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -NameVirtualHost *:80 - - ServerAdmin webmaster@localhost - - DocumentRoot @@OPENQRM_WEBSERVER_DOCUMENT_ROOT@@ - - Options FollowSymLinks - AllowOverride None - - - AllowOverride AuthConfig - Options FollowSymLinks - - - - ErrorLog /var/log/apache2/openqrm-error.log - - # Possible values include: debug, info, notice, warn, error, crit, - # alert, emerg. - LogLevel warn - - CustomLog /var/log/apache2/access.log combined - ServerSignature On - - diff --git a/openQRM-5.3.50-CE/src/etc/httpd/openqrm-httpd.conf b/openQRM-5.3.50-CE/src/etc/httpd/openqrm-httpd.conf deleted file mode 100644 index 6e827d8..0000000 --- a/openQRM-5.3.50-CE/src/etc/httpd/openqrm-httpd.conf +++ /dev/null @@ -1,5 +0,0 @@ - - AllowOverride AuthConfig - Options FollowSymLinks - - diff --git a/openQRM-5.3.50-CE/src/etc/httpd/openqrm-https.conf b/openQRM-5.3.50-CE/src/etc/httpd/openqrm-https.conf deleted file mode 100644 index 6c4a98d..0000000 --- a/openQRM-5.3.50-CE/src/etc/httpd/openqrm-https.conf +++ /dev/null @@ -1,45 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -NameVirtualHost *:443 - - ServerAdmin webmaster@localhost - - SSLEngine on - SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire - SSLCertificateFile @@OPENQRM_SERVER_BASE_DIR@@/openqrm/etc/ssl/cert/openqrm.crt - SSLCertificateKeyFile @@OPENQRM_SERVER_BASE_DIR@@/openqrm/etc/ssl/private/openqrm-private.key - SSLCertificateChainFile @@OPENQRM_SERVER_BASE_DIR@@/openqrm/etc/ssl/chain/openqrm.csr - - DocumentRoot @@OPENQRM_WEBSERVER_DOCUMENT_ROOT@@ - - Options FollowSymLinks - AllowOverride None - - - AllowOverride AuthConfig - Options FollowSymLinks - - - - ErrorLog /var/log/apache2/openqrm-error.log - - # Possible values include: debug, info, notice, warn, error, crit, - # alert, emerg. - LogLevel warn - - CustomLog /var/log/apache2/access.log combined - ServerSignature On - - diff --git a/openQRM-5.3.50-CE/src/etc/httpd/php.apache2.php b/openQRM-5.3.50-CE/src/etc/httpd/php.apache2.php deleted file mode 100644 index b5074a8..0000000 --- a/openQRM-5.3.50-CE/src/etc/httpd/php.apache2.php +++ /dev/null @@ -1,1947 +0,0 @@ -[PHP] - -;;;;;;;;;;;;;;;;;;; -; About php.ini ; -;;;;;;;;;;;;;;;;;;; -; PHP's initialization file, generally called php.ini, is responsible for -; configuring many of the aspects of PHP's behavior. - -; PHP attempts to find and load this configuration from a number of locations. -; The following is a summary of its search order: -; 1. SAPI module specific location. -; 2. The PHPRC environment variable. (As of PHP 5.2.0) -; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0) -; 4. Current working directory (except CLI) -; 5. The web server's directory (for SAPI modules), or directory of PHP -; (otherwise in Windows) -; 6. The directory from the --with-config-file-path compile time option, or the -; Windows directory (usually C:\windows) -; See the PHP docs for more specific information. -; http://php.net/configuration.file - -; The syntax of the file is extremely simple. Whitespace and lines -; beginning with a semicolon are silently ignored (as you probably guessed). -; Section headers (e.g. [Foo]) are also silently ignored, even though -; they might mean something in the future. - -; Directives following the section heading [PATH=/www/mysite] only -; apply to PHP files in the /www/mysite directory. Directives -; following the section heading [HOST=www.example.com] only apply to -; PHP files served from www.example.com. Directives set in these -; special sections cannot be overridden by user-defined INI files or -; at runtime. Currently, [PATH=] and [HOST=] sections only work under -; CGI/FastCGI. -; http://php.net/ini.sections - -; Directives are specified using the following syntax: -; directive = value -; Directive names are *case sensitive* - foo=bar is different from FOO=bar. -; Directives are variables used to configure PHP or PHP extensions. -; There is no name validation. If PHP can't find an expected -; directive because it is not set or is mistyped, a default value will be used. - -; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one -; of the INI constants (On, Off, True, False, Yes, No and None) or an expression -; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a -; previously set variable or directive (e.g. ${foo}) - -; Expressions in the INI file are limited to bitwise operators and parentheses: -; | bitwise OR -; ^ bitwise XOR -; & bitwise AND -; ~ bitwise NOT -; ! boolean NOT - -; Boolean flags can be turned on using the values 1, On, True or Yes. -; They can be turned off using the values 0, Off, False or No. - -; An empty string can be denoted by simply not writing anything after the equal -; sign, or by using the None keyword: - -; foo = ; sets foo to an empty string -; foo = None ; sets foo to an empty string -; foo = "None" ; sets foo to the string 'None' - -; If you use constants in your value, and these constants belong to a -; dynamically loaded extension (either a PHP extension or a Zend extension), -; you may only use these constants *after* the line that loads the extension. - -;;;;;;;;;;;;;;;;;;; -; About this file ; -;;;;;;;;;;;;;;;;;;; -; PHP comes packaged with two INI files. One that is recommended to be used -; in production environments and one that is recommended to be used in -; development environments. - -; php.ini-production contains settings which hold security, performance and -; best practices at its core. But please be aware, these settings may break -; compatibility with older or less security conscience applications. We -; recommending using the production ini in production and testing environments. - -; php.ini-development is very similar to its production variant, except it is -; much more verbose when it comes to errors. We recommend using the -; development version only in development environments, as errors shown to -; application users can inadvertently leak otherwise secure information. - -; This is the php.ini-production INI file. - -;;;;;;;;;;;;;;;;;;; -; Quick Reference ; -;;;;;;;;;;;;;;;;;;; -; The following are all the settings which are different in either the production -; or development versions of the INIs with respect to PHP's default behavior. -; Please see the actual settings later in the document for more details as to why -; we recommend these changes in PHP's behavior. - -; display_errors -; Default Value: On -; Development Value: On -; Production Value: Off - -; display_startup_errors -; Default Value: Off -; Development Value: On -; Production Value: Off - -; error_reporting -; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED -; Development Value: E_ALL -; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT - -; log_errors -; Default Value: Off -; Development Value: On -; Production Value: On - -; max_input_time -; Default Value: -1 (Unlimited) -; Development Value: 60 (60 seconds) -; Production Value: 60 (60 seconds) - -; output_buffering -; Default Value: Off -; Development Value: 4096 -; Production Value: 4096 - -; register_argc_argv -; Default Value: On -; Development Value: Off -; Production Value: Off - -; request_order -; Default Value: None -; Development Value: "GP" -; Production Value: "GP" - -; session.gc_divisor -; Default Value: 100 -; Development Value: 1000 -; Production Value: 1000 - -; session.sid_bits_per_character -; Default Value: 4 -; Development Value: 5 -; Production Value: 5 - -; short_open_tag -; Default Value: On -; Development Value: Off -; Production Value: Off - -; variables_order -; Default Value: "EGPCS" -; Development Value: "GPCS" -; Production Value: "GPCS" - -;;;;;;;;;;;;;;;;;;;; -; php.ini Options ; -;;;;;;;;;;;;;;;;;;;; -; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini" -;user_ini.filename = ".user.ini" - -; To disable this feature set this option to an empty value -;user_ini.filename = - -; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes) -;user_ini.cache_ttl = 300 - -;;;;;;;;;;;;;;;;;;;; -; Language Options ; -;;;;;;;;;;;;;;;;;;;; - -; Enable the PHP scripting language engine under Apache. -; http://php.net/engine -engine = On - -; This directive determines whether or not PHP will recognize code between -; tags as PHP source which should be processed as such. It is -; generally recommended that should be used and that this feature -; should be disabled, as enabling it may result in issues when generating XML -; documents, however this remains supported for backward compatibility reasons. -; Note that this directive does not control the would work. -; http://php.net/syntax-highlighting -;highlight.string = #DD0000 -;highlight.comment = #FF9900 -;highlight.keyword = #007700 -;highlight.default = #0000BB -;highlight.html = #000000 - -; If enabled, the request will be allowed to complete even if the user aborts -; the request. Consider enabling it if executing long requests, which may end up -; being interrupted by the user or a browser timing out. PHP's default behavior -; is to disable this feature. -; http://php.net/ignore-user-abort -;ignore_user_abort = On - -; Determines the size of the realpath cache to be used by PHP. This value should -; be increased on systems where PHP opens many files to reflect the quantity of -; the file operations performed. -; Note: if open_basedir is set, the cache is disabled -; http://php.net/realpath-cache-size -;realpath_cache_size = 4096k - -; Duration of time, in seconds for which to cache realpath information for a given -; file or directory. For systems with rarely changing files, consider increasing this -; value. -; http://php.net/realpath-cache-ttl -;realpath_cache_ttl = 120 - -; Enables or disables the circular reference collector. -; http://php.net/zend.enable-gc -zend.enable_gc = On - -; If enabled, scripts may be written in encodings that are incompatible with -; the scanner. CP936, Big5, CP949 and Shift_JIS are the examples of such -; encodings. To use this feature, mbstring extension must be enabled. -; Default: Off -;zend.multibyte = Off - -; Allows to set the default encoding for the scripts. This value will be used -; unless "declare(encoding=...)" directive appears at the top of the script. -; Only affects if zend.multibyte is set. -; Default: "" -;zend.script_encoding = - -; Allows to include or exclude arguments from stack traces generated for exceptions. -; In production, it is recommended to turn this setting on to prohibit the output -; of sensitive information in stack traces -; Default: Off -zend.exception_ignore_args = On - -;;;;;;;;;;;;;;;;; -; Miscellaneous ; -;;;;;;;;;;;;;;;;; - -; Decides whether PHP may expose the fact that it is installed on the server -; (e.g. by adding its signature to the Web server header). It is no security -; threat in any way, but it makes it possible to determine whether you use PHP -; on your server or not. -; http://php.net/expose-php -expose_php = Off - -;;;;;;;;;;;;;;;;;;; -; Resource Limits ; -;;;;;;;;;;;;;;;;;;; - -; Maximum execution time of each script, in seconds -; http://php.net/max-execution-time -; Note: This directive is hardcoded to 0 for the CLI SAPI -max_execution_time = 30 - -; Maximum amount of time each script may spend parsing request data. It's a good -; idea to limit this time on productions servers in order to eliminate unexpectedly -; long running scripts. -; Note: This directive is hardcoded to -1 for the CLI SAPI -; Default Value: -1 (Unlimited) -; Development Value: 60 (60 seconds) -; Production Value: 60 (60 seconds) -; http://php.net/max-input-time -max_input_time = 60 - -; Maximum input variable nesting level -; http://php.net/max-input-nesting-level -;max_input_nesting_level = 64 - -; How many GET/POST/COOKIE input variables may be accepted -;max_input_vars = 1000 - -; Maximum amount of memory a script may consume -; http://php.net/memory-limit -memory_limit = 128M - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Error handling and logging ; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -; This directive informs PHP of which errors, warnings and notices you would like -; it to take action for. The recommended way of setting values for this -; directive is through the use of the error level constants and bitwise -; operators. The error level constants are below here for convenience as well as -; some common settings and their meanings. -; By default, PHP is set to take action on all errors, notices and warnings EXCEPT -; those related to E_NOTICE and E_STRICT, which together cover best practices and -; recommended coding standards in PHP. For performance reasons, this is the -; recommend error reporting setting. Your production server shouldn't be wasting -; resources complaining about best practices and coding standards. That's what -; development servers and development settings are for. -; Note: The php.ini-development file has this setting as E_ALL. This -; means it pretty much reports everything which is exactly what you want during -; development and early testing. -; -; Error Level Constants: -; E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0) -; E_ERROR - fatal run-time errors -; E_RECOVERABLE_ERROR - almost fatal run-time errors -; E_WARNING - run-time warnings (non-fatal errors) -; E_PARSE - compile-time parse errors -; E_NOTICE - run-time notices (these are warnings which often result -; from a bug in your code, but it's possible that it was -; intentional (e.g., using an uninitialized variable and -; relying on the fact it is automatically initialized to an -; empty string) -; E_STRICT - run-time notices, enable to have PHP suggest changes -; to your code which will ensure the best interoperability -; and forward compatibility of your code -; E_CORE_ERROR - fatal errors that occur during PHP's initial startup -; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's -; initial startup -; E_COMPILE_ERROR - fatal compile-time errors -; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) -; E_USER_ERROR - user-generated error message -; E_USER_WARNING - user-generated warning message -; E_USER_NOTICE - user-generated notice message -; E_DEPRECATED - warn about code that will not work in future versions -; of PHP -; E_USER_DEPRECATED - user-generated deprecation warnings -; -; Common Values: -; E_ALL (Show all errors, warnings and notices including coding standards.) -; E_ALL & ~E_NOTICE (Show all errors, except for notices) -; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.) -; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) -; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED -; Development Value: E_ALL -; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT -; http://php.net/error-reporting -error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT - -; This directive controls whether or not and where PHP will output errors, -; notices and warnings too. Error output is very useful during development, but -; it could be very dangerous in production environments. Depending on the code -; which is triggering the error, sensitive information could potentially leak -; out of your application such as database usernames and passwords or worse. -; For production environments, we recommend logging errors rather than -; sending them to STDOUT. -; Possible Values: -; Off = Do not display any errors -; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) -; On or stdout = Display errors to STDOUT -; Default Value: On -; Development Value: On -; Production Value: Off -; http://php.net/display-errors -display_errors = Off - -; The display of errors which occur during PHP's startup sequence are handled -; separately from display_errors. PHP's default behavior is to suppress those -; errors from clients. Turning the display of startup errors on can be useful in -; debugging configuration problems. We strongly recommend you -; set this to 'off' for production servers. -; Default Value: Off -; Development Value: On -; Production Value: Off -; http://php.net/display-startup-errors -display_startup_errors = Off - -; Besides displaying errors, PHP can also log errors to locations such as a -; server-specific log, STDERR, or a location specified by the error_log -; directive found below. While errors should not be displayed on productions -; servers they should still be monitored and logging is a great way to do that. -; Default Value: Off -; Development Value: On -; Production Value: On -; http://php.net/log-errors -log_errors = On - -; Set maximum length of log_errors. In error_log information about the source is -; added. The default is 1024 and 0 allows to not apply any maximum length at all. -; http://php.net/log-errors-max-len -log_errors_max_len = 1024 - -; Do not log repeated messages. Repeated errors must occur in same file on same -; line unless ignore_repeated_source is set true. -; http://php.net/ignore-repeated-errors -ignore_repeated_errors = Off - -; Ignore source of message when ignoring repeated messages. When this setting -; is On you will not log errors with repeated messages from different files or -; source lines. -; http://php.net/ignore-repeated-source -ignore_repeated_source = Off - -; If this parameter is set to Off, then memory leaks will not be shown (on -; stdout or in the log). This is only effective in a debug compile, and if -; error reporting includes E_WARNING in the allowed list -; http://php.net/report-memleaks -report_memleaks = On - -; This setting is on by default. -;report_zend_debug = 0 - -; Store the last error/warning message in $php_errormsg (boolean). Setting this value -; to On can assist in debugging and is appropriate for development servers. It should -; however be disabled on production servers. -; This directive is DEPRECATED. -; Default Value: Off -; Development Value: Off -; Production Value: Off -; http://php.net/track-errors -;track_errors = Off - -; Turn off normal error reporting and emit XML-RPC error XML -; http://php.net/xmlrpc-errors -;xmlrpc_errors = 0 - -; An XML-RPC faultCode -;xmlrpc_error_number = 0 - -; When PHP displays or logs an error, it has the capability of formatting the -; error message as HTML for easier reading. This directive controls whether -; the error message is formatted as HTML or not. -; Note: This directive is hardcoded to Off for the CLI SAPI -; http://php.net/html-errors -;html_errors = On - -; If html_errors is set to On *and* docref_root is not empty, then PHP -; produces clickable error messages that direct to a page describing the error -; or function causing the error in detail. -; You can download a copy of the PHP manual from http://php.net/docs -; and change docref_root to the base URL of your local copy including the -; leading '/'. You must also specify the file extension being used including -; the dot. PHP's default behavior is to leave these settings empty, in which -; case no links to documentation are generated. -; Note: Never use this feature for production boxes. -; http://php.net/docref-root -; Examples -;docref_root = "/phpmanual/" - -; http://php.net/docref-ext -;docref_ext = .html - -; String to output before an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-prepend-string -; Example: -;error_prepend_string = "" - -; String to output after an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-append-string -; Example: -;error_append_string = "" - -; Log errors to specified file. PHP's default behavior is to leave this value -; empty. -; http://php.net/error-log -; Example: -error_log = /var/log/php.log -; Log errors to syslog (Event Log on Windows). -;error_log = syslog - -; The syslog ident is a string which is prepended to every message logged -; to syslog. Only used when error_log is set to syslog. -;syslog.ident = php - -; The syslog facility is used to specify what type of program is logging -; the message. Only used when error_log is set to syslog. -;syslog.facility = user - -; Set this to disable filtering control characters (the default). -; Some loggers only accept NVT-ASCII, others accept anything that's not -; control characters. If your logger accepts everything, then no filtering -; is needed at all. -; Allowed values are: -; ascii (all printable ASCII characters and NL) -; no-ctrl (all characters except control characters) -; all (all characters) -; raw (like "all", but messages are not split at newlines) -; http://php.net/syslog.filter -;syslog.filter = ascii - -;windows.show_crt_warning -; Default value: 0 -; Development value: 0 -; Production value: 0 - -;;;;;;;;;;;;;;;;; -; Data Handling ; -;;;;;;;;;;;;;;;;; - -; The separator used in PHP generated URLs to separate arguments. -; PHP's default setting is "&". -; http://php.net/arg-separator.output -; Example: -;arg_separator.output = "&" - -; List of separator(s) used by PHP to parse input URLs into variables. -; PHP's default setting is "&". -; NOTE: Every character in this directive is considered as separator! -; http://php.net/arg-separator.input -; Example: -;arg_separator.input = ";&" - -; This directive determines which super global arrays are registered when PHP -; starts up. G,P,C,E & S are abbreviations for the following respective super -; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty -; paid for the registration of these arrays and because ENV is not as commonly -; used as the others, ENV is not recommended on productions servers. You -; can still get access to the environment variables through getenv() should you -; need to. -; Default Value: "EGPCS" -; Development Value: "GPCS" -; Production Value: "GPCS"; -; http://php.net/variables-order -variables_order = "GPCS" - -; This directive determines which super global data (G,P & C) should be -; registered into the super global array REQUEST. If so, it also determines -; the order in which that data is registered. The values for this directive -; are specified in the same manner as the variables_order directive, -; EXCEPT one. Leaving this value empty will cause PHP to use the value set -; in the variables_order directive. It does not mean it will leave the super -; globals array REQUEST empty. -; Default Value: None -; Development Value: "GP" -; Production Value: "GP" -; http://php.net/request-order -request_order = "GP" - -; This directive determines whether PHP registers $argv & $argc each time it -; runs. $argv contains an array of all the arguments passed to PHP when a script -; is invoked. $argc contains an integer representing the number of arguments -; that were passed when the script was invoked. These arrays are extremely -; useful when running scripts from the command line. When this directive is -; enabled, registering these variables consumes CPU cycles and memory each time -; a script is executed. For performance reasons, this feature should be disabled -; on production servers. -; Note: This directive is hardcoded to On for the CLI SAPI -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/register-argc-argv -register_argc_argv = Off - -; When enabled, the ENV, REQUEST and SERVER variables are created when they're -; first used (Just In Time) instead of when the script starts. If these -; variables are not used within a script, having this directive on will result -; in a performance gain. The PHP directive register_argc_argv must be disabled -; for this directive to have any effect. -; http://php.net/auto-globals-jit -auto_globals_jit = On - -; Whether PHP will read the POST data. -; This option is enabled by default. -; Most likely, you won't want to disable this option globally. It causes $_POST -; and $_FILES to always be empty; the only way you will be able to read the -; POST data will be through the php://input stream wrapper. This can be useful -; to proxy requests or to process the POST data in a memory efficient fashion. -; http://php.net/enable-post-data-reading -;enable_post_data_reading = Off - -; Maximum size of POST data that PHP will accept. -; Its value may be 0 to disable the limit. It is ignored if POST data reading -; is disabled through enable_post_data_reading. -; http://php.net/post-max-size -post_max_size = 8M - -; Automatically add files before PHP document. -; http://php.net/auto-prepend-file -auto_prepend_file = - -; Automatically add files after PHP document. -; http://php.net/auto-append-file -auto_append_file = - -; By default, PHP will output a media type using the Content-Type header. To -; disable this, simply set it to be empty. -; -; PHP's built-in default media type is set to text/html. -; http://php.net/default-mimetype -default_mimetype = "text/html" - -; PHP's default character set is set to UTF-8. -; http://php.net/default-charset -default_charset = "UTF-8" - -; PHP internal character encoding is set to empty. -; If empty, default_charset is used. -; http://php.net/internal-encoding -;internal_encoding = - -; PHP input character encoding is set to empty. -; If empty, default_charset is used. -; http://php.net/input-encoding -;input_encoding = - -; PHP output character encoding is set to empty. -; If empty, default_charset is used. -; See also output_buffer. -; http://php.net/output-encoding -;output_encoding = - -;;;;;;;;;;;;;;;;;;;;;;;;; -; Paths and Directories ; -;;;;;;;;;;;;;;;;;;;;;;;;; - -; UNIX: "/path1:/path2" -;include_path = ".:/usr/share/php" -; -; Windows: "\path1;\path2" -;include_path = ".;c:\php\includes" -; -; PHP's default setting for include_path is ".;/path/to/php/pear" -; http://php.net/include-path - -; The root of the PHP pages, used only if nonempty. -; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root -; if you are running php as a CGI under any web server (other than IIS) -; see documentation for security issues. The alternate is to use the -; cgi.force_redirect configuration below -; http://php.net/doc-root -doc_root = - -; The directory under which PHP opens the script using /~username used only -; if nonempty. -; http://php.net/user-dir -user_dir = - -; Directory in which the loadable extensions (modules) reside. -; http://php.net/extension-dir -;extension_dir = "./" -; On windows: -;extension_dir = "ext" - -; Directory where the temporary files should be placed. -; Defaults to the system default (see sys_get_temp_dir) -;sys_temp_dir = "/tmp" - -; Whether or not to enable the dl() function. The dl() function does NOT work -; properly in multithreaded servers, such as IIS or Zeus, and is automatically -; disabled on them. -; http://php.net/enable-dl -enable_dl = Off - -; cgi.force_redirect is necessary to provide security running PHP as a CGI under -; most web servers. Left undefined, PHP turns this on by default. You can -; turn it off here AT YOUR OWN RISK -; **You CAN safely turn this off for IIS, in fact, you MUST.** -; http://php.net/cgi.force-redirect -;cgi.force_redirect = 1 - -; if cgi.nph is enabled it will force cgi to always sent Status: 200 with -; every request. PHP's default behavior is to disable this feature. -;cgi.nph = 1 - -; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape -; (iPlanet) web servers, you MAY need to set an environment variable name that PHP -; will look for to know it is OK to continue execution. Setting this variable MAY -; cause security issues, KNOW WHAT YOU ARE DOING FIRST. -; http://php.net/cgi.redirect-status-env -;cgi.redirect_status_env = - -; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's -; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok -; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting -; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting -; of zero causes PHP to behave as before. Default is 1. You should fix your scripts -; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. -; http://php.net/cgi.fix-pathinfo -;cgi.fix_pathinfo=1 - -; if cgi.discard_path is enabled, the PHP CGI binary can safely be placed outside -; of the web tree and people will not be able to circumvent .htaccess security. -;cgi.discard_path=1 - -; FastCGI under IIS supports the ability to impersonate -; security tokens of the calling client. This allows IIS to define the -; security context that the request runs under. mod_fastcgi under Apache -; does not currently support this feature (03/17/2002) -; Set to 1 if running under IIS. Default is zero. -; http://php.net/fastcgi.impersonate -;fastcgi.impersonate = 1 - -; Disable logging through FastCGI connection. PHP's default behavior is to enable -; this feature. -;fastcgi.logging = 0 - -; cgi.rfc2616_headers configuration option tells PHP what type of headers to -; use when sending HTTP response code. If set to 0, PHP sends Status: header that -; is supported by Apache. When this option is set to 1, PHP will send -; RFC2616 compliant header. -; Default is zero. -; http://php.net/cgi.rfc2616-headers -;cgi.rfc2616_headers = 0 - -; cgi.check_shebang_line controls whether CGI PHP checks for line starting with #! -; (shebang) at the top of the running script. This line might be needed if the -; script support running both as stand-alone script and via PHP CGI<. PHP in CGI -; mode skips this line and ignores its content if this directive is turned on. -; http://php.net/cgi.check-shebang-line -;cgi.check_shebang_line=1 - -;;;;;;;;;;;;;;;; -; File Uploads ; -;;;;;;;;;;;;;;;; - -; Whether to allow HTTP file uploads. -; http://php.net/file-uploads -file_uploads = On - -; Temporary directory for HTTP uploaded files (will use system default if not -; specified). -; http://php.net/upload-tmp-dir -;upload_tmp_dir = - -; Maximum allowed size for uploaded files. -; http://php.net/upload-max-filesize -upload_max_filesize = 2M - -; Maximum number of files that can be uploaded via a single request -max_file_uploads = 20 - -;;;;;;;;;;;;;;;;;; -; Fopen wrappers ; -;;;;;;;;;;;;;;;;;; - -; Whether to allow the treatment of URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-fopen -allow_url_fopen = On - -; Whether to allow include/require to open URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-include -allow_url_include = Off - -; Define the anonymous ftp password (your email address). PHP's default setting -; for this is empty. -; http://php.net/from -;from="john@doe.com" - -; Define the User-Agent string. PHP's default setting for this is empty. -; http://php.net/user-agent -;user_agent="PHP" - -; Default timeout for socket based streams (seconds) -; http://php.net/default-socket-timeout -default_socket_timeout = 60 - -; If your scripts have to deal with files from Macintosh systems, -; or you are running on a Mac and need to deal with files from -; unix or win32 systems, setting this flag will cause PHP to -; automatically detect the EOL character in those files so that -; fgets() and file() will work regardless of the source of the file. -; http://php.net/auto-detect-line-endings -;auto_detect_line_endings = Off - -;;;;;;;;;;;;;;;;;;;;;; -; Dynamic Extensions ; -;;;;;;;;;;;;;;;;;;;;;; - -; If you wish to have an extension loaded automatically, use the following -; syntax: -; -; extension=modulename -; -; For example: -; -; extension=mysqli -; -; When the extension library to load is not located in the default extension -; directory, You may specify an absolute path to the library file: -; -; extension=/path/to/extension/mysqli.so -; -; Note : The syntax used in previous PHP versions ('extension=.so' and -; 'extension='php_.dll') is supported for legacy reasons and may be -; deprecated in a future PHP major version. So, when it is possible, please -; move to the new ('extension=) syntax. -; -; Notes for Windows environments : -; -; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+) -; extension folders as well as the separate PECL DLL download (PHP 5+). -; Be sure to appropriately set the extension_dir directive. -; -;extension=bz2 -;extension=curl -;extension=ffi -;extension=ftp -;extension=fileinfo -;extension=gd2 -;extension=gettext -;extension=gmp -;extension=intl -;extension=imap -;extension=ldap -;extension=mbstring -;extension=exif ; Must be after mbstring as it depends on it -;extension=mysqli -;extension=oci8_12c ; Use with Oracle Database 12c Instant Client -;extension=odbc -;extension=openssl -;extension=pdo_firebird -;extension=pdo_mysql -;extension=pdo_oci -;extension=pdo_odbc -;extension=pdo_pgsql -;extension=pdo_sqlite -;extension=pgsql -;extension=shmop - -; The MIBS data available in the PHP distribution must be installed. -; See http://www.php.net/manual/en/snmp.installation.php -;extension=snmp - -;extension=soap -;extension=sockets -;extension=sodium -;extension=sqlite3 -;extension=tidy -;extension=xmlrpc -;extension=xsl - -;;;;;;;;;;;;;;;;;;; -; Module Settings ; -;;;;;;;;;;;;;;;;;;; - -[CLI Server] -; Whether the CLI web server uses ANSI color coding in its terminal output. -cli_server.color = On - -[Date] -; Defines the default timezone used by the date functions -; http://php.net/date.timezone -;date.timezone = - -; http://php.net/date.default-latitude -;date.default_latitude = 31.7667 - -; http://php.net/date.default-longitude -;date.default_longitude = 35.2333 - -; http://php.net/date.sunrise-zenith -;date.sunrise_zenith = 90.583333 - -; http://php.net/date.sunset-zenith -;date.sunset_zenith = 90.583333 - -[filter] -; http://php.net/filter.default -;filter.default = unsafe_raw - -; http://php.net/filter.default-flags -;filter.default_flags = - -[iconv] -; Use of this INI entry is deprecated, use global input_encoding instead. -; If empty, default_charset or input_encoding or iconv.input_encoding is used. -; The precedence is: default_charset < input_encoding < iconv.input_encoding -;iconv.input_encoding = - -; Use of this INI entry is deprecated, use global internal_encoding instead. -; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. -; The precedence is: default_charset < internal_encoding < iconv.internal_encoding -;iconv.internal_encoding = - -; Use of this INI entry is deprecated, use global output_encoding instead. -; If empty, default_charset or output_encoding or iconv.output_encoding is used. -; The precedence is: default_charset < output_encoding < iconv.output_encoding -; To use an output encoding conversion, iconv's output handler must be set -; otherwise output encoding conversion cannot be performed. -;iconv.output_encoding = - -[imap] -; rsh/ssh logins are disabled by default. Use this INI entry if you want to -; enable them. Note that the IMAP library does not filter mailbox names before -; passing them to rsh/ssh command, thus passing untrusted data to this function -; with rsh/ssh enabled is insecure. -;imap.enable_insecure_rsh=0 - -[intl] -;intl.default_locale = -; This directive allows you to produce PHP errors when some error -; happens within intl functions. The value is the level of the error produced. -; Default is 0, which does not produce any errors. -;intl.error_level = E_WARNING -;intl.use_exceptions = 0 - -[sqlite3] -; Directory pointing to SQLite3 extensions -; http://php.net/sqlite3.extension-dir -;sqlite3.extension_dir = - -; SQLite defensive mode flag (only available from SQLite 3.26+) -; When the defensive flag is enabled, language features that allow ordinary -; SQL to deliberately corrupt the database file are disabled. This forbids -; writing directly to the schema, shadow tables (eg. FTS data tables), or -; the sqlite_dbpage virtual table. -; https://www.sqlite.org/c3ref/c_dbconfig_defensive.html -; (for older SQLite versions, this flag has no use) -;sqlite3.defensive = 1 - -[Pcre] -; PCRE library backtracking limit. -; http://php.net/pcre.backtrack-limit -;pcre.backtrack_limit=100000 - -; PCRE library recursion limit. -; Please note that if you set this value to a high number you may consume all -; the available process stack and eventually crash PHP (due to reaching the -; stack size limit imposed by the Operating System). -; http://php.net/pcre.recursion-limit -;pcre.recursion_limit=100000 - -; Enables or disables JIT compilation of patterns. This requires the PCRE -; library to be compiled with JIT support. -;pcre.jit=1 - -[Pdo] -; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" -; http://php.net/pdo-odbc.connection-pooling -;pdo_odbc.connection_pooling=strict - -;pdo_odbc.db2_instance_name - -[Pdo_mysql] -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -pdo_mysql.default_socket= - -[Phar] -; http://php.net/phar.readonly -;phar.readonly = On - -; http://php.net/phar.require-hash -;phar.require_hash = On - -;phar.cache_list = - -[mail function] -; For Win32 only. -; http://php.net/smtp -SMTP = localhost -; http://php.net/smtp-port -smtp_port = 25 - -; For Win32 only. -; http://php.net/sendmail-from -;sendmail_from = me@example.com - -; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). -; http://php.net/sendmail-path -;sendmail_path = - -; Force the addition of the specified parameters to be passed as extra parameters -; to the sendmail binary. These parameters will always replace the value of -; the 5th parameter to mail(). -;mail.force_extra_parameters = - -; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename -mail.add_x_header = Off - -; The path to a log file that will log all mail() calls. Log entries include -; the full path of the script, line number, To address and headers. -;mail.log = -; Log mail to syslog (Event Log on Windows). -;mail.log = syslog - -[ODBC] -; http://php.net/odbc.default-db -;odbc.default_db = Not yet implemented - -; http://php.net/odbc.default-user -;odbc.default_user = Not yet implemented - -; http://php.net/odbc.default-pw -;odbc.default_pw = Not yet implemented - -; Controls the ODBC cursor model. -; Default: SQL_CURSOR_STATIC (default). -;odbc.default_cursortype - -; Allow or prevent persistent links. -; http://php.net/odbc.allow-persistent -odbc.allow_persistent = On - -; Check that a connection is still valid before reuse. -; http://php.net/odbc.check-persistent -odbc.check_persistent = On - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/odbc.max-persistent -odbc.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/odbc.max-links -odbc.max_links = -1 - -; Handling of LONG fields. Returns number of bytes to variables. 0 means -; passthru. -; http://php.net/odbc.defaultlrl -odbc.defaultlrl = 4096 - -; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. -; See the documentation on odbc_binmode and odbc_longreadlen for an explanation -; of odbc.defaultlrl and odbc.defaultbinmode -; http://php.net/odbc.defaultbinmode -odbc.defaultbinmode = 1 - -[MySQLi] - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/mysqli.max-persistent -mysqli.max_persistent = -1 - -; Allow accessing, from PHP's perspective, local files with LOAD DATA statements -; http://php.net/mysqli.allow_local_infile -;mysqli.allow_local_infile = On - -; Allow or prevent persistent links. -; http://php.net/mysqli.allow-persistent -mysqli.allow_persistent = On - -; Maximum number of links. -1 means no limit. -; http://php.net/mysqli.max-links -mysqli.max_links = -1 - -; Default port number for mysqli_connect(). If unset, mysqli_connect() will use -; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the -; compile-time value defined MYSQL_PORT (in that order). Win32 will only look -; at MYSQL_PORT. -; http://php.net/mysqli.default-port -mysqli.default_port = 3306 - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/mysqli.default-socket -mysqli.default_socket = /run/mysqld/mysqld.sock - -; Default host for mysqli_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-host -mysqli.default_host = - -; Default user for mysqli_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-user -mysqli.default_user = - -; Default password for mysqli_connect() (doesn't apply in safe mode). -; Note that this is generally a *bad* idea to store passwords in this file. -; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") -; and reveal this password! And of course, any users with read access to this -; file will be able to reveal the password as well. -; http://php.net/mysqli.default-pw -mysqli.default_pw = - -; Allow or prevent reconnect -mysqli.reconnect = Off - -[mysqlnd] -; Enable / Disable collection of general statistics by mysqlnd which can be -; used to tune and monitor MySQL operations. -mysqlnd.collect_statistics = On - -; Enable / Disable collection of memory usage statistics by mysqlnd which can be -; used to tune and monitor MySQL operations. -mysqlnd.collect_memory_statistics = Off - -; Records communication from all extensions using mysqlnd to the specified log -; file. -; http://php.net/mysqlnd.debug -;mysqlnd.debug = - -; Defines which queries will be logged. -;mysqlnd.log_mask = 0 - -; Default size of the mysqlnd memory pool, which is used by result sets. -;mysqlnd.mempool_default_size = 16000 - -; Size of a pre-allocated buffer used when sending commands to MySQL in bytes. -;mysqlnd.net_cmd_buffer_size = 2048 - -; Size of a pre-allocated buffer used for reading data sent by the server in -; bytes. -;mysqlnd.net_read_buffer_size = 32768 - -; Timeout for network requests in seconds. -;mysqlnd.net_read_timeout = 31536000 - -; SHA-256 Authentication Plugin related. File with the MySQL server public RSA -; key. -;mysqlnd.sha256_server_public_key = - -[OCI8] - -; Connection: Enables privileged connections using external -; credentials (OCI_SYSOPER, OCI_SYSDBA) -; http://php.net/oci8.privileged-connect -;oci8.privileged_connect = Off - -; Connection: The maximum number of persistent OCI8 connections per -; process. Using -1 means no limit. -; http://php.net/oci8.max-persistent -;oci8.max_persistent = -1 - -; Connection: The maximum number of seconds a process is allowed to -; maintain an idle persistent connection. Using -1 means idle -; persistent connections will be maintained forever. -; http://php.net/oci8.persistent-timeout -;oci8.persistent_timeout = -1 - -; Connection: The number of seconds that must pass before issuing a -; ping during oci_pconnect() to check the connection validity. When -; set to 0, each oci_pconnect() will cause a ping. Using -1 disables -; pings completely. -; http://php.net/oci8.ping-interval -;oci8.ping_interval = 60 - -; Connection: Set this to a user chosen connection class to be used -; for all pooled server requests with Oracle 11g Database Resident -; Connection Pooling (DRCP). To use DRCP, this value should be set to -; the same string for all web servers running the same application, -; the database pool must be configured, and the connection string must -; specify to use a pooled server. -;oci8.connection_class = - -; High Availability: Using On lets PHP receive Fast Application -; Notification (FAN) events generated when a database node fails. The -; database must also be configured to post FAN events. -;oci8.events = Off - -; Tuning: This option enables statement caching, and specifies how -; many statements to cache. Using 0 disables statement caching. -; http://php.net/oci8.statement-cache-size -;oci8.statement_cache_size = 20 - -; Tuning: Enables statement prefetching and sets the default number of -; rows that will be fetched automatically after statement execution. -; http://php.net/oci8.default-prefetch -;oci8.default_prefetch = 100 - -; Compatibility. Using On means oci_close() will not close -; oci_connect() and oci_new_connect() connections. -; http://php.net/oci8.old-oci-close-semantics -;oci8.old_oci_close_semantics = Off - -[PostgreSQL] -; Allow or prevent persistent links. -; http://php.net/pgsql.allow-persistent -pgsql.allow_persistent = On - -; Detect broken persistent links always with pg_pconnect(). -; Auto reset feature requires a little overheads. -; http://php.net/pgsql.auto-reset-persistent -pgsql.auto_reset_persistent = Off - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/pgsql.max-persistent -pgsql.max_persistent = -1 - -; Maximum number of links (persistent+non persistent). -1 means no limit. -; http://php.net/pgsql.max-links -pgsql.max_links = -1 - -; Ignore PostgreSQL backends Notice message or not. -; Notice message logging require a little overheads. -; http://php.net/pgsql.ignore-notice -pgsql.ignore_notice = 0 - -; Log PostgreSQL backends Notice message or not. -; Unless pgsql.ignore_notice=0, module cannot log notice message. -; http://php.net/pgsql.log-notice -pgsql.log_notice = 0 - -[bcmath] -; Number of decimal digits for all bcmath functions. -; http://php.net/bcmath.scale -bcmath.scale = 0 - -[browscap] -; http://php.net/browscap -;browscap = extra/browscap.ini - -[Session] -; Handler used to store/retrieve data. -; http://php.net/session.save-handler -session.save_handler = files - -; Argument passed to save_handler. In the case of files, this is the path -; where data files are stored. Note: Windows users have to change this -; variable in order to use PHP's session functions. -; -; The path can be defined as: -; -; session.save_path = "N;/path" -; -; where N is an integer. Instead of storing all the session files in -; /path, what this will do is use subdirectories N-levels deep, and -; store the session data in those directories. This is useful if -; your OS has problems with many files in one directory, and is -; a more efficient layout for servers that handle many sessions. -; -; NOTE 1: PHP will not create this directory structure automatically. -; You can use the script in the ext/session dir for that purpose. -; NOTE 2: See the section on garbage collection below if you choose to -; use subdirectories for session storage -; -; The file storage module creates files using mode 600 by default. -; You can change that by using -; -; session.save_path = "N;MODE;/path" -; -; where MODE is the octal representation of the mode. Note that this -; does not overwrite the process's umask. -; http://php.net/session.save-path -;session.save_path = "/var/lib/php/sessions" - -; Whether to use strict session mode. -; Strict session mode does not accept an uninitialized session ID, and -; regenerates the session ID if the browser sends an uninitialized session ID. -; Strict mode protects applications from session fixation via a session adoption -; vulnerability. It is disabled by default for maximum compatibility, but -; enabling it is encouraged. -; https://wiki.php.net/rfc/strict_sessions -session.use_strict_mode = 0 - -; Whether to use cookies. -; http://php.net/session.use-cookies -session.use_cookies = 1 - -; http://php.net/session.cookie-secure -;session.cookie_secure = - -; This option forces PHP to fetch and use a cookie for storing and maintaining -; the session id. We encourage this operation as it's very helpful in combating -; session hijacking when not specifying and managing your own session id. It is -; not the be-all and end-all of session hijacking defense, but it's a good start. -; http://php.net/session.use-only-cookies -session.use_only_cookies = 1 - -; Name of the session (used as cookie name). -; http://php.net/session.name -session.name = PHPSESSID - -; Initialize session on request startup. -; http://php.net/session.auto-start -session.auto_start = 0 - -; Lifetime in seconds of cookie or, if 0, until browser is restarted. -; http://php.net/session.cookie-lifetime -session.cookie_lifetime = 0 - -; The path for which the cookie is valid. -; http://php.net/session.cookie-path -session.cookie_path = / - -; The domain for which the cookie is valid. -; http://php.net/session.cookie-domain -session.cookie_domain = - -; Whether or not to add the httpOnly flag to the cookie, which makes it -; inaccessible to browser scripting languages such as JavaScript. -; http://php.net/session.cookie-httponly -session.cookie_httponly = - -; Add SameSite attribute to cookie to help mitigate Cross-Site Request Forgery (CSRF/XSRF) -; Current valid values are "Strict", "Lax" or "None". When using "None", -; make sure to include the quotes, as `none` is interpreted like `false` in ini files. -; https://tools.ietf.org/html/draft-west-first-party-cookies-07 -session.cookie_samesite = - -; Handler used to serialize data. php is the standard serializer of PHP. -; http://php.net/session.serialize-handler -session.serialize_handler = php - -; Defines the probability that the 'garbage collection' process is started on every -; session initialization. The probability is calculated by using gc_probability/gc_divisor, -; e.g. 1/100 means there is a 1% chance that the GC process starts on each request. -; Default Value: 1 -; Development Value: 1 -; Production Value: 1 -; http://php.net/session.gc-probability -session.gc_probability = 0 - -; Defines the probability that the 'garbage collection' process is started on every -; session initialization. The probability is calculated by using gc_probability/gc_divisor, -; e.g. 1/100 means there is a 1% chance that the GC process starts on each request. -; For high volume production servers, using a value of 1000 is a more efficient approach. -; Default Value: 100 -; Development Value: 1000 -; Production Value: 1000 -; http://php.net/session.gc-divisor -session.gc_divisor = 1000 - -; After this number of seconds, stored data will be seen as 'garbage' and -; cleaned up by the garbage collection process. -; http://php.net/session.gc-maxlifetime -session.gc_maxlifetime = 1440 - -; NOTE: If you are using the subdirectory option for storing session files -; (see session.save_path above), then garbage collection does *not* -; happen automatically. You will need to do your own garbage -; collection through a shell script, cron entry, or some other method. -; For example, the following script is the equivalent of setting -; session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): -; find /path/to/sessions -cmin +24 -type f | xargs rm - -; Check HTTP Referer to invalidate externally stored URLs containing ids. -; HTTP_REFERER has to contain this substring for the session to be -; considered as valid. -; http://php.net/session.referer-check -session.referer_check = - -; Set to {nocache,private,public,} to determine HTTP caching aspects -; or leave this empty to avoid sending anti-caching headers. -; http://php.net/session.cache-limiter -session.cache_limiter = nocache - -; Document expires after n minutes. -; http://php.net/session.cache-expire -session.cache_expire = 180 - -; trans sid support is disabled by default. -; Use of trans sid may risk your users' security. -; Use this option with caution. -; - User may send URL contains active session ID -; to other person via. email/irc/etc. -; - URL that contains active session ID may be stored -; in publicly accessible computer. -; - User may access your site with the same session ID -; always using URL stored in browser's history or bookmarks. -; http://php.net/session.use-trans-sid -session.use_trans_sid = 0 - -; Set session ID character length. This value could be between 22 to 256. -; Shorter length than default is supported only for compatibility reason. -; Users should use 32 or more chars. -; http://php.net/session.sid-length -; Default Value: 32 -; Development Value: 26 -; Production Value: 26 -session.sid_length = 26 - -; The URL rewriter will look for URLs in a defined set of HTML tags. -;
is special; if you include them here, the rewriter will -; add a hidden field with the info which is otherwise appended -; to URLs. tag's action attribute URL will not be modified -; unless it is specified. -; Note that all valid entries require a "=", even if no value follows. -; Default Value: "a=href,area=href,frame=src,form=" -; Development Value: "a=href,area=href,frame=src,form=" -; Production Value: "a=href,area=href,frame=src,form=" -; http://php.net/url-rewriter.tags -session.trans_sid_tags = "a=href,area=href,frame=src,form=" - -; URL rewriter does not rewrite absolute URLs by default. -; To enable rewrites for absolute paths, target hosts must be specified -; at RUNTIME. i.e. use ini_set() -; tags is special. PHP will check action attribute's URL regardless -; of session.trans_sid_tags setting. -; If no host is defined, HTTP_HOST will be used for allowed host. -; Example value: php.net,www.php.net,wiki.php.net -; Use "," for multiple hosts. No spaces are allowed. -; Default Value: "" -; Development Value: "" -; Production Value: "" -;session.trans_sid_hosts="" - -; Define how many bits are stored in each character when converting -; the binary hash data to something readable. -; Possible values: -; 4 (4 bits: 0-9, a-f) -; 5 (5 bits: 0-9, a-v) -; 6 (6 bits: 0-9, a-z, A-Z, "-", ",") -; Default Value: 4 -; Development Value: 5 -; Production Value: 5 -; http://php.net/session.hash-bits-per-character -session.sid_bits_per_character = 5 - -; Enable upload progress tracking in $_SESSION -; Default Value: On -; Development Value: On -; Production Value: On -; http://php.net/session.upload-progress.enabled -;session.upload_progress.enabled = On - -; Cleanup the progress information as soon as all POST data has been read -; (i.e. upload completed). -; Default Value: On -; Development Value: On -; Production Value: On -; http://php.net/session.upload-progress.cleanup -;session.upload_progress.cleanup = On - -; A prefix used for the upload progress key in $_SESSION -; Default Value: "upload_progress_" -; Development Value: "upload_progress_" -; Production Value: "upload_progress_" -; http://php.net/session.upload-progress.prefix -;session.upload_progress.prefix = "upload_progress_" - -; The index name (concatenated with the prefix) in $_SESSION -; containing the upload progress information -; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" -; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" -; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" -; http://php.net/session.upload-progress.name -;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" - -; How frequently the upload progress should be updated. -; Given either in percentages (per-file), or in bytes -; Default Value: "1%" -; Development Value: "1%" -; Production Value: "1%" -; http://php.net/session.upload-progress.freq -;session.upload_progress.freq = "1%" - -; The minimum delay between updates, in seconds -; Default Value: 1 -; Development Value: 1 -; Production Value: 1 -; http://php.net/session.upload-progress.min-freq -;session.upload_progress.min_freq = "1" - -; Only write session data when session data is changed. Enabled by default. -; http://php.net/session.lazy-write -;session.lazy_write = On - -[Assertion] -; Switch whether to compile assertions at all (to have no overhead at run-time) -; -1: Do not compile at all -; 0: Jump over assertion at run-time -; 1: Execute assertions -; Changing from or to a negative value is only possible in php.ini! (For turning assertions on and off at run-time, see assert.active, when zend.assertions = 1) -; Default Value: 1 -; Development Value: 1 -; Production Value: -1 -; http://php.net/zend.assertions -zend.assertions = -1 - -; Assert(expr); active by default. -; http://php.net/assert.active -;assert.active = On - -; Throw an AssertionError on failed assertions -; http://php.net/assert.exception -;assert.exception = On - -; Issue a PHP warning for each failed assertion. (Overridden by assert.exception if active) -; http://php.net/assert.warning -;assert.warning = On - -; Don't bail out by default. -; http://php.net/assert.bail -;assert.bail = Off - -; User-function to be called if an assertion fails. -; http://php.net/assert.callback -;assert.callback = 0 - -; Eval the expression with current error_reporting(). Set to true if you want -; error_reporting(0) around the eval(). -; http://php.net/assert.quiet-eval -;assert.quiet_eval = 0 - -[COM] -; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs -; http://php.net/com.typelib-file -;com.typelib_file = - -; allow Distributed-COM calls -; http://php.net/com.allow-dcom -;com.allow_dcom = true - -; autoregister constants of a component's typlib on com_load() -; http://php.net/com.autoregister-typelib -;com.autoregister_typelib = true - -; register constants casesensitive -; http://php.net/com.autoregister-casesensitive -;com.autoregister_casesensitive = false - -; show warnings on duplicate constant registrations -; http://php.net/com.autoregister-verbose -;com.autoregister_verbose = true - -; The default character set code-page to use when passing strings to and from COM objects. -; Default: system ANSI code page -;com.code_page= - -[mbstring] -; language for internal character representation. -; This affects mb_send_mail() and mbstring.detect_order. -; http://php.net/mbstring.language -;mbstring.language = Japanese - -; Use of this INI entry is deprecated, use global internal_encoding instead. -; internal/script encoding. -; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) -; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. -; The precedence is: default_charset < internal_encoding < iconv.internal_encoding -;mbstring.internal_encoding = - -; Use of this INI entry is deprecated, use global input_encoding instead. -; http input encoding. -; mbstring.encoding_translation = On is needed to use this setting. -; If empty, default_charset or input_encoding or mbstring.input is used. -; The precedence is: default_charset < input_encoding < mbstring.http_input -; http://php.net/mbstring.http-input -;mbstring.http_input = - -; Use of this INI entry is deprecated, use global output_encoding instead. -; http output encoding. -; mb_output_handler must be registered as output buffer to function. -; If empty, default_charset or output_encoding or mbstring.http_output is used. -; The precedence is: default_charset < output_encoding < mbstring.http_output -; To use an output encoding conversion, mbstring's output handler must be set -; otherwise output encoding conversion cannot be performed. -; http://php.net/mbstring.http-output -;mbstring.http_output = - -; enable automatic encoding translation according to -; mbstring.internal_encoding setting. Input chars are -; converted to internal encoding by setting this to On. -; Note: Do _not_ use automatic encoding translation for -; portable libs/applications. -; http://php.net/mbstring.encoding-translation -;mbstring.encoding_translation = Off - -; automatic encoding detection order. -; "auto" detect order is changed according to mbstring.language -; http://php.net/mbstring.detect-order -;mbstring.detect_order = auto - -; substitute_character used when character cannot be converted -; one from another -; http://php.net/mbstring.substitute-character -;mbstring.substitute_character = none - -; overload(replace) single byte functions by mbstring functions. -; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), -; etc. Possible values are 0,1,2,4 or combination of them. -; For example, 7 for overload everything. -; 0: No overload -; 1: Overload mail() function -; 2: Overload str*() functions -; 4: Overload ereg*() functions -; http://php.net/mbstring.func-overload -;mbstring.func_overload = 0 - -; enable strict encoding detection. -; Default: Off -;mbstring.strict_detection = On - -; This directive specifies the regex pattern of content types for which mb_output_handler() -; is activated. -; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml) -;mbstring.http_output_conv_mimetype= - -; This directive specifies maximum stack depth for mbstring regular expressions. It is similar -; to the pcre.recursion_limit for PCRE. -; Default: 100000 -;mbstring.regex_stack_limit=100000 - -; This directive specifies maximum retry count for mbstring regular expressions. It is similar -; to the pcre.backtrack_limit for PCRE. -; Default: 1000000 -;mbstring.regex_retry_limit=1000000 - -[gd] -; Tell the jpeg decode to ignore warnings and try to create -; a gd image. The warning will then be displayed as notices -; disabled by default -; http://php.net/gd.jpeg-ignore-warning -;gd.jpeg_ignore_warning = 1 - -[exif] -; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. -; With mbstring support this will automatically be converted into the encoding -; given by corresponding encode setting. When empty mbstring.internal_encoding -; is used. For the decode settings you can distinguish between motorola and -; intel byte order. A decode setting cannot be empty. -; http://php.net/exif.encode-unicode -;exif.encode_unicode = ISO-8859-15 - -; http://php.net/exif.decode-unicode-motorola -;exif.decode_unicode_motorola = UCS-2BE - -; http://php.net/exif.decode-unicode-intel -;exif.decode_unicode_intel = UCS-2LE - -; http://php.net/exif.encode-jis -;exif.encode_jis = - -; http://php.net/exif.decode-jis-motorola -;exif.decode_jis_motorola = JIS - -; http://php.net/exif.decode-jis-intel -;exif.decode_jis_intel = JIS - -[Tidy] -; The path to a default tidy configuration file to use when using tidy -; http://php.net/tidy.default-config -;tidy.default_config = /usr/local/lib/php/default.tcfg - -; Should tidy clean and repair output automatically? -; WARNING: Do not use this option if you are generating non-html content -; such as dynamic images -; http://php.net/tidy.clean-output -tidy.clean_output = Off - -[soap] -; Enables or disables WSDL caching feature. -; http://php.net/soap.wsdl-cache-enabled -soap.wsdl_cache_enabled=1 - -; Sets the directory name where SOAP extension will put cache files. -; http://php.net/soap.wsdl-cache-dir -soap.wsdl_cache_dir="/tmp" - -; (time to live) Sets the number of second while cached file will be used -; instead of original one. -; http://php.net/soap.wsdl-cache-ttl -soap.wsdl_cache_ttl=86400 - -; Sets the size of the cache limit. (Max. number of WSDL files to cache) -soap.wsdl_cache_limit = 5 - -[sysvshm] -; A default size of the shared memory segment -;sysvshm.init_mem = 10000 - -[ldap] -; Sets the maximum number of open links or -1 for unlimited. -ldap.max_links = -1 - -[dba] -;dba.default_handler= - -[opcache] -; Determines if Zend OPCache is enabled -;opcache.enable=1 - -; Determines if Zend OPCache is enabled for the CLI version of PHP -;opcache.enable_cli=0 - -; The OPcache shared memory storage size. -;opcache.memory_consumption=128 - -; The amount of memory for interned strings in Mbytes. -;opcache.interned_strings_buffer=8 - -; The maximum number of keys (scripts) in the OPcache hash table. -; Only numbers between 200 and 1000000 are allowed. -;opcache.max_accelerated_files=10000 - -; The maximum percentage of "wasted" memory until a restart is scheduled. -;opcache.max_wasted_percentage=5 - -; When this directive is enabled, the OPcache appends the current working -; directory to the script key, thus eliminating possible collisions between -; files with the same name (basename). Disabling the directive improves -; performance, but may break existing applications. -;opcache.use_cwd=1 - -; When disabled, you must reset the OPcache manually or restart the -; webserver for changes to the filesystem to take effect. -;opcache.validate_timestamps=1 - -; How often (in seconds) to check file timestamps for changes to the shared -; memory storage allocation. ("1" means validate once per second, but only -; once per request. "0" means always validate) -;opcache.revalidate_freq=2 - -; Enables or disables file search in include_path optimization -;opcache.revalidate_path=0 - -; If disabled, all PHPDoc comments are dropped from the code to reduce the -; size of the optimized code. -;opcache.save_comments=1 - -; Allow file existence override (file_exists, etc.) performance feature. -;opcache.enable_file_override=0 - -; A bitmask, where each bit enables or disables the appropriate OPcache -; passes -;opcache.optimization_level=0x7FFFBFFF - -;opcache.dups_fix=0 - -; The location of the OPcache blacklist file (wildcards allowed). -; Each OPcache blacklist file is a text file that holds the names of files -; that should not be accelerated. The file format is to add each filename -; to a new line. The filename may be a full path or just a file prefix -; (i.e., /var/www/x blacklists all the files and directories in /var/www -; that start with 'x'). Line starting with a ; are ignored (comments). -;opcache.blacklist_filename= - -; Allows exclusion of large files from being cached. By default all files -; are cached. -;opcache.max_file_size=0 - -; Check the cache checksum each N requests. -; The default value of "0" means that the checks are disabled. -;opcache.consistency_checks=0 - -; How long to wait (in seconds) for a scheduled restart to begin if the cache -; is not being accessed. -;opcache.force_restart_timeout=180 - -; OPcache error_log file name. Empty string assumes "stderr". -;opcache.error_log= - -; All OPcache errors go to the Web server log. -; By default, only fatal errors (level 0) or errors (level 1) are logged. -; You can also enable warnings (level 2), info messages (level 3) or -; debug messages (level 4). -;opcache.log_verbosity_level=1 - -; Preferred Shared Memory back-end. Leave empty and let the system decide. -;opcache.preferred_memory_model= - -; Protect the shared memory from unexpected writing during script execution. -; Useful for internal debugging only. -;opcache.protect_memory=0 - -; Allows calling OPcache API functions only from PHP scripts which path is -; started from specified string. The default "" means no restriction -;opcache.restrict_api= - -; Mapping base of shared memory segments (for Windows only). All the PHP -; processes have to map shared memory into the same address space. This -; directive allows to manually fix the "Unable to reattach to base address" -; errors. -;opcache.mmap_base= - -; Facilitates multiple OPcache instances per user (for Windows only). All PHP -; processes with the same cache ID and user share an OPcache instance. -;opcache.cache_id= - -; Enables and sets the second level cache directory. -; It should improve performance when SHM memory is full, at server restart or -; SHM reset. The default "" disables file based caching. -;opcache.file_cache= - -; Enables or disables opcode caching in shared memory. -;opcache.file_cache_only=0 - -; Enables or disables checksum validation when script loaded from file cache. -;opcache.file_cache_consistency_checks=1 - -; Implies opcache.file_cache_only=1 for a certain process that failed to -; reattach to the shared memory (for Windows only). Explicitly enabled file -; cache is required. -;opcache.file_cache_fallback=1 - -; Enables or disables copying of PHP code (text segment) into HUGE PAGES. -; This should improve performance, but requires appropriate OS configuration. -;opcache.huge_code_pages=1 - -; Validate cached file permissions. -;opcache.validate_permission=0 - -; Prevent name collisions in chroot'ed environment. -;opcache.validate_root=0 - -; If specified, it produces opcode dumps for debugging different stages of -; optimizations. -;opcache.opt_debug_level=0 - -; Specifies a PHP script that is going to be compiled and executed at server -; start-up. -; http://php.net/opcache.preload -;opcache.preload= - -; Preloading code as root is not allowed for security reasons. This directive -; facilitates to let the preloading to be run as another user. -; http://php.net/opcache.preload_user -;opcache.preload_user= - -; Prevents caching files that are less than this number of seconds old. It -; protects from caching of incompletely updated files. In case all file updates -; on your site are atomic, you may increase performance by setting it to "0". -;opcache.file_update_protection=2 - -; Absolute path used to store shared lockfiles (for *nix only). -;opcache.lockfile_path=/tmp - -[curl] -; A default value for the CURLOPT_CAINFO option. This is required to be an -; absolute path. -;curl.cainfo = - -[openssl] -; The location of a Certificate Authority (CA) file on the local filesystem -; to use when verifying the identity of SSL/TLS peers. Most users should -; not specify a value for this directive as PHP will attempt to use the -; OS-managed cert stores in its absence. If specified, this value may still -; be overridden on a per-stream basis via the "cafile" SSL stream context -; option. -;openssl.cafile= - -; If openssl.cafile is not specified or if the CA file is not found, the -; directory pointed to by openssl.capath is searched for a suitable -; certificate. This value must be a correctly hashed certificate directory. -; Most users should not specify a value for this directive as PHP will -; attempt to use the OS-managed cert stores in its absence. If specified, -; this value may still be overridden on a per-stream basis via the "capath" -; SSL stream context option. -;openssl.capath= - -[ffi] -; FFI API restriction. Possible values: -; "preload" - enabled in CLI scripts and preloaded files (default) -; "false" - always disabled -; "true" - always enabled -;ffi.enable=preload - -; List of headers files to preload, wildcard patterns allowed. -;ffi.preload= diff --git a/openQRM-5.3.50-CE/src/etc/httpd/php.cli.php b/openQRM-5.3.50-CE/src/etc/httpd/php.cli.php deleted file mode 100644 index 2cb8b5c..0000000 --- a/openQRM-5.3.50-CE/src/etc/httpd/php.cli.php +++ /dev/null @@ -1,1948 +0,0 @@ -[PHP] - -;;;;;;;;;;;;;;;;;;; -; About php.ini ; -;;;;;;;;;;;;;;;;;;; -; PHP's initialization file, generally called php.ini, is responsible for -; configuring many of the aspects of PHP's behavior. - -; PHP attempts to find and load this configuration from a number of locations. -; The following is a summary of its search order: -; 1. SAPI module specific location. -; 2. The PHPRC environment variable. (As of PHP 5.2.0) -; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0) -; 4. Current working directory (except CLI) -; 5. The web server's directory (for SAPI modules), or directory of PHP -; (otherwise in Windows) -; 6. The directory from the --with-config-file-path compile time option, or the -; Windows directory (usually C:\windows) -; See the PHP docs for more specific information. -; http://php.net/configuration.file - -; The syntax of the file is extremely simple. Whitespace and lines -; beginning with a semicolon are silently ignored (as you probably guessed). -; Section headers (e.g. [Foo]) are also silently ignored, even though -; they might mean something in the future. - -; Directives following the section heading [PATH=/www/mysite] only -; apply to PHP files in the /www/mysite directory. Directives -; following the section heading [HOST=www.example.com] only apply to -; PHP files served from www.example.com. Directives set in these -; special sections cannot be overridden by user-defined INI files or -; at runtime. Currently, [PATH=] and [HOST=] sections only work under -; CGI/FastCGI. -; http://php.net/ini.sections - -; Directives are specified using the following syntax: -; directive = value -; Directive names are *case sensitive* - foo=bar is different from FOO=bar. -; Directives are variables used to configure PHP or PHP extensions. -; There is no name validation. If PHP can't find an expected -; directive because it is not set or is mistyped, a default value will be used. - -; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one -; of the INI constants (On, Off, True, False, Yes, No and None) or an expression -; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a -; previously set variable or directive (e.g. ${foo}) - -; Expressions in the INI file are limited to bitwise operators and parentheses: -; | bitwise OR -; ^ bitwise XOR -; & bitwise AND -; ~ bitwise NOT -; ! boolean NOT - -; Boolean flags can be turned on using the values 1, On, True or Yes. -; They can be turned off using the values 0, Off, False or No. - -; An empty string can be denoted by simply not writing anything after the equal -; sign, or by using the None keyword: - -; foo = ; sets foo to an empty string -; foo = None ; sets foo to an empty string -; foo = "None" ; sets foo to the string 'None' - -; If you use constants in your value, and these constants belong to a -; dynamically loaded extension (either a PHP extension or a Zend extension), -; you may only use these constants *after* the line that loads the extension. - -;;;;;;;;;;;;;;;;;;; -; About this file ; -;;;;;;;;;;;;;;;;;;; -; PHP comes packaged with two INI files. One that is recommended to be used -; in production environments and one that is recommended to be used in -; development environments. - -; php.ini-production contains settings which hold security, performance and -; best practices at its core. But please be aware, these settings may break -; compatibility with older or less security conscience applications. We -; recommending using the production ini in production and testing environments. - -; php.ini-development is very similar to its production variant, except it is -; much more verbose when it comes to errors. We recommend using the -; development version only in development environments, as errors shown to -; application users can inadvertently leak otherwise secure information. - -; This is the php.ini-production INI file. - -;;;;;;;;;;;;;;;;;;; -; Quick Reference ; -;;;;;;;;;;;;;;;;;;; -; The following are all the settings which are different in either the production -; or development versions of the INIs with respect to PHP's default behavior. -; Please see the actual settings later in the document for more details as to why -; we recommend these changes in PHP's behavior. - -; display_errors -; Default Value: On -; Development Value: On -; Production Value: Off - -; display_startup_errors -; Default Value: Off -; Development Value: On -; Production Value: Off - -; error_reporting -; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED -; Development Value: E_ALL -; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT - -; log_errors -; Default Value: Off -; Development Value: On -; Production Value: On - -; max_input_time -; Default Value: -1 (Unlimited) -; Development Value: 60 (60 seconds) -; Production Value: 60 (60 seconds) - -; output_buffering -; Default Value: Off -; Development Value: 4096 -; Production Value: 4096 - -; register_argc_argv -; Default Value: On -; Development Value: Off -; Production Value: Off - -; request_order -; Default Value: None -; Development Value: "GP" -; Production Value: "GP" - -; session.gc_divisor -; Default Value: 100 -; Development Value: 1000 -; Production Value: 1000 - -; session.sid_bits_per_character -; Default Value: 4 -; Development Value: 5 -; Production Value: 5 - -; short_open_tag -; Default Value: On -; Development Value: Off -; Production Value: Off - -; variables_order -; Default Value: "EGPCS" -; Development Value: "GPCS" -; Production Value: "GPCS" - -;;;;;;;;;;;;;;;;;;;; -; php.ini Options ; -;;;;;;;;;;;;;;;;;;;; -; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini" -;user_ini.filename = ".user.ini" - -; To disable this feature set this option to an empty value -;user_ini.filename = - -; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes) -;user_ini.cache_ttl = 300 - -;;;;;;;;;;;;;;;;;;;; -; Language Options ; -;;;;;;;;;;;;;;;;;;;; - -; Enable the PHP scripting language engine under Apache. -; http://php.net/engine -engine = On - -; This directive determines whether or not PHP will recognize code between -; tags as PHP source which should be processed as such. It is -; generally recommended that should be used and that this feature -; should be disabled, as enabling it may result in issues when generating XML -; documents, however this remains supported for backward compatibility reasons. -; Note that this directive does not control the would work. -; http://php.net/syntax-highlighting -;highlight.string = #DD0000 -;highlight.comment = #FF9900 -;highlight.keyword = #007700 -;highlight.default = #0000BB -;highlight.html = #000000 - -; If enabled, the request will be allowed to complete even if the user aborts -; the request. Consider enabling it if executing long requests, which may end up -; being interrupted by the user or a browser timing out. PHP's default behavior -; is to disable this feature. -; http://php.net/ignore-user-abort -;ignore_user_abort = On - -; Determines the size of the realpath cache to be used by PHP. This value should -; be increased on systems where PHP opens many files to reflect the quantity of -; the file operations performed. -; Note: if open_basedir is set, the cache is disabled -; http://php.net/realpath-cache-size -;realpath_cache_size = 4096k - -; Duration of time, in seconds for which to cache realpath information for a given -; file or directory. For systems with rarely changing files, consider increasing this -; value. -; http://php.net/realpath-cache-ttl -;realpath_cache_ttl = 120 - -; Enables or disables the circular reference collector. -; http://php.net/zend.enable-gc -zend.enable_gc = On - -; If enabled, scripts may be written in encodings that are incompatible with -; the scanner. CP936, Big5, CP949 and Shift_JIS are the examples of such -; encodings. To use this feature, mbstring extension must be enabled. -; Default: Off -;zend.multibyte = Off - -; Allows to set the default encoding for the scripts. This value will be used -; unless "declare(encoding=...)" directive appears at the top of the script. -; Only affects if zend.multibyte is set. -; Default: "" -;zend.script_encoding = - -; Allows to include or exclude arguments from stack traces generated for exceptions. -; In production, it is recommended to turn this setting on to prohibit the output -; of sensitive information in stack traces -; Default: Off -zend.exception_ignore_args = On - -;;;;;;;;;;;;;;;;; -; Miscellaneous ; -;;;;;;;;;;;;;;;;; - -; Decides whether PHP may expose the fact that it is installed on the server -; (e.g. by adding its signature to the Web server header). It is no security -; threat in any way, but it makes it possible to determine whether you use PHP -; on your server or not. -; http://php.net/expose-php -expose_php = On - -;;;;;;;;;;;;;;;;;;; -; Resource Limits ; -;;;;;;;;;;;;;;;;;;; - -; Maximum execution time of each script, in seconds -; http://php.net/max-execution-time -; Note: This directive is hardcoded to 0 for the CLI SAPI -max_execution_time = 30 - -; Maximum amount of time each script may spend parsing request data. It's a good -; idea to limit this time on productions servers in order to eliminate unexpectedly -; long running scripts. -; Note: This directive is hardcoded to -1 for the CLI SAPI -; Default Value: -1 (Unlimited) -; Development Value: 60 (60 seconds) -; Production Value: 60 (60 seconds) -; http://php.net/max-input-time -max_input_time = 60 - -; Maximum input variable nesting level -; http://php.net/max-input-nesting-level -;max_input_nesting_level = 64 - -; How many GET/POST/COOKIE input variables may be accepted -;max_input_vars = 1000 - -; Maximum amount of memory a script may consume -; http://php.net/memory-limit -memory_limit = -1 - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Error handling and logging ; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -; This directive informs PHP of which errors, warnings and notices you would like -; it to take action for. The recommended way of setting values for this -; directive is through the use of the error level constants and bitwise -; operators. The error level constants are below here for convenience as well as -; some common settings and their meanings. -; By default, PHP is set to take action on all errors, notices and warnings EXCEPT -; those related to E_NOTICE and E_STRICT, which together cover best practices and -; recommended coding standards in PHP. For performance reasons, this is the -; recommend error reporting setting. Your production server shouldn't be wasting -; resources complaining about best practices and coding standards. That's what -; development servers and development settings are for. -; Note: The php.ini-development file has this setting as E_ALL. This -; means it pretty much reports everything which is exactly what you want during -; development and early testing. -; -; Error Level Constants: -; E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0) -; E_ERROR - fatal run-time errors -; E_RECOVERABLE_ERROR - almost fatal run-time errors -; E_WARNING - run-time warnings (non-fatal errors) -; E_PARSE - compile-time parse errors -; E_NOTICE - run-time notices (these are warnings which often result -; from a bug in your code, but it's possible that it was -; intentional (e.g., using an uninitialized variable and -; relying on the fact it is automatically initialized to an -; empty string) -; E_STRICT - run-time notices, enable to have PHP suggest changes -; to your code which will ensure the best interoperability -; and forward compatibility of your code -; E_CORE_ERROR - fatal errors that occur during PHP's initial startup -; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's -; initial startup -; E_COMPILE_ERROR - fatal compile-time errors -; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) -; E_USER_ERROR - user-generated error message -; E_USER_WARNING - user-generated warning message -; E_USER_NOTICE - user-generated notice message -; E_DEPRECATED - warn about code that will not work in future versions -; of PHP -; E_USER_DEPRECATED - user-generated deprecation warnings -; -; Common Values: -; E_ALL (Show all errors, warnings and notices including coding standards.) -; E_ALL & ~E_NOTICE (Show all errors, except for notices) -; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.) -; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) -; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED -; Development Value: E_ALL -; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT -; http://php.net/error-reporting -error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT - -; This directive controls whether or not and where PHP will output errors, -; notices and warnings too. Error output is very useful during development, but -; it could be very dangerous in production environments. Depending on the code -; which is triggering the error, sensitive information could potentially leak -; out of your application such as database usernames and passwords or worse. -; For production environments, we recommend logging errors rather than -; sending them to STDOUT. -; Possible Values: -; Off = Do not display any errors -; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) -; On or stdout = Display errors to STDOUT -; Default Value: On -; Development Value: On -; Production Value: Off -; http://php.net/display-errors -display_errors = Off - -; The display of errors which occur during PHP's startup sequence are handled -; separately from display_errors. PHP's default behavior is to suppress those -; errors from clients. Turning the display of startup errors on can be useful in -; debugging configuration problems. We strongly recommend you -; set this to 'off' for production servers. -; Default Value: Off -; Development Value: On -; Production Value: Off -; http://php.net/display-startup-errors -display_startup_errors = Off - -; Besides displaying errors, PHP can also log errors to locations such as a -; server-specific log, STDERR, or a location specified by the error_log -; directive found below. While errors should not be displayed on productions -; servers they should still be monitored and logging is a great way to do that. -; Default Value: Off -; Development Value: On -; Production Value: On -; http://php.net/log-errors -log_errors = On - -; Set maximum length of log_errors. In error_log information about the source is -; added. The default is 1024 and 0 allows to not apply any maximum length at all. -; http://php.net/log-errors-max-len -log_errors_max_len = 1024 - -; Do not log repeated messages. Repeated errors must occur in same file on same -; line unless ignore_repeated_source is set true. -; http://php.net/ignore-repeated-errors -ignore_repeated_errors = Off - -; Ignore source of message when ignoring repeated messages. When this setting -; is On you will not log errors with repeated messages from different files or -; source lines. -; http://php.net/ignore-repeated-source -ignore_repeated_source = Off - -; If this parameter is set to Off, then memory leaks will not be shown (on -; stdout or in the log). This is only effective in a debug compile, and if -; error reporting includes E_WARNING in the allowed list -; http://php.net/report-memleaks -report_memleaks = On - -; This setting is on by default. -;report_zend_debug = 0 - -; Store the last error/warning message in $php_errormsg (boolean). Setting this value -; to On can assist in debugging and is appropriate for development servers. It should -; however be disabled on production servers. -; This directive is DEPRECATED. -; Default Value: Off -; Development Value: Off -; Production Value: Off -; http://php.net/track-errors -;track_errors = Off - -; Turn off normal error reporting and emit XML-RPC error XML -; http://php.net/xmlrpc-errors -;xmlrpc_errors = 0 - -; An XML-RPC faultCode -;xmlrpc_error_number = 0 - -; When PHP displays or logs an error, it has the capability of formatting the -; error message as HTML for easier reading. This directive controls whether -; the error message is formatted as HTML or not. -; Note: This directive is hardcoded to Off for the CLI SAPI -; http://php.net/html-errors -;html_errors = On - -; If html_errors is set to On *and* docref_root is not empty, then PHP -; produces clickable error messages that direct to a page describing the error -; or function causing the error in detail. -; You can download a copy of the PHP manual from http://php.net/docs -; and change docref_root to the base URL of your local copy including the -; leading '/'. You must also specify the file extension being used including -; the dot. PHP's default behavior is to leave these settings empty, in which -; case no links to documentation are generated. -; Note: Never use this feature for production boxes. -; http://php.net/docref-root -; Examples -;docref_root = "/phpmanual/" - -; http://php.net/docref-ext -;docref_ext = .html - -; String to output before an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-prepend-string -; Example: -;error_prepend_string = "" - -; String to output after an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-append-string -; Example: -;error_append_string = "" - -; Log errors to specified file. PHP's default behavior is to leave this value -; empty. -; http://php.net/error-log -; Example: -;error_log = php_errors.log -error_log = /var/log/php.log -; Log errors to syslog (Event Log on Windows). -;error_log = syslog - -; The syslog ident is a string which is prepended to every message logged -; to syslog. Only used when error_log is set to syslog. -;syslog.ident = php - -; The syslog facility is used to specify what type of program is logging -; the message. Only used when error_log is set to syslog. -;syslog.facility = user - -; Set this to disable filtering control characters (the default). -; Some loggers only accept NVT-ASCII, others accept anything that's not -; control characters. If your logger accepts everything, then no filtering -; is needed at all. -; Allowed values are: -; ascii (all printable ASCII characters and NL) -; no-ctrl (all characters except control characters) -; all (all characters) -; raw (like "all", but messages are not split at newlines) -; http://php.net/syslog.filter -;syslog.filter = ascii - -;windows.show_crt_warning -; Default value: 0 -; Development value: 0 -; Production value: 0 - -;;;;;;;;;;;;;;;;; -; Data Handling ; -;;;;;;;;;;;;;;;;; - -; The separator used in PHP generated URLs to separate arguments. -; PHP's default setting is "&". -; http://php.net/arg-separator.output -; Example: -;arg_separator.output = "&" - -; List of separator(s) used by PHP to parse input URLs into variables. -; PHP's default setting is "&". -; NOTE: Every character in this directive is considered as separator! -; http://php.net/arg-separator.input -; Example: -;arg_separator.input = ";&" - -; This directive determines which super global arrays are registered when PHP -; starts up. G,P,C,E & S are abbreviations for the following respective super -; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty -; paid for the registration of these arrays and because ENV is not as commonly -; used as the others, ENV is not recommended on productions servers. You -; can still get access to the environment variables through getenv() should you -; need to. -; Default Value: "EGPCS" -; Development Value: "GPCS" -; Production Value: "GPCS"; -; http://php.net/variables-order -variables_order = "GPCS" - -; This directive determines which super global data (G,P & C) should be -; registered into the super global array REQUEST. If so, it also determines -; the order in which that data is registered. The values for this directive -; are specified in the same manner as the variables_order directive, -; EXCEPT one. Leaving this value empty will cause PHP to use the value set -; in the variables_order directive. It does not mean it will leave the super -; globals array REQUEST empty. -; Default Value: None -; Development Value: "GP" -; Production Value: "GP" -; http://php.net/request-order -request_order = "GP" - -; This directive determines whether PHP registers $argv & $argc each time it -; runs. $argv contains an array of all the arguments passed to PHP when a script -; is invoked. $argc contains an integer representing the number of arguments -; that were passed when the script was invoked. These arrays are extremely -; useful when running scripts from the command line. When this directive is -; enabled, registering these variables consumes CPU cycles and memory each time -; a script is executed. For performance reasons, this feature should be disabled -; on production servers. -; Note: This directive is hardcoded to On for the CLI SAPI -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/register-argc-argv -register_argc_argv = Off - -; When enabled, the ENV, REQUEST and SERVER variables are created when they're -; first used (Just In Time) instead of when the script starts. If these -; variables are not used within a script, having this directive on will result -; in a performance gain. The PHP directive register_argc_argv must be disabled -; for this directive to have any effect. -; http://php.net/auto-globals-jit -auto_globals_jit = On - -; Whether PHP will read the POST data. -; This option is enabled by default. -; Most likely, you won't want to disable this option globally. It causes $_POST -; and $_FILES to always be empty; the only way you will be able to read the -; POST data will be through the php://input stream wrapper. This can be useful -; to proxy requests or to process the POST data in a memory efficient fashion. -; http://php.net/enable-post-data-reading -;enable_post_data_reading = Off - -; Maximum size of POST data that PHP will accept. -; Its value may be 0 to disable the limit. It is ignored if POST data reading -; is disabled through enable_post_data_reading. -; http://php.net/post-max-size -post_max_size = 8M - -; Automatically add files before PHP document. -; http://php.net/auto-prepend-file -auto_prepend_file = - -; Automatically add files after PHP document. -; http://php.net/auto-append-file -auto_append_file = - -; By default, PHP will output a media type using the Content-Type header. To -; disable this, simply set it to be empty. -; -; PHP's built-in default media type is set to text/html. -; http://php.net/default-mimetype -default_mimetype = "text/html" - -; PHP's default character set is set to UTF-8. -; http://php.net/default-charset -default_charset = "UTF-8" - -; PHP internal character encoding is set to empty. -; If empty, default_charset is used. -; http://php.net/internal-encoding -;internal_encoding = - -; PHP input character encoding is set to empty. -; If empty, default_charset is used. -; http://php.net/input-encoding -;input_encoding = - -; PHP output character encoding is set to empty. -; If empty, default_charset is used. -; See also output_buffer. -; http://php.net/output-encoding -;output_encoding = - -;;;;;;;;;;;;;;;;;;;;;;;;; -; Paths and Directories ; -;;;;;;;;;;;;;;;;;;;;;;;;; - -; UNIX: "/path1:/path2" -;include_path = ".:/usr/share/php" -; -; Windows: "\path1;\path2" -;include_path = ".;c:\php\includes" -; -; PHP's default setting for include_path is ".;/path/to/php/pear" -; http://php.net/include-path - -; The root of the PHP pages, used only if nonempty. -; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root -; if you are running php as a CGI under any web server (other than IIS) -; see documentation for security issues. The alternate is to use the -; cgi.force_redirect configuration below -; http://php.net/doc-root -doc_root = - -; The directory under which PHP opens the script using /~username used only -; if nonempty. -; http://php.net/user-dir -user_dir = - -; Directory in which the loadable extensions (modules) reside. -; http://php.net/extension-dir -;extension_dir = "./" -; On windows: -;extension_dir = "ext" - -; Directory where the temporary files should be placed. -; Defaults to the system default (see sys_get_temp_dir) -;sys_temp_dir = "/tmp" - -; Whether or not to enable the dl() function. The dl() function does NOT work -; properly in multithreaded servers, such as IIS or Zeus, and is automatically -; disabled on them. -; http://php.net/enable-dl -enable_dl = Off - -; cgi.force_redirect is necessary to provide security running PHP as a CGI under -; most web servers. Left undefined, PHP turns this on by default. You can -; turn it off here AT YOUR OWN RISK -; **You CAN safely turn this off for IIS, in fact, you MUST.** -; http://php.net/cgi.force-redirect -;cgi.force_redirect = 1 - -; if cgi.nph is enabled it will force cgi to always sent Status: 200 with -; every request. PHP's default behavior is to disable this feature. -;cgi.nph = 1 - -; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape -; (iPlanet) web servers, you MAY need to set an environment variable name that PHP -; will look for to know it is OK to continue execution. Setting this variable MAY -; cause security issues, KNOW WHAT YOU ARE DOING FIRST. -; http://php.net/cgi.redirect-status-env -;cgi.redirect_status_env = - -; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's -; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok -; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting -; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting -; of zero causes PHP to behave as before. Default is 1. You should fix your scripts -; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. -; http://php.net/cgi.fix-pathinfo -;cgi.fix_pathinfo=1 - -; if cgi.discard_path is enabled, the PHP CGI binary can safely be placed outside -; of the web tree and people will not be able to circumvent .htaccess security. -;cgi.discard_path=1 - -; FastCGI under IIS supports the ability to impersonate -; security tokens of the calling client. This allows IIS to define the -; security context that the request runs under. mod_fastcgi under Apache -; does not currently support this feature (03/17/2002) -; Set to 1 if running under IIS. Default is zero. -; http://php.net/fastcgi.impersonate -;fastcgi.impersonate = 1 - -; Disable logging through FastCGI connection. PHP's default behavior is to enable -; this feature. -;fastcgi.logging = 0 - -; cgi.rfc2616_headers configuration option tells PHP what type of headers to -; use when sending HTTP response code. If set to 0, PHP sends Status: header that -; is supported by Apache. When this option is set to 1, PHP will send -; RFC2616 compliant header. -; Default is zero. -; http://php.net/cgi.rfc2616-headers -;cgi.rfc2616_headers = 0 - -; cgi.check_shebang_line controls whether CGI PHP checks for line starting with #! -; (shebang) at the top of the running script. This line might be needed if the -; script support running both as stand-alone script and via PHP CGI<. PHP in CGI -; mode skips this line and ignores its content if this directive is turned on. -; http://php.net/cgi.check-shebang-line -;cgi.check_shebang_line=1 - -;;;;;;;;;;;;;;;; -; File Uploads ; -;;;;;;;;;;;;;;;; - -; Whether to allow HTTP file uploads. -; http://php.net/file-uploads -file_uploads = On - -; Temporary directory for HTTP uploaded files (will use system default if not -; specified). -; http://php.net/upload-tmp-dir -;upload_tmp_dir = - -; Maximum allowed size for uploaded files. -; http://php.net/upload-max-filesize -upload_max_filesize = 2M - -; Maximum number of files that can be uploaded via a single request -max_file_uploads = 20 - -;;;;;;;;;;;;;;;;;; -; Fopen wrappers ; -;;;;;;;;;;;;;;;;;; - -; Whether to allow the treatment of URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-fopen -allow_url_fopen = On - -; Whether to allow include/require to open URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-include -allow_url_include = Off - -; Define the anonymous ftp password (your email address). PHP's default setting -; for this is empty. -; http://php.net/from -;from="john@doe.com" - -; Define the User-Agent string. PHP's default setting for this is empty. -; http://php.net/user-agent -;user_agent="PHP" - -; Default timeout for socket based streams (seconds) -; http://php.net/default-socket-timeout -default_socket_timeout = 60 - -; If your scripts have to deal with files from Macintosh systems, -; or you are running on a Mac and need to deal with files from -; unix or win32 systems, setting this flag will cause PHP to -; automatically detect the EOL character in those files so that -; fgets() and file() will work regardless of the source of the file. -; http://php.net/auto-detect-line-endings -;auto_detect_line_endings = Off - -;;;;;;;;;;;;;;;;;;;;;; -; Dynamic Extensions ; -;;;;;;;;;;;;;;;;;;;;;; - -; If you wish to have an extension loaded automatically, use the following -; syntax: -; -; extension=modulename -; -; For example: -; -; extension=mysqli -; -; When the extension library to load is not located in the default extension -; directory, You may specify an absolute path to the library file: -; -; extension=/path/to/extension/mysqli.so -; -; Note : The syntax used in previous PHP versions ('extension=.so' and -; 'extension='php_.dll') is supported for legacy reasons and may be -; deprecated in a future PHP major version. So, when it is possible, please -; move to the new ('extension=) syntax. -; -; Notes for Windows environments : -; -; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+) -; extension folders as well as the separate PECL DLL download (PHP 5+). -; Be sure to appropriately set the extension_dir directive. -; -;extension=bz2 -;extension=curl -;extension=ffi -;extension=ftp -;extension=fileinfo -;extension=gd2 -;extension=gettext -;extension=gmp -;extension=intl -;extension=imap -;extension=ldap -;extension=mbstring -;extension=exif ; Must be after mbstring as it depends on it -;extension=mysqli -;extension=oci8_12c ; Use with Oracle Database 12c Instant Client -;extension=odbc -;extension=openssl -;extension=pdo_firebird -;extension=pdo_mysql -;extension=pdo_oci -;extension=pdo_odbc -;extension=pdo_pgsql -;extension=pdo_sqlite -;extension=pgsql -;extension=shmop - -; The MIBS data available in the PHP distribution must be installed. -; See http://www.php.net/manual/en/snmp.installation.php -;extension=snmp - -;extension=soap -;extension=sockets -;extension=sodium -;extension=sqlite3 -;extension=tidy -;extension=xmlrpc -;extension=xsl - -;;;;;;;;;;;;;;;;;;; -; Module Settings ; -;;;;;;;;;;;;;;;;;;; - -[CLI Server] -; Whether the CLI web server uses ANSI color coding in its terminal output. -cli_server.color = On - -[Date] -; Defines the default timezone used by the date functions -; http://php.net/date.timezone -;date.timezone = - -; http://php.net/date.default-latitude -;date.default_latitude = 31.7667 - -; http://php.net/date.default-longitude -;date.default_longitude = 35.2333 - -; http://php.net/date.sunrise-zenith -;date.sunrise_zenith = 90.583333 - -; http://php.net/date.sunset-zenith -;date.sunset_zenith = 90.583333 - -[filter] -; http://php.net/filter.default -;filter.default = unsafe_raw - -; http://php.net/filter.default-flags -;filter.default_flags = - -[iconv] -; Use of this INI entry is deprecated, use global input_encoding instead. -; If empty, default_charset or input_encoding or iconv.input_encoding is used. -; The precedence is: default_charset < input_encoding < iconv.input_encoding -;iconv.input_encoding = - -; Use of this INI entry is deprecated, use global internal_encoding instead. -; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. -; The precedence is: default_charset < internal_encoding < iconv.internal_encoding -;iconv.internal_encoding = - -; Use of this INI entry is deprecated, use global output_encoding instead. -; If empty, default_charset or output_encoding or iconv.output_encoding is used. -; The precedence is: default_charset < output_encoding < iconv.output_encoding -; To use an output encoding conversion, iconv's output handler must be set -; otherwise output encoding conversion cannot be performed. -;iconv.output_encoding = - -[imap] -; rsh/ssh logins are disabled by default. Use this INI entry if you want to -; enable them. Note that the IMAP library does not filter mailbox names before -; passing them to rsh/ssh command, thus passing untrusted data to this function -; with rsh/ssh enabled is insecure. -;imap.enable_insecure_rsh=0 - -[intl] -;intl.default_locale = -; This directive allows you to produce PHP errors when some error -; happens within intl functions. The value is the level of the error produced. -; Default is 0, which does not produce any errors. -;intl.error_level = E_WARNING -;intl.use_exceptions = 0 - -[sqlite3] -; Directory pointing to SQLite3 extensions -; http://php.net/sqlite3.extension-dir -;sqlite3.extension_dir = - -; SQLite defensive mode flag (only available from SQLite 3.26+) -; When the defensive flag is enabled, language features that allow ordinary -; SQL to deliberately corrupt the database file are disabled. This forbids -; writing directly to the schema, shadow tables (eg. FTS data tables), or -; the sqlite_dbpage virtual table. -; https://www.sqlite.org/c3ref/c_dbconfig_defensive.html -; (for older SQLite versions, this flag has no use) -;sqlite3.defensive = 1 - -[Pcre] -; PCRE library backtracking limit. -; http://php.net/pcre.backtrack-limit -;pcre.backtrack_limit=100000 - -; PCRE library recursion limit. -; Please note that if you set this value to a high number you may consume all -; the available process stack and eventually crash PHP (due to reaching the -; stack size limit imposed by the Operating System). -; http://php.net/pcre.recursion-limit -;pcre.recursion_limit=100000 - -; Enables or disables JIT compilation of patterns. This requires the PCRE -; library to be compiled with JIT support. -;pcre.jit=1 - -[Pdo] -; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" -; http://php.net/pdo-odbc.connection-pooling -;pdo_odbc.connection_pooling=strict - -;pdo_odbc.db2_instance_name - -[Pdo_mysql] -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -pdo_mysql.default_socket= - -[Phar] -; http://php.net/phar.readonly -;phar.readonly = On - -; http://php.net/phar.require-hash -;phar.require_hash = On - -;phar.cache_list = - -[mail function] -; For Win32 only. -; http://php.net/smtp -SMTP = localhost -; http://php.net/smtp-port -smtp_port = 25 - -; For Win32 only. -; http://php.net/sendmail-from -;sendmail_from = me@example.com - -; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). -; http://php.net/sendmail-path -;sendmail_path = - -; Force the addition of the specified parameters to be passed as extra parameters -; to the sendmail binary. These parameters will always replace the value of -; the 5th parameter to mail(). -;mail.force_extra_parameters = - -; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename -mail.add_x_header = Off - -; The path to a log file that will log all mail() calls. Log entries include -; the full path of the script, line number, To address and headers. -;mail.log = -; Log mail to syslog (Event Log on Windows). -;mail.log = syslog - -[ODBC] -; http://php.net/odbc.default-db -;odbc.default_db = Not yet implemented - -; http://php.net/odbc.default-user -;odbc.default_user = Not yet implemented - -; http://php.net/odbc.default-pw -;odbc.default_pw = Not yet implemented - -; Controls the ODBC cursor model. -; Default: SQL_CURSOR_STATIC (default). -;odbc.default_cursortype - -; Allow or prevent persistent links. -; http://php.net/odbc.allow-persistent -odbc.allow_persistent = On - -; Check that a connection is still valid before reuse. -; http://php.net/odbc.check-persistent -odbc.check_persistent = On - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/odbc.max-persistent -odbc.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/odbc.max-links -odbc.max_links = -1 - -; Handling of LONG fields. Returns number of bytes to variables. 0 means -; passthru. -; http://php.net/odbc.defaultlrl -odbc.defaultlrl = 4096 - -; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. -; See the documentation on odbc_binmode and odbc_longreadlen for an explanation -; of odbc.defaultlrl and odbc.defaultbinmode -; http://php.net/odbc.defaultbinmode -odbc.defaultbinmode = 1 - -[MySQLi] - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/mysqli.max-persistent -mysqli.max_persistent = -1 - -; Allow accessing, from PHP's perspective, local files with LOAD DATA statements -; http://php.net/mysqli.allow_local_infile -;mysqli.allow_local_infile = On - -; Allow or prevent persistent links. -; http://php.net/mysqli.allow-persistent -mysqli.allow_persistent = On - -; Maximum number of links. -1 means no limit. -; http://php.net/mysqli.max-links -mysqli.max_links = -1 - -; Default port number for mysqli_connect(). If unset, mysqli_connect() will use -; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the -; compile-time value defined MYSQL_PORT (in that order). Win32 will only look -; at MYSQL_PORT. -; http://php.net/mysqli.default-port -mysqli.default_port = 3306 - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/mysqli.default-socket -mysqli.default_socket = /run/mysqld/mysqld.sock - -; Default host for mysqli_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-host -mysqli.default_host = - -; Default user for mysqli_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-user -mysqli.default_user = - -; Default password for mysqli_connect() (doesn't apply in safe mode). -; Note that this is generally a *bad* idea to store passwords in this file. -; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") -; and reveal this password! And of course, any users with read access to this -; file will be able to reveal the password as well. -; http://php.net/mysqli.default-pw -mysqli.default_pw = - -; Allow or prevent reconnect -mysqli.reconnect = Off - -[mysqlnd] -; Enable / Disable collection of general statistics by mysqlnd which can be -; used to tune and monitor MySQL operations. -mysqlnd.collect_statistics = On - -; Enable / Disable collection of memory usage statistics by mysqlnd which can be -; used to tune and monitor MySQL operations. -mysqlnd.collect_memory_statistics = Off - -; Records communication from all extensions using mysqlnd to the specified log -; file. -; http://php.net/mysqlnd.debug -;mysqlnd.debug = - -; Defines which queries will be logged. -;mysqlnd.log_mask = 0 - -; Default size of the mysqlnd memory pool, which is used by result sets. -;mysqlnd.mempool_default_size = 16000 - -; Size of a pre-allocated buffer used when sending commands to MySQL in bytes. -;mysqlnd.net_cmd_buffer_size = 2048 - -; Size of a pre-allocated buffer used for reading data sent by the server in -; bytes. -;mysqlnd.net_read_buffer_size = 32768 - -; Timeout for network requests in seconds. -;mysqlnd.net_read_timeout = 31536000 - -; SHA-256 Authentication Plugin related. File with the MySQL server public RSA -; key. -;mysqlnd.sha256_server_public_key = - -[OCI8] - -; Connection: Enables privileged connections using external -; credentials (OCI_SYSOPER, OCI_SYSDBA) -; http://php.net/oci8.privileged-connect -;oci8.privileged_connect = Off - -; Connection: The maximum number of persistent OCI8 connections per -; process. Using -1 means no limit. -; http://php.net/oci8.max-persistent -;oci8.max_persistent = -1 - -; Connection: The maximum number of seconds a process is allowed to -; maintain an idle persistent connection. Using -1 means idle -; persistent connections will be maintained forever. -; http://php.net/oci8.persistent-timeout -;oci8.persistent_timeout = -1 - -; Connection: The number of seconds that must pass before issuing a -; ping during oci_pconnect() to check the connection validity. When -; set to 0, each oci_pconnect() will cause a ping. Using -1 disables -; pings completely. -; http://php.net/oci8.ping-interval -;oci8.ping_interval = 60 - -; Connection: Set this to a user chosen connection class to be used -; for all pooled server requests with Oracle 11g Database Resident -; Connection Pooling (DRCP). To use DRCP, this value should be set to -; the same string for all web servers running the same application, -; the database pool must be configured, and the connection string must -; specify to use a pooled server. -;oci8.connection_class = - -; High Availability: Using On lets PHP receive Fast Application -; Notification (FAN) events generated when a database node fails. The -; database must also be configured to post FAN events. -;oci8.events = Off - -; Tuning: This option enables statement caching, and specifies how -; many statements to cache. Using 0 disables statement caching. -; http://php.net/oci8.statement-cache-size -;oci8.statement_cache_size = 20 - -; Tuning: Enables statement prefetching and sets the default number of -; rows that will be fetched automatically after statement execution. -; http://php.net/oci8.default-prefetch -;oci8.default_prefetch = 100 - -; Compatibility. Using On means oci_close() will not close -; oci_connect() and oci_new_connect() connections. -; http://php.net/oci8.old-oci-close-semantics -;oci8.old_oci_close_semantics = Off - -[PostgreSQL] -; Allow or prevent persistent links. -; http://php.net/pgsql.allow-persistent -pgsql.allow_persistent = On - -; Detect broken persistent links always with pg_pconnect(). -; Auto reset feature requires a little overheads. -; http://php.net/pgsql.auto-reset-persistent -pgsql.auto_reset_persistent = Off - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/pgsql.max-persistent -pgsql.max_persistent = -1 - -; Maximum number of links (persistent+non persistent). -1 means no limit. -; http://php.net/pgsql.max-links -pgsql.max_links = -1 - -; Ignore PostgreSQL backends Notice message or not. -; Notice message logging require a little overheads. -; http://php.net/pgsql.ignore-notice -pgsql.ignore_notice = 0 - -; Log PostgreSQL backends Notice message or not. -; Unless pgsql.ignore_notice=0, module cannot log notice message. -; http://php.net/pgsql.log-notice -pgsql.log_notice = 0 - -[bcmath] -; Number of decimal digits for all bcmath functions. -; http://php.net/bcmath.scale -bcmath.scale = 0 - -[browscap] -; http://php.net/browscap -;browscap = extra/browscap.ini - -[Session] -; Handler used to store/retrieve data. -; http://php.net/session.save-handler -session.save_handler = files - -; Argument passed to save_handler. In the case of files, this is the path -; where data files are stored. Note: Windows users have to change this -; variable in order to use PHP's session functions. -; -; The path can be defined as: -; -; session.save_path = "N;/path" -; -; where N is an integer. Instead of storing all the session files in -; /path, what this will do is use subdirectories N-levels deep, and -; store the session data in those directories. This is useful if -; your OS has problems with many files in one directory, and is -; a more efficient layout for servers that handle many sessions. -; -; NOTE 1: PHP will not create this directory structure automatically. -; You can use the script in the ext/session dir for that purpose. -; NOTE 2: See the section on garbage collection below if you choose to -; use subdirectories for session storage -; -; The file storage module creates files using mode 600 by default. -; You can change that by using -; -; session.save_path = "N;MODE;/path" -; -; where MODE is the octal representation of the mode. Note that this -; does not overwrite the process's umask. -; http://php.net/session.save-path -;session.save_path = "/var/lib/php/sessions" - -; Whether to use strict session mode. -; Strict session mode does not accept an uninitialized session ID, and -; regenerates the session ID if the browser sends an uninitialized session ID. -; Strict mode protects applications from session fixation via a session adoption -; vulnerability. It is disabled by default for maximum compatibility, but -; enabling it is encouraged. -; https://wiki.php.net/rfc/strict_sessions -session.use_strict_mode = 0 - -; Whether to use cookies. -; http://php.net/session.use-cookies -session.use_cookies = 1 - -; http://php.net/session.cookie-secure -;session.cookie_secure = - -; This option forces PHP to fetch and use a cookie for storing and maintaining -; the session id. We encourage this operation as it's very helpful in combating -; session hijacking when not specifying and managing your own session id. It is -; not the be-all and end-all of session hijacking defense, but it's a good start. -; http://php.net/session.use-only-cookies -session.use_only_cookies = 1 - -; Name of the session (used as cookie name). -; http://php.net/session.name -session.name = PHPSESSID - -; Initialize session on request startup. -; http://php.net/session.auto-start -session.auto_start = 0 - -; Lifetime in seconds of cookie or, if 0, until browser is restarted. -; http://php.net/session.cookie-lifetime -session.cookie_lifetime = 0 - -; The path for which the cookie is valid. -; http://php.net/session.cookie-path -session.cookie_path = / - -; The domain for which the cookie is valid. -; http://php.net/session.cookie-domain -session.cookie_domain = - -; Whether or not to add the httpOnly flag to the cookie, which makes it -; inaccessible to browser scripting languages such as JavaScript. -; http://php.net/session.cookie-httponly -session.cookie_httponly = - -; Add SameSite attribute to cookie to help mitigate Cross-Site Request Forgery (CSRF/XSRF) -; Current valid values are "Strict", "Lax" or "None". When using "None", -; make sure to include the quotes, as `none` is interpreted like `false` in ini files. -; https://tools.ietf.org/html/draft-west-first-party-cookies-07 -session.cookie_samesite = - -; Handler used to serialize data. php is the standard serializer of PHP. -; http://php.net/session.serialize-handler -session.serialize_handler = php - -; Defines the probability that the 'garbage collection' process is started on every -; session initialization. The probability is calculated by using gc_probability/gc_divisor, -; e.g. 1/100 means there is a 1% chance that the GC process starts on each request. -; Default Value: 1 -; Development Value: 1 -; Production Value: 1 -; http://php.net/session.gc-probability -session.gc_probability = 0 - -; Defines the probability that the 'garbage collection' process is started on every -; session initialization. The probability is calculated by using gc_probability/gc_divisor, -; e.g. 1/100 means there is a 1% chance that the GC process starts on each request. -; For high volume production servers, using a value of 1000 is a more efficient approach. -; Default Value: 100 -; Development Value: 1000 -; Production Value: 1000 -; http://php.net/session.gc-divisor -session.gc_divisor = 1000 - -; After this number of seconds, stored data will be seen as 'garbage' and -; cleaned up by the garbage collection process. -; http://php.net/session.gc-maxlifetime -session.gc_maxlifetime = 1440 - -; NOTE: If you are using the subdirectory option for storing session files -; (see session.save_path above), then garbage collection does *not* -; happen automatically. You will need to do your own garbage -; collection through a shell script, cron entry, or some other method. -; For example, the following script is the equivalent of setting -; session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): -; find /path/to/sessions -cmin +24 -type f | xargs rm - -; Check HTTP Referer to invalidate externally stored URLs containing ids. -; HTTP_REFERER has to contain this substring for the session to be -; considered as valid. -; http://php.net/session.referer-check -session.referer_check = - -; Set to {nocache,private,public,} to determine HTTP caching aspects -; or leave this empty to avoid sending anti-caching headers. -; http://php.net/session.cache-limiter -session.cache_limiter = nocache - -; Document expires after n minutes. -; http://php.net/session.cache-expire -session.cache_expire = 180 - -; trans sid support is disabled by default. -; Use of trans sid may risk your users' security. -; Use this option with caution. -; - User may send URL contains active session ID -; to other person via. email/irc/etc. -; - URL that contains active session ID may be stored -; in publicly accessible computer. -; - User may access your site with the same session ID -; always using URL stored in browser's history or bookmarks. -; http://php.net/session.use-trans-sid -session.use_trans_sid = 0 - -; Set session ID character length. This value could be between 22 to 256. -; Shorter length than default is supported only for compatibility reason. -; Users should use 32 or more chars. -; http://php.net/session.sid-length -; Default Value: 32 -; Development Value: 26 -; Production Value: 26 -session.sid_length = 26 - -; The URL rewriter will look for URLs in a defined set of HTML tags. -; is special; if you include them here, the rewriter will -; add a hidden field with the info which is otherwise appended -; to URLs. tag's action attribute URL will not be modified -; unless it is specified. -; Note that all valid entries require a "=", even if no value follows. -; Default Value: "a=href,area=href,frame=src,form=" -; Development Value: "a=href,area=href,frame=src,form=" -; Production Value: "a=href,area=href,frame=src,form=" -; http://php.net/url-rewriter.tags -session.trans_sid_tags = "a=href,area=href,frame=src,form=" - -; URL rewriter does not rewrite absolute URLs by default. -; To enable rewrites for absolute paths, target hosts must be specified -; at RUNTIME. i.e. use ini_set() -; tags is special. PHP will check action attribute's URL regardless -; of session.trans_sid_tags setting. -; If no host is defined, HTTP_HOST will be used for allowed host. -; Example value: php.net,www.php.net,wiki.php.net -; Use "," for multiple hosts. No spaces are allowed. -; Default Value: "" -; Development Value: "" -; Production Value: "" -;session.trans_sid_hosts="" - -; Define how many bits are stored in each character when converting -; the binary hash data to something readable. -; Possible values: -; 4 (4 bits: 0-9, a-f) -; 5 (5 bits: 0-9, a-v) -; 6 (6 bits: 0-9, a-z, A-Z, "-", ",") -; Default Value: 4 -; Development Value: 5 -; Production Value: 5 -; http://php.net/session.hash-bits-per-character -session.sid_bits_per_character = 5 - -; Enable upload progress tracking in $_SESSION -; Default Value: On -; Development Value: On -; Production Value: On -; http://php.net/session.upload-progress.enabled -;session.upload_progress.enabled = On - -; Cleanup the progress information as soon as all POST data has been read -; (i.e. upload completed). -; Default Value: On -; Development Value: On -; Production Value: On -; http://php.net/session.upload-progress.cleanup -;session.upload_progress.cleanup = On - -; A prefix used for the upload progress key in $_SESSION -; Default Value: "upload_progress_" -; Development Value: "upload_progress_" -; Production Value: "upload_progress_" -; http://php.net/session.upload-progress.prefix -;session.upload_progress.prefix = "upload_progress_" - -; The index name (concatenated with the prefix) in $_SESSION -; containing the upload progress information -; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" -; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" -; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" -; http://php.net/session.upload-progress.name -;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" - -; How frequently the upload progress should be updated. -; Given either in percentages (per-file), or in bytes -; Default Value: "1%" -; Development Value: "1%" -; Production Value: "1%" -; http://php.net/session.upload-progress.freq -;session.upload_progress.freq = "1%" - -; The minimum delay between updates, in seconds -; Default Value: 1 -; Development Value: 1 -; Production Value: 1 -; http://php.net/session.upload-progress.min-freq -;session.upload_progress.min_freq = "1" - -; Only write session data when session data is changed. Enabled by default. -; http://php.net/session.lazy-write -;session.lazy_write = On - -[Assertion] -; Switch whether to compile assertions at all (to have no overhead at run-time) -; -1: Do not compile at all -; 0: Jump over assertion at run-time -; 1: Execute assertions -; Changing from or to a negative value is only possible in php.ini! (For turning assertions on and off at run-time, see assert.active, when zend.assertions = 1) -; Default Value: 1 -; Development Value: 1 -; Production Value: -1 -; http://php.net/zend.assertions -zend.assertions = -1 - -; Assert(expr); active by default. -; http://php.net/assert.active -;assert.active = On - -; Throw an AssertionError on failed assertions -; http://php.net/assert.exception -;assert.exception = On - -; Issue a PHP warning for each failed assertion. (Overridden by assert.exception if active) -; http://php.net/assert.warning -;assert.warning = On - -; Don't bail out by default. -; http://php.net/assert.bail -;assert.bail = Off - -; User-function to be called if an assertion fails. -; http://php.net/assert.callback -;assert.callback = 0 - -; Eval the expression with current error_reporting(). Set to true if you want -; error_reporting(0) around the eval(). -; http://php.net/assert.quiet-eval -;assert.quiet_eval = 0 - -[COM] -; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs -; http://php.net/com.typelib-file -;com.typelib_file = - -; allow Distributed-COM calls -; http://php.net/com.allow-dcom -;com.allow_dcom = true - -; autoregister constants of a component's typlib on com_load() -; http://php.net/com.autoregister-typelib -;com.autoregister_typelib = true - -; register constants casesensitive -; http://php.net/com.autoregister-casesensitive -;com.autoregister_casesensitive = false - -; show warnings on duplicate constant registrations -; http://php.net/com.autoregister-verbose -;com.autoregister_verbose = true - -; The default character set code-page to use when passing strings to and from COM objects. -; Default: system ANSI code page -;com.code_page= - -[mbstring] -; language for internal character representation. -; This affects mb_send_mail() and mbstring.detect_order. -; http://php.net/mbstring.language -;mbstring.language = Japanese - -; Use of this INI entry is deprecated, use global internal_encoding instead. -; internal/script encoding. -; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) -; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. -; The precedence is: default_charset < internal_encoding < iconv.internal_encoding -;mbstring.internal_encoding = - -; Use of this INI entry is deprecated, use global input_encoding instead. -; http input encoding. -; mbstring.encoding_translation = On is needed to use this setting. -; If empty, default_charset or input_encoding or mbstring.input is used. -; The precedence is: default_charset < input_encoding < mbstring.http_input -; http://php.net/mbstring.http-input -;mbstring.http_input = - -; Use of this INI entry is deprecated, use global output_encoding instead. -; http output encoding. -; mb_output_handler must be registered as output buffer to function. -; If empty, default_charset or output_encoding or mbstring.http_output is used. -; The precedence is: default_charset < output_encoding < mbstring.http_output -; To use an output encoding conversion, mbstring's output handler must be set -; otherwise output encoding conversion cannot be performed. -; http://php.net/mbstring.http-output -;mbstring.http_output = - -; enable automatic encoding translation according to -; mbstring.internal_encoding setting. Input chars are -; converted to internal encoding by setting this to On. -; Note: Do _not_ use automatic encoding translation for -; portable libs/applications. -; http://php.net/mbstring.encoding-translation -;mbstring.encoding_translation = Off - -; automatic encoding detection order. -; "auto" detect order is changed according to mbstring.language -; http://php.net/mbstring.detect-order -;mbstring.detect_order = auto - -; substitute_character used when character cannot be converted -; one from another -; http://php.net/mbstring.substitute-character -;mbstring.substitute_character = none - -; overload(replace) single byte functions by mbstring functions. -; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), -; etc. Possible values are 0,1,2,4 or combination of them. -; For example, 7 for overload everything. -; 0: No overload -; 1: Overload mail() function -; 2: Overload str*() functions -; 4: Overload ereg*() functions -; http://php.net/mbstring.func-overload -;mbstring.func_overload = 0 - -; enable strict encoding detection. -; Default: Off -;mbstring.strict_detection = On - -; This directive specifies the regex pattern of content types for which mb_output_handler() -; is activated. -; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml) -;mbstring.http_output_conv_mimetype= - -; This directive specifies maximum stack depth for mbstring regular expressions. It is similar -; to the pcre.recursion_limit for PCRE. -; Default: 100000 -;mbstring.regex_stack_limit=100000 - -; This directive specifies maximum retry count for mbstring regular expressions. It is similar -; to the pcre.backtrack_limit for PCRE. -; Default: 1000000 -;mbstring.regex_retry_limit=1000000 - -[gd] -; Tell the jpeg decode to ignore warnings and try to create -; a gd image. The warning will then be displayed as notices -; disabled by default -; http://php.net/gd.jpeg-ignore-warning -;gd.jpeg_ignore_warning = 1 - -[exif] -; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. -; With mbstring support this will automatically be converted into the encoding -; given by corresponding encode setting. When empty mbstring.internal_encoding -; is used. For the decode settings you can distinguish between motorola and -; intel byte order. A decode setting cannot be empty. -; http://php.net/exif.encode-unicode -;exif.encode_unicode = ISO-8859-15 - -; http://php.net/exif.decode-unicode-motorola -;exif.decode_unicode_motorola = UCS-2BE - -; http://php.net/exif.decode-unicode-intel -;exif.decode_unicode_intel = UCS-2LE - -; http://php.net/exif.encode-jis -;exif.encode_jis = - -; http://php.net/exif.decode-jis-motorola -;exif.decode_jis_motorola = JIS - -; http://php.net/exif.decode-jis-intel -;exif.decode_jis_intel = JIS - -[Tidy] -; The path to a default tidy configuration file to use when using tidy -; http://php.net/tidy.default-config -;tidy.default_config = /usr/local/lib/php/default.tcfg - -; Should tidy clean and repair output automatically? -; WARNING: Do not use this option if you are generating non-html content -; such as dynamic images -; http://php.net/tidy.clean-output -tidy.clean_output = Off - -[soap] -; Enables or disables WSDL caching feature. -; http://php.net/soap.wsdl-cache-enabled -soap.wsdl_cache_enabled=1 - -; Sets the directory name where SOAP extension will put cache files. -; http://php.net/soap.wsdl-cache-dir -soap.wsdl_cache_dir="/tmp" - -; (time to live) Sets the number of second while cached file will be used -; instead of original one. -; http://php.net/soap.wsdl-cache-ttl -soap.wsdl_cache_ttl=86400 - -; Sets the size of the cache limit. (Max. number of WSDL files to cache) -soap.wsdl_cache_limit = 5 - -[sysvshm] -; A default size of the shared memory segment -;sysvshm.init_mem = 10000 - -[ldap] -; Sets the maximum number of open links or -1 for unlimited. -ldap.max_links = -1 - -[dba] -;dba.default_handler= - -[opcache] -; Determines if Zend OPCache is enabled -;opcache.enable=1 - -; Determines if Zend OPCache is enabled for the CLI version of PHP -;opcache.enable_cli=0 - -; The OPcache shared memory storage size. -;opcache.memory_consumption=128 - -; The amount of memory for interned strings in Mbytes. -;opcache.interned_strings_buffer=8 - -; The maximum number of keys (scripts) in the OPcache hash table. -; Only numbers between 200 and 1000000 are allowed. -;opcache.max_accelerated_files=10000 - -; The maximum percentage of "wasted" memory until a restart is scheduled. -;opcache.max_wasted_percentage=5 - -; When this directive is enabled, the OPcache appends the current working -; directory to the script key, thus eliminating possible collisions between -; files with the same name (basename). Disabling the directive improves -; performance, but may break existing applications. -;opcache.use_cwd=1 - -; When disabled, you must reset the OPcache manually or restart the -; webserver for changes to the filesystem to take effect. -;opcache.validate_timestamps=1 - -; How often (in seconds) to check file timestamps for changes to the shared -; memory storage allocation. ("1" means validate once per second, but only -; once per request. "0" means always validate) -;opcache.revalidate_freq=2 - -; Enables or disables file search in include_path optimization -;opcache.revalidate_path=0 - -; If disabled, all PHPDoc comments are dropped from the code to reduce the -; size of the optimized code. -;opcache.save_comments=1 - -; Allow file existence override (file_exists, etc.) performance feature. -;opcache.enable_file_override=0 - -; A bitmask, where each bit enables or disables the appropriate OPcache -; passes -;opcache.optimization_level=0x7FFFBFFF - -;opcache.dups_fix=0 - -; The location of the OPcache blacklist file (wildcards allowed). -; Each OPcache blacklist file is a text file that holds the names of files -; that should not be accelerated. The file format is to add each filename -; to a new line. The filename may be a full path or just a file prefix -; (i.e., /var/www/x blacklists all the files and directories in /var/www -; that start with 'x'). Line starting with a ; are ignored (comments). -;opcache.blacklist_filename= - -; Allows exclusion of large files from being cached. By default all files -; are cached. -;opcache.max_file_size=0 - -; Check the cache checksum each N requests. -; The default value of "0" means that the checks are disabled. -;opcache.consistency_checks=0 - -; How long to wait (in seconds) for a scheduled restart to begin if the cache -; is not being accessed. -;opcache.force_restart_timeout=180 - -; OPcache error_log file name. Empty string assumes "stderr". -;opcache.error_log= - -; All OPcache errors go to the Web server log. -; By default, only fatal errors (level 0) or errors (level 1) are logged. -; You can also enable warnings (level 2), info messages (level 3) or -; debug messages (level 4). -;opcache.log_verbosity_level=1 - -; Preferred Shared Memory back-end. Leave empty and let the system decide. -;opcache.preferred_memory_model= - -; Protect the shared memory from unexpected writing during script execution. -; Useful for internal debugging only. -;opcache.protect_memory=0 - -; Allows calling OPcache API functions only from PHP scripts which path is -; started from specified string. The default "" means no restriction -;opcache.restrict_api= - -; Mapping base of shared memory segments (for Windows only). All the PHP -; processes have to map shared memory into the same address space. This -; directive allows to manually fix the "Unable to reattach to base address" -; errors. -;opcache.mmap_base= - -; Facilitates multiple OPcache instances per user (for Windows only). All PHP -; processes with the same cache ID and user share an OPcache instance. -;opcache.cache_id= - -; Enables and sets the second level cache directory. -; It should improve performance when SHM memory is full, at server restart or -; SHM reset. The default "" disables file based caching. -;opcache.file_cache= - -; Enables or disables opcode caching in shared memory. -;opcache.file_cache_only=0 - -; Enables or disables checksum validation when script loaded from file cache. -;opcache.file_cache_consistency_checks=1 - -; Implies opcache.file_cache_only=1 for a certain process that failed to -; reattach to the shared memory (for Windows only). Explicitly enabled file -; cache is required. -;opcache.file_cache_fallback=1 - -; Enables or disables copying of PHP code (text segment) into HUGE PAGES. -; This should improve performance, but requires appropriate OS configuration. -;opcache.huge_code_pages=1 - -; Validate cached file permissions. -;opcache.validate_permission=0 - -; Prevent name collisions in chroot'ed environment. -;opcache.validate_root=0 - -; If specified, it produces opcode dumps for debugging different stages of -; optimizations. -;opcache.opt_debug_level=0 - -; Specifies a PHP script that is going to be compiled and executed at server -; start-up. -; http://php.net/opcache.preload -;opcache.preload= - -; Preloading code as root is not allowed for security reasons. This directive -; facilitates to let the preloading to be run as another user. -; http://php.net/opcache.preload_user -;opcache.preload_user= - -; Prevents caching files that are less than this number of seconds old. It -; protects from caching of incompletely updated files. In case all file updates -; on your site are atomic, you may increase performance by setting it to "0". -;opcache.file_update_protection=2 - -; Absolute path used to store shared lockfiles (for *nix only). -;opcache.lockfile_path=/tmp - -[curl] -; A default value for the CURLOPT_CAINFO option. This is required to be an -; absolute path. -;curl.cainfo = - -[openssl] -; The location of a Certificate Authority (CA) file on the local filesystem -; to use when verifying the identity of SSL/TLS peers. Most users should -; not specify a value for this directive as PHP will attempt to use the -; OS-managed cert stores in its absence. If specified, this value may still -; be overridden on a per-stream basis via the "cafile" SSL stream context -; option. -;openssl.cafile= - -; If openssl.cafile is not specified or if the CA file is not found, the -; directory pointed to by openssl.capath is searched for a suitable -; certificate. This value must be a correctly hashed certificate directory. -; Most users should not specify a value for this directive as PHP will -; attempt to use the OS-managed cert stores in its absence. If specified, -; this value may still be overridden on a per-stream basis via the "capath" -; SSL stream context option. -;openssl.capath= - -[ffi] -; FFI API restriction. Possible values: -; "preload" - enabled in CLI scripts and preloaded files (default) -; "false" - always disabled -; "true" - always enabled -;ffi.enable=preload - -; List of headers files to preload, wildcard patterns allowed. -;ffi.preload= diff --git a/openQRM-5.3.50-CE/src/etc/init.d/openqrm b/openQRM-5.3.50-CE/src/etc/init.d/openqrm deleted file mode 100644 index 13229b6..0000000 --- a/openQRM-5.3.50-CE/src/etc/init.d/openqrm +++ /dev/null @@ -1,661 +0,0 @@ -#!/bin/bash -# openqrm-server openQRM-server init script -# -# chkconfig: 2345 98 24 -# description: openQRM is the next generation Linux Data Center management - -# support for LSB init script -### BEGIN INIT INFO -# Provides: openqrm -# Required-Start: $local_fs $network $remote_fs -# Required-Stop: $local_fs $network $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: openQRM-Server init script -# Description: openQRM-Server init script -### END INIT INFO - -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export LANG=C -PATH=/usr/bin:/sbin:/bin:/usr/sbin:$PATH -export PATH -LOCKFILE=/var/lock/subsys/openqrm -mkdir -p $(dirname $LOCKFILE) -# a new line for sed -NEWLINE=' -' - -# unset http_proxy environment -unset http_proxy -unset https_proxy - - -# find the openqrm-server-base-dir -readlink() { - local path=$1 ll - if [ -L "$path" ]; then - ll="$(LC_ALL=C ls -l "$path" 2> /dev/null)" && - echo "${ll/* -> }" - else - return 1 - fi -} - -SCRIPT=$0 -while [ -L "$SCRIPT" ]; do - SRC=$(readlink $SCRIPT) - if [ "${SRC:0:1}" != "/" ]; then - SRC=$(dirname $SCRIPT)/$SRC - fi - SCRIPT=$SRC -done -export OPENQRM_SERVER_BASE_DIR=`pushd \`dirname $SCRIPT\`/../../../ 1>/dev/null && pwd && popd 1>/dev/null` - -# get the openqrm-server configuration + functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/$OPENQRM_DATABASE_TYPE/openqrm-$OPENQRM_DATABASE_TYPE-functions - -# 64bit ? -if ((1 == 1<<32)); then - echo "ERROR: openQRM requires a 64bit operating system!!" - exit 1 -fi - - -# functions - -function stop_exec_subsystem_force() { - kill `ps ax | grep dropbear | grep -v grep | grep openqrm | awk {' print $1 '}` 2>/dev/null || true - kill `ps ax | grep openqrm-cmd-queue | grep -v grep | awk {' print $1 '}` 2>/dev/null || true - kill `ps ax | grep openqrm-rabbitmq-cmd-queue | grep -v grep | awk {' print $1 '}` 2>/dev/null || true - kill `ps ax | grep openqrm-monitord | grep -v grep | awk {' print $1 '}` 2>/dev/null || true - return 0 -} - - - -function openqrm_server_init() { - - echo "First startup detected. Running initialization." - # make sure to have all enabled plugins stopped and uninstalled - if [ -d $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/ ]; then - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN stop - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN - fi - done - fi - - # do some extra checks for redhat/centos regarding selinux + firewall - if [ -f /etc/redhat-release ]; then - # selinux disabled ? - if selinuxenabled; then - echo "ERROR: Found SELinux enabled!" - echo "ERROR: Please set SELINUX=disabled in /etc/selinux/config and reboot!" - exit 1 - fi - # iptables ? - if which iptables 1>/dev/null; then - if iptables -L | grep REJECT 1>/dev/null; then - echo "NOTICE: Found iptables firewall enabled!" - echo "NOTICE: An active firewall may cause troubles during the initialization!" - echo "NOTICE: openQRM at least needs access to the following ports : 80, 443, $OPENQRM_EXEC_PORT" - echo - echo "NOTICE: Press 'c' to continue with the current iptables firewall configuration" - echo "NOTICE: Press 's' to stop the iptables firewall for the initialization" - while (:); do - read -n1 IPTABLES - if [ "$IPTABLES" == "c" ]; then - break - fi - if [ "$IPTABLES" == "s" ]; then - break - fi - done - if [ "$IPTABLES" == "c" ]; then - echo "... continuing with the current iptables firewall configuration" - elif [ "$IPTABLES" == "s" ]; then - echo "NOTICE: Stopping the iptables firewall" - if [ -x /etc/init.d/iptables ]; then - /etc/init.d/iptables stop - else - iptables --flush - fi - else - echo "ERROR: No such option!" - exit 1 - fi - - - fi - fi - fi - - # link the web application directory to the documentroot - HTPASSWD="htpasswd" - echo -n " Creating custom apache config.." - if [ -f /etc/debian_version ]; then - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/web/ $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm - # the default apache config normally does not allow to override the authconfig (needed for basic auth) - # so we allow it for the openqrm directory - APACHE_CUSTOM_CONFIG_DIR="/etc/apache2/conf.d" - # support for Ubuntu 14.04 - new apache enabled-conf dir - if [ -d /etc/apache2/conf-enabled ]; then - APACHE_CUSTOM_CONFIG_DIR="/etc/apache2/conf-enabled" - # preserve backwards compatibility for other projects e.g. linuxcoe - ln -sf /etc/apache2/conf-enabled /etc/apache2/conf.d - cat $OPENQRM_SERVER_BASE_DIR/openqrm/etc/httpd/openqrm-httpd-vhost.conf | \ - sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | \ - sed -e "s#@@OPENQRM_WEBSERVER_DOCUMENT_ROOT@@#$OPENQRM_WEBSERVER_DOCUMENT_ROOT#g" \ - > $APACHE_CUSTOM_CONFIG_DIR/openqrm-httpd.conf - else - cat $OPENQRM_SERVER_BASE_DIR/openqrm/etc/httpd/openqrm-httpd.conf | sed -e "s#OPENQRM_WEBSERVER_DOCUMENT_ROOT#$OPENQRM_WEBSERVER_DOCUMENT_ROOT#g" >> $APACHE_CUSTOM_CONFIG_DIR/openqrm-httpd.conf - fi - echo ".$APACHE_CUSTOM_CONFIG_DIR/openqrm-httpd.conf" - # care about php disable_functions in php.ini - if [ -f /etc/php5/apache2/php.ini ]; then - sed -i -e "s/^disable_functions/;disable_functions/g" /etc/php5/apache2/php.ini - fi - elif [ -f /etc/redhat-release ]; then - APACHE_CUSTOM_CONFIG_DIR="/etc/httpd/conf.d" - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/web/ $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm - cat $OPENQRM_SERVER_BASE_DIR/openqrm/etc/httpd/openqrm-httpd.conf | sed -e "s#OPENQRM_WEBSERVER_DOCUMENT_ROOT#$OPENQRM_WEBSERVER_DOCUMENT_ROOT#g" >> $APACHE_CUSTOM_CONFIG_DIR/openqrm-httpd.conf - echo ".$APACHE_CUSTOM_CONFIG_DIR/openqrm-httpd.conf" - elif [ -f /etc/SuSE-release ]; then - APACHE_CUSTOM_CONFIG_DIR="/etc/apache2/conf.d" - HTPASSWD="htpasswd2" - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/web/ $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm - cat $OPENQRM_SERVER_BASE_DIR/openqrm/etc/httpd/openqrm-httpd.conf | sed -e "s#OPENQRM_WEBSERVER_DOCUMENT_ROOT#$OPENQRM_WEBSERVER_DOCUMENT_ROOT#g" >> $APACHE_CUSTOM_CONFIG_DIR/openqrm-httpd.conf - echo ".$APACHE_CUSTOM_CONFIG_DIR/openqrm-httpd.conf" - # we need a special treatment for suse to allow followsymlinks in the default-setup - DEFAULT_CONF=/etc/apache2/default-server.conf - NEW_CONF=/etc/apache2/default-server.conf.new - if [ -f $DEFAULT_CONF ]; then - if grep Options $DEFAULT_CONF | grep -v "#" | head -n1 | grep None 1>/dev/null; then - echo "Need to allow FollowSymLinks in default-server.conf" - OLD_IFS=$IFS - IFS=$NEWLINE - for LINE in `cat $DEFAULT_CONF`; do - if echo $LINE | grep -v '#' | grep Options | grep None 1>/dev/null; then - echo " Options FollowSymLinks" >> $NEW_CONF - else - echo $LINE >> $NEW_CONF - fi - done - IFS=$OLD_IFS - cp -f $DEFAULT_CONF $DEFAULT_CONF.org - mv -f $NEW_CONF $DEFAULT_CONF - fi - fi - fi - - # ssl ? - echo -n " Checking $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf for OPENQRM_WEB_PROTOCOL=https.." - if [ "$OPENQRM_WEB_PROTOCOL" == "https" ]; then - echo ".yes." - echo " Setting up SSL secured openQRM website." - # apache ssl setup, on centos it is enabled by default - if [ -f /etc/debian_version ]; then - if ! a2enmod ssl; then - echo "ERROR: Could not enable SSL in the Apache webserver ! Exiting." - return 1 - fi - fi - - # check for hostname settings - ETCHOSTS=/etc/hosts - MYHOSTNAME=`hostname` - - if grep $MYHOSTNAME $ETCHOSTS | grep 127.0. 1>/dev/null || ! grep $MYHOSTNAME $ETCHOSTS 1>/dev/null; then - echo " Found system hostname $MYHOSTNAME connected to loopback (127.0) interface" - echo " [WARNING] This could cause problems when enabling SSL on the apache webserver." - -## AVAIL_IPS=`ifconfig -a | grep -v inet6 | grep -B1 inet | grep -i -A1 link | grep -v lo | grep inet | grep -v 127.0.0.1 | cut -d':' -f2 | awk {' print $1 '}` -# AVAIL_IPS=`ifconfig -a | grep -v inet6 | grep -B1 inet | grep -i -A1 UP | grep -v lo | grep inet | grep -v 127.0.0.1 | cut -d':' -f2 | awk {' print $2 '}` - AVAIL_IPS=`ip -4 addr | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v 127.0.0.1` - - while (true); do - echo - echo " Please type one of the following ip addresses to be connected to this" - echo " hostname: $MYHOSTNAME in $ETCHOSTS (Your current hosts file will be backed up):" - echo "$AVAIL_IPS" - echo -n "> " - read HOSTIP - if openqrm_validate_ip "$HOSTIP"; then - if echo $AVAIL_IPS | grep "$HOSTIP" 1>/dev/null; then - break; - else - echo "$HOSTIP is not available on this system!" - fi - else - echo "$HOSTIP is invalid!" - fi - done - echo " Connecting $HOSTIP to $MYHOSTNAME in $ETCHOSTS (we made a backup $ETCHOSTS.openqrm.bak).." - # remove first - sed -i -e "s/.*$MYHOSTNAME.*//g" $ETCHOSTS - sed -i -e "s/.*openQRM.*//g" $ETCHOSTS - # make sure we did not remove the loopback entry copmletely - if ! grep "127.0.*.localhost" $ETCHOSTS 1>/dev/null; then - echo "127.0.0.1 localhost" >> $ETCHOSTS.new - cat $ETCHOSTS >> $ETCHOSTS.new - cp -f $ETCHOSTS $ETCHOSTS.openqrm.bak - mv -f $ETCHOSTS.new $ETCHOSTS - fi - echo "# added by openQRM" >> $ETCHOSTS - echo "$HOSTIP $MYHOSTNAME" >> $ETCHOSTS - fi - - # creating the cert + key - PRIVATE_KEY=$OPENQRM_SERVER_BASE_DIR/openqrm/etc/ssl/private/openqrm-private.key - CERTIFICATE_FILE=$OPENQRM_SERVER_BASE_DIR/openqrm/etc/ssl/cert/openqrm.crt - CHAIN_FILE=$OPENQRM_SERVER_BASE_DIR/openqrm/etc/ssl/chain/openqrm.csr - VALID_DAYS=3650 - mkdir -p `dirname $PRIVATE_KEY` - mkdir -p `dirname $CERTIFICATE_FILE` - mkdir -p `dirname $CHAIN_FILE` - rm -f $PRIVATE_KEY $CERTIFICATE_FILE $CHAIN_FILE - - sleep 2 - clear - echo - echo "########## Creating new private/public-keys for server $MYHOSTNAME ##########" - echo - echo " -> please go on with the defaults!" - echo " -> for 'Common Name' please use $MYHOSTNAME" - echo " -> please provide an empty password!" - echo - echo "#############################################################################" - sleep 4 - echo - openssl genrsa -des3 -passout pass:xXxXxX -out /tmp/server.pass.key 2048 - openssl rsa -passin pass:xXxXxX -in /tmp/server.pass.key -out $PRIVATE_KEY - rm -f /tmp/server.pass.key - openssl req -new -key $PRIVATE_KEY -out $CHAIN_FILE - openssl x509 -req -days 365 -in $CHAIN_FILE -signkey $PRIVATE_KEY -out $CERTIFICATE_FILE - - echo - echo -n " Creating custom apache ssl config.." - cat $OPENQRM_SERVER_BASE_DIR/openqrm/etc/httpd/openqrm-https.conf | \ - sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | \ - sed -e "s#@@OPENQRM_WEBSERVER_DOCUMENT_ROOT@@#$OPENQRM_WEBSERVER_DOCUMENT_ROOT#g" \ - > $APACHE_CUSTOM_CONFIG_DIR/openqrm-https.conf - echo ".$APACHE_CUSTOM_CONFIG_DIR/openqrm-https.conf" - # check if to adjust the error log location - if [ -f /etc/redhat-release ]; then - sed -i -e "s/apache2/httpd/g" $APACHE_CUSTOM_CONFIG_DIR/openqrm-https.conf - fi - fi - - openqrm_webserver reload - - # create the .htaccess file - cat $OPENQRM_SERVER_BASE_DIR/openqrm/etc/httpd/openqrm-htaccess.conf | sed -e "s#OPENQRM_WEBSERVER_DOCUMENT_ROOT#$OPENQRM_WEBSERVER_DOCUMENT_ROOT#g" > $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/.htaccess - # create the default admin user - $HTPASSWD -bc $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/.htpasswd openqrm openqrm - chmod 666 $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/.htpasswd - - # create the image-auth and upload dir - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/web/action/image-auth - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/web/action/image-auth - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/tmp - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/tmp - - # link the tftpboot/boot dir to the boot-services - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/boot - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/ $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/boot - - # init the remote execution layer - case "$OPENQRM_EXECUTION_LAYER" in - dropbear) - # init the openQRM exec-mechanism via dropbear - echo " Initializing dropbear..." - # on debian and ubuntu, lets make sure it is not started as a service due to our install - if test -e /etc/default/dropbear; then - if grep '^NO_START=0' /etc/default/dropbear 1>/dev/null|| ! grep 'NO_START' /etc/default/dropbear 1>/dev/null; then - # looks like it has been set to start by default; let's revert that - /etc/init.d/dropbear stop - sed -i -e "s/^NO_START=0/NO_START=1/g" /etc/default/dropbear - # just in case it was never there in the first place - echo "NO_START=1" >> /etc/default/dropbear - fi - fi - # prepare dropbear config - /bin/rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/ - if ! dropbearkey -t rsa -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/dropbear_rsa_host_key; then - echo "ERROR: Could not create host key with dropbearkey. Please check to have dropbear installed correctly!" - return 1 - fi - # allow the webserver user to read it - chmod 600 $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/dropbear_rsa_host_key - - # create authorized_keys - PUBLIC_KEY=`dropbearkey -y -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/dropbear_rsa_host_key | grep ssh` - if [ ! -d /root/.ssh ]; then - mkdir /root/.ssh - chmod 700 /root/.ssh - fi - echo " Adding public key to /root/.ssh/authorized_keys..." - echo - if [ ! -f /root/.ssh/authorized_keys ]; then - echo "$PUBLIC_KEY" > /root/.ssh/authorized_keys - chmod 600 /root/.ssh/authorized_keys - else - OPENQRM_HOST=`echo $PUBLIC_KEY | awk {' print $3 '}` - if grep $OPENQRM_HOST /root/.ssh/authorized_keys 1>/dev/null; then - sed -i -e "s#.*$OPENQRM_HOST.*##g" /root/.ssh/authorized_keys - fi - echo "$PUBLIC_KEY" >> /root/.ssh/authorized_keys - chmod 600 /root/.ssh/authorized_keys - fi - # and put it in the boot-service dir for the resources to download - echo "$PUBLIC_KEY" > $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/openqrm-server-public-rsa-key - # create the command-queue dir - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/var/spool/ $OPENQRM_SERVER_BASE_DIR/openqrm/var/lock/ - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/var/spool $OPENQRM_SERVER_BASE_DIR/openqrm/var/lock/ - ;; - - rabbitmq) - echo "- Initializing RabbitMQ as command execution mechanism" - ;; - *) - echo "ERROR: Un-supported command execution layer $openqrm_execution_layer ! Exiting." - return 1 - ;; - esac - - # here we start the init - # add automatic startup - openqrm_chkconfig add openqrm - - # create unconfigured file containing a list of available network cards to setup openQRM on - ip a s | grep ^[0-9] | cut -d':' -f2 | awk '{ print $1 }' | grep -v lo > $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/unconfigured - - # use the first nic to preconfigure the openqrm-server.conf - FIRST_NIC=`ip a s | grep ^[0-9] | cut -d':' -f2 | awk '{ print $1 }' | grep -v lo | head -n 1` - if [ "$FIRST_NIC" != "" ]; then - sed -i -e "s/OPENQRM_SERVER_INTERFACE=.*/OPENQRM_SERVER_INTERFACE=$FIRST_NIC/g" $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - fi - -} - - - -function openqrm_server_uninstall() { - - echo "Uninstalling openQRM-server ver. $OPENQRM_SERVER_VERSION." - # backup state - chmod +x $OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/$OPENQRM_DATABASE_TYPE/openqrm-$OPENQRM_DATABASE_TYPE-functions - openqrm_server_state backup uninstall - - # stop first - openqrm_server_stop - - # drop db - $OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/$OPENQRM_DATABASE_TYPE/openqrm-$OPENQRM_DATABASE_TYPE-functions drop - - # remove automatic startup - openqrm_chkconfig del openqrm - rm -f /etc/init.d/openqrm - - # removing the apache web + config - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm - if [ -f /etc/debian_version ]; then - rm -f /etc/apache2/conf.d/openqrm-httpd.conf - rm -f /etc/apache2/conf.d/openqrm-https.conf - elif [ -f /etc/redhat-release ]; then - rm -f /etc/httpd/conf.d/openqrm-httpd.conf - rm -f /etc/httpd/conf.d/openqrm-https.conf - elif [ -f /etc/SuSE-release ]; then - rm -f /etc/apache2/conf.d/openqrm-httpd.conf - rm -f /etc/apache2/conf.d/openqrm-https.conf - fi - openqrm_webserver reload - - # remove default file to re-init at next startup - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/default - - case "$OPENQRM_EXECUTION_LAYER" in - dropbear) - # remove dropbear key - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/var - ;; - esac - echo "Uninstallation of openQRM-server finished." -} - - -function openqrm_server_start() { - - if [ -f ${LOCKFILE} ]; then - echo "openQRM-server ver. $OPENQRM_SERVER_VERSION is already running." - return 1 - fi - if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" - else - RUNSCREEN=`which screen` - fi - # make sure apache is up - if [ -f /etc/debian_version ]; then - if ! ps ax | grep apache2 | grep -v grep 1>/dev/null; then - openqrm_webserver start - fi - elif [ -f /etc/redhat-release ]; then - if ! ps ax | grep httpd | grep -v grep 1>/dev/null; then - openqrm_webserver start - openqrm_chkconfig add httpd - fi - if ! ps ax | grep mysqld | grep -v grep 1>/dev/null; then - if [ -f /etc/centos-release ]; then - service mysql start - service mariadb start - systemctl enable mysql - systemctl enable httpd - else - # make sure the db is up - /etc/init.d/mysqld start - openqrm_chkconfig add mysqld - fi - fi - elif [ -f /etc/SuSE-release ]; then - if ! ps ax | grep apache | grep -v grep 1>/dev/null; then - openqrm_webserver start - fi - fi - - # check if we are at first-startup, if yes do initialization - if [ ! -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/default ]; then - openqrm_server_init - fi - echo "Starting the openQRM-server ver. $OPENQRM_SERVER_VERSION." - - # start the execution layer - stop_exec_subsystem_force - case "$OPENQRM_EXECUTION_LAYER" in - dropbear) - # start the openqrm-execd daemon - if ! dropbear -p $OPENQRM_EXEC_PORT -r $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/dropbear_rsa_host_key; then - echo "ERROR: Could not start the dropbear server. Please check to have dropbear installed correctly!" - return 1 - fi - # start the openqrm-cmd-queue - $RUNSCREEN -dmS cmdqueue $OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-cmd-queue - ;; - rabbitmq) - echo "- Using RabbitMQ as command execution mechanism" - if [ "$OPENQRM_RABBITMQ_PASSWORD" == "" ]; then - echo "ERROR: OPENQRM_RABBITMQ_PASSWORD not set in $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf!" - return 1 - fi - openqrm_server_get_config - export RABBITMQ_SERVER="$OPENQRM_SERVER_IP_ADDRESS" - export RABBITMQ_PASSWORD="$OPENQRM_RABBITMQ_PASSWORD" - export RABBITMQ_QUEUE_NAME="$OPENQRM_SERVER_IP_ADDRESS" - $RUNSCREEN -dmS cmdqueue $OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-rabbitmq-cmd-queue - ;; - *) - echo "ERROR: Un-supported command execution layer $openqrm_execution_layer ! Exiting." - return 1 - ;; - esac - touch ${LOCKFILE} - - if [ -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/unconfigured ]; then - echo - if [ "$OPENQRM_SERVER_IP_ADDRESS" != "" ]; then - echo "Initialization complete. Please configure your openQRM Server at: $OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/" - else - echo "Initialization complete. Please configure your openQRM Server at: $OPENQRM_WEB_PROTOCOL://[server-ip-address]/openqrm/" - fi - echo "-> User: openqrm -> Password: openqrm" - echo - sleep 2 - else - # check openqrm-interface - if ! ifconfig | grep ^"$OPENQRM_SERVER_INTERFACE" 1>/dev/null; then - ifup "$OPENQRM_SERVER_INTERFACE" - sleep 2 - fi - ifconfig "$OPENQRM_SERVER_INTERFACE" | grep inet 1>/dev/null 2>&1 || \ - { echo "Interface $OPENQRM_SERVER_INTERFACE is down. Please configure and activate it and try again"; return 1; } - - CONFIGURED_IP=$(cat $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/default | grep "openqrm=" | sed -e "s/.*openqrm=//" | awk {' print $1 '}) - OPENQRM_SERVER_IP_ADDRESS=`ip a s $OPENQRM_SERVER_INTERFACE | grep -w $OPENQRM_SERVER_INTERFACE$ | grep -w inet | awk '{ print $2 }' | cut -d'/' -f1` - - if [ "$OPENQRM_SERVER_IP_ADDRESS" != "$CONFIGURED_IP" ]; then - echo "$OPENQRM_SERVER_IP_ADDRESS != $CONFIGURED_IP" > /tmp/lll-ip-check - echo -e "Interface $OPENQRM_SERVER_INTERFACE has the wrong ip-configuration.\n" \ - " The openQRM-server is configured to have the ip-address $CONFIGURED_IP\n" \ - " but the interface $OPENQRM_SERVER_INTERFACE is running with the ip-address $OPENQRM_SERVER_IP_ADDRESS" - - # create lockfile again to forcre re-configuration - ip a s | grep ^[0-9] | cut -d':' -f2 | awk '{ print $1 }' | grep -v lo > $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/unconfigured - echo - if [ "$OPENQRM_SERVER_IP_ADDRESS" != "" ]; then - echo "Please re-configure your openQRM Server at : http://$OPENQRM_SERVER_IP_ADDRESS/openqrm/" - else - echo "Please re-configure your openQRM Server at : http://[server-ip-address]/openqrm/" - fi - echo - sleep 2 - return 1 - fi - - # and the monitoring infra-structure - $RUNSCREEN -dmS monitord $OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-monitord - # start all enabled plugins - echo "Starting enabled openQRM-server plugins..." - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - # make sure they are stopped before - if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.running ]; then - if [ -x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN stop 1>/dev/null 2>/dev/null - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.openqrm_stopped - fi - fi - if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.openqrm_stopped ]; then - if [ -x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN start - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.openqrm_stopped - fi - fi - done - fi - -} - - -function openqrm_server_stop() { - - if [ ! -f ${LOCKFILE} ]; then - echo "openQRM-server ver. $OPENQRM_SERVER_VERSION is not running." - else - # stop all enabled plugins - echo "Stopping enabled openQRM-server plugins..." - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.running ]; then - if [ -x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/init.d/openqrm-plugin-$OPENQRM_PLUGIN stop - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/$OPENQRM_PLUGIN/.openqrm_stopped - fi - fi - done - echo "Stopping the openQRM-server ver. $OPENQRM_SERVER_VERSION." - stop_exec_subsystem_force - /bin/rm -f ${LOCKFILE} - fi -} - - -function openqrm_server_status() { - if [ -f ${LOCKFILE} ]; then - echo "openQRM-server ver. $OPENQRM_SERVER_VERSION is running." - exit 0 - else - echo "openQRM-server ver. $OPENQRM_SERVER_VERSION is not running." - exit 3 - fi -} - - -# main -ADDITIONAL_PARAM=$2 -case "$1" in - start) - openqrm_server_start - ;; - stop) - openqrm_server_stop - ;; - status) - openqrm_server_status - ;; - restart) - openqrm_server_stop - sleep 1 - openqrm_server_start - ;; - reload) - openqrm_server_stop - sleep 1 - openqrm_server_start - ;; - force-reload) - openqrm_server_stop - sleep 1 - openqrm_server_start - ;; - init) - openqrm_server_init - ;; - uninstall) - openqrm_server_uninstall - ;; - *) - echo "Usage: $0 {start|stop|status|restart|reload|force-reload|init|uninstall}" - exit 1 - -esac - - - diff --git a/openQRM-5.3.50-CE/src/etc/init.d/openqrm-client b/openQRM-5.3.50-CE/src/etc/init.d/openqrm-client deleted file mode 100644 index 23e3f81..0000000 --- a/openQRM-5.3.50-CE/src/etc/init.d/openqrm-client +++ /dev/null @@ -1,385 +0,0 @@ -#!/bin/bash -# openqrm-client openQRM init script for the managed resources -# -# chkconfig: 2345 98 19 -# description: openQRM is the next generation Linux Data Center management - -# support for LSB init scripts -### BEGIN INIT INFO -# Provides: openqrm-client -# Required-Start: $all -# Required-Stop: $all -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: openQRM init script for the managed resources -# Description: openQRM init script for the managed resources -### END INIT INFO - -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export LANG=C -PATH=/usr/bin:/sbin:/bin:/usr/sbin -export PATH -LOCKFILE=/var/lock/subsys/openqrm -mkdir -p $(dirname $LOCKFILE) - -export `eval cat /proc/cmdline` 2>/dev/null -. /var/openqrm/openqrm-resource.conf -# make sure to have a valid backup of the parameters, at least including the openQRM server ip -if [ ! -f /var/openqrm/openqrm-resource.conf.last ]; then - /bin/cp -f /var/openqrm/openqrm-resource.conf /var/openqrm/openqrm-resource.conf.last -fi -if [ "$resource_mac" == "" ]; then - /bin/cp -f /var/openqrm/openqrm-resource.conf.last /var/openqrm/openqrm-resource.conf - . /var/openqrm/openqrm-resource.conf -fi -export OPENQRM_SERVER_BASE_DIR=$resource_basedir -export OPENQRM_SOURCE_DIR=$resource_basedir/openqrm -. $resource_basedir/openqrm/include/openqrm-functions -. $resource_basedir/openqrm/include/openqrm-package-functions - - -# define max-start-retries -MAX_START_RETRY=120 - -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET="wget -q --no-check-certificate" -else - WGET="wget -q" -fi - -# gets/starts/stops enabled boot-services for the resources -function openqrm_boot_service() { - local BOOT_SERVICE=$1 - local BOOT_SERVICE_CMD=$2 - local CURRENT=`pwd` - - # get + install the package during start - if [ "$BOOT_SERVICE_CMD" == "start" ]; then - echo "Getting boot-service package $BOOT_SERVICE" - mkdir -p $resource_basedir/openqrm/plugins/$BOOT_SERVICE - cd $resource_basedir/openqrm/plugins/$BOOT_SERVICE - if ! $WGET $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/boot-service-$BOOT_SERVICE.tgz; then - echo "ERROR: Could not get boot-service package for boot-service $BOOT_SERVICE !" - return 1 - fi - tar -xzf boot-service-$BOOT_SERVICE.tgz - rm -f boot-service-$BOOT_SERVICE.tgz - # get optional custom appliance config - if [ "$appliance_name" != "" ]; then - if [ ! -d $resource_basedir/openqrm/plugins/$BOOT_SERVICE/etc/ ]; then - mkdir -p $resource_basedir/openqrm/plugins/$BOOT_SERVICE/etc/ - fi - if $WGET -O $resource_basedir/openqrm/plugins/$BOOT_SERVICE/etc/openqrm-plugin-$BOOT_SERVICE.conf.$appliance_name.conf $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/plugins/$BOOT_SERVICE/openqrm-plugin-$BOOT_SERVICE.$appliance_name.conf; then - echo "- applying custom $BOOT_SERVICE boot-service configuration for appliance $appliance_name" - /bin/cp -f $resource_basedir/openqrm/plugins/$BOOT_SERVICE/etc/openqrm-plugin-$BOOT_SERVICE.conf $resource_basedir/openqrm/plugins/$BOOT_SERVICE/etc/openqrm-plugin-$BOOT_SERVICE.conf.default - /bin/cp -f $resource_basedir/openqrm/plugins/$BOOT_SERVICE/etc/openqrm-plugin-$BOOT_SERVICE.conf.$appliance_name.conf $resource_basedir/openqrm/plugins/$BOOT_SERVICE/etc/openqrm-plugin-$BOOT_SERVICE.conf - fi - fi - fi - # run the boot-service cmd - BOOT_SERVICE_INIT="$resource_basedir/openqrm/plugins/$BOOT_SERVICE/etc/init.d/$BOOT_SERVICE" - if [ -x $BOOT_SERVICE_INIT ]; then - echo "Running $BOOT_SERVICE_CMD on boot-service $BOOT_SERVICE" - $BOOT_SERVICE_INIT $BOOT_SERVICE_CMD - fi - cd $CURRENT -} - - - - - -function openqrm_client_start() { - - echo "Starting openQRM-client" - openqrm_client_stop 1>/dev/null 2>&1 - START_RETRY=0 - LOOP_CONNECT=0 - MAX_CONNECT=10 - - # checks - umount /initrd/lib/modules 1>/dev/null 2>&1 - umount /initrd/boot 1>/dev/null 2>&1 - umount /initrd/ 1>/dev/null 2>&1 - - grep -q "/initrd" /proc/mounts && umount /initrd - - chmod 666 /dev/null - - if [ ! -e /dev/tty ]; then - cd /dev - mknod tty c 5 0 - cd - fi - - # network up ? - echo "NOTICE: Checking connection to openQRM server at $resource_openqrmserver" - while ! $WGET -q -t 1 -T 4 -O /dev/null "$openqrm_web_protocol://$resource_openqrmserver/openqrm/action/resource-monitor.php"; do - echo -n "." - sleep 2 - LOOP_CONNECT=$(( LOOP_CONNECT + 1 )) - if [ "$LOOP_CONNECT" == "$MAX_CONNECT" ]; then - echo "WARNING: Could not connect to openQRM server at $resource_openqrmserver! Trying to continue ..." - break - fi - done - - # check if we have resource_mac, if not try to find the right interface integrated in openQRM - if ip a s | grep "link/ether" | awk '{ print $2 }' | cut -d'/' -f1 | grep -i $resource_mac &>/dev/null; then - # if not in the initrd try to refresh the resource parameters - if [ ! -f /etc/initrd-devices.conf ]; then - if ! $WGET -q -t 1 -T 4 -O /var/openqrm/openqrm-resource.conf "$openqrm_web_protocol://$resource_openqrmserver/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_mac=$resource_mac"; then - # restore - /bin/cp -f /var/openqrm/openqrm-resource.conf.last /var/openqrm/openqrm-resource.conf - echo "NOTICE: Could not refresh resource-parameters. Using previous one." - else - . /var/openqrm/openqrm-resource.conf - fi - fi - else - # here we do not found the resource_mac on one of the systems network cards - # assuming auto-install or clone to local-disk - /bin/cp -f /var/openqrm/openqrm-resource.conf /var/openqrm/openqrm-resource.conf.previous_res - for RESOURCE_MAC in `ip a s | grep "link/ether" | awk '{ print $2 }' | cut -d'/' -f1`; do - echo "NOTICE: Refreshing resource-parameters. Trying $RESOURCE_MAC." - if $WGET -q -t 1 -T 4 -O /var/openqrm/openqrm-resource.conf "$openqrm_web_protocol://$resource_openqrmserver/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_mac=$RESOURCE_MAC"; then - if grep -i $RESOURCE_MAC /var/openqrm/openqrm-resource.conf &>/dev/null; then - . /var/openqrm/openqrm-resource.conf - break - fi - fi - done - fi - - # do some extra checks for redhat/centos regarding firewall - if [ -f /etc/redhat-release ]; then - # iptables ? - if which iptables 1>/dev/null; then - if iptables -L | grep REJECT 1>/dev/null; then - echo "NOTICE: Found iptables firewall enabled!" - echo "NOTICE: Inserting rule to allow access to the openQRM management port $resource_execdport" - iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport $resource_execdport -j ACCEPT - fi - fi - fi - - case "$openqrm_execution_layer" in - dropbear) - # install and use the distro dropbear package - DROPBEAR=`which dropbear` - if test -z $DROPBEAR; then - FORCE_INSTALL=true openqrm_install_os_dependency dropbear - # on debian and ubuntu, lets make sure it is not started as a service due to our install - if test -e /etc/default/dropbear; then - if grep '^NO_START=0' /etc/default/dropbear 1>/dev/null|| ! grep 'NO_START' /etc/default/dropbear 1>/dev/null; then - # looks like it has been set to start by default; let's revert that - /etc/init.d/dropbear stop - sed -i -e "s/^NO_START=0/NO_START=1/g" /etc/default/dropbear - # just in case it was never there in the first place - echo "NO_START=1" >> /etc/default/dropbear - fi - fi - fi - # start dropbear as openqrm-execd - /bin/rm -rf $resource_basedir/openqrm/etc/dropbear - mkdir -p $resource_basedir/openqrm/etc/dropbear/ - if ! dropbearkey -t rsa -f $resource_basedir/openqrm/etc/dropbear/dropbear_rsa_host_key; then - echo "ERROR: Could not create host key with dropbearkey. Please check to have dropbear installed correctly!" - return 1 - fi - # get the public key of the openQRM server - while (true); do - if ! $WGET $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/openqrm-server-public-rsa-key; then - if [ "$START_RETRY" == "$MAX_START_RETRY" ]; then - echo "ERROR: Could not get the public key of the openQRM-server at $resource_openqrmserver ! Please check the certificates !" - return 1 - fi - START_RETRY=$(( START_RETRY + 1 )) - sleep 1 - else - break - fi - done - if [ ! -d /root/.ssh ]; then - mkdir -p /root/.ssh - chmod 700 /root/.ssh - fi - if [ ! -f /root/.ssh/authorized_keys ]; then - mv -f openqrm-server-public-rsa-key /root/.ssh/authorized_keys - chmod 600 /root/.ssh/authorized_keys - else - OPENQRM_HOST=`cat openqrm-server-public-rsa-key | awk {' print $3 '}` - if grep $OPENQRM_HOST /root/.ssh/authorized_keys 1>/dev/null; then - sed -i -e "s#.*$OPENQRM_HOST.*##g" /root/.ssh/authorized_keys - fi - cat openqrm-server-public-rsa-key >> /root/.ssh/authorized_keys - rm -f openqrm-server-public-rsa-key - chmod 600 /root/.ssh/authorized_keys - fi - # start dropbear - killall dropbear 1>/dev/null 2>&1 - for OPENQRM_PID in `ps ax 2>/dev/null | grep dropbear | grep -v grep | awk {' print $1 '}`; do - kill $OPENQRM_PID - done - dropbear -p $resource_execdport -r $resource_basedir/openqrm/etc/dropbear/dropbear_rsa_host_key - ;; - - - rabbitmq) - RUNSCREEN=`which screen` - if test -z $RUNSCREEN; then - FORCE_INSTALL=true openqrm_install_os_dependency screen - fi - if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" - else - RUNSCREEN=`which screen` - fi - echo "- installing python pip installer" - if ! openqrm_full_fill_os_dependency pip python3-pip; then - echo "ERROR: Failed to install python3-pip!" - exit 1 - fi - echo "- installing python pika" - if ! pip install pika==0.9.8; then - echo "ERROR: Failed to install python pika!" - exit 1 - fi - # export RABBITMQ_PASSWORD="$OPENQRM_PASSWORD" - eval $appliance_capabilities - export RABBITMQ_PASSWORD - export RABBITMQ_SERVER="$resource_openqrmserver" - export RABBITMQ_QUEUE_NAME="$resource_ip" - $RUNSCREEN -dmS cmdqueue $resource_basedir/openqrm/sbin/openqrm-rabbitmq-cmd-queue - ;; - - *) - echo "ERROR: Un-supported command execution layer $openqrm_execution_layer ! Exiting." - return 1 - ;; - esac - - # start openqrm-monitord - if [ ! -d /tmp ]; then mkdir -p /tmp; fi - nohup $resource_basedir/openqrm/sbin/openqrm-monitord 1>/tmp/openqrm-monitord.out 2>&1 & - rm -f /tmp/openqrm-monitord.out - - # allow to overwrite the resource-configuration e.g. for cluster-resources - if [ -f /var/openqrm/openqrm-resource.conf.static ]; then - cat /var/openqrm/openqrm-resource.conf.static >> /var/openqrm/openqrm-resource.conf - fi - - # set the image password - if not in the initrd - if [ ! -f /etc/initrd-devices.conf ]; then -# if $WGET -O /tmp/iauth.$image_id $openqrm_web_protocol://$resource_openqrmserver/openqrm/action/image-auth/iauth.$image_id.php 2>/tmp/iauth.log; then - if $WGET -O /tmp/iauth.$image_id $openqrm_web_protocol://$resource_openqrmserver/openqrm/action/image-auth/iauth.php?id=$image_id 2>/tmp/iauth.log; then - cryptedpassword=`cat /tmp/iauth.$image_id` - rm -f /tmp/iauth.$image_id /tmp/iauth.log - if [ "$cryptedpassword" != "" ]; then - sed -i "s#^root:[^:]*#root:$cryptedpassword#" /etc/shadow - sed -i "s#^root:[^:]*#root:$cryptedpassword#" /etc/shadow- - fi - fi - - # upate package manager, the boot-services may want to install additional os-deps, disabled for now - # openqrm_update_package_manager - # start boot-services from enabled plugins - for boot_service in $openqrm_boot_services; do - openqrm_boot_service $boot_service start - done - fi - - openqrm_post_event $resource_id "openqrm-client" 5 openqrm_client_start "Resource $resource_id fully started" - touch ${LOCKFILE} - -} - - -function openqrm_client_stop() { - echo "Stopping openQRM-client" - - if [ ! -f /linuxrc ]; then - # stop boot-services from enabled plugins - for boot_service in $openqrm_boot_services; do - openqrm_boot_service $boot_service stop - done - fi - # stop openqrm-execd - case "$openqrm_execution_layer" in - dropbear) - killall dropbear 1>/dev/null 2>&1 - for OPENQRM_PID in `ps ax 2>/dev/null | grep dropbear | grep -v grep | awk {' print $1 '}`; do - kill $OPENQRM_PID - done - ;; - rabbitmq) - kill `ps ax | grep openqrm-rabbitmq-cmd-queue | grep -v grep | awk {' print $1 '}` 2>/dev/null || true - ;; - *) - echo "ERROR: Un-supported command execution layer $openqrm_execution_layer ! Exiting." - return 1 - ;; - esac - killall openqrm-monitord 1>/dev/null 2>&1 - # in case we do not have killall (e.g. on debian-minimal install) be sure to stop the openqrm-agents anyway - for OPENQRM_PID in `ps ax 2>/dev/null | grep openqrm-monitord | grep -v grep | awk {' print $1 '}`; do - kill $OPENQRM_PID - done - - # remove firewall rule for exec port - if [ -f /etc/redhat-release ]; then - # iptables ? - if which iptables 1>/dev/null; then - if iptables -L | grep REJECT 1>/dev/null; then - iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport $resource_execdport -j ACCEPT 2>/dev/null - fi - fi - fi - /bin/rm -f ${LOCKFILE} -} - -function openqrm_client_status() { - if [ -f ${LOCKFILE} ]; then - echo "openQRM-client service is running" - else - echo "openQRM-client service is not running" - fi -} - - - -case "$1" in - start) - openqrm_client_start - ;; - stop) - openqrm_client_stop - ;; - status) - openqrm_client_status - ;; - restart) - openqrm_client_stop - openqrm_client_start - ;; - *) - echo $"Usage: $0 {start|stop|status|restart}" - exit 1 - ;; -esac - diff --git a/openQRM-5.3.50-CE/src/etc/init.d/openqrm-server.postinstall b/openQRM-5.3.50-CE/src/etc/init.d/openqrm-server.postinstall deleted file mode 100644 index 90002f3..0000000 --- a/openQRM-5.3.50-CE/src/etc/init.d/openqrm-server.postinstall +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# this is the postinstall script for the packaging stage -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# is this an update ? -if [ -f "/usr/share/openqrm_pre_update/etc/openqrm-server.conf" ]; then - if [ -x "/etc/init.d/openqrm" ]; then - /etc/init.d/openqrm stop || echo - fi - if [ -x "/usr/share/openqrm/bin/openqrm-update" ]; then - /usr/share/openqrm/bin/openqrm-update base -f - /usr/share/openqrm/bin/openqrm-update post -f - /usr/share/openqrm/bin/openqrm-update initrds -f - fi - # save state - touch /usr/share/openqrm/package-update.state -fi -# add openqrm init -chmod +x /usr/share/openqrm/etc/init.d/openqrm -ln -sf /usr/share/openqrm/etc/init.d/openqrm /etc/init.d/openqrm -/etc/init.d/openqrm start - - diff --git a/openQRM-5.3.50-CE/src/etc/init.d/openqrm-server.preinstall b/openQRM-5.3.50-CE/src/etc/init.d/openqrm-server.preinstall deleted file mode 100644 index e8e2577..0000000 --- a/openQRM-5.3.50-CE/src/etc/init.d/openqrm-server.preinstall +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# this is the preinstall script for the packaging stage -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -if [ -f "/usr/share/openqrm/etc/openqrm-server.conf" ]; then - # this is an update - if [ -x "/usr/share/openqrm/bin/openqrm-update" ]; then - /usr/share/openqrm/bin/openqrm-update pre -f - fi -fi - - diff --git a/openQRM-5.3.50-CE/src/etc/init.d/openqrm-server.preremove b/openQRM-5.3.50-CE/src/etc/init.d/openqrm-server.preremove deleted file mode 100644 index 8fba6ca..0000000 --- a/openQRM-5.3.50-CE/src/etc/init.d/openqrm-server.preremove +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# this is the pre-remove script for the packaging stage -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -if [ -x "/etc/init.d/openqrm" ]; then - /etc/init.d/openqrm stop || echo -fi - diff --git a/openQRM-5.3.50-CE/src/etc/openqrm-server.conf b/openQRM-5.3.50-CE/src/etc/openqrm-server.conf deleted file mode 100644 index 71ab40e..0000000 --- a/openQRM-5.3.50-CE/src/etc/openqrm-server.conf +++ /dev/null @@ -1,149 +0,0 @@ -# this is the main openQRM-server config file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -############## start of user setup ############## - -# OPENQRM_SERVER_BASE_DIR sets the installation for the openQRM-server. -# Please adjust to your needs before running "make install" -# (default is "/usr/share") -OPENQRM_SERVER_BASE_DIR=/usr/share - -# OPENQRM_SERVER_INTERFACE configures on which network interface -# the openQRM-server should run on -# Please adjust to your needs before running "make install" -# (default is "eth0") -OPENQRM_SERVER_INTERFACE=ens18 - -############## start of database setup ############## -# default LAMP setup -OPENQRM_DATABASE_TYPE=mysql -OPENQRM_DATABASE_SERVER=localhost -OPENQRM_DATABASE_NAME=openqrm -OPENQRM_DATABASE_USER=openqrm -OPENQRM_DATABASE_PASSWORD=openqrm - -# please find configuration templates for -# the different supported database types below : - -# configuration for using a db2 database -#OPENQRM_DATABASE_TYPE="db2" -#OPENQRM_DATABASE_SERVER="localhost" -#OPENQRM_DATABASE_NAME="openqrm" -#OPENQRM_DATABASE_USER="db2inst1" -#OPENQRM_DATABASE_PASSWORD="db2" - -# configuration for using a oracle database -#OPENQRM_DATABASE_TYPE="oracle" -#OPENQRM_DATABASE_SERVER="localhost" -#OPENQRM_DATABASE_NAME="orcl" -#OPENQRM_DATABASE_USER="scott" -#OPENQRM_DATABASE_PASSWORD="tiger" -#OPENQRM_LD_LIBRARY_PATH="/u01/app/oracle/product/11.1.0/db_1/lib" -#OPENQRM_ORACLE_HOME="/u01/app/oracle/product/11.1.0/db_1" -#OPENQRM_TNS_ADMIN="/u01/app/oracle/product/11.1.0/db_1" - -# configuration for using a postgres database -#OPENQRM_DATABASE_TYPE="postgres" -#OPENQRM_DATABASE_SERVER="localhost" -#OPENQRM_DATABASE_NAME="openqrm" -#OPENQRM_DATABASE_USER="postgres" -#OPENQRM_DATABASE_PASSWORD="" - -############## end of database setup ############## - -############## end of user setup ############## - -################################################### -# do not change anything below except you are knowing what you are doing ;) -OPENQRM_SERVER_VERSION="5.3" -OPENQRM_MINOR_RELEASE_VERSION="50" - -# OPENQRM_EXEC_PORT defines the network port for running administrative -# commands on the openQRM-server and its managed resources -OPENQRM_EXEC_PORT=1667 - -# OPENQRM_RESOURCE_BASE_DIR defines the basedir to use for -# openQRM related stuff on the managed resources -# by default it is set to the same as openQRM-server base-directory (/usr/share) -OPENQRM_RESOURCE_BASE_DIR=/usr/share - -# these are the main openQRM-server dependencies -# which configure the package-dependencies for the -# different supported linux distributions - -# OPENQRM_SERVER_DEPENDENCIES defines the package dependencies of -# the main openQRM-server - -# OPENQRM_WEBSERVER_DOCUMENT_ROOT defines the web-servers document-root -# The openQRM-server web-application will be sym-linked to this -# directory during installation -# for debian/ubuntu based systems the default doc root is at /var/www -# for redhat-based systems docroot is at /var/www/html -# for suse-based systems docroot is at /srv/www/htdocs/ - -if [ -f /etc/debian_version ]; then - OPENQRM_SERVER_DEPENDENCIES="apache2, php, php-mysql, php-xml, libphp-adodb, mariadb-client, mariadb-server, pxelinux, screen, procmail, openssl, dropbear, libapache2-mod-php, net-tools" - OPENQRM_SERVER_BUILD_REQUIREMENTS="make, wget, tar, bzip2, unzip" - OPENQRM_WEBSERVER_DOCUMENT_ROOT=/var/www - OPENQRM_WEBSERVER_CONFIG=/etc/apache2/sites-available/default -elif [ -f /etc/redhat-release ]; then - if [ -f /etc/centos-release ]; then - OPENQRM_SERVER_DEPENDENCIES="httpd, php, php-mysql, php-soap, mod_ssl, mariadb, mariadb-server, syslinux, screen, procmail, openssl, dropbear, crontabs, cronie" - else - OPENQRM_SERVER_DEPENDENCIES="httpd, php, php-mysql, php-soap, mod_ssl, mariadb, mariadb-server, syslinux, screen, procmail, openssl, dropbear, crontabs, cronie" - fi - OPENQRM_SERVER_BUILD_REQUIREMENTS="make, wget, tar, bzip2, unzip" - OPENQRM_WEBSERVER_DOCUMENT_ROOT=/var/www/html - OPENQRM_WEBSERVER_CONFIG=/etc/httpd/conf/httpd.conf -elif [ -f /etc/SuSE-release ]; then - #add maridb repo - rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB - zypper addrepo --gpgcheck --refresh https://yum.mariadb.org/10.5/opensuse/15/x86_64 mariadb - - OPENQRM_SERVER_DEPENDENCIES="apache2, apache2-mod_php7, php7, php7-mysql, MariaDB-server MariaDB-client, syslinux, screen, procmail, openssl, dropbear" - OPENQRM_SERVER_BUILD_REQUIREMENTS="make, wget, tar, bzip2, unzip" - OPENQRM_WEBSERVER_DOCUMENT_ROOT=/srv/www/htdocs - OPENQRM_WEBSERVER_CONFIG=/etc/apache2/httpd.conf -fi - -# which web protocol to use for the openQRM apache webserver -# supported are http and https, default is http -OPENQRM_WEB_PROTOCOL="https" - -# OPENQRM_EXECUTION_LAYER defines the subsystem used for executing commands -# on the openQRM server and on the managed servers -# Supported values are : -# - dropbear (ssl authentication based on key-pair, default) -# - rabbitmq (Message queuing via a RabbitMQ server, enterprise) -OPENQRM_EXECUTION_LAYER="dropbear" - -# OPENQRM_TEMP_DIR defines the tmp location for openQRM-server -OPENQRM_TEMP_DIR=/tmp - -# OPENQRM_PACKAGE_TMP_DIR defines the location for package creation (deb + rpm) -OPENQRM_PACKAGE_TMP_DIR=/tmp - -# OPENQRM_BUILD_TMP_DIR defines the location for compiling third-party components -OPENQRM_BUILD_TMP_DIR=${OPENQRM_SOURCE_DIR}/../buildtmp - -# OPENQRM_DEFAULT_CMD_TIMEOUT defines how long commands are allowed to run -OPENQRM_DEFAULT_CMD_TIMEOUT=120 - -# OPENQRM_CMD_QUEUE_RETRY defines if commands should be re-run if failed -OPENQRM_CMD_QUEUE_RETRY=false - -# OPENQRM_RABBITMQ_PASSWORD defines the password to connect to RabbitMQ -# requires that OPENQRM_EXECUTION_LAYER is to "rabbitmq" -OPENQRM_RABBITMQ_PASSWORD="" diff --git a/openQRM-5.3.50-CE/src/etc/systemd/system/openqrm-client.service b/openQRM-5.3.50-CE/src/etc/systemd/system/openqrm-client.service deleted file mode 100644 index 5cf1ce0..0000000 --- a/openQRM-5.3.50-CE/src/etc/systemd/system/openqrm-client.service +++ /dev/null @@ -1,20 +0,0 @@ -[Unit] -Description=openQRM is the next generation Linux Data Center management -After=network-online.target -Wants=network-online.target -#After=network.target -# chrony.service -#Requires=network.target - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/usr/share/openqrm/etc/init.d/openqrm-client start -ExecStop=/usr/share/openqrm/etc/init.d/openqrm-client stop -TimeoutSec=120 -#StandardOutput=tty - -[Install] -Alias=openqrm-client.service -WantedBy=multi-user.target -##WantedBy=network.target diff --git a/openQRM-5.3.50-CE/src/etc/templates/openqrm-linuxrc b/openQRM-5.3.50-CE/src/etc/templates/openqrm-linuxrc deleted file mode 100644 index 474ea2c..0000000 --- a/openQRM-5.3.50-CE/src/etc/templates/openqrm-linuxrc +++ /dev/null @@ -1,731 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# linuxrc for the openQRM initrd -export SHELL=/bin/bash -PATH=/sbin:/bin:/usr/bin:/usr/sbin -export PATH - -# some defines -export IMAGE_FSTAB=/mnt/etc/fstab -export IMAGE_FSTAB_STATIC=/mnt/etc/fstab-static -export NETWORK_SERVICES_TO_ADJUST="/etc/init.d/portmap /etc/init.d/netfs /etc/rc.d/init.d/portmap /etc/rc.d/init.d/netfs /etc/init.d/network /etc/rc.d/init.d/network /etc/init.d/networking /etc/rc.d/init.d/networking" - -#export NOT_START_SERVICE="dbus avahi-daemon kudzu" -export NOT_START_SERVICE="avahi-daemon kudzu" - -# functions -function prepare_udev() { - mkdir -p /mnt/initrd - if [ ! -e /mnt/dev/console ] || [ ! -e /mnt/dev/null ]; then - if [ ! -d /mnt/dev ]; then - mkdir -p /mnt/dev - fi - mount -t tmpfs none /mnt/dev/ - cp -a /dev/* /mnt/dev/ - mkdir -p /mnt/dev/.udevdb/ - fi - # clean udev rulez - rm -f /mnt/etc/udev/rules.d/* -} - -function prepare_var() { - VAR_LOOP=0 - local OLD_IFS=$IFS - IFS=$'\n' - for var_run_dir in $(ls -al /mnt/var/run | grep ^d); do - unset IFS - VAR_ARRAY=($var_run_dir) - VAR_DIR=${VAR_ARRAY[8]} - if [ "$VAR_DIR" != "." ] && [ "$VAR_DIR" != ".." ]; then - VAR_USER=${VAR_ARRAY[2]} - VAR_GROUP=${VAR_ARRAY[3]} - VAR_RUN_DIR[$VAR_LOOP]="$VAR_DIR $VAR_USER $VAR_GROUP" - VAR_LOOP=$(( VAR_LOOP + 1 )) - fi - done - mount -n -t tmpfs none /mnt/var/run - rm -f /mnt/var/log/wtmp - ln -s -f ../run/wtmp /mnt/var/log/wtmp - touch /mnt/var/run/wtmp - chmod 0664 /mnt/var/run/wtmp - for (( d=0;d<$VAR_LOOP;d++)); do - VAR_ARRAY=(${VAR_RUN_DIR[$d]}) - VAR_DIR=${VAR_ARRAY[0]} - VAR_USER=${VAR_ARRAY[1]} - VAR_GROUP=${VAR_ARRAY[2]} - mkdir -p /mnt/var/run/$VAR_DIR - chown $VAR_USER:$VAR_GROUP /mnt/var/run/$VAR_DIR 1>/dev/null - done - unset IFS - return 0 -} - -function import_kernel() { - - mkdir -p /tmp_download - mount -t tmpfs none /tmp_download - mount -t tmpfs none /lib/modules - cd /tmp_download - - echo -n "Attempting http(s) get modules" - if ! $WGET -q -O modules-$kernel_name.tgz $openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/boot/modules-$kernel_name.tgz; then - echo ": skipped" - echo "Attempting tftp modules" - tftp $OPENQRM_SERVER_IP_ADDRESS -g -r boot/modules-$kernel_name.tgz -l modules-$kernel_name.tgz - else - echo "...." - fi - - tar -C / -xzf /tmp_download/modules-$kernel_name.tgz - rm -f modules-$kernel_name.tgz - sync - mkdir -p /boot - mount -t tmpfs none /boot - cd /boot - - echo -n "Attempting http(s) get kernel" - if ! $WGET -q -O vmlinuz-$kernel_name $openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/boot/vmlinuz-$kernel_name; then - echo ": skipped" - echo "Attempting tftp get kernel" - tftp $OPENQRM_SERVER_IP_ADDRESS -g -r boot/vmlinuz-$kernel_name -l vmlinuz-$kernel_name - else - echo "...." - fi - mv vmlinuz-$kernel_name vmlinuz-$kernel_version - - echo -n "Attempting http(s) get System.map" - if ! $WGET -q -O System.map-$kernel_name $openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/boot/System.map-$kernel_name; then - echo ": skipped" - echo "Attempting tftp get System.map" - tftp $OPENQRM_SERVER_IP_ADDRESS -g -r boot/System.map-$kernel_name -l System.map-$kernel_name - else - echo "...." - fi - - mv System.map-$kernel_name System.map-$kernel_version - cd / - mknod /dev/ptmx c 5 2 - chmod 666 /dev/ptmx - # and mount /dev/pts - mkdir -p /dev/pts - mount /dev/pts - depmod -a - - # pcimap ? - if [ ! -f /lib/modules/$KERNEL_VERSION/modules.pcimap ]; then - depmod -a -m - if [ ! -f /lib/modules/$KERNEL_VERSION/modules.pcimap ]; then - echo "WARNING: Could not create /lib/modules/$KERNEL_VERSION/modules.pcimap!" - echo "WARNING: Automatic hardware-detection may fail!" - fi - fi - # manually load ide disk + cdroms - modprobe ide-core 2>/mplog1 - modprobe ide-generic 2>/mplog1 - modprobe ide-disk 2>/mplog1 - modprobe ata_piix 2>/mplog1 - modprobe sata_nv 2>/mplog1 - modprobe sd_mod 2>/mplog1 - rm -f /mplog1 - echo "- (2) Starting hardware detection (all system components)" - for module in `/sbin/pcimodules`; do - if [ "$module" == "matroxfb_base" ]; then - # skip this, it makes the kvm vm vnc console unreadable - continue - fi - if [ "$module" == "cirrusfb" ]; then - # skip this, it crashes the xen vm qemu-dm when accessing the vnc console on debian-lenny - continue - fi - if [ "$module" == "virtio" ] || [ "$module" == "virtio_pci" ] || [ "$module" == "virtio_ring" ] || [ "$module" == "virtio_net" ]; then - #skip these modules already loaded - echo "Skipping modules; virtio, virtio_pci, virtio_ring, virtio_net" - continue - fi - echo " -- loading $module" - modprobe -s "$module" - done - - umount /tmp_download - rmdir /tmp_download - - # start udev - udevd --daemon - - # give time to settle, especially needed for some scsi devices - sleep 3 - -# #lvm -# if [ -x /bin/lvm ]; then -# if /bin/lvm lvdisplay | grep -E "LV Path" 1>/dev/null; then -# LVM_VOLME_GREP="LV Path" -# else -# LVM_VOLME_GREP="LV Name" -# fi -# echo "- Scanning for physical lvm drives " -# /bin/lvm pvscan -# echo "- Scanning for logical volume groups" -# /bin/lvm vgscan -# echo "- Activating logical volume groups" -# /bin/lvm vgchange -ay -# echo "- Scanning for logical volumes" -# /bin/lvm lvscan -# echo "- Activating logical volumes" -# for LVOL in `/bin/lvm lvdisplay | grep -i "$LVM_VOLME_GREP" | awk {' print $3 '}`; do -# echo "- Activating $LVOL" -# /bin/lvm lvchange -ay -y $LVOL -# done -# fi - -} - - -# this functions adds the common entries to the images fstab -function create_fstab_commons() { - - local OLD_IFS=$IFS - echo "none /dev/pts devpts gid=5,mode=620 0 0" >> $IMAGE_FSTAB - echo "none /proc proc defaults 0 0" >> $IMAGE_FSTAB - echo "none /dev/shm tmpfs defaults 0 0" >> $IMAGE_FSTAB - echo "/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0" >> $IMAGE_FSTAB - IFS=$'\n' - - if [ -d /proc/ide ]; then - for IDEDEVICES in $(ls /proc/ide); do - if grep cdrom /proc/ide/$IDEDEVICES/media 1>/dev/null 2>&1; then - echo "Found cdrom at $IDEDEVICES" - mkdir -p /mnt/cdrom$LOOP 1>/dev/null - echo "/dev/$IDEDEVICES /mnt/cdrom$LOOP udf,iso9660 noauto,owner,kudzu,ro 0 0" >> $IMAGE_FSTAB - LOOP=$(( LOOP +1 )) - fi - done - fi - - FOUND_SWAP=0 -# for SWPSPACE in $(cat /proc/partitions |grep '[0-9]' | awk '{print $4}'); do -# if swapon /dev/${SWPSPACE} 1>/dev/null 2>&1; then -# swapoff /dev/${SWPSPACE} 1>/dev/null -# echo "Adding /dev/${SWPSPACE} as swap space" -# echo "/dev/${SWPSPACE} swap swap defaults 0 0" >> $IMAGE_FSTAB -# FOUND_SWAP=1 -# fi -# done -# if [ "$FOUND_SWAP" == "0" ]; then -# # we need to create a small swap file -# dd if=/dev/zero of=/mnt/tmp/mini-swap.swap bs=1M count=1 -# mkswap /mnt/tmp/mini-swap.swap -# echo "Adding mini-swap file as swap space" -# echo "/tmp/mini-swap.swap swap swap noauto 0 0" >> $IMAGE_FSTAB -# fi - - IFS=$OLD_IFS - - # fetch a custom fstab part from openqrm if exists -# if $WGET -q -O /fstab-custom "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/atu/custom/fstab/fstab.$appliance_name"; then -# cat /fstab-custom >> $IMAGE_FSTAB -# elif [ -f $IMAGE_FSTAB_STATIC ]; then -# echo "Found $IMAGE_FSTAB_STATIC, adding to $IMAGE_FSTAB" -# cat $IMAGE_FSTAB_STATIC >> $IMAGE_FSTAB -# fi - - if [ -f /custom/fstab-static ]; then - cat /custom/fstab-static >> $IMAGE_FSTAB - fi - - if [ -f /custom/fstab.$appliance_name ]; then - cat /custom/fstab.$appliance_name >> $IMAGE_FSTAB - fi - - if [ -f /custom/modules.$appliance_name ]; then - /bin/cp -f /custom/modules.$appliance_name /mnt/etc/modules - elif [ -f /custom/modules ]; then - /bin/cp -f /custom/modules /mnt/etc/modules - fi - - if [ -f /custom/interfaces.$appliance_name ]; then - /bin/cp -f /custom/interfaces.$appliance_name /mnt/etc/network/interfaces - fi - - if [ -f /custom/hosts-static ]; then - /bin/cp -f /custom/hosts-static /mnt/etc/hosts - fi - - if [ -f /custom/hosts-atu ]; then - cat /custom/hosts-atu >> /mnt/etc/hosts - fi - - if [ -f /custom/hosts.$appliance_name ]; then - cat /custom/hosts.$appliance_name >> /mnt/etc/hosts - fi - -} - - -function set_root_password() { - local id=$1 - -# if $WGET -q -O /iauth.$id $openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/image-auth/iauth.$id.php 2>/iauth.log; then - if $WGET -q -O /iauth.$id "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/image-auth/iauth.php?id=$id" 2>/iauth.log; then - cryptedpassword=`cat /iauth.$id` - rm -f /iauth.$id iauth.log - if [ "$cryptedpassword" != "" ]; then - sed -i "s#^root:[^:]*#root:$cryptedpassword#" /mnt/etc/shadow - sed -i "s#^root:[^:]*#root:$cryptedpassword#" /mnt/etc/shadow- - fi - fi -} - -function prepare_services() { - - if [ ! -e /mnt/bin/systemd ] && [ ! -e /mnt/usr/bin/systemd ] ; then - chroot /mnt ln -sf /$resource_basedir/openqrm/etc/init.d/openqrm-client /etc/init.d/openqrm-client - fi - - echo "#!/bin/bash -x" > /mnt/tmp/openqrm-client.enable - echo "OPENQRM_SERVER_BASE_DIR=$resource_basedir" >> /mnt/tmp/openqrm-client.enable - echo ". /$resource_basedir/openqrm/include/openqrm-functions" >> /mnt/tmp/openqrm-client.enable - echo "openqrm_chkconfig add openqrm-client" >> /mnt/tmp/openqrm-client.enable - for SERVICE in $NOT_START_SERVICE; do - echo "openqrm_chkconfig del $SERVICE" >> /mnt/tmp/openqrm-client.enable - done - chmod +x /mnt/tmp/openqrm-client.enable - chroot /mnt /tmp/openqrm-client.enable 1>/dev/null 2>&1 - rm -f /mnt/tmp/openqrm-client.enable -} - - -function prepare_net_init() { - INIT_SCRIPTS_TO_PREPARE="$@" - for INIT_SCRIPT in $INIT_SCRIPTS_TO_PREPARE; do - if [ -f /mnt/$INIT_SCRIPT ]; then - if ! grep -A2 "stop)" /mnt/$INIT_SCRIPT | grep -q "openqrm" ; then - echo "Preparing init script $INIT_SCRIPT" - sed -e "s/^[ \t]*stop)\(.*\)/stop) exit # added by openqrm \n\1/" /mnt/$INIT_SCRIPT > /mnt/${INIT_SCRIPT}.openqrm - mv -f /mnt/${INIT_SCRIPT}.openqrm /mnt/$INIT_SCRIPT - chmod +x /mnt/$INIT_SCRIPT - fi - fi - done -} - - - - -# main -mount -t proc proc /proc -# creating the devices -echo "Creating the devices ..." -makedevs -d /etc/initrd-devices.conf / -mkdir -p /dev/fd -ln -sf /proc/self/fd /dev/fd -mknod /dev/tty c 5 0 -ln -sf /dev/ram1 /dev/ram -mknod /dev/random c 1 8 -mknod /dev/urandom c 1 9 -echo 0x0100 > /proc/sys/kernel/real-root-dev -echo 6 > /proc/sys/kernel/printk -syslogd && klogd - -# need to run depmod 2 times as experienced -depmod -a -depmod -a - -KERNEL_VERSION=`uname -r` -if [ ! -f /lib/modules/$KERNEL_VERSION/modules.pcimap ]; then - # create the legacy maps - echo " - /lib/modules/$KERNEL_VERSION/modules.pcimap missing. Trying to create it" - depmod -a -m - if [ -f /lib/modules/$KERNEL_VERSION/modules.pcimap ]; then - echo " - /lib/modules/$KERNEL_VERSION/modules.pcimap created" - else - echo "WARNING: Could not create /lib/modules/$KERNEL_VERSION/modules.pcimap!" - echo "WARNING: Automatic hardware-detection may fail!" - fi -fi - -# load virtio drivers for KVM + Xen VMs -for module in xen-netfront virtio virtio_pci virtio_ring virtio_net crc32c e1000 e1000e igb forcedeth mdio dma ioatdma ixgbe hid usbhid hid-generic ; do - echo " -- loading $module" - modprobe "$module" 2>/mplog -done -rm -f /mplog -if grep -q sysfs /proc/filesystems ; then - mount -t sysfs none /sys -fi - -# firmware rules existing ? -if [ ! -f /etc/udev/rules.d/50-firmware.rules ]; then - # debian/ubuntu - if [ -x /lib/udev/firmware ]; then - echo 'SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware"' > /etc/udev/rules.d/50-firmware.rules - fi - # centos/rh - if [ -x /lib/udev/firmware.sh ]; then - echo 'SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh"' > /etc/udev/rules.d/50-firmware.rules - fi -fi -mkdir -p /run/udev -udevd --daemon - -# start acpid early if existing -if which acpid 1>/dev/null; then - echo "Starting acpid daemon" - acpid -fi -sleep 4 - -#jump into bash for debugging - no longer needed -#/bin/bash - -if [ -f /lib/modules/$KERNEL_VERSION/modules.pcimap ]; then - echo "- (1) Starting hardware detection (network)" - for module in `/sbin/pcimodules`; do - echo " -- loading $module" - modprobe -s "$module" - done -else - echo "- (1) Starting hardware detection (network)" - echo "NOTICE: No modules.pcimap available. Probing all network devices" - for module in `find /lib/modules/$KERNEL_VERSION/* -name "*.ko"`; do - module=`basename $module | cut -d'.' -f1` - echo " -- loading $module" - modprobe -s "$module" - done -fi - -# bnx2x support, bring up the faster nics first as eth0/1 -if lsmod | grep ^bnx2x 1>/dev/null; then - rmmod tg3 - rmmod bnx2x - udevd --daemon - modprobe bnx2x - ifconfig eth0 up - ifconfig eth1 up - modprobe tg3 -fi - -eval `cat /proc/cmdline` -sleep 3 -killall udevd 2>/mplog -rm -f /mplog -sleep 3 - -# collecting some infos from /proc/cmdline -OPENQRM_RESOURCE_MAC_ADDRESS=`echo $BOOTIF | sed -e "s/-/:/g" | sed -e "s/^01://g" | tr '[:lower:]' '[:upper:]'` - -OPENQRM_RESOURCE_MANAGED_INTERFACE=`ifconfig -a | grep $OPENQRM_RESOURCE_MAC_ADDRESS | awk {' print $1 '} | head -n 1` -#OPENQRM_RESOURCE_MANAGED_INTERFACE=`ifconfig -a | grep $OPENQRM_RESOURCE_MAC_ADDRESS -B3 | awk {' print substr($1, 1, length($1)-1) '} | head -n 1` - -OPENQRM_RESOURCE_IP_ADDRESS=`echo $ip | cut -d':' -f1` -OPENQRM_SERVER_IP_ADDRESS=`echo $ip | cut -d':' -f2` -OPENQRM_RESOURCE_DEFAULT_GATEWAY=`echo $ip | cut -d':' -f3` -OPENQRM_RESOURCE_SUBNETMASK=`echo $ip | cut -d':' -f4` -OPENQRM_RESOURCE_BROADCAST=`ipcalc -b $OPENQRM_RESOURCE_IP_ADDRESS $OPENQRM_RESOURCE_SUBNETMASK | cut -d'=' -f2` - -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -mkdir -p `dirname $OPENQRM_RESOURCE_PARAMETER_FILE` - -# adjust arp settings -if [ -f /proc/sys/net/ipv4/conf/$OPENQRM_RESOURCE_MANAGED_INTERFACE/arp_filter ]; then - echo 1 > /proc/sys/net/ipv4/conf/$OPENQRM_RESOURCE_MANAGED_INTERFACE/arp_filter -fi -if [ -f /proc/sys/net/ipv4/conf/$OPENQRM_RESOURCE_MANAGED_INTERFACE/rp_filter ]; then - echo 1 > /proc/sys/net/ipv4/conf/$OPENQRM_RESOURCE_MANAGED_INTERFACE/rp_filter -fi - -# get the net working -echo "Bringing up $OPENQRM_RESOURCE_MANAGED_INTERFACE:oq" -echo "-> mac-address : $OPENQRM_RESOURCE_MAC_ADDRESS" -echo "-> ip-address : $OPENQRM_RESOURCE_IP_ADDRESS" -echo "-> subnetmask : $OPENQRM_RESOURCE_SUBNETMASK" -echo "-> broadcast : $OPENQRM_RESOURCE_BROADCAST" -echo "-> default gw : $OPENQRM_RESOURCE_DEFAULT_GATEWAY" -echo "-> openQRM-server : $OPENQRM_SERVER_IP_ADDRESS" - -#/bin/bash - -#echo "loopback up" -ifconfig lo 127.0.0.1 up - -## -#echo "Interface: $OPENQRM_RESOURCE_MANAGED_INTERFACE down" -ifconfig $OPENQRM_RESOURCE_MANAGED_INTERFACE down -# -#echo "Interface: $OPENQRM_RESOURCE_MANAGED_INTERFACE up" -ifconfig $OPENQRM_RESOURCE_MANAGED_INTERFACE 0.0.0.0 up -# -#echo "Interface: $OPENQRM_RESOURCE_MANAGED_INTERFACE:oq $OPENQRM_RESOURCE_IP_ADDRESS up" -ifconfig $OPENQRM_RESOURCE_MANAGED_INTERFACE:oq $OPENQRM_RESOURCE_IP_ADDRESS netmask $OPENQRM_RESOURCE_SUBNETMASK broadcast $OPENQRM_RESOURCE_BROADCAST up -if [ "$OPENQRM_RESOURCE_DEFAULT_GATEWAY" != "0.0.0.0" ]; then - route add default gw $OPENQRM_RESOURCE_DEFAULT_GATEWAY -fi -## -# force a small delay for the networkcard to initialize -ping -c 5 -q $OPENQRM_SERVER_IP_ADDRESS > /dev/null - -# get resource parameter -echo "Getting resource-parameters ..." -if [ "$id" == "-1" ]; then - echo "New resource detected ! Adding to the openQRM-server at $OPENQRM_SERVER_IP_ADDRESS" -fi - -# sending resource-id will add the resource if not existing (-1 = new resource) -# loop get-parameters in case the network card is still not ready initialized -NETWORKCARD_LOOP=0 - -while (true); do - # try https first - if wget --no-check-certificate --random-file=/dev/random -q -O $OPENQRM_RESOURCE_PARAMETER_FILE "https://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_id=$id&resource_mac=$OPENQRM_RESOURCE_MAC_ADDRESS&resource_ip=$OPENQRM_RESOURCE_IP_ADDRESS&resource_subnet=$OPENQRM_RESOURCE_SUBNETMASK"; then - if ! grep "" $OPENQRM_RESOURCE_PARAMETER_FILE >/out; then - echo "-> got parameters via https" - break - fi - rm -f /out - fi - # try http - if wget -q -O $OPENQRM_RESOURCE_PARAMETER_FILE "http://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_id=$id&resource_mac=$OPENQRM_RESOURCE_MAC_ADDRESS&resource_ip=$OPENQRM_RESOURCE_IP_ADDRESS&resource_subnet=$OPENQRM_RESOURCE_SUBNETMASK"; then - if ! grep "" $OPENQRM_RESOURCE_PARAMETER_FILE >/out; then - echo "-> got parameter via http" - break - fi - rm -f /out - fi - # no chance ? - if [ "$NETWORKCARD_LOOP" == "10" ]; then - echo "ERROR: Could not reach the openQRM-Server at $OPENQRM_SERVER_IP_ADDRESS!" - # give a shell for the admin - /bin/bash - fi - NETWORKCARD_LOOP=$(( NETWORKCARD_LOOP + 1 )) - sleep 5 -done -# source parameters -. $OPENQRM_RESOURCE_PARAMETER_FILE - -# define wget -if [ "$openqrm_web_protocol" == "https" ]; then - export WGET="wget --no-check-certificate --random-file=/dev/random" -else - export WGET="wget" -fi - -# get kernel + modules by tftp -echo "Importing kernel files" -import_kernel -# load usb modules -for module in usbcore hid usbhid; do - echo " -- loading $module" - modprobe "$module" 2>/mplog -done -rm -f /mplog - -# run default openqrm-client boot-service -KERNEL_ARCH=`uname -m` -if echo $KERNEL_ARCH | grep i.*86 1>/dev/null; then - # i386 - OPENQRM_CLIENT_ARCH=i386 -else - OPENQRM_CLIENT_ARCH=x86_64 -fi - -cd / -if ! $WGET -q -O openqrm-client.tgz "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/openqrm-client.tgz"; then - rm -f openqrm-client.tgz - echo "WARNING: Failed to get the openqrm-client package! Starting an emergency shell" - /bin/bash -fi -tar -xzf openqrm-client.tgz -rm -f openqrm-client.tgz - -$resource_basedir/openqrm/etc/init.d/openqrm-client start - -#/bin/bash - -if [ "$image_type" == "ram" ] || [ "$image_type" == "" ]; then - - # send idle/available - echo "Sending idle/available to openQRM-server at $OPENQRM_SERVER_IP_ADDRESS" - $WGET -q -O /dev/null "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/resource-monitor.php?resource_command=update_status&resource_id=$resource_id&resource_state=active&resource_event=available" - hostname idle$resource_id - # rcs0 will be started here from init - # for initramfs initrds we start a shell here - if [ -x /init ]; then - echo "Detected initrd as initramfs, starting a shell" - exec setsid /bin/bash -c 'exec /bin/bash /dev/tty1 2>&1' - fi - -else - -# /bin/bash - - # if any deployment plugin is enabled, handle over the control - # -> deployment plugins will take care to mount the root fs - # and do the pivot_root if needed - - # pre-root-mount-hook to setup everything which needs to be done before the root-mount - cd / - for boot_service in $openqrm_boot_services; do - if $WGET -q -O /pre-root-mount-hook.$boot_service "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/pre-root-mount-hook.$boot_service"; then - echo " - Running for pre-root-mount-hook of boot-service $boot_service" - chmod +x pre-root-mount-hook.$boot_service - . ./pre-root-mount-hook.$boot_service - pre_mount_rootfs - else - rm -f /pre-root-mount-hook.$boot_service - fi - done - -# /bin/bash - - # root-mount-hook - eval $image_deployment_parameter - cd / - $WGET -q "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/root-mount.$image_type" - chmod +x root-mount.$image_type - -# /bin/bash - - # source the deployment plugin command, it will provide - # the functions to mount/remount the rootfs at /mnt according - # to the deployment-type and the image_deployment_parameters - . ./root-mount.$image_type - - # mount ro (provided by the deployment plugin) - ############################################################### - # DEPLOYMENT PLUGIN HOOK ###################################### - ############################################################### - mount_rootfs - -# /bin/bash - - # here we have the rootfs mounted rw so we get the openQRM client according - # distro and arch - # find out the short distri name - if [ -f /mnt/etc/debian_version ]; then - # debian or ubuntu, try to find out without lsb-release which may not be installed - if grep -i ubuntu /mnt/etc/apt/sources.list 1>/dev/null; then - OPENQRM_SHORT_DISTRI_NAME="ubuntu" - else - OPENQRM_SHORT_DISTRI_NAME="debian" - fi - elif [ -f /mnt/etc/redhat-release ]; then - OPENQRM_SHORT_DISTRI_NAME="centos" - elif [ -f /mnt/etc/SuSE-release ]; then - OPENQRM_SHORT_DISTRI_NAME="suse" - else - OPENQRM_SHORT_DISTRI_NAME="custom" - fi - -# /bin/bash - - # get the openQRM client package fitting to distri + arch - rm -rf /mnt/$resource_basedir/openqrm - cd / - echo "Getting openqrm-client package(2)................" - if ! $WGET -q -O /mnt/openqrm-client.tgz "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/openqrm-client.tgz"; then - rm -f /mnt/openqrm-client.tgz - echo "WARNING: Failed to get the openqrm-client package!" - # copy openQRM client which is on the initrd - mkdir /mnt/$resource_basedir/openqrm/ - cp -a /$resource_basedir/openqrm/* /mnt/$resource_basedir/openqrm/ - else - # use the openQRM client which fits to the distri and arch - cd /mnt/ - tar -xzf openqrm-client.tgz - rm -f openqrm-client.tgz - cd / - fi - - - # fill /boot and /lib/modules on the fs-image - echo "Filling /boot and /lib/modules" - - #create modules dir incase it does not exist, stops errors - if [ ! -d /mnt/lib/modules/$kernel_version ]; then - mkdir -p /mnt/lib/modules/$kernel_version - fi - - rm -rf /mnt/boot/vmlinuz-$kernel_version /mnt/boot/System.map-$kernel_version /mnt/lib/modules/$kernel_version - cp -af /boot/vmlinuz-$kernel_version /mnt/boot/vmlinuz-$kernel_version - cp -af /boot/System.map-$kernel_version /mnt/boot/System.map-$kernel_version - cp -af /lib/modules/$kernel_version /mnt/lib/modules/ - - - - # create custom fstab / needed for the remount rw during the system init - # (custom entry provided by the deployment plugin) - ############################################################### - # DEPLOYMENT PLUGIN HOOK ###################################### - ############################################################### - create_fstab - - # (common entries provided by a local function) - create_fstab_commons - -# /bin/bash - - # transfer resource basedir - echo "Preparing resource openQRM client" - - # copy resource parameter - mkdir -p /mnt/`dirname $OPENQRM_RESOURCE_PARAMETER_FILE` - cp -af $OPENQRM_RESOURCE_PARAMETER_FILE /mnt/$OPENQRM_RESOURCE_PARAMETER_FILE - - # prepare init according plugin services - echo "Preparing system init" - prepare_udev - prepare_var - prepare_services - prepare_net_init $NETWORK_SERVICES_TO_ADJUST - - # managed shared image - if [ "$image_isshared" != "" ]; then - echo "Prepare image as shared" - fi - - # set root password - set_root_password $image_id - - # remount rw (provided by the deployment plugin) - ############################################################### - # DEPLOYMENT PLUGIN HOOK ###################################### - ############################################################### - remount_rootfs - - # chroot + init - killall syslogd klogd 1>/dev/null 2>&1 - killall udevd 1>/dev/null 2>&1 - killall acpid 1>/dev/null 2>&1 - killall dropbear 1>/dev/null 2>&1 - - sleep 2 - if grep sysfs /proc/filesystems 1>/dev/null ; then - umount /sys - fi - umount /proc - umount /boot - umount /lib/modules - - exec switch_root /mnt /sbin/init - # here the system will do a normal init - # from the mounted rootfs image - -fi - - -#modprobe hid-generic - diff --git a/openQRM-5.3.50-CE/src/etc/templates/openqrm-linuxrc~ b/openQRM-5.3.50-CE/src/etc/templates/openqrm-linuxrc~ deleted file mode 100644 index 5fed43b..0000000 --- a/openQRM-5.3.50-CE/src/etc/templates/openqrm-linuxrc~ +++ /dev/null @@ -1,732 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# linuxrc for the openQRM initrd -export SHELL=/bin/bash -PATH=/sbin:/bin:/usr/bin:/usr/sbin -export PATH - -# some defines -export IMAGE_FSTAB=/mnt/etc/fstab -export IMAGE_FSTAB_STATIC=/mnt/etc/fstab-static -export NETWORK_SERVICES_TO_ADJUST="/etc/init.d/portmap /etc/init.d/netfs /etc/rc.d/init.d/portmap /etc/rc.d/init.d/netfs /etc/init.d/network /etc/rc.d/init.d/network /etc/init.d/networking /etc/rc.d/init.d/networking" - -#export NOT_START_SERVICE="dbus avahi-daemon kudzu" -export NOT_START_SERVICE="avahi-daemon kudzu" - -# functions -function prepare_udev() { - mkdir -p /mnt/initrd - if [ ! -e /mnt/dev/console ] || [ ! -e /mnt/dev/null ]; then - if [ ! -d /mnt/dev ]; then - mkdir -p /mnt/dev - fi - mount -t tmpfs none /mnt/dev/ - cp -a /dev/* /mnt/dev/ - mkdir -p /mnt/dev/.udevdb/ - fi - # clean udev rulez - rm -f /mnt/etc/udev/rules.d/* -} - -function prepare_var() { - VAR_LOOP=0 - local OLD_IFS=$IFS - IFS=$'\n' - for var_run_dir in $(ls -al /mnt/var/run | grep ^d); do - unset IFS - VAR_ARRAY=($var_run_dir) - VAR_DIR=${VAR_ARRAY[8]} - if [ "$VAR_DIR" != "." ] && [ "$VAR_DIR" != ".." ]; then - VAR_USER=${VAR_ARRAY[2]} - VAR_GROUP=${VAR_ARRAY[3]} - VAR_RUN_DIR[$VAR_LOOP]="$VAR_DIR $VAR_USER $VAR_GROUP" - VAR_LOOP=$(( VAR_LOOP + 1 )) - fi - done - mount -n -t tmpfs none /mnt/var/run - rm -f /mnt/var/log/wtmp - ln -s -f ../run/wtmp /mnt/var/log/wtmp - touch /mnt/var/run/wtmp - chmod 0664 /mnt/var/run/wtmp - for (( d=0;d<$VAR_LOOP;d++)); do - VAR_ARRAY=(${VAR_RUN_DIR[$d]}) - VAR_DIR=${VAR_ARRAY[0]} - VAR_USER=${VAR_ARRAY[1]} - VAR_GROUP=${VAR_ARRAY[2]} - mkdir -p /mnt/var/run/$VAR_DIR - chown $VAR_USER:$VAR_GROUP /mnt/var/run/$VAR_DIR 1>/dev/null - done - unset IFS - return 0 -} - -function import_kernel() { - - mkdir -p /tmp_download - mount -t tmpfs none /tmp_download - mount -t tmpfs none /lib/modules - cd /tmp_download - - echo -n "Attempting http(s) get modules" - if ! $WGET -q -O modules-$kernel_name.tgz $openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/boot/modules-$kernel_name.tgz; then - echo ": skipped" - echo "Attempting tftp modules" - tftp $OPENQRM_SERVER_IP_ADDRESS -g -r boot/modules-$kernel_name.tgz -l modules-$kernel_name.tgz - else - echo "...." - fi - - tar -C / -xzf /tmp_download/modules-$kernel_name.tgz - rm -f modules-$kernel_name.tgz - sync - mkdir -p /boot - mount -t tmpfs none /boot - cd /boot - - echo -n "Attempting http(s) get kernel" - if ! $WGET -q -O vmlinuz-$kernel_name $openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/boot/vmlinuz-$kernel_name; then - echo ": skipped" - echo "Attempting tftp get kernel" - tftp $OPENQRM_SERVER_IP_ADDRESS -g -r boot/vmlinuz-$kernel_name -l vmlinuz-$kernel_name - else - echo "...." - fi - mv vmlinuz-$kernel_name vmlinuz-$kernel_version - - echo -n "Attempting http(s) get System.map" - if ! $WGET -q -O System.map-$kernel_name $openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/boot/System.map-$kernel_name; then - echo ": skipped" - echo "Attempting tftp get System.map" - tftp $OPENQRM_SERVER_IP_ADDRESS -g -r boot/System.map-$kernel_name -l System.map-$kernel_name - else - echo "...." - fi - - mv System.map-$kernel_name System.map-$kernel_version - cd / - mknod /dev/ptmx c 5 2 - chmod 666 /dev/ptmx - # and mount /dev/pts - mkdir -p /dev/pts - mount /dev/pts - depmod -a - - # pcimap ? - if [ ! -f /lib/modules/$KERNEL_VERSION/modules.pcimap ]; then - depmod -a -m - if [ ! -f /lib/modules/$KERNEL_VERSION/modules.pcimap ]; then - echo "WARNING: Could not create /lib/modules/$KERNEL_VERSION/modules.pcimap!" - echo "WARNING: Automatic hardware-detection may fail!" - fi - fi - # manually load ide disk + cdroms - modprobe ide-core 2>/mplog1 - modprobe ide-generic 2>/mplog1 - modprobe ide-disk 2>/mplog1 - modprobe ata_piix 2>/mplog1 - modprobe sata_nv 2>/mplog1 - modprobe sd_mod 2>/mplog1 - rm -f /mplog1 - echo "- (2) Starting hardware detection (all system components)" - for module in `/sbin/pcimodules`; do - if [ "$module" == "matroxfb_base" ]; then - # skip this, it makes the kvm vm vnc console unreadable - continue - fi - if [ "$module" == "cirrusfb" ]; then - # skip this, it crashes the xen vm qemu-dm when accessing the vnc console on debian-lenny - continue - fi - if [ "$module" == "virtio" ] || [ "$module" == "virtio_pci" ] || [ "$module" == "virtio_ring" ] || [ "$module" == "virtio_net" ]; then - #skip these modules already loaded - echo "Skipping modules; virtio, virtio_pci, virtio_ring, virtio_net" - continue - fi - echo " -- loading $module" - modprobe -s "$module" - done - - umount /tmp_download - rmdir /tmp_download - - # start udev - udevd --daemon - - # give time to settle, especially needed for some scsi devices - sleep 3 - -# #lvm -# if [ -x /bin/lvm ]; then -# if /bin/lvm lvdisplay | grep -E "LV Path" 1>/dev/null; then -# LVM_VOLME_GREP="LV Path" -# else -# LVM_VOLME_GREP="LV Name" -# fi -# echo "- Scanning for physical lvm drives " -# /bin/lvm pvscan -# echo "- Scanning for logical volume groups" -# /bin/lvm vgscan -# echo "- Activating logical volume groups" -# /bin/lvm vgchange -ay -# echo "- Scanning for logical volumes" -# /bin/lvm lvscan -# echo "- Activating logical volumes" -# for LVOL in `/bin/lvm lvdisplay | grep -i "$LVM_VOLME_GREP" | awk {' print $3 '}`; do -# echo "- Activating $LVOL" -# /bin/lvm lvchange -ay -y $LVOL -# done -# fi - -} - - -# this functions adds the common entries to the images fstab -function create_fstab_commons() { - - local OLD_IFS=$IFS - echo "none /dev/pts devpts gid=5,mode=620 0 0" >> $IMAGE_FSTAB - echo "none /proc proc defaults 0 0" >> $IMAGE_FSTAB - echo "none /dev/shm tmpfs defaults 0 0" >> $IMAGE_FSTAB - echo "/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0" >> $IMAGE_FSTAB - IFS=$'\n' - - if [ -d /proc/ide ]; then - for IDEDEVICES in $(ls /proc/ide); do - if grep cdrom /proc/ide/$IDEDEVICES/media 1>/dev/null 2>&1; then - echo "Found cdrom at $IDEDEVICES" - mkdir -p /mnt/cdrom$LOOP 1>/dev/null - echo "/dev/$IDEDEVICES /mnt/cdrom$LOOP udf,iso9660 noauto,owner,kudzu,ro 0 0" >> $IMAGE_FSTAB - LOOP=$(( LOOP +1 )) - fi - done - fi - - FOUND_SWAP=0 -# for SWPSPACE in $(cat /proc/partitions |grep '[0-9]' | awk '{print $4}'); do -# if swapon /dev/${SWPSPACE} 1>/dev/null 2>&1; then -# swapoff /dev/${SWPSPACE} 1>/dev/null -# echo "Adding /dev/${SWPSPACE} as swap space" -# echo "/dev/${SWPSPACE} swap swap defaults 0 0" >> $IMAGE_FSTAB -# FOUND_SWAP=1 -# fi -# done -# if [ "$FOUND_SWAP" == "0" ]; then -# # we need to create a small swap file -# dd if=/dev/zero of=/mnt/tmp/mini-swap.swap bs=1M count=1 -# mkswap /mnt/tmp/mini-swap.swap -# echo "Adding mini-swap file as swap space" -# echo "/tmp/mini-swap.swap swap swap noauto 0 0" >> $IMAGE_FSTAB -# fi - - IFS=$OLD_IFS - - # fetch a custom fstab part from openqrm if exists -# if $WGET -q -O /fstab-custom "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/atu/custom/fstab/fstab.$appliance_name"; then -# cat /fstab-custom >> $IMAGE_FSTAB -# elif [ -f $IMAGE_FSTAB_STATIC ]; then -# echo "Found $IMAGE_FSTAB_STATIC, adding to $IMAGE_FSTAB" -# cat $IMAGE_FSTAB_STATIC >> $IMAGE_FSTAB -# fi - - if [ -f /custom/fstab-static ]; then - cat /custom/fstab-static >> $IMAGE_FSTAB - fi - - if [ -f /custom/fstab.$appliance_name ]; then - cat /custom/fstab.$appliance_name >> $IMAGE_FSTAB - fi - - if [ -f /custom/modules.$appliance_name ]; then - /bin/cp -f /custom/modules.$appliance_name /mnt/etc/modules - elif [ -f /custom/modules ]; then - /bin/cp -f /custom/modules /mnt/etc/modules - fi - - if [ -f /custom/interfaces.$appliance_name ]; then - /bin/cp -f /custom/interfaces.$appliance_name /mnt/etc/network/interfaces - fi - - if [ -f /custom/hosts-static ]; then - /bin/cp -f /custom/hosts-static /mnt/etc/hosts - fi - - if [ -f /custom/hosts-atu ]; then - cat /custom/hosts-atu >> /mnt/etc/hosts - fi - - if [ -f /custom/hosts.$appliance_name ]; then - cat /custom/hosts.$appliance_name >> /mnt/etc/hosts - fi - -} - - -function set_root_password() { - local id=$1 - -# if $WGET -q -O /iauth.$id $openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/image-auth/iauth.$id.php 2>/iauth.log; then - if $WGET -q -O /iauth.$id "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/image-auth/iauth.php?id=$id" 2>/iauth.log; then - cryptedpassword=`cat /iauth.$id` - rm -f /iauth.$id iauth.log - if [ "$cryptedpassword" != "" ]; then - sed -i "s#^root:[^:]*#root:$cryptedpassword#" /mnt/etc/shadow - sed -i "s#^root:[^:]*#root:$cryptedpassword#" /mnt/etc/shadow- - fi - fi -} - -function prepare_services() { - - if [ ! -e /mnt/bin/systemd ] && [ ! -e /mnt/usr/bin/systemd ] ; then - chroot /mnt ln -sf /$resource_basedir/openqrm/etc/init.d/openqrm-client /etc/init.d/openqrm-client - fi - - echo "#!/bin/bash -x" > /mnt/tmp/openqrm-client.enable - echo "OPENQRM_SERVER_BASE_DIR=$resource_basedir" >> /mnt/tmp/openqrm-client.enable - echo ". /$resource_basedir/openqrm/include/openqrm-functions" >> /mnt/tmp/openqrm-client.enable - echo "openqrm_chkconfig add openqrm-client" >> /mnt/tmp/openqrm-client.enable - for SERVICE in $NOT_START_SERVICE; do - echo "openqrm_chkconfig del $SERVICE" >> /mnt/tmp/openqrm-client.enable - done - chmod +x /mnt/tmp/openqrm-client.enable - chroot /mnt /tmp/openqrm-client.enable 1>/dev/null 2>&1 - rm -f /mnt/tmp/openqrm-client.enable -} - - -function prepare_net_init() { - INIT_SCRIPTS_TO_PREPARE="$@" - for INIT_SCRIPT in $INIT_SCRIPTS_TO_PREPARE; do - if [ -f /mnt/$INIT_SCRIPT ]; then - if ! grep -A2 "stop)" /mnt/$INIT_SCRIPT | grep -q "openqrm" ; then - echo "Preparing init script $INIT_SCRIPT" - sed -e "s/^[ \t]*stop)\(.*\)/stop) exit # added by openqrm \n\1/" /mnt/$INIT_SCRIPT > /mnt/${INIT_SCRIPT}.openqrm - mv -f /mnt/${INIT_SCRIPT}.openqrm /mnt/$INIT_SCRIPT - chmod +x /mnt/$INIT_SCRIPT - fi - fi - done -} - - - - -# main -mount -t proc proc /proc -# creating the devices -echo "Creating the devices ..." -makedevs -d /etc/initrd-devices.conf / -mkdir -p /dev/fd -ln -sf /proc/self/fd /dev/fd -mknod /dev/tty c 5 0 -ln -sf /dev/ram1 /dev/ram -mknod /dev/random c 1 8 -mknod /dev/urandom c 1 9 -echo 0x0100 > /proc/sys/kernel/real-root-dev -echo 6 > /proc/sys/kernel/printk -syslogd && klogd - -# need to run depmod 2 times as experienced -depmod -a -depmod -a - -KERNEL_VERSION=`uname -r` -if [ ! -f /lib/modules/$KERNEL_VERSION/modules.pcimap ]; then - # create the legacy maps - echo " - /lib/modules/$KERNEL_VERSION/modules.pcimap missing. Trying to create it" - depmod -a -m - if [ -f /lib/modules/$KERNEL_VERSION/modules.pcimap ]; then - echo " - /lib/modules/$KERNEL_VERSION/modules.pcimap created" - else - echo "WARNING: Could not create /lib/modules/$KERNEL_VERSION/modules.pcimap!" - echo "WARNING: Automatic hardware-detection may fail!" - fi -fi - -# load virtio drivers for KVM + Xen VMs -#for module in xen-netfront virtio virtio_pci virtio_ring virtio_net crc32c; do -for module in xen-netfront virtio virtio_pci virtio_ring virtio_net crc32c e1000 e1000e igb forcedeth dca ioatdma ixgbe hid usbhid hid-generic ; do - echo " -- loading $module" - modprobe "$module" 2>/mplog -done -rm -f /mplog -if grep -q sysfs /proc/filesystems ; then - mount -t sysfs none /sys -fi - -# firmware rules existing ? -if [ ! -f /etc/udev/rules.d/50-firmware.rules ]; then - # debian/ubuntu - if [ -x /lib/udev/firmware ]; then - echo 'SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware"' > /etc/udev/rules.d/50-firmware.rules - fi - # centos/rh - if [ -x /lib/udev/firmware.sh ]; then - echo 'SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh"' > /etc/udev/rules.d/50-firmware.rules - fi -fi -mkdir -p /run/udev -udevd --daemon - -# start acpid early if existing -if which acpid 1>/dev/null; then - echo "Starting acpid daemon" - acpid -fi -sleep 4 - -#jump into bash for debugging - no longer needed -#/bin/bash - -if [ -f /lib/modules/$KERNEL_VERSION/modules.pcimap ]; then - echo "- (1) Starting hardware detection (network)" - for module in `/sbin/pcimodules`; do - echo " -- loading $module" - modprobe -s "$module" - done -else - echo "- (1) Starting hardware detection (network)" - echo "NOTICE: No modules.pcimap available. Probing all network devices" - for module in `find /lib/modules/$KERNEL_VERSION/* -name "*.ko"`; do - module=`basename $module | cut -d'.' -f1` - echo " -- loading $module" - modprobe -s "$module" - done -fi - -# bnx2x support, bring up the faster nics first as eth0/1 -if lsmod | grep ^bnx2x 1>/dev/null; then - rmmod tg3 - rmmod bnx2x - udevd --daemon - modprobe bnx2x - ifconfig eth0 up - ifconfig eth1 up - modprobe tg3 -fi - -eval `cat /proc/cmdline` -sleep 3 -killall udevd 2>/mplog -rm -f /mplog -sleep 3 - -# collecting some infos from /proc/cmdline -OPENQRM_RESOURCE_MAC_ADDRESS=`echo $BOOTIF | sed -e "s/-/:/g" | sed -e "s/^01://g" | tr '[:lower:]' '[:upper:]'` - -OPENQRM_RESOURCE_MANAGED_INTERFACE=`ifconfig -a | grep $OPENQRM_RESOURCE_MAC_ADDRESS | awk {' print $1 '} | head -n 1` -#OPENQRM_RESOURCE_MANAGED_INTERFACE=`ifconfig -a | grep $OPENQRM_RESOURCE_MAC_ADDRESS -B3 | awk {' print substr($1, 1, length($1)-1) '} | head -n 1` - -OPENQRM_RESOURCE_IP_ADDRESS=`echo $ip | cut -d':' -f1` -OPENQRM_SERVER_IP_ADDRESS=`echo $ip | cut -d':' -f2` -OPENQRM_RESOURCE_DEFAULT_GATEWAY=`echo $ip | cut -d':' -f3` -OPENQRM_RESOURCE_SUBNETMASK=`echo $ip | cut -d':' -f4` -OPENQRM_RESOURCE_BROADCAST=`ipcalc -b $OPENQRM_RESOURCE_IP_ADDRESS $OPENQRM_RESOURCE_SUBNETMASK | cut -d'=' -f2` - -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -mkdir -p `dirname $OPENQRM_RESOURCE_PARAMETER_FILE` - -# adjust arp settings -if [ -f /proc/sys/net/ipv4/conf/$OPENQRM_RESOURCE_MANAGED_INTERFACE/arp_filter ]; then - echo 1 > /proc/sys/net/ipv4/conf/$OPENQRM_RESOURCE_MANAGED_INTERFACE/arp_filter -fi -if [ -f /proc/sys/net/ipv4/conf/$OPENQRM_RESOURCE_MANAGED_INTERFACE/rp_filter ]; then - echo 1 > /proc/sys/net/ipv4/conf/$OPENQRM_RESOURCE_MANAGED_INTERFACE/rp_filter -fi - -# get the net working -echo "Bringing up $OPENQRM_RESOURCE_MANAGED_INTERFACE:oq" -echo "-> mac-address : $OPENQRM_RESOURCE_MAC_ADDRESS" -echo "-> ip-address : $OPENQRM_RESOURCE_IP_ADDRESS" -echo "-> subnetmask : $OPENQRM_RESOURCE_SUBNETMASK" -echo "-> broadcast : $OPENQRM_RESOURCE_BROADCAST" -echo "-> default gw : $OPENQRM_RESOURCE_DEFAULT_GATEWAY" -echo "-> openQRM-server : $OPENQRM_SERVER_IP_ADDRESS" - -#/bin/bash - -#echo "loopback up" -ifconfig lo 127.0.0.1 up - -## -#echo "Interface: $OPENQRM_RESOURCE_MANAGED_INTERFACE down" -ifconfig $OPENQRM_RESOURCE_MANAGED_INTERFACE down -# -#echo "Interface: $OPENQRM_RESOURCE_MANAGED_INTERFACE up" -ifconfig $OPENQRM_RESOURCE_MANAGED_INTERFACE 0.0.0.0 up -# -#echo "Interface: $OPENQRM_RESOURCE_MANAGED_INTERFACE:oq $OPENQRM_RESOURCE_IP_ADDRESS up" -ifconfig $OPENQRM_RESOURCE_MANAGED_INTERFACE:oq $OPENQRM_RESOURCE_IP_ADDRESS netmask $OPENQRM_RESOURCE_SUBNETMASK broadcast $OPENQRM_RESOURCE_BROADCAST up -if [ "$OPENQRM_RESOURCE_DEFAULT_GATEWAY" != "0.0.0.0" ]; then - route add default gw $OPENQRM_RESOURCE_DEFAULT_GATEWAY -fi -## -# force a small delay for the networkcard to initialize -ping -c 5 -q $OPENQRM_SERVER_IP_ADDRESS > /dev/null - -# get resource parameter -echo "Getting resource-parameters ..." -if [ "$id" == "-1" ]; then - echo "New resource detected ! Adding to the openQRM-server at $OPENQRM_SERVER_IP_ADDRESS" -fi - -# sending resource-id will add the resource if not existing (-1 = new resource) -# loop get-parameters in case the network card is still not ready initialized -NETWORKCARD_LOOP=0 - -while (true); do - # try https first - if wget --no-check-certificate --random-file=/dev/random -q -O $OPENQRM_RESOURCE_PARAMETER_FILE "https://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_id=$id&resource_mac=$OPENQRM_RESOURCE_MAC_ADDRESS&resource_ip=$OPENQRM_RESOURCE_IP_ADDRESS&resource_subnet=$OPENQRM_RESOURCE_SUBNETMASK"; then - if ! grep "" $OPENQRM_RESOURCE_PARAMETER_FILE >/out; then - echo "-> got parameters via https" - break - fi - rm -f /out - fi - # try http - if wget -q -O $OPENQRM_RESOURCE_PARAMETER_FILE "http://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_id=$id&resource_mac=$OPENQRM_RESOURCE_MAC_ADDRESS&resource_ip=$OPENQRM_RESOURCE_IP_ADDRESS&resource_subnet=$OPENQRM_RESOURCE_SUBNETMASK"; then - if ! grep "" $OPENQRM_RESOURCE_PARAMETER_FILE >/out; then - echo "-> got parameter via http" - break - fi - rm -f /out - fi - # no chance ? - if [ "$NETWORKCARD_LOOP" == "10" ]; then - echo "ERROR: Could not reach the openQRM-Server at $OPENQRM_SERVER_IP_ADDRESS!" - # give a shell for the admin - /bin/bash - fi - NETWORKCARD_LOOP=$(( NETWORKCARD_LOOP + 1 )) - sleep 5 -done -# source parameters -. $OPENQRM_RESOURCE_PARAMETER_FILE - -# define wget -if [ "$openqrm_web_protocol" == "https" ]; then - export WGET="wget --no-check-certificate --random-file=/dev/random" -else - export WGET="wget" -fi - -# get kernel + modules by tftp -echo "Importing kernel files" -import_kernel -# load usb modules -for module in usbcore hid usbhid; do - echo " -- loading $module" - modprobe "$module" 2>/mplog -done -rm -f /mplog - -# run default openqrm-client boot-service -KERNEL_ARCH=`uname -m` -if echo $KERNEL_ARCH | grep i.*86 1>/dev/null; then - # i386 - OPENQRM_CLIENT_ARCH=i386 -else - OPENQRM_CLIENT_ARCH=x86_64 -fi - -cd / -if ! $WGET -q -O openqrm-client.tgz "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/openqrm-client.tgz"; then - rm -f openqrm-client.tgz - echo "WARNING: Failed to get the openqrm-client package! Starting an emergency shell" - /bin/bash -fi -tar -xzf openqrm-client.tgz -rm -f openqrm-client.tgz - -$resource_basedir/openqrm/etc/init.d/openqrm-client start - -#/bin/bash - -if [ "$image_type" == "ram" ] || [ "$image_type" == "" ]; then - - # send idle/available - echo "Sending idle/available to openQRM-server at $OPENQRM_SERVER_IP_ADDRESS" - $WGET -q -O /dev/null "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/resource-monitor.php?resource_command=update_status&resource_id=$resource_id&resource_state=active&resource_event=available" - hostname idle$resource_id - # rcs0 will be started here from init - # for initramfs initrds we start a shell here - if [ -x /init ]; then - echo "Detected initrd as initramfs, starting a shell" - exec setsid /bin/bash -c 'exec /bin/bash /dev/tty1 2>&1' - fi - -else - -# /bin/bash - - # if any deployment plugin is enabled, handle over the control - # -> deployment plugins will take care to mount the root fs - # and do the pivot_root if needed - - # pre-root-mount-hook to setup everything which needs to be done before the root-mount - cd / - for boot_service in $openqrm_boot_services; do - if $WGET -q -O /pre-root-mount-hook.$boot_service "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/pre-root-mount-hook.$boot_service"; then - echo " - Running for pre-root-mount-hook of boot-service $boot_service" - chmod +x pre-root-mount-hook.$boot_service - . ./pre-root-mount-hook.$boot_service - pre_mount_rootfs - else - rm -f /pre-root-mount-hook.$boot_service - fi - done - -# /bin/bash - - # root-mount-hook - eval $image_deployment_parameter - cd / - $WGET -q "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/root-mount.$image_type" - chmod +x root-mount.$image_type - -# /bin/bash - - # source the deployment plugin command, it will provide - # the functions to mount/remount the rootfs at /mnt according - # to the deployment-type and the image_deployment_parameters - . ./root-mount.$image_type - - # mount ro (provided by the deployment plugin) - ############################################################### - # DEPLOYMENT PLUGIN HOOK ###################################### - ############################################################### - mount_rootfs - -# /bin/bash - - # here we have the rootfs mounted rw so we get the openQRM client according - # distro and arch - # find out the short distri name - if [ -f /mnt/etc/debian_version ]; then - # debian or ubuntu, try to find out without lsb-release which may not be installed - if grep -i ubuntu /mnt/etc/apt/sources.list 1>/dev/null; then - OPENQRM_SHORT_DISTRI_NAME="ubuntu" - else - OPENQRM_SHORT_DISTRI_NAME="debian" - fi - elif [ -f /mnt/etc/redhat-release ]; then - OPENQRM_SHORT_DISTRI_NAME="centos" - elif [ -f /mnt/etc/SuSE-release ]; then - OPENQRM_SHORT_DISTRI_NAME="suse" - else - OPENQRM_SHORT_DISTRI_NAME="custom" - fi - -# /bin/bash - - # get the openQRM client package fitting to distri + arch - rm -rf /mnt/$resource_basedir/openqrm - cd / - echo "Getting openqrm-client package(2)................" - if ! $WGET -q -O /mnt/openqrm-client.tgz "$openqrm_web_protocol://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/openqrm-client.tgz"; then - rm -f /mnt/openqrm-client.tgz - echo "WARNING: Failed to get the openqrm-client package!" - # copy openQRM client which is on the initrd - mkdir /mnt/$resource_basedir/openqrm/ - cp -a /$resource_basedir/openqrm/* /mnt/$resource_basedir/openqrm/ - else - # use the openQRM client which fits to the distri and arch - cd /mnt/ - tar -xzf openqrm-client.tgz - rm -f openqrm-client.tgz - cd / - fi - - - # fill /boot and /lib/modules on the fs-image - echo "Filling /boot and /lib/modules" - - #create modules dir incase it does not exist, stops errors - if [ ! -d /mnt/lib/modules/$kernel_version ]; then - mkdir -p /mnt/lib/modules/$kernel_version - fi - - rm -rf /mnt/boot/vmlinuz-$kernel_version /mnt/boot/System.map-$kernel_version /mnt/lib/modules/$kernel_version - cp -af /boot/vmlinuz-$kernel_version /mnt/boot/vmlinuz-$kernel_version - cp -af /boot/System.map-$kernel_version /mnt/boot/System.map-$kernel_version - cp -af /lib/modules/$kernel_version /mnt/lib/modules/ - - - - # create custom fstab / needed for the remount rw during the system init - # (custom entry provided by the deployment plugin) - ############################################################### - # DEPLOYMENT PLUGIN HOOK ###################################### - ############################################################### - create_fstab - - # (common entries provided by a local function) - create_fstab_commons - -# /bin/bash - - # transfer resource basedir - echo "Preparing resource openQRM client" - - # copy resource parameter - mkdir -p /mnt/`dirname $OPENQRM_RESOURCE_PARAMETER_FILE` - cp -af $OPENQRM_RESOURCE_PARAMETER_FILE /mnt/$OPENQRM_RESOURCE_PARAMETER_FILE - - # prepare init according plugin services - echo "Preparing system init" - prepare_udev - prepare_var - prepare_services - prepare_net_init $NETWORK_SERVICES_TO_ADJUST - - # managed shared image - if [ "$image_isshared" != "" ]; then - echo "Prepare image as shared" - fi - - # set root password - set_root_password $image_id - - # remount rw (provided by the deployment plugin) - ############################################################### - # DEPLOYMENT PLUGIN HOOK ###################################### - ############################################################### - remount_rootfs - - # chroot + init - killall syslogd klogd 1>/dev/null 2>&1 - killall udevd 1>/dev/null 2>&1 - killall acpid 1>/dev/null 2>&1 - killall dropbear 1>/dev/null 2>&1 - - sleep 2 - if grep sysfs /proc/filesystems 1>/dev/null ; then - umount /sys - fi - umount /proc - umount /boot - umount /lib/modules - - exec switch_root /mnt /sbin/init - # here the system will do a normal init - # from the mounted rootfs image - -fi - - -#modprobe hid-generic - diff --git a/openQRM-5.3.50-CE/src/etc/templates/openqrm-openssl-configuration b/openQRM-5.3.50-CE/src/etc/templates/openqrm-openssl-configuration deleted file mode 100644 index d5b0465..0000000 --- a/openQRM-5.3.50-CE/src/etc/templates/openqrm-openssl-configuration +++ /dev/null @@ -1,53 +0,0 @@ -[ ca ] -default_ca = openqrmca - -[ openqrmca ] -dir = . -certificate = $dir/cacert.pem -database = $dir/index.txt -new_certs_dir = $dir/certs -private_key = $dir/private/cakey.pem -serial = $dir/serial - -default_crl_days = 7 -default_days = 365 -default_md = sha1 - -policy = openqrmca_policy -x509_extensions = certificate_extensions - -[ openqrmca_policy ] -commonName = supplied -stateOrProvinceName = optional -countryName = optional -emailAddress = optional -organizationName = optional -organizationalUnitName = optional - -[ certificate_extensions ] -basicConstraints = CA:false - -[ req ] -default_bits = 2048 -default_keyfile = ./private/cakey.pem -default_md = sha1 -prompt = yes -distinguished_name = root_ca_distinguished_name -x509_extensions = root_ca_extensions - -[ root_ca_distinguished_name ] -commonName = sensu - -[ root_ca_extensions ] -basicConstraints = CA:true -keyUsage = keyCertSign, cRLSign - -[ client_ca_extensions ] -basicConstraints = CA:false -keyUsage = digitalSignature -extendedKeyUsage = 1.3.6.1.5.5.7.3.2 - -[ server_ca_extensions ] -basicConstraints = CA:false -keyUsage = keyEncipherment -extendedKeyUsage = 1.3.6.1.5.5.7.3.1 diff --git a/openQRM-5.3.50-CE/src/etc/templates/openqrm-pxelinux b/openQRM-5.3.50-CE/src/etc/templates/openqrm-pxelinux deleted file mode 100644 index afa4f77..0000000 --- a/openQRM-5.3.50-CE/src/etc/templates/openqrm-pxelinux +++ /dev/null @@ -1,9 +0,0 @@ -default linux - -label linux -kernel boot/OPENQRM_BOOTIMAGE_KERNEL -append ramdisk_size=131072 apm=off initrd=boot/OPENQRM_BOOTIMAGE_INITRD id=OPENQRM_RESOURCE_ID openqrm=OPENQRM_SERVER_IP_ADDRESS selinux=0 net.ifnames=0 -ipappend 3 - -label local -LOCALBOOT 0 diff --git a/openQRM-5.3.50-CE/src/etc/templates/openqrm-rabbitmq-ssl-configuration b/openQRM-5.3.50-CE/src/etc/templates/openqrm-rabbitmq-ssl-configuration deleted file mode 100644 index fd5d778..0000000 --- a/openQRM-5.3.50-CE/src/etc/templates/openqrm-rabbitmq-ssl-configuration +++ /dev/null @@ -1,8 +0,0 @@ -[ - {rabbit, [ - {ssl_listeners, [5671]}, - {ssl_options, [{cacertfile,"/etc/rabbitmq/ssl/cacert.pem"}, - {certfile,"/etc/rabbitmq/ssl/server_cert.pem"}, - {keyfile,"/etc/rabbitmq/ssl/server_key.pem"}]} - ]} -]. diff --git a/openQRM-5.3.50-CE/src/etc/templates/prepare_net_init.sh b/openQRM-5.3.50-CE/src/etc/templates/prepare_net_init.sh deleted file mode 100644 index 03f6c54..0000000 --- a/openQRM-5.3.50-CE/src/etc/templates/prepare_net_init.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -x - -function prepare_net_init() { - INIT_SCRIPTS_TO_PREPARE="$@" - for INIT_SCRIPT in $INIT_SCRIPTS_TO_PREPARE; do - if [ -f /mnt/$INIT_SCRIPT ]; then - if ! grep -A2 "stop)" /mnt/$INIT_SCRIPT | grep -q "openqrm" ; then - echo "Preparing init script $INIT_SCRIPT" - sed -e "s/^[ \t]*stop)\(.*\)/stop) exit # added by openqrm \n\1/" /mnt/$INIT_SCRIPT > /mnt/${INIT_SCRIPT}.openqrm - mv -f /mnt/${INIT_SCRIPT}.openqrm /mnt/$INIT_SCRIPT - chmod +x /mnt/$INIT_SCRIPT - fi - fi - done -} - -export NETWORK_SERVICES_TO_ADJUST="/etc/init.d/portmap /etc/init.d/netfs /etc/rc.d/init.d/portmap /etc/rc.d/init.d/netfs /etc/init.d/network /etc/rc.d/init.d/network /etc/init.d/networking /etc/rc.d/init.d/networking" - -prepare_net_init $NETWORK_SERVICES_TO_ADJUST \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/fill-build-cache b/openQRM-5.3.50-CE/src/fill-build-cache deleted file mode 100644 index 1eb1aba..0000000 --- a/openQRM-5.3.50-CE/src/fill-build-cache +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - - -export OPENQRM_SERVER_BASE_DIR=`dirname $0` -export OPENQRM_SOURCE_DIR=$OPENQRM_SERVER_BASE_DIR -. include/openqrm-functions -. include/openqrm-build-functions - -for COMPONENT_CONFIG in `find etc/build.conf/ -type f -name *.conf | grep -v initrd-devices` ; do - COMPONENT=`basename $COMPONENT_CONFIG` - COMPONENT=`echo $COMPONENT | sed -e 's/\.conf//g'` - echo "Checking $COMPONENT" - openqrm_cache_or_download $COMPONENT $COMPONENT_CONFIG -done -for COMPONENT_CONFIG in $PLUGIN_CONFS; do - COMPONENT=`basename $COMPONENT_CONFIG` - COMPONENT=`echo $COMPONENT | sed -e 's/\.conf//g'` - echo "Checking $COMPONENT" - openqrm_cache_or_download $COMPONENT $COMPONENT_CONFIG -done - diff --git a/openQRM-5.3.50-CE/src/include/Makefile b/openQRM-5.3.50-CE/src/include/Makefile deleted file mode 100644 index d7ece81..0000000 --- a/openQRM-5.3.50-CE/src/include/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# this is the openQRM include Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/include - . $(OPENQRM_SERVER_CONF) && cp openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/include/ - - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/include/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/include - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/include/openqrm-build-functions b/openQRM-5.3.50-CE/src/include/openqrm-build-functions deleted file mode 100644 index 794e668..0000000 --- a/openQRM-5.3.50-CE/src/include/openqrm-build-functions +++ /dev/null @@ -1,911 +0,0 @@ -#!/bin/bash -x -########################## build functions ########################## -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# in the stage these function are used the files may be not installed yet - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SERVER_BASE_DIR before sourcing $0" - exit 1 -fi -if [ "$OPENQRM_SOURCE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SOURCE_DIR before sourcing $0" - exit 1 -fi -# source the openqrm-functions file for more features -. $OPENQRM_SOURCE_DIR/include/openqrm-functions -# include package functions for package management -. $OPENQRM_SOURCE_DIR/include/openqrm-package-functions -# source the openqrm-server.conf which resets the OPENQRM_SERVER_BASE_DIR again -. $OPENQRM_SOURCE_DIR/etc/openqrm-server.conf - -if [ -x "/sbin/rpcbind" ]; then - # portmap was replaced with rpcbind on fc > 7 - OPENQRM_INITRD_COMPONENTS="/sbin/rpcbind" -else - OPENQRM_INITRD_COMPONENTS="/sbin/portmap" -fi -if [ -x "/sbin/rpc.statd" ]; then - OPENQRM_INITRD_COMPONENTS="$OPENQRM_INITRD_COMPONENTS /sbin/rpc.statd" -fi - - -OPENQRM_INITRD_COMPONENTS="$OPENQRM_INITRD_COMPONENTS /bin/bash /usr/bin/rsync /usr/bin/wget /sbin/modprobe /sbin/depmod /sbin/insmod /sbin/lsmod /sbin/mke2fs /sbin/sfdisk /sbin/udevd /sbin/lvm `which ethtool 2>/dev/null` `which acpid 2>/dev/null`" -OPENQRM_INITRD_DIRECTORIES="bin etc etc/rc.d/init.d etc/sysconfig etc/X11 lib lib/modules lib/i686 loopfs mnt old_root proc sys sysroot usr usr/lib usr/bin usr/sbin var var/lock var/lock/subsys var/log var/run /var/lib /var/lib/nfs /var/lib/nfs/statd" - -# colorize/emphasize terminal output -USE_COLORS=1 - -# -# Print a message to STDOUT -# -# $1: the message -# $2: (optional) use "bold" to get bold-printed output -# -function print_message() { - bold="\033[1m" - esc="\033[m" - if [ $USE_COLORS == 1 -a "$2" == 'bold' ]; then - echo -e "${bold}${1}${esc}" - else - echo "$1" - fi -} - -function print_error() { - bold="\033[1m" - red="\033[31m" - esc="\033[m" - if [ $USE_COLORS == 1 ]; then - echo -e "${red}ERROR: ${1}${esc}" - else - echo "ERROR: $1" - fi -} - -function print_notice() { - echo "NOTICE: $1" -} - - -# -# Display all library files (not links) a binary depends on -# -> this is generic -# -# $1: path to the binary -# -function openqrm_build_find_libs() { - BINARY=$1 - for LIBRARY in `ldd $BINARY | awk {' print $3 '}`; do - REAL_LIBRARYFILE=`readlink $LIBRARY` - if [ "$REAL_LIBRARYFILE" == "" ]; then - REAL_LIBRARYFILE=`basename $LIBRARY` - fi - FULL_PATH_TO_LIBRARY=`dirname $LIBRARY` - if [ "$FULL_PATH_TO_LIBRARY" != "." ]; then - echo $FULL_PATH_TO_LIBRARY/$REAL_LIBRARYFILE - fi - done -} - - - -# -# Check requirements for the compile phase -# -> this is for "make all" / compilation phase -# -function openqrm_check_build_requirements() { - echo "Checking requirements for the compilation phase" - export FORCE_INSTALL=true - # check which command to use for checking the requirements - if [ -f /etc/debian_version ]; then - OPENQRM_PACKAGE_TYPE=deb - OPENQRM_REQUIREMENTS_CHECK_COMMAND="dpkg -L" - elif [ -f /etc/redhat-release ]; then - OPENQRM_PACKAGE_TYPE=rpm - OPENQRM_REQUIREMENTS_CHECK_COMMAND="rpm -qs" - elif [ -f /etc/SuSE-release ]; then - OPENQRM_PACKAGE_TYPE=rpm - OPENQRM_REQUIREMENTS_CHECK_COMMAND="rpm -qs" - else - echo "NOTICE: Could not find out which compile-requirements to use" - echo " Please make sure to have all needed components installed!" - sleep 4 - echo "... Continuing anyway" - return 0 - fi - - # check for required packages and install them if possible - echo "openqrm-server requires: $OPENQRM_SERVER_BUILD_REQUIREMENTS" - for DEP in `echo $OPENQRM_SERVER_BUILD_REQUIREMENTS | sed -e "s/,//g"`; do - if $OPENQRM_REQUIREMENTS_CHECK_COMMAND $DEP 1>/dev/null 2>&1; then - print_message "found $DEP installed" bold - else - print_notice "Trying to automatically install $DEP ..." - openqrm_install_os_dependency $DEP - if [ $? != 0 ]; then - print_error "$DEP could not be installed. Please install manually to continue" - return 1 - fi - fi - done - - # check if the build tmp directory is writable - if [ ! -d "$OPENQRM_BUILD_TMP_DIR" ]; then - if ! mkdir -p "$OPENQRM_BUILD_TMP_DIR"; then - print_error "$OPENQRM_BUILD_TMP_DIR could not be created by user `whoami`." - return 1; - fi - elif [ ! -w "$OPENQRM_BUILD_TMP_DIR" -o ! -x "$OPENQRM_BUILD_TMP_DIR" ]; then - print_error "$OPENQRM_BUILD_TMP_DIR must exist and be writable by user `whoami`." - return 1; - fi - - # get a list of plugins for checking their requirements - OPENQRM_PACKAGE_COMPONENT_LIST=`ls $OPENQRM_SOURCE_DIR/plugins | grep -v Makefile | grep -v CVS` - for OPENQRM_PLUGIN in $OPENQRM_PACKAGE_COMPONENT_LIST; do - PLUGIN_CONF=$OPENQRM_SOURCE_DIR/plugins/$OPENQRM_PLUGIN/etc/openqrm-plugin-$OPENQRM_PLUGIN"".conf - if [ -f $PLUGIN_CONF ]; then - . $PLUGIN_CONF - else - print_notice "openqrm-plugin-$OPENQRM_PLUGIN has no config file. Unable to check dependencies!" - continue - fi - echo "openqrm-plugin-$OPENQRM_PLUGIN requires: `echo $OPENQRM_PLUGIN_BUILD_REQUIREMENTS`" - for DEP in `echo $OPENQRM_PLUGIN_BUILD_REQUIREMENTS | sed -e "s/,//g"`; do - if $OPENQRM_REQUIREMENTS_CHECK_COMMAND $DEP 1>/dev/null 2>&1; then - print_message "found $DEP installed" bold - else - echo "NOTICE: Trying to automatically install $DEP ..." - openqrm_install_os_dependency $DEP - if [ $? != 0 ]; then - print_error "$DEP could not be installed. Please install manually to continue" - return 1 - fi - fi - done - done - echo "Checking for required components to compile openQRM finished successfully" - -} - - -# function to download+cache source packages in the package-dir -# -> this is for "make all" / comilation phase -function openqrm_cache_or_download() { - # 1 param: component name - # 2 param: component build config file - OPENQRM_SOURCE_COMPONENT_NAME=$1 - OPENQRM_SOURCE_COMPONENT_BUILD_CONFIG=$2 - if [ "$OPENQRM_SOURCE_COMPONENT_BUILD_CONFIG" == "" ]; then - . $OPENQRM_SOURCE_DIR/etc/build.conf/$OPENQRM_SOURCE_COMPONENT_NAME.conf - else - . $OPENQRM_SOURCE_COMPONENT_BUILD_CONFIG - fi - OPENQRM_SOURCE_COMPONENT_FILE=`basename $OPENQRM_SOURCE_DOWNLOAD` - CURRENT_DIR=`pwd` - if [ -f $OPENQRM_BUILD_TMP_DIR/openqrm-build/$OPENQRM_SOURCE_COMPONENT_NAME/source/$OPENQRM_SOURCE_COMPONENT_FILE ]; then - print_message "-> found component $OPENQRM_SOURCE_COMPONENT_NAME ($OPENQRM_SOURCE_COMPONENT_FILE) already downloaded" bold - else - mkdir -p $OPENQRM_BUILD_TMP_DIR/openqrm-build/$OPENQRM_SOURCE_COMPONENT_NAME/source/ - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/$OPENQRM_SOURCE_COMPONENT_NAME/source/ - if ! wget $OPENQRM_SOURCE_DOWNLOAD; then - print_error "Could not download $OPENQRM_SOURCE_COMPONENT_NAME from " \ - "$OPENQRM_SOURCE_DOWNLOAD" \ - print_error "Please put $OPENQRM_SOURCE_COMPONENT_FILE in " \ - "$OPENQRM_BUILD_TMP_DIR/openqrm-build/$OPENQRM_SOURCE_COMPONENT_NAME/source/" \ - " and try again." - exit 1 - fi - cd $CURRENT_DIR - fi - cd $CURRENT_DIR -} - - - -#function to compile a component from the source -# -> this is for "make all" / compilation phase -function openqrm_compile_from_source() { - # 1 param: component name - # 2 param: component build config file - # optional variables : - # OPENQRM_CONFIGURE command to use for configure (default "./configure" if exists) - # OPENQRM_PRE_MAKE commands to run before make - # OPENQRM_POST_MAKE commands to run after make - OPENQRM_SOURCE_COMPONENT_NAME=$1 - OPENQRM_SOURCE_COMPONENT_BUILD_CONFIG=$2 - if [ "$OPENQRM_SOURCE_COMPONENT_BUILD_CONFIG" == "" ]; then - . $OPENQRM_SOURCE_DIR/etc/build.conf/$OPENQRM_SOURCE_COMPONENT_NAME.conf - else - . $OPENQRM_SOURCE_COMPONENT_BUILD_CONFIG - fi - OPENQRM_SOURCE_COMPONENT_FILE=`basename $OPENQRM_SOURCE_DOWNLOAD` - CURRENT_DIR=`pwd` - # check if it is already compiled - if [ ! -f $OPENQRM_BUILD_TMP_DIR/openqrm-build/$OPENQRM_SOURCE_COMPONENT_NAME/$OPENQRM_SOURCE_BINARY_RESULT ]; then - # nope, then we have to build it - # unpack - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/$OPENQRM_SOURCE_COMPONENT_NAME/ - OPENQRM_SOURCE_COMPONENT_FILE_TYPE=`echo $OPENQRM_SOURCE_COMPONENT_FILE | sed -e "s/.*\.//g"` - if [ "$OPENQRM_SOURCE_COMPONENT_FILE_TYPE" == "bz2" ]; then - tar -xjf source/$OPENQRM_SOURCE_COMPONENT_FILE - else - tar -xzf source/$OPENQRM_SOURCE_COMPONENT_FILE - fi - cd $OPENQRM_SOURCE_COMPONENT_NAME-$OPENQRM_SOURCE_VERSION - - # configure - if [ "$OPENQRM_CONFIGURE" != "" ]; then - $OPENQRM_CONFIGURE - elif [ -f ./configure ]; then - chmod +x ./configure && ./configure - fi - - # pre-make - eval $OPENQRM_PRE_MAKE - - # make - make $OPENQRM_MAKE_TARGET - # we do not run make install, if needed pls run it in post-make - - # post-make - eval $OPENQRM_POST_MAKE - - unset OPENQRM_CONFIGURE OPENQRM_PRE_MAKE OPENQRM_POST_MAKE - cd $CURRENT_DIR - else - print_message "-> Found $OPENQRM_SOURCE_BINARY_RESULT already in the build-cache" bold - print_message "-> Skipping compilation, taking the ready built component from the cache" bold - fi -} - - - -# function to create the default initrd-template during the compile stage -# -> this is for "make install" / installation phase -function openqrm_create_default_initrd_template() { - - CURRENT_DIR=`pwd` - OPENQRM_SOURCE_DIR_FULL_PATH=`cd $OPENQRM_SOURCE_DIR && pwd && cd $CURRENT_DIR` - echo "Creating the default initrd-template" - # install build deps - export FORCE_INSTALL=true - if [ -f /etc/debian_version ]; then - openqrm_install_os_dependency gcc - openqrm_install_os_dependency rpcbind - openqrm_install_os_dependency rsync - openqrm_install_os_dependency zlib1g-dev - openqrm_install_os_dependency netbase - openqrm_install_os_dependency patch - openqrm_install_os_dependency lvm2 - openqrm_install_os_dependency ethtool - openqrm_install_os_dependency dropbear - openqrm_install_os_dependency acpid - elif [ -f /etc/redhat-release ]; then - openqrm_install_os_dependency gcc - openqrm_install_os_dependency glibc-static - openqrm_install_os_dependency rpcbind - openqrm_install_os_dependency rsync - openqrm_install_os_dependency zlib-devel - openqrm_install_os_dependency zlib-static - openqrm_install_os_dependency lvm2 - openqrm_install_os_dependency ethtool - openqrm_install_os_dependency dropbear - openqrm_install_os_dependency acpid - elif [ -f /etc/SuSE-release ]; then - openqrm_install_os_dependency gcc - openqrm_install_os_dependency rpcbind - openqrm_install_os_dependency rsync - openqrm_install_os_dependency zlib-devel - openqrm_install_os_dependency lvm2 - openqrm_install_os_dependency ethtool - openqrm_install_os_dependency dropbear - openqrm_install_os_dependency acpid - fi - - # getting + compiling busybox - . $OPENQRM_SOURCE_DIR/etc/build.conf/busybox.conf - openqrm_cache_or_download busybox - OPENQRM_SOURCE_COMPONENT_BUILD_DIR=$OPENQRM_BUILD_TMP_DIR/openqrm-build/busybox/busybox-$OPENQRM_SOURCE_VERSION/ - export OPENQRM_PRE_MAKE="cp $OPENQRM_SOURCE_DIR_FULL_PATH/etc/build.conf/busybox.configuration $OPENQRM_SOURCE_COMPONENT_BUILD_DIR/.config && make oldconfig" - export OPENQRM_POST_MAKE="make install" - openqrm_compile_from_source busybox - unset OPENQRM_PRE_MAKE - unset OPENQRM_POST_MAKE - - # getting pciutils - openqrm_cache_or_download pciutils - # compile static - export LDFLAGS="-static" - # patch for pcimodules - . $OPENQRM_SOURCE_DIR/etc/build.conf/pciutils.conf - OPENQRM_SOURCE_PCIUTILS_DIR="$OPENQRM_BUILD_TMP_DIR/openqrm-build/pciutils/pciutils-$OPENQRM_SOURCE_VERSION/" - export OPENQRM_PRE_MAKE="cd $OPENQRM_SOURCE_PCIUTILS_DIR; patch -p1 < $OPENQRM_SOURCE_DIR/etc/build.conf/pciutils-pcimodules.patch; cd -" - openqrm_compile_from_source pciutils - unset LDFLAGS - unset OPENQRM_PRE_MAKE - unset OPENQRM_POST_MAKE - - # create the initroot - mkdir -p $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot - cp -aR $OPENQRM_SOURCE_COMPONENT_BUILD_DIR/_install/* $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/ - # create symlink to /lib64 for 64bit systems - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/ - ln -sf lib lib64 - cd $CURRENT_DIR - # create lib dir + copy ld-linux - mkdir -p $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/lib - if ls /lib64/ld-* 2>/dev/null 1>&1; then - for LDLINUX in `ls /lib64/ld-*`; do - cp -af $LDLINUX $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/lib/ - if [ -h $LDLINUX ]; then - LDDFILE=`readlink -f $LDLINUX` - LDDIR=`dirname $LDDFILE` - mkdir -p $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/$LDDIR - cp -af $LDDFILE $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/$LDDIR - fi - done - else - for LDLINUX in `ls /lib/ld-*`; do - cp -af $LDLINUX $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/lib/ - if [ -h $LDLINUX ]; then - LDDFILE=`readlink -f $LDLINUX` - LDDIR=`dirname $LDDFILE` - mkdir -p $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/$LDDIR - cp -af $LDDFILE $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/$LDDIR - fi - done - fi - # add the libs busybox depends on - for LIB in `openqrm_build_find_libs $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/bin/busybox`; do - LIB=`echo $LIB | sed -e "s/-[0-9].*.so//g" | sed -e "s/\.so.[0-9].*//g"` - if [ "$LIB" != "/lib/" ]; then - cp -a $LIB""* $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/lib/ - fi - done - # remove wget link - rm -f $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/bin/wget - # add some more utils + their libs - for UTIL in $OPENQRM_INITRD_COMPONENTS; do - cp -a $UTIL $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/bin - echo "Adding $UTIL to default initrd-template" - for LIB in `openqrm_build_find_libs $UTIL`; do - LIB=`echo $LIB | sed -e "s/-[0-9].*.so//g" | sed -e "s/\.so.[0-9].*//g"` - if [ "$LIB" != "/lib/" ]; then - cp -af $LIB""* $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/lib/ - fi - done - done - # fix wget - rm -f $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/usr/bin/wget - # if lvm is a link to lvm.static (e.g. on centos) - if [ -x /sbin/lvm.static ]; then - cp -a /sbin/lvm.static $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/bin/ - fi - # create default udhcpc script - mkdir -p $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/usr/share/udhcpc - cat > $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/usr/share/udhcpc/default.script << EOF -#!/bin/sh -# udhcpc script edited by Tim Riker -# changed by infernix : we don't need to do resolv.conf again -# because we only call this for additional interfaces -[ -z "\$1" ] && echo "Error: should be called from udhcpc" && exit 1 -[ -n "\$broadcast" ] && BROADCAST="broadcast \$broadcast" -[ -n "\$subnet" ] && NETMASK="netmask \$subnet" - -case "\$1" in - deconfig) - ifconfig \$interface 0.0.0.0 - ;; - renew|bound) - ifconfig \$interface \$ip \$BROADCAST \$NETMASK - if [ -n "\$router" ] ; then - echo "deleting routers" - while /sbin/route del default gw 0.0.0.0 dev \$interface ; do - : - done - metric=0 - for i in \$router ; do - /sbin/route add default gw \$i dev \$interface metric \$((metric++)) - done - fi - ;; -esac -exit 0 -EOF - chmod 755 $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/usr/share/udhcpc/default.script - - # take vol_id or blkid - if [ -x /lib/udev/vol_id ]; then - UDEV_UTIL="/lib/udev/vol_id" - elif [ -x /sbin/blkid ]; then - UDEV_UTIL="/sbin/blkid" - fi - cp -a $UDEV_UTIL $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/bin - echo "Adding $UDEV_UTIL to default initrd-template" - for LIB in `openqrm_build_find_libs $UDEV_UTIL`; do - LIB=`echo $LIB | sed -e "s/-[0-9].*.so//g" | sed -e "s/\.so.[0-9].*//g"` - if [ "$LIB" != "/lib/" ]; then - cp -af $LIB""* $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/lib/ - fi - done - if [ "$UDEV_UTIL" == "/sbin/blkid" ]; then - cp -af $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/bin/blkid $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/bin/vol_id - fi - - - # fix reboot for the initrd -> reboot -f (it's simply faster) - rm -f $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/sbin/reboot - cat >> $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/sbin/reboot << EOF -#!/bin/bash -/bin/busybox reboot -f -EOF - chmod +x $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/sbin/reboot - # create shutdown from reboot - cp -af $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/sbin/reboot $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/sbin/shutdown - # creating initrd directories - for DIR in $OPENQRM_INITRD_DIRECTORIES; do - mkdir -p $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/$DIR - done - touch $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/var/lib/nfs/rmtab - touch $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/var/lib/nfs/xtab - touch $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/var/lib/nfs/etab - touch $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/var/lib/nfs/state - # prepare etc - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/etc - ln -sf /proc/mounts mtab - ln -sf rc.d/init.d init.d - touch localtime - # create shells file - echo "/bin/bash" > shells - echo "none /dev/pts devpts gid=0,mode=620 0 0" > fstab - # passwd + group - echo "root:x:0:0:root:/root:/bin/bash" > passwd - echo "rpc:x:100:100:rpc:/tmp:/bin/bash" >> passwd - echo "root:x:0:root" > group - echo "rpc:x:100:root" >> group - # hosts - echo "127.0.0.1" > hosts - # netconfig ? fedora has + needs it - if [ -f "/etc/netconfig" ]; then - cp -a /etc/netconfig . - fi - # services - cp -a /etc/services . - # nsswitch - echo "passwd: files" > nsswitch.conf - echo "shadow: files" >> nsswitch.conf - echo "group: files" >> nsswitch.conf - # cp libnss - if ls /lib64/libnss_files* 2>/dev/null 1>&1; then - cp -aR /lib64/libnss_files* $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/lib/ - else - cp -aR /lib/libnss_files* $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/lib/ 2>/dev/null - fi - if ls /lib/x86_64-linux-gnu/libnss_files* 2>/dev/null 1>&1; then - mkdir -p $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/lib/x86_64-linux-gnu/ - cp -aR /lib/x86_64-linux-gnu/libnss_files* $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/lib/x86_64-linux-gnu/ - fi - - # installing pciutils + pcimodules - cp -a $OPENQRM_SOURCE_PCIUTILS_DIR/lspci $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/sbin/ - cp -a $OPENQRM_SOURCE_PCIUTILS_DIR/pcimodules $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/sbin/ - # installing dropbear - DROPBEAR_BIN=`which dropbear` - DBCLIENT_BIN=`which dbclient` - DROPBEARKEY_BIN=`which dropbearkey` - cp -a $DROPBEAR_BIN $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/sbin/ - cp -a $DBCLIENT_BIN $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/bin/ - cp -a $DROPBEARKEY_BIN $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/bin/ - # install dropbear libs - for LIB in `openqrm_build_find_libs $DROPBEAR_BIN`; do - LIB=`echo $LIB | sed -e "s/-[0-9].*.so//g" | sed -e "s/\.so.[0-9].*//g"` - if [ "$LIB" != "/lib/" ]; then - cp -af $LIB""* $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/lib/ - fi - done - # creating the initrd devices - cp -a $OPENQRM_SOURCE_DIR_FULL_PATH/etc/build.conf/initrd-devices.conf $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/etc/ - rm -rf $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/dev - mkdir -p $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/dev - # copy acpi config - if [ -d /etc/acpi ]; then - cp -aR /etc/acpi $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/etc/ - fi - # create rcS - rm -f $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/etc/rc.d/init.d/rcS - cat >> $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/etc/rc.d/init.d/rcS << EOF -#!/bin/bash -export SHELL=/bin/bash -export \$(eval cat /proc/cmdline) -echo "openQRM resource \$id is starting rcS" > /dev/console - -EOF - chmod +x $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/etc/rc.d/init.d/rcS - - # create inittab - rm -f $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/etc/inittab - cat >> $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/etc/inittab << EOF - -# inittab -::askfirst:-/bin/bash -tty2::askfirst:-/bin/bash -tty3::askfirst:-/bin/bash -tty4::askfirst:-/bin/bash -::sysinit:/etc/init.d/rcS -::restart:/sbin/reboot - -# Stuff to do before rebooting -::ctrlaltdel:/sbin/reboot -::shutdown:/sbin/halt - -EOF -} - - -# function to create a tgz file out of the initroot/initrd-content -# -> this is for "make install" / installation phase -function openqrm_pack_default_initrd_template() { - # pack - CURRENT_DIR=`pwd` - OPENQRM_SOURCE_DIR_FULL_PATH=`cd $OPENQRM_SOURCE_DIR && pwd && cd $CURRENT_DIR` - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/sbin $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/bin - # create the initrd package fitting to the build arch + distri - KERNEL_ARCH=`uname -m` - if echo $KERNEL_ARCH | grep i.*86 1>/dev/null; then - # i386 - OPENQRM_CLIENT_ARCH=i386 - else - OPENQRM_CLIENT_ARCH=x86_64 - fi - # find out the short distri name - if [ -f /etc/debian_version ]; then - # debian or ubuntu, try to find out without lsb-release which may not be installed - if grep -i ubuntu /etc/apt/sources.list 1>/dev/null; then - OPENQRM_SHORT_DISTRI_NAME="ubuntu" - else - OPENQRM_SHORT_DISTRI_NAME="debian" - fi - elif [ -f /etc/redhat-release ]; then - OPENQRM_SHORT_DISTRI_NAME="centos" - fi - rm -f $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-template.$OPENQRM_SHORT_DISTRI_NAME.$OPENQRM_CLIENT_ARCH.tgz - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/initroot/ - tar -czf $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-template.$OPENQRM_SHORT_DISTRI_NAME.$OPENQRM_CLIENT_ARCH.tgz * - cd $CURRENT_DIR - echo "Created initrd-template $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-template.$OPENQRM_SHORT_DISTRI_NAME.$OPENQRM_CLIENT_ARCH.tgz" -} - - -# function to provide adodb for Suse+Redhat systems only -# -> this is for "make" phase -function openqrm_get_adodb() { - if [ ! -f /etc/debian_version ]; then - CURRENT_DIR=`pwd` - openqrm_cache_or_download adodb - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/adodb/ - tar -xzf source/adodb*.tgz - cd $CURRENT_DIR - fi -} - -# function to install adodb for Suse + Redhat systems only -# -> this is for "make install" phase -function openqrm_install_adodb() { - if [ ! -f /etc/debian_version ]; then - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/adodb/adodb $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/include/ - fi -} - - - -# function to provide the api-documentation -# -> this is for "make" phase -function openqrm_get_api_docu() { - CURRENT_DIR=`pwd` - openqrm_cache_or_download openqrm-api-docu - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/openqrm-api-docu/ - tar -xzf source/openqrm-api-docu-$OPENQRM_SERVER_VERSION.tgz - cd $CURRENT_DIR -} - -# function to install the api-documentation -# -> this is for "make install" phase -function openqrm_install_api_docu() { - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/server/zz_documentation/api - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/openqrm-api-docu/openqrm-api-docu-$OPENQRM_SERVER_VERSION/* $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/server/zz_documentation/api/ -} - - -# function to get the jquery bundle -# -> this is for "make " phase -function openqrm_get_jquery_bundle() { - # TODO gather version from build.conf file - JQUERY_VERSION="1.3.2" - CURRENT_DIR=`pwd` - openqrm_cache_or_download jquery - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/jquery/ - tar -xzf source/jquery-$JQUERY_VERSION.tgz - cd $CURRENT_DIR -} - -# function to install the jquery-bundle -# -> this is for "make install" phase -function openqrm_install_jquery_bundle() { - - JQUERY_VERSION="1.3.2" - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/js/jquery - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/css/jquery - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/jquery/jquery-$JQUERY_VERSION/* $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/js/jquery/ - - # exclude .txt files - rm -f $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/js/jquery/development-bundle/*.txt - - # css - rm -rf $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/js/jquery/css - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/jquery/jquery-$JQUERY_VERSION/css/* $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/css/jquery/ - - # also install it for the cloud plugin - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/user/js - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/user/css - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/jquery/jquery-$JQUERY_VERSION/* $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/user/js/ - - # exclude .txt files - rm -f $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/user/js/development-bundle/*.txt - - # css - rm -rf $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/user/js/css - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/jquery/jquery-$JQUERY_VERSION/css/* $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/user/css/ - - # also install it for the cloud-zones plugin - if [ -d $OPENQRM_SOURCE_DIR/plugins/cloud-zones ]; then - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud-zones/cloud-portal/web/user/js - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud-zones/cloud-portal/web/user/css - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/jquery/jquery-$JQUERY_VERSION/* $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud-zones/cloud-portal/web/user/js/ - # exclude .txt files - rm -f $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud-zones/cloud-portal/web/user/js/development-bundle/*.txt - # css - rm -rf $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud-zones/cloud-portal/web/user/js/css - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/jquery/jquery-$JQUERY_VERSION/css/* $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud-zones/cloud-portal/web/user/css/ - fi - -} - - -# function to get the interface js -# -> this is for "make " phase -function openqrm_get_js_interface() { - # TODO gather version from build.conf file - INTERFACE_VERSION="1.2" - CURRENT_DIR=`pwd` - openqrm_cache_or_download js-interface - rm -rf "$OPENQRM_BUILD_TMP_DIR/openqrm-build/js-interface/interface $INTERFACE_VERSION" - rm -rf "$OPENQRM_BUILD_TMP_DIR/openqrm-build/js-interface/interface_$INTERFACE_VERSION" - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/js-interface/ - unzip -q source/interface_$INTERFACE_VERSION.zip - for f in *; do mv "$f" `echo $f | tr ' ' '_'` 2>/dev/null; done - cd $CURRENT_DIR -} - - -# function to install the jquery-bundle -# -> this is for "make install" phase -function openqrm_install_js_interface() { - INTERFACE_VERSION="1.2" - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/js/interface - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/js-interface/interface_$INTERFACE_VERSION/interface.js $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/js/interface/ - # also install it for the cloud plugin - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/user/js - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/js-interface/interface_$INTERFACE_VERSION/interface.js $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/user/js/ - # also install it for the cloud-zones plugin - if [ -d $OPENQRM_SOURCE_DIR/plugins/cloud-zones ]; then - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud-zones/cloud-portal/web/user/js - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/js-interface/interface_$INTERFACE_VERSION/interface.js $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud-zones/cloud-portal/web/user/js/ - fi -} - - - -# function to get the htmlobjects -# -> this is for "make " phase -function openqrm_get_htmlobjects() { - HTMLOBJECTS_VERSION="v1.1_r193" - CURRENT_DIR=`pwd` - openqrm_cache_or_download htmlobjects - rm -rf "$OPENQRM_BUILD_TMP_DIR/openqrm-build/htmlobjects/htmlobjects" - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/htmlobjects/ - tar -xzf source/htmlobjects_$HTMLOBJECTS_VERSION.tar.gz - cd $CURRENT_DIR -} - - -# function to install the htmlobjects -# -> this is for "make install" phase -function openqrm_install_htmlobjects() { - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/class/htmlobjects - cp -aR $OPENQRM_BUILD_TMP_DIR/openqrm-build/htmlobjects/htmlobjects/* $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/class/htmlobjects/ -} - - - -# function to get the jqClock jquery plugin -# -> this is for "make " phase -function openqrm_get_jqclock() { - JQCLOCK_VERSION="2.0.1" - CURRENT_DIR=`pwd` - openqrm_cache_or_download jqclock - rm -rf "$OPENQRM_BUILD_TMP_DIR/openqrm-build/jqclock/jqclock" - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/jqclock/ - tar -xzf source/jqclock-$JQCLOCK_VERSION.tgz - cd $CURRENT_DIR -} - - -# function to install the jqClock jquery plugin -# -> this is for "make install" phase -function openqrm_install_jqclock() { - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/js - cp -aR $OPENQRM_BUILD_TMP_DIR/openqrm-build/jqclock/jqClock.min.js $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/js/ -} - - -# function to get the treemenu.js -# -> this is for "make " phase -function openqrm_get_treemenu_js() { - TREEMENUJS_VERSION="0.1" - CURRENT_DIR=`pwd` - openqrm_cache_or_download treemenujs - rm -rf "$OPENQRM_BUILD_TMP_DIR/openqrm-build/treemenujs/treemenujs" - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/treemenujs/ - tar -xzf source/treemenu-js.$TREEMENUJS_VERSION.tgz - cd $CURRENT_DIR -} - - -# function to install the treemenu.js -# -> this is for "make install" phase -function openqrm_install_treemenu_js() { - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/js - cp -aR $OPENQRM_BUILD_TMP_DIR/openqrm-build/treemenujs/treemenu.js $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/js/ - cp -aR $OPENQRM_BUILD_TMP_DIR/openqrm-build/treemenujs/menu.js $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/js/ -} - - -# function to get the treemenu icons -# -> this is for "make " phase -function openqrm_get_treemenu_icons() { - TREEMENU_ICONS_VERSION="0.1" - CURRENT_DIR=`pwd` - openqrm_cache_or_download treemenuicons - rm -rf "$OPENQRM_BUILD_TMP_DIR/openqrm-build/treemenuicons/treemenuicons" - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/treemenuicons/ - tar -xzf source/treemenu-icons.$TREEMENU_ICONS_VERSION.tgz - cd $CURRENT_DIR -} - - -# function to install the treemenu icons -# -> this is for "make install" phase -function openqrm_install_treemenu_icons() { - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu - cp -aR $OPENQRM_BUILD_TMP_DIR/openqrm-build/treemenuicons/*.png $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu -} - - - -# function to get the phplib class -# -> this is for "make " phase -function openqrm_get_phplib() { - CURRENT_DIR=`pwd` - openqrm_cache_or_download phplib - cd $OPENQRM_BUILD_TMP_DIR/openqrm-build/phplib/ - tar -xzf source/phplib.tgz - cd $CURRENT_DIR -} - - -# function to install the phplib class -# -> this is for "make install" phase -function openqrm_install_phplib() { - mkdir -p $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/class - cp -aR $OPENQRM_BUILD_TMP_DIR/openqrm-build/phplib/*.php $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/class/ -} - - -# function to get the additional initrd-templates -# -> this is for "make " phase -function openqrm_get_initrd_templates() { -# openqrm_cache_or_download openqrm-initrd-template.centos.i386 - openqrm_cache_or_download openqrm-initrd-template.centos.x86_64 -# openqrm_cache_or_download openqrm-initrd-template.debian.i386 - openqrm_cache_or_download openqrm-initrd-template.debian.x86_64 -# openqrm_cache_or_download openqrm-initrd-template.ubuntu.i386 - openqrm_cache_or_download openqrm-initrd-template.ubuntu.x86_64 -} - - -# function to install the additional initrd-templates -# -> this is for "make install" phase -function openqrm_install_initrd_templates() { - - CLIENT_VERSION="5.3.1" - KERNEL_ARCH=`uname -m` - if echo $KERNEL_ARCH | grep i.*86 1>/dev/null; then - # i386 - OPENQRM_CLIENT_ARCH=i386 - else - OPENQRM_CLIENT_ARCH=x86_64 - fi - # find out the short distri name - if [ -f /etc/debian_version ]; then - # debian or ubuntu, try to find out without lsb-release which may not be installed - if grep -i ubuntu /etc/apt/sources.list 1>/dev/null; then - OPENQRM_SHORT_DISTRI_NAME="ubuntu" - else - OPENQRM_SHORT_DISTRI_NAME="debian" - fi - elif [ -f /etc/redhat-release ]; then - OPENQRM_SHORT_DISTRI_NAME="centos" - elif [ -f /etc/SuSE-release ]; then - OPENQRM_SHORT_DISTRI_NAME="centos" - fi - -# cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/openqrm-initrd-template.centos.i386/source/openqrm-initrd-template.$CLIENT_VERSION.centos.i386.tgz $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-template.centos.i386.tgz - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/openqrm-initrd-template.centos.x86_64/source/openqrm-initrd-template.$CLIENT_VERSION.centos.x86_64.tgz $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-template.centos.x86_64.tgz - -# cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/openqrm-initrd-template.debian.i386/source/openqrm-initrd-template.$CLIENT_VERSION.debian.i386.tgz $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-template.debian.i386.tgz - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/openqrm-initrd-template.debian.x86_64/source/openqrm-initrd-template.$CLIENT_VERSION.debian.x86_64.tgz $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-template.debian.x86_64.tgz - -# cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/openqrm-initrd-template.ubuntu.i386/source/openqrm-initrd-template.$CLIENT_VERSION.ubuntu.i386.tgz $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-template.ubuntu.i386.tgz - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/openqrm-initrd-template.ubuntu.x86_64/source/openqrm-initrd-template.$CLIENT_VERSION.ubuntu.x86_64.tgz $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-template.ubuntu.x86_64.tgz - - # set the default initrd template for creating the default kernel during init - cp -a $OPENQRM_BUILD_TMP_DIR/openqrm-build/openqrm-initrd-template.$OPENQRM_SHORT_DISTRI_NAME.$OPENQRM_CLIENT_ARCH/source/openqrm-initrd-template.$CLIENT_VERSION.$OPENQRM_SHORT_DISTRI_NAME.$OPENQRM_CLIENT_ARCH.tgz $DESTINATION_DIR$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-default.tgz - -} - - - -# -------------------------------------------------------------------- -# ------------------------- update function -------------------------- -# -------------------------------------------------------------------- - -# function to run commands before the update of openQRM -function openqrm_pre_update() { - $OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm-update pre -f -} - -# function to run commands after the update of openQRM -function openqrm_post_update() { - $OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm-update post -f -} - -# function to update openQRM base -function openqrm_base_update() { - $OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm-update base -f -} - -# function to update the openQRM initrds -function openqrm_initrd_update() { - $OPENQRM_SERVER_BASE_DIR/openqrm/bin/openqrm-update initrds -f -} - - - - - - diff --git a/openQRM-5.3.50-CE/src/include/openqrm-functions b/openQRM-5.3.50-CE/src/include/openqrm-functions deleted file mode 100644 index ae3547a..0000000 --- a/openQRM-5.3.50-CE/src/include/openqrm-functions +++ /dev/null @@ -1,813 +0,0 @@ -#!/bin/bash -# this is the main function file for openQRM -# only general + generic functions should go in here -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SERVER_BASE_DIR before sourcing $0" - exit 1 -fi -# some static defines -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -OPENQRM_CMD_QUEUE_STARTING_LOCK="/var/run/openqrm/starting-queue-command.lock" - -# be sure cmd output is english -export LANGUAGE=C -export LANG=C -export LC_ALL=C - -# A more portable "chkconfig". -# Uses chkconfig or rc.d-update as found, if not then "manual". -function openqrm_chkconfig() { - action="$1" - service="$2" - - if [ $action != "add" ] && [ $action != "del" ] ; then - echo "openqrm_chkconfig: action must be either \"add\" or \"del\"" - return 1 - fi - if [ -z "${service}" ] ; then - echo "openqrm_chkconfig: service must be valid service name" - return 1 - fi - - - -# # For systemd - if [ -x /bin/systemd ] || [ -x /usr/bin/systemd ] ; then - - case $action in - add) - if [ ! -d /etc/systemd/system/ ] ; then - mkdir -p /etc/systemd/system/ - fi - if [ "${service}" == "openqrm-client" ] ; then - cp $OPENQRM_SERVER_BASE_DIR/openqrm/etc/systemd/system/openqrm-client.service /etc/systemd/system/openqrm-client.service - fi - /bin/systemctl enable ${service} - /bin/systemctl daemon-reload - ;; - del) - /bin/systemctl disable ${service} - /bin/systemctl daemon-reload - ;; - esac - -# # For Redhat/SuSe - elif [ -x /sbin/chkconfig ] ; then - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/openqrm-client /etc/init.d/openqrm-client - - case $action in - add) - local do_chkconfig=1 - # check if the init is not configured - chkconfig --list ${service} > /dev/null 2>&1 && do_chkconfig= - - # maybe it is configured, but for our runlevel not (tam) - if [ -z "$do_chkconfig" ]; then - do_chkconfig=1 - local runlevel=$(grep initdefault /etc/inittab | grep id |cut -d ':' -f2) - for f in /etc/rc${runlevel}.d/S??${service} /etc/init.d/rc${runlevel}.d/S??${service}; do - [ -e $f ] && do_chkconfig= - done - fi - if [ $do_chkconfig ]; then - chkconfig --add ${service} - if [ ! -f /etc/UnitedLinux-release ]; then - chkconfig ${service} on - else - chkconfig --add ${service} - fi - fi - ;; - del) - #check if service exists - if chkconfig --list ${service} > /dev/null 2>&1 ; then - chkconfig --del ${service} - fi - ;; - - esac - # For Debian/Ubuntu - elif [ -x /usr/sbin/update-rc.d ] ; then - # according to manuals, update-rc.d does nothing if links already exist - - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/openqrm-client /etc/init.d/openqrm-client - - if [ $action == "add" ] ; then - # check for start + stop leven - start_l=`grep chkconfig /etc/init.d/${service} | grep ^'#' | awk {' print $4 '}` - stop_l=`grep chkconfig /etc/init.d/${service} | grep ^'#' | awk {' print $5 '}` - update-rc.d ${service} defaults $start_l $stop_l - # check for upstart - if [ "$service" == "openqrm" ]; then - # debian 6 using insserv, be sure to start in rc 2 - /bin/cp -a /etc/rc3.d/S*openqrm /etc/rc2.d/ - if [ -d /etc/init/ ]; then - echo '# openQRM - starts openQRM' > /etc/init/openqrm.conf - echo 'description "openQRM Server"' >> /etc/init/openqrm.conf - echo 'start on net-device-up' >> /etc/init/openqrm.conf - echo 'exec /etc/init.d/openqrm start' >> /etc/init/openqrm.conf - fi - fi - if [ "$service" == "openqrm-client" ]; then - # debian 6 using insserv, be sure to start in rc 2 - /bin/cp -a /etc/rc3.d/S*openqrm-client /etc/rc2.d/ - if [ -d /etc/init/ ]; then - echo '# openQRM Client - starts openQRM Client' > /etc/init/openqrm-client.conf - echo 'description "openQRM Client"' >> /etc/init/openqrm-client.conf - echo 'start on net-device-up' >> /etc/init/openqrm-client.conf - echo 'exec /etc/init.d/openqrm-client start' >> /etc/init/openqrm-client.conf - fi - fi - if [ "$service" == "openqrm-local-vm-client" ]; then - # debian 6 using insserv, be sure to start in rc 2 - /bin/cp -a /etc/rc3.d/S*openqrm-local-vm-client /etc/rc2.d/ - if [ -d /etc/init/ ]; then - echo '# openQRM Client - starts openQRM Client' > /etc/init/openqrm-local-vm-client.conf - echo 'description "openQRM Client"' >> /etc/init/openqrm-local-vm-client.conf - echo 'start on net-device-up' >> /etc/init/openqrm-local-vm-client.conf - echo 'exec /etc/init.d/openqrm-local-vm-client start' >> /etc/init/openqrm-local-vm-client.conf - fi - fi - elif [ $action == "del" ] ; then - update-rc.d -f ${service} remove 1>/dev/null 2>&1 - # check for upstart - if [ "$service" == "openqrm-client" ]; then - # debian 6 using insserv, remove from rc 2 - rm -f /etc/rc2.d/S*openqrm-client - if [ -e /etc/init/openqrm-client.conf ]; then - rm -f /etc/init/openqrm-client.conf - fi - fi - if [ "$service" == "openqrm" ]; then - rm -f /etc/rc2.d/S*openqrm - if [ -e /etc/init/openqrm.conf ]; then - rm -f /etc/init/openqrm.conf - fi - fi - if [ "$service" == "openqrm-local-vm-client" ]; then - rm -f /etc/rc2.d/S*openqrm-local-vm-client - if [ -e /etc/init/openqrm-local-vm-client.conf ]; then - rm -f /etc/init/openqrm-local-vm-client.conf - fi - fi - fi - # "Manual". Uses S91 by default - else - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/openqrm-client /etc/init.d/openqrm-client - - # Get default runlevel - runlevel=$( grep default /etc/inittab | grep ^id: | cut -f 2 -d: ) - - # Find directory for script links - if [ -d /etc/rc.d/ ] ; then - rcdir=/etc/rc.d/rc${runlevel}.d - else - rcdir=/etc/rc${runlevel}.d - fi - - if [ $action == "add" ] ; then - if [ ! -f $rcdir/S??${service} ] && [ -f /etc/init.d/${service} ] ; then - ln -s /etc/init.d/${service} $rcdir/S91${service} - fi - elif [ $action == "del" ] ; then - if [ -f $rcdir/S??${service} ] ; then - rm $rcdir/S??${service} - fi - fi - fi - return 0 -} - - - -# create short name for distro for the package stage -function openqrm_get_distro() { - # find out which distribution it is - # find out which version it is - # give the ROOT_DIR as the first cmdline param - local ROOT_DIR=${1:-/} - if [ -f $ROOT_DIR/etc/fedora-release ]; then - RELEASE=$(cat $ROOT_DIR/etc/fedora-release | head -1) - case $RELEASE in - *Fedora*9*) - echo "fedora9" - ;; - *Fedora*10*) - echo "fedora10" - ;; - *) - echo "fedora" - ;; - esac - elif [ -f $ROOT_DIR/etc/redhat-release ]; then - RELEASE=$(cat $ROOT_DIR/etc/redhat-release | head -1) - case $RELEASE in - *Werewolf*) - echo "fc8" - ;; - *Moonshine*) - echo "fc7" - ;; - *Zod*) - echo "fc6" - ;; - *Bordeaux*) - echo "fc5" - ;; - *Stentz*) - echo "fc4" - ;; - *Nahant*) - echo "el4" - ;; - *Shrike*) - echo "rh9" - ;; - *Psyche*) - echo "rh8" - ;; - *Valhalla*) - echo "rh73" - ;; - *Taroon*) - echo "el3" - ;; - *CentOS*5*) - echo "centos5" - ;; - *CentOS*6*) - echo "centos6" - ;; - *CentOS*7*) - echo "centos7" - ;; - *) - echo "rh" - ;; - esac - elif [ -f $ROOT_DIR/etc/UnitedLinux-release ]; then - RELEASE=$(cat $ROOT_DIR/etc/UnitedLinux-release | head -1) - case $RELEASE in - *UnitedLinux*) - echo "suse8" - ;; - *) - echo "suse" - ;; - esac - elif [ -f $ROOT_DIR/etc/SuSE-release ]; then - RELEASE=$(cat $ROOT_DIR/etc/SuSE-release | head -1) - case $RELEASE in - *openSUSE*10*) - echo "opensuse10" - ;; - *SUSE*9*) - echo "suse9" - ;; - *SUSE*10*) - echo "suse10" - ;; - *SUSE*11*) - echo "suse11" - ;; - *) - echo "suse" - ;; - esac - - elif [ -f $ROOT_DIR/etc/debian_version ]; then - RELEASE=$(cat $ROOT_DIR/etc/debian_version | head -1) - case $RELEASE in - *3.1*) - echo "debian31" - ;; - *4.0*) - echo "debian40" - ;; - *5.0*) - echo "debian50" - ;; - *lenny/sid*) - if [ -f $ROOT_DIR/etc/lsb-release ]; then - if grep hardy $ROOT_DIR/etc/lsb-release 1>/dev/null; then - echo "ubuntu804" - elif grep intrepid $ROOT_DIR/etc/lsb-release 1>/dev/null; then - echo "ubuntu810" - else - echo "ubuntu804" - fi - else - echo "ubuntu804" - fi - ;; - *) - echo "debian" - ;; - esac - else - echo "generic" - fi -} - -# -# get the distribution name -# $1: root directory of the installation (optional; default is "/") -# returns: one of fedora|rhel|suse|ubuntu|debian|unknown -# -function openqrm_get_distro_name() { - local ROOT_DIR=${1:-/} - if [-f "$ROOT_DIR/etc/fedora-release" ]; then - echo "fedora" - elif [ -f "$ROOT_DIR/etc/redhat-release" ]; then - # CentOS uses /etc/redhat-release, too - echo 'rhel'; - elif [ -f "$ROOT_DIR/etc/UnitedLinux-release" ]; then - echo "suse" - elif [ -f "$ROOT_DIR/etc/SuSE-release" ]; then - echo "suse" - elif [ -f "$ROOT_DIR/etc/ubuntu_version" ]; then - echo "ubuntu" - elif [ -f "$ROOT_DIR/etc/debian_version" ]; then - echo "debian" - else - echo "unknown" - fi -} - -# -# get the distribution's version -# -# you can choose to get the result as integer or as string. Use the integer -# output if you want to have a condition like distro_version > 100 (equals 10.0) -# Use string output for user-visible display. Default is "string". -# -# Note one Debian specific feature: if testing/unstable is installed (there is no -# version number for these), "string" will return "testing/unstable", "integer" -# returns -1! -# -# Note that old Redhat releases (before 2003, ending with Redhat 9) are NOT -# supported. There is only RedHat Enterprise (RHEL) and Fedora. -# -# integer will return -# - version * 10 (e.g. 103 instead of 10.3) for Debian and SUSE -# - version for RHEL/CentOS and Fedora -# -# FIXME: use lsb_release as soon as it is usable by many distributions -# (required since LSB 3.0, but not installed by default on RHEL/CentOS) -# -# -# $1: string|integer return as integer or as string (optional; default is string) -# $2: root directory of the installation (optional; default is "/") -# returns: the distribution's version number -# -function openqrm_get_distro_version() { - local RETURN_AS=$1 - if [ "$1" == '' ]; then - RETURN_AS=string - fi - - case `openqrm_get_distro_name()` in - "suse") - # tested with: openSUSE 10.3 - # XXX: This is not tested for SLES/SLED yet - if [ $RETURN_AS == 'string' ]; then - local VERSION=$(cat "$ROOT_DIR/etc/SuSE-release" | tail -1 | sed 's/VERSION = \([0-9]\+\.[0-9]\)/\1/') - echo $VERSION - elif [ $RETURN_AS == 'integer' ]; then - local VERSION=$(cat "$ROOT_DIR/etc/SuSE-release" | tail -1 | sed 's/VERSION = \([0-9]\+\)\.\([0-9]\)/\1\2/') - echo $VERSION - fi - ;; - "rhel") - # tested with: CentOS 5.1 - # XXX: RHEL/CentOS does not give us the service release number (e.g. only 5 instead of 5.1) - local VERSION=$(cat "$ROOT_DIR/etc/redhat-release" | head -n1 | sed 's/.*release \([0-9]\+\).*/\1/') - echo $VERSION - ;; - "fedora") - # tested with: Fedora Core 3, Fedora Core 6, Fedora 8 - local VERSION=$(cat "$ROOT_DIR/etc/fedora-release" | head -n1 | sed 's/.*release \([0-9]\+\) .*/\1/') - echo $VERSION - ;; - "debian") - # tested with: 4.0 (etch), unstable/testing - if [ $RETURN_AS == 'string' ]; then - local VERSION=$(cat "$ROOT_DIR/etc/debian_version") - echo $VERSION - elif [ $RETURN_AS == 'integer' ]; then - if [ `cat "$ROOT_DIR/etc/debian_version"` == 'testing/unstable' ]; then - echo -1 - else - local VERSION=$(cat "$ROOT_DIR/etc/debian_version" | sed 's/\([0-9]\+\)\.\([0-9]\)/\1\2/') - echo $VERSION - fi - fi - ;; - *) - echo 0 - ;; - esac -} - - - -# function to send events to the openQRM-server -# param 1 = resource_id -# param 2 = event_name -# param 3 = event_priority -# param 4 = event_source -# param 5 = event_description -function openqrm_post_event() { - resource_id=`urlencodestring $1` - event_name=`urlencodestring $2` - event_priority=`urlencodestring $3` - event_source=`urlencodestring $4` - event_description=`urlencodestring $5` - # are we on the openQRM server or on a resource ? - if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - resource_id=0 - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL - fi - # define wget to use with https - if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" - fi - MESSAGEDATA="resource_id=$resource_id&event_name=$event_name&event_priority=$event_priority&event_source=$event_source&event_description=$event_description"; - OPENQRM_RESOURCE_EVENT_URL="$openqrm_web_protocol://$resource_openqrmserver/openqrm/action/resource-monitor.php?resource_command=post_event&$MESSAGEDATA" - wget -q $WGET_NO_CERT_CHECK -O /dev/null --tries=200 --retry-connrefused -T 10 --random-wait --no-proxy "$OPENQRM_RESOURCE_EVENT_URL" & -} - - - -# a generic function to start portmap -# -> on some systems (e.g. fedora) we need to start rpcbind -function openqrm_portmap_start() { - if which rpcbind 1>/dev/null; then - rpcbind - rpc.statd - else - portmap - fi -} - - - -# a generic function to stop portmap -# -> on some systems (e.g. fedora) we need to stop rpcbind -function openqrm_portmap_stop() { - if which rpcbind 1>/dev/null; then - killall rpc.statd - killall rpcbind - else - killall portmap - fi -} - - - - -# a function to validate an ip address -function openqrm_validate_ip() { - IP_A=$1 - OLDIFS=$IFS - IFS=. - set -- $IP_A - if [ "$#" -ne "4" ]; then - IFS=$OLDIFS - return 1 - fi - - for oct in $1 $2 $3 $4; do - echo $oct | egrep "^[0-9]+$" >/dev/null 2>&1 - if [ "$?" -ne "0" ]; then - IFS=$OLDIFS - return 1 - else - if [ "$oct" -lt "0" -o "$oct" -gt "255" ]; then - IFS=$OLDIFS - return 1 - fi - fi - done - echo "$IP_A" | grep "\.$" >/dev/null 2>&1 - if [ "$?" -eq "0" ]; then - IFS=$OLDIFS - return 1 - fi - IFS=$OLDIFS - return 0 -} - - - - -# a generic function to get the LVM volumes paths -# newer version of lvdisplay (>=2.02.95 in Ubuntu 12.10) output "LV Path" instead of "LV Name" -# https://github.com/stevenshiau/clonezilla/blob/master/sbin/ocs-lvm2-stop -function openqrm_get_lvm_volume_paths() { - if lvdisplay | grep -E "LV Path" 1>/dev/null; then - LVM_VOLME_GREP="LV Path" - else - LVM_VOLME_GREP="LV Name" - fi - lvdisplay | grep "$LVM_VOLME_GREP" | awk {' print $3 '} -} - - - -# reciever command queue locking function, one queue per -# use like : -# LOCK_TIME=`openqrm_lock_queue aquire ` -# run-locked-commands -# openqrm_lock_queue release $LOCK_TIME -# -function openqrm_lock_queue() { - local COMMAND=$1 - local SUBSECTION=$2 - local OPENQRM_CMD_LOCK_FILE=/var/run/openqrm/lock-$SUBSECTION.lock - local OPENQRM_CMD_LOCK_DELAY=2 - local OPENQRM_CMD_LOCK_RETRY=1200 - local OPENQRM_CMD_LOCK_TIMEOUT=240 - local OPENQRM_CMD_QUEUE_WARNING_1=30 - local OPENQRM_CMD_QUEUE_WARNING_2=60 - local OPENQRM_CMD_QUEUE_WARNING_3=90 - - local OPENQRM_CMD_QUEUE_WARNING_LIMIT_1=10 - local OPENQRM_CMD_QUEUE_WARNING_LIMIT_2=50 - local OPENQRM_CMD_QUEUE_WARNING_LIMIT_3=100 - - if [ -f "$OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions" ]; then - resource_id=0 - else - . $OPENQRM_RESOURCE_PARAMETER_FILE - fi - local LOCK_FILE_DIR=`dirname $OPENQRM_CMD_LOCK_FILE` - if [ ! -d "$LOCK_FILE_DIR" ]; then - mkdir -p "$LOCK_FILE_DIR" - fi - case "$COMMAND" in - aquire) - local EXACTNOW=`date +%s%N` - trap "rm -f $OPENQRM_CMD_LOCK_FILE.$EXACTNOW" EXIT - lockfile -s $OPENQRM_CMD_LOCK_DELAY -r $OPENQRM_CMD_LOCK_RETRY -l $OPENQRM_CMD_LOCK_TIMEOUT $OPENQRM_CMD_LOCK_FILE.$EXACTNOW - echo $$ > $OPENQRM_CMD_LOCK_FILE.$EXACTNOW - local LOOP_TIMEOUT=0 - local LOCK_TIMESTAMP_LAST="" - while (:); do - LOCK_TIMESTAMP_NEXT=`ls $OPENQRM_CMD_LOCK_FILE.* 2>/dev/null | cut -d '.' -f3 | sort -g | head -n1 2>/dev/null | grep -v $EXACTNOW` - if [ "$LOCK_TIMESTAMP_NEXT" == "" ]; then - openqrm_post_event $resource_id "aquire $SUBSECTION" 5 "openqrm_lock_queue" "NOTICE: Resource $resource_id running cmd $0 - $EXACTNOW" 1>/dev/null 2>&1 - break - else - if [ "$EXACTNOW" == "$LOCK_TIMESTAMP_NEXT" ]; then - openqrm_post_event $resource_id "aquire $SUBSECTION" 5 "openqrm_lock_queue" "NOTICE: Resource $resource_id running cmd $0 running now - $EXACTNOW == $LOCK_TIMESTAMP_NEXT" 1>/dev/null 2>&1 - break - else - # debug + reporting - if [ "$LOOP_TIMEOUT" == "$OPENQRM_CMD_QUEUE_WARNING_1" ] || [ "$LOOP_TIMEOUT" == "$OPENQRM_CMD_QUEUE_WARNING_2" ] || [ "$LOOP_TIMEOUT" == "$OPENQRM_CMD_QUEUE_WARNING_3" ]; then - BLOCK_PID=`cat $OPENQRM_CMD_LOCK_FILE.$LOCK_TIMESTAMP_NEXT 2>/dev/null` - openqrm_post_event $resource_id "aquire $SUBSECTION" 5 "openqrm_lock_queue" "NOTICE: Resource $resource_id cmd $0 waiting for PID $BLOCK_PID to finish - $EXACTNOW != $LOCK_TIMESTAMP_NEXT - $LOOP_TIMEOUT" 1>/dev/null 2>&1 - WAITING_COMMANDS=`ls $OPENQRM_CMD_LOCK_FILE.* 2>/dev/null | wc -l` - if [ "$WAITING_COMMANDS" != "" ]; then - if [ $WAITING_COMMANDS -gt $OPENQRM_CMD_QUEUE_WARNING_LIMIT_3 ]; then - openqrm_post_event $resource_id "aquire $SUBSECTION" 9 "openqrm_lock_queue" "ERROR: Resource $resource_id cmd $0 reporting $WAITING_COMMANDS waiting commands in $SUBSECTION queue" 1>/dev/null 2>&1 - elif [ $WAITING_COMMANDS -gt $OPENQRM_CMD_QUEUE_WARNING_LIMIT_2 ]; then - openqrm_post_event $resource_id "aquire $SUBSECTION" 9 "openqrm_lock_queue" "ERROR: Resource $resource_id cmd $0 reporting $WAITING_COMMANDS waiting commands in $SUBSECTION queue" 1>/dev/null 2>&1 - elif [ $WAITING_COMMANDS -gt $OPENQRM_CMD_QUEUE_WARNING_LIMIT_1 ]; then - openqrm_post_event $resource_id "aquire $SUBSECTION" 9 "openqrm_lock_queue" "WARNING: Resource $resource_id cmd $0 reporting $WAITING_COMMANDS waiting commands in $SUBSECTION queue" 1>/dev/null 2>&1 - else - openqrm_post_event $resource_id "aquire $SUBSECTION" 5 "openqrm_lock_queue" "NOTICE: Resource $resource_id cmd $0 reporting $WAITING_COMMANDS waiting commands in $SUBSECTION queue" 1>/dev/null 2>&1 - fi - else - openqrm_post_event $resource_id "aquire $SUBSECTION" 5 "openqrm_lock_queue" "NOTICE: Resource $resource_id cmd $0 reporting no waiting commands in $SUBSECTION queue" 1>/dev/null 2>&1 - fi - fi - fi - fi - - if [ "$LOCK_TIMESTAMP_NEXT" == "$LOCK_TIMESTAMP_LAST" ]; then - LOOP_TIMEOUT=$(( LOOP_TIMEOUT + 1 )) - else - # new command, reset loop counter - LOOP_TIMEOUT=0 - fi - if [ "$OPENQRM_CMD_LOCK_RETRY" == "$LOOP_TIMEOUT" ]; then - BLOCK_PID=`cat $OPENQRM_CMD_LOCK_FILE.$LOCK_TIMESTAMP_NEXT 2>/dev/null` - kill $BLOCK_PID 2>/dev/null - rm -f $OPENQRM_CMD_LOCK_FILE.$LOCK_TIMESTAMP_NEXT - LOCK_TIMESTAMP_LAST=$LOCK_TIMESTAMP_NEXT - openqrm_post_event $resource_id "aquire $SUBSECTION" 3 "openqrm_lock_queue" "ERROR: Resource $resource_id cmd $0 could not get lock after $OPENQRM_CMD_LOCK_RETRY retries!" 1>/dev/null 2>&1 - openqrm_post_event $resource_id "aquire $SUBSECTION" 3 "openqrm_lock_queue" "ERROR: Resource $resource_id cmd $0 stopped blocking process $BLOCK_PID" 1>/dev/null 2>&1 - openqrm_post_event $resource_id "aquire $SUBSECTION" 9 "openqrm_lock_queue" "WARNING: Resource $resource_id force removed lock $OPENQRM_CMD_LOCK_FILE.$LOCK_TIMESTAMP_NEXT" 1>/dev/null 2>&1 - break - fi - LOCK_TIMESTAMP_LAST=$LOCK_TIMESTAMP_NEXT - sleep $OPENQRM_CMD_LOCK_DELAY - done - # output timestamp - echo $EXACTNOW - trap '' EXIT - return 0 - ;; - release) - local LOCKFILE_TIMESTAMP=$3 - if [ "$LOCKFILE_TIMESTAMP" == "" ]; then - openqrm_post_event $resource_id "release $SUBSECTION" 3 "openqrm_lock_queue" "ERROR: Resource $resource_id cmd $0 lock parameter wrong" 1>/dev/null 2>&1 - return 1 - fi - if [ ! -f "$OPENQRM_CMD_LOCK_FILE.$LOCKFILE_TIMESTAMP" ]; then - return 1 - fi - /bin/rm -f $OPENQRM_CMD_LOCK_FILE.$LOCKFILE_TIMESTAMP - openqrm_post_event $resource_id "release $SUBSECTION" 5 "openqrm_lock_queue" "NOTICE: Resource $resource_id cmd $0 released the lock $OPENQRM_CMD_LOCK_FILE.$LOCKFILE_TIMESTAMP" 1>/dev/null 2>&1 - return 0 - ;; - *) - openqrm_post_event $resource_id "release $SUBSECTION" 3 "openqrm_lock_queue" "ERROR: Resource $resource_id cmd $0 command parameter wrong" 1>/dev/null 2>&1 - return 1 - ;; - esac -} - - -# function to unblock the starting command queue -function openqrm_unblock_starting_queue() { - if ! echo $@ | grep "\-\-openqrm\-internal\-cmd" 1>/dev/null; then - if echo $@ | grep "\-\-openqrm\-ui\-user" 1>/dev/null; then - rm -f /var/run/openqrm/starting-queue-command.lock.ui-cmd-queue - else - rm -f /var/run/openqrm/starting-queue-command.lock.bg-cmd-queue - fi - fi -} - - - -function openqrm_format_error_msg() { - ERROR_MSG=$@ - if [ ! -d /var/log/openqrm/ ]; then - mkdir -p /var/log/openqrm/ - fi - echo "openQRM command error: "$ERROR_MSG | logger - echo $ERROR_MSG | cut -b1-200 > /var/log/openqrm/$$.log - sed -i -e "s/\"//g" /var/log/openqrm/$$.log - sed -i -e "s/\'//g" /var/log/openqrm/$$.log - sed -i -e "s/\`//g" /var/log/openqrm/$$.log - sed -i -e "s/'//g" /var/log/openqrm/$$.log - FORMAT_ERROR_MSG=`cat /var/log/openqrm/$$.log` - FORMAT_ERROR_MSG=`urlencodestring $FORMAT_ERROR_MSG` - rm -f /var/log/openqrm/$$.log - echo $FORMAT_ERROR_MSG -} - - - -function openqrm_global_lock() { - local LOCK_CMD=$1 - local SECTION=$2 - local OPENQRM_USER=$3 - local OPENQRM_PASSWORD=$4 - local TOKEN=$5 - local DESCRIPTION=`urlencodestring $6` - local GB_TIMEOUT=120 - local GB_LOOP=0 - - # are we on the openQRM server or on a resource ? - if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - resource_id=0 - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL - fi - # define wget to use with https - if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" - fi - if [ "$LOCK_CMD" != "aquire" ] && [ "$LOCK_CMD" != "release" ]; then - openqrm_post_event $resource_id "lock" 3 "aquire_global_lock" "Wrong lock command parameter! Use aquire and release." 1>/dev/null 2>&1 - return 1 - fi - - OPENQRM_GLOBAL_LOCK_URL="$openqrm_web_protocol://$resource_openqrmserver/openqrm/base/api.php?action=lock&lock=$LOCK_CMD&resource_id=$resource_id§ion=$SECTION&token=$TOKEN&description=$DESCRIPTION" - while (:); do - unset GLOBAL_LOCK_ID - GLOBAL_LOCK_ID=`wget -q $WGET_NO_CERT_CHECK --http-user=$OPENQRM_USER --http-passwd=$OPENQRM_PASSWORD -O - "$OPENQRM_GLOBAL_LOCK_URL"` - if [ "$?" != 0 ]; then - echo "ERROR: Could not post global lock to the openQRM-server at $resource_openqrmserver !" | logger - return 1 - fi - if [ "$GLOBAL_LOCK_ID" != "" ]; then - if [[ $GLOBAL_LOCK_ID = *[[:digit:]]* ]]; then - openqrm_post_event $resource_id "lock" 5 "aquire_global_lock" "$LOCK_CMD global lock $GLOBAL_LOCK_ID for section $SECTION." 1>/dev/null 2>&1 - return 0 - fi - else - if [ "$LOCK_CMD" == "release" ]; then - return 0 - fi - fi - if [ "$GB_TIMEOUT" == "$GB_LOOP" ]; then - openqrm_post_event $resource_id "lock" 3 "aquire_global_lock" "Giving up $LOCK_CMD global lock $GLOBAL_LOCK_ID for section $SECTION after $GB_TIMEOUT secs." 1>/dev/null 2>&1 - return 1 - fi - sleep 1 - done - return 0 -} - - - - -function urlencodechar() { - # notice : "%", "*" and "\" are not supported - UCHAR=$1 - UCHAR=${UCHAR/\~/%7E} - UCHAR=${UCHAR/\!/%21} - UCHAR=${UCHAR/\@/%40} - UCHAR=${UCHAR/\\#/%23} - UCHAR=${UCHAR/\\$/%24} - #UCHAR=${UCHAR/\%/%25} - UCHAR=${UCHAR/\^/%5E} - UCHAR=${UCHAR/\&/%26} - #UCHAR=${UCHAR/\\*/%2A} - UCHAR=${UCHAR/\(/%28} - UCHAR=${UCHAR/\)/%29} - UCHAR=${UCHAR/\+/%2B} - UCHAR=${UCHAR/\|/%7C} - UCHAR=${UCHAR/\{/%7B} - UCHAR=${UCHAR/\}/%7D} - UCHAR=${UCHAR/\:/%3A} - UCHAR=${UCHAR/\"/%22} - UCHAR=${UCHAR/\/%3E} - UCHAR=${UCHAR/\\?/%3F} - UCHAR=${UCHAR/\`/%60} - UCHAR=${UCHAR/\=/%3D} - #UCHAR=${UCHAR/\\/%5C} - UCHAR=${UCHAR/\[/%5B} - UCHAR=${UCHAR/\]/%5D} - UCHAR=${UCHAR/\;/%3B} - UCHAR=${UCHAR/\'/%27} - UCHAR=${UCHAR/\,/%2C} - UCHAR=${UCHAR/\//%2F} - # whitespace - if [ -z $UCHAR ]; then - UCHAR=%20 - fi - echo "$UCHAR" -} - - -function urlencodestring() { - USERINPUT=$@ - LENGTH=${#USERINPUT} - for (( LOOP=0; LOOP<$LENGTH; LOOP++ )); do - TESTCHAR=`echo ${USERINPUT:$LOOP:1}` - TESTCHAR=`urlencodechar $TESTCHAR` - echo -n $TESTCHAR - done -} - - -# a generic function to manage the openQRM webserver -function openqrm_webserver() { - local ACTION=$1 - if [ -f /etc/debian_version ]; then - /etc/init.d/apache2 $ACTION - elif [ -f /etc/redhat-release ]; then - if [ -f /etc/centos-release ]; then - systemctl $ACTION httpd - else - /etc/init.d/httpd $ACTION - fi - elif [ -f /etc/SuSE-release ]; then - /etc/init.d/apache2 $ACTION - fi - -} - diff --git a/openQRM-5.3.50-CE/src/include/openqrm-package-functions b/openQRM-5.3.50-CE/src/include/openqrm-package-functions deleted file mode 100644 index ab3b58f..0000000 --- a/openQRM-5.3.50-CE/src/include/openqrm-package-functions +++ /dev/null @@ -1,780 +0,0 @@ -#!/bin/bash -# this is the package function file for openQRM -# only functions needed for packaging should go in here -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SERVER_BASE_DIR before sourcing $0" - exit 1 -fi -if [ "$OPENQRM_SOURCE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SOURCE_DIR before sourcing $0" - exit 1 -fi - -# get the openqrm-server configuration + functions -if [ -f $OPENQRM_SOURCE_DIR/etc/openqrm-server.conf ]; then - . $OPENQRM_SOURCE_DIR/etc/openqrm-server.conf - . $OPENQRM_SOURCE_DIR/include/openqrm-functions - for VAR in `cat $OPENQRM_SOURCE_DIR/etc/openqrm-server.conf | grep -v ^# | grep OPENQRM | cut -d'=' -f1`; do - eval `export $VAR` - done - PACKAGE_MANAGER_TIME_OUT=3600 -else - PACKAGE_MANAGER_TIME_OUT=30 -fi -# get distribution -export OPENQRM_PACKAGE_DISTRIBUTION=`openqrm_get_distro` - - -# runs a command with a timeout -function openqrm_cmd_timeout() { - sleep_time=$PACKAGE_MANAGER_TIME_OUT - command=$@ - $command & - cmd_pid=$! - ( sleep $sleep_time && kill $cmd_pid &>/dev/null && echo "Stopped $command due to timeout $sleep_time exceeded" ) & - killer_pid=$! - wait $cmd_pid &> /dev/null - wait_status=$? - if [ $wait_status == 0 ]; then - disown $killer_pid - kill $killer_pid &>/dev/null - fi - return $wait_status -} - - - - - -# -# updates the system's package manager -# -# returns the return code of the package manager; the only reliable check is -# to check for a non-zero returncode (which means an error has occurred). -# -function openqrm_update_package_manager() { - local PACKAGE=$1 - # check which dependencies to use - if [ -f /etc/debian_version ]; then - WHOAMI=`whoami` - if [ "$WHOAMI" != "root" ]; then - export SUDO="sudo" - fi - openqrm_cmd_timeout $SUDO apt-get update - fi -} - - -# -# Install a system dependency using the system's package manager -# -# $1: package name -# returns the return code of the package manager; the only reliable check is -# to check for a non-zero returncode (which means an error has occurred). -# -function openqrm_install_os_dependency() { - local PACKAGE=$1 - # check which dependencies to use - if [ -f /etc/debian_version ]; then - WHOAMI=`whoami` - if [ "$WHOAMI" != "root" ]; then - export SUDO="sudo" - fi - - # support different php versions on debian/ubuntu - ADAPT_PACKAGE=false - if echo $PACKAGE | grep ^php 1>/dev/null; then - ADAPT_PACKAGE=true - fi - if [ "$PACKAGE" == "libapache2-mod-php" ]; then - ADAPT_PACKAGE=true - fi - if [ "$ADAPT_PACKAGE" == "true" ]; then - PHP_VERSION=`apt-cache search php | grep ^'php[0-9].* ' | awk {' print $1 '} | grep -v '-' | grep -v cc | head -n1 | sed -e "s/php//g"` - if [ "$PHP_VERSION" == "" ]; then - echo "ERROR: Could not find PHP version to install!" - echo "-> please install $PACKAGE manually!" - return 1 - fi - # php-xml does not exists in php version 5 - if [ "$PACKAGE" == "php-xml" ]; then - if echo $PHP_VERSION | grep ^5 1>/dev/null; then - return 0 - fi - fi - # php modules - if echo $PACKAGE | grep ^php-* 1>/dev/null; then - PACKAGE=`echo $PACKAGE | sed -e "s/php-/php$PHP_VERSION-/"g` - fi - # php main - if [ "$PACKAGE" == "php" ] ; then - PACKAGE=$PACKAGE""$PHP_VERSION - fi - # libapache2-mod-php5 - if [ "$PACKAGE" == "libapache2-mod-php" ] ; then - PACKAGE=$PACKAGE""$PHP_VERSION - fi - - fi - - - # if we already have the package installed, don't install it - local PACKAGESTATE=`dpkg -s $PACKAGE | grep '^Status' | awk '{print $4}'` - if [ "$PACKAGESTATE" != "installed" ]; then - if [ "$FORCE_INSTALL" == "true" ]; then - $SUDO apt-get -y install $PACKAGE - else - $SUDO apt-get install $PACKAGE - fi - fi - elif [ -f /etc/redhat-release ]; then - if [ "$FORCE_INSTALL" == "true" ]; then - su - root -c "yum -y install $PACKAGE" - else - su - root -c "yum install $PACKAGE" - fi - - elif [ -f /etc/SuSE-release ]; then - if [ "$FORCE_INSTALL" == "true" ]; then - su - root -c "rpm -e --nodeps $PACKAGE" - fi - # special handling for SUSE and zypper. We get a 0 return code, - # even if the requested package is not available. This wrapper - # returns 1 if the package is not found. - local TMPFILE=$OPENQRM_BUILD_TMP_DIR/$(basename $0).$RANDOM.txt - LC_ALL=C su - root -c "zypper --non-interactive install $PACKAGE" 2>&1 | tee "$TMPFILE" - local RETURNCODE=${PIPESTATUS[0]} - if cat "$TMPFILE" | grep -c "not found" >/dev/null ; then - rm "$TMPFILE" - return 1; - else - rm "$TMPFILE" - return $RETURNCODE - fi - fi -} - - - -# -# Install a system dependency using openqrm_install_os_dependency -# -# $1: binary name -# $2: package name -# returns 0 in case of success, post an error in case of failue -function openqrm_full_fill_os_dependency() { - local BINARY_DEP=$1 - local PACKAGE_DEP=$2 - export FORCE_INSTALL=true - if ! which $BINARY_DEP 1>/dev/null; then - openqrm_install_os_dependency $PACKAGE_DEP - else - return 0 - fi - if ! which $BINARY_DEP 1>/dev/null; then - openqrm_post_event 0 "dependency" 2 "openqrm-package-functions" "Could not auto-install $PACKAGE_DEP on resource $resource_id!" - openqrm_post_event 0 "dependency" 2 "openqrm-package-functions" "Please manually install $PACKAGE_DEP on resource $resource_id!" - return 1 - else - return 0 - fi - -} - - - -function openqrm_check_requirements() { - if [ ! -d "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins" ]; then - print_error "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins does not exist. Run make check after installing openQRM!" - return 1 - fi - export FORCE_INSTALL=true - # check which dependencies to use - if [ -f /etc/debian_version ]; then - print_message "Checking the requirements for Debian/Ubuntu based systems ..." - elif [ -f /etc/redhat-release ]; then - print_message "Checking the requirements for RedHat based systems ..." - # check for epel-release - echo "Checking for epel-release repository ..." - if rpm -qa | grep epel-release 1>/dev/null; then - echo "-> found epel-release repository available" - else - echo "ERROR: Please enable the epel-release repository!" - return 1 - fi - elif [ -f /etc/SuSE-release ]; then - print_message "Checking the requirements for SUSE based systems ..." - else - print_notice "NOTICE: Could not find out which dependencies to use" \ - "Please make sure to have all needed components installed!" - sleep 4 - print_message "... Continuing anyway" - return 0 - fi - - print_message "openqrm-server requires: $OPENQRM_SERVER_DEPENDENCIES" - for DEP in `echo $OPENQRM_SERVER_DEPENDENCIES | sed -e "s/,//g"`; do - openqrm_install_os_dependency $DEP - if [ $? != 0 ]; then - print_error "$DEP could not be installed. Please install manually to continue" - return 1 - fi - done - - - # get a list of plugins for checking their dependencies - OPENQRM_PACKAGE_COMPONENT_LIST=`ls $OPENQRM_SERVER_BASE_DIR/openqrm/plugins` - for OPENQRM_PLUGIN in $OPENQRM_PACKAGE_COMPONENT_LIST; do - PLUGIN_CONF=$OPENQRM_SOURCE_DIR/plugins/$OPENQRM_PLUGIN/etc/openqrm-plugin-$OPENQRM_PLUGIN"".conf - if [ -f $PLUGIN_CONF ]; then - . $PLUGIN_CONF - else - print_notice "openqrm-plugin-$OPENQRM_PLUGIN has no config file. Unable to check dependencies!" - continue - fi - print_message "openqrm-plugin-$OPENQRM_PLUGIN requires: `echo $OPENQRM_PLUGIN_DEPENDENCIES | sed -e "s/openqrm-server//g"`" - for DEP in `echo $OPENQRM_PLUGIN_DEPENDENCIES | sed -e "s/,//g" | sed -e "s/openqrm-server//g"`; do - openqrm_install_os_dependency $DEP - if [ $? != 0 ]; then - print_error "$DEP could not be installed. Please install manually to continue" - return 1 - fi - done - done - print_message "Checking for required components finished successfully" -} - - - -function openqrm_rpm_package() { - CDIR=`pwd` - # make sure to have some additional deps installed - if [ -f /etc/SuSE-release ]; then - export FORCE_INSTALL=true - openqrm_install_os_dependency rpm-build - else - export FORCE_INSTALL=true - openqrm_install_os_dependency redhat-rpm-config - openqrm_install_os_dependency rpm-build - openqrm_install_os_dependency rpmdevtools - openqrm_install_os_dependency rpm-devel - - # check for epel-release - echo "Checking for epel-release repository ..." - if rpm -qa | grep epel-release 1>/dev/null; then - echo "-> found epel-release repository available" - else - echo "ERROR: Please enable the epel-release repository!" - return 1 - fi - fi - - # this is only rpm packaging, debian package are build with the standard debian package tools - OPENQRM_PACKAGE_ARCHITECTURE=` uname -i` - if [ -f /etc/redhat-release ]; then - OPENQRM_PACKAGE_SUB_DIR="redhat" - elif [ -f /etc/SuSE-release ]; then - OPENQRM_PACKAGE_SUB_DIR="packages" - fi - # check where our build root is. Centos 6 puts it in /root/rpmbuild - if [ ! -d "/usr/src/$OPENQRM_PACKAGE_SUB_DIR" ]; then - if [ -d /root/rpmbuild ]; then - ln -sf /root/rpmbuild /usr/src/$OPENQRM_PACKAGE_SUB_DIR - else - # here we have just installed rpm-build and no ~/rpmbuild exists yet - # we create one by running rpmbuild on a non-existin dummy spec - rpmbuild dummy.spec 1>/dev/null 2>&1 - if [ -d /root/rpmbuild ]; then - ln -sf /root/rpmbuild /usr/src/$OPENQRM_PACKAGE_SUB_DIR - else - echo "ERROR: Could not find nor create the ~/rpmbuild directory!" - return 1 - fi - fi - fi - - # openqrm package ########################################################## - - # enterprise or community ? - if [ -d plugins/cloud-zones ]; then - OPENQRM_PACKAGE_NAME="openqrm-enterprise" - OPENQRM_PACKAGE_LICENSE="GNU General Public License version 2" - OPENQRM_PACKAGE_CONFLICTS="openqrm" - else - OPENQRM_PACKAGE_NAME="openqrm" - OPENQRM_PACKAGE_LICENSE="GPL" - OPENQRM_PACKAGE_CONFLICTS="openqrm-enterprise" - fi - - # set postinst + prerm - OPENQRM_PACKAGE_PREINSTALL="sh /usr/share/openqrm/etc/init.d/openqrm-server.preinstall" - OPENQRM_PACKAGE_PREINSTALL_SCRIPT="/usr/share/openqrm/etc/init.d/openqrm-server.preinstall" - OPENQRM_PACKAGE_POSTINSTALL="sh /usr/share/openqrm/etc/init.d/openqrm-server.postinstall" - OPENQRM_PACKAGE_PREREMOVE="sh /usr/share/openqrm/etc/init.d/openqrm-server.preremove" - - # get a list of plugins for checking their dependencies - . etc/openqrm-server.conf - OPENQRM_PACKAGE_DEPENDENCIES="$OPENQRM_SERVER_DEPENDENCIES" - OPENQRM_PACKAGE_COMPONENT_LIST=`ls plugins` - for OPENQRM_PLUGIN in $OPENQRM_PACKAGE_COMPONENT_LIST; do - PLUGIN_CONF="plugins/$OPENQRM_PLUGIN/etc/openqrm-plugin-$OPENQRM_PLUGIN"".conf" - if [ -f $PLUGIN_CONF ]; then - . $PLUGIN_CONF - fi - for DEP in `echo $OPENQRM_PLUGIN_DEPENDENCIES | sed -e "s/,//g" | sed -e "s/openqrm-server//g"`; do - if ! echo $OPENQRM_PACKAGE_DEPENDENCIES | grep -w $DEP 1>/dev/null; then - OPENQRM_PACKAGE_DEPENDENCIES="$OPENQRM_PACKAGE_DEPENDENCIES, $DEP" - fi - done - done - if [ "$OPENQRM_MINOR_RELEASE_VERSION" != "" ]; then - export OPENQRM_SERVER_VERSION="$OPENQRM_SERVER_VERSION"."$OPENQRM_MINOR_RELEASE_VERSION" - fi - # clean up - rm -rf /usr/src/$OPENQRM_PACKAGE_SUB_DIR/BUILD/buildtmp /usr/src/$OPENQRM_PACKAGE_SUB_DIR/BUILD/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION - # create the source package - rm -rf $OPENQRM_PACKAGE_TMP_DIR/openqrm-packaging/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION-$OPENQRM_PACKAGE_DISTRIBUTION.$OPENQRM_PACKAGE_ARCHITECTURE/source/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION - mkdir -p $OPENQRM_PACKAGE_TMP_DIR/openqrm-packaging/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION-$OPENQRM_PACKAGE_DISTRIBUTION.$OPENQRM_PACKAGE_ARCHITECTURE/source/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION - cp -aR * $OPENQRM_PACKAGE_TMP_DIR/openqrm-packaging/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION-$OPENQRM_PACKAGE_DISTRIBUTION.$OPENQRM_PACKAGE_ARCHITECTURE/source/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION/ - rm -rf `find $OPENQRM_PACKAGE_TMP_DIR/openqrm-packaging/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION-$OPENQRM_PACKAGE_DISTRIBUTION.$OPENQRM_PACKAGE_ARCHITECTURE/source/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION/ -name .svn` - # include the thirdparty source packages - if [ -d $CDIR/../buildtmp/openqrm-build ]; then - cp -aR $CDIR/../buildtmp $OPENQRM_PACKAGE_TMP_DIR/openqrm-packaging/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION-$OPENQRM_PACKAGE_DISTRIBUTION.$OPENQRM_PACKAGE_ARCHITECTURE/source/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION/thirdparty - else - if [ ! -d ~/openqrm-thirdparty-cache ]; then - ./fill-build-cache - cp -aR ../buildtmp $OPENQRM_PACKAGE_TMP_DIR/openqrm-packaging/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION-$OPENQRM_PACKAGE_DISTRIBUTION.$OPENQRM_PACKAGE_ARCHITECTURE/source/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION/thirdparty - else - cp -aR ~/openqrm-thirdparty-cache $OPENQRM_PACKAGE_TMP_DIR/openqrm-packaging/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION-$OPENQRM_PACKAGE_DISTRIBUTION.$OPENQRM_PACKAGE_ARCHITECTURE/source/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION/thirdparty - fi - fi - rm -f /usr/src/$OPENQRM_PACKAGE_SUB_DIR/SOURCES/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION.tgz - tar -C $OPENQRM_PACKAGE_TMP_DIR/openqrm-packaging/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION-$OPENQRM_PACKAGE_DISTRIBUTION.$OPENQRM_PACKAGE_ARCHITECTURE/source/ -czf /usr/src/$OPENQRM_PACKAGE_SUB_DIR/SOURCES/$OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION.tgz $OPENQRM_PACKAGE_NAME-$OPENQRM_SERVER_VERSION/ - - # create spec file from template - cat rpm/openqrm.spec | \ - sed -e "s/OPENQRM_PACKAGE_NAME/$OPENQRM_PACKAGE_NAME/g" | \ - sed -e "s/OPENQRM_PACKAGE_VERSION/$OPENQRM_SERVER_VERSION/g" | \ - sed -e "s/OPENQRM_PACKAGE_LICENSE/$OPENQRM_PACKAGE_LICENSE/g" | \ - sed -e "s/OPENQRM_PACKAGE_ARCHITECTURE/$OPENQRM_PACKAGE_ARCHITECTURE/g" | \ - sed -e "s/OPENQRM_PACKAGE_DISTRIBUTION/$OPENQRM_PACKAGE_DISTRIBUTION/g" | \ - sed -e "s/OPENQRM_PACKAGE_DEPENDENCIES/$OPENQRM_PACKAGE_DEPENDENCIES/g" | \ - sed -e "s/OPENQRM_SERVER_BUILD_REQUIREMENTS/$OPENQRM_SERVER_BUILD_REQUIREMENTS/g" | \ - sed -e "s/OPENQRM_PACKAGE_CONFLICTS/$OPENQRM_PACKAGE_CONFLICTS/g" | \ - sed -e "s#OPENQRM_BUILD_POSTINSTALL#$OPENQRM_BUILD_POSTINSTALL#g" | \ - sed -e "s#OPENQRM_PACKAGE_PREINSTALL_SCRIPT#$OPENQRM_PACKAGE_PREINSTALL_SCRIPT#g" | \ - sed -e "s#OPENQRM_PACKAGE_PREINSTALL#$OPENQRM_PACKAGE_PREINSTALL#g" | \ - sed -e "s#OPENQRM_PACKAGE_POSTINSTALL#$OPENQRM_PACKAGE_POSTINSTALL#g" | \ - sed -e "s#OPENQRM_PACKAGE_PREREMOVE#$OPENQRM_PACKAGE_PREREMOVE#g" \ - > /usr/src/$OPENQRM_PACKAGE_SUB_DIR/SOURCES/$OPENQRM_PACKAGE_NAME.spec - - rm -rf $OPENQRM_PACKAGE_TMP_DIR/openqrm-packaging - mkdir -p $OPENQRM_PACKAGE_TMP_DIR/openqrm-packaging/$OPENQRM_PACKAGE_NAME - # build the rpm package - rpmbuild -ba /usr/src/$OPENQRM_PACKAGE_SUB_DIR/SOURCES/$OPENQRM_PACKAGE_NAME.spec - rm -rf $OPENQRM_PACKAGE_TMP_DIR/openqrm-packaging -} - - - - - - -# function to create a debian/ubuntu source package -function openqrm_create_deb_source() { - - # find out the short distri name - if [ -f /etc/debian_version ]; then - # debian or ubuntu, try to find out without lsb-release which may not be installed - if grep -i ubuntu /etc/apt/sources.list 1>/dev/null; then - OPENQRM_SHORT_DISTRI_NAME="ubuntu" - else - OPENQRM_SHORT_DISTRI_NAME="debian" - fi - fi - # make sure to have some additional deps installed - export FORCE_INSTALL=true - openqrm_install_os_dependency build-essential - openqrm_install_os_dependency pbuilder - openqrm_install_os_dependency fakeroot - openqrm_install_os_dependency debhelper - openqrm_install_os_dependency rpcbind - openqrm_install_os_dependency zlib1g-dev - openqrm_install_os_dependency lvm2 - openqrm_install_os_dependency rsync - openqrm_install_os_dependency ethtool - - CDIR=`pwd` - TMPBUILD_DIR=`mktemp -d /tmp/deb_source.XXXXXXXXXX` || exit 1 - if [ "$OPENQRM_MINOR_RELEASE_VERSION" != "" ]; then - export OPENQRM_SERVER_VERSION="$OPENQRM_SERVER_VERSION"."$OPENQRM_MINOR_RELEASE_VERSION" - fi - OPENQRM_UBUNTU_VERSION="$OPENQRM_SERVER_VERSION" - export OPENQRM_PACKAGE_NAME="openqrm-enterprise" - export OPENQRM_PACKAGE_CONFLICTS="openqrm" - mkdir -p $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION -# tar cf - . --exclude=".svn" | ( cd $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION/; tar xfp -) - tar cf - . | ( cd $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION/; tar xfp -) - cd $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION/ - - #create deps - OPENQRM_PACKAGE_DEPENDENCIES="$OPENQRM_SERVER_DEPENDENCIES" - OPENQRM_PACKAGE_COMPONENT_LIST=`ls plugins | grep -v Makefile` - for OPENQRM_PLUGIN in $OPENQRM_PACKAGE_COMPONENT_LIST; do - rm -rf plugins/$OPENQRM_PLUGIN - done - - # copy changelog for package naming - cp -f debian/changelog.$OPENQRM_SHORT_DISTRI_NAME debian/changelog - sed -i -e "s/^openqrm/openqrm-enterprise/g" debian/changelog - for F in `ls debian/openqrm.*`; do - FNEW=`echo $F | sed -e "s/openqrm/openqrm-enterprise/g"` - mv -f $F $FNEW - done - # use the enterprise copyright - if [ -f debian/copyright.enterprise ]; then - mv -f debian/copyright.enterprise debian/copyright - fi - # create spec file from template - cat debian/control | \ - sed -e "s/OPENQRM_PACKAGE_NAME/$OPENQRM_PACKAGE_NAME/g" | \ - sed -e "s/OPENQRM_PACKAGE_DEPENDENCIES/$OPENQRM_PACKAGE_DEPENDENCIES/g" | \ - sed -e "s/OPENQRM_PACKAGE_CONFLICTS/$OPENQRM_PACKAGE_CONFLICTS/g" \ - > debian/control.configured - mv -f debian/control.configured debian/control - # remove svn dirs - rm -rf `find -name .svn ` - rm -rf `find -name .git ` - # avoid the following build confs. - rm -f etc/build.conf/adodb.conf - rm -f etc/build.conf/busybox.conf - rm -f etc/build.conf/dropbear.conf - rm -f etc/build.conf/initrd-devices.conf - rm -f etc/build.conf/pciutils.conf - - TPDIR="" - if [ -d $CDIR/../buildtmp/openqrm-build ]; then - TPDIR="$CDIR/../buildtmp" - else - if [ ! -d ~/openqrm-thirdparty-cache ]; then - ./fill-build-cache - TPDIR="../buildtmp" - else - TPDIR="~/openqrm-thirdparty-cache" - fi - fi - if [ "$TPDIR" != "" ]; then - mkdir -p thirdparty/openqrm-build - cp -aR $TPDIR/openqrm-build/htmlobjects thirdparty/openqrm-build/ - cp -aR $TPDIR/openqrm-build/jqclock thirdparty/openqrm-build/ - cp -aR $TPDIR/openqrm-build/jquery thirdparty/openqrm-build/ - cp -aR $TPDIR/openqrm-build/js-interface thirdparty/openqrm-build/ - cp -aR $TPDIR/openqrm-build/jsmin thirdparty/openqrm-build/ - cp -aR $TPDIR/openqrm-build/phplib thirdparty/openqrm-build/ - cp -aR $TPDIR/openqrm-build/treemenuicons thirdparty/openqrm-build/ - cp -aR $TPDIR/openqrm-build/treemenujs thirdparty/openqrm-build/ - cp -aR $TPDIR/openqrm-build/openqrm-initrd-template.* thirdparty/openqrm-build/ - fi - - # prepare openqrm_[version].orig.tar.gz - cd $TMPBUILD_DIR/ - mv $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION/debian . - tar -czf $OPENQRM_PACKAGE_NAME"_"$OPENQRM_UBUNTU_VERSION.orig.tar.gz $OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION - mv $TMPBUILD_DIR/debian $OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION/ - # build the source package - cd $OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION - if [ "$GPGKEY" != "" ]; then - dpkg-buildpackage -S -sa -rfakeroot -k$GPGKEY - else - dpkg-buildpackage -S -sa -rfakeroot - fi - cd $CDIR - mv -f $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME"_"* ../ - rm -rf $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION - rm -rf $TMPBUILD_DIR/buildtmp - rmdir $TMPBUILD_DIR -} - - -# function to create a debian/ubuntu binary package via pbuilder -function openqrm_pbuilder() { - CDIR=`pwd` - # find out the short distri name - if [ -f /etc/debian_version ]; then - # debian or ubuntu, try to find out without lsb-release which may not be installed - if grep -i ubuntu /etc/apt/sources.list 1>/dev/null; then - OPENQRM_SHORT_DISTRI_NAME="ubuntu" - else - OPENQRM_SHORT_DISTRI_NAME="debian" - fi - fi - # make sure to have some additional deps installed - export FORCE_INSTALL=true - openqrm_install_os_dependency build-essential - openqrm_install_os_dependency pbuilder - openqrm_install_os_dependency fakeroot - openqrm_install_os_dependency debhelper - openqrm_install_os_dependency rpcbind - openqrm_install_os_dependency zlib1g-dev - openqrm_install_os_dependency lvm2 - - OPENQRM_UBUNTU_VERSION=`cat debian/changelog.$OPENQRM_SHORT_DISTRI_NAME | head -n1 | cut -d'(' -f2 | cut -d')' -f1` - DISTRIBUTION_VERSION=`cat debian/changelog.$OPENQRM_SHORT_DISTRI_NAME | head -n1 | cut -d';' -f1 | awk '{ print $3 }'` - OPENQRM_PACKAGE_NAME="openqrm-enterprise" - PACKAGE_DESCRIPTION=$OPENQRM_PACKAGE_NAME"_"$OPENQRM_UBUNTU_VERSION.dsc - if [ ! -f "../$PACKAGE_DESCRIPTION" ]; then - openqrm_create_deb_source - fi - cd .. - # set proxy env for pbuilder if needed - PBUILDER_PROXY="" - if grep http_proxy /root/.bashrc 1>/dev/null 2>/dev/null; then - PBUILDER_PROXY=`grep http_proxy /root/.bashrc | head -n1 | sed -e "s/.*=//g" | sed -e 's/"//g'` - export PBUILDER_PROXY_PARAMETER=" --http-proxy $PBUILDER_PROXY" - fi - # check if to init pbuilder - if [ ! -f /var/cache/pbuilder/base.tgz ]; then - pbuilder create --distribution $DISTRIBUTION_VERSION $PBUILDER_PROXY_PARAMETER - fi - # run pbuilder - pbuilder build $PACKAGE_DESCRIPTION $PBUILDER_PROXY_PARAMETER - echo - echo "Packaging finished. Please find the created packages in /var/cache/pbuilder/result" - ls -lh /var/cache/pbuilder/result/openqrm* - cd $CDIR -} - - - - - - - -# function to create a debian/ubuntu plugin source package -function openqrm_plugin_create_deb_source() { - - PLUGIN_NAME=$1 - echo "- building plugin package $PLUGIN_NAME" - # find out the short distri name - if [ -f /etc/debian_version ]; then - # debian or ubuntu, try to find out without lsb-release which may not be installed - if grep -i ubuntu /etc/apt/sources.list 1>/dev/null; then - OPENQRM_SHORT_DISTRI_NAME="ubuntu" - else - OPENQRM_SHORT_DISTRI_NAME="debian" - fi - fi - # make sure to have some additional deps installed - export FORCE_INSTALL=true - openqrm_install_os_dependency build-essential - openqrm_install_os_dependency pbuilder - openqrm_install_os_dependency fakeroot - openqrm_install_os_dependency debhelper - openqrm_install_os_dependency rpcbind - openqrm_install_os_dependency zlib1g-dev - openqrm_install_os_dependency lvm2 - - CDIR=`pwd` - TMPBUILD_DIR=`mktemp -d /tmp/deb_source.XXXXXXXXXX` || exit 1 - - . plugins/$PLUGIN_NAME/etc/openqrm-plugin-$PLUGIN_NAME.conf - OPENQRM_UBUNTU_VERSION="$OPENQRM_PLUGIN_VERSION" - export OPENQRM_PACKAGE_NAME="openqrm-enterprise-plugin-$PLUGIN_NAME" - export OPENQRM_PACKAGE_CONFLICTS="openqrm" - mkdir -p $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION -# tar cf - . --exclude=".svn" | ( cd $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION/; tar xfp -) - tar cf - . | ( cd $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION/; tar xfp -) - cd $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION/ - - #create deps - OPENQRM_PACKAGE_DEPENDENCIES=`echo $OPENQRM_PLUGIN_DEPENDENCIES | sed -e "s/openqrm-server/openqrm-enterprise/g"` - - # copy changelog for package naming - cp -f debian/changelog.$OPENQRM_SHORT_DISTRI_NAME debian/changelog - sed -i -e "s/^openqrm/openqrm-enterprise-plugin-$PLUGIN_NAME/g" debian/changelog - for F in `ls debian/openqrm.*`; do - FNEW=`echo $F | sed -e "s/openqrm/openqrm-enterprise-plugin-$PLUGIN_NAME/g"` - mv -f $F $FNEW - done - - # adapt rules, not copying docs - cp -f debian/rules.plugin debian/rules - rm -f debian/rules.plugin - # remove postinst, postrm and preinst - rm -f debian/openqrm*.postinst - rm -f debian/openqrm*.postrm - rm -f debian/openqrm*.preinst - rm -f debian/openqrm*.prerm - - # use the enterprise copyright - if [ -f debian/copyright.enterprise ]; then - mv -f debian/copyright.enterprise debian/copyright - fi - # create spec file from template - cat debian/control | \ - sed -e "s/OPENQRM_PACKAGE_NAME/$OPENQRM_PACKAGE_NAME/g" | \ - sed -e "s/OPENQRM_PACKAGE_DEPENDENCIES/$OPENQRM_PACKAGE_DEPENDENCIES/g" | \ - sed -e "s/OPENQRM_PACKAGE_CONFLICTS/$OPENQRM_PACKAGE_CONFLICTS/g" \ - > debian/control.configured - mv -f debian/control.configured debian/control - # remove svn dirs - rm -rf `find -name .svn ` - - # remove base - rm -rf bin doc rpm sbin tftpboot web - # re-create empty Makefile for etc - rm -rf etc/build.conf etc/db etc/enterprise etc/httpd etc/init.d etc/templates - rm -f etc/Makefile - echo "all:" > etc/Makefile - echo "install:" >> etc/Makefile - echo "clean:" >> etc/Makefile - echo "realclean:" >> etc/Makefile - echo "uninstall:" >> etc/Makefile - echo "configure:" >> etc/Makefile - echo "compile:" >> etc/Makefile - # re-create empty Makefile for include - rm -f include/Makefile - echo "all:" > include/Makefile - echo "install:" >> include/Makefile - echo "clean:" >> include/Makefile - echo "realclean:" >> include/Makefile - echo "uninstall:" >> include/Makefile - echo "configure:" >> include/Makefile - echo "compile:" >> include/Makefile - - # remove all other plugins - OPENQRM_PACKAGE_COMPONENT_LIST=`ls plugins | grep -v Makefile | grep -v ^$PLUGIN_NAME$` - for OPENQRM_PLUGIN in $OPENQRM_PACKAGE_COMPONENT_LIST; do - rm -rf plugins/$OPENQRM_PLUGIN - done - - TPDIR="" - if [ -d $CDIR/../buildtmp/openqrm-build ]; then - TPDIR="$CDIR/../buildtmp" - else - if [ ! -d ~/openqrm-thirdparty-cache ]; then - ./fill-build-cache - TPDIR="../buildtmp" - else - TPDIR="~/openqrm-thirdparty-cache" - fi - fi - if [ "$TPDIR" != "" ]; then - mkdir -p thirdparty/openqrm-build - - if [ -d plugins/$PLUGIN_NAME/etc/build.conf ]; then - echo "- configuring build cache for plugin $PLUGIN_NAME" - for BUILD_CONF in `ls plugins/$PLUGIN_NAME/etc/build.conf/ | sed -e "s/\.conf//g"`; do - echo "- copying $BUILD_CONF to build cache" - cp -aR $TPDIR/openqrm-build/$BUILD_CONF thirdparty/openqrm-build/ - done - fi - fi - - # prepare openqrm_[version].orig.tar.gz - cd $TMPBUILD_DIR/ - mv $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION/debian . - tar -czf $OPENQRM_PACKAGE_NAME"_"$OPENQRM_UBUNTU_VERSION.orig.tar.gz $OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION - mv $TMPBUILD_DIR/debian $OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION/ - # build the source package - cd $OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION - if [ "$GPGKEY" != "" ]; then - dpkg-buildpackage -S -sa -rfakeroot -k$GPGKEY - else - dpkg-buildpackage -S -sa -rfakeroot - fi - cd $CDIR - mv -f $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME"_"* ../ - rm -rf $TMPBUILD_DIR/$OPENQRM_PACKAGE_NAME-$OPENQRM_UBUNTU_VERSION - rm -rf $TMPBUILD_DIR/buildtmp - rmdir $TMPBUILD_DIR -} - - - - -# function to create a debian/ubuntu plugin binary package via pbuilder -function openqrm_plugin_pbuilder() { - - PLUGIN_NAME=$1 - CDIR=`pwd` - # find out the short distri name - if [ -f /etc/debian_version ]; then - # debian or ubuntu, try to find out without lsb-release which may not be installed - if grep -i ubuntu /etc/apt/sources.list 1>/dev/null; then - OPENQRM_SHORT_DISTRI_NAME="ubuntu" - else - OPENQRM_SHORT_DISTRI_NAME="debian" - fi - fi - # make sure to have some additional deps installed - export FORCE_INSTALL=true - openqrm_install_os_dependency build-essential - openqrm_install_os_dependency pbuilder - openqrm_install_os_dependency fakeroot - openqrm_install_os_dependency debhelper - openqrm_install_os_dependency rpcbind - openqrm_install_os_dependency zlib1g-dev - openqrm_install_os_dependency lvm2 - - OPENQRM_UBUNTU_VERSION=`cat debian/changelog.$OPENQRM_SHORT_DISTRI_NAME | head -n1 | cut -d'(' -f2 | cut -d')' -f1` - DISTRIBUTION_VERSION=`cat debian/changelog.$OPENQRM_SHORT_DISTRI_NAME | head -n1 | cut -d';' -f1 | awk '{ print $3 }'` - OPENQRM_PACKAGE_NAME="openqrm-enterprise-plugin-$PLUGIN_NAME" - PACKAGE_DESCRIPTION=$OPENQRM_PACKAGE_NAME"_"$OPENQRM_UBUNTU_VERSION.dsc - if [ ! -f "../$PACKAGE_DESCRIPTION" ]; then - openqrm_plugin_create_deb_source $PLUGIN_NAME - fi - cd .. - # set proxy env for pbuilder if needed - PBUILDER_PROXY="" - if grep http_proxy /root/.bashrc 1>/dev/null 2>/dev/null; then - PBUILDER_PROXY=`grep http_proxy /root/.bashrc | head -n1 | sed -e "s/.*=//g" | sed -e 's/"//g'` - export PBUILDER_PROXY_PARAMETER=" --http-proxy $PBUILDER_PROXY" - fi - # check if to init pbuilder - if [ ! -f /var/cache/pbuilder/base.tgz ]; then - pbuilder create --distribution $DISTRIBUTION_VERSION $PBUILDER_PROXY_PARAMETER - fi - # run pbuilder - pbuilder build $PACKAGE_DESCRIPTION $PBUILDER_PROXY_PARAMETER - echo - echo "Packaging finished. Please find the created packages in /var/cache/pbuilder/result" - ls -lh /var/cache/pbuilder/result/openqrm* - cd $CDIR -} - - - - -# function to create a debian/ubuntu plugin binary package via pbuilder -function openqrm_packages() { - clear - echo "building base" - sleep 5 - openqrm_create_deb_source - openqrm_pbuilder - - for PLUGIN in `ls plugins | grep -v Makefile`; do - clear - echo "building plugin $PLUGIN" - sleep 5 - openqrm_plugin_create_deb_source $PLUGIN - openqrm_plugin_pbuilder $PLUGIN - done - -} diff --git a/openQRM-5.3.50-CE/src/include/openqrm-server-functions b/openQRM-5.3.50-CE/src/include/openqrm-server-functions deleted file mode 100644 index d396ef6..0000000 --- a/openQRM-5.3.50-CE/src/include/openqrm-server-functions +++ /dev/null @@ -1,841 +0,0 @@ -#!/bin/bash -# this is the server function file for openQRM -# only server functions should go in here -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export LANGUAGE=C -export LANG=C -export LC_ALL=C - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SERVER_BASE_DIR before sourcing $0" - exit 1 -fi - -# source the server configuration -OPENQRM_SERVER_CONF=$OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_CONF - -# some definitions -#OPENQRM_UNWANTED_MODULES="cops.o ipddp.o ltpc.o hdlcdrv.o airo_cs.o aironet4500_cs.o airo.o axnet_cs.o fmvj18x_cs.o ibmtr_cs.o netwave_cs.o nmclan_cs.o pcnet_cs.o ray_cs.o smc91c92_cs.o wavelan_cs.o wvlan_cs.o xirc2ps_cs.o xircom_cb.o xircom_tulip_cb.o ppp_async.o ppp_deflate.o ppp_generic.o ppp_synctty.o wavelan.o wd.o winbond-840.o airo_cs.o airo.o hermes.o orinoco_cs.o orinoco.o orinoco_plx.o orinoco_old_cs.o cops.ko ipddp.ko ltpc.ko hdlcdrv.ko airo_cs.ko aironet4500_cs.ko airo.ko axnet_cs.ko fmvj18x_cs.ko ibmtr_cs.ko netwave_cs.ko nmclan_cs.ko pcnet_cs.ko ray_cs.ko smc91c92_cs.ko wavelan_cs.ko wvlan_cs.ko xirc2ps_cs.ko xircom_cb.ko xircom_tulip_cb.ko ppp_async.ko ppp_deflate.ko ppp_generic.ko ppp_synctty.ko wavelan.ko wd.ko winbond-840.ko airo_cs.ko airo.ko hermes.ko orinoco_cs.ko orinoco.ko orinoco_plx.ko orinoco_old_cs.ko de600.ko de620.ko defxx.ko depca.ko hp100.ko hp.ko hp-plus.ko ne3210.ko ne.ko netwave_cs.ko ipw2100.ko proteon.ko skisa.ko vga16fb.ko atyfb.ko xen-netfront.ko" -OPENQRM_UNWANTED_MODULES="cops.o ipddp.o ltpc.o hdlcdrv.o airo_cs.o aironet4500_cs.o airo.o axnet_cs.o fmvj18x_cs.o ibmtr_cs.o netwave_cs.o nmclan_cs.o pcnet_cs.o ray_cs.o smc91c92_cs.o wavelan_cs.o wvlan_cs.o xirc2ps_cs.o xircom_cb.o xircom_tulip_cb.o ppp_async.o ppp_deflate.o ppp_generic.o ppp_synctty.o wavelan.o wd.o winbond-840.o airo_cs.o airo.o hermes.o orinoco_cs.o orinoco.o orinoco_plx.o orinoco_old_cs.o cops.ko ipddp.ko ltpc.ko hdlcdrv.ko airo_cs.ko aironet4500_cs.ko airo.ko axnet_cs.ko fmvj18x_cs.ko ibmtr_cs.ko netwave_cs.ko nmclan_cs.ko pcnet_cs.ko ray_cs.ko smc91c92_cs.ko wavelan_cs.ko wvlan_cs.ko xirc2ps_cs.ko xircom_cb.ko xircom_tulip_cb.ko ppp_async.ko ppp_deflate.ko ppp_generic.ko ppp_synctty.ko wavelan.ko wd.ko winbond-840.ko airo_cs.ko airo.ko hermes.ko orinoco_cs.ko orinoco.ko orinoco_plx.ko orinoco_old_cs.ko de600.ko de620.ko defxx.ko depca.ko hp100.ko hp.ko hp-plus.ko ne3210.ko ne.ko netwave_cs.ko ipw2100.ko proteon.ko skisa.ko atyfb.ko xen-netfront.ko" - -OPENQRM_DEFAULT_INITRD_TEMPLATE="$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-default.tgz" -OPENQRM_SERVER_LINUXRC="$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-linuxrc" -OPENQRM_MAX_INITRD_SIZE=128000 -OPENQRM_DEFAULT_RAM_DISK_BLOCK_SIZE=1024 -# static directory define for the server state backups -OPENQRM_SERVER_STATE_DIR="/var/spool/openqrm-state" -# which files/dirs to backup/restore (base only, plugin need to care about their bacukp/restore themselves) -OPENQRM_SERVER_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - $OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-default.tgz \ - $OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-linuxrc" -OPENQRM_SERVER_STATE_DIRS="$OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/ \ - $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/ \ - $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/ \ - $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/plugins/" - - - -# translates cidr to subnet mask -function cidr2subnet () { - if [ "$1" != "" ]; then - set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0 - [ $1 -gt 1 ] && shift $1 || shift - echo ${1-0}.${2-0}.${3-0}.${4-0} - fi -} - - -# function to export all given configuration from the -# main openQRM-server config file -function openqrm_server_get_config() { - . $OPENQRM_SERVER_CONF - for VAR in `cat $OPENQRM_SERVER_CONF | grep -v ^# | grep OPENQRM | cut -d'=' -f1`; do - eval `export $VAR` - done - - # make sure /sbin and /usr/sbin are in our PATH, because we might be running as the webserver user, - # in which case the ifconfig and route commands will fail, leaving the variables empty (bad!) - PATH=/sbin:/usr/sbin:$PATH - # get ip configuration - export OPENQRM_SERVER_IP_ADDRESS=`ip a s $OPENQRM_SERVER_INTERFACE 2>/dev/null | grep -w $OPENQRM_SERVER_INTERFACE$ | grep -w inet | awk '{ print $2 }' | cut -d'/' -f1` - export OPENQRM_SERVER_BROADCAST_ADDRESS=`ip a s $OPENQRM_SERVER_INTERFACE 2>/dev/null | grep -w $OPENQRM_SERVER_INTERFACE$ | grep -w inet | awk '{ print $4 }' | cut -d'/' -f1` - export OPENQRM_SERVER_CIDR=`ip a s $OPENQRM_SERVER_INTERFACE 2>/dev/null | grep -w $OPENQRM_SERVER_INTERFACE$ | grep -w inet | awk '{ print $2 }' | cut -d'/' -f2` - export OPENQRM_SERVER_SUBNET_MASK=`cidr2subnet $OPENQRM_SERVER_CIDR` - export OPENQRM_SERVER_DEFAULT_GATEWAY=`route -n | grep ^0.0.0.0 | head -n1 | awk {' print $2 '}` -} -# run immediatly -openqrm_server_get_config - -# define wget to use with https -if [ "$OPENQRM_WEB_PROTOCOL" == "https" ]; then - export WGET="wget --no-check-certificate" -else - export WGET="wget" -fi - - -# -------------------------------------------------------------------- -# ------------------------- kernel functions ------------------------- -# -------------------------------------------------------------------- - - - -# function resolve kernel module dependencies -# param 1 : full path to kernel module -function modresolvdeps() { - MODULE=$1 - FMOD=`basename $MODULE` - FREST=`echo $MODULE | sed -e "s#.*\/kernel\/##g"` - DMOD=`echo $MODULE | sed -e "s#$FREST##g"` - DPENDLIST=`modinfo $MODULE | grep ^depends | cut -d':' -f2 | awk '{ print $1 }' | sed -e "s/,/ /g"` - if [ "$DPENDLIST" != "" ]; then - for MOD in `echo $DPENDLIST`; do - #echo $MOD - MODFULLPATH=`find $DMOD -name $MOD.ko` - echo $MODFULLPATH - modresolvdeps $MODFULLPATH - done - fi - -} - - - - -# function to create kernels -# param 1 : kernel name -# param 2 : kernel-version -# param 3 : path-to-kernel-files -function openqrm_server_create_kernel() { - - OPENQRM_SERVER_KERNEL_NAME=$1 - OPENQRM_SERVER_KERNEL_VERSION=$2 - OPENQRM_SERVER_KERNEL_LOCATION=$3 - - # OPENQRM_SERVER_KERNEL_TYPE can be "ext2" or "initramfs" - OPENQRM_SERVER_KERNEL_TYPE=$4 - OPENQRM_SERVER_INITRD_TEMPLATE=$5 - OPENQRM_SERVER_UNWANTED_MODULES=$6 - - if [ "$OPENQRM_SERVER_UNWANTED_MODULES" != "" ]; then - OPENQRM_SERVER_UNWANTED_MODULES_SPACES=`echo $OPENQRM_SERVER_UNWANTED_MODULES | sed -e "s/,/\.ko /g"`".ko" - OPENQRM_UNWANTED_MODULES="$OPENQRM_UNWANTED_MODULES $OPENQRM_SERVER_UNWANTED_MODULES_SPACES" - for MO in `echo $OPENQRM_SERVER_UNWANTED_MODULES_SPACES`; do - MODULES_EXCLUDE="$MODULES_EXCLUDE --exclude=$MO" - done - fi - - if [ "$OPENQRM_SERVER_KERNEL_TYPE" == "" ]; then - export OPENQRM_SERVER_KERNEL_TYPE="initramfs" - fi - if [ "$OPENQRM_SERVER_INITRD_TEMPLATE" == "" ]; then - export OPENQRM_SERVER_INITRD_TEMPLATE=$OPENQRM_DEFAULT_INITRD_TEMPLATE - fi - # kernel there ? - if [ ! -f "$OPENQRM_SERVER_KERNEL_LOCATION/boot/vmlinuz-$OPENQRM_SERVER_KERNEL_VERSION" ]; then - echo "ERROR: Cannot find kernel file at $OPENQRM_SERVER_KERNEL_LOCATION/boot/vmlinuz-$OPENQRM_SERVER_KERNEL_VERSION!" - return 1 - fi - # system.map there ? - if [ ! -f "$OPENQRM_SERVER_KERNEL_LOCATION/boot/System.map-$OPENQRM_SERVER_KERNEL_VERSION" ]; then - echo "ERROR: Cannot find System.map at $OPENQRM_SERVER_KERNEL_LOCATION/boot/System.map-$OPENQRM_SERVER_KERNEL_VERSION!" - return 1 - fi - # module dir there ? - if [ ! -d "$OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION" ]; then - echo "ERROR: Cannot find kernel module directory at $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION!" - return 1 - fi - # modules.pcimap there ? - if [ ! -f "$OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/modules.pcimap" ]; then - echo "WARNING: Cannot find modules.pcimap in kernel module directory at $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION. Trying to create it ..." - if ! depmod -a -m -F $OPENQRM_SERVER_KERNEL_LOCATION/boot/System.map-$OPENQRM_SERVER_KERNEL_VERSION -b $OPENQRM_SERVER_KERNEL_LOCATION $OPENQRM_SERVER_KERNEL_VERSION; then - echo "WARNING: Could not create modules.pcimap in kernel module directory at $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION! Trying to continue ..." - else - echo "NOTICE: Created modules.pcimap in kernel module directory at $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION." - fi - fi - - echo "Creating kernel $OPENQRM_SERVER_KERNEL_NAME version $OPENQRM_SERVER_KERNEL_VERSION ($OPENQRM_SERVER_KERNEL_TYPE initrd)" - - # copy kernel + System-map - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot - cp -a $OPENQRM_SERVER_KERNEL_LOCATION/boot/vmlinuz-$OPENQRM_SERVER_KERNEL_VERSION $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/vmlinuz-$OPENQRM_SERVER_KERNEL_NAME - cp -a $OPENQRM_SERVER_KERNEL_LOCATION/boot/System.map-$OPENQRM_SERVER_KERNEL_VERSION $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/System.map-$OPENQRM_SERVER_KERNEL_NAME - - # modules - #tar -C $OPENQRM_SERVER_KERNEL_LOCATION/ -czf $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/modules-$OPENQRM_SERVER_KERNEL_NAME.tgz lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - tar -C $OPENQRM_SERVER_KERNEL_LOCATION/ -czf $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/modules-$OPENQRM_SERVER_KERNEL_NAME.tgz $MODULES_EXCLUDE lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - - # initrd - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net -type f | grep -v wireless`; do - MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` - if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then - /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - # resolve deps - for L in `modresolvdeps $MODULE`; do - DEPNAME=`basename $L` - echo "--- adding module dependency $MODULE_NAME -> $DEPNAME" - /bin/cp -f $L $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - done - fi - done - - # also need virtio* for kvm virtio pci network card - for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers -type f -name virtio*`; do - MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` - if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then - /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - fi - done - - -# # also need igb for network cards -# for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers -type f -name igb`; do -# MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` -# if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then -# /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION -# fi -# done - -# # also need ixgbe for network cards -# for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers -type f -name ixgbe`; do -# MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` -# if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then -# /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION -# fi -# done - - # for networks support - for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/ -type f | egrep 'mptbase|mptsas|mptscsih|scsi_transport_sas|jfs|crc32|bnx2|bnx2x|usbhid|hid|mdio|dca|virtio'`; do - MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` - if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then - /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - fi - done - - - # need i2c modules - for igb - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/i2c $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/dca $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/dma $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/mfd $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/watchdog $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - - #for e1000e; ptp, pps - if [ -d $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ethernet/ ]; then - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ethernet/ - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ethernet/* $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ethernet/ - elif [ -d $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ ]; then - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/* $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ - fi - #end igb - - #ptp, pps - if [ -d $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ptp ]; then - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ptp $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - fi - - if [ -d $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/pps ]; then - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/pps $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - fi - # end ptp, pps - - - # also need dma modules - for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/dma -type f`; do - MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` - if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then - echo "- adding dma module $MODULE_NAME" - /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - # resolve deps - for L in `modresolvdeps $MODULE`; do - DEPNAME=`basename $L` - echo "--- adding module dependency $MODULE_NAME -> $DEPNAME" - /bin/cp -f $L $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - done - fi - done - #end dma - - - # for bnx2 support - for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/ -type f | egrep 'mptbase|mptsas|mptscsih|scsi_transport_sas|jfs|crc32|bnx2|bnx2x|hid|mdio|dca|virtio'`; do - MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` - if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then - /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - fi - done - - # include firmware for bnx2/bnx2x - rm -rf $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/firmware - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/firmware/ - if ls $OPENQRM_SERVER_KERNEL_LOCATION/lib/firmware/bnx2* 2>/dev/null 1>&2; then - /bin/cp -aRf $OPENQRM_SERVER_KERNEL_LOCATION/lib/firmware/bnx2* $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/firmware/ -# /bin/cp -aRf /lib/firmware/bnx2* $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/firmware/ - fi - #end bnx2 - - - # include firmware for cxgb4 T4 & T5 adapters - /bin/cp -aRf $OPENQRM_SERVER_KERNEL_LOCATION/lib/firmware/cxgb4 $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/firmware/ - #/bin/cp -aRf /lib/firmware/cxgb4 $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/firmware/ - #end add firmware for cxgb4 T4 & T5 adapters - - - # also we need to take the modules.pcimap for the hardware detection to work - cp -a $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/modules.* $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/ - - # unpack the initrd-template - echo "-> using initrd-template from $OPENQRM_SERVER_INITRD_TEMPLATE" - tar -C $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME -xzf $OPENQRM_SERVER_INITRD_TEMPLATE - - # check size - OPENQRM_INITRD_SIZE=`du -s $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/ | awk {' print $1 '}` - OPENQRM_INITRD_SIZE=$(( OPENQRM_INITRD_SIZE + 16000 )) - if (( $OPENQRM_INITRD_SIZE > $OPENQRM_MAX_INITRD_SIZE )); then - echo "ERROR: Initrd got too big" - return 1 - fi - - # take udev from kernel-location - rm -rf $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/etc/udev - cp -aR $OPENQRM_SERVER_KERNEL_LOCATION/etc/udev $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/etc/ - - # and /lib/udev - rm -rf $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/udev - cp -aR $OPENQRM_SERVER_KERNEL_LOCATION/lib/udev $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/ - - # take the initial console device - cp -aR $OPENQRM_SERVER_KERNEL_LOCATION/dev/console $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/dev/ - - # create run/udev dir for binding udevd socket - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/run/udev - - # creating the initrd file - if [ "$OPENQRM_SERVER_KERNEL_TYPE" == "ext2" ]; then - echo "Creating the initrd as $OPENQRM_SERVER_KERNEL_TYPE" - dd if=/dev/zero of=$OPENQRM_TEMP_DIR/bootimage/initrd-$OPENQRM_SERVER_KERNEL_NAME.img bs=1k count=$OPENQRM_INITRD_SIZE - #get ram block size there is a problem in newer kernels with size 4096 - if [ -f "$OPENQRM_SERVER_KERNEL_LOCATION/boot/config-$OPENQRM_SERVER_KERNEL_VERSION" ]; then - ram_block_size=`cat $OPENQRM_SERVER_KERNEL_LOCATION/boot/config-$OPENQRM_SERVER_KERNEL_VERSION | grep CONFIG_BLK_DEV_RAM_BLOCKSIZE | awk -F= '{print $2}'` - if [ -z $ram_block_size ]; then - ram_block_size=$OPENQRM_DEFAULT_RAM_DISK_BLOCK_SIZE - fi - else - ram_block_size=$OPENQRM_DEFAULT_RAM_DISK_BLOCK_SIZE - fi - mkfs.ext2 -q -b $ram_block_size -F $OPENQRM_TEMP_DIR/bootimage/initrd-$OPENQRM_SERVER_KERNEL_NAME.img - tune2fs -c 0 -i 0 $OPENQRM_TEMP_DIR/bootimage/initrd-$OPENQRM_SERVER_KERNEL_NAME.img - mkdir -p $OPENQRM_TEMP_DIR/bootimage/mnt - mount -o loop $OPENQRM_TEMP_DIR/bootimage/initrd-$OPENQRM_SERVER_KERNEL_NAME.img $OPENQRM_TEMP_DIR/bootimage/mnt - mv $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/* $OPENQRM_TEMP_DIR/bootimage/mnt/ - # add the openQRM-linuxrc - rm -f $OPENQRM_TEMP_DIR/bootimage/mnt/linuxrc - cp $OPENQRM_SERVER_LINUXRC $OPENQRM_TEMP_DIR/bootimage/mnt/linuxrc - chmod +x $OPENQRM_TEMP_DIR/bootimage/mnt/linuxrc - umount $OPENQRM_TEMP_DIR/bootimage/mnt - gzip $OPENQRM_TEMP_DIR/bootimage/initrd-$OPENQRM_SERVER_KERNEL_NAME.img - mv $OPENQRM_TEMP_DIR/bootimage/initrd-$OPENQRM_SERVER_KERNEL_NAME.img.gz $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-$OPENQRM_SERVER_KERNEL_NAME.img - rm -rf $OPENQRM_TEMP_DIR/bootimage - elif [ "$OPENQRM_SERVER_KERNEL_TYPE" == "initramfs" ]; then - echo "Creating the initrd as $OPENQRM_SERVER_KERNEL_TYPE" - DIR_CURRENT=`pwd` - # add the openQRM-linuxrc as init - rm -f $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/linuxrc - rm -f $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/init - cp $OPENQRM_SERVER_LINUXRC $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/init - chmod +x $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/init - # pack with cpio - cd $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/ - find . | cpio -o -H newc | gzip -9 > $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-$OPENQRM_SERVER_KERNEL_NAME.img - cd $DIR_CURRENT - rm -rf $OPENQRM_TEMP_DIR/bootimage - else - echo "ERROR: Supported initrd types are ext2 and initramfs. type: " . $OPENQRM_SERVER_KERNEL_TYPE - return 1 - fi - chmod 444 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-$OPENQRM_SERVER_KERNEL_NAME.img - chmod 444 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/vmlinuz-$OPENQRM_SERVER_KERNEL_NAME - chmod 444 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/System.map-$OPENQRM_SERVER_KERNEL_NAME - chmod 444 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/modules-$OPENQRM_SERVER_KERNEL_NAME.tgz - - # hook for plugins - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/include/openqrm-plugin-$OPENQRM_PLUGIN-kernel-hook ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/include/openqrm-plugin-$OPENQRM_PLUGIN-kernel-hook - PLUGIN_FUNCTION_NAME=`echo $OPENQRM_PLUGIN | sed -e "s/-/_/g"`""_kernel_hook - $PLUGIN_FUNCTION_NAME $OPENQRM_SERVER_KERNEL_NAME $OPENQRM_SERVER_KERNEL_VERSION $OPENQRM_SERVER_KERNEL_LOCATION $OPENQRM_SERVER_KERNEL_TYPE - fi - done - -} - - - -# function to add/remove a kernel to the openQRM-server db -# param 1 : add/remove -# param 2 : user -# param 3 : password -# param 4 : kernel name -# param 5 : kernel-version -function openqrm_server_manage_kernel() { - OPENQRM_USER=$2 - OPENQRM_USER_PASSWORD=$3 - OPENQRM_SERVER_KERNEL_NAME=$4 - OPENQRM_SERVER_KERNEL_VERSION=$5 - if [ "$OPENQRM_SERVER_IP_ADDRESS" == "" ]; then - OPENQRM_SERVER_IP_ADDRESS="localhost" - fi - case "$1" in - add) - echo "openQRM-server: Adding kernel $OPENQRM_SERVER_KERNEL_NAME version $OPENQRM_SERVER_KERNEL_VERSION" | logger - if ! $WGET -O /dev/null --http-user=$OPENQRM_USER --http-password=$OPENQRM_USER_PASSWORD "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/base/server/kernel/kernel-action.php?kernel_command=new_kernel&kernel_name=$OPENQRM_SERVER_KERNEL_NAME&kernel_version=$OPENQRM_SERVER_KERNEL_VERSION"; then - echo "ERROR: Could not add kernel $OPENQRM_SERVER_KERNEL_NAME to the openQRM-server!" | logger - return 1 - fi - return 0 - ;; - remove) - echo "openQRM-server: Removing kernel $OPENQRM_SERVER_KERNEL_NAME" | logger - if ! $WGET -O /dev/null --http-user=$OPENQRM_USER --http-password=$OPENQRM_USER_PASSWORD "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/base/server/kernel/kernel-action.php?kernel_command=remove_by_name&kernel_name=$OPENQRM_SERVER_KERNEL_NAME"; then - echo "ERROR: Could not remove kernel $OPENQRM_SERVER_KERNEL_NAME to the openQRM-server!" | logger - return 1 - fi - return 0 - ;; - esac -} - - -# function to set the default kernel -# param 1 : kernel-name -function openqrm_server_set_default_kernel() { - OPENQRM_KERNEL_NAME=$1 - echo "openQRM-server: Setting kernel $OPENQRM_KERNEL_NAME as default kernel" | logger - if [ "$OPENQRM_KERNEL_NAME" != "default" ]; then - cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/vmlinuz-$OPENQRM_KERNEL_NAME $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/vmlinuz-default - cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/System.map-$OPENQRM_KERNEL_NAME $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/System.map-default - cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-$OPENQRM_KERNEL_NAME.img $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-default.img - cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/modules-$OPENQRM_KERNEL_NAME.tgz $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/modules-default.tgz - fi -} - - -# -------------------------------------------------------------------- -# ------------------------- image functions -------------------------- -# -------------------------------------------------------------------- - - -# function to create a crypted password file for an image -# param 1 : image id -# param 2 : plain password -function openqrm_server_set_image_password() { - OPENQRM_IMAGE_ID=$1 - OPENQRM_IMAGE_PASSWORD=$2 - echo "openQRM-server: Setting root-password for image $OPENQRM_IMAGE_ID" | logger - $OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-crypt $OPENQRM_IMAGE_PASSWORD > $OPENQRM_SERVER_BASE_DIR/openqrm/web/action/image-auth/iauth.$OPENQRM_IMAGE_ID.php - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/web/action/image-auth/iauth.$OPENQRM_IMAGE_ID.php -} - - - - - -# -------------------------------------------------------------------- -# ------------------------- deployments functions ------------------------- -# -------------------------------------------------------------------- - -# function to add a deployment method to the openQRM-server db -# this function is used by the init+uninstall functions of the deployment plugins -# param 1 : username -# param 2 : password -# param 3 : deployment name -# param 4 : deployment type -# param 5 : deployment description -# param 6 : deployment storagetype -# param 7 : deployment storagetype description -# param 8 : deployment mapping -function openqrm_server_add_deployment_type() { - OPENQRM_USER=$1 - OPENQRM_USER_PASSWORD=$2 - OPENQRM_SERVER_DEPLOYMENT_NAME=$3 - OPENQRM_SERVER_DEPLOYMENT_TYPE=$4 - OPENQRM_SERVER_DEPLOYMENT_DESCRIPTION=$5 - OPENQRM_SERVER_DEPLOYMENT_STORAGE_TYPE=$6 - OPENQRM_SERVER_DEPLOYMENT_STORAGE_DESCRIPTION=$7 - OPENQRM_SERVER_DEPLOYMENT_MAPPING=$8 - if [ "$OPENQRM_SERVER_IP_ADDRESS" == "" ]; then - OPENQRM_SERVER_IP_ADDRESS="localhost" - fi - echo "openQRM-server: Adding deployment type $OPENQRM_SERVER_DEPLOYMENT_NAME to the openQRM-server" | logger - if ! $WGET -O /dev/null -q --http-user=$OPENQRM_USER --http-password=$OPENQRM_USER_PASSWORD "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/base/server/image/image-action.php?image_command=add_deployment_type&deployment_name=$OPENQRM_SERVER_DEPLOYMENT_NAME&deployment_type=$OPENQRM_SERVER_DEPLOYMENT_TYPE&deployment_description=$OPENQRM_SERVER_DEPLOYMENT_DESCRIPTION&deployment_storagetype=$OPENQRM_SERVER_DEPLOYMENT_STORAGE_TYPE&deployment_storagedescription=$OPENQRM_SERVER_DEPLOYMENT_STORAGE_DESCRIPTION&deployment_mapping=$OPENQRM_SERVER_DEPLOYMENT_MAPPING"; then - echo "ERROR: Could not add deployment type $OPENQRM_SERVER_DEPLOYMENT_NAME to the openQRM-server!" | logger - return 1 - fi - return 0 -} - -# function to remove a deployment method to the openQRM-server db -# this function is used by the init+uninstall functions of the deployment plugins -# param 1 : username -# param 2 : password -# param 3 : deployment name -function openqrm_server_remove_deployment_type() { - OPENQRM_USER=$1 - OPENQRM_USER_PASSWORD=$2 - OPENQRM_SERVER_DEPLOYMENT_NAME=$3 - if [ "$OPENQRM_SERVER_IP_ADDRESS" == "" ]; then - OPENQRM_SERVER_IP_ADDRESS="localhost" - fi - echo "openQRM-server: Removing deployment type $OPENQRM_SERVER_DEPLOYMENT_NAME from the openQRM-server" | logger - if ! $WGET -O /dev/null -q --http-user=$OPENQRM_USER --http-password=$OPENQRM_USER_PASSWORD "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/base/server/image/image-action.php?image_command=remove_deployment_type&deployment_name=$OPENQRM_SERVER_DEPLOYMENT_NAME"; then - echo "ERROR: Could not remove deployment type $OPENQRM_SERVER_DEPLOYMENT_NAME from the openQRM-server!" | logger - return 1 - fi - return 0 -} - - - -# -------------------------------------------------------------------- -# ------------------------- virtualization functions ------------------------- -# -------------------------------------------------------------------- - -# function to add a virtualization method to the openQRM-server db -# this function is used by the init+uninstall functions of the virtualization plugins -# param 1 : username -# param 2 : password -# param 3 : virtualization type -# param 4 : virtualization name -function openqrm_server_add_virtualization_type() { - OPENQRM_USER=$1 - OPENQRM_USER_PASSWORD=$2 - OPENQRM_SERVER_VIRTUALIZATION_TYPE=$3 - OPENQRM_SERVER_VIRTUALIZATION_NAME=$4 - if [ "$OPENQRM_SERVER_IP_ADDRESS" == "" ]; then - OPENQRM_SERVER_IP_ADDRESS="localhost" - fi - echo "openQRM-server: Adding virtualization type $OPENQRM_SERVER_VIRTUALIZATION_TYPE to the openQRM-server" | logger - if ! $WGET -O /dev/null -q --http-user=$OPENQRM_USER --http-password=$OPENQRM_USER_PASSWORD "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/base/server/resource/resource-action.php?resource_command=add_virtualization_type&virtualization_type=$OPENQRM_SERVER_VIRTUALIZATION_TYPE&virtualization_name=$OPENQRM_SERVER_VIRTUALIZATION_NAME"; then - echo "ERROR: Could not add virtualization type $OPENQRM_SERVER_VIRTUALIZATION_TYPE to the openQRM-server!" | logger - return 1 - fi - return 0 -} - -# function to remove a virtualization method to the openQRM-server db -# this function is used by the init+uninstall functions of the virtualization plugins -# param 1 : username -# param 2 : password -# param 3 : virtualization type -function openqrm_server_remove_virtualization_type() { - OPENQRM_USER=$1 - OPENQRM_USER_PASSWORD=$2 - OPENQRM_SERVER_VIRTUALIZATION_TYPE=$3 - if [ "$OPENQRM_SERVER_IP_ADDRESS" == "" ]; then - OPENQRM_SERVER_IP_ADDRESS="localhost" - fi - echo "openQRM-server: Removing virtualization type $OPENQRM_SERVER_VIRTUALIZATION_TYPE from the openQRM-server" | logger - if ! $WGET -O /dev/null -q --http-user=$OPENQRM_USER --http-password=$OPENQRM_USER_PASSWORD "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/base/server/resource/resource-action.php?resource_command=remove_virtualization_type&virtualization_type=$OPENQRM_SERVER_VIRTUALIZATION_TYPE"; then - echo "ERROR: Could not remove virtualization type $OPENQRM_SERVER_VIRTUALIZATION_TYPE from the openQRM-server!" | logger - return 1 - fi - return 0 -} - - - - -# -------------------------------------------------------------------- -# ------------------------- resource functions ----------------------- -# -------------------------------------------------------------------- - - - -# function adding a new resource to the openQRM-server -# param 1 : resource_id -# param 2 : kernel name -# param 3 : pxelinux.cfg filename -function openqrm_server_create_pxe_config() { - local RESOURCE_ID=$1 - local KERNEL_NAME=$2 - local RESOURCE_PXELINUXCFG_FILE=$3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-pxelinux | \ - sed -e "s/OPENQRM_BOOTIMAGE_KERNEL/vmlinuz-$KERNEL_NAME/g" | \ - sed -e "s/OPENQRM_BOOTIMAGE_INITRD/initrd-$KERNEL_NAME.img/g" | \ - sed -e "s/OPENQRM_RESOURCE_ID/$RESOURCE_ID/g" | \ - sed -e "s/OPENQRM_SERVER_IP_ADDRESS/$OPENQRM_SERVER_IP_ADDRESS/g" \ - > $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - - # allow plugin to re-write the pxe-config - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/include/openqrm-plugin-$OPENQRM_PLUGIN-assign-hook ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/include/openqrm-plugin-$OPENQRM_PLUGIN-assign-hook - OPENQRM_PLUGIN=`echo $OPENQRM_PLUGIN | sed -e "s/-/_/g"` - $OPENQRM_PLUGIN""_assign_hook $RESOURCE_ID $KERNEL_NAME $RESOURCE_PXELINUXCFG_FILE - fi - done -} - - - -# function adding a new resource to the openQRM-server -# param 1 : resource_id -# param 2 : resource_mac -# param 3 : resouce_ip -function openqrm_server_add_resource() { - local RESOURCE_ID=$1 - local RESOURCE_MAC=$2 - local RESOURCE_IP_ADDRESS=$3 - local RESOURCE_PXELINUXCFG_FILE=`echo 01-$RESOURCE_MAC | sed -e "s/:/-/g" | tr '[:upper:]' '[:lower:]'` - echo "openQRM-server: Adding resource $RESOURCE_ID $RESOURCE_MAC/$RESOURCE_IP_ADDRESS" | logger - openqrm_server_create_pxe_config $RESOURCE_ID default $RESOURCE_PXELINUXCFG_FILE -} - - -# function to remove a resource from the openQRM-server -# param 1 : resource_id -# param 2 : resource_mac -function openqrm_remove_resource() { - local RESOURCE_ID=$1 - local RESOURCE_MAC=$2 - local RESOURCE_PXELINUXCFG_FILE=`echo 01-$RESOURCE_MAC | sed -e "s/:/-/g" | tr '[:upper:]' '[:lower:]'` - echo "openQRM-server: Removing resource $RESOURCE_ID $RESOURCE_MAC/$RESOURCE_IP_ADDRESS" | logger - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE.idle -} - - - -# function to set a resource net or local boot -# param 1 : resource_id -# param 2 : resource_mac -# param 3 : resouce_ip -function openqrm_server_set_boot() { - local RESOURCE_BOOT=$1 - local RESOURCE_ID=$2 - local RESOURCE_MAC=$3 - local RESOURCE_IP_ADDRESS=$4 - local RESOURCE_PXELINUXCFG_FILE=`echo 01-$RESOURCE_MAC | sed -e "s/:/-/g" | tr '[:upper:]' '[:lower:]'` - if [ "$RESOURCE_BOOT" == "net" ]; then - echo "openQRM-server: Setting resource $RESOURCE_ID $RESOURCE_MAC/$RESOURCE_IP_ADDRESS to netboot" | logger - openqrm_server_create_pxe_config $RESOURCE_ID default $RESOURCE_PXELINUXCFG_FILE - else - echo "openQRM-server: Setting resource $RESOURCE_ID $RESOURCE_MAC/$RESOURCE_IP_ADDRESS to localboot" | logger - sed -i -e "s/^default.*/default local/g" $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - fi -} - - - - -# function to assign a kernel to a resource -# param 1 : resource_id -# param 2 : resource_mac -# param 3 : resouce_ip -function openqrm_assign_kernel() { - local RESOURCE_ID=$1 - local RESOURCE_MAC=$2 - local RESOURCE_KERNEL=$3 - local RESOURCE_PXELINUXCFG_FILE=`echo 01-$RESOURCE_MAC | sed -e "s/:/-/g" | tr '[:upper:]' '[:lower:]'` - echo "openQRM-server: Assigning resource $RESOURCE_ID $RESOURCE_MAC to kernel $RESOURCE_KERNEL" | logger - openqrm_server_create_pxe_config $RESOURCE_ID $RESOURCE_KERNEL $RESOURCE_PXELINUXCFG_FILE -} - - - - -# function to get infos about a resource -# param 1 : resource_mac -function openqrm_get_resource_parameter() { - local mac=$1 - if [ "$OPENQRM_SERVER_IP_ADDRESS" == "" ]; then - OPENQRM_SERVER_IP_ADDRESS="localhost" - fi - $WGET -q -O /tmp/$mac "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_mac=$mac" - . /tmp/$mac - for param in `cat /tmp/$mac`; do - KEY=`echo $param | cut -d'=' -f1` - if [ "$KEY" != '"' ]; then - export $KEY 2>/dev/null - fi - done -} - - - - -# -------------------------------------------------------------------- -# ------------------------- plugin functions ------------------------- -# -------------------------------------------------------------------- - -# function to run a plugin command -# param 1 : plugin_name -function openqrm_server_plugin_command() { - local PLUGIN_NAME=$1 - local PLUGIN_COMMAND=$2 - local PLUGIN_USER=$3 - local PLUGIN_PASS=$4 - local PLUGIN_INIT_SCRIPT="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/init.d/openqrm-plugin-$PLUGIN_NAME" - if [ -x $PLUGIN_INIT_SCRIPT ]; then - echo "openQRM-server: $PLUGIN_COMMAND openQRM plugin $PLUGIN_NAME user $PLUGIN_USER" | logger - $PLUGIN_INIT_SCRIPT $PLUGIN_COMMAND $PLUGIN_USER $PLUGIN_PASS & - else - echo "openQRM-server: $PLUGIN_NAME init script not found or not executable !" | logger - fi -} - - - - - - -# -------------------------------------------------------------------- -# ------------------------- state backup/restore functions ------------------------- -# -------------------------------------------------------------------- - -# function to backup/restore a server-state -# param 1 : -# param 1 : [name] -function openqrm_server_state() { - local CMD=$1 - local NAME=$2 - local NOW=`date +"%D_%T" | sed -e "s#/#-#g" | sed -e "s#:#.#g"` - local USAGE="Usage : openqrm_server_state backup/restore/remove/list [name]" - if [ ! -d $OPENQRM_SERVER_STATE_DIR ]; then - mkdir -p $OPENQRM_SERVER_STATE_DIR - fi - if [ "$CMD" == "" ]; then - echo $USAGE - return 1 - fi - if [ "$CMD" != "list" ] && [ "$NAME" == "" ]; then - echo $USAGE - return 1 - fi - - - - case $CMD in - backup) - echo "openQRM-server: Creating backup of the server state $NAME-$NOW" - rm -rf $OPENQRM_SERVER_STATE_DIR/$NAME - mkdir -p $OPENQRM_SERVER_STATE_DIR/$NAME - - # dirs - # adding the plugin-backup dirs to the dirlist - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/openqrm-plugin-$OPENQRM_PLUGIN.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/openqrm-plugin-$OPENQRM_PLUGIN.conf - OPENQRM_SERVER_STATE_DIRS="$OPENQRM_SERVER_STATE_DIRS $OPENQRM_PLUGIN_STATE_DIRS" - unset OPENQRM_PLUGIN_STATE_DIRS - fi - done - # now the static dirs - for DIR in $OPENQRM_SERVER_STATE_DIRS; do - if [ -d "$DIR" ]; then - mkdir -p `dirname $OPENQRM_SERVER_STATE_DIR/$NAME/$DIR` - cp -aR $DIR `dirname $OPENQRM_SERVER_STATE_DIR/$NAME/$DIR` - fi - done - - # files - # first add the enabled plugins state file - for RUNNING in `ls $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/plugins/`; do - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$RUNNING/web/.running ]; then - mkdir -p $OPENQRM_SERVER_STATE_DIR/$NAME/$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$RUNNING/web/ - touch $OPENQRM_SERVER_STATE_DIR/$NAME/$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$RUNNING/web/.running - fi - done - # now adding the plugin-backup files to the filelist - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/openqrm-plugin-$OPENQRM_PLUGIN.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/openqrm-plugin-$OPENQRM_PLUGIN.conf - OPENQRM_SERVER_STATE_FILES="$OPENQRM_SERVER_STATE_FILES $OPENQRM_PLUGIN_STATE_FILES" - unset OPENQRM_PLUGIN_STATE_FILES - fi - done - # now the static files - for FILE in $OPENQRM_SERVER_STATE_FILES; do - if [ -f "$FILE" ]; then - mkdir -p `dirname $OPENQRM_SERVER_STATE_DIR/$NAME/$FILE` - cp -af $FILE $OPENQRM_SERVER_STATE_DIR/$NAME/$FILE - fi - done - - RELATIVE_OPENQRM_SERVER_BASE_DIR=`echo $OPENQRM_SERVER_BASE_DIR | sed -e s"#/##"` - # db - $OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/$OPENQRM_DATABASE_TYPE/openqrm-$OPENQRM_DATABASE_TYPE-functions backup $OPENQRM_SERVER_STATE_DIR/$NAME/$RELATIVE_OPENQRM_SERVER_BASE_DIR/openqrm/database.sql - - # package - tar -C $OPENQRM_SERVER_STATE_DIR/$NAME -czf $OPENQRM_SERVER_STATE_DIR/$NAME-$NOW.tgz $RELATIVE_OPENQRM_SERVER_BASE_DIR/openqrm - rm -rf $OPENQRM_SERVER_STATE_DIR/$NAME - ;; - - restore) - if [ -f $OPENQRM_SERVER_STATE_DIR/$NAME.tgz ]; then - echo "openQRM-server: Restoring server state from $OPENQRM_SERVER_STATE_DIR/$NAME.tgz" - # files + dirs - tar -C / -xzf $OPENQRM_SERVER_STATE_DIR/$NAME.tgz - # db - $OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/$OPENQRM_DATABASE_TYPE/openqrm-$OPENQRM_DATABASE_TYPE-functions restore $OPENQRM_SERVER_BASE_DIR/openqrm/database.sql - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/database.sql - else - echo "openQRM-server: No such sever state file $NAME" - return 1 - fi - ;; - - remove) - if [ -f $OPENQRM_SERVER_STATE_DIR/$NAME.tgz ]; then - echo "openQRM-server: Removing server state $NAME-$NOW" - rm -f $OPENQRM_SERVER_STATE_DIR/$NAME.tgz - else - echo "openQRM-server: No such sever state file $NAME" - return 1 - fi - ;; - list) - ls $OPENQRM_SERVER_STATE_DIR | sed -s "s/\.tgz//g" - ;; - - *) - echo "openQRM-server: No such server-state command!" - return 1 - ;; - - - - esac - -} - - -# -------------------------------------------------------------------- - - - diff --git a/openQRM-5.3.50-CE/src/include/openqrm-server-functions~ b/openQRM-5.3.50-CE/src/include/openqrm-server-functions~ deleted file mode 100644 index a717688..0000000 --- a/openQRM-5.3.50-CE/src/include/openqrm-server-functions~ +++ /dev/null @@ -1,834 +0,0 @@ -#!/bin/bash -# this is the server function file for openQRM -# only server functions should go in here -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export LANGUAGE=C -export LANG=C -export LC_ALL=C - -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SERVER_BASE_DIR before sourcing $0" - exit 1 -fi - -# source the server configuration -OPENQRM_SERVER_CONF=$OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_CONF - -# some definitions -#OPENQRM_UNWANTED_MODULES="cops.o ipddp.o ltpc.o hdlcdrv.o airo_cs.o aironet4500_cs.o airo.o axnet_cs.o fmvj18x_cs.o ibmtr_cs.o netwave_cs.o nmclan_cs.o pcnet_cs.o ray_cs.o smc91c92_cs.o wavelan_cs.o wvlan_cs.o xirc2ps_cs.o xircom_cb.o xircom_tulip_cb.o ppp_async.o ppp_deflate.o ppp_generic.o ppp_synctty.o wavelan.o wd.o winbond-840.o airo_cs.o airo.o hermes.o orinoco_cs.o orinoco.o orinoco_plx.o orinoco_old_cs.o cops.ko ipddp.ko ltpc.ko hdlcdrv.ko airo_cs.ko aironet4500_cs.ko airo.ko axnet_cs.ko fmvj18x_cs.ko ibmtr_cs.ko netwave_cs.ko nmclan_cs.ko pcnet_cs.ko ray_cs.ko smc91c92_cs.ko wavelan_cs.ko wvlan_cs.ko xirc2ps_cs.ko xircom_cb.ko xircom_tulip_cb.ko ppp_async.ko ppp_deflate.ko ppp_generic.ko ppp_synctty.ko wavelan.ko wd.ko winbond-840.ko airo_cs.ko airo.ko hermes.ko orinoco_cs.ko orinoco.ko orinoco_plx.ko orinoco_old_cs.ko de600.ko de620.ko defxx.ko depca.ko hp100.ko hp.ko hp-plus.ko ne3210.ko ne.ko netwave_cs.ko ipw2100.ko proteon.ko skisa.ko vga16fb.ko atyfb.ko xen-netfront.ko" -OPENQRM_UNWANTED_MODULES="cops.o ipddp.o ltpc.o hdlcdrv.o airo_cs.o aironet4500_cs.o airo.o axnet_cs.o fmvj18x_cs.o ibmtr_cs.o netwave_cs.o nmclan_cs.o pcnet_cs.o ray_cs.o smc91c92_cs.o wavelan_cs.o wvlan_cs.o xirc2ps_cs.o xircom_cb.o xircom_tulip_cb.o ppp_async.o ppp_deflate.o ppp_generic.o ppp_synctty.o wavelan.o wd.o winbond-840.o airo_cs.o airo.o hermes.o orinoco_cs.o orinoco.o orinoco_plx.o orinoco_old_cs.o cops.ko ipddp.ko ltpc.ko hdlcdrv.ko airo_cs.ko aironet4500_cs.ko airo.ko axnet_cs.ko fmvj18x_cs.ko ibmtr_cs.ko netwave_cs.ko nmclan_cs.ko pcnet_cs.ko ray_cs.ko smc91c92_cs.ko wavelan_cs.ko wvlan_cs.ko xirc2ps_cs.ko xircom_cb.ko xircom_tulip_cb.ko ppp_async.ko ppp_deflate.ko ppp_generic.ko ppp_synctty.ko wavelan.ko wd.ko winbond-840.ko airo_cs.ko airo.ko hermes.ko orinoco_cs.ko orinoco.ko orinoco_plx.ko orinoco_old_cs.ko de600.ko de620.ko defxx.ko depca.ko hp100.ko hp.ko hp-plus.ko ne3210.ko ne.ko netwave_cs.ko ipw2100.ko proteon.ko skisa.ko atyfb.ko xen-netfront.ko" - -OPENQRM_DEFAULT_INITRD_TEMPLATE="$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-default.tgz" -OPENQRM_SERVER_LINUXRC="$OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-linuxrc" -OPENQRM_MAX_INITRD_SIZE=128000 -OPENQRM_DEFAULT_RAM_DISK_BLOCK_SIZE=1024 -# static directory define for the server state backups -OPENQRM_SERVER_STATE_DIR="/var/spool/openqrm-state" -# which files/dirs to backup/restore (base only, plugin need to care about their bacukp/restore themselves) -OPENQRM_SERVER_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - $OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-initrd-default.tgz \ - $OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-linuxrc" -OPENQRM_SERVER_STATE_DIRS="$OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/ \ - $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/ \ - $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/ \ - $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/plugins/" - - - -# translates cidr to subnet mask -function cidr2subnet () { - if [ "$1" != "" ]; then - set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0 - [ $1 -gt 1 ] && shift $1 || shift - echo ${1-0}.${2-0}.${3-0}.${4-0} - fi -} - - -# function to export all given configuration from the -# main openQRM-server config file -function openqrm_server_get_config() { - . $OPENQRM_SERVER_CONF - for VAR in `cat $OPENQRM_SERVER_CONF | grep -v ^# | grep OPENQRM | cut -d'=' -f1`; do - eval `export $VAR` - done - - # make sure /sbin and /usr/sbin are in our PATH, because we might be running as the webserver user, - # in which case the ifconfig and route commands will fail, leaving the variables empty (bad!) - PATH=/sbin:/usr/sbin:$PATH - # get ip configuration - export OPENQRM_SERVER_IP_ADDRESS=`ip a s $OPENQRM_SERVER_INTERFACE 2>/dev/null | grep -w $OPENQRM_SERVER_INTERFACE$ | grep -w inet | awk '{ print $2 }' | cut -d'/' -f1` - export OPENQRM_SERVER_BROADCAST_ADDRESS=`ip a s $OPENQRM_SERVER_INTERFACE 2>/dev/null | grep -w $OPENQRM_SERVER_INTERFACE$ | grep -w inet | awk '{ print $4 }' | cut -d'/' -f1` - export OPENQRM_SERVER_CIDR=`ip a s $OPENQRM_SERVER_INTERFACE 2>/dev/null | grep -w $OPENQRM_SERVER_INTERFACE$ | grep -w inet | awk '{ print $2 }' | cut -d'/' -f2` - export OPENQRM_SERVER_SUBNET_MASK=`cidr2subnet $OPENQRM_SERVER_CIDR` - export OPENQRM_SERVER_DEFAULT_GATEWAY=`route -n | grep ^0.0.0.0 | head -n1 | awk {' print $2 '}` -} -# run immediatly -openqrm_server_get_config - -# define wget to use with https -if [ "$OPENQRM_WEB_PROTOCOL" == "https" ]; then - export WGET="wget --no-check-certificate" -else - export WGET="wget" -fi - - -# -------------------------------------------------------------------- -# ------------------------- kernel functions ------------------------- -# -------------------------------------------------------------------- - - - -# function resolve kernel module dependencies -# param 1 : full path to kernel module -function modresolvdeps() { - MODULE=$1 - FMOD=`basename $MODULE` - FREST=`echo $MODULE | sed -e "s#.*\/kernel\/##g"` - DMOD=`echo $MODULE | sed -e "s#$FREST##g"` - DPENDLIST=`modinfo $MODULE | grep ^depends | cut -d':' -f2 | awk '{ print $1 }' | sed -e "s/,/ /g"` - if [ "$DPENDLIST" != "" ]; then - for MOD in `echo $DPENDLIST`; do - #echo $MOD - MODFULLPATH=`find $DMOD -name $MOD.ko` - echo $MODFULLPATH - modresolvdeps $MODFULLPATH - done - fi - -} - - - - -# function to create kernels -# param 1 : kernel name -# param 2 : kernel-version -# param 3 : path-to-kernel-files -function openqrm_server_create_kernel() { - - OPENQRM_SERVER_KERNEL_NAME=$1 - OPENQRM_SERVER_KERNEL_VERSION=$2 - OPENQRM_SERVER_KERNEL_LOCATION=$3 - - # OPENQRM_SERVER_KERNEL_TYPE can be "ext2" or "initramfs" - OPENQRM_SERVER_KERNEL_TYPE=$4 - OPENQRM_SERVER_INITRD_TEMPLATE=$5 - OPENQRM_SERVER_UNWANTED_MODULES=$6 - - if [ "$OPENQRM_SERVER_UNWANTED_MODULES" != "" ]; then - OPENQRM_SERVER_UNWANTED_MODULES_SPACES=`echo $OPENQRM_SERVER_UNWANTED_MODULES | sed -e "s/,/\.ko /g"`".ko" - OPENQRM_UNWANTED_MODULES="$OPENQRM_UNWANTED_MODULES $OPENQRM_SERVER_UNWANTED_MODULES_SPACES" - for MO in `echo $OPENQRM_SERVER_UNWANTED_MODULES_SPACES`; do - MODULES_EXCLUDE="$MODULES_EXCLUDE --exclude=$MO" - done - fi - - if [ "$OPENQRM_SERVER_KERNEL_TYPE" == "" ]; then - export OPENQRM_SERVER_KERNEL_TYPE="initramfs" - fi - if [ "$OPENQRM_SERVER_INITRD_TEMPLATE" == "" ]; then - export OPENQRM_SERVER_INITRD_TEMPLATE=$OPENQRM_DEFAULT_INITRD_TEMPLATE - fi - # kernel there ? - if [ ! -f "$OPENQRM_SERVER_KERNEL_LOCATION/boot/vmlinuz-$OPENQRM_SERVER_KERNEL_VERSION" ]; then - echo "ERROR: Cannot find kernel file at $OPENQRM_SERVER_KERNEL_LOCATION/boot/vmlinuz-$OPENQRM_SERVER_KERNEL_VERSION!" - return 1 - fi - # system.map there ? - if [ ! -f "$OPENQRM_SERVER_KERNEL_LOCATION/boot/System.map-$OPENQRM_SERVER_KERNEL_VERSION" ]; then - echo "ERROR: Cannot find System.map at $OPENQRM_SERVER_KERNEL_LOCATION/boot/System.map-$OPENQRM_SERVER_KERNEL_VERSION!" - return 1 - fi - # module dir there ? - if [ ! -d "$OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION" ]; then - echo "ERROR: Cannot find kernel module directory at $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION!" - return 1 - fi - # modules.pcimap there ? - if [ ! -f "$OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/modules.pcimap" ]; then - echo "WARNING: Cannot find modules.pcimap in kernel module directory at $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION. Trying to create it ..." - if ! depmod -a -m -F $OPENQRM_SERVER_KERNEL_LOCATION/boot/System.map-$OPENQRM_SERVER_KERNEL_VERSION -b $OPENQRM_SERVER_KERNEL_LOCATION $OPENQRM_SERVER_KERNEL_VERSION; then - echo "WARNING: Could not create modules.pcimap in kernel module directory at $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION! Trying to continue ..." - else - echo "NOTICE: Created modules.pcimap in kernel module directory at $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION." - fi - fi - - echo "Creating kernel $OPENQRM_SERVER_KERNEL_NAME version $OPENQRM_SERVER_KERNEL_VERSION ($OPENQRM_SERVER_KERNEL_TYPE initrd)" - - # copy kernel + System-map - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot - cp -a $OPENQRM_SERVER_KERNEL_LOCATION/boot/vmlinuz-$OPENQRM_SERVER_KERNEL_VERSION $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/vmlinuz-$OPENQRM_SERVER_KERNEL_NAME - cp -a $OPENQRM_SERVER_KERNEL_LOCATION/boot/System.map-$OPENQRM_SERVER_KERNEL_VERSION $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/System.map-$OPENQRM_SERVER_KERNEL_NAME - - # modules - #tar -C $OPENQRM_SERVER_KERNEL_LOCATION/ -czf $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/modules-$OPENQRM_SERVER_KERNEL_NAME.tgz lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - tar -C $OPENQRM_SERVER_KERNEL_LOCATION/ -czf $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/modules-$OPENQRM_SERVER_KERNEL_NAME.tgz $MODULES_EXCLUDE lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - - # initrd - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net -type f | grep -v wireless`; do - MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` - if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then - /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - # resolve deps - for L in `modresolvdeps $MODULE`; do - DEPNAME=`basename $L` - echo "--- adding module dependency $MODULE_NAME -> $DEPNAME" - /bin/cp -f $L $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - done - fi - done - - # also need virtio* for kvm virtio pci network card - for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers -type f -name virtio*`; do - MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` - if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then - /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - fi - done - - -# # also need igb for network cards -# for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers -type f -name igb`; do -# MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` -# if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then -# /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION -# fi -# done - -# # also need ixgbe for network cards -# for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers -type f -name ixgbe`; do -# MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` -# if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then -# /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION -# fi -# done - - # for networks support - for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/ -type f | egrep 'mptbase|mptsas|mptscsih|scsi_transport_sas|jfs|crc32|bnx2|bnx2x|usbhid|hid|mdio|dca|virtio'`; do - MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` - if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then - /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - fi - done - - - # need i2c modules - for igb - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/i2c $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/dca $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/dma $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/mfd $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/watchdog $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - - #for e1000e; ptp, pps - if [ -d $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ethernet/ ]; then - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ethernet/ - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ethernet/* $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ethernet/ - elif [ -d $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ ]; then - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/* $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/net/ - fi - #end igb - - #ptp, pps - if [ -d $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ptp ]; then - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ptp $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - fi - - if [ -d $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/pps ]; then - /bin/cp -Rf $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/pps $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/ - fi - # end ptp, pps - - - # also need dma modules - for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/kernel/drivers/dma -type f`; do - MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` - if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then - echo "- adding dma module $MODULE_NAME" - /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - # resolve deps - for L in `modresolvdeps $MODULE`; do - DEPNAME=`basename $L` - echo "--- adding module dependency $MODULE_NAME -> $DEPNAME" - /bin/cp -f $L $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - done - fi - done - #end dma - - # for bnx2 support - for MODULE in `find $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/ -type f | egrep 'mptbase|mptsas|mptscsih|scsi_transport_sas|jfs|crc32|bnx2|bnx2x|hid|mdio|dca|virtio'`; do - MODULE_NAME=`echo $MODULE | sed -e "s/.*\///"` - if ! echo $OPENQRM_UNWANTED_MODULES | grep $MODULE_NAME 1>/dev/null; then - /bin/cp -f $MODULE $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION - fi - done - # include firmware for bnx2/bnx2x - rm -rf $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/firmware - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/firmware/ - if ls $OPENQRM_SERVER_KERNEL_LOCATION/lib/firmware/bnx2* 2>/dev/null 1>&2; then -# /bin/cp -aRf $OPENQRM_SERVER_KERNEL_LOCATION/lib/firmware/bnx2* $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/firmware/ - /bin/cp -aRf /lib/firmware/bnx2* $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/firmware/ - fi - #end bnx2 - - - # include firmware for cxgb4 T4 & T5 adapters - #/bin/cp -aRf $OPENQRM_SERVER_KERNEL_LOCATION/lib/firmware/cxgb4 $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/firmware/ - /bin/cp -aRf /lib/firmware/cxgb4 $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/firmware/ - #end add firmware for cxgb4 T4 & T5 adapters - - - # also we need to take the modules.pcimap for the hardware detection to work - cp -a $OPENQRM_SERVER_KERNEL_LOCATION/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/modules.* $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/modules/$OPENQRM_SERVER_KERNEL_VERSION/ - # unpack the initrd-template - echo "-> using initrd-template from $OPENQRM_SERVER_INITRD_TEMPLATE" - tar -C $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME -xzf $OPENQRM_SERVER_INITRD_TEMPLATE - - # check size - OPENQRM_INITRD_SIZE=`du -s $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/ | awk {' print $1 '}` - OPENQRM_INITRD_SIZE=$(( OPENQRM_INITRD_SIZE + 16000 )) - if (( $OPENQRM_INITRD_SIZE > $OPENQRM_MAX_INITRD_SIZE )); then - echo "ERROR: Initrd got too big" - return 1 - fi - - # take udev from kernel-location - rm -rf $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/etc/udev - cp -aR $OPENQRM_SERVER_KERNEL_LOCATION/etc/udev $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/etc/ - # and /lib/udev - rm -rf $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/udev - cp -aR $OPENQRM_SERVER_KERNEL_LOCATION/lib/udev $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/lib/ - # take the initial console device - cp -aR $OPENQRM_SERVER_KERNEL_LOCATION/dev/console $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/dev/ - - # create run/udev dir for binding udevd socket - mkdir -p $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/run/udev - - # creating the initrd file - if [ "$OPENQRM_SERVER_KERNEL_TYPE" == "ext2" ]; then - echo "Creating the initrd as $OPENQRM_SERVER_KERNEL_TYPE" - dd if=/dev/zero of=$OPENQRM_TEMP_DIR/bootimage/initrd-$OPENQRM_SERVER_KERNEL_NAME.img bs=1k count=$OPENQRM_INITRD_SIZE - #get ram block size there is a problem in newer kernels with size 4096 - if [ -f "$OPENQRM_SERVER_KERNEL_LOCATION/boot/config-$OPENQRM_SERVER_KERNEL_VERSION" ]; then - ram_block_size=`cat $OPENQRM_SERVER_KERNEL_LOCATION/boot/config-$OPENQRM_SERVER_KERNEL_VERSION | grep CONFIG_BLK_DEV_RAM_BLOCKSIZE | awk -F= '{print $2}'` - if [ -z $ram_block_size ]; then - ram_block_size=$OPENQRM_DEFAULT_RAM_DISK_BLOCK_SIZE - fi - else - ram_block_size=$OPENQRM_DEFAULT_RAM_DISK_BLOCK_SIZE - fi - mkfs.ext2 -q -b $ram_block_size -F $OPENQRM_TEMP_DIR/bootimage/initrd-$OPENQRM_SERVER_KERNEL_NAME.img - tune2fs -c 0 -i 0 $OPENQRM_TEMP_DIR/bootimage/initrd-$OPENQRM_SERVER_KERNEL_NAME.img - mkdir -p $OPENQRM_TEMP_DIR/bootimage/mnt - mount -o loop $OPENQRM_TEMP_DIR/bootimage/initrd-$OPENQRM_SERVER_KERNEL_NAME.img $OPENQRM_TEMP_DIR/bootimage/mnt - mv $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/* $OPENQRM_TEMP_DIR/bootimage/mnt/ - # add the openQRM-linuxrc - rm -f $OPENQRM_TEMP_DIR/bootimage/mnt/linuxrc - cp $OPENQRM_SERVER_LINUXRC $OPENQRM_TEMP_DIR/bootimage/mnt/linuxrc - chmod +x $OPENQRM_TEMP_DIR/bootimage/mnt/linuxrc - umount $OPENQRM_TEMP_DIR/bootimage/mnt - gzip $OPENQRM_TEMP_DIR/bootimage/initrd-$OPENQRM_SERVER_KERNEL_NAME.img - mv $OPENQRM_TEMP_DIR/bootimage/initrd-$OPENQRM_SERVER_KERNEL_NAME.img.gz $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-$OPENQRM_SERVER_KERNEL_NAME.img - rm -rf $OPENQRM_TEMP_DIR/bootimage - elif [ "$OPENQRM_SERVER_KERNEL_TYPE" == "initramfs" ]; then - echo "Creating the initrd as $OPENQRM_SERVER_KERNEL_TYPE" - DIR_CURRENT=`pwd` - # add the openQRM-linuxrc as init - rm -f $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/linuxrc - rm -f $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/init - cp $OPENQRM_SERVER_LINUXRC $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/init - chmod +x $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/init - # pack with cpio - cd $OPENQRM_TEMP_DIR/bootimage/$OPENQRM_SERVER_KERNEL_NAME/ - find . | cpio -o -H newc | gzip -9 > $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-$OPENQRM_SERVER_KERNEL_NAME.img - cd $DIR_CURRENT - rm -rf $OPENQRM_TEMP_DIR/bootimage - else - echo "ERROR: Supported initrd types are ext2 and initramfs. type: " . $OPENQRM_SERVER_KERNEL_TYPE - return 1 - fi - chmod 444 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-$OPENQRM_SERVER_KERNEL_NAME.img - chmod 444 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/vmlinuz-$OPENQRM_SERVER_KERNEL_NAME - chmod 444 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/System.map-$OPENQRM_SERVER_KERNEL_NAME - chmod 444 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/modules-$OPENQRM_SERVER_KERNEL_NAME.tgz - # hook for plugins - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/include/openqrm-plugin-$OPENQRM_PLUGIN-kernel-hook ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/include/openqrm-plugin-$OPENQRM_PLUGIN-kernel-hook - PLUGIN_FUNCTION_NAME=`echo $OPENQRM_PLUGIN | sed -e "s/-/_/g"`""_kernel_hook - $PLUGIN_FUNCTION_NAME $OPENQRM_SERVER_KERNEL_NAME $OPENQRM_SERVER_KERNEL_VERSION $OPENQRM_SERVER_KERNEL_LOCATION $OPENQRM_SERVER_KERNEL_TYPE - fi - done -} - - - -# function to add/remove a kernel to the openQRM-server db -# param 1 : add/remove -# param 2 : user -# param 3 : password -# param 4 : kernel name -# param 5 : kernel-version -function openqrm_server_manage_kernel() { - OPENQRM_USER=$2 - OPENQRM_USER_PASSWORD=$3 - OPENQRM_SERVER_KERNEL_NAME=$4 - OPENQRM_SERVER_KERNEL_VERSION=$5 - if [ "$OPENQRM_SERVER_IP_ADDRESS" == "" ]; then - OPENQRM_SERVER_IP_ADDRESS="localhost" - fi - case "$1" in - add) - echo "openQRM-server: Adding kernel $OPENQRM_SERVER_KERNEL_NAME version $OPENQRM_SERVER_KERNEL_VERSION" | logger - if ! $WGET -O /dev/null --http-user=$OPENQRM_USER --http-password=$OPENQRM_USER_PASSWORD "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/base/server/kernel/kernel-action.php?kernel_command=new_kernel&kernel_name=$OPENQRM_SERVER_KERNEL_NAME&kernel_version=$OPENQRM_SERVER_KERNEL_VERSION"; then - echo "ERROR: Could not add kernel $OPENQRM_SERVER_KERNEL_NAME to the openQRM-server!" | logger - return 1 - fi - return 0 - ;; - remove) - echo "openQRM-server: Removing kernel $OPENQRM_SERVER_KERNEL_NAME" | logger - if ! $WGET -O /dev/null --http-user=$OPENQRM_USER --http-password=$OPENQRM_USER_PASSWORD "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/base/server/kernel/kernel-action.php?kernel_command=remove_by_name&kernel_name=$OPENQRM_SERVER_KERNEL_NAME"; then - echo "ERROR: Could not remove kernel $OPENQRM_SERVER_KERNEL_NAME to the openQRM-server!" | logger - return 1 - fi - return 0 - ;; - esac -} - - -# function to set the default kernel -# param 1 : kernel-name -function openqrm_server_set_default_kernel() { - OPENQRM_KERNEL_NAME=$1 - echo "openQRM-server: Setting kernel $OPENQRM_KERNEL_NAME as default kernel" | logger - if [ "$OPENQRM_KERNEL_NAME" != "default" ]; then - cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/vmlinuz-$OPENQRM_KERNEL_NAME $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/vmlinuz-default - cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/System.map-$OPENQRM_KERNEL_NAME $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/System.map-default - cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-$OPENQRM_KERNEL_NAME.img $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-default.img - cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/modules-$OPENQRM_KERNEL_NAME.tgz $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/modules-default.tgz - fi -} - - -# -------------------------------------------------------------------- -# ------------------------- image functions -------------------------- -# -------------------------------------------------------------------- - - -# function to create a crypted password file for an image -# param 1 : image id -# param 2 : plain password -function openqrm_server_set_image_password() { - OPENQRM_IMAGE_ID=$1 - OPENQRM_IMAGE_PASSWORD=$2 - echo "openQRM-server: Setting root-password for image $OPENQRM_IMAGE_ID" | logger - $OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-crypt $OPENQRM_IMAGE_PASSWORD > $OPENQRM_SERVER_BASE_DIR/openqrm/web/action/image-auth/iauth.$OPENQRM_IMAGE_ID.php - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/web/action/image-auth/iauth.$OPENQRM_IMAGE_ID.php -} - - - - - -# -------------------------------------------------------------------- -# ------------------------- deployments functions ------------------------- -# -------------------------------------------------------------------- - -# function to add a deployment method to the openQRM-server db -# this function is used by the init+uninstall functions of the deployment plugins -# param 1 : username -# param 2 : password -# param 3 : deployment name -# param 4 : deployment type -# param 5 : deployment description -# param 6 : deployment storagetype -# param 7 : deployment storagetype description -# param 8 : deployment mapping -function openqrm_server_add_deployment_type() { - OPENQRM_USER=$1 - OPENQRM_USER_PASSWORD=$2 - OPENQRM_SERVER_DEPLOYMENT_NAME=$3 - OPENQRM_SERVER_DEPLOYMENT_TYPE=$4 - OPENQRM_SERVER_DEPLOYMENT_DESCRIPTION=$5 - OPENQRM_SERVER_DEPLOYMENT_STORAGE_TYPE=$6 - OPENQRM_SERVER_DEPLOYMENT_STORAGE_DESCRIPTION=$7 - OPENQRM_SERVER_DEPLOYMENT_MAPPING=$8 - if [ "$OPENQRM_SERVER_IP_ADDRESS" == "" ]; then - OPENQRM_SERVER_IP_ADDRESS="localhost" - fi - echo "openQRM-server: Adding deployment type $OPENQRM_SERVER_DEPLOYMENT_NAME to the openQRM-server" | logger - if ! $WGET -O /dev/null -q --http-user=$OPENQRM_USER --http-password=$OPENQRM_USER_PASSWORD "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/base/server/image/image-action.php?image_command=add_deployment_type&deployment_name=$OPENQRM_SERVER_DEPLOYMENT_NAME&deployment_type=$OPENQRM_SERVER_DEPLOYMENT_TYPE&deployment_description=$OPENQRM_SERVER_DEPLOYMENT_DESCRIPTION&deployment_storagetype=$OPENQRM_SERVER_DEPLOYMENT_STORAGE_TYPE&deployment_storagedescription=$OPENQRM_SERVER_DEPLOYMENT_STORAGE_DESCRIPTION&deployment_mapping=$OPENQRM_SERVER_DEPLOYMENT_MAPPING"; then - echo "ERROR: Could not add deployment type $OPENQRM_SERVER_DEPLOYMENT_NAME to the openQRM-server!" | logger - return 1 - fi - return 0 -} - -# function to remove a deployment method to the openQRM-server db -# this function is used by the init+uninstall functions of the deployment plugins -# param 1 : username -# param 2 : password -# param 3 : deployment name -function openqrm_server_remove_deployment_type() { - OPENQRM_USER=$1 - OPENQRM_USER_PASSWORD=$2 - OPENQRM_SERVER_DEPLOYMENT_NAME=$3 - if [ "$OPENQRM_SERVER_IP_ADDRESS" == "" ]; then - OPENQRM_SERVER_IP_ADDRESS="localhost" - fi - echo "openQRM-server: Removing deployment type $OPENQRM_SERVER_DEPLOYMENT_NAME from the openQRM-server" | logger - if ! $WGET -O /dev/null -q --http-user=$OPENQRM_USER --http-password=$OPENQRM_USER_PASSWORD "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/base/server/image/image-action.php?image_command=remove_deployment_type&deployment_name=$OPENQRM_SERVER_DEPLOYMENT_NAME"; then - echo "ERROR: Could not remove deployment type $OPENQRM_SERVER_DEPLOYMENT_NAME from the openQRM-server!" | logger - return 1 - fi - return 0 -} - - - -# -------------------------------------------------------------------- -# ------------------------- virtualization functions ------------------------- -# -------------------------------------------------------------------- - -# function to add a virtualization method to the openQRM-server db -# this function is used by the init+uninstall functions of the virtualization plugins -# param 1 : username -# param 2 : password -# param 3 : virtualization type -# param 4 : virtualization name -function openqrm_server_add_virtualization_type() { - OPENQRM_USER=$1 - OPENQRM_USER_PASSWORD=$2 - OPENQRM_SERVER_VIRTUALIZATION_TYPE=$3 - OPENQRM_SERVER_VIRTUALIZATION_NAME=$4 - if [ "$OPENQRM_SERVER_IP_ADDRESS" == "" ]; then - OPENQRM_SERVER_IP_ADDRESS="localhost" - fi - echo "openQRM-server: Adding virtualization type $OPENQRM_SERVER_VIRTUALIZATION_TYPE to the openQRM-server" | logger - if ! $WGET -O /dev/null -q --http-user=$OPENQRM_USER --http-password=$OPENQRM_USER_PASSWORD "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/base/server/resource/resource-action.php?resource_command=add_virtualization_type&virtualization_type=$OPENQRM_SERVER_VIRTUALIZATION_TYPE&virtualization_name=$OPENQRM_SERVER_VIRTUALIZATION_NAME"; then - echo "ERROR: Could not add virtualization type $OPENQRM_SERVER_VIRTUALIZATION_TYPE to the openQRM-server!" | logger - return 1 - fi - return 0 -} - -# function to remove a virtualization method to the openQRM-server db -# this function is used by the init+uninstall functions of the virtualization plugins -# param 1 : username -# param 2 : password -# param 3 : virtualization type -function openqrm_server_remove_virtualization_type() { - OPENQRM_USER=$1 - OPENQRM_USER_PASSWORD=$2 - OPENQRM_SERVER_VIRTUALIZATION_TYPE=$3 - if [ "$OPENQRM_SERVER_IP_ADDRESS" == "" ]; then - OPENQRM_SERVER_IP_ADDRESS="localhost" - fi - echo "openQRM-server: Removing virtualization type $OPENQRM_SERVER_VIRTUALIZATION_TYPE from the openQRM-server" | logger - if ! $WGET -O /dev/null -q --http-user=$OPENQRM_USER --http-password=$OPENQRM_USER_PASSWORD "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/base/server/resource/resource-action.php?resource_command=remove_virtualization_type&virtualization_type=$OPENQRM_SERVER_VIRTUALIZATION_TYPE"; then - echo "ERROR: Could not remove virtualization type $OPENQRM_SERVER_VIRTUALIZATION_TYPE from the openQRM-server!" | logger - return 1 - fi - return 0 -} - - - - -# -------------------------------------------------------------------- -# ------------------------- resource functions ----------------------- -# -------------------------------------------------------------------- - - - -# function adding a new resource to the openQRM-server -# param 1 : resource_id -# param 2 : kernel name -# param 3 : pxelinux.cfg filename -function openqrm_server_create_pxe_config() { - local RESOURCE_ID=$1 - local KERNEL_NAME=$2 - local RESOURCE_PXELINUXCFG_FILE=$3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/etc/templates/openqrm-pxelinux | \ - sed -e "s/OPENQRM_BOOTIMAGE_KERNEL/vmlinuz-$KERNEL_NAME/g" | \ - sed -e "s/OPENQRM_BOOTIMAGE_INITRD/initrd-$KERNEL_NAME.img/g" | \ - sed -e "s/OPENQRM_RESOURCE_ID/$RESOURCE_ID/g" | \ - sed -e "s/OPENQRM_SERVER_IP_ADDRESS/$OPENQRM_SERVER_IP_ADDRESS/g" \ - > $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - - # allow plugin to re-write the pxe-config - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/include/openqrm-plugin-$OPENQRM_PLUGIN-assign-hook ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/include/openqrm-plugin-$OPENQRM_PLUGIN-assign-hook - OPENQRM_PLUGIN=`echo $OPENQRM_PLUGIN | sed -e "s/-/_/g"` - $OPENQRM_PLUGIN""_assign_hook $RESOURCE_ID $KERNEL_NAME $RESOURCE_PXELINUXCFG_FILE - fi - done -} - - - -# function adding a new resource to the openQRM-server -# param 1 : resource_id -# param 2 : resource_mac -# param 3 : resouce_ip -function openqrm_server_add_resource() { - local RESOURCE_ID=$1 - local RESOURCE_MAC=$2 - local RESOURCE_IP_ADDRESS=$3 - local RESOURCE_PXELINUXCFG_FILE=`echo 01-$RESOURCE_MAC | sed -e "s/:/-/g" | tr '[:upper:]' '[:lower:]'` - echo "openQRM-server: Adding resource $RESOURCE_ID $RESOURCE_MAC/$RESOURCE_IP_ADDRESS" | logger - openqrm_server_create_pxe_config $RESOURCE_ID default $RESOURCE_PXELINUXCFG_FILE -} - - -# function to remove a resource from the openQRM-server -# param 1 : resource_id -# param 2 : resource_mac -function openqrm_remove_resource() { - local RESOURCE_ID=$1 - local RESOURCE_MAC=$2 - local RESOURCE_PXELINUXCFG_FILE=`echo 01-$RESOURCE_MAC | sed -e "s/:/-/g" | tr '[:upper:]' '[:lower:]'` - echo "openQRM-server: Removing resource $RESOURCE_ID $RESOURCE_MAC/$RESOURCE_IP_ADDRESS" | logger - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE.idle -} - - - -# function to set a resource net or local boot -# param 1 : resource_id -# param 2 : resource_mac -# param 3 : resouce_ip -function openqrm_server_set_boot() { - local RESOURCE_BOOT=$1 - local RESOURCE_ID=$2 - local RESOURCE_MAC=$3 - local RESOURCE_IP_ADDRESS=$4 - local RESOURCE_PXELINUXCFG_FILE=`echo 01-$RESOURCE_MAC | sed -e "s/:/-/g" | tr '[:upper:]' '[:lower:]'` - if [ "$RESOURCE_BOOT" == "net" ]; then - echo "openQRM-server: Setting resource $RESOURCE_ID $RESOURCE_MAC/$RESOURCE_IP_ADDRESS to netboot" | logger - openqrm_server_create_pxe_config $RESOURCE_ID default $RESOURCE_PXELINUXCFG_FILE - else - echo "openQRM-server: Setting resource $RESOURCE_ID $RESOURCE_MAC/$RESOURCE_IP_ADDRESS to localboot" | logger - sed -i -e "s/^default.*/default local/g" $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - fi -} - - - - -# function to assign a kernel to a resource -# param 1 : resource_id -# param 2 : resource_mac -# param 3 : resouce_ip -function openqrm_assign_kernel() { - local RESOURCE_ID=$1 - local RESOURCE_MAC=$2 - local RESOURCE_KERNEL=$3 - local RESOURCE_PXELINUXCFG_FILE=`echo 01-$RESOURCE_MAC | sed -e "s/:/-/g" | tr '[:upper:]' '[:lower:]'` - echo "openQRM-server: Assigning resource $RESOURCE_ID $RESOURCE_MAC to kernel $RESOURCE_KERNEL" | logger - openqrm_server_create_pxe_config $RESOURCE_ID $RESOURCE_KERNEL $RESOURCE_PXELINUXCFG_FILE -} - - - - -# function to get infos about a resource -# param 1 : resource_mac -function openqrm_get_resource_parameter() { - local mac=$1 - if [ "$OPENQRM_SERVER_IP_ADDRESS" == "" ]; then - OPENQRM_SERVER_IP_ADDRESS="localhost" - fi - $WGET -q -O /tmp/$mac "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_mac=$mac" - . /tmp/$mac - for param in `cat /tmp/$mac`; do - KEY=`echo $param | cut -d'=' -f1` - if [ "$KEY" != '"' ]; then - export $KEY 2>/dev/null - fi - done -} - - - - -# -------------------------------------------------------------------- -# ------------------------- plugin functions ------------------------- -# -------------------------------------------------------------------- - -# function to run a plugin command -# param 1 : plugin_name -function openqrm_server_plugin_command() { - local PLUGIN_NAME=$1 - local PLUGIN_COMMAND=$2 - local PLUGIN_USER=$3 - local PLUGIN_PASS=$4 - local PLUGIN_INIT_SCRIPT="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$PLUGIN_NAME/etc/init.d/openqrm-plugin-$PLUGIN_NAME" - if [ -x $PLUGIN_INIT_SCRIPT ]; then - echo "openQRM-server: $PLUGIN_COMMAND openQRM plugin $PLUGIN_NAME user $PLUGIN_USER" | logger - $PLUGIN_INIT_SCRIPT $PLUGIN_COMMAND $PLUGIN_USER $PLUGIN_PASS & - else - echo "openQRM-server: $PLUGIN_NAME init script not found or not executable !" | logger - fi -} - - - - - - -# -------------------------------------------------------------------- -# ------------------------- state backup/restore functions ------------------------- -# -------------------------------------------------------------------- - -# function to backup/restore a server-state -# param 1 : -# param 1 : [name] -function openqrm_server_state() { - local CMD=$1 - local NAME=$2 - local NOW=`date +"%D_%T" | sed -e "s#/#-#g" | sed -e "s#:#.#g"` - local USAGE="Usage : openqrm_server_state backup/restore/remove/list [name]" - if [ ! -d $OPENQRM_SERVER_STATE_DIR ]; then - mkdir -p $OPENQRM_SERVER_STATE_DIR - fi - if [ "$CMD" == "" ]; then - echo $USAGE - return 1 - fi - if [ "$CMD" != "list" ] && [ "$NAME" == "" ]; then - echo $USAGE - return 1 - fi - - - - case $CMD in - backup) - echo "openQRM-server: Creating backup of the server state $NAME-$NOW" - rm -rf $OPENQRM_SERVER_STATE_DIR/$NAME - mkdir -p $OPENQRM_SERVER_STATE_DIR/$NAME - - # dirs - # adding the plugin-backup dirs to the dirlist - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/openqrm-plugin-$OPENQRM_PLUGIN.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/openqrm-plugin-$OPENQRM_PLUGIN.conf - OPENQRM_SERVER_STATE_DIRS="$OPENQRM_SERVER_STATE_DIRS $OPENQRM_PLUGIN_STATE_DIRS" - unset OPENQRM_PLUGIN_STATE_DIRS - fi - done - # now the static dirs - for DIR in $OPENQRM_SERVER_STATE_DIRS; do - if [ -d "$DIR" ]; then - mkdir -p `dirname $OPENQRM_SERVER_STATE_DIR/$NAME/$DIR` - cp -aR $DIR `dirname $OPENQRM_SERVER_STATE_DIR/$NAME/$DIR` - fi - done - - # files - # first add the enabled plugins state file - for RUNNING in `ls $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/plugins/`; do - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$RUNNING/web/.running ]; then - mkdir -p $OPENQRM_SERVER_STATE_DIR/$NAME/$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$RUNNING/web/ - touch $OPENQRM_SERVER_STATE_DIR/$NAME/$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$RUNNING/web/.running - fi - done - # now adding the plugin-backup files to the filelist - for OPENQRM_PLUGIN in `ls $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/`; do - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/openqrm-plugin-$OPENQRM_PLUGIN.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$OPENQRM_PLUGIN/etc/openqrm-plugin-$OPENQRM_PLUGIN.conf - OPENQRM_SERVER_STATE_FILES="$OPENQRM_SERVER_STATE_FILES $OPENQRM_PLUGIN_STATE_FILES" - unset OPENQRM_PLUGIN_STATE_FILES - fi - done - # now the static files - for FILE in $OPENQRM_SERVER_STATE_FILES; do - if [ -f "$FILE" ]; then - mkdir -p `dirname $OPENQRM_SERVER_STATE_DIR/$NAME/$FILE` - cp -af $FILE $OPENQRM_SERVER_STATE_DIR/$NAME/$FILE - fi - done - - RELATIVE_OPENQRM_SERVER_BASE_DIR=`echo $OPENQRM_SERVER_BASE_DIR | sed -e s"#/##"` - # db - $OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/$OPENQRM_DATABASE_TYPE/openqrm-$OPENQRM_DATABASE_TYPE-functions backup $OPENQRM_SERVER_STATE_DIR/$NAME/$RELATIVE_OPENQRM_SERVER_BASE_DIR/openqrm/database.sql - - # package - tar -C $OPENQRM_SERVER_STATE_DIR/$NAME -czf $OPENQRM_SERVER_STATE_DIR/$NAME-$NOW.tgz $RELATIVE_OPENQRM_SERVER_BASE_DIR/openqrm - rm -rf $OPENQRM_SERVER_STATE_DIR/$NAME - ;; - - restore) - if [ -f $OPENQRM_SERVER_STATE_DIR/$NAME.tgz ]; then - echo "openQRM-server: Restoring server state from $OPENQRM_SERVER_STATE_DIR/$NAME.tgz" - # files + dirs - tar -C / -xzf $OPENQRM_SERVER_STATE_DIR/$NAME.tgz - # db - $OPENQRM_SERVER_BASE_DIR/openqrm/etc/db/$OPENQRM_DATABASE_TYPE/openqrm-$OPENQRM_DATABASE_TYPE-functions restore $OPENQRM_SERVER_BASE_DIR/openqrm/database.sql - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/database.sql - else - echo "openQRM-server: No such sever state file $NAME" - return 1 - fi - ;; - - remove) - if [ -f $OPENQRM_SERVER_STATE_DIR/$NAME.tgz ]; then - echo "openQRM-server: Removing server state $NAME-$NOW" - rm -f $OPENQRM_SERVER_STATE_DIR/$NAME.tgz - else - echo "openQRM-server: No such sever state file $NAME" - return 1 - fi - ;; - list) - ls $OPENQRM_SERVER_STATE_DIR | sed -s "s/\.tgz//g" - ;; - - *) - echo "openQRM-server: No such server-state command!" - return 1 - ;; - - - - esac - -} - - -# -------------------------------------------------------------------- - - - diff --git a/openQRM-5.3.50-CE/src/make-assistant b/openQRM-5.3.50-CE/src/make-assistant deleted file mode 100644 index f69eac3..0000000 --- a/openQRM-5.3.50-CE/src/make-assistant +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# this script helps the "make" to call functions -# from within the Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=`pwd`/`dirname $0` -OPENQRM_SOURCE_DIR=$OPENQRM_SERVER_BASE_DIR -. $OPENQRM_SOURCE_DIR/etc/openqrm-server.conf -. $OPENQRM_SOURCE_DIR/include/openqrm-functions -. $OPENQRM_SOURCE_DIR/include/openqrm-build-functions -. $OPENQRM_SOURCE_DIR/include/openqrm-package-functions -MAKE_COMMAND=$1 - -if [ "$MAKE_COMMAND" == "" ]; then - echo "This script helps the "make" to call functions from within the Makefiles" - exit 0 -fi - -$@ diff --git a/openQRM-5.3.50-CE/src/plugins/Makefile b/openQRM-5.3.50-CE/src/plugins/Makefile deleted file mode 100644 index e63ddd8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# this is the main openQRM plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../etc/openqrm-server.conf - -all: configure compile - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn"`; do cd $$SRC_DIR && if [ ! -f deprecated ]; then make all; fi && cd ..; done - -configure: - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn"`; do cd $$SRC_DIR && if [ ! -f deprecated ]; then make configure; fi && cd ..; done - -compile: - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn"`; do cd $$SRC_DIR && if [ ! -f deprecated ]; then make; fi && cd ..; done - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn"`; do cd $$SRC_DIR && if [ ! -f deprecated ]; then make install; fi && cd ..; done - -uninstall: - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn"`; do cd $$SRC_DIR && if [ ! -f deprecated ]; then make uninstall; fi && cd ..; done - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins - -clean: - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn"`; do cd $$SRC_DIR && if [ ! -f deprecated ]; then make clean; fi && cd ..; done - -realclean: clean - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn"`; do cd $$SRC_DIR && if [ ! -f deprecated ]; then make realclean; fi && cd ..; done - -zips: - @for SRC_DIR in `find -mindepth 1 -maxdepth 1 -type d -not -name ".svn"`; do zip -r `basename $$SRC_DIR`.zip $$SRC_DIR; done - -.PHONY: all configure compile install uninstall clean realclean - diff --git a/openQRM-5.3.50-CE/src/plugins/amazon/Makefile b/openQRM-5.3.50-CE/src/plugins/amazon/Makefile deleted file mode 100644 index 5948698..0000000 --- a/openQRM-5.3.50-CE/src/plugins/amazon/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/amazon/etc - cp etc/openqrm-plugin-amazon.conf /usr/share/openqrm/plugins/amazon/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/amazon/etc/openqrm-plugin-amazon.conf b/openQRM-5.3.50-CE/src/plugins/amazon/etc/openqrm-plugin-amazon.conf deleted file mode 100644 index ea7605e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/amazon/etc/openqrm-plugin-amazon.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Amazon Cloud Computing with Amazon EC2 Public Cloud.
This plugin is only available in the openQRM Enterprise version!
Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="cloud" diff --git a/openQRM-5.3.50-CE/src/plugins/android/Makefile b/openQRM-5.3.50-CE/src/plugins/android/Makefile deleted file mode 100644 index 56fce04..0000000 --- a/openQRM-5.3.50-CE/src/plugins/android/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/android/etc - cp etc/openqrm-plugin-android.conf /usr/share/openqrm/plugins/android/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/android/etc/openqrm-plugin-android.conf b/openQRM-5.3.50-CE/src/plugins/android/etc/openqrm-plugin-android.conf deleted file mode 100644 index 19e73c8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/android/etc/openqrm-plugin-android.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Support for the Android Operating System in openQRM.
This plugin is only available in the openQRM Enterprise version!
Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="deployment" diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/Makefile b/openQRM-5.3.50-CE/src/plugins/ansible/Makefile deleted file mode 100644 index e16abe2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -# this is the openQRM ansible-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/ansible* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/default - . $(OPENQRM_SERVER_CONF) && cp -aR etc/default/* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/default/ - . $(OPENQRM_SERVER_CONF) && rm -rf `find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/default/ -name .svn` - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/cron.d - . $(OPENQRM_SERVER_CONF) && cp -aR etc/cron.d/*.cron $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/cron.d/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/tpl/ - . $(OPENQRM_SERVER_CONF) && chmod 777 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/lang/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/bin/openqrm* - . $(OPENQRM_SERVER_CONF) && tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible -czvf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/boot-service-ansible.tgz include/ etc/init.d/ansible - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/ansible - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/ansible/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/bin/openqrm-ansible-config b/openQRM-5.3.50-CE/src/plugins/ansible/bin/openqrm-ansible-config deleted file mode 100644 index dbad922..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/bin/openqrm-ansible-config +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# this script gets activated via cron to sequentially check -# if there are new config updates in the svn repo -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -SVN_COMMIT_MESSAGE="Automatically updated through openQRM ansible plugin" -CUR=`pwd` -export LANGUAGE=C -export LANG=C -export LC_ALL=C - -# here it commits any changes made through the web-interface -cd $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/ansible/ -# check for removed files -for r in `svn status . | grep ^"!" | awk {' print $2 '}`; do - echo "found removed file $r" | logger - svn del $r - svn commit -m "$SVN_COMMIT_MESSAGE" . | logger -done - -# add new files -svn add `find | grep -v svn` | logger -# commit -svn commit -m "$SVN_COMMIT_MESSAGE" . | logger -# update eventual changes from external -svn update . | logger - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/bin/openqrm-ansible-manager b/openQRM-5.3.50-CE/src/plugins/ansible/bin/openqrm-ansible-manager deleted file mode 100644 index 2b9c88b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/bin/openqrm-ansible-manager +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash -# this script automatically manages ansible -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/include/openqrm-plugin-ansible-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/openqrm-plugin-ansible.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -openqrm_server_get_config -export resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -export LANG=C -ANSIBLE_PLAYBOOK_LOG="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/log/playbook-apply.log" -export PATH=$PATH:/usr/local/bin - -# retries for applying playbooks -if [ "$OPENQRM_PLUGIN_ANSIBLE_RETRY" == "" ]; then - OPENQRM_PLUGIN_ANSIBLE_RETRY="60" -fi -# delay/timeout in seconds for retruying failed playbooks -if [ "$OPENQRM_PLUGIN_ANSIBLE_DELAY" == "" ]; then - OPENQRM_PLUGIN_ANSIBLE_DELAY="10" -fi - - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - -if ! which ansible 1>/dev/null; then - openqrm_unblock_starting_queue $@ - openqrm_post_event 0 "check" 3 "openqrm-ansible-manager" "The ansible utility is not installed! Please install and try again." - echo "ERROR: The 'ansible' utility is not installed! Please install and try again." - exit 6 -fi -if ! which ansible-playbook 1>/dev/null; then - openqrm_unblock_starting_queue $@ - openqrm_post_event 0 "check" 3 "openqrm-ansible-manager" "The ansible-playbook utility is not installed! Please install and try again." - echo "ERROR: The 'ansible-playbook' utility is not installed! Please install and try again." - exit 6 -fi - - -function ansible_manager_usage() { - echo "Usage : $0 apply server-id server-name server-ip" - exit 1 -} - - -FULL_COMMANDLINE="$0 $@" -ANSIBLE_MANAGER_COMMAND=$1 - -# main -case "$ANSIBLE_MANAGER_COMMAND" in - apply) - SERVER_ID=$2 - SERVER_NAME=$3 - SERVER_IP=$4 - SERVER_PLAYBOOK_CONFIG="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/ansible/server/$SERVER_NAME" - if [ ! -f "$SERVER_PLAYBOOK_CONFIG" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "apply" 5 "openqrm-ansible-manager" "No Ansible Playbooks configured for Server $SERVER_NAME" - exit 0 - fi - openqrm_post_event 0 "apply" 5 "openqrm-ansible-manager" "Starting Ansible configuration management for Server $SERVER_NAME" - - LOCK_TIME=`openqrm_lock_queue aquire ansible` - trap "openqrm_lock_queue release ansible $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # make sure the host/ip is not in the knownhosts file - ssh-keygen -R $SERVER_IP - ssh-keygen -R $SERVER_NAME - # add it to the knownhosts file by running a simple command - ANSIBLE_PLAYBOOK_RETRY_LOOP=0 - while ! $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/bin/openqrm-ansible-ssh $SERVER_IP ls; do - ANSIBLE_PLAYBOOK_RETRY_LOOP=$(( ANSIBLE_PLAYBOOK_RETRY_LOOP + 1 )) - if [ "$OPENQRM_PLUGIN_ANSIBLE_RETRY" == "$ANSIBLE_PLAYBOOK_RETRY_LOOP" ]; then - openqrm_post_event 0 "apply" 3 "openqrm-ansible-manager" "Applying Ansible Playbook $PLAYBOOK.yml to Server $SERVER_NAME timed out!" - break - fi - sleep $OPENQRM_PLUGIN_ANSIBLE_DELAY - done - - # run the configured playbooks - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/log - ANSIBLE_HOST_FILE=`mktemp /tmp/ansible.$SERVER_NAME.XXXXXX` || exit 1 - ANSIBLE_PLAYBOOK_FILE=`mktemp /tmp/ansible.$SERVER_NAME.XXXXXX` || exit 1 - echo $SERVER_IP > $ANSIBLE_HOST_FILE - for PLAYBOOK in `cat $SERVER_PLAYBOOK_CONFIG`; do - openqrm_post_event 0 "apply" 9 "openqrm-ansible-manager" "Applying Ansible Playbook $PLAYBOOK.yml to Server $SERVER_NAME" - cp $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/ansible/playbooks/$PLAYBOOK.yml -f $ANSIBLE_PLAYBOOK_FILE - sed -i -e "s/@@IP@@/$SERVER_IP/g" $ANSIBLE_PLAYBOOK_FILE - if ! ansible-playbook $ANSIBLE_PLAYBOOK_FILE -i $ANSIBLE_HOST_FILE 2>$ANSIBLE_PLAYBOOK_LOG 1>$ANSIBLE_PLAYBOOK_LOG; then - openqrm_post_event 0 "apply" 3 "openqrm-ansible-manager" "Applying Ansible Playbook $PLAYBOOK.yml to Server $SERVER_NAME failed!" - fi - openqrm_post_event 0 "apply" 10 "openqrm-ansible-manager" "Applying Ansible Playbook $PLAYBOOK.yml to Server $SERVER_NAME" - rm -f $ANSIBLE_PLAYBOOK_FILE - done - rm -f $ANSIBLE_HOST_FILE - - openqrm_lock_queue release ansible $LOCK_TIME - trap '' EXIT - - openqrm_post_event 0 "apply" 5 "openqrm-ansible-manager" "Ansible configuration management for Server $SERVER_NAME finished" - ;; - - start) - SERVER_ID=$2 - SERVER_NAME=$3 - SERVER_IP=$4 - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "start" 5 "openqrm-ansible-manager" "Server $SERVER_NAME id $SERVER_ID starting with ip-address $SERVER_IP." - ;; - stop) - SERVER_ID=$2 - SERVER_NAME=$3 - SERVER_IP=$4 - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "stop" 5 "openqrm-ansible-manager" "Server $SERVER_NAME id $SERVER_ID stopping with ip-address $SERVER_IP." - ;; - *) - echo "ERROR: Free commandline arguments are not allowed!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - ansible_manager_usage - exit 6 - ;; -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/bin/openqrm-ansible-ssh b/openQRM-5.3.50-CE/src/plugins/ansible/bin/openqrm-ansible-ssh deleted file mode 100644 index 6426d14..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/bin/openqrm-ansible-ssh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/expect -f -# expect script to answer the connect question at first login -# -# This file is part of openQRM. -# -# openQRM is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 -# as published by the Free Software Foundation. -# -# openQRM is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with openQRM. If not, see . -# -# Copyright 2011, OPENQRM AUSTRALIA PTY LTD -# - -if {[llength $argv]<2} { - send_user "usage: $argv0 \n" - exit -} -set hostname [lrange $argv 0 0] -set command [lrange $argv 1 1] -set timeout -1 - -spawn ssh root@$hostname $command -match_max 100000 - -expect { - -re ".*yes.*no.*" { - send "yes\r" - exp_continue - } - -re "Connection refused" {puts "Host error -> $expect_out(buffer)";exit 1} - -re "Connection closed" {puts "Host error -> $expect_out(buffer)";exit 1} - -re "no address.*" {puts "Host error -> $expect_out(buffer)";exit 1} - -re "Read from socket failed:.*" {puts "Host error -> $expect_out(buffer)";exit 1} - -re ".*Connection reset.*" {puts "Host error -> $expect_out(buffer)";exit 1} - timeout {puts "Timeout error. Is device down or unreachable?? ssh_expect";exit 1} - - send -- "$command\r" -} - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/etc/cron.d/openqrm-ansible-config.cron b/openQRM-5.3.50-CE/src/plugins/ansible/etc/cron.d/openqrm-ansible-config.cron deleted file mode 100644 index 0d1ac02..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/etc/cron.d/openqrm-ansible-config.cron +++ /dev/null @@ -1,16 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -MAILTO="" -* * * * * root @@OPENQRM_SERVER_BASE_DIR@@/openqrm/plugins/ansible/bin/openqrm-ansible-config diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/etc/default/playbooks/webserver.yml b/openQRM-5.3.50-CE/src/plugins/ansible/etc/default/playbooks/webserver.yml deleted file mode 100644 index ed8926f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/etc/default/playbooks/webserver.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- hosts: @@IP@@ - vars: - user: root - tasks: - - name: my custom command - shell: "/bin/echo hallo > /tmp/playbook.cmd" - handlers: diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/etc/init.d/ansible b/openQRM-5.3.50-CE/src/plugins/ansible/etc/init.d/ansible deleted file mode 100644 index a9df2ad..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/etc/init.d/ansible +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the ansible resources -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -# for including the package functions -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/include/openqrm-plugin-ansible-functions -. $OPENQRM_RESOURCE_PARAMETER_FILE -OPENQRM_SERVER_IP=$resource_openqrmserver - -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET="wget -q --no-check-certificate" -else - WGET="wget -q" -fi - -# do not run on idle resources -if [ "$resource_image" == "idle" ]; then - exit 0 -fi - -# also do not run before the real init of the rootfs -# if we have this file /etc/initrd-devices.conf we are still in the initrd -if [ -f /etc/initrd-devices.conf ]; then - exit 0 -fi - - -function ansible_start() { - echo "Starting the openQRM ansible-plugin" - ansible_stop 1>/dev/null 2>&1 - - # get the public ssh key from openQRM - SSHKEY_TMP_FILE=`mktemp /tmp/ansible.XXXXXX` || exit 1 - - if ! $WGET -O $SSHKEY_TMP_FILE $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/openqrm-server-public-ssh-key; then - echo "ERROR: Could not get the public ssh-key from opernQRM at $resource_openqrmserver!" - return 1 - fi - # add to authorized_keys - OPENQRM_PUBLIC_SSHKEY=`cat $SSHKEY_TMP_FILE` - if ! grep "$OPENQRM_PUBLIC_SSHKEY" /root/.ssh/authorized_keys 1>/dev/null 2>/dev/null; then - if [ ! -d /root/.ssh ]; then - mkdir -p /root/.ssh - chmod 700 /root/.ssh - fi - echo >> /root/.ssh/authorized_keys - cat $SSHKEY_TMP_FILE >> /root/.ssh/authorized_keys - echo >> /root/.ssh/authorized_keys - fi - if ! ps -C sshd 1>/dev/null; then - echo "...trying to start ssh/sshd" - if [ -x "/etc/init.d/ssh" ]; then - /etc/init.d/ssh start - elif [ -x "/etc/init.d/sshd" ]; then - /etc/init.d/sshd start - else - echo "WARNING: Could not start ssh/sshd! Init script not found" - fi - fi - - # trigger openQRM to apply the playbooks - if ! $WGET -O /dev/null "$openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/openqrm-ansible-apply.php?ansible_command=apply&ansible_id=$appliance_id&ansible_name=$appliance_name&ansible_mac=$resource_mac&ansible_ip=$resource_ip"; then - echo "ERROR: Could not apply Ansible Playbooks!" - return 1 - else - return 0 - fi -} - - -function ansible_stop() { - echo "Stopping the openQRM ansible-plugin" -} - - - - - -case "$1" in - start) - ansible_start - ;; - stop) - ansible_stop - ;; - restart) - ansible_stop - sleep 1 - ansible_start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 - -esac -exit $? - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/etc/init.d/openqrm-plugin-ansible b/openQRM-5.3.50-CE/src/plugins/ansible/etc/init.d/openqrm-plugin-ansible deleted file mode 100644 index 84236cb..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/etc/init.d/openqrm-plugin-ansible +++ /dev/null @@ -1,206 +0,0 @@ -#!/bin/bash -# init script for the openQRM ansible-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/include/openqrm-plugin-ansible-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/openqrm-plugin-ansible.conf -openqrm_server_get_config -export resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -export LANG=C -# define wget to use with https -if [ "$OPENQRM_WEB_PROTOCOL" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - - -function openqrm_plugin_ansible_start() { - echo "Starting the openQRM ansible-plugin" - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/ansible/.running -} - - -function openqrm_plugin_ansible_stop() { - echo "Stopping the openQRM ansible-plugin" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/ansible/.running -} - -function openqrm_plugin_ansible_uninstall() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "ansible: Please give a username to uninstall the plugin : " - read USERNAME - echo - echo -n "ansible: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Uninstalling the openQRM ansible-plugin" - openqrm_plugin_ansible_stop - rm -f /etc/cron.d/openqrm-ansible-config - if [ -x "/etc/init.d/cron" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d cron reload - else - /etc/init.d/cron reload - fi - elif [ -x /etc/init.d/crond ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d crond reload - else - /etc/init.d/crond reload - fi - else - openqrm_post_event 0 "openqrm_plugin_ansible_start" 3 "openqrm-plugin-ansible" "Could not find cron init script in /etc/init.d/. Please reload cron manually!" - fi - - # trigger init action to eventually remove cloud products - if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/cloud ]; then - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$USERNAME --http-password=$PASSWORD "$OPENQRM_WEB_PROTOCOL://$resource_openqrmserver/openqrm/base/plugins/ansible/ansible-action.php?ansible_command=uninstall"; then - openqrm_post_event 0 "openqrm_plugin_ansible_start" 3 "openqrm-plugin-ansible" "Could not trigger database hook. Please manually remove any Ansible Cloud products!" - fi - fi - - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/ansible - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-ansible.tgz - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/openqrm-ansible-apply.php - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible - return 0 -} - -function openqrm_plugin_ansible_init() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "ansible: Please give a username to init the plugin : " - read USERNAME - echo - echo -n "ansible: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - # check for the public ssh key - if [ ! -f "$OPENQRM_PLUGIN_ANSIBLE_PUBLIC_SSHKEY" ]; then - openqrm_post_event 0 "openqrm_plugin_ansible_start" 3 "openqrm-plugin-ansible" "Public SSH key file $OPENQRM_PLUGIN_ANSIBLE_PUBLIC_SSHKEY does not exists! Please create it!" - return 1 - fi - cp -f $OPENQRM_PLUGIN_ANSIBLE_PUBLIC_SSHKEY $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/openqrm-server-public-ssh-key - # add to authorized_keys - OPENQRM_PUBLIC_SSHKEY=`cat $OPENQRM_PLUGIN_ANSIBLE_PUBLIC_SSHKEY` - if ! grep "$OPENQRM_PUBLIC_SSHKEY" /root/.ssh/authorized_keys 1>/dev/null 2>/dev/null; then - openqrm_post_event 0 "openqrm_plugin_ansible_start" 5 "openqrm-plugin-ansible" "Adding Public SSH key file $OPENQRM_PLUGIN_ANSIBLE_PUBLIC_SSHKEY to /root/.ssh/authorized_keys" - echo >> /root/.ssh/authorized_keys - cat $OPENQRM_PLUGIN_ANSIBLE_PUBLIC_SSHKEY >> /root/.ssh/authorized_keys - echo >> /root/.ssh/authorized_keys - fi - CURRENTD=`pwd` - echo "Initializing the openQRM ansible-plugin" - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/ansible - # link the boot-service - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/boot-service-ansible.tgz $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-ansible.tgz - # link the apply - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/openqrm-ansible-apply.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/openqrm-ansible-apply.php - # create the svn dir - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible - svnadmin create $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible - svn import -q $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/default/ file://$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible/ -m "initial import" - # also co the files for the web-dir - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/ansible/ - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/ansible/ - cd $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/ansible/ - svn co -q file://$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible/ . - chmod -R 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/web/ansible/ - # setup access through ssh+svn - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible/conf/svnserve.conf - echo "[general]" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible/conf/svnserve.conf - echo "anon-access = read" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible/conf/svnserve.conf - echo "auth-access = write" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible/conf/svnserve.conf - echo "realm = openQRM Ansible configuration" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible/conf/svnserve.conf - echo "password-db = passwd" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible/conf/svnserve.conf - chmod -R 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible/db - cd $CURRENTD - # create cron job which will update the svn repo with files which were added by the web gui - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/cron.d/openqrm-ansible-config.cron | \ - sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" > /etc/cron.d/openqrm-ansible-config - if [ -x "/etc/init.d/cron" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d cron reload - else - /etc/init.d/cron reload - fi - elif [ -x /etc/init.d/crond ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d crond reload - else - /etc/init.d/crond reload - fi - else - echo "Could not find cron init script in /etc/init.d/. Please reload cron manually!" - openqrm_post_event 0 "openqrm_plugin_ansible_start" 3 "openqrm-plugin-ansible" "Could not find cron init script in /etc/init.d/. Please reload cron manually!" - fi - - # trigger init action to eventually add cloud products - if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/cloud ]; then - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$USERNAME --http-password=$PASSWORD "$OPENQRM_WEB_PROTOCOL://$resource_openqrmserver/openqrm/base/plugins/ansible/ansible-action.php?ansible_command=init"; then - openqrm_post_event 0 "openqrm_plugin_ansible_start" 3 "openqrm-plugin-ansible" "Could not trigger database hook. Please manually add Ansible Cloud products!" - fi - fi - return 0 -} - - - - - - - -USER=$2 -PASS=$3 - -case "$1" in - start) - openqrm_plugin_ansible_start - ;; - stop) - openqrm_plugin_ansible_stop - ;; - restart) - openqrm_plugin_ansible_stop - sleep 1 - openqrm_plugin_ansible_start - ;; - init) - openqrm_plugin_ansible_init $USER $PASS - ;; - uninstall) - openqrm_plugin_ansible_uninstall $USER $PASS - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/etc/init.d/openqrm-plugin-ansible.postinstall b/openQRM-5.3.50-CE/src/plugins/ansible/etc/init.d/openqrm-plugin-ansible.postinstall deleted file mode 100644 index f6758ec..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/etc/init.d/openqrm-plugin-ansible.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-ansible postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/etc/init.d/openqrm-plugin-ansible.preremove b/openQRM-5.3.50-CE/src/plugins/ansible/etc/init.d/openqrm-plugin-ansible.preremove deleted file mode 100644 index 298f54d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/etc/init.d/openqrm-plugin-ansible.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-ansible preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-ansible stop diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/etc/openqrm-plugin-ansible.conf b/openQRM-5.3.50-CE/src/plugins/ansible/etc/openqrm-plugin-ansible.conf deleted file mode 100644 index 611b264..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/etc/openqrm-plugin-ansible.conf +++ /dev/null @@ -1,49 +0,0 @@ -# this is the openQRM-plugin-ansible info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen, subversion, expect" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen, subversion, expect, ansible" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen, subversion, expect, ansible" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Integrates Ansible for fully automated Configuration Management and Application deployment." -OPENQRM_PLUGIN_TYPE="deployment" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# the public ssh key to use -OPENQRM_PLUGIN_ANSIBLE_PUBLIC_SSHKEY="/root/.ssh/id_rsa.pub" - -# retries for applying playbooks -OPENQRM_PLUGIN_ANSIBLE_RETRY="60" - -# delay/timeout in seconds for retruying failed playbooks -OPENQRM_PLUGIN_ANSIBLE_DELAY="10" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="" -# dirs which should be taken to the state backup -OPENQRM_PLUGIN_STATE_DIRS="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/ansible/etc/ansible" - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/include/openqrm-plugin-ansible-functions b/openQRM-5.3.50-CE/src/plugins/ansible/include/openqrm-plugin-ansible-functions deleted file mode 100644 index 0f63879..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/include/openqrm-plugin-ansible-functions +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# this is the functions file for the ansible-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -################ common ansible functions - -# logs for ansible -function ansible_log() { - local COMPONENT=$1 - shift - local MESSAGE=$@ - logger -i -t "ansible plug-in" "$COMPONENT : $MESSAGE" -} - - - - - -################ ansible functions - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/ansible-action.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/ansible-action.php deleted file mode 100644 index 927b51b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/ansible-action.php +++ /dev/null @@ -1,75 +0,0 @@ - -*/ -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once $RootDir."/include/openqrm-database-functions.php"; -require_once $RootDir."/include/user.inc.php"; -require_once $RootDir."/include/openqrm-server-config.php"; -require_once $RootDir."/class/storage.class.php"; -require_once $RootDir."/class/resource.class.php"; -require_once $RootDir."/class/event.class.php"; -require_once $RootDir."/class/authblocker.class.php"; -require_once $RootDir."/class/openqrm_server.class.php"; -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; -// filter inputs -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; -$ansible_command = $request->get('ansible_command'); -$cloud_product_hook = $RootDir.'/plugins/ansible/openqrm-ansible-cloud-product-hook.php'; -$cloud_selector_class = $RootDir.'/plugins/cloud/class/cloudselector.class.php'; - -global $IMAGE_INFO_TABLE; -global $DEPLOYMENT_INFO_TABLE; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); - -// user/role authentication -if ($OPENQRM_USER->role != "administrator") { - $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "ansible-action", "Un-Authorized access to ansible-actions from $OPENQRM_USER->name", "", "", 0, 0, 0); - exit(); -} - - -$event->log("$ansible_command", $_SERVER['REQUEST_TIME'], 5, "ansible-action", "Processing ansible command $ansible_command", "", "", 0, 0, 0); -switch ($ansible_command) { - case 'init': - if (file_exists($cloud_selector_class)) { - if (file_exists($cloud_product_hook)) { - require_once $cloud_product_hook; - openqrm_ansible_cloud_product("add", NULL); - } - } - break; - - case 'uninstall': - if (file_exists($cloud_selector_class)) { - if (file_exists($cloud_product_hook)) { - require_once $cloud_product_hook; - openqrm_ansible_cloud_product("remove", NULL); - } - } - break; - - default: - $event->log("$ansible_command", $_SERVER['REQUEST_TIME'], 3, "ansible-action", "No such ansible command ($ansible_command)", "", "", 0, 0, 0); - break; - - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible-about.controller.class.php deleted file mode 100644 index e7fe6f1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible-about.controller.class.php +++ /dev/null @@ -1,173 +0,0 @@ - - */ - - -class ansible_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'ansible_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'ansible_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'ansible_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'ansible_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About Ansible', - 'label' => 'About Ansible', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The Ansible plugin provides automated configuration-management for Server in openQRM. - It seamlessly integrates Ansible within the openQRM GUI and assists to apply pre-made or custom Ansible Playbooks to specific Server. - By enabling the plugin the Ansible-environment is pre-configured and initialyzed automatically according to best-practice experiences e.g. by keeping the ansible-configuration within a svn-repsitory. - Custom Ansible Playbookds can be added to the playbooks directory in the subversion repository. - All Playbooks will be automatically displayed in the Ansible plugin server manager. - The ansible-configuration repository is also available for external svn clients. - To check out the ansible-repo please run

:', - 'introduction_title1' => 'Assigning Applications to Server', - 'introduction_content1' => '
  1. Go to the "Server" in the Ansible plugin menu
  2. -
  3. Select a Server to be configured via Ansible
  4. -
  5. Select the Ansible Playbookds to be applied to the server
- Within short time the ansible-server will distribute the new configuration to the Appliance automatically.', - 'requirements_title' => 'Requirements', - 'requirements_list' => '
  • The Ansible Plugin depends on the Dhcpd Plugin! Please make sure to have the Dhcpd Plugin enabled and started before.
  • ', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - 'provides_title' => 'Provides', - 'provides_list' => '
  • Automated configuration-management for Server in openQRM
  • ', - 'type_title' => 'Plugin Type', - 'type_content' => 'Deployment', - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - ), -); - - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/ansible/lang", 'ansible-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/ansible/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About Ansible - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/ansible/class/ansible-about.documentation.class.php'); - $controller = new ansible_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible-about.documentation.class.php deleted file mode 100644 index 6666fb1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible-about.documentation.class.php +++ /dev/null @@ -1,92 +0,0 @@ - - */ - -class ansible_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'ansible_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "ansible_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $svn_co_command = "svn co svn+ssh://[user]@[openqrm-server-ip]".$this->basedir."/openqrm/plugins/ansible/etc/ansible/"; - $t = $this->response->html->template($this->tpldir.'/ansible-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($svn_co_command, 'introduction_command'); - $t->add($this->lang['introduction_title1'], 'introduction_title1'); - $t->add($this->lang['introduction_content1'], 'introduction_content1'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible.class.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible.class.php deleted file mode 100644 index 223676c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible.class.php +++ /dev/null @@ -1,145 +0,0 @@ - -*/ - - -// This class represents a ansible user in openQRM - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/folder.class.php"; -require_once "$RootDir/class/file.class.php"; - -$event = new event(); -global $event; - -$ansible_playbook_dir = "$RootDir/plugins/ansible/ansible/playbooks"; -global $ansible_playbook_dir; -$ansible_server_dir = "$RootDir/plugins/ansible/ansible/server"; -global $ansible_server_dir; - -class ansible { - - function __construct() { - $RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; - $this->playbook_dir = $RootDir.'/plugins/ansible/ansible/playbooks'; - $this->server_dir = $RootDir.'/plugins/ansible/ansible/server'; - $this->event = new event(); - } - -// --------------------------------------------------------------------------------- -// general ansibleconfig methods -// --------------------------------------------------------------------------------- - - -function get_available_playbooks() { - $app_dir = new folder(); - $app_dir->getFolderContent($this->playbook_dir); - $ansible_playbooks = array(); - $ansible_playbooks = $app_dir->files; - $ansible_playbook_array = array(); - foreach($ansible_playbooks as $ansible) { - $ansible_playbook = str_replace(".yml", "", $ansible->name); - $ansible_playbook_array[] .= $ansible_playbook; - } - return $ansible_playbook_array; -} - - - -function get_playbook_info($group_name) { - $filename = $this->playbook_dir."/".$group_name.".yml"; - if (file_exists($filename)) { - if (!$handle = fopen($filename, 'r')) { - $this->event->log("get_playbook_info", $_SERVER['REQUEST_TIME'], 2, "ansible.class.php", "Cannot open file ($filename)", "", "", 0, 0, 0); - exit; - } - while (!feof($handle)) { - $info = fgets($handle, 4096); - if (strstr($info, "#")) { - $info = str_replace("#", "", $info); - fclose($handle); - return $info; - } - } - } -} - - -function get_supported_os($group_name) { - $filename = $this->playbook_dir."/".$group_name.".yml"; - if (file_exists($filename)) { - if (!$handle = fopen($filename, 'r')) { - $this->event->log("get_supported_os", $_SERVER['REQUEST_TIME'], 2, "ansible.class.php", "Cannot open file ($filename)", "", "", 0, 0, 0); - exit; - } - while (!feof($handle)) { - $os_version = fgets($handle, 4096); - if (strstr($os_version, "# os:")) { - $os_version = str_replace("# os:", "", $os_version); - fclose($handle); - $os_version_arr = explode(",", $os_version); - return $os_version_arr; - } - } - } -} - - -function set_playbooks($appliance_name, $ansible_playbook_array) { - $filename = $this->server_dir."/".$appliance_name; - if (!$handle = fopen($filename, 'w+')) { - $this->event->log("set_playbook", $_SERVER['REQUEST_TIME'], 2, "ansible.class.php", "Cannot open file ($filename)", "", "", 0, 0, 0); - exit; - } - foreach($ansible_playbook_array as $ansible_playbook) { - fwrite($handle, $ansible_playbook."\n"); - } - $empty = count($ansible_playbook_array); - fclose($handle); -} - - -function get_playbooks($appliance_name) { - $ansible_playbook_array = array(); - $filename = $this->server_dir."/".$appliance_name; - - if (file_exists($filename)) { - if (!$handle = fopen($filename, 'r')) { - $this->event->log("get_playbooks", $_SERVER['REQUEST_TIME'], 2, "ansible.class.php", "Cannot open file ($filename)", "", "", 0, 0, 0); - exit; - } - while (!feof($handle)) { - $buffer = fgets($handle, 4096); - $buffer = trim($buffer); - $ansible_playbook_array[] .= $buffer; - } - fclose($handle); - } - return $ansible_playbook_array; -} - -function remove_appliance($appliance_name) { - $filename = $this->server_dir."/".$appliance_name; - if (file_exists($filename)) { - unlink($filename); - } -} - - -// --------------------------------------------------------------------------------- - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible.controller.class.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible.controller.class.php deleted file mode 100644 index 843375a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible.controller.class.php +++ /dev/null @@ -1,208 +0,0 @@ - - */ - -class ansible_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'ansible_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "ansible_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'ansible_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'ansible_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array( - 'tab' => 'Appliances', - 'label' => 'Ansible Appliances', - 'id' => 'ID', - 'appliance' => 'Appliance', - 'name' => 'Name', - 'resource' => 'Resource', - 'playbooks' => 'Playbooks', - 'action_edit' => 'edit', - 'please_wait' => 'Loading. Please wait ..', - ), - 'edit' => array( - 'tab' => 'Edit', - 'label' => 'Ansible playbooks for appliance %s', - 'ansible_playbooks' => 'Ansible Playbooks', - 'apply_playbooks' => 'Direct apply the Playbooks', - 'msg_updated' => 'Updated appliance %s', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/ansible/lang", 'ansible.ini'); - $this->tpldir = $this->rootdir.'/plugins/ansible/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = 'select'; - } - - $content = array(); - switch( $this->action ) { - case '': - default: - case 'select': - $content[] = $this->select(true); - break; - case 'edit': - $content[] = $this->select(false); - $content[] = $this->edit(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->auto_tab = false; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * Select appliance - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/ansible/class/ansible.select.class.php'); - $controller = new ansible_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Edit appliance - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function edit( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/ansible/class/ansible.edit.class.php'); - $controller = new ansible_edit($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['edit']; - $data = $controller->action(); - } - $content['label'] = $this->lang['edit']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'edit' ); - $content['onclick'] = false; - if($this->action === 'edit'){ - $content['active'] = true; - } - return $content; - } - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible.edit.class.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible.edit.class.php deleted file mode 100644 index 853c77f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible.edit.class.php +++ /dev/null @@ -1,208 +0,0 @@ - - */ - -class ansible_edit -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'ansible_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "ansible_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'ansible_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'ansible_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->tpldir = $this->rootdir.'/plugins/ansible/tpl'; - - require_once($this->openqrm->get('basedir').'/plugins/ansible/web/class/ansible.class.php'); - $this->ansible = new ansible(); - - $id = $this->response->html->request()->get('appliance_id'); - $this->response->add('appliance_id', $id); - - $appliance = $this->openqrm->appliance(); - $this->appliance = $appliance->get_instance_by_id($id); - $resource = $this->openqrm->resource(); - $this->resource = $resource->get_instance_by_id($appliance->resources); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action() { - - $response = $this->edit(); - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - if(isset($response->msg)) { - $response->redirect( - $response->get_url($this->actions_name, 'select', $this->message_param, $response->msg) - ); - } - $data['canceled'] = $this->lang['canceled']; - $data['please_wait'] = $this->lang['please_wait']; - $data['prefix_tab'] = $this->prefix_tab; - $data['label'] = sprintf($this->lang['label'], $this->appliance->name); - $data['baseurl'] = $this->openqrm->get('baseurl'); - $data['thisfile'] = $response->html->thisfile; - $t = $response->html->template($this->tpldir.'/ansible-edit.tpl.php'); - $t->add($response->form); - $t->add($data); - $t->group_elements(array('param_' => 'form')); - - return $t; - - } - - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function edit() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $response->submit()) { - $playbooks = $form->get_request('playbooks'); - $this->ansible->remove_appliance($this->appliance->name); - if(!in_array('{empty}', $playbooks)) { - $this->ansible->set_playbooks($this->appliance->name, $playbooks); - } - // apply directly - $apply = $form->get_request('apply'); - if ($apply == '1') { - $command = $this->openqrm->get('basedir')."/plugins/ansible/bin/openqrm-ansible-manager apply ".$this->appliance->id." ".$this->appliance->name." ".$this->resource->ip; - $command .= " --openqrm-cmd-mode fork"; - $openqrm_server = new openqrm_server(); - $openqrm_server->send_command($command); - } - $response->msg = sprintf($this->lang['msg_updated'], $this->appliance->name); - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param enum $mode [select|edit] - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - - $response = $this->response; - $form = $response->get_form($this->actions_name, 'edit'); - $selected = $this->ansible->get_playbooks($this->appliance->name); - $playbooks = $this->ansible->get_available_playbooks(); - - $select = array('{empty}', ' '); - foreach($playbooks as $v) { - $o = $response->html->option(); - $o->value = $v; - $o->label = $v; - $o->title = $this->ansible->get_playbook_info($v); - $select[] = $o; - } - $d['select']['label'] = $this->lang['ansible_playbooks']; - $d['select']['object']['type'] = 'htmlobject_select'; - $d['select']['object']['attrib']['name'] = 'playbooks[]'; - $d['select']['object']['attrib']['index'] = array(0,1); - $d['select']['object']['attrib']['multiple'] = true; - $d['select']['object']['attrib']['css'] = 'ansible_select'; - $d['select']['object']['attrib']['options'] = $select; - $d['select']['object']['attrib']['selected'] = $selected; - - $d['apply']['label'] = $this->lang['apply_playbooks']; - $d['apply']['object']['type'] = 'htmlobject_input'; - $d['apply']['object']['attrib']['type'] = 'checkbox'; - $d['apply']['object']['attrib']['name'] = 'apply'; - $d['apply']['object']['attrib']['value'] = '1'; - $d['apply']['object']['attrib']['checked'] = true; - - $form->add($d); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $response->form = $form; - return $response; - - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible.select.class.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible.select.class.php deleted file mode 100644 index 3922b5f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/class/ansible.select.class.php +++ /dev/null @@ -1,195 +0,0 @@ - - */ - -class ansible_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'ansible_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "ansible_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'ansible_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'ansible_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->tpldir = $this->rootdir.'/plugins/ansible/tpl'; - - require_once($this->openqrm->get('basedir').'/plugins/ansible/web/class/ansible.class.php'); - $this->ansible = new ansible(); - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $response = $this->select(); - $t = $this->response->html->template($this->tpldir.'/ansible-select.tpl.php'); - $t->add($this->prefix_tab, 'prefix_tab'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->table, 'table'); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['please_wait'], 'please_wait'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function select() { - $response = $this->response; - $appliance = new appliance(); - - $table = $this->response->html->tablebuilder('ansible', $this->response->get_array($this->actions_name, 'select')); - $table->offset = 0; - $table->sort = 'appliance_id'; - $table->limit = 10; - $table->order = 'ASC'; - $table->max = $appliance->get_count(); - - $table->init(); - - $h['appliance_id']['title'] = $this->lang['id']; - $h['appliance_id']['sortable'] = true; - $h['appliance_id']['hidden'] = true; - - $h['appliance']['title'] = $this->lang['appliance']; - $h['appliance']['sortable'] = false; - - $h['appliance_name']['title'] = $this->lang['name']; - $h['appliance_name']['sortable'] = true; - $h['appliance_name']['hidden'] = true; - - $h['appliance_resources']['title'] = $this->lang['resource']; - $h['appliance_resources']['sortable'] = true; - $h['appliance_resources']['hidden'] = true; - - - $h['playbooks']['title'] = $this->lang['playbooks']; - $h['playbooks']['sortable'] = false; - $h['edit']['title'] = ' '; - $h['edit']['sortable'] = false; - - $result = $appliance->display_overview($table->offset, $table->limit, $table->sort, $table->order); - $b = array(); - foreach($result as $k => $v) { - - $resource = new resource(); - $resource = $resource->get_instance_by_id($v['appliance_resources']); - - $tmp = array(); - $tmp['appliance_id'] = $v['appliance_id']; - $tmp['appliance_name'] = $v['appliance_name']; - $tmp['appliance_resources'] = $v['appliance_resources']; - $tmp['appliance'] = ''.$this->lang['id'].': '.$v['appliance_id'].'
    '; - $tmp['appliance'] .= ''.$this->lang['name'].': '.$v['appliance_name'].'
    '; - $tmp['appliance'] .= ''.$this->lang['resource'].': '.$resource->id.' / '.$resource->ip.'
    '; - - $playbooks = $this->ansible->get_playbooks($v['appliance_name']); - $tmp['playbooks'] = implode(', ', $playbooks); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'edit' ).'&appliance_id='.$v['appliance_id']; - $a->label = $this->lang['action_edit']; - $a->title = $this->lang['action_edit']; - $a->css = 'edit'; - $a->handler = 'onclick="wait();"'; - $tmp['edit'] = $a->get_string(); - - $b[] = $tmp; - } - - $table->css = 'htmlobject_table'; - $table->border = 0; - $table->id = 'Tabelle'; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $b; - $table->sort_params = $response->get_string( $this->actions_name, 'select' ); - $table->sort_form = true; - $table->sort_link = false; - $table->autosort = false; - $table->limit_select = array( - array("value" => 10, "text" => 10), - array("value" => 20, "text" => 20), - array("value" => 30, "text" => 30), - array("value" => 40, "text" => 40), - array("value" => 50, "text" => 50), - ); - $response->table = $table; - return $response; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/css/ansible.css b/openQRM-5.3.50-CE/src/plugins/ansible/web/css/ansible.css deleted file mode 100644 index e69de29..0000000 diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/ansible/web/img/plugin.png deleted file mode 100644 index e969688..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/ansible/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/lang/de.ansible-about.ini b/openQRM-5.3.50-CE/src/plugins/ansible/web/lang/de.ansible-about.ini deleted file mode 100644 index 1b98de0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/lang/de.ansible-about.ini +++ /dev/null @@ -1,34 +0,0 @@ -[documentation] -tab = "Über Ansible" -label = "Über Ansible" -introduction_title = "Einleitung" -introduction_content = "Das Ansible-Plugin bietet automatisches Konfiguration-Managment (Applikations-Deployment plus Vorkonfiguration) für Server in openQRM. Es integriert Ansible in den openQRM-Server und erlaubt die Provisionierung spezifischer Applikationen mittels einfacher Zuordnung von Ansible Playbooks.

    -

    Das Ansible-Plugin beinhaltet einen nach 'best-practise' konfigurierten Ansible Umgebung. Die Ansible Playbooks werden dabei automatisch in einem Subversion-Repository abgelegt. Die Ansible-Konfiguration ist in Server und Playbooks organisiert. Eigene Playbooks werden dem playbooks Verzeichnis hinzugefügt. Die vorhandenden Playbooks können direkt in der openQRM-Benutzeroberfläche specifischen Servern zugeordnet werden. Der Inhalt des Playbooks Verzeichnis wird automatisch in der UI dargestellt. Das Ansible-Plugin beinhaltet einige vorgefertigte Ansible Playbooks wie z.B. -

      -
    • webserver
    • -
    • database-server
    • -
    • lamp
    • -
    - Diese vordefinierten Playbooks können selbstverständlich nach eigenen Bedürfnissen angepasst werden. Das Ansible Konfigurations-Repository von openQRM ist auch für externe Subversion Clients verfügbar unter:" - -introduction_title1 = "Applikationen den Server zuordnen" -introduction_content1 = "
      -
    1. Klicken Sie auf 'Server' im Ansible-plugin Menu
    2. -
    3. Wählen Sie einen Server die von Ansible verwaltet werden soll
    4. -
    5. Wählen Sie die Ansible Playbooks die auf dem Server ausgeführt werden sollen
    6. -
    - Innerhalb kürzester Zeit wird openQRM die für den Server konfigurierten Playbooks automatisch auf den Server angewenden." -requirements_title = "Anforderungen" -requirements_list = "Das Ansible-Plugin ist abhängig vom Dhcpd-Plugin. Bitte vergewissern Sie sich, dass das Dhcpd-Plugin vor dem Ansible-Plugin gestartet wurde." -tested_title = "Getestet mit" -tested_content = "Dieses Plugin ist getestet mit Debian, Ubuntu und CentOS" - -provides_title = "Bietet" -provides_list = "Automatisches Konfigurations-Managment für Server in openQRM" - -type_title = "Plugin-Typ" -type_content = "Deployment" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/lang/de.ansible.ini b/openQRM-5.3.50-CE/src/plugins/ansible/web/lang/de.ansible.ini deleted file mode 100644 index 0f4eea6..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/lang/de.ansible.ini +++ /dev/null @@ -1,18 +0,0 @@ -[select] -tab = "Server" -label = "Ansible Server" -id = "ID" -appliance = "Server" -name = "Name" -resource = "Resource" -playbooks = "Playbooks" -action_edit = "bearbeiten" -please_wait = "Lade. Bitte warten .." -[edit] -tab = "Bearbeiten" -label = "Ansible Playbooks für Server %s" -ansible_playbooks = "Ansible Playbooks" -apply_playbooks = "Playbooks direkt anwenden" -msg_updated = "Server %s aktuallisiert" -please_wait = "Lade. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/lang/en.ansible-about.ini b/openQRM-5.3.50-CE/src/plugins/ansible/web/lang/en.ansible-about.ini deleted file mode 100644 index 5f0ed66..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/lang/en.ansible-about.ini +++ /dev/null @@ -1,37 +0,0 @@ -[documentation] -tab = "About Ansible" -label = "About Ansible" -introduction_title = "Introduction" -introduction_content = "

    The Ansible plugin provides automated configuration-management for Server in openQRM. - It seamlessly integrates Ansible within the openQRM GUI and assists to apply pre-made or custom Ansible Playbooks to specific Server.

    -

    By enabling the plugin the Ansible-environment is pre-configured and initialyzed automatically according to best-practice experiences e.g. by keeping the ansible-configuration within a svn-repsitory.

    -

    Custom Ansible Playbooks can be added to the playbooks directory in the subversion repository. All Playbooks will be automatically displayed in the Ansible plugin server manager. - A collection of basic Playbooks is provided by openQRM. Those are -

      -
    • webserver
    • -
    • database-server
    • -
    • lamp
    • -
    - Those provided Playbooks can be of course customized according own requirements. The ansible-configuration repository is also available for external svn clients. To check out the ansible-repo please run:

    " - -introduction_title1 = "Assigning applications to server" -introduction_content1 = "
    1. Go to the 'Server' in the Ansible plugin menu
    2. -
    3. Select an server to be configured via Ansible
    4. -
    5. Select the Ansible Playbookds to be applied to the server
    6. -
    - Within short time the ansible server will distribute the new configuration to the server automatically." - -requirements_title = "Requirements" -requirements_list = "The ansible plugin depends on the Dhcpd plugin! Please make sure to have the Dhcpd plugin enabled and started before." - -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions." - -provides_title = "Provides" -provides_list = "Automated configuration management for Server in openQRM" - -type_title = "Plugin type" -type_content = "Deployment" - -documentation_title = "Documentation" -use_case_title = "Use case" diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/lang/en.ansible.ini b/openQRM-5.3.50-CE/src/plugins/ansible/web/lang/en.ansible.ini deleted file mode 100644 index 8530b6e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/lang/en.ansible.ini +++ /dev/null @@ -1,18 +0,0 @@ -[select] -tab = "Server" -label = "Ansible Server" -id = "ID" -appliance = "Server" -name = "Name" -resource = "Resource" -playbooks = "Playbooks" -action_edit = "edit" -please_wait = "Loading. Please wait .." -[edit] -tab = "Edit" -label = "Ansible playbooks for Server %s" -ansible_playbooks = "Ansible Playbooks" -apply_playbooks = "Direct apply the Playbooks" -msg_updated = "Updated Server %s" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/ansible/web/menu.txt deleted file mode 100644 index 7183b52..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/menu.txt +++ /dev/null @@ -1,22 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|Ansible -...|Server|index.php?plugin=ansible|Apply Ansible Classes to Server -...|About|index.php?plugin=ansible&controller=ansible-about|How to use diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/openqrm-ansible-appliance-edit-hook.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/openqrm-ansible-appliance-edit-hook.php deleted file mode 100644 index 114b8ee..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/openqrm-ansible-appliance-edit-hook.php +++ /dev/null @@ -1,29 +0,0 @@ - -*/ - -function get_ansible_appliance_edit($appliance_id, $openqrm, $response) { - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - $plugin_title = "Configure Application on Appliance ".$appliance->name; - - $a = $response->html->a(); - $a->label = ''.$plugin_title.''; - $a->href = $openqrm->get('baseurl').'/index.php?base=appliance&appliance_action=load_edit&aplugin=ansible&appliance_id='.$appliance_id.'&ansible_action=edit'; - $a->handler = ''; - - return $a; -} - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/openqrm-ansible-apply.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/openqrm-ansible-apply.php deleted file mode 100644 index 7997037..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/openqrm-ansible-apply.php +++ /dev/null @@ -1,86 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$thisfile = basename($_SERVER['PHP_SELF']); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -$BaseDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/'; -require_once $RootDir."/include/user.inc.php"; -require_once $RootDir."/class/image.class.php"; -require_once $RootDir."/class/resource.class.php"; -require_once $RootDir."/class/virtualization.class.php"; -require_once $RootDir."/class/appliance.class.php"; -require_once $RootDir."/class/deployment.class.php"; -require_once $RootDir."/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -// filter inputs -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; - -$ansible_command = $request->get('ansible_command'); -$ansible_server_id = $request->get('ansible_id'); -$ansible_server_name = $request->get('ansible_name'); -$ansible_server_mac = $request->get('ansible_mac'); -$ansible_server_ip = $request->get('ansible_ip'); - -global $OPENQRM_SERVER_BASE_DIR; - -$event = new event(); -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $event; - - -// main -$event->log($ansible_command, $_SERVER['REQUEST_TIME'], 5, "ansible-apply", "Processing ansible command ".$ansible_command, "", "", 0, 0, 0); - - switch ($ansible_command) { - - case 'apply': - $appliance = new appliance(); - $appliance->get_instance_by_id($ansible_server_id); - if ($ansible_server_name == $appliance->name) { - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - if (($ansible_server_mac == $resource->mac) && ($ansible_server_ip == $resource->ip)) { - $command = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/ansible/bin/openqrm-ansible-manager apply ".$appliance->id." ".$appliance->name." ".$resource->ip." --openqrm-cmd-mode fork"; - $openqrm_server = new openqrm_server(); - $openqrm_server->send_command($command); - } else { - $event->log($ansible_command, $_SERVER['REQUEST_TIME'], 3, "ansible-apply", "Request for Ansible apply for server id ".$ansible_server_id." with wrong resource ".$resource->id, "", "", 0, 0, 0); - } - } else { - $event->log($ansible_command, $_SERVER['REQUEST_TIME'], 3, "ansible-apply", "Request for Ansible apply for server id ".$ansible_server_id." with wrong name ".$ansible_server_name, "", "", 0, 0, 0); - } - break; - - default: - $event->log($ansible_command, $_SERVER['REQUEST_TIME'], 3, "ansible-apply", "No such command ".$ansible_command, "", "", 0, 0, 0); - break; - - - } - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/openqrm-ansible-cloud-application-hook.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/openqrm-ansible-cloud-application-hook.php deleted file mode 100644 index 9e348af..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/openqrm-ansible-cloud-application-hook.php +++ /dev/null @@ -1,87 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once $RootDir."/include/user.inc.php"; -require_once $RootDir."/class/event.class.php"; -require_once $RootDir."/class/resource.class.php"; -require_once $RootDir."/class/openqrm_server.class.php"; -require_once $RootDir."/include/openqrm-server-config.php"; -require_once $RootDir."/plugins/ansible/class/ansible.class.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $OPENQRM_SERVER_IP_ADDRESS; -$event = new event(); -global $event; - - - -// cloud hook to get the available application groups -function openqrm_ansible_get_cloud_applications() { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $ansible_group_list = array(); - $ansible = new ansible(); - $ansible_group_array = $ansible->get_available_playbooks(); - foreach ($ansible_group_array as $index => $ansible_app) { - $ansible_group_list[] = "ansible/".$ansible_app; - } - return $ansible_group_list; -} - - -// cloud hook to get the supported os version by application -function openqrm_ansible_get_supported_os_version($application) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $ansible = new ansible(); - $ansible_os_array = $ansible->get_supported_os($application); - return $ansible_os_array; -} - - - -// cloud hook to set applications for a cloud server -function openqrm_ansible_set_cloud_applications($appliance_name, $application_array) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $ansible = new ansible(); - $ansible->set_playbooks($appliance_name, $application_array); -} - - -// cloud hook to remove applications from a cloud server -function openqrm_ansible_remove_cloud_applications($appliance_name) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $ansible = new ansible(); - $ansible->remove_appliance($appliance_name); -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/openqrm-ansible-cloud-product-hook.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/openqrm-ansible-cloud-product-hook.php deleted file mode 100644 index aad86bb..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/openqrm-ansible-cloud-product-hook.php +++ /dev/null @@ -1,90 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once $RootDir."/plugins/ansible/class/ansible.class.php"; - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $IMAGE_AUTHENTICATION_TABLE; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - - -function openqrm_ansible_cloud_product($cmd, $cloud_hook_config) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RootDir; - - $openqrm_server = new openqrm_server(); - - $event->log("openqrm_ansible_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-ansible-cloud-product-hook.php", "Handling ".$cmd." event", "", "", 0, 0, 0); - switch($cmd) { - case "add": - // create application products - $next_sort_id = 0; - $db=openqrm_get_db_connection(); - $ansible = new ansible(); - $ansible_group_array = $ansible->get_available_playbooks(); - foreach ($ansible_group_array as $index => $ansible_app) { - $event->log("openqrm_ansible_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-ansible-cloud-product-hook.php", "Adding application ".$ansible_app." as cloud-product", "", "", 0, 0, 0); - $cloud_product_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $create_application_cloudselector_config = "insert into cloud_selector (id, type, sort_id, quantity, price, name, description, state) VALUES (".$cloud_product_id.", 'application', ".$next_sort_id.", 'ansible/".$ansible_app."', 1, '".$ansible_app."', '".$ansible_app." via ansible', 1);"; - $recordSet = $db->Execute($create_application_cloudselector_config); - $next_sort_id++; - } - break; - - case "remove": - $cloud_product_class = $RootDir."/plugins/cloud/class/cloudselector.class.php"; - if (file_exists($cloud_product_class)) { - require_once $cloud_product_class; - $cloud_selector = new cloudselector(); - $cloud_selector_id_ar = $cloud_selector->get_all_ids(); - foreach ($cloud_selector_id_ar as $key => $value) { - $id = $value['id']; - $cloud_selector->get_instance_by_id($id); - $pos = strpos($cloud_selector->quantity, 'ansible/'); - if ($pos !== false) { - $event->log("openqrm_ansible_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-ansible-cloud-product-hook.php", "Removing application ".$cloud_selector->quantity." from cloud-products", "", "", 0, 0, 0); - $cloud_selector->remove($id); - } - } - } - break; - } -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/tpl/ansible-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/tpl/ansible-about-documentation.tpl.php deleted file mode 100644 index f17797c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/tpl/ansible-about-documentation.tpl.php +++ /dev/null @@ -1,52 +0,0 @@ - -

    {label}

    - -
    - -
    - -

    {introduction_title}

    - {introduction_content} -
    {introduction_command}
    - -

    {introduction_title1}

    - {introduction_content1} - -

    {provides_title}

    - {provides_list} - -

    {requirements_title}

    - {requirements_list} -
    - -
    -

    {type_title}

    - {type_content} - -

    {tested_title}

    - {tested_content} -
    - - -
    - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/tpl/ansible-apply.tpl.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/tpl/ansible-apply.tpl.php deleted file mode 100644 index 85520e9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/tpl/ansible-apply.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ - -

    Apply Ansible Classes II

    - -

    Please Select the Ansible-groups for the appliance {appliance_name}

    -
    -{ansible_groups_table} -<- back -
    diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/tpl/ansible-edit.tpl.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/tpl/ansible-edit.tpl.php deleted file mode 100644 index b5781cc..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/tpl/ansible-edit.tpl.php +++ /dev/null @@ -1,26 +0,0 @@ - -

    {label}

    - -
    - - {form} - {select} - {apply} - {submit} {cancel} - -
    diff --git a/openQRM-5.3.50-CE/src/plugins/ansible/web/tpl/ansible-select.tpl.php b/openQRM-5.3.50-CE/src/plugins/ansible/web/tpl/ansible-select.tpl.php deleted file mode 100644 index bd68de0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ansible/web/tpl/ansible-select.tpl.php +++ /dev/null @@ -1,18 +0,0 @@ - -

    {label}

    -{table} diff --git a/openQRM-5.3.50-CE/src/plugins/aoe-storage/Makefile b/openQRM-5.3.50-CE/src/plugins/aoe-storage/Makefile deleted file mode 100644 index 53790cf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/aoe-storage/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/aoe-storage/etc - cp etc/openqrm-plugin-aoe-storage.conf /usr/share/openqrm/plugins/aoe-storage/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/aoe-storage/etc/openqrm-plugin-aoe-storage.conf b/openQRM-5.3.50-CE/src/plugins/aoe-storage/etc/openqrm-plugin-aoe-storage.conf deleted file mode 100644 index 2b98bde..0000000 --- a/openQRM-5.3.50-CE/src/plugins/aoe-storage/etc/openqrm-plugin-aoe-storage.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Integrates AOE (ATA over Ethernet) as Storage technology (network-deployment).
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="storage" diff --git a/openQRM-5.3.50-CE/src/plugins/atu/Makefile b/openQRM-5.3.50-CE/src/plugins/atu/Makefile deleted file mode 100644 index aa0d0bd..0000000 --- a/openQRM-5.3.50-CE/src/plugins/atu/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/atu/etc - cp etc/openqrm-plugin-atu.conf /usr/share/openqrm/plugins/atu/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/atu/etc/openqrm-plugin-atu.conf b/openQRM-5.3.50-CE/src/plugins/atu/etc/openqrm-plugin-atu.conf deleted file mode 100644 index 061da6c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/atu/etc/openqrm-plugin-atu.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="ATU's openQRM Plugin. Server and Cluster Configuration management
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="misc" diff --git a/openQRM-5.3.50-CE/src/plugins/autoscale/Makefile b/openQRM-5.3.50-CE/src/plugins/autoscale/Makefile deleted file mode 100644 index 0995a1f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/autoscale/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/autoscale/etc - cp etc/openqrm-plugin-autoscale.conf /usr/share/openqrm/plugins/autoscale/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/autoscale/etc/openqrm-plugin-autoscale.conf b/openQRM-5.3.50-CE/src/plugins/autoscale/etc/openqrm-plugin-autoscale.conf deleted file mode 100644 index 3e2b783..0000000 --- a/openQRM-5.3.50-CE/src/plugins/autoscale/etc/openqrm-plugin-autoscale.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Autoscale Cloud Computing with Autoscale EC2 Public Cloud.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="cloud" diff --git a/openQRM-5.3.50-CE/src/plugins/azure/Makefile b/openQRM-5.3.50-CE/src/plugins/azure/Makefile deleted file mode 100644 index 16ceb52..0000000 --- a/openQRM-5.3.50-CE/src/plugins/azure/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/azure/etc - cp etc/openqrm-plugin-azure.conf /usr/share/openqrm/plugins/azure/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/azure/etc/openqrm-plugin-azure.conf b/openQRM-5.3.50-CE/src/plugins/azure/etc/openqrm-plugin-azure.conf deleted file mode 100644 index 89b801f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/azure/etc/openqrm-plugin-azure.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Azure Cloud Computing with Amazon Public Cloud, Ubuntu Enterprise Cloud and Eucalyptus.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="cloud" diff --git a/openQRM-5.3.50-CE/src/plugins/bandwidth/Makefile b/openQRM-5.3.50-CE/src/plugins/bandwidth/Makefile deleted file mode 100644 index 41d46e0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/bandwidth/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/bandwidth/etc - cp etc/openqrm-plugin-bandwidth.conf /usr/share/openqrm/plugins/bandwidth/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/bandwidth/etc/openqrm-plugin-bandwidth.conf b/openQRM-5.3.50-CE/src/plugins/bandwidth/etc/openqrm-plugin-bandwidth.conf deleted file mode 100644 index 2469a38..0000000 --- a/openQRM-5.3.50-CE/src/plugins/bandwidth/etc/openqrm-plugin-bandwidth.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Network-mangement for the Appliances public IP-addresses.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="network" diff --git a/openQRM-5.3.50-CE/src/plugins/citrix/Makefile b/openQRM-5.3.50-CE/src/plugins/citrix/Makefile deleted file mode 100644 index 041cf8a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/citrix/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/citrix/etc - cp etc/openqrm-plugin-citrix.conf /usr/share/openqrm/plugins/citrix/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/citrix/etc/openqrm-plugin-citrix.conf b/openQRM-5.3.50-CE/src/plugins/citrix/etc/openqrm-plugin-citrix.conf deleted file mode 100644 index 332a1f2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/citrix/etc/openqrm-plugin-citrix.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Integrates the Citrix XenServer Virtualization Technology.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="virtualization" diff --git a/openQRM-5.3.50-CE/src/plugins/clonezilla/Makefile b/openQRM-5.3.50-CE/src/plugins/clonezilla/Makefile deleted file mode 100644 index d0134e5..0000000 --- a/openQRM-5.3.50-CE/src/plugins/clonezilla/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/clonezilla/etc - cp etc/openqrm-plugin-clonezilla.conf /usr/share/openqrm/plugins/clonezilla/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/clonezilla/etc/openqrm-plugin-clonezilla.conf b/openQRM-5.3.50-CE/src/plugins/clonezilla/etc/openqrm-plugin-clonezilla.conf deleted file mode 100644 index dc5b731..0000000 --- a/openQRM-5.3.50-CE/src/plugins/clonezilla/etc/openqrm-plugin-clonezilla.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Automatic disk-cloning with Clonezilla (local-deployment).
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="deployment" diff --git a/openQRM-5.3.50-CE/src/plugins/cloud-zones/Makefile b/openQRM-5.3.50-CE/src/plugins/cloud-zones/Makefile deleted file mode 100644 index 247b567..0000000 --- a/openQRM-5.3.50-CE/src/plugins/cloud-zones/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/cloud-zones/etc - cp etc/openqrm-plugin-cloud-zones.conf /usr/share/openqrm/plugins/cloud-zones/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/cloud-zones/etc/openqrm-plugin-cloud-zones.conf b/openQRM-5.3.50-CE/src/plugins/cloud-zones/etc/openqrm-plugin-cloud-zones.conf deleted file mode 100644 index 171618b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/cloud-zones/etc/openqrm-plugin-cloud-zones.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Manage multiple datacenter locations with openQRM Enterprise Cloud Zones.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="cloud" diff --git a/openQRM-5.3.50-CE/src/plugins/cloud/Makefile b/openQRM-5.3.50-CE/src/plugins/cloud/Makefile deleted file mode 100644 index 48288be..0000000 --- a/openQRM-5.3.50-CE/src/plugins/cloud/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/cloud/etc - cp etc/openqrm-plugin-cloud.conf /usr/share/openqrm/plugins/cloud/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/cloud/etc/openqrm-plugin-cloud.conf b/openQRM-5.3.50-CE/src/plugins/cloud/etc/openqrm-plugin-cloud.conf deleted file mode 100644 index c24be92..0000000 --- a/openQRM-5.3.50-CE/src/plugins/cloud/etc/openqrm-plugin-cloud.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Private/Public Cloud Computing with openQRM.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="cloud" diff --git a/openQRM-5.3.50-CE/src/plugins/cobbler/Makefile b/openQRM-5.3.50-CE/src/plugins/cobbler/Makefile deleted file mode 100644 index 55500e3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/cobbler/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/cobbler/etc - cp etc/openqrm-plugin-cobbler.conf /usr/share/openqrm/plugins/cobbler/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/cobbler/etc/openqrm-plugin-cobbler.conf b/openQRM-5.3.50-CE/src/plugins/cobbler/etc/openqrm-plugin-cobbler.conf deleted file mode 100644 index 8efd657..0000000 --- a/openQRM-5.3.50-CE/src/plugins/cobbler/etc/openqrm-plugin-cobbler.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Integrates Cobbler Install Server for automatic Linux deployments (local-deployment).
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="deployment" diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/Makefile b/openQRM-5.3.50-CE/src/plugins/collectd/Makefile deleted file mode 100644 index 2a7fe9e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# this is the openQRM collectd-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/collectd* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/templates - . $(OPENQRM_SERVER_CONF) && cp etc/templates/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/templates/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/img/ - . $(OPENQRM_SERVER_CONF) && chmod 777 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/lang/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/tpl/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/bin/* - . $(OPENQRM_SERVER_CONF) && tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd -czvf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/boot-service-collectd.tgz include/ etc/init.d/collectd etc/templates/openqrm-collectd.conf - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/collectd - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/collectd/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/bin/openqrm-collectd-manager b/openQRM-5.3.50-CE/src/plugins/collectd/bin/openqrm-collectd-manager deleted file mode 100644 index 5a0a1d9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/bin/openqrm-collectd-manager +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -# this script automatically manages collectd -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -# unblock starting command queue early for non-blocking + ui commands -COLLECTD_MANAGER_COMMAND=$1 -if [ "$COLLECTD_MANAGER_COMMAND" == "remove" ]; then - openqrm_unblock_starting_queue $@ - NON_BLOCKING=true -fi - -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/include/openqrm-plugin-collectd-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/openqrm-plugin-collectd.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -openqrm_server_get_config -export resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -export LANG=C -CURRENT_DIR=`pwd` - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - -# the collectd plugin depends on dns working so it needs the dns plugin available+enabled -# collectd autosigning needs a domain name. This we get from the dns-plugin config -if [ ! -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf ]; then - openqrm_post_event 0 "collectd-plugin" 3 "collectd-plugin" "The openQRM collectd-plugin depends on the dns-plugin. Please enable the dns-plugin first!" - exit 1 -fi -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf - -function collectd_manager_usage() { - echo "Usage : $0 graph" - echo " : $0 remove [now/later]" - echo "" - echo "Optional parameters:" - echo " [--openqrm-ui-user ]" - echo " [--openqrm-internal-cmd ]" - echo " [--openqrm-cmd-mode ]" - exit 1 -} - - -COLLECTD_MANAGER_COMMAND=$1 -# main -case "$COLLECTD_MANAGER_COMMAND" in - graph) - # running by crond - LOCK_TIME=`openqrm_lock_queue aquire collectd-graph` - trap "openqrm_lock_queue release collectd-graph $LOCK_TIME" EXIT - - for APPLIANCE_NAME in `ls $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/data/`; do - echo "Creating graphs for Appliance $APPLIANCE_NAME" - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/graphs/$APPLIANCE_NAME.work - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/graphs/$APPLIANCE_NAME.work/data-snapshot/ - cp -a `find $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/data/$APPLIANCE_NAME/ -name *.rrd` $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/graphs/$APPLIANCE_NAME.work/data-snapshot/ - cd $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/graphs/$APPLIANCE_NAME.work - nice -n 19 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/bin/collectd2html.pl --data-dir=$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/graphs/$APPLIANCE_NAME.work/data-snapshot/ --host=$APPLIANCE_NAME | logger - ln -sf $APPLIANCE_NAME.html index.html - rm -rf data-snapshot/ - cd $CURRENT_DIR - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/graphs/$APPLIANCE_NAME - mv $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/graphs/$APPLIANCE_NAME.work $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/graphs/$APPLIANCE_NAME - done - openqrm_lock_queue release collectd-graph $LOCK_TIME - trap '' EXIT - ;; - remove) - # running from the engine - APPLIANCE_NAME=$2 - WHEN=$3 - if [ "$APPLIANCE_NAME" == "" ]; then - exit - fi - if [ "$WHEN" == "later" ]; then - # wait until the appliance is fully stopped - sleep 60 - fi - - LOCK_TIME=`openqrm_lock_queue aquire collectd` - trap "openqrm_lock_queue release collectd $LOCK_TIME" EXIT - - # remove data - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/data/$APPLIANCE_NAME - # remove graphs - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/graphs/$APPLIANCE_NAME - - openqrm_lock_queue release collectd $LOCK_TIME - trap '' EXIT - ;; - *) - echo "ERROR: Free commandline arguments are not allowed" - collectd_manager_usage - exit 6 - ;; -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/etc/init.d/collectd b/openQRM-5.3.50-CE/src/plugins/collectd/etc/init.d/collectd deleted file mode 100644 index 6faabb5..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/etc/init.d/collectd +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the collectd resources -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -# for including the package functions -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/include/openqrm-plugin-collectd-functions -. $OPENQRM_RESOURCE_PARAMETER_FILE -OPENQRM_SERVER_IP=$resource_openqrmserver - -COLLECTD_CONF="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/collectd.conf" -# for the clients we use the regular data dir since they are sending -# their stats to the server anyway -COLLECTD_DATA_DIR="/var/lib/collectd/rdd" - -# do not run on idle resources -if [ "$resource_image" == "idle" ]; then - exit 0 -fi - -# set the hostname early :) -hostname $appliance_name - -# also do not run before the real init of the rootfs -# if we have this file /etc/initrd-devices.conf we are still in the initrd -if [ -f /etc/initrd-devices.conf ]; then - exit 0 -fi -if [ -f /etc/debian_version ]; then - echo "$appliance_name" > /etc/hostname -elif [ -f /etc/redhat-release ]; then - sed -i -e "s#HOSTNAME=.*#HOSTNAME=$appliance_name#g" /etc/sysconfig/network -elif [ -f /etc/SuSE-release ]; then - echo "$appliance_name" > /etc/HOSTNAME -fi - - -function collectd_start() { - echo "Starting the openQRM collectd-plugin" - collectd_stop 1>/dev/null 2>&1 - if ! openqrm_full_fill_os_dependency collectd collectd; then - return 0 - fi - openqrm_chkconfig del collectd - collectd_stop 1>/dev/null 2>&1 - - # prepare collectd client config - mkdir -p $COLLECTD_DATA_DIR - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/templates/openqrm-collectd.conf | \ - sed -e "s/@@MODE@@/Server/g" | \ - sed -e "s#@@COLLECTD_DATA_DIR@@#$COLLECTD_DATA_DIR#g" | \ - sed -e "s#@@OPENQRM_HOSTNAME@@#$appliance_name#g" | \ - sed -e "s/@@OPENQRM_SERVER_IP_ADDRESS@@/$resource_openqrmserver/g" > $COLLECTD_CONF - - # start collectd - if [ -x /usr/sbin/collectdmon ]; then - if ! /usr/sbin/collectdmon -P /var/run/collectdmon.pid -- -C $COLLECTD_CONF 1>/dev/null 2>&1; then - echo "ERROR: Could not start collectd" - fi - elif [ -x /usr/sbin/collectd ]; then - if ! /usr/sbin/collectd -C $COLLECTD_CONF; then - echo "ERROR: Could not start collectd" - fi - fi -} - - -function collectd_stop() { - echo "Stopping the openQRM collectd-plugin" - if [ -x /etc/init.d/collectd ]; then - /etc/init.d/collectd stop - fi - kill `ps ax | grep collectd.conf | grep -v grep | awk {' print $1 '}` 2>/dev/null - # be sure it is gone - kill -9 `ps ax | grep collectd.conf | grep -v grep | awk {' print $1 '}` 2>/dev/null -} - - - - - -case "$1" in - start) - collectd_start - ;; - stop) - collectd_stop - ;; - restart) - collectd_stop - sleep 1 - collectd_start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 - -esac -exit $? - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/etc/init.d/openqrm-plugin-collectd b/openQRM-5.3.50-CE/src/plugins/collectd/etc/init.d/openqrm-plugin-collectd deleted file mode 100644 index 5161293..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/etc/init.d/openqrm-plugin-collectd +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/bash -# init script for the openQRM collectd-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/include/openqrm-plugin-collectd-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/openqrm-plugin-collectd.conf -openqrm_server_get_config -export resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - -COLLECTD_CONF="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/collectd.conf" -COLLECTD_DATA_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/data" - -function openqrm_plugin_collectd_start() { - echo "Starting the openQRM collectd-plugin" - kill -9 `ps ax | grep collectd | grep -v openqrm | grep -v grep | awk {' print $1 '}` 2>/dev/null - openqrm_chkconfig del collectd - # start collectd - if [ -x /usr/sbin/collectdmon ]; then - if /usr/sbin/collectdmon -P /var/run/collectdmon.pid -- -C $COLLECTD_CONF; then - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/collectd/.running - fi - fi -} - - -function openqrm_plugin_collectd_stop() { - echo "Stopping the openQRM collectd-plugin" - /etc/init.d/collectd stop - # be sure it is stopped - kill `ps ax | grep collectd | grep -v openqrm | grep -v grep | awk {' print $1 '}` 2>/dev/null - # be sure it is gone - kill -9 `ps ax | grep collectd | grep -v openqrm | grep -v grep | awk {' print $1 '}` 2>/dev/null - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/collectd/.running -} - -function openqrm_plugin_collectd_uninstall() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "collectd: Please give a username to uninstall the plugin : " - read USERNAME - echo - echo -n "collectd: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Uninstalling the openQRM collectd-plugin" - openqrm_plugin_collectd_stop - - # remove from cron - if [ -e /etc/cron.d/openqrm-collectd-graph ]; then - rm -f /etc/cron.d/openqrm-collectd-graph - if [ -x /etc/init.d/cron ]; then - /etc/init.d/cron reload - elif [ -x /etc/init.d/crond ]; then - /etc/init.d/crond reload - else - echo "Could not find cron init script in /etc/init.d/. Please reload cron manually!" - fi - fi - - # remove data dir - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/data - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/graphs - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/collectd - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-collectd.tgz - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/collectd -} - -function openqrm_plugin_collectd_init() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "collectd: Please give a username to init the plugin : " - read USERNAME - echo - echo -n "collectd: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - - # the collectd plugin depends on dns working so it needs the dns plugin available+enabled - # collectd needs a hostname name. This we get from the dns-plugin config - if [ ! -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf ]; then - echo "ERROR: The openQRM collectd-plugin depends on the dns-plugin. Please enable the dns-plugin first!" - openqrm_post_event 0 "collectd-plugin" 3 "collectd-plugin" "The openQRM collectd-plugin depends on the dns-plugin. Please enable the dns-plugin first!" - exit 1 - fi - . $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf - echo "Initializing the openQRM collectd-plugin" - - # prepare collectd server config - mkdir -p $COLLECTD_DATA_DIR - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/templates/openqrm-collectd.conf | \ - sed -e "s/@@MODE@@/Listen/g" | \ - sed -e "s#@@COLLECTD_DATA_DIR@@#$COLLECTD_DATA_DIR#g" | \ - sed -e "s#@@OPENQRM_HOSTNAME@@#openqrm#g" | \ - sed -e "s/@@OPENQRM_SERVER_IP_ADDRESS@@/$OPENQRM_SERVER_IP_ADDRESS/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/collectd.conf - - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/collectd - # link the boot-service - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/web/boot-service-collectd.tgz $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-collectd.tgz -} - -USER=$2 -PASS=$3 - -case "$1" in - start) - openqrm_plugin_collectd_start - ;; - stop) - openqrm_plugin_collectd_stop - ;; - restart) - openqrm_plugin_collectd_stop - sleep 1 - openqrm_plugin_collectd_start - ;; - init) - openqrm_plugin_collectd_init $USER $PASS - ;; - uninstall) - openqrm_plugin_collectd_uninstall $USER $PASS - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/etc/init.d/openqrm-plugin-collectd.postinstall b/openQRM-5.3.50-CE/src/plugins/collectd/etc/init.d/openqrm-plugin-collectd.postinstall deleted file mode 100644 index 0aecc73..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/etc/init.d/openqrm-plugin-collectd.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-collectd postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/etc/init.d/openqrm-plugin-collectd.preremove b/openQRM-5.3.50-CE/src/plugins/collectd/etc/init.d/openqrm-plugin-collectd.preremove deleted file mode 100644 index c71ec82..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/etc/init.d/openqrm-plugin-collectd.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-collectd preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-collectd stop \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/etc/openqrm-plugin-collectd.conf b/openQRM-5.3.50-CE/src/plugins/collectd/etc/openqrm-plugin-collectd.conf deleted file mode 100644 index 515f499..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/etc/openqrm-plugin-collectd.conf +++ /dev/null @@ -1,38 +0,0 @@ -# this is the openQRM-plugin-collectd info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen, collectd" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen, collectd, collectd-rrdtool" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen, collectd" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Monitor systems with Collectd providing long-term statistics and graphs." -OPENQRM_PLUGIN_TYPE="monitoring" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/collectd/etc/openqrm-plugin-collectd.conf" - diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/etc/templates/openqrm-collectd.conf b/openQRM-5.3.50-CE/src/plugins/collectd/etc/templates/openqrm-collectd.conf deleted file mode 100644 index f02f6d3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/etc/templates/openqrm-collectd.conf +++ /dev/null @@ -1,56 +0,0 @@ -# this is the openqrm-plugin-collectd client configuration file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -FQDNLookup false -Hostname "@@OPENQRM_HOSTNAME@@" - -LoadPlugin syslog - - LogLevel info - -#LoadPlugin battery -#LoadPlugin cpu -#LoadPlugin df -#LoadPlugin disk -#LoadPlugin entropy -#LoadPlugin interface -#LoadPlugin irq -LoadPlugin load -LoadPlugin memory -LoadPlugin network -#LoadPlugin processes -LoadPlugin rrdtool -#LoadPlugin swap -#LoadPlugin users - - - @@MODE@@ "@@OPENQRM_SERVER_IP_ADDRESS@@" "25826" - TimeToLive 128 - Forward false - CacheFlush 1800 - - - DataDir "@@COLLECTD_DATA_DIR@@" - - - - Device "/dev" - Device "/dev/shm" - IgnoreSelected false - - -Include "/etc/collectd/thresholds.conf" - diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/include/openqrm-plugin-collectd-functions b/openQRM-5.3.50-CE/src/plugins/collectd/include/openqrm-plugin-collectd-functions deleted file mode 100644 index b3203be..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/include/openqrm-plugin-collectd-functions +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# this is the functions file for the collectd-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -################ common collectd functions - - - -################ collectd functions - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd-about.bootservice.class.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd-about.bootservice.class.php deleted file mode 100644 index 197b438..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd-about.bootservice.class.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ - -class collectd_about_bootservice -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'collectd_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "collectd_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/collectd-about-bootservice.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['boot_service_title'], 'boot_service_title'); - $t->add($this->lang['boot_service_content'], 'boot_service_content'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd-about.controller.class.php deleted file mode 100644 index 92cc43d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd-about.controller.class.php +++ /dev/null @@ -1,287 +0,0 @@ - - */ - -class collectd_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'collectd_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'collectd_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'collectd_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'collectd_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About Collectd', - 'label' => 'About Collectd', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The "Collectd" plugin automatically provides System statistics for server. - It seamlessly integrates Collectd within openQRM - and provides hourly, daily, weekly and monthly system graphs created from the collected data via rrdtool. - By enabling the plugin collectd is pre-configured and initialized automatically. - The system graphs are updated sequentially via a cron-job. It may take some minutes after the start of a server to collect enough data to create the graphs.', - 'requirements_title' => 'Requirements', - 'requirements_list' => 'none', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - - 'provides_title' => 'Provides', - 'provides_list' => 'System statistics for Appliances', - 'type_title' => 'Plugin Type', - 'type_content' => 'Monitoring', - - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - ), - 'bootservice' => array ( - 'tab' => 'Boot-Service', - 'label' => 'Collectd Boot-Service', - 'boot_service_title' => 'Collectd Boot-Service', - 'boot_service_content' => 'The Collectd Plugin provides an openQRM Boot-Service. - This "Collectd Boot-Service" is automatically downloaded and executed by the openQRM-Client on all integrated Systems. - The Boot-Service is located at:
    -
    - /usr/share/openqrm/plugins/collectd/web/boot-service-collectd.tgz -
    -
    - The "Collectd Boot-Service contains the Client files of the Collectd Plugin.
    - Also a configuration file for the Collectd Hosts is included in this Boot-Service.
    -
    - The Boot-Service configuration can be viewed and administrated by the "openqrm" utility.
    - To view the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n collectd -a default -
    -
    - To view a Boot-Service configuration of a specific appliance run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n collectd -a [appliance-name] -
    -
    - To adapt a parameter in the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n collectd -a default -k [key] -v [value] -
    -
    - To adapt a paramter in the Boot-Service configuration of a specific appliance run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n collectd -a [appliance-name] -k [key] -v [value] -
    -
    - In case the openmQRM Server itself is used as the Collectd Host please edit:
    -
    - /usr/share/openqrm/plugins/collectd/etc/openqrm-plugin-collectd.conf -
    -
    - ', - ), - 'usage' => array ( - 'tab' => 'About Collectd', - 'label' => 'Collectd Use-Cases', - ), - -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/collectd/lang", 'collectd-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/collectd/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "documentation"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - case 'bootservice': - $content[] = $this->bootservice(true); - break; - case 'usage': - $content[] = $this->usage(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About Collectd - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/collectd/class/collectd-about.documentation.class.php'); - $controller = new collectd_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Boot-Service - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function bootservice( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/collectd/class/collectd-about.bootservice.class.php'); - $controller = new collectd_about_bootservice($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['bootservice']; - $data = $controller->action(); - } - $content['label'] = $this->lang['bootservice']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'bootservice' ); - $content['onclick'] = false; - if($this->action === 'bootservice'){ - $content['active'] = true; - } - return $content; - } - - - - - - //-------------------------------------------- - /** - * About Collectd Use-Cases - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function usage( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/collectd/class/collectd-about.usage.class.php'); - $controller = new collectd_about_usage($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['usage']; - $data = $controller->action(); - } - $content['label'] = $this->lang['usage']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'usage' ); - $content['onclick'] = false; - if($this->action === 'usage'){ - $content['active'] = true; - } - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd-about.documentation.class.php deleted file mode 100644 index c4104d3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd-about.documentation.class.php +++ /dev/null @@ -1,87 +0,0 @@ - - */ - -class collectd_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'collectd_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "collectd_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/collectd-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd-about.usage.class.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd-about.usage.class.php deleted file mode 100644 index e461203..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd-about.usage.class.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ - -class collectd_about_usage -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'collectd_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "collectd_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/collectd-about-usage.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd.api.class.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd.api.class.php deleted file mode 100644 index 6b2f655..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd.api.class.php +++ /dev/null @@ -1,228 +0,0 @@ - -*/ - -class collectd_api -{ - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param object $controller - */ - //-------------------------------------------- - function __construct($controller) { - $this->controller = $controller; - $this->user = $this->controller->user; - $this->html = $this->controller->response->html; - $this->response = $this->html->response(); - $this->file = $this->controller->file; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - */ - //-------------------------------------------- - function action() { - $action = $this->response->html->request()->get($this->controller->actions_name); - switch( $action ) { - case 'image': - $this->image(); - break; - case 'download': - $this->download(); - break; - } - } - - //-------------------------------------------- - /** - * Get Image - * - * @param array $_REQUEST[values] - * @param string $_REQUEST[interval] - * @param string $_REQUEST[path] - * @param int $_REQUEST[width] optional - * @param int $_REQUEST[height] optional - * @access public - */ - //-------------------------------------------- - function image( $raw = false ) { - $values = $this->response->html->request()->get('values'); - $interval = $this->response->html->request()->get('interval'); - $path = $this->response->html->request()->get('path'); - $width = 800; - if($this->response->html->request()->get('width') !== '') { - $width = $this->response->html->request()->get('width'); - } - $height = 200; - if($this->response->html->request()->get('height') !== '') { - $height = $this->response->html->request()->get('height'); - } - $bcolors = array('#ffe8e8','#e8e8ff','#e2ffe2'); - $lcolors = array('#ff7777','#7777ff','#55ff55'); - - $i = 0; - $str = ''; - foreach($values as $value) { - if($value !== '') { - $str.= 'DEF:'.$value.'_avg='.$path.':'.$value.':AVERAGE '; - $str.= 'DEF:'.$value.'_max='.$path.':'.$value.':MAX '; - $str.= 'AREA:'.$value.'_max'.$bcolors[$i].' '; - $str.= 'LINE2:'.$value.'_avg'.$lcolors[$i].':'.$value.' '; - $str.= 'GPRINT:'.$value.'_avg:AVERAGE:%5.1lf%sAvg '; - $i++; - } - } - - $names = explode('/', dirname($path)); - $head = $names[count($names)-1]; - $host = $names[count($names)-2]; - $name = str_replace('.rrd', '',basename($path)); - $title = $host.' '.$head.' '. str_replace($head, '', $name).' '.$interval.' '.date('d. F Y H:i:s', time()); - - $cmd = 'rrdtool graph - '; - $cmd .= '-t "'.$title.'" '; - $cmd .= '--imgformat PNG '; - $cmd .= '--width '.$width.' '; - $cmd .= '--height '.$height.' '; - $cmd .= '--start now-'.$interval.' '; - $cmd .= '--end now '; - $cmd .= '--interlaced '; - $cmd .= $str; - - $return = shell_exec($cmd); - if($raw === false) { - $size = strlen($return); - $mime = 'image/png'; - header("Pragma: public"); - header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Cache-Control: must-revalidate"); - header("Content-type: $mime"); - header("Content-Length: ".$size); - header("Content-disposition: inline; filename=test"); - header("Accept-Ranges: ".$size); - flush(); - echo $return; - exit(0); - } - else if ($raw === true) { - return $return; - } - } - - //-------------------------------------------- - /** - * Download - * - * @param string $_REQUEST[appliance_id] - * @param string $_REQUEST[interval] - * @access public - */ - //-------------------------------------------- - function download() { - - $_REQUEST[$this->controller->actions_name] = 'statistics'; - $role = $this->controller->openqrm->role($this->response); - $allow = $role->check_permission($this->controller, true); - if($allow === true) { - $file = tempnam('/dummydir', 'xx'); - $dir = dirname($file).'/'.time().'/'; - $error = $this->file->mkdir($dir); - if($error === '') { - $this->controller->action = 'statistics'; - $tab = $this->controller->statistics(true); - $images = $tab['value']->get_elements('images'); - - $x = preg_match_all('~file->mkfile($dir.$filename, $this->image(true), 'w+', true); - $images = str_replace($match, $filename, $images); - } - } - $tab['value']->add('', 'form'); - $tab['value']->add('', 'interval'); - $tab['value']->add('', 'submit'); - $tab['value']->add('', 'download'); - $tab['value']->add($images, 'images'); - $data = 'collectd'; - $data .= ''; - $data .= ''; - $data .= $tab['value']->get_string(); - $data .= ''; - $this->file->mkfile($dir.'index.html', $data,'w+', true); - - shell_exec('cd '.$dir.' && tar -czvf '.$file.' *'); - - $size = filesize($file); - header("Pragma: public"); - header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Cache-Control: must-revalidate"); - header("Content-type: application/x-tar"); - header("Content-Length: ".$size); - header("Content-disposition: inline; filename=collectd_".time().".tar"); - header("Accept-Ranges: ".$size); - flush(); - readfile($file); - $this->file->remove($file); - $this->file->remove($dir, true); - exit(0); - } - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd.controller.class.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd.controller.class.php deleted file mode 100644 index d2cc6bf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd.controller.class.php +++ /dev/null @@ -1,187 +0,0 @@ - - */ - -class collectd_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'collectd_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "collectd_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'collectd_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'collectd_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'statistics' => array( - 'tab' => 'Collectd', - 'label' => 'Statistics on resource %s', - 'action_download' => 'download', - 'no_data' => 'No statistics found', - 'form_interval' => 'Interval', - 'please_wait' => 'Loading Collectd Data. Please wait ..', - ), -); -/** -* path to image -* @access public -* @var string -*/ -var $image_path = 'api.php?action=plugin&plugin=collectd&collectd_action=image'; -/** -* image_width -* @access public -* @var integer -*/ -var $image_width = 800; -/** -* image_height -* @access public -* @var integer -*/ -var $image_height = 243; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/collectd/lang", 'collectd.ini'); - $this->tpldir = $this->rootdir.'/plugins/collectd/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = 'statistics'; - } - - $content = array(); - switch( $this->action ) { - case 'statistics': - $content[] = $this->statistics(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * API - * - * @access public - */ - //-------------------------------------------- - function api() { - require_once($this->rootdir.'/plugins/collectd/class/collectd.api.class.php'); - $controller = new collectd_api($this); - $controller->action(); - } - - //-------------------------------------------- - /** - * View statistics - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function statistics( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/collectd/class/collectd.statistics.class.php'); - $controller = new collectd_statistics($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['statistics']; - $controller->image_path = $this->image_path; - $controller->image_width = $this->image_width; - $controller->image_height = $this->image_height; - $data = $controller->action(); - } - $content['label'] = $this->lang['statistics']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'statistics' ); - $content['onclick'] = false; - if($this->action === 'statistics'){ - $content['active'] = true; - } - return $content; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd.statistics.class.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd.statistics.class.php deleted file mode 100644 index 6b80d77..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/class/collectd.statistics.class.php +++ /dev/null @@ -1,261 +0,0 @@ - - */ - -class collectd_statistics -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'collectd_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "collectd_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'collectd_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'collectd_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); -/** -* path to image -* @access public -* @var string -*/ -var $image_path = 'api.php?action=plugin&plugin=collectd&collectd_action=image'; -/** -* image_width -* @access public -* @var integer -*/ -var $image_width = 243; -/** -* image_height -* @access public -* @var integer -*/ -var $image_height = 800; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->tpldir = $this->rootdir.'/plugins/collectd/tpl'; - if($this->response->html->request()->get('appliance_id') !== '') { - $appliance = $this->openqrm->appliance(); - $appliance->get_instance_by_id($this->response->html->request()->get('appliance_id')); - $this->appliance = $appliance; - if(isset($appliance->resources) && $appliance->resources !== '') { - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $this->resource = $resource; - } - } - $this->response->add('appliance_id', $this->response->html->request()->get('appliance_id')); - $this->lib = '/usr/share/openqrm/plugins/collectd/data'; - - $intervals[0] = array('all'); - $intervals[1] = array('1hour'); - $intervals[2] = array('1day'); - $intervals[3] = array('1week'); - $intervals[4] = array('1month'); - $this->intervals = $intervals; - $this->response->add('interval', $this->response->html->request()->get('interval')); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $response = $this->statistics(); - $t = $this->response->html->template($this->tpldir.'/collectd-statistics.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->images, 'images'); - $t->add($response->links, 'links'); - $t->add($response->download, 'download'); - $t->add($response->form); - $t->group_elements(array('param_' => 'form')); - if(isset($this->resource)) { - $t->add(sprintf($this->lang['label'], $this->resource->hostname), 'label'); - } else { - $t->add($this->lang['no_data'], 'label'); - } - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - //-------------------------------------------- - /** - * Statistics - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function statistics() { - $response = $this->get_response(); - $images = ''; - $links = ''; - if(isset($this->resource)) { - $folder = $this->lib.'/'.$this->appliance->name; - // if resource is the openqrm server - if ($this->resource->id == 0) { - $folder = $this->lib.'/openqrm'; - } - if($this->file->exists($folder)) { - $folders =$this->file->get_folders($folder); - $i = 0; - $max = count($folders) -1; - foreach($folders as $dir) { - if($i === $max && $max > 2) { - $links .= ''.ucfirst($dir['name']).''; - } else { - $links .= ''.ucfirst($dir['name']).''; - } - $images .= '

    '.ucfirst($dir['name']).'

    '; - $files = $this->file->get_files($dir['path']); - foreach($files as $file) { - $path = $file['path']; - $cmd = 'rrdtool info '.$path; - $cmd .= "|grep 'ds\['"; - $cmd .= "|sed 's/^ds\[//'"; - $cmd .= "|sed 's/\].*//'"; - $cmd .= "|sort"; - $cmd .= "|uniq"; - $ret = shell_exec($cmd); - $src = $this->image_path; - $src .= '&path='.$path; - $src .= '&width='.$this->image_width; - $src .= '&height='.$this->image_height; - if(isset($ret)) { - $values = explode("\n", $ret); - foreach($values as $value) { - if($value !== '') { - $src .= '&'.urlencode('values[]').'='.$value; - } - } - } - if($this->response->html->request()->get('interval') === '') { - $intervals = $this->intervals[1]; - } - else if ($this->response->html->request()->get('interval') === 'all') { - for($i=1;$iintervals);$i++) { - $intervals[] = $this->intervals[$i][0]; - } - } else { - $intervals = array($this->response->html->request()->get('interval')); - } - $images .= '

    '.str_replace('.rrd', '', $file['name']).'

    '; - foreach ($intervals as $interval) { - $alt = str_replace('.rrd', '', basename($path)).'_'.$interval; - $images .= ''.$alt.''; - } - } - $images .= '
    '; - $i++; - } - } - } - - $a = $response->html->a(); - $a->label = $this->lang['action_download']; - $a->id = 'downloadlink'; - $a->css = 'badge'; - $a->href = $this->image_path; - $a->href .= '&interval='.$this->response->html->request()->get('interval'); - $a->href .= '&appliance_id='.$this->response->html->request()->get('appliance_id'); - $a->href .= '&'.$this->actions_name.'=download'; - $response->download = $a; - $response->links = $links; - $response->images = $images; - return $response; - } - - - - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'statistics'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $submit->css = 'interval_submit'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['interval']['label'] = $this->lang['form_interval']; - $d['interval']['object']['type'] = 'htmlobject_select'; - $d['interval']['object']['attrib']['id'] = 'interval'; - $d['interval']['object']['attrib']['handler'] = 'onchange="wait();this.form.submit();"'; - $d['interval']['object']['attrib']['name'] = 'interval'; - $d['interval']['object']['attrib']['index'] = array(0,0); - $d['interval']['object']['attrib']['options'] = $this->intervals; - if($this->response->html->request()->get('interval') === '') { - $d['interval']['object']['attrib']['selected'] = array($this->intervals[1][0]); - } - - - $form->add($d); - $response->form = $form; - return $response; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/css/collectd.css b/openQRM-5.3.50-CE/src/plugins/collectd/web/css/collectd.css deleted file mode 100644 index 007ca13..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/css/collectd.css +++ /dev/null @@ -1,103 +0,0 @@ -#collectd_statistics h3 { - margin-left: 15px; - margin-right: 15px; - margin-bottom: 20px; - padding: 0 0 10px 0; - border-bottom: 1px solid #ccc; -} -#collectd_statistics h3 a.toplink { - float: right; - padding:0 4px; - margin: 4px 15px 0 0; - line-height:16px; - font-size: 12px; - color: #ccc; - border: 1px solid #ccc; - text-decoration: none; -} -#collectd_statistics h4 { - text-align: left; - margin-left: 50px; - margin-top: 20px; -} -#collectd_statistics #downloadlink { - margin-left: 15px; - margin-top: 15px; - display: block; - width: 80px; - text-align: center; - float: left; -} -#collectd_statistics .image_box { - border: 0px none; - text-align: center; - margin-right: 15px; -} -#collectd_statistics .image_box img { - margin: 0 0 0 0; -} -#collectd_statistics #links{ - float: right; - display: block; - width: 165px; - height: 59px; - overflow: auto; - margin-right: 28px; - border-left: 1px solid #ccc; - border-top: 1px solid #ccc; - border-bottom: 1px solid #ccc; -} -#collectd_statistics #links .linkswrapper{ - height: 60px; -} -#collectd_statistics #links a { - padding: 0 0 0 3px; - display: block; - font-size: 13px; - line-height: 19px; - text-decoration: none; - border-bottom: 1px solid #ccc; - color: black; -} -#collectd_statistics #links a.last { - border-bottom: 0px none; -} -#collectd_statistics #form { - float:right; - margin: -55px 20px 0 0; -} -#collectd_statistics #intervalbox, -#collectd_statistics #buttons { - float:left; -} -#collectd_statistics #interval_box .left { - width: auto; - padding: 2px 15px 0 0; -} -#collectd_statistics #interval_box .right select { - width: 80px; - margin: 3px 0 0 0; -} -#collectd_statistics .interval_submit { - vertical-align: middle; - margin: 0 0 0 8px; - width: 30px; - height: 30px; - text-indent: -1000px; - background-color: transparent; - background-image: url(../../../img/glyphicons/glyphicons.png); - background-position: -44px -382px; -} - -.floatbreaker { - clear:both; - height:0px !important; - position:relative; - line-height:0px; - font-size:0px; - border:0px none; - margin:0; - padding:0; - overflow:hidden; - width:0px; -} diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/collectd/web/img/plugin.png deleted file mode 100644 index d41daa5..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/collectd/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/lang/de.collectd-about.ini b/openQRM-5.3.50-CE/src/plugins/collectd/web/lang/de.collectd-about.ini deleted file mode 100644 index 7a4f5ee..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/lang/de.collectd-about.ini +++ /dev/null @@ -1,50 +0,0 @@ -[documentation] -tab = "Über Collectd" -label = "Über Collectd" -introduction_title = "Einleitung" -introduction_content = "Das collectd Plugin stellt automatisch System-Statistiken der Server in openQRM bereit. - Es integriert collectd in openQRM und erstellt Grafiken der System-Statistiken aus den gesammelten Collectd-Daten mittels rrdtool (stündlich, täglich, wöchentlich und monatlich). Einschalten und starten des Collectd-Plugins konfiguriert automatisch openQRM als Collectd Master, der die Statistik Daten der verwalteten Systeme automatisch sammelt und aufbereitet. Auf den Client-Systemen sorgt der Collectd-Boot-Service für die automatische Konfiguration. Die System Grafiken werden sequenziell mittels eines cron Jobs erzeugt. -

    -

    tipp Es kann einige Zeit dauern bis genügend Daten zur Verfügung stehen um die Grafiken zu generieren." - -requirements_title = "Anforderungen" -requirements_list = "keine" -tested_title = "Testet mit" -tested_content = "Diese Plugin ist getestet mit Debian-, Ubuntu- und CentOS-Linux-Distributionen" - -provides_title = "Bietet" -provides_list = "System-Statistiken der Server" - -type_title = "Plugin-Typ" -type_content = "Monitoring" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" - -[bootservice] -tab = "Boot-Service" -label = "Collectd Boot-Service" -boot_service_title = "Collectd Boot-Service" -boot_service_content = "Das Collectd Plugin beinhaltet einen openQRM Boot-Service. Dieser 'Collectd Boot-Service' wird automatisch von allen in openQRM integrierten Systeme heruntergeladen und ausgeführt. Der Boot-Service befindet sich unter: -

    /usr/share/openqrm/plugins/collectd/web/boot-service-collectd.tgz
    - Der 'Collectd Boot-Service' beinhaltet die 'Client' Dateien des Collectd Plugin. - Eine Konfigurationsdatei für den Collectd ist ebenfalls enhalten. - Die Boot-Service konfiguration wird mittels des openqrm Kommandozeilenwerkzeugs verwaltet. - - Der folgende Befehl zeigt die aktuelle default Boot-Service-Konfiguration an: -
    /usr/share/openqrm/bin/openqrm boot-service view -n collectd -a default
    - - Die Boot-Service-Konfiguration eines speziellen Servers zeigt der folgende Befehl an: -
    /usr/share/openqrm/bin/openqrm boot-service view -n collectd -a [appliance-name]
    - - Der folgende Befehl passt einen Konfigurationparameter des default Boot-Service an: -
    /usr/share/openqrm/bin/openqrm boot-service configure -n collectd -a default -k [key] -v [value]
    - - Die Boot-Service Konfigurarationsparameter eines speziellen Server passt der folgende Befehl an: -
    /usr/share/openqrm/bin/openqrm boot-service configure -n collectd -a [appliance-name] -k [key] -v [value]
    - - Im Falle das der openmQRM-Server selber als Collectd genutzt wird werden die Konfigurationsparameter in der folgenden Datei manuell angepasst: -
    /usr/share/openqrm/plugins/collectd/etc/openqrm-plugin-collectd.conf
    " -[usage] -tab = "Über Collectd" -label = "Collectd Anwendungsfälle" diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/lang/de.collectd.ini b/openQRM-5.3.50-CE/src/plugins/collectd/web/lang/de.collectd.ini deleted file mode 100644 index a842152..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/lang/de.collectd.ini +++ /dev/null @@ -1,7 +0,0 @@ -[statistics] -tab = "Collectd" -label = "Statistik auf Ressource %s" -form_interval = "Zeitraum" -action_download = "download" -no_data = "Keien Statistik gefunden" -please_wait = "Lade Collectd Daten. Bitte warten .." diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/lang/en.collectd-about.ini b/openQRM-5.3.50-CE/src/plugins/collectd/web/lang/en.collectd-about.ini deleted file mode 100644 index 21d390a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/lang/en.collectd-about.ini +++ /dev/null @@ -1,40 +0,0 @@ -[documentation] -tab = "About collectd" -label = "About collectd" -introduction_title = "Introduction" -introduction_content = "The collectd plugin automatically provides system statistics for server. It seamlessly integrates collectd within openQRM and provides hourly, daily, weekly and monthly system graphs created from the collected data via rrdtool. - By enabling the plugin collectd is pre-configured and initialized automatically. The system graphs are updated sequentially via a cron job.

    -

    hint It may take some minutes after the start of a server to collect enough data to create the graphs." -requirements_title = "Requirements" -requirements_list = "none" -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions." - -provides_title = "Provides" -provides_list = "System statistics for server" -type_title = "Plugin type" -type_content = "Monitoring" - -documentation_title = "Documentation" -use_case_title = "Use case" - -[bootservice] -tab = "boot service" -label = "Collectd boot service" -boot_service_title = "Collectd boot service" -boot_service_content = "

    The collectd plugin provides an openQRM boot service which is automatically downloaded and executed by the openQRM client on all integrated systems. The boot service is located at: -

    /usr/share/openqrm/plugins/collectd/web/boot-service-collectd.tgz
    - The boot service contains the client files of the collectd plugin. and a configuration file for the collectd hosts. The boot service configuration can be viewed and administrated by the 'openqrm' utility. To view the current default boot service configuration run: -
    /usr/share/openqrm/bin/openqrm boot-service view -n collectd -a default
    - To view a boot service configuration of a specific Server run: -
    /usr/share/openqrm/bin/openqrm boot-service view -n collectd -a [appliance-name]
    - To adapt a parameter in the current default boot-service configuration run: -
    /usr/share/openqrm/bin/openqrm boot-service configure -n collectd -a default -k [key] -v [value]
    - To adapt a parameter in the boot service configuration of a specific Server run:
    -
    /usr/share/openqrm/bin/openqrm boot-service configure -n collectd -a [appliance-name] -k [key] -v [value]
    - In case the openQRM server itself is used as the collectd host please edit:
    -
    /usr/share/openqrm/plugins/collectd/etc/openqrm-plugin-collectd.conf
    " - -[usage] -tab = "About collectd" -label = "Collectd use cases" diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/lang/en.collectd.ini b/openQRM-5.3.50-CE/src/plugins/collectd/web/lang/en.collectd.ini deleted file mode 100644 index cb69491..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/lang/en.collectd.ini +++ /dev/null @@ -1,7 +0,0 @@ -[statistics] -tab = "Collectd" -label = "Statistics on resource %s" -form_interval = "Interval" -action_download = "download" -no_data = "No statistics found" -please_wait = "Loading Collectd Data. Please wait .." diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/collectd/web/menu.txt deleted file mode 100644 index cf9f47c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/menu.txt +++ /dev/null @@ -1,22 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|Collectd -...|About|index.php?plugin=collectd&controller=collectd-about|How to use -...|Config|index.php?plugin=collectd&collectd_about_action=bootservice&controller=collectd-about|Collectd Boot-Service diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/openqrm-collectd-appliance-hook.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/openqrm-collectd-appliance-hook.php deleted file mode 100644 index 97bed7c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/openqrm-collectd-appliance-hook.php +++ /dev/null @@ -1,62 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $OPENQRM_SERVER_IP_ADDRESS; -$event = new event(); -global $event; - - - -function openqrm_collectd_appliance($cmd, $appliance_fields) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $appliance_id=$appliance_fields["appliance_id"]; - $appliance_name=$appliance_fields["appliance_name"]; - $resource = new resource(); - $resource->get_instance_by_id($appliance_fields["appliance_resources"]); - $appliance_ip=$resource->ip; - - - $event->log("openqrm_new_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-collectd-appliance-hook.php", "Handling $cmd event $appliance_id/$appliance_name/$appliance_ip", "", "", 0, 0, $appliance_id); - // we remove the stats on add and remove - switch($cmd) { - case "add": - $openqrm_server = new openqrm_server(); - $openqrm_server->send_command($OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/collectd/bin/openqrm-collectd-manager remove ".$appliance_name." now --openqrm-cmd-mode background"); - break; - case "remove": - $openqrm_server = new openqrm_server(); - $openqrm_server->send_command($OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/collectd/bin/openqrm-collectd-manager remove ".$appliance_name." now --openqrm-cmd-mode background"); - break; - - } -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/openqrm-collectd-appliance-link-hook.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/openqrm-collectd-appliance-link-hook.php deleted file mode 100644 index 47fad2c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/openqrm-collectd-appliance-link-hook.php +++ /dev/null @@ -1,58 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/htmlobjects/htmlobject.class.php"; -global $OPENQRM_SERVER_BASE_DIR; -$event = new event(); -global $event; - - - -function get_collectd_appliance_link($appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - - $appliance_name=''; - - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $hostname = $appliance->name; - if ($resource->id == 0) { - $hostname = 'openqrm'; - } - - $a = ''; - if(file_exists('/usr/share/openqrm/plugins/collectd/data/'.$hostname)) { - $html = new htmlobject($OPENQRM_SERVER_BASE_DIR.'/openqrm/web/base/class/htmlobjects'); - $a = $html->a(); - $a->label = 'collectd'; - $a->css = 'badge'; - $a->handler = 'onclick="wait();"'; - $a->href = '/openqrm/base/index.php?plugin=collectd&controller=collectd&collectd_action=statistics&appliance_id='.$appliance->id; - } - return $a; -} diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/tpl/collectd-about-bootservice.tpl.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/tpl/collectd-about-bootservice.tpl.php deleted file mode 100644 index 83406ed..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/tpl/collectd-about-bootservice.tpl.php +++ /dev/null @@ -1,31 +0,0 @@ - - - - -
    -
    -

    {boot_service_title}

    - - {boot_service_content} - -
    -
    - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/tpl/collectd-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/tpl/collectd-about-documentation.tpl.php deleted file mode 100644 index 180d9a2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/tpl/collectd-about-documentation.tpl.php +++ /dev/null @@ -1,47 +0,0 @@ - -

    {label}

    - -
    -
    -

    {introduction_title}

    - {introduction_content} - -
    -

    {provides_title}

    - {provides_list} - -
    -

    {requirements_title}

    - {requirements_list} - -
    - - -
    - -

    {type_title}

    - {type_content} - -

    {tested_title}

    - {tested_content} -
    -
    - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/tpl/collectd-about-usage.tpl.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/tpl/collectd-about-usage.tpl.php deleted file mode 100644 index 102297f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/tpl/collectd-about-usage.tpl.php +++ /dev/null @@ -1,20 +0,0 @@ - -

    {label}

    -
    - - diff --git a/openQRM-5.3.50-CE/src/plugins/collectd/web/tpl/collectd-statistics.tpl.php b/openQRM-5.3.50-CE/src/plugins/collectd/web/tpl/collectd-statistics.tpl.php deleted file mode 100644 index e9dc875..0000000 --- a/openQRM-5.3.50-CE/src/plugins/collectd/web/tpl/collectd-statistics.tpl.php +++ /dev/null @@ -1,32 +0,0 @@ - -

    {label}

    -
    -
    -
    - {form} -
    {interval}
    -
    {submit}
    -
     
    -
    -
    -
     
    -{download} - -
     
    -{images} -
    diff --git a/openQRM-5.3.50-CE/src/plugins/development/Makefile b/openQRM-5.3.50-CE/src/plugins/development/Makefile deleted file mode 100644 index e8e506a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -# this is the openQRM development-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web/tpl/ - . $(OPENQRM_SERVER_CONF) && chmod 777 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web/lang/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web/css/ - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/development - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/development/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/development/etc/init.d/openqrm-plugin-development b/openQRM-5.3.50-CE/src/plugins/development/etc/init.d/openqrm-plugin-development deleted file mode 100644 index 875f63b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/etc/init.d/openqrm-plugin-development +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -# init script for the openQRM development-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/include/openqrm-plugin-development-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/etc/openqrm-plugin-development.conf -openqrm_server_get_config -export LANG=C -# define wget to use with https -if [ "$OPENQRM_WEB_PROTOCOL" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - - -function openqrm_plugin_development_start() { - echo "Starting the openQRM development-plugin" - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/development/.running -} - - -function openqrm_plugin_development_stop() { - echo "Stopping the openQRM development-plugin" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/development/.running -} - -function openqrm_plugin_development_uninstall() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "development: Please give a username to uninstall the plugin : " - read USERNAME - echo - echo -n "development: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Uninstalling the openQRM development-plugin" - openqrm_plugin_development_stop - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/development -} - -function openqrm_plugin_development_init() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "development: Please give a username to init the plugin : " - read USERNAME - echo - echo -n "development: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - - echo "Initializing the openQRM development-plugin" - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/development/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/development - -} - - - - - - - -USER=$2 -PASS=$3 - -case "$1" in - start) - openqrm_plugin_development_start - ;; - stop) - openqrm_plugin_development_stop - ;; - restart) - openqrm_plugin_development_stop - sleep 1 - openqrm_plugin_development_start - ;; - init) - openqrm_plugin_development_init $USER $PASS - ;; - uninstall) - openqrm_plugin_development_uninstall $USER $PASS - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/development/etc/init.d/openqrm-plugin-development.postinstall b/openQRM-5.3.50-CE/src/plugins/development/etc/init.d/openqrm-plugin-development.postinstall deleted file mode 100644 index c3a3525..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/etc/init.d/openqrm-plugin-development.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-documentation postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/development/etc/init.d/openqrm-plugin-development.preremove b/openQRM-5.3.50-CE/src/plugins/development/etc/init.d/openqrm-plugin-development.preremove deleted file mode 100644 index 44712f7..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/etc/init.d/openqrm-plugin-development.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-development preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-development stop diff --git a/openQRM-5.3.50-CE/src/plugins/development/etc/openqrm-plugin-development.conf b/openQRM-5.3.50-CE/src/plugins/development/etc/openqrm-plugin-development.conf deleted file mode 100644 index b845044..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/etc/openqrm-plugin-development.conf +++ /dev/null @@ -1,40 +0,0 @@ -# this is the openQRM-plugin-development info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Documentation for Plugin-Development." -OPENQRM_PLUGIN_TYPE="misc" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="" -# dirs which should be taken to the state backup -OPENQRM_PLUGIN_STATE_DIRS="" - diff --git a/openQRM-5.3.50-CE/src/plugins/development/include/openqrm-plugin-development-functions b/openQRM-5.3.50-CE/src/plugins/development/include/openqrm-plugin-development-functions deleted file mode 100644 index afb9a5a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/include/openqrm-plugin-development-functions +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -# this is the functions file for the development-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -DEVELOPMENT_MANAGER_LOCK_FILE=/var/run/openqrm/development-plugin.lock -DEVELOPMENT_MANAGER_LOCK_DELAY=5 -DEVELOPMENT_MANAGER_LOCK_RETRY=100 -DEVELOPMENT_MANAGER_LOCK_TIMEOUT=500 -################ common development functions - -# logs for development -function development_manager_log() { - local COMPONENT=$1 - shift - local MESSAGE=$@ - logger -i -t "development plug-in" "$COMPONENT : $MESSAGE" -} - - -# locking function -function development_manager_lock() { - local COMMAND=$1 - local RET=1 - - if [ ! -d `dirname $DEVELOPMENT_MANAGER_LOCK_FILE` ]; then - mkdir -p `dirname $DEVELOPMENT_MANAGER_LOCK_FILE` - fi - case "$COMMAND" in - aquire) - lockfile -s $DEVELOPMENT_MANAGER_LOCK_DELAY -r $DEVELOPMENT_MANAGER_LOCK_RETRY -l $DEVELOPMENT_MANAGER_LOCK_TIMEOUT $DEVELOPMENT_MANAGER_LOCK_FILE - RET=$? - development_manager_log development_manager_lock "Aquired the lock" - return $RET - ;; - release) - /bin/rm -f $DEVELOPMENT_MANAGER_LOCK_FILE - RET=$? - development_manager_log development_manager_lock "Released the lock" - return $RET - ;; - *) - development_manager_log development_manager_lock "No such command. Try 'aquire' or 'release'" - return 1 - ;; - esac -} - - - -################ development functions - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/development-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/development-about.controller.class.php deleted file mode 100644 index e7c5af4..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/development-about.controller.class.php +++ /dev/null @@ -1,158 +0,0 @@ - - */ - - -class development_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'development_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'development_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'development_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'development_about_identifier'; -/** -* path to developments -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About Development', - 'label' => 'About Development', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The Development plugin provides developer informations like translation and rest api for base and plugins.', - 'requirements_title' => 'Requirements', - 'requirements_list' => 'none', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - 'type_title' => 'Plugin Type', - 'type_content' => 'Misc', - ), -); - - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/development/lang", 'development-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/development/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About Documentation - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/development/class/development-about.documentation.class.php'); - $controller = new development_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/development-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/development-about.documentation.class.php deleted file mode 100644 index c474285..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/development-about.documentation.class.php +++ /dev/null @@ -1,87 +0,0 @@ - - */ - -class development_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'development_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "development_about_msg"; -/** -* path to documentations -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_documentation - */ - //-------------------------------------------- - function action() { - $svn_co_command = ""; - $t = $this->response->html->template($this->tpldir.'/development-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.api.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/development.api.class.php deleted file mode 100644 index c973cff..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.api.class.php +++ /dev/null @@ -1,376 +0,0 @@ - - */ - - -class development_api -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'development_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "development_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'development_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'development_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - - $this->openqrm = $openqrm; - $this->controller = $controller; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('basedir'); - $this->tpldir = $this->rootdir.'/plugins/development/tpl'; - $this->response = $response; - $this->file = $this->openqrm->file(); - - $plugin = $this->response->html->request()->get('plugin_name'); - $this->response->add('plugin_name', $plugin); - $base = $this->response->html->request()->get('base_name'); - $this->response->add('base_name', $base); - $this->methods = array('api', 'action'); - } - - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - if($this->response->html->request()->get('plugin_name') !== '') { - $name = $this->response->html->request()->get('plugin_name'); - $data['label'] = sprintf($this->lang['label_plugin'], $name); - } - else if ($this->response->html->request()->get('base_name') !== '') { - $name = $this->response->html->request()->get('base_name'); - $data['label'] = sprintf($this->lang['label_base'], $name); - } - $data['canceled'] = $this->lang['canceled']; - $data['wait'] = $this->lang['please_wait']; - $data['prefix_tab'] = $this->prefix_tab; - $vars = array_merge( - $data, - array( - 'thisfile' => $this->response->html->thisfile, - )); - $t = $this->response->html->template($this->tpldir.'/development-rest.tpl.php'); - $t->add($vars); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - - return $this->edit($t); - - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function edit($template) { - - // cache output - ob_start(); - - require_once($this->openqrm->get('webdir').'/class/htmlobjects/htmlobject.response.class.php'); - $response = new htmlobject_response($this->response->html, $this->response->id); - $response->html->debug(); - - require_once($this->openqrm->get('basedir').'/plugins/development/web/class/dummyuser.class.php'); - $dummy = new dummyuser('xxx'); - - require_once($this->openqrm->get('basedir').'/web/base/class/openqrm.class.php'); - $oq = new openqrm($this->file, $dummy, $response); - - - - if($this->response->html->request()->get('plugin_name') !== '') { - $path = $this->rootdir.'/plugins/'.$this->response->html->request()->get('plugin_name').'/web/class/'; - } - if($this->response->html->request()->get('base_name') !== '') { - if($this->response->html->request()->get('base_name') !== 'plugins') { - $path = $this->rootdir.'/web/base/server/'.$this->response->html->request()->get('base_name').'/class/'; - } - elseif ($this->response->html->request()->get('base_name') === 'plugins') { - $path = $this->rootdir.'/web/base/plugins/aa_plugins/class/'; - } - } - - $files = $this->file->get_files($path); - $name = array(); - $objs = array(); - if(is_array($files)) { - foreach($files as $file) { - if(strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') === false) { - require_once($file['path']); - $class = str_replace('.class.php', '', $file['name']); - $class = str_replace('.', '_', $class); - $class = str_replace('-', '_', $class); - $class = new $class($oq, $response->response()); - $objs[] = $class; - $name[] = str_replace('.controller.class.php','', $file['name']); - } - } - } - - $content = array(); - $i = 0; - foreach($objs as $obj) { - $content[$i]['name'] = $name[$i]; - $content[$i]['object'] = $obj; - $content[$i]['class'] = get_class($obj); - if(get_class_methods($obj)) { - $content[$i]['methods'] = get_class_methods($obj); - } else { - $content[$i]['methods'] = ''; - } - $content[$i]['vars'] = get_class_vars(get_class($obj)); - $i++; - } - - $legend = ''; - $doc = ''; - if($this->response->html->request()->get('plugin_name') !== '') { - $plugin = 'plugin='.$this->response->html->request()->get('plugin_name'); - $action = 'plugin'; - } - else if($this->response->html->request()->get('base_name') !== '') { - $plugin = 'base='.$this->response->html->request()->get('base_name'); - $action = 'base'; - } - if(count($content) > 0) { - foreach($content as $con) { - foreach($con as $k => $v) { - if($k === 'name') { - $controller = 'controller='.$v; - } - if($k === 'methods') { - if(is_array($v)) { - $i = 0; - foreach($v as $value) { - $css = ''; - if(stripos($value, 'api') !== false && $controller !== 'controller=development') { - $file = $con['name'].'.'.str_replace('_', '-', $value).'.class.php'; - if($this->file->exists($path.$file)) { - $css = 'action'; - if($i === 0) { $i++; $css = 'action first'; } - require_once($path.$file); - $class = str_replace('.class.php', '', $file); - $class = str_replace('.', '_', $class); - $class = str_replace('-', '_', $class); - $class = new $class($con['object']); - // check lang - if(isset($con['object']->lang[$value])) { - $class->lang = $con['object']->lang[$value]; - } else { - $class->lang = $con['object']->lang; - } - - $t = $this->__template($path.$file); - $doc .= ''; - $doc .= $t->get_string(); - } else { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missing file '.$file.' for action '.$value.'
    '; - } - } - - } - } - } - } - } - } else { - $oop = false; - foreach($files as $file) { - if(strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') !== false) { - $oop = true; - $doc = '
    Plugin '.$this->response->html->request()->get('plugin_name').' is about controller only
    '; - break; - } - } - if($oop === false) { - $doc = '
    Plugin '.$this->response->html->request()->get('plugin_name').' is not OOP
    '; - } - } - - if($doc === '') { - $doc = '
    Plugin has no API
    '; - } - - $template->add($doc, 'controllers'); - $template->add($legend, 'legend'); - - // handle errors - $phpinfo = ''; - if($this->response->html->request()->get('debug') !== '' ) { - if(isset($GLOBALS['error_controller']) && count($GLOBALS['error_controller']) > 0) { - $phpinfo .= implode('', $GLOBALS['error_controller']); - } - if(isset($GLOBALS['error_action']) && count($GLOBALS['error_action']) > 0) { - $phpinfo .= implode('', $GLOBALS['error_action']); - } - if(isset($GLOBALS['error_php']) && count($GLOBALS['error_php']) > 0) { - $phpinfo .= implode('', $GLOBALS['error_php']); - } - $messages = trim(ob_get_contents()); - if($messages !== '') { - $phpinfo .= 'HTMLOBJECTS DEBUG:
    '.$messages; - } - } - - // end cache - ob_end_clean(); - - if($phpinfo !== '') { - $phpinfo = '
    '.$phpinfo.'
    '; - } else { - $phpinfo = ' '; - } - $template->add($phpinfo, 'phpinfo'); - $template = $this->controller->__get_navi($template, 'api'); - - - // event cleanup, some methods creating events if constructed without parameters - $event = new event(); - $event->remove_by_description('Could not create instance of'); - return $template; - } - - //-------------------------------------------- - /** - * Get Classreader Template - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function __template($path) { - - require_once($this->rootdir.'/plugins/development/web/class/docblock.class.php'); - $reader = new docblock($path); - - $template = $this->response->html->template($this->rootdir.'/plugins/development/web/tpl/docblock.tpl.php'); - - $ar = $reader->get(); - $out = array(); - $out['class'] = $ar['classname']; - foreach($ar as $key => $value) { - - if($value !== '') { - $out[$key] = ''.$key.': '.$value; - } else { - $out[$key] = ''; - } - if($key === 'docblock') { - $out['docblock'] = implode('
    ', $ar['docblock']); - } - if($key === 'attribs') { - if(is_array($ar['attribs'])) { - $out['attribs'] = ''; - $out['attribs-ul'] = '
      '; - foreach($ar['attribs'] as $k => $attrib) { - $out['attribs'] .= 'top'; - $out['attribs'] .= '
      attribute: '. $k; - $out['attribs'] .= '
      '; - $out['attribs'] .= 'access: '. $attrib['access'].'
      '; - $out['attribs'] .= 'default:
      '. $attrib['default'].'

      '; - $out['attribs'] .= '
      '.implode("\n", $attrib['docblock']).'
      '; - - $out['attribs-ul'] .= '
    • '.$k.'
    • '; - } - $out['attribs-ul'] .= '
    '; - } else { - $out['attribs'] = ''; - $out['attribs-ul'] = ''; - } - } - if($key === 'methods') { - if(is_array($ar['methods'])) { - $out['methods'] = ''; - $out['methods-ul'] = '
      '; - foreach($ar['methods'] as $k => $attrib) { - $out['methods'] .= 'top'; - $out['methods'] .= '
      function: '. $k; - $out['methods'] .= '
      '; - if($attrib['params'] !== '') { - $out['methods'] .= 'params:
      ';
      -							$out['methods'] .= str_replace(array(', ',','), "\n", $attrib['params']);
      -							$out['methods'] .= '

      '; - } else { - $out['methods'] .= '
      '; - } - $out['methods'] .= '
      '.implode("\n", $attrib['docblock']).'
      '; - - $out['methods-ul'] .= '
    • '.$k.'
    • '; - } - $out['methods-ul'] .= '
    '; - } else { - $out['methods'] = ''; - $out['methods-ul'] = ''; - } - } - - } - $template->add($out); - return $template; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.controller.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/development.controller.class.php deleted file mode 100644 index 61230f3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.controller.class.php +++ /dev/null @@ -1,725 +0,0 @@ - - */ - -function myErrorHandler($code, $txt, $file, $line, $context) -{ - $text = $file." [".$line."] ".$txt ."\n"; - switch ($code) { - case E_PARSE: - echo 'E_PARSE: '.$text; - break; - case E_ERROR: - echo 'E_ERROR: '.$text; - break; - case E_DEPRECATED: - $GLOBALS['error_php'][] = '
    E_DEPRECATED: '.$text.'
    '; - break; - case E_STRICT: - $GLOBALS['error_php'][] = '
    E_STRICT: '.$text.'
    '; - break; - case E_WARNING: - $GLOBALS['error_php'][] = '
    E_WARNING: '.$text.'
    '; - break; - case E_NOTICE: - $GLOBALS['error_php'][] = '
    E_NOTICE: '.$text.'
    '; - break; - default: - $GLOBALS['error_php'][] = '
    '.$code.': '.$text.'
    '; - break; - } - /* Don't execute PHP internal error handler */ - return true; -} - - - -class development_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'development_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "development_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'development_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'development_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array( - 'tab' => 'Development', - 'label' => 'Development', - 'id' => 'Name', - 'action_docblock' => 'docblock', - 'action_rest' => 'rest', - 'action_lang' => 'lang', - 'action_template' => 'templates', - 'action_api' => 'api', - 'action_hooks' => 'hooks', - 'action_js' => 'js', - 'action_css' => 'css', - 'please_wait' => 'Loading. Please wait ..', - ), - 'rest' => array( - 'tab' => 'Rest', - 'label_plugin' => 'View Plugin %s Rest', - 'label_base' => 'View %s Rest', - 'param_must_be_set_within_action' => 'must be set within action', - 'param_optional' => 'optional', - 'param_form_field' => 'form field', - 'param_required' => 'required form field', - 'param_validator' => 'validator', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'api' => array( - 'tab' => 'Api', - 'label_plugin' => 'View Plugin %s Api', - 'label_base' => 'View %s Api', - 'param_must_be_set_within_action' => 'must be set within action', - 'param_optional' => 'optional', - 'param_form_field' => 'form field', - 'param_required' => 'required form field', - 'param_validator' => 'validator', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'template' => array( - 'tab' => 'Template', - 'label_plugin' => 'View Plugin %s Templates', - 'label_base' => 'View %s Templates', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'lang' => array( - 'tab' => 'Translation', - 'label_plugin' => 'View Plugin %s Translation', - 'label_base' => 'View %s Translation', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'docblock' => array( - 'tab' => 'Docblock', - 'label_plugin' => 'View Plugin %s Docblock', - 'label_base' => 'View %s Docblock', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'hooks' => array( - 'tab' => 'Hooks', - 'label_plugin' => 'View Plugin %s Hooks', - 'label_base' => 'View %s Hooks', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - 'appliance-hook' => 'The appliance-hook allows plugins to run custom action during start, stop and update of a server.', - 'appliance-edit-hook' => 'The appliance-edit hook provides plugins the capability to add an action item in the server edit section.', - 'appliance-link-hook' => 'The appliance-edit hook provides plugins the capability to add an action item in the server overview section.', - 'billing-hook' => 'The billing-hook allows to plugin custom external billing systems for the Cloud deployments.', - 'cloud-hook' => 'The cloud-hook let the virtualization plugins define the way how specific VMs are created and removed.', - 'dashboard-quicklink-hook' => 'The dashboard-quicklink-hook provides an option for plugins to add a icon and URL to the Quicklink setion on the openQRM dashboard.', - 'deployment-auth-hook/auth-hook' => 'The deployment-auth-hook provides the storage plugins which is responsible for the specific image deployment types of the server image to run custom action on the storage object to authenticate/de-authenticate the image volume.', - 'deployment-cloud-hook' => 'The deployment-cloud-hook let the storage plugins define a the way how the image volumes are created/removed/resized/privatized for the automated Cloud deployment.', - 'event-hook' => 'The event-hook is triggered when a specific event arrives in openQRM and allows plugins to run custom actions.', - 'external-dns-hook' => 'The external-dns-hook provides a way to interact with remote DNS services.', - 'ha-cmd-hook' => 'The ha-cmd-hook let the virtualization plugins define the way how specific VMs are created and fenced in case of a highavailability fail-over.', - 'monitor-hook' => 'The monitor-hook provides an option for plugins to run frequent repeated commands e.g. for status updates.', - 'remote-console-hook' => 'The remote-console-hook allows plugins to embed a remote console for specific Virtualization technologies.', - 'resource-hook' => 'The resource-hook allows plugins to run custom action during start, stop and restart of a server.', - 'resource-fence-hook' => 'The resource-fence-hook defines how resources are fenced (STONITH) during highavailability fail-over.', - 'resource-virtual-command-hook' => 'The resource-virtual-command-hook let the virtualization plugins define the way how specific VMs and Hosts are started and stopped through the Virtualization Host API.', - 'role-hook' => 'The role-hook provides plugins the capability to define custom role-based permissions for every action in openQRM.', - ), - 'js' => array( - 'tab' => 'JS', - 'label_plugin' => 'View Plugin %s JS', - 'label_base' => 'View %s JS', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'css' => array( - 'tab' => 'CSS', - 'label_plugin' => 'View Plugin %s CSS', - 'label_base' => 'View %s CSS', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/development/lang", 'development.ini'); - $this->tpldir = $this->rootdir.'/plugins/development/tpl'; - if($this->response->html->request()->get('debug') !== '' ) { - $this->response->add('debug', $this->response->html->request()->get('debug')); - } - $alter_error_handler = set_error_handler("myErrorHandler"); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = 'select'; - } - - $content = array(); - switch( $this->action ) { - case '': - default: - case 'select': - $content[] = $this->select(true); - break; - case 'rest': - $content[] = $this->select(false); - $content[] = $this->rest(true); - break; - case 'api': - $content[] = $this->select(false); - $content[] = $this->api(true); - break; - case 'docblock': - $content[] = $this->select(false); - $content[] = $this->docblock(true); - break; - case 'lang': - $content[] = $this->select(false); - $content[] = $this->lang(true); - break; - case 'template': - $content[] = $this->select(false); - $content[] = $this->template(true); - break; - case 'hooks': - $content[] = $this->select(false); - $content[] = $this->hooks(true); - break; - case 'js': - $content[] = $this->select(false); - $content[] = $this->js(true); - break; - case 'css': - $content[] = $this->select(false); - $content[] = $this->css(true); - break; - case 'download': - $this->__download(); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/development/class/development.select.class.php'); - $controller = new development_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Rest - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function rest( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/development/class/development.rest.class.php'); - $controller = new development_rest($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['rest']; - $data = $controller->action(); - } - $content['label'] = $this->lang['rest']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'rest' ); - $content['onclick'] = false; - if($this->action === 'rest'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * API - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function api( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/development/class/development.api.class.php'); - $controller = new development_api($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['api']; - $data = $controller->action(); - } - $content['label'] = $this->lang['api']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'api' ); - $content['onclick'] = false; - if($this->action === 'api'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Template - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function template( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/development/class/development.template.class.php'); - $controller = new development_template($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['template']; - $data = $controller->action(); - } - $content['label'] = $this->lang['template']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'template' ); - $content['onclick'] = false; - if($this->action === 'template'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Lang - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function lang( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/development/class/development.lang.class.php'); - $controller = new development_lang($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['lang']; - $data = $controller->action(); - } - $content['label'] = $this->lang['lang']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'lang' ); - $content['onclick'] = false; - if($this->action === 'lang'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Docblock - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function docblock( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/development/class/development.docblock.class.php'); - $controller = new development_docblock($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['docblock']; - $data = $controller->action(); - } - $content['label'] = $this->lang['docblock']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'docblock' ); - $content['onclick'] = false; - if($this->action === 'docblock'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Hooks - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function hooks( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/development/class/development.hooks.class.php'); - $controller = new development_hooks($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['hooks']; - $data = $controller->action(); - } - $content['label'] = $this->lang['hooks']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'hooks' ); - $content['onclick'] = false; - if($this->action === 'hooks'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * JS - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function js( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/development/class/development.js.class.php'); - $controller = new development_js($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['js']; - $data = $controller->action(); - } - $content['label'] = $this->lang['js']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'js' ); - $content['onclick'] = false; - if($this->action === 'js'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * CSS - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function css( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/development/class/development.css.class.php'); - $controller = new development_css($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['css']; - $data = $controller->action(); - } - $content['label'] = $this->lang['css']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'css' ); - $content['onclick'] = false; - if($this->action === 'css'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Download File - * - * @access public - * @param string $target - * @param string $mime - */ - //-------------------------------------------- - function __download() { - $file = $this->response->html->request()->get('file'); - $file = str_replace('../', '', $file); - - if($this->response->html->request()->get('plugin_name') !== '') { - $dir = $this->response->html->request()->get('plugin_name'); - $path = $this->openqrm->get('basedir').'/plugins/'.$dir.'/web/'.$file; - $mime = $this->response->html->request()->get('mime'); - } - else if($this->response->html->request()->get('base_name') !== '') { - if($this->response->html->request()->get('base_name') !== 'plugins') { - $dir = $this->response->html->request()->get('base_name'); - $path = $this->openqrm->get('basedir').'/web/base/server/'.$dir.'/'.$file; - $mime = $this->response->html->request()->get('mime'); - } - elseif ($this->response->html->request()->get('base_name') === 'plugins') { - $dir = 'aa_plugins'; - $path = $this->openqrm->get('basedir').'/web/base/plugins/aa_plugins/'.$file; - $mime = $this->response->html->request()->get('mime'); - } - } - - if (!headers_sent()) { - $filename = str_replace(' ', '_', $file); - ini_set('zlib.output_compression','Off'); - header("Pragma: public"); - header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Cache-Control: must-revalidate"); - header("Content-type: ".$mime.""); - header("Content-Length: ".filesize($path)); - header("Content-disposition: inline; filename=$filename"); - header("Accept-Ranges: ".filesize($path)); - readfile($path); - exit(); - } else { - echo $path; - } - } - - //-------------------------------------------- - /** - * Previous and next - * - * @access private - * @param object $template - * @param string $mode - * @return object - */ - //-------------------------------------------- - function __get_navi($template, $mode) { - $response = $this->response; - if($this->response->html->request()->get('plugin_name') !== '') { - $plugin = new plugin(); - $plugins = $plugin->available(); - $key = array_keys($plugins, $this->response->html->request()->get('plugin_name')); - $key = $key[0]; - $param = 'plugin_name'; - } - if($this->response->html->request()->get('base_name') !== '') { - $plugins = array('aa_server', 'appliance', 'event', 'image','kernel', 'plugins', 'resource','storage'); - $key = array_keys($plugins, $this->response->html->request()->get('base_name')); - $key = $key[0]; - $param = 'base_name'; - } - $prev = ' '; - $next = ' '; - if($key === 0) { - $next = $response->html->a(); - $next->label = $plugins[1].' >>'; - $next->href = $this->response->get_url($this->actions_name, $mode ).'&'.$param.'='.$plugins[1]; - $next->handler = 'onclick="wait();"'; - } - else if($key !== 0 && $key < count($plugins)-1) { - $prev = $response->html->a(); - $prev->label = '<< '.$plugins[$key-1]; - $prev->href = $this->response->get_url($this->actions_name, $mode ).'&'.$param.'='.$plugins[$key-1]; - $prev->handler = 'onclick="wait();"'; - $next = $response->html->a(); - $next->label = $plugins[$key+1].' >>'; - $next->href = $this->response->get_url($this->actions_name, $mode ).'&'.$param.'='.$plugins[$key+1]; - $next->handler = 'onclick="wait();"'; - } - else if($key === count($plugins)-1) { - $prev = $response->html->a(); - $prev->label = '<< '.$plugins[$key-1]; - $prev->href = $this->response->get_url($this->actions_name, $mode ).'&'.$param.'='.$plugins[$key-1]; - $prev->style = "text-decoration: none;"; - $prev->handler = 'onclick="wait();"'; - } - $switch = ''; - if($mode !== 'docblock') { - $a = $response->html->a(); - $a->label = 'docblock'; - $a->href = $this->response->get_url($this->actions_name, 'docblock' ); - $a->handler = 'onclick="wait();"'; - $switch .= $a->get_string(); - } - if($mode !== 'lang') { - $a = $response->html->a(); - $a->label = 'lang'; - $a->href = $this->response->get_url($this->actions_name, 'lang' ); - $a->handler = 'onclick="wait();"'; - $switch .= $a->get_string(); - } - if($mode !== 'rest') { - $a = $response->html->a(); - $a->label = 'rest'; - $a->href = $this->response->get_url($this->actions_name, 'rest' ); - $a->handler = 'onclick="wait();"'; - $switch .= $a->get_string(); - } - if($mode !== 'api') { - $a = $response->html->a(); - $a->label = 'api'; - $a->href = $this->response->get_url($this->actions_name, 'api' ); - $a->handler = 'onclick="wait();"'; - $switch .= $a->get_string(); - } - if($mode !== 'template') { - $a = $response->html->a(); - $a->label = 'templates'; - $a->href = $this->response->get_url($this->actions_name, 'template' ); - $a->handler = 'onclick="wait();"'; - $switch .= $a->get_string(); - } - if($mode !== 'hooks') { - $a = $response->html->a(); - $a->label = 'hooks'; - $a->href = $this->response->get_url($this->actions_name, 'hooks' ); - $a->handler = 'onclick="wait();"'; - $switch .= $a->get_string(); - } - if($mode !== 'js') { - $a = $response->html->a(); - $a->label = 'js'; - $a->href = $this->response->get_url($this->actions_name, 'js' ); - $a->handler = 'onclick="wait();"'; - $switch .= $a->get_string(); - } - if($mode !== 'css') { - $a = $response->html->a(); - $a->label = 'css'; - $a->href = $this->response->get_url($this->actions_name, 'css' ); - $a->handler = 'onclick="wait();"'; - $switch .= $a->get_string(); - } - - $template->add($switch, 'switch'); - $template->add($prev, 'previous'); - $template->add($next, 'next'); - return $template; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.css.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/development.css.class.php deleted file mode 100644 index be16059..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.css.class.php +++ /dev/null @@ -1,161 +0,0 @@ - - */ - - -class development_css -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'development_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "development_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'development_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'development_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - - $this->openqrm = $openqrm; - $this->controller = $controller; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('basedir'); - $this->tpldir = $this->rootdir.'/plugins/development/tpl'; - $this->response = $response; - $this->file = $this->openqrm->file(); - - $plugin = $this->response->html->request()->get('plugin_name'); - $this->response->add('plugin_name', $plugin); - $base = $this->response->html->request()->get('base_name'); - $this->response->add('base_name', $base); - $this->methods = array('api', 'action'); - } - - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - if($this->response->html->request()->get('plugin_name') !== '') { - $name = $this->response->html->request()->get('plugin_name'); - $data['label'] = sprintf($this->lang['label_plugin'], $name); - } - else if ($this->response->html->request()->get('base_name') !== '') { - $name = $this->response->html->request()->get('base_name'); - $data['label'] = sprintf($this->lang['label_base'], $name); - } - $vars = array_merge( - $data, - array( - 'thisfile' => $this->response->html->thisfile, - )); - $t = $this->response->html->template($this->tpldir.'/development-css.tpl.php'); - $t->add($vars); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - - return $this->edit($t); - - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function edit($template) { - if($this->response->html->request()->get('plugin_name') !== '') { - $path = $this->rootdir.'/plugins/'.$this->response->html->request()->get('plugin_name').'/web/css/'; - } - if($this->response->html->request()->get('base_name') !== '') { - if($this->response->html->request()->get('base_name') !== 'plugins') { - $path = $this->rootdir.'/web/base/server/'.$this->response->html->request()->get('base_name').'/css/'; - } - elseif ($this->response->html->request()->get('base_name') === 'plugins') { - $path = $this->rootdir.'/web/base/plugins/aa_plugins/css/'; - } - } - - $files = $this->file->get_files($path, '', '*.css'); - $names = array(); - if(is_array($files)) { - foreach($files as $file) { - if(strripos($file['name'], '.css') !== false) { - $names[] = $file['path']; - } - } - $links = ''; - foreach($names as $path) { - $links .= '

    '.basename($path).'

    '; - $links .= '
    '.$this->file->get_contents($path).'
    '; - } - if($links === '') { - $links = '
    Plugin has no css
    '; - } - $template->add($links, 'links'); - } - $template = $this->controller->__get_navi($template, 'css'); - return $template; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.docblock.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/development.docblock.class.php deleted file mode 100644 index eafd846..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.docblock.class.php +++ /dev/null @@ -1,262 +0,0 @@ - - */ - - -class development_docblock -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'development_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "development_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'development_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'development_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - - $this->openqrm = $openqrm; - $this->controller = $controller; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('basedir'); - $this->tpldir = $this->rootdir.'/plugins/development/tpl'; - $this->response = $response; - $this->file = $this->openqrm->file(); - - $plugin = $this->response->html->request()->get('plugin_name'); - $this->response->add('plugin_name', $plugin); - $base = $this->response->html->request()->get('base_name'); - $this->response->add('base_name', $base); - $this->methods = array('api', 'action'); - } - - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - if($this->response->html->request()->get('plugin_name') !== '') { - $name = $this->response->html->request()->get('plugin_name'); - $data['label'] = sprintf($this->lang['label_plugin'], $name); - } - else if ($this->response->html->request()->get('base_name') !== '') { - $name = $this->response->html->request()->get('base_name'); - $data['label'] = sprintf($this->lang['label_base'], $name); - } - $vars = array_merge( - $data, - array( - 'thisfile' => $this->response->html->thisfile, - )); - $t = $this->response->html->template($this->tpldir.'/development-docblock.tpl.php'); - $t->add($vars); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - - return $this->edit($t); - - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function edit($template) { - - if($this->response->html->request()->get('plugin_name') !== '') { - $path = $this->rootdir.'/plugins/'.$this->response->html->request()->get('plugin_name').'/web/class/'; - } - if($this->response->html->request()->get('base_name') !== '') { - if($this->response->html->request()->get('base_name') !== 'plugins') { - $path = $this->rootdir.'/web/base/server/'.$this->response->html->request()->get('base_name').'/class/'; - } - elseif ($this->response->html->request()->get('base_name') === 'plugins') { - $path = $this->rootdir.'/web/base/plugins/aa_plugins/class/'; - } - } - - $files = $this->file->get_files($path); - $names = array(); - if(is_array($files)) { - foreach($files as $file) { - if(strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') === false) { - $names[] = $file['path']; - } - } - $string = ''; - $links = ' '; - $i = 0; - foreach($names as $path) { - $class = basename($path); - $class = str_replace('.class.php', '', $class); - $class = str_replace('.', '_', $class); - $class = str_replace('-', '_', $class); - - $a = $this->response->html->a(); - $a->label = $class; - $a->href = "#".$class; - $a->style = "text-decoration: none;"; - $links .= '
  • '.$a->get_string().'
  • '; - - if($i !== 0) { - $a = $this->response->html->a(); - $a->label = 'top'; - $a->href = "#topofpage"; - $a->css = "toplink"; - $string .= $a->get_string(); - } - - $t = $this->__template($path); - $string .= $t->get_string(); - - $i++; - } - $template->add($links, 'links'); - $template->add($string, 'controllers'); - } - $template = $this->controller->__get_navi($template, 'docblock'); - return $template; - } - - - //-------------------------------------------- - /** - * Get Classreader Template - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function __template($path) { - - require_once($this->rootdir.'/plugins/development/web/class/docblock.class.php'); - $reader = new docblock($path); - - $template = $this->response->html->template($this->rootdir.'/plugins/development/web/tpl/docblock.tpl.php'); - - $ar = $reader->get(); - $out = array(); - $out['class'] = $ar['classname']; - foreach($ar as $key => $value) { - - if($value !== '') { - $out[$key] = ''.$key.': '.$value; - } else { - $out[$key] = ''; - } - if($key === 'docblock') { - $out['docblock'] = implode('
    ', $ar['docblock']); - } - if($key === 'attribs') { - if(is_array($ar['attribs'])) { - $out['attribs'] = ''; - $out['attribs-ul'] = '
      '; - foreach($ar['attribs'] as $k => $attrib) { - $out['attribs'] .= 'top'; - $out['attribs'] .= '
      attribute: '. $k; - $out['attribs'] .= '
      '; - $out['attribs'] .= 'access: '. $attrib['access'].'
      '; - $out['attribs'] .= 'default:
      '. $attrib['default'].'

      '; - $out['attribs'] .= '
      '.implode("\n", $attrib['docblock']).'
      '; - - $out['attribs-ul'] .= '
    • '.$k.'
    • '; - } - $out['attribs-ul'] .= '
    '; - } else { - $out['attribs'] = ''; - $out['attribs-ul'] = ''; - } - } - if($key === 'methods') { - if(is_array($ar['methods'])) { - $out['methods'] = ''; - $out['methods-ul'] = '
      '; - foreach($ar['methods'] as $k => $attrib) { - $out['methods'] .= 'top'; - $out['methods'] .= '
      function: '. $k; - $out['methods'] .= '
      '; - if($attrib['params'] !== '') { - $out['methods'] .= 'params:
      ';
      -							$out['methods'] .= str_replace(array(', ',','), "\n", $attrib['params']);
      -							$out['methods'] .= '

      '; - } else { - $out['methods'] .= '
      '; - } - $out['methods'] .= '
      '.implode("\n", $attrib['docblock']).'
      '; - - $out['methods-ul'] .= '
    • '.$k.'
    • '; - } - $out['methods-ul'] .= '
    '; - } else { - $out['methods'] = ''; - $out['methods-ul'] = ''; - } - } - - } - $template->add($out); - return $template; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.hooks.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/development.hooks.class.php deleted file mode 100644 index e80ab23..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.hooks.class.php +++ /dev/null @@ -1,204 +0,0 @@ - - */ - - -class development_hooks -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'development_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "development_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'development_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'development_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - - $this->openqrm = $openqrm; - $this->controller = $controller; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('basedir'); - $this->tpldir = $this->rootdir.'/plugins/development/tpl'; - $this->response = $response; - $this->file = $this->openqrm->file(); - - $plugin = $this->response->html->request()->get('plugin_name'); - $this->response->add('plugin_name', $plugin); - $base = $this->response->html->request()->get('base_name'); - $this->response->add('base_name', $base); - $this->methods = array('api', 'action'); - } - - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - if($this->response->html->request()->get('plugin_name') !== '') { - $name = $this->response->html->request()->get('plugin_name'); - $data['label'] = sprintf($this->lang['label_plugin'], $name); - } - else if ($this->response->html->request()->get('base_name') !== '') { - $name = $this->response->html->request()->get('base_name'); - $data['label'] = sprintf($this->lang['label_base'], $name); - } - $vars = array_merge( - $data, - array( - 'thisfile' => $this->response->html->thisfile, - )); - $t = $this->response->html->template($this->tpldir.'/development-hooks.tpl.php'); - $t->add($vars); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - - return $this->edit($t); - - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function edit($template) { - if($this->response->html->request()->get('plugin_name') !== '') { - $plugin_name = $this->response->html->request()->get('plugin_name'); - $path = $this->rootdir.'/plugins/'.$plugin_name.'/web/'; - } - if($this->response->html->request()->get('base_name') !== '') { - $plugin_name = $this->response->html->request()->get('base_name'); - if($plugin_name !== 'plugins') { - $path = $this->rootdir.'/web/base/server/'.$plugin_name; - } - elseif ($plugin_name === 'plugins') { - $path = $this->rootdir.'/web/base/plugins/aa_plugins/'; - } - } - - $files = $this->file->get_files($path); - $names = array(); - if(is_array($files)) { - foreach($files as $file) { - if(strripos($file['name'], 'hook') !== false) { - $names[] = $file['path']; - } - } - $i = 0; - $available = array(); - if(count($names) > 0) { - $table = $this->response->html->table(); - $table->css = 'hooktable'; - foreach($names as $path) { - $a = $this->response->html->a(); - $a->label = 'download'; - $a->href = $this->response->get_url($this->actions_name, 'download').'&file='.basename($path).'&mime=text/plain'; - $a->style = "text-decoration: none;"; - $a->target = '_blank'; - - $tr = $this->response->html->tr(); - - $plugin_name = str_replace('-storage', '', $plugin_name); - $name = basename($path); - $name = preg_replace('~(openqrm-'.$plugin_name.'-)(.*?)(.php)~is', '$1$2$3', $name); - $available[] = preg_replace('~(openqrm-'.$plugin_name.'-)(.*?)(.php)~is', '$2', $name); - $td = $this->response->html->td(); - $td->add($name); - $tr->add($td); - - $td = $this->response->html->td(); - $td->add($a); - $tr->add($td); - - $table->add($tr); - $i++; - } - } - if(!isset($table)) { - $table = '
    Plugin has no hooks
    '; - } - $template->add($table, 'table'); - // Legend - $hidden = array('tab','label_plugin','label_base','please_wait','canceled'); - asort($this->lang); - $legend = ''; - foreach($this->lang as $k => $v) { - if(!in_array($k, $hidden)) { - $css = ''; - if(in_array($k, $available)) { $css = 'class="available"'; } - $legend .= '
    '; - $legend .= '

    '.$k.'

    '; - $legend .= '
    '.$v.'
    '; - $legend .= '
    '; - } - } - $template->add($legend, 'legend'); - - } - $template = $this->controller->__get_navi($template, 'hooks'); - return $template; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.js.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/development.js.class.php deleted file mode 100644 index 31d12a6..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.js.class.php +++ /dev/null @@ -1,161 +0,0 @@ - - */ - - -class development_js -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'development_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "development_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'development_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'development_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - - $this->openqrm = $openqrm; - $this->controller = $controller; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('basedir'); - $this->tpldir = $this->rootdir.'/plugins/development/tpl'; - $this->response = $response; - $this->file = $this->openqrm->file(); - - $plugin = $this->response->html->request()->get('plugin_name'); - $this->response->add('plugin_name', $plugin); - $base = $this->response->html->request()->get('base_name'); - $this->response->add('base_name', $base); - $this->methods = array('api', 'action'); - } - - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - if($this->response->html->request()->get('plugin_name') !== '') { - $name = $this->response->html->request()->get('plugin_name'); - $data['label'] = sprintf($this->lang['label_plugin'], $name); - } - else if ($this->response->html->request()->get('base_name') !== '') { - $name = $this->response->html->request()->get('base_name'); - $data['label'] = sprintf($this->lang['label_base'], $name); - } - $vars = array_merge( - $data, - array( - 'thisfile' => $this->response->html->thisfile, - )); - $t = $this->response->html->template($this->tpldir.'/development-js.tpl.php'); - $t->add($vars); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - - return $this->edit($t); - - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function edit($template) { - if($this->response->html->request()->get('plugin_name') !== '') { - $path = $this->rootdir.'/plugins/'.$this->response->html->request()->get('plugin_name').'/web/js/'; - } - if($this->response->html->request()->get('base_name') !== '') { - if($this->response->html->request()->get('base_name') !== 'plugins') { - $path = $this->rootdir.'/web/base/server/'.$this->response->html->request()->get('base_name').'/js/'; - } - elseif ($this->response->html->request()->get('base_name') === 'plugins') { - $path = $this->rootdir.'/web/base/plugins/aa_plugins/js/'; - } - } - - $files = $this->file->get_files($path, '', '*.js'); - $names = array(); - if(is_array($files)) { - foreach($files as $file) { - if(strripos($file['name'], '.js') !== false) { - $names[] = $file['path']; - } - } - $links = ''; - foreach($names as $path) { - $links .= '

    '.basename($path).'

    '; - $links .= '
    '.$this->file->get_contents($path).'
    '; - } - if($links === '') { - $links = '
    Plugin has no js
    '; - } - $template->add($links, 'links'); - } - $template = $this->controller->__get_navi($template, 'js'); - return $template; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.lang.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/development.lang.class.php deleted file mode 100644 index df2eea5..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.lang.class.php +++ /dev/null @@ -1,338 +0,0 @@ - - */ - - -class development_lang -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'development_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "development_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'development_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'development_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - $this->openqrm = $openqrm; - $this->controller = $controller; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('basedir'); - $this->tpldir = $this->rootdir.'/plugins/development/tpl'; - $this->response = $response; - $this->file = $this->openqrm->file(); - - $plugin = $this->response->html->request()->get('plugin_name'); - $this->response->add('plugin_name', $plugin); - $base = $this->response->html->request()->get('base_name'); - $this->response->add('base_name', $base); - $this->methods = array('api', 'action'); - } - - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - if($this->response->html->request()->get('plugin_name') !== '') { - $name = $this->response->html->request()->get('plugin_name'); - $data['label'] = sprintf($this->lang['label_plugin'], $name); - } - else if ($this->response->html->request()->get('base_name') !== '') { - $name = $this->response->html->request()->get('base_name'); - $data['label'] = sprintf($this->lang['label_base'], $name); - } - $vars = array_merge( - $data, - array( - 'thisfile' => $this->response->html->thisfile, - )); - $t = $this->response->html->template($this->tpldir.'/development-lang.tpl.php'); - $t->add($vars); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - - return $this->edit($t); - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function edit($template) { - - require_once($this->openqrm->get('webdir').'/class/htmlobjects/htmlobject.response.class.php'); - $response = new htmlobject_response($this->response->html, $this->response->id); - $response->html->debug(); - - require_once($this->openqrm->get('basedir').'/plugins/development/web/class/dummyuser.class.php'); - $dummy = new dummyuser('xxx'); - - require_once($this->openqrm->get('basedir').'/web/base/class/openqrm.class.php'); - $oq = new openqrm($this->file, $dummy, $response); - - if($this->response->html->request()->get('plugin_name') !== '') { - $path = $this->rootdir.'/plugins/'.$this->response->html->request()->get('plugin_name').'/web'; - } - - if($this->response->html->request()->get('base_name') !== '') { - if($this->response->html->request()->get('base_name') !== 'plugins') { - $path = $this->rootdir.'/web/base/server/'.$this->response->html->request()->get('base_name'); - } - elseif ($this->response->html->request()->get('base_name') === 'plugins') { - $path = $this->rootdir.'/web/base/plugins/aa_plugins'; - } - } - - $files = $this->file->get_files($path.'/class/'); - $name = array(); - $objs = array(); - if(is_array($files)) { - foreach($files as $file) { - if(strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') === false) { - require_once($file['path']); - $class = str_replace('.class.php', '', $file['name']); - $class = str_replace('.', '_', $class); - $class = str_replace('-', '_', $class); - $class = new $class($oq, $response->response()); - $objs[] = $class; - $name[] = str_replace('.controller.class.php','', $file['name']); - } - } - } - - $content = array(); - $i = 0; - foreach($objs as $obj) { - $content[$i]['name'] = $name[$i]; - $content[$i]['object'] = $obj; - $content[$i]['class'] = get_class($obj); - if(get_class_methods($obj)) { - $content[$i]['methods'] = get_class_methods($obj); - } else { - $content[$i]['methods'] = ''; - } - $content[$i]['vars'] = get_class_vars(get_class($obj)); - $i++; - } - - $controller = ''; - if(count($content) > 0) { - $files = $this->file->get_files($path.'/lang'); - foreach($content as $con) { - if(isset($con['object']->lang)) { - $controller .= '
    Controller: '.$con['class'].'
    '; - $lfiles = array(); - foreach($files as $file) { - if(strpos($file['name'], '.'.$con['name'].'.') !== false) { - $lang = substr($file['name'], 0, strpos($file['name'], '.')); - $lfiles[$lang] = $file['path']; - } - } - $msg = array(); - foreach($lfiles as $lang => $file) { - $error = array(); - $ini = $this->file->get_ini($file); - foreach($con['object']->lang as $k => $v) { - if(is_array($v)) { - foreach($v as $key => $value) { - if(isset($ini[$k]) && !array_key_exists($key, $ini[$k])) { - $error['file'] = basename($file); - $error['missing'][$k][$key] = ''; - } - else if(!isset($ini[$k])) { - $error['file'] = basename($file); - $error['missing'][$k][$key] = ''; - } else { - unset($ini[$k][$key]); - } - } - } else { - if(!array_key_exists($k, $ini)) { - $error['file'] = basename($file); - $error['missing'][$k] = ''; - } else { - unset($ini[$k]); - } - } - if(isset($ini[$k]) && count($ini[$k]) < 1) { - unset($ini[$k]); - } - } - if(count($ini) < 1) { - unset($ini); - } else { - foreach($ini as $i => $x) { - $error['file'] = basename($file); - if(!is_array($x)) { - $error['supernumerous'][$i] = ''; - } else { - if(count($x) > 0) { - foreach($x as $xx => $vv) { - $error['supernumerous'][$i][$xx] = ''; - } - } else { - $error['supernumerous'][$i] = ''; - } - } - } - } - - $download = $this->response->html->a(); - $download->label = 'download'; - $download->href = $this->response->get_url($this->actions_name, 'download').'&file=lang/'.basename($file).'&mime=text/plain'; - $download->target = '_blank'; - $download->style = 'vertical-align:top;text-decoration:none;'; - - // check errors - if(count($error) < 1) { - $msg[] = '
    '.$lang.' passed '.$download->get_string().'
    '; - } else { - // cache output - ob_start(); - $response->html->help($error); - $messages = trim(ob_get_contents()); - // end cache - ob_end_clean(); - if($messages !== '') { - $txt = '
    '.$lang.' failed '.$download->get_string().'
    '; - $txt .= '
    ';
    -								$txt .= $messages;
    -								$txt .= '
    '; - $msg[] = $txt; - } - } - } - - // handle message - if(count($msg) > 0) { - $controller .= '
    '; - $controller .= implode('', $msg); - $controller .= '
    '; - } - } - } - } else { - $oop = false; - foreach($files as $file) { - if(strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') !== false) { - $oop = true; - $controller = '
    Plugin '.$this->response->html->request()->get('plugin_name').' is about controller only
    '; - break; - } - } - if($oop === false) { - $controller = '
    Plugin '.$this->response->html->request()->get('plugin_name').' is not OOP
    '; - } - } - - $template->add($controller, 'controllers'); - - // handle php errors - $phpinfo = ''; - if($this->response->html->request()->get('debug') !== '' ) { - if(isset($GLOBALS['error_php']) && count($GLOBALS['error_php']) > 0) { - $phpinfo .= implode('', $GLOBALS['error_php']); - } - } - if($phpinfo !== '') { - $phpinfo = '
    '.$phpinfo.'
    '; - } else { - $phpinfo = ' '; - } - $template->add($phpinfo, 'phpinfo'); - $template = $this->controller->__get_navi($template, 'lang'); - return $template; - } - - - //-------------------------------------------- - /** - * Translate - * - * @access public - * @param array $text_array array to translate - * @param string $dir dir of translation files - * @param string $file translation file - * @return array - */ - //-------------------------------------------- - function translate( $text_array, $dir, $file ) { - $user_language = $this->lang; - $path = $dir.'/'.$user_language.'.'.$file; - if(file_exists($path)) { - $tmp = parse_ini_file( $path, true ); - foreach($tmp as $k => $v) { - if(is_array($v)) { - foreach($v as $k2 => $v2) { - $text_array[$k][$k2] = $v2; - } - } else { - $text_array[$k] = $v; - } - } - } - return $text_array; - } -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.rest.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/development.rest.class.php deleted file mode 100644 index f2ebbd1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.rest.class.php +++ /dev/null @@ -1,463 +0,0 @@ - - */ - - -class development_rest -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'development_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "development_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'development_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'development_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - - $this->openqrm = $openqrm; - $this->controller = $controller; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('basedir'); - $this->tpldir = $this->rootdir.'/plugins/development/tpl'; - $this->response = $response; - $this->file = $this->openqrm->file(); - - $plugin = $this->response->html->request()->get('plugin_name'); - $this->response->add('plugin_name', $plugin); - $base = $this->response->html->request()->get('base_name'); - $this->response->add('base_name', $base); - $this->methods = array('api', 'action'); - } - - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - if($this->response->html->request()->get('plugin_name') !== '') { - $name = $this->response->html->request()->get('plugin_name'); - $data['label'] = sprintf($this->lang['label_plugin'], $name); - } - else if ($this->response->html->request()->get('base_name') !== '') { - $name = $this->response->html->request()->get('base_name'); - $data['label'] = sprintf($this->lang['label_base'], $name); - } - $vars = array_merge( - $data, - array( - 'thisfile' => $this->response->html->thisfile, - )); - $t = $this->response->html->template($this->tpldir.'/development-rest.tpl.php'); - $t->add($vars); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - - return $this->edit($t); - - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function edit($template) { - - // cache output - ob_start(); - - require_once($this->openqrm->get('webdir').'/class/htmlobjects/htmlobject.response.class.php'); - $response = new htmlobject_response($this->response->html, $this->response->id); - $response->html->debug(); - - require_once($this->openqrm->get('basedir').'/plugins/development/web/class/dummyuser.class.php'); - $dummy = new dummyuser('xxx'); - - require_once($this->openqrm->get('basedir').'/web/base/class/openqrm.class.php'); - $oq = new openqrm($this->file, $dummy, $response); - - - - if($this->response->html->request()->get('plugin_name') !== '') { - $path = $this->rootdir.'/plugins/'.$this->response->html->request()->get('plugin_name').'/web/class/'; - } - if($this->response->html->request()->get('base_name') !== '') { - if($this->response->html->request()->get('base_name') !== 'plugins') { - $path = $this->rootdir.'/web/base/server/'.$this->response->html->request()->get('base_name').'/class/'; - } - elseif ($this->response->html->request()->get('base_name') === 'plugins') { - $path = $this->rootdir.'/web/base/plugins/aa_plugins/class/'; - } - } - - $files = $this->file->get_files($path); - $name = array(); - $objs = array(); - if(is_array($files)) { - foreach($files as $file) { - if(strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') === false) { - require_once($file['path']); - $class = str_replace('.class.php', '', $file['name']); - $class = str_replace('.', '_', $class); - $class = str_replace('-', '_', $class); - $class = new $class($oq, $response->response()); - $objs[] = $class; - $name[] = str_replace('.controller.class.php','', $file['name']); - } - } - } - - $content = array(); - $i = 0; - foreach($objs as $obj) { - $content[$i]['name'] = $name[$i]; - $content[$i]['object'] = $obj; - $content[$i]['class'] = get_class($obj); - if(get_class_methods($obj)) { - $content[$i]['methods'] = get_class_methods($obj); - } else { - $content[$i]['methods'] = ''; - } - $content[$i]['vars'] = get_class_vars(get_class($obj)); - $i++; - } - - $legend = ''; - if($this->response->html->request()->get('plugin_name') !== '') { - $controllers = '
    plugin='.$this->response->html->request()->get('plugin_name').'
    '; - } - else if($this->response->html->request()->get('base_name') !== '') { - $controllers = '
    base='.$this->response->html->request()->get('base_name').'
    '; - } - if(count($content) > 0) { - - $legend = '
    '; - $legend .= '
     
    = Plugin
    '; - $legend .= '
     
    = Controller
    '; - $legend .= '
     
    = Action
    '; - $legend .= '
    '; - $legend .= 'Params'; - $legend .= '
    param = '.$this->lang['param_must_be_set_within_action'].'
    '; - $legend .= '
    param = '.$this->lang['param_optional'].'
    '; - $legend .= '
    param = '.$this->lang['param_form_field'].'
    '; - $legend .= '
    param * = '.$this->lang['param_required'].'
    '; - $legend .= '
    param (...) = '.$this->lang['param_validator'].'
    '; - $legend .= '
    '; - $legend .= '
    '; - - foreach($content as $con) { - $controllers .= '
    '; - foreach($con as $k => $v) { - if($k === 'name') { - $controllers .= '
    controller='.$v.'
    '; - // check vars - $this->__check_controller_vars($con); - } - if($k === 'methods') { - if(is_array($v)) { - $controllers .= '
    '; - $i = 0; - foreach($v as $value) { - $css = ''; - if(!in_array($value, $this->methods) && strpos($value, '__') === false && stripos($value, 'reload') === false) { - // handle duplicate - if($value === 'duplicate') { $value = 'clone'; } - $file = $con['name'].'.'.str_replace('_', '-', $value).'.class.php'; - if($this->file->exists($path.$file)) { -$url = array(); - $css = 'action'; - if($i === 0) { $i++; $css = 'action first'; } - $controllers .= '
    '.$con['vars']['actions_name'].'='. $value.''; - -$url[] = $con['vars']['actions_name'].'='. $value; - - require_once($path.$file); - $class = str_replace('.class.php', '', $file); - $class = str_replace('.', '_', $class); - $class = str_replace('-', '_', $class); - $class = new $class($oq, $con['object']->response->response(), $con['object']); - // check vars - $this->__check_action_vars($class, $con, $value); - // check lang - if(isset($con['object']->lang[$value])) { - $class->lang = $con['object']->lang[$value]; - } else { - $class->lang = $con['object']->lang; - } - $x = new ReflectionObject($class); - if($x->hasMethod('get_response')) { - $params = $x->getMethod('get_response')->getParameters(); - $res = $class->get_response(); - if(isset($res->form)) { - $str = ''; - $elem = $res->form->get_elements(); - if(is_array($elem) && count($elem) > 0) { - foreach($elem as $key => $e) { - if($e instanceof htmlobject_box) { - // check elements name - if(isset($e->__elements[0]->name) && $e->__elements[0]->name !== '') { - $required = ''; - if(isset($res->form->__data[$key]['required'])) { - $required = ' *'; - } - $regex = ''; - if(isset($res->form->__data[$key]['validate']['regex'])) { - $regex = ' ('.$res->form->__data[$key]['validate']['regex'].')'; - } - $str .= ''.$e->__elements[0]->name.$required.$regex.''; - $url[] = $e->__elements[0]->name.'=..'; - } - } else { - if(isset($e->name) && $e->name !== $con['vars']['actions_name']) { - if($key !== 'submit' && $key !== 'cancel') { - $str .= ''.$e->name.''; - $url[] = $e->name.'=..'; - } else { - $str .= ''.$e->name.''; - if($key !== 'cancel') { - $url[] = $e->name.'=submit'; - } - } - } - } - } - if($str !== '') { - $controllers .= '
    Params'; - $controllers .= $str; - $controllers .= '
    '; - if($this->response->html->request()->get('plugin_name') !== '') { - $p = $this->response->html->request()->get('plugin_name'); - $tag = 'plugin'; - } - else if($this->response->html->request()->get('base_name') !== '') { - $p = $this->response->html->request()->get('base_name'); - $tag = 'base'; - } - $controllers .= ''; - } - } - } - } else { - $elem = ''; - if(isset($class->response->params)) { - $elem = $class->response->params; - } - if(is_array($elem) && count($elem) > 0) { - $str = ''; - foreach($elem as $key => $e) { - $str .= ''.$key.''; - } - if($str !== '') { - $controllers .= '
    Params'; - $controllers .= $str; - $controllers .= '
    '; - } - } - } - $controllers .= '
    '; - } else { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missing file '.$file.' for action '.$value.'
    '; - } - } - - } - $controllers .= '
    '; - } - } - } - $controllers .= '
    '; - } - $controllers .= '
    '; - } else { - $oop = false; - foreach($files as $file) { - if(strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') !== false) { - $oop = true; - $controllers = '
    Plugin '.$this->response->html->request()->get('plugin_name').' is about controller only
    '; - break; - } - } - if($oop === false) { - $controllers = '
    Plugin '.$this->response->html->request()->get('plugin_name').' is not OOP
    '; - } - } - - - $template->add($controllers, 'controllers'); - $template->add($legend, 'legend'); - - // handle errors - $phpinfo = ''; - if($this->response->html->request()->get('debug') !== '' ) { - if(isset($GLOBALS['error_controller']) && count($GLOBALS['error_controller']) > 0) { - $phpinfo .= implode('', $GLOBALS['error_controller']); - } - if(isset($GLOBALS['error_action']) && count($GLOBALS['error_action']) > 0) { - $phpinfo .= implode('', $GLOBALS['error_action']); - } - if(isset($GLOBALS['error_php']) && count($GLOBALS['error_php']) > 0) { - $phpinfo .= implode('', $GLOBALS['error_php']); - } - $messages = trim(ob_get_contents()); - if($messages !== '') { - $phpinfo .= 'HTMLOBJECTS DEBUG:
    '.$messages; - } - } - - // end cache - ob_end_clean(); - - if($phpinfo !== '') { - $phpinfo = '
    '.$phpinfo.'
    '; - } else { - $phpinfo = ' '; - } - $template->add($phpinfo, 'phpinfo'); - $template = $this->controller->__get_navi($template, 'rest'); - - - // event cleanup, some methods creating events if constructed without parameters - $event = new event(); - $event->remove_by_description('Could not create instance of'); - return $template; - } - - //-------------------------------------------- - /** - * Check vars for controller - * - * @access private - * @param object $con (controller) - */ - //-------------------------------------------- - function __check_controller_vars($con) { - $text = 'CONTROLLER_ERROR: missing property '; - // actions_name - if(!array_key_exists('actions_name', $con['vars'])) { - $GLOBALS['error_controller'][] = '
    '.$text.'actions_name for '.$con['class'].'
    '; - } - // message_param - if(!array_key_exists('message_param', $con['vars'])) { - $GLOBALS['error_controller'][] = '
    '.$text.'message_param for '.$con['class'].'
    '; - } - // prefix_tab - if(!array_key_exists('prefix_tab', $con['vars'])) { - $GLOBALS['error_controller'][] = '
    '.$text.'prefix_tab for '.$con['class'].'
    '; - } - // identifier_name - if(!array_key_exists('identifier_name', $con['vars'])) { - $GLOBALS['error_controller'][] = '
    '.$text.' identifier_name for '.$con['class'].'
    '; - } - // lang - if(!array_key_exists('lang', $con['vars'])) { - $GLOBALS['error_controller'][] = '
    '.$text.'lang for '.$con['class'].'
    '; - } - } - - //-------------------------------------------- - /** - * Check vars for action - * - * @access private - * @param object $class (current class) - * @param object $con (controller) - * @param string $value (action) - */ - //-------------------------------------------- - function __check_action_vars($class, $con, $value) { - // actions_name - if(!property_exists($class, 'actions_name')) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missing property actions_name for action '.$value.' in class '.get_class($class).'
    '; - } else { - if(isset($class->actions_name) && $class->actions_name !== $con['object']->actions_name) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missmatching property actions_name for action '.$value.' (action:'.$class->actions_name.' -> controller:'.$con['object']->actions_name.')
    '; - } - } - // message_param - if(!property_exists($class, 'message_param')) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missing property message_param for action '.$value.' in class '.get_class($class).'
    '; - } else { - if(isset($class->message_param) && $class->message_param !== $con['object']->message_param) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missmatching property message_param for action '.$value.' (action:'.$class->message_param.' -> controller:'.$con['object']->message_param.')
    '; - } - } - // prefix_tab - if(!property_exists($class, 'prefix_tab')) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missing property prefix_tab for action '.$value.' in class '.get_class($class).'
    '; - } else { - if(isset($class->prefix_tab) && $class->prefix_tab !== $con['object']->prefix_tab) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missmatching property prefix_tab for action '.$value.' (action:'.$class->prefix_tab.' -> controller:'.$con['object']->prefix_tab.')
    '; - } - } - // identifier_name - if(!property_exists($class, 'identifier_name')) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missing property identifier_name for action '.$value.' in class '.get_class($class).'
    '; - } else { - if(isset($class->identifier_name) && $class->identifier_name !== $con['object']->identifier_name) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missmatching property identifier_name for action '.$value.' (action:'.$class->identifier_name.' -> controller:'.$con['object']->identifier_name.')
    '; - } - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.select.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/development.select.class.php deleted file mode 100644 index e734ac4..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.select.class.php +++ /dev/null @@ -1,349 +0,0 @@ - - */ - -class development_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'development_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "development_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'development_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'development_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->tpldir = $this->rootdir.'/plugins/development/tpl'; - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $response = $this->select(); - $t = $this->response->html->template($this->tpldir.'/development-select.tpl.php'); - $t->add($response->table_plugins, 'table_plugins'); - $t->add($response->table_base, 'table_base'); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function select() { - $response = $this->response; - - $h['plugin']['title'] = $this->lang['id']; - $h['plugin']['sortable'] = true; - - $h['docblock']['title'] = ' '; - $h['docblock']['sortable'] = false; - - $h['lang']['title'] = ' '; - $h['lang']['sortable'] = false; - - $h['edit']['title'] = ' '; - $h['edit']['sortable'] = false; - - $h['api']['title'] = ' '; - $h['api']['sortable'] = false; - - $h['hooks']['title'] = ' '; - $h['hooks']['sortable'] = false; - - $h['template']['title'] = ' '; - $h['template']['sortable'] = false; - - $h['css']['title'] = ' '; - $h['css']['sortable'] = false; - - $h['js']['title'] = ' '; - $h['js']['sortable'] = false; - - // plugins - $plugin = new plugin(); - $result = $plugin->available(); - $b = array(); - if(is_array($result)) { - foreach($result as $v) { - $tmp['plugin'] = $v; - $tmp['docblock'] = ' '; - $tmp['edit'] = ' '; - $tmp['api'] = ' '; - $tmp['lang'] = ' '; - $tmp['template'] = ' '; - $tmp['hooks'] = ' '; - $path = $this->openqrm->get('basedir').'/plugins/'.$v.'/web/class/'; - $files = $this->file->get_files($path); - $oop = false; - foreach($files as $file) { - if(strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') === false) { - $oop = true; - break; - } - } - if($oop === true) { - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'docblock' ).'&plugin_name='.$v; - $a->label = $this->lang['action_docblock']; - $a->title = $this->lang['action_docblock']; - $a->handler = 'onclick="wait();"'; - $tmp['docblock'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'lang' ).'&plugin_name='.$v; - $a->label = $this->lang['action_lang']; - $a->title = $this->lang['action_lang']; - $a->handler = 'onclick="wait();"'; - $tmp['lang'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'rest' ).'&plugin_name='.$v; - $a->label = $this->lang['action_rest']; - $a->title = $this->lang['action_rest']; - $a->handler = 'onclick="wait();"'; - $tmp['edit'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'api' ).'&plugin_name='.$v; - $a->label = $this->lang['action_api']; - $a->title = $this->lang['action_api']; - $a->handler = 'onclick="wait();"'; - $tmp['api'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'template' ).'&plugin_name='.$v; - $a->label = $this->lang['action_template']; - $a->title = $this->lang['action_template']; - $a->handler = 'onclick="wait();"'; - $tmp['template'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'hooks' ).'&plugin_name='.$v; - $a->label = $this->lang['action_hooks']; - $a->title = $this->lang['action_hooks']; - $a->handler = 'onclick="wait();"'; - $tmp['hooks'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'js' ).'&plugin_name='.$v; - $a->label = $this->lang['action_js']; - $a->title = $this->lang['action_js']; - $a->handler = 'onclick="wait();"'; - $tmp['js'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'css' ).'&plugin_name='.$v; - $a->label = $this->lang['action_css']; - $a->title = $this->lang['action_css']; - $a->handler = 'onclick="wait();"'; - $tmp['css'] = $a->get_string(); - } - $b[] = $tmp; - } - } - - - $table = $this->response->html->tablebuilder('plugins', $this->response->get_array($this->actions_name, 'select')); - $table->offset = 0; - $table->sort = 'plugin'; - $table->limit = 0; - $table->order = 'ASC'; - $table->max = count($b); - $table->css = 'htmlobject_table'; - $table->border = 0; - $table->id = 'Tabelle_1'; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $b; - $table->sort_params = $response->get_string( $this->actions_name, 'select' ); - $table->sort_form = false; - $table->sort_link = false; - $table->autosort = true; - - $response->table_plugins = $table; - - // base - $result = array('aa_server','appliance', 'event', 'image','kernel','resource','storage', 'plugins'); - $b = array(); - if(is_array($result)) { - foreach($result as $v) { - $tmp['plugin'] = $v; - $tmp['docblock'] = ' '; - $tmp['edit'] = ' '; - $tmp['api'] = ' '; - $tmp['lang'] = ' '; - $tmp['template'] = ' '; - $tmp['hooks'] = ' '; - if($v !== 'plugins') { - $path = $this->openqrm->get('basedir').'/web/base/server/'.$v.'/class/'; - } - elseif ($v === 'plugins') { - $path = $this->openqrm->get('basedir').'/web/base/plugins/aa_plugins/class/'; - } - $files = $this->file->get_files($path); - $oop = false; - foreach($files as $file) { - if(strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') === false) { - $oop = true; - break; - } - } - if($oop === true) { - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'docblock' ).'&base_name='.$v; - $a->label = $this->lang['action_docblock']; - $a->title = $this->lang['action_docblock']; - $a->handler = 'onclick="wait();"'; - $tmp['docblock'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'lang' ).'&base_name='.$v; - $a->label = $this->lang['action_lang']; - $a->title = $this->lang['action_lang']; - $a->handler = 'onclick="wait();"'; - $tmp['lang'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'rest' ).'&base_name='.$v; - $a->label = $this->lang['action_rest']; - $a->title = $this->lang['action_rest']; - $a->handler = 'onclick="wait();"'; - $tmp['edit'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'api' ).'&base_name='.$v; - $a->label = $this->lang['action_api']; - $a->title = $this->lang['action_api']; - $a->handler = 'onclick="wait();"'; - $tmp['api'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'template' ).'&base_name='.$v; - $a->label = $this->lang['action_template']; - $a->title = $this->lang['action_template']; - $a->handler = 'onclick="wait();"'; - $tmp['template'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'hooks' ).'&base_name='.$v; - $a->label = $this->lang['action_hooks']; - $a->title = $this->lang['action_hooks']; - $a->handler = 'onclick="wait();"'; - $tmp['hooks'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'js' ).'&base_name='.$v; - $a->label = $this->lang['action_js']; - $a->title = $this->lang['action_js']; - $a->handler = 'onclick="wait();"'; - $tmp['js'] = $a->get_string(); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'css' ).'&base_name='.$v; - $a->label = $this->lang['action_css']; - $a->title = $this->lang['action_css']; - $a->handler = 'onclick="wait();"'; - $tmp['css'] = $a->get_string(); - } - $b[] = $tmp; - } - } - - $table = $this->response->html->tablebuilder('base', $this->response->get_array($this->actions_name, 'select')); - $table->offset = 0; - $table->sort = 'plugin'; - $table->limit = 0; - $table->order = 'ASC'; - $table->max = count($b); - $table->css = 'htmlobject_table'; - $table->border = 0; - $table->id = 'Tabelle_2'; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $b; - $table->sort_params = $response->get_string( $this->actions_name, 'select' ); - $table->sort_form = false; - $table->sort_link = false; - $table->autosort = true; - - $response->table_base = $table; - - - return $response; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.template.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/development.template.class.php deleted file mode 100644 index c5a1be8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/development.template.class.php +++ /dev/null @@ -1,509 +0,0 @@ - - */ - - -class development_template -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'development_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "development_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'development_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'development_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - - $this->openqrm = $openqrm; - $this->controller = $controller; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('basedir'); - $this->tpldir = $this->rootdir.'/plugins/development/tpl'; - $this->response = $response; - $this->file = $this->openqrm->file(); - - $plugin = $this->response->html->request()->get('plugin_name'); - $this->response->add('plugin_name', $plugin); - $base = $this->response->html->request()->get('base_name'); - $this->response->add('base_name', $base); - $this->methods = array('api', 'action'); - } - - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - if($this->response->html->request()->get('plugin_name') !== '') { - $name = $this->response->html->request()->get('plugin_name'); - $data['label'] = sprintf($this->lang['label_plugin'], $name); - } - else if ($this->response->html->request()->get('base_name') !== '') { - $name = $this->response->html->request()->get('base_name'); - $data['label'] = sprintf($this->lang['label_base'], $name); - } - $vars = array_merge( - $data, - array( - 'thisfile' => $this->response->html->thisfile, - )); - $t = $this->response->html->template($this->tpldir.'/development-template.tpl.php'); - $t->add($vars); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - - return $this->edit($t); - - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function edit($template) { - - // cache output - ob_start(); - - require_once($this->openqrm->get('webdir').'/class/htmlobjects/htmlobject.response.class.php'); - $response = new htmlobject_response($this->response->html, $this->response->id); - $response->html->debug(); - - require_once($this->openqrm->get('basedir').'/plugins/development/web/class/dummyuser.class.php'); - $dummy = new dummyuser('xxx'); - - require_once($this->openqrm->get('basedir').'/web/base/class/openqrm.class.php'); - $oq = new openqrm($this->file, $dummy, $response); - - - - if($this->response->html->request()->get('plugin_name') !== '') { - $path = $this->rootdir.'/plugins/'.$this->response->html->request()->get('plugin_name').'/web/class/'; - } - if($this->response->html->request()->get('base_name') !== '') { - if($this->response->html->request()->get('base_name') !== 'plugins') { - $path = $this->rootdir.'/web/base/server/'.$this->response->html->request()->get('base_name').'/class/'; - } - elseif ($this->response->html->request()->get('base_name') === 'plugins') { - $path = $this->rootdir.'/web/base/plugins/aa_plugins/class/'; - } - } - - $files = $this->file->get_files($path); - $name = array(); - $objs = array(); - if(is_array($files)) { - foreach($files as $file) { - if(strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') === false) { - require_once($file['path']); - $class = str_replace('.class.php', '', $file['name']); - $class = str_replace('.', '_', $class); - $class = str_replace('-', '_', $class); - $class = new $class($oq, $response->response()); - $objs[] = $class; - $name[] = str_replace('.controller.class.php','', $file['name']); - } - } - } - - $content = array(); - $i = 0; - foreach($objs as $obj) { - $content[$i]['name'] = $name[$i]; - $content[$i]['object'] = $obj; - $content[$i]['class'] = get_class($obj); - if(get_class_methods($obj)) { - $content[$i]['methods'] = get_class_methods($obj); - } else { - $content[$i]['methods'] = ''; - } - $content[$i]['vars'] = get_class_vars(get_class($obj)); - $i++; - } - - if($this->response->html->request()->get('plugin_name') !== '') { - $controllers = '
    plugin='.$this->response->html->request()->get('plugin_name').'
    '; - } - else if($this->response->html->request()->get('base_name') !== '') { - $controllers = '
    base='.$this->response->html->request()->get('base_name').'
    '; - } - - $legend = ''; - if(count($content) > 0) { - - $tpldir = dirname($path).'/tpl/'; - $files = $this->file->get_files($tpldir); - - $legend = '
    '; - $legend .= '
     
    = Plugin
    '; - $legend .= '
     
    = Controller
    '; - $legend .= '
     
    = Action
    '; - $legend .= '
    '; - - foreach($content as $con) { - $controllers .= '
    '; - foreach($con as $k => $v) { - if($k === 'name') { - $controllers .= '
    controller='.$v.'
    '; - } - if($k === 'methods') { - if(is_array($v)) { - $controllers .= '
    '; - $i = 0; - foreach($v as $value) { - $css = ''; - if(!in_array($value, $this->methods) && strpos($value, '__') === false && stripos($value, 'reload') === false) { - // handle duplicate - if($value === 'duplicate') { $value = 'clone'; } - $file = $con['name'].'.'.str_replace('_', '-', $value).'.class.php'; - if($this->file->exists($path.$file)) { - - $css = 'action'; - if($i === 0) { $i++; $css = 'action first'; } - $controllers .= '
    '. $value.'
    '; - - require_once($path.$file); - $class = str_replace('.class.php', '', $file); - $class = str_replace('.', '_', $class); - $class = str_replace('-', '_', $class); - -$tpl = str_replace('_', '-', $class).'.tpl.php'; -if(!$this->file->exists($tpldir.$tpl)) { - $tpl = '
    ERROR: missing template '.$tpl.'
    '; -} else { - foreach($files as $key => $file) { - if($file['name'] === $tpl) { - unset($files[$key]); - } - } - $tpl = '
    PASSED: found template '.$tpl.'
    '; -} -$controllers .= $tpl; - - - -/* - - $class = new $class($oq, $con['object']->response->response(), $con['object']); - $class->tpldir = dirname($path).'/tpl/'; - // check vars - #$this->__check_action_vars($class, $con, $value); - // check lang - if(isset($con['object']->lang[$value])) { - $class->lang = $con['object']->lang[$value]; - } else { - $class->lang = $con['object']->lang; - } - - $x = new ReflectionObject($class); - if($x->hasMethod('action')) { - - - $controllers .= $class->action()->get_string(); - - - - if($str !== '') { - $controllers .= '
    Params'; - $controllers .= $str; - $controllers .= '
    '; - if($this->response->html->request()->get('plugin_name') !== '') { - $p = $this->response->html->request()->get('plugin_name'); - $tag = 'plugin'; - } - else if($this->response->html->request()->get('base_name') !== '') { - $p = $this->response->html->request()->get('base_name'); - $tag = 'base'; - } - $controllers .= ''; - } - - - $params = $x->getMethod('get_response')->getParameters(); - $res = $class->get_response(); - if(isset($res->form)) { - $str = ''; - $elem = $res->form->get_elements(); - if(is_array($elem) && count($elem) > 0) { - foreach($elem as $key => $e) { - if($e instanceof htmlobject_box) { - // check elements name - if(isset($e->__elements[0]->name) && $e->__elements[0]->name !== '') { - $required = ''; - if(isset($res->form->__data[$key]['required'])) { - $required = ' *'; - } - $regex = ''; - if(isset($res->form->__data[$key]['validate']['regex'])) { - $regex = ' ('.$res->form->__data[$key]['validate']['regex'].')'; - } - $str .= ''.$e->__elements[0]->name.$required.$regex.''; - $url[] = $e->__elements[0]->name.'=..'; - } - } else { - if(isset($e->name) && $e->name !== $con['vars']['actions_name']) { - if($key !== 'submit' && $key !== 'cancel') { - $str .= ''.$e->name.''; - $url[] = $e->name.'=..'; - } else { - $str .= ''.$e->name.''; - if($key !== 'cancel') { - $url[] = $e->name.'=submit'; - } - } - } - } - } - if($str !== '') { - $controllers .= '
    Params'; - $controllers .= $str; - $controllers .= '
    '; - if($this->response->html->request()->get('plugin_name') !== '') { - $p = $this->response->html->request()->get('plugin_name'); - $tag = 'plugin'; - } - else if($this->response->html->request()->get('base_name') !== '') { - $p = $this->response->html->request()->get('base_name'); - $tag = 'base'; - } - $controllers .= ''; - } - } - } - } else { - $elem = $class->response->params; - if(is_array($elem) && count($elem) > 0) { - $str = ''; - foreach($elem as $key => $e) { - $str .= ''.$key.''; - } - if($str !== '') { - $controllers .= '
    Params'; - $controllers .= $str; - $controllers .= '
    '; - } - } - } -*/ - - - $controllers .= '
    '; - } else { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missing file '.$file.' for action '.$value.'
    '; - } - } - - } - $controllers .= '
    '; - } - } - } - $controllers .= '
    '; - } - -// supernumerous files -foreach($files as $file) { - if(strripos($file['name'], 'about') === false) { - $GLOBALS['error_action'][] = '
    TEMPLATE_NOTICE: Found supernumerous file '. $file['name'].'
    '; - } -} - - - $controllers .= '
    '; - } else { - $oop = false; - foreach($files as $file) { - if(strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') !== false) { - $oop = true; - $controllers = '
    Plugin '.$this->response->html->request()->get('plugin_name').' is about controller only
    '; - break; - } - } - if($oop === false) { - $controllers = '
    Plugin '.$this->response->html->request()->get('plugin_name').' is not OOP
    '; - } - } - - - $template->add($controllers, 'controllers'); - $template->add($legend, 'legend'); - - // handle errors - $phpinfo = ''; - - - if($this->response->html->request()->get('debug') !== '' ) { - if(isset($GLOBALS['error_controller']) && count($GLOBALS['error_controller']) > 0) { - $phpinfo .= implode('', $GLOBALS['error_controller']); - } - if(isset($GLOBALS['error_action']) && count($GLOBALS['error_action']) > 0) { - $phpinfo .= implode('', $GLOBALS['error_action']); - } - if(isset($GLOBALS['error_php']) && count($GLOBALS['error_php']) > 0) { - $phpinfo .= implode('', $GLOBALS['error_php']); - } - $messages = trim(ob_get_contents()); - if($messages !== '') { - $phpinfo .= 'HTMLOBJECTS DEBUG:
    '.$messages; - } - } - - - // end cache - ob_end_clean(); - - if($phpinfo !== '') { - $phpinfo = '
    '.$phpinfo.'
    '; - } else { - $phpinfo = ' '; - } - $template->add($phpinfo, 'phpinfo'); - $template = $this->controller->__get_navi($template, 'template'); - - - // event cleanup, some methods creating events if constructed without parameters - $event = new event(); - $event->remove_by_description('Could not create instance of'); - return $template; - } - - //-------------------------------------------- - /** - * Check vars for controller - * - * @access private - * @param object $con (controller) - */ - //-------------------------------------------- - function __check_controller_vars($con) { - $text = 'CONTROLLER_ERROR: missing property '; - // actions_name - if(!array_key_exists('actions_name', $con['vars'])) { - $GLOBALS['error_controller'][] = '
    '.$text.'actions_name for '.$con['class'].'
    '; - } - // message_param - if(!array_key_exists('message_param', $con['vars'])) { - $GLOBALS['error_controller'][] = '
    '.$text.'message_param for '.$con['class'].'
    '; - } - // prefix_tab - if(!array_key_exists('prefix_tab', $con['vars'])) { - $GLOBALS['error_controller'][] = '
    '.$text.'prefix_tab for '.$con['class'].'
    '; - } - // identifier_name - if(!array_key_exists('identifier_name', $con['vars'])) { - $GLOBALS['error_controller'][] = '
    '.$text.' identifier_name for '.$con['class'].'
    '; - } - // lang - if(!array_key_exists('lang', $con['vars'])) { - $GLOBALS['error_controller'][] = '
    '.$text.'lang for '.$con['class'].'
    '; - } - } - - //-------------------------------------------- - /** - * Check vars for action - * - * @access private - * @param object $class (current class) - * @param object $con (controller) - * @param string $value (action) - */ - //-------------------------------------------- - function __check_action_vars($class, $con, $value) { - // actions_name - if(!property_exists($class, 'actions_name')) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missing property actions_name for action '.$value.' in class '.get_class($class).'
    '; - } else { - if(isset($class->actions_name) && $class->actions_name !== $con['object']->actions_name) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missmatching property actions_name for action '.$value.' (action:'.$class->actions_name.' -> controller:'.$con['object']->actions_name.')
    '; - } - } - // message_param - if(!property_exists($class, 'message_param')) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missing property message_param for action '.$value.' in class '.get_class($class).'
    '; - } else { - if(isset($class->message_param) && $class->message_param !== $con['object']->message_param) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missmatching property message_param for action '.$value.' (action:'.$class->message_param.' -> controller:'.$con['object']->message_param.')
    '; - } - } - // prefix_tab - if(!property_exists($class, 'prefix_tab')) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missing property prefix_tab for action '.$value.' in class '.get_class($class).'
    '; - } else { - if(isset($class->prefix_tab) && $class->prefix_tab !== $con['object']->prefix_tab) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missmatching property prefix_tab for action '.$value.' (action:'.$class->prefix_tab.' -> controller:'.$con['object']->prefix_tab.')
    '; - } - } - // identifier_name - if(!property_exists($class, 'identifier_name')) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missing property identifier_name for action '.$value.' in class '.get_class($class).'
    '; - } else { - if(isset($class->identifier_name) && $class->identifier_name !== $con['object']->identifier_name) { - $GLOBALS['error_action'][] = '
    ACTION_ERROR: missmatching property identifier_name for action '.$value.' (action:'.$class->identifier_name.' -> controller:'.$con['object']->identifier_name.')
    '; - } - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/docblock.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/docblock.class.php deleted file mode 100644 index 9b4c0b6..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/docblock.class.php +++ /dev/null @@ -1,163 +0,0 @@ - - */ - - -class docblock -{ - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param file $classfile - */ - //-------------------------------------------- - function __construct($classfile) { - $this->path = realpath($classfile); - $content = file_get_contents($this->path); - $content = str_replace("\r\n", "\n", $content); - $this->content = $content; - ini_set('pcre.backtrack_limit', 10000000); - } - - //-------------------------------------------- - /** - * Get content - * - * @access public - * @return array - */ - //-------------------------------------------- - function get() { - $ar = array(); - $ar['filename'] = basename($this->path); - $ar['classname'] = $this->__regex('~[\\n| |\\t]+class[ ]+([^ |\\n]*)~i', false); - $ar['extends'] = $this->__regex('~extends ([^\\n{ ]*)~i', false); - $ar['implements'] = $this->__regex('~implements ([^\\n{]*)~i', false); - $ar['docblock'] = $this->__docblock('class[ ]+'.$ar['classname'], false); - $ar['attribs'] = $this->__attribs(); - $ar['methods'] = $this->__regex('~[\\n| |\\t]+function[ ]+([^\(| ]*).*~i'); - - if(is_array($ar['methods'])) { - foreach($ar['methods'] as $key => $value) { - $params = $this->__regex('~function[ ]+'.$key.'[ ]*\((.+)\)~i', false); - $ar['methods'][$key]['params'] = trim(htmlentities($params)); - $ar['methods'][$key]['docblock'] = $this->__docblock('function[ ]+'.$key.'[ ]*\('); - } - } - - return $ar; - } - - //-------------------------------------------- - /** - * Docblock - * - * @access private - * @param integer $offset - * @return array - */ - //-------------------------------------------- - function __docblock( $offset ) { - $res = $this->__regex('~/\*\*\\n(.+)\*/.+'.$offset.'~s', false); - $res = preg_replace('~.+/\*\*\\n~is', '', $res); - $res = str_replace(array("\t","* ","*"), '', $res); - $res = htmlentities($res); - $res = str_replace('<code>', '', $res); - $res = str_replace('</code>', '', $res); - $res = explode("\n", $res); - unset($res[count($res)-1]); - return $res; - } - - //-------------------------------------------- - /** - * Get attribs - * - * @access private - * @return string|array - */ - //-------------------------------------------- - function __attribs() { - $regex = '~[\\n| |\\t]+(var|private|protected|public|static)[ ]+\$([^ |=|;]*).*[\\n]~i'; - preg_match_all($regex, $this->content, $matches); - if(isset($matches[2][0])) { - $m = array(); - foreach($matches[2] as $key => $value) { - $default = $this->__regex('~'.$matches[1][$key].'.+\$'.$value.'.*=([^;]*).*\\n~im', false); - $default = trim(htmlentities($default)); - switch($default) { - case "''": $default = 'empty'; break; - case "" : $default = 'null'; break; - } - if(strpos($default, 'array') === false) { - $default = str_replace(array("\t",'"',"'","""), '', $default); - } - $m[$value]['access'] = ($matches[1][$key] === 'var')? 'public' : $matches[1][$key]; - $m[$value]['default'] = $default; - $m[$value]['docblock'] = $this->__docblock($matches[1][$key].'[ ]+\$'.$value.'[ |=|;]+'); - } - return $m; - } else { - return ''; - } - } - - //-------------------------------------------- - /** - * Regex - * - * @access private - * @param string $regex - * @param bool $all - * @param bool $key - * @return string|array - */ - //-------------------------------------------- - function __regex($regex, $all = true, $key = true) { - if($all === true) { - preg_match_all($regex, $this->content, $matches); - if(isset($matches[1][0])) { - if(count($matches[1]) < 2) { - return array($matches[1][0] => ''); - } else { - if($key === true) { - $m = array(); - foreach($matches[1] as $value) { - $m[$value] = ''; - } - return $m; - } else { - return $matches[1]; - } - } - } else { - return ''; - } - } else { - preg_match($regex, $this->content, $matches); - if(isset($matches[1])) { - return $matches[1]; - } else { - return ''; - } - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/class/dummyuser.class.php b/openQRM-5.3.50-CE/src/plugins/development/web/class/dummyuser.class.php deleted file mode 100644 index a4bd77f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/class/dummyuser.class.php +++ /dev/null @@ -1,595 +0,0 @@ - -*/ - - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/openqrm_server.class.php"; - - -class dummyuser -{ -/** -* Id -* @access public -* @var int -*/ -var $id; -/** -* Nickname -* @access public -* @var string -*/ -var $name = ''; -/** -* Password -* @access public -* @var string -*/ -var $password = ''; -/** -* Gender -* @access public -* @var string -*/ -var $gender = ''; -/** -* Firstname -* @access public -* @var string -*/ -var $first_name = ''; -/** -* Lastname -* @access public -* @var string -*/ -var $last_name = ''; -/** -* Department -* @access public -* @var string -*/ -var $department = ''; -/** -* Office -* @access public -* @var string -*/ -var $office = ''; -/** -* Role (Group) -* @access public -* @var string -*/ -var $role = ''; -/** - * -* Lang (language) -* @access public -* @var string -*/ -var $lang = ''; -/** -* Last update -* @access public -* @var string -*/ -var $last_update_time = ''; -/** -* Description -* @access public -* @var string -*/ -var $description = ''; -/** -* Capabilities -* @access public -* @var string -*/ -var $capabilities = ''; -/** -* wizard_name -* @access public -* @var string -*/ -var $wizard_name = ''; -/** -* wizard_step -* @access public -* @var string -*/ -var $wizard_step = ''; -/** -* wizard_id -* @access public -* @var string -*/ -var $wizard_id = ''; -/** -* State -* @access public -* @var string -*/ -var $state = ''; - -/** -* Internal use only -* @access private -* @var string -*/ -var $_user_table = ''; -/** -* Internal use only -* @access private -* @var string -*/ -var $_role_table = ''; - - - //----------------------------------------------------------------------------------- - function user($name) { - global $USER_INFO_TABLE; - $this->name = $name; - $this->get_instance_by_name($name); - $this->_role_table = 'role_info'; - $this->_user_table = $USER_INFO_TABLE; - } - - - - - // returns a user from the db selected by id, mac or ip - function get_instance($id, $name) { - global $USER_INFO_TABLE; - $event = new event(); - $db=openqrm_get_db_connection(); - if ($id != "") { - $user_array = $db->GetAll("select * from ".$this->_user_table." where user_id=$id"); - } else if ($name != "") { - $user_array = $db->GetAll("select * from ".$USER_INFO_TABLE." where user_name='$name'"); - } else { - $event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "user.class.php", "Could not create instance of user without data", "", "", 0, 0, 0); - return; - } - foreach ($user_array as $index => $user) { - $this->id = $user["user_id"]; - $this->name = $user["user_name"]; - $this->password = $user["user_password"]; - $this->gender = $user["user_gender"]; - $this->first_name = $user["user_first_name"]; - $this->last_name = $user["user_last_name"]; - $this->department = $user["user_department"]; - $this->office = $user["user_office"]; - $this->role = $user["user_role"]; - $this->lang = $user["user_lang"]; - $this->last_update_time = $user["user_last_update_time"]; - $this->description = $user["user_description"]; - $this->capabilities = $user["user_capabilities"]; - $this->wizard_name = $user["user_wizard_name"]; - $this->wizard_step = $user["user_wizard_step"]; - $this->wizard_id = $user["user_wizard_id"]; - $this->state = $user["user_state"]; - } - return $this; - } - - // returns a user from the db selected by id - function get_instance_by_id($id) { - $this->get_instance($id, ""); - return $this; - } - - - // returns a user from the db selected by id - function get_instance_by_name($name) { - $this->get_instance("", $name); - return $this; - } - - - - // for the ldap integration - - // adds user just to the database - function add($user_fields) { - global $event; - if (!is_array($user_fields)) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "user.class.php", "user_fields not well defined", "", "", 0, 0, 0); - return 1; - } - $db=openqrm_get_db_connection(); - $result = $db->AutoExecute($this->_user_table, $user_fields, 'INSERT'); - if (! $result) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "user.class.php", "Failed adding new user to database", "", "", 0, 0, 0); - } - } - - function get_name_list() { - $user_array = array(); - $query = "select user_name from $this->_user_table"; - $db=openqrm_get_db_connection(); - $rs = $db->Execute($query); - if (!$rs) - $event->log("get_name_list", $_SERVER['REQUEST_TIME'], 2, "user.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $user_array[] = $rs->fields; - $rs->MoveNext(); - } - return $user_array; - } - - function remove_by_name($user_name) { - // remove from db - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from $this->_user_table where user_name='$user_name'"); - return $rs; - } - - // end of ldap integration - - - //-------------------------------------------- - /** - * Find out user is admin - * - * @access public - * @return bool - */ - //-------------------------------------------- - function isAdmin() { - if(strtolower($this->role) === 'administrator' || $this->role === 0) { - return true; - } else { - return false; - } - } - - - //----------------------------------------------------------------------------------- - function set_user_form() { - - $query = $this->query_select(); - $result = openqrm_db_get_result($query); - - $this->name = array('value'=>$this->name, 'label'=>'Login'); - $this->id = $result[0][0]; - $this->gender = $result[0][1]; - $this->first_name = $result[0][2]; - $this->last_name = $result[0][3]; - $this->description = $result[0][4]; - $this->department = $result[0][5]; - $this->office = $result[0][6]; - $this->capabilities = $result[0][7]; - $this->state = $result[0][8]; - $this->role = $result[0][9]; - $this->last_update_time = $result[0][10]; - $this->password = array('value'=>'', 'label'=>$result[0][11]['label']); - } - //----------------------------------------------------------------------------------- - function set_user() { - - $query = $this->query_select(); - $result = openqrm_db_get_result($query); - - $this->id = $result[0][0]['value']; - $this->gender = $result[0][1]['value']; - $this->first_name = $result[0][2]['value']; - $this->last_name = $result[0][3]['value']; - $this->description = $result[0][4]['value']; - $this->department = $result[0][5]['value']; - $this->office = $result[0][6]['value']; - $this->capabilities = $result[0][7]['value']; - $this->state = $result[0][8]['value']; - $this->role = $result[0][9]['value']; - $this->last_update_time = $result[0][10]['value']; - $this->password = $result[0][11]['value']; - - $this->get_role_name(); - $this->role = $this->role['label']; - } - //----------------------------------------------------------------------------------- - function set_user_from_request() { - - $this->id = $this->http_request('id'); - $this->password = $this->http_request('password'); - $this->gender = $this->http_request('gender'); - $this->first_name = $this->http_request('first_name'); - $this->last_name = $this->http_request('last_name'); - $this->department = $this->http_request('department'); - $this->office = $this->http_request('office'); - $this->role = $this->http_request('role'); - $this->last_update_time = $this->http_request('last_update_time'); - $this->description = $this->http_request('description'); - $this->capabilities = $this->http_request('capabilities'); - $this->state = $this->http_request('state'); - - } - //----------------------------------------------------------------------------------- - function query_select(){ - $query = " - SELECT - user_id, - user_gender, - user_first_name, - user_last_name, - user_description, - user_department, - user_office, - user_capabilities, - user_state, - user_role, - user_last_update_time, - user_password - user_lang - FROM $this->_user_table - WHERE user_name = '$this->name' - "; - return $query; - } - //----------------------------------------------------------------------------------- - function query_insert(){ - global $USER_INFO_TABLE; - $this->id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $query = " - INSERT INTO - $USER_INFO_TABLE ( - user_id, - user_name, - user_password, - user_gender, - user_first_name, - user_last_name, - user_department, - user_office, - user_role, - user_last_update_time, - user_description, - user_capabilities, - user_state, - user_lang - ) - VALUES ( - '$this->id', - '$this->name', - '$this->password', - '$this->gender', - '$this->first_name', - '$this->last_name', - '$this->department', - '$this->office', - '$this->role', - '$this->last_update_time', - '$this->description', - '$this->capabilities', - '$this->state.', - '$this->lang.' - ) - "; - - $this->change_htpasswd('insert'); - return openqrm_db_get_result($query); - } - //----------------------------------------------------------------------------------- - function query_update(){ - global $USER_INFO_TABLE; - $user_fields = array(); - if($this->password != '') { - $user_fields['user_password']=$this->password; - $this->change_htpasswd('update'); - } - $user_fields['user_gender']=$this->gender; - $user_fields['user_first_name']=$this->first_name; - $user_fields['user_last_name']=$this->last_name; - $user_fields['user_department']=$this->department; - $user_fields['user_office']=$this->office; - $user_fields['user_role']=$this->role; - $user_fields['user_last_update_time']=$this->last_update_time; - $user_fields['user_description']=$this->description; - $user_fields['user_capabilities']=$this->capabilities; - $user_fields['user_state']=$this->state; - $user_fields['user_lang']=$this->lang; - $db=openqrm_get_db_connection(); - $result = $db->AutoExecute($USER_INFO_TABLE, $user_fields, 'UPDATE', "user_name = '$this->name'"); - if (! $result) { - $event->log("query_update", $_SERVER['REQUEST_TIME'], 2, "user.class.php", "Failed updating user", "", "", 0, 0, 0); - } - } - //----------------------------------------------------------------------------------- - function query_delete(){ - $query = " - DELETE FROM $this->_user_table - WHERE user_name = '".$this->name."' - "; - $this->change_htpasswd('delete'); - return openqrm_db_get_result($query); - } - //----------------------------------------------------------------------------------- - function check_user_exists() { - $query = " - SELECT user_name - FROM $this->_user_table - WHERE user_name = '".$this->name."' - "; - $result = openqrm_db_get_result_single($query); - - if($result['value'] != '') { return true; } - else { return false; } - - } - //----------------------------------------------------------------------------------- - function get_gender_list() { - $ar_Return = array(); - $ar_Return[] = array("value"=>'', "label"=>'',); - $ar_Return[] = array("value"=>'f', "label"=>'female',); - $ar_Return[] = array("value"=>'m', "label"=>'male',); - return $ar_Return; - } - //----------------------------------------------------------------------------------- - function get_role_name() { - $query = " - SELECT user_role, role_name - FROM $this->_user_table, $this->_role_table - WHERE user_name = '".$this->name."' - AND user_role = role_id - "; - $result = openqrm_db_get_result_double($query); - $this->role = $result[0]; - } - //----------------------------------------------------------------------------------- - function get_role_list() { - $query = " - SELECT role_id, role_name - FROM $this->_role_table - "; - $result = openqrm_db_get_result_double($query); - return $result; - } - //----------------------------------------------------------------------------------- - function check_string_name($name) { - - if (!preg_match('#^[A-Za-z0-9]*$#', $name)) { - return '[A-Za-z0-9]'; - } else { - return ''; - } - } - //----------------------------------------------------------------------------------- - function check_string_password($pass) { - if (!preg_match('#^[A-Za-z0-9]*$#', $pass)) { - return '[A-Za-z0-9_-]'; - } else { - return ''; - } - } - //----------------------------------------------------------------------------------- - /** - * Change htpassswd - * @access private - * @param $mode [update, delete, insert] - */ - function change_htpasswd($mode = 'update') { - global $RootDir; - - $ar_values = array(); - - $handle = fopen ($RootDir.'/.htpasswd', "r"); - while (!feof($handle)) { - $tmp = explode(':', fgets($handle, 4096)); - if($tmp[0] != '') { - $ar_values[$tmp[0]] = $tmp[1]; - } - } - fclose ($handle); - - $handle = fopen ($RootDir.'/.htpasswd', "w+"); - - if($mode == 'insert') { - foreach($ar_values as $key => $value) { - fputs($handle, "$key:$value"); - } - fputs($handle, $this->name.':'.crypt($this->password)."\n"); - } - if($mode == 'update') { - foreach($ar_values as $key => $value) { - if($key == $this->name) { - fputs($handle, $this->name.':'.crypt($this->password)."\n"); - } else { - fputs($handle, "$key:$value"); - } - } - } - if($mode == 'delete') { - foreach($ar_values as $key => $value) { - if($key != $this->name) { - fputs($handle, "$key:$value"); - } - } - } - fclose ($handle); - } - //----------------------------------------------------------------------------------- - function get_users() { - $query = ' - SELECT - user_name, - user_id, - user_first_name, - user_last_name, - role_name - FROM '.$this->_user_table.', '.$this->_role_table.' - WHERE user_role = role_id - ORDER BY user_name - '; - $ar_db = openqrm_db_get_result($query); - $ar_headline = array(); - $ar_headline[] = array('Login', 'ID', 'First Name', 'Last Name', 'Role'); - $result = array_merge($ar_headline, $ar_db); - - return $result; - } - //----------------------------------------------------------------------------------- - function http_request($arg) - { - global $_REQUEST; - if (isset($_REQUEST[$arg])) - return $_REQUEST[$arg]; - else - return ''; - } - - - - // set users lang - function set_user_language($name, $lang) { - $db=openqrm_get_db_connection(); - $sql = "update ".$this->_user_table." set user_lang='".$lang."' where user_name='".$name."'"; - $rs = $db->Execute($sql); - } - - - // set wizard fields - function set_wizard($username, $wizardname, $step, $id) { - $db=openqrm_get_db_connection(); - $sql = "update ".$this->_user_table." set user_wizard_name='".$wizardname."', user_wizard_step=".$step.",user_wizard_id=".$id." where user_name='".$username."'"; - $rs = $db->Execute($sql); - return $rs; - } - - - - //-------------------------------------------- - /** - * Translate - * - * @access public - * @param array $text_array array to translate - * @param string $dir dir of translation files - * @param string $file translation file - * @return array - */ - //-------------------------------------------- - function translate( $text_array, $dir, $file ) { - return $text_array; - } - - - - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/css/development.css b/openQRM-5.3.50-CE/src/plugins/development/web/css/development.css deleted file mode 100644 index 7696086..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/css/development.css +++ /dev/null @@ -1,274 +0,0 @@ -.htmlobject_td.edit, -.htmlobject_td.lang, -.htmlobject_td.docblock, -.htmlobject_td.template, -.htmlobject_td.api, -.htmlobject_td.hooks, -.htmlobject_td.js, -.htmlobject_td.css { - text-align: center; - vertical-align: top; - width: 30px; -} - -#form .legend { - float: right; - margin: 0px 16px 0 0; - box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.3); - border: 1px solid #ccc; - padding: 8px 10px 5px 10px; - background: white; -} -#form .legend.hooks h4 { - margin: 0 0 5px 0; -} -#form .legend.hooks { - width: 500px; -} -#form .legend.hooks .available { - background: #eee; - padding: 5px; - border: 1px solid #bbb; - margin: 0 0 5px 0; -} -#form .legend.hooks .available h4 { - margin: 0 0 5px 0; - border: 0px none; - font-weight: bold; -} - - -#form .legend.hooks .hookexplain { - margin: 0 0 10px 5px; -} - -#form .phpinfobox { - height: 180px; - overflow: scroll; - white-space: nowrap; - border: 1px solid #91A7B4; - padding: 2px 5px 5px 5px; - margin: 0 0 15px 0; -} -#form .plugininfo fieldset { - background: #fff; -} -#form div.plugin { - margin: 0 0 10px 0; - padding: 15px; - background: #E4EEFF; - border: 1px solid #ccc; -} -#form .controller { - border: 1px solid #ccc; - margin: 0 0 10px 0; - padding: 15px; - background: #FFFFE0; -} -#form div.plugin b, -#form .controller b { - text-decoration: underline; - padding: 0 0 0 0; - margin: 0 0 5px 0; -} -#form div.plugin b.error, -#form .controller b.error { - text-decoration: none; - padding: 0 0 0 0; - margin: 0 0 5px 0; - color: red; -} -#form div.plugin b.succes, -#form .controller b.success { - text-decoration: none; - padding: 0 0 0 0; - margin: 0 0 5px 0; - color: green; -} -#form div.name { - margin: 0; - padding: 5px 5px 25px 0; -} -#form .methods { - margin: 0; - padding: 0; -} - -#form .methods span { - display: block; -} -#form .methods span.action { - color: green; -} -#form .vars div, -#form .vars span { - display: block; - margin: 0 0 0 10px; -} -#form .action{ - margin: 0 0 10px 0px; - border: 1px solid #CCCCCC; - padding: 15px 0 15px 15px; - background: white; -} -#form .action .params { - margin: 0 0 20px 250px; - padding: 0 0 0 0; -} -#form .action .params b{ - text-decoration: underline; -} -#form .action .params span{ - display: block; -} -#form .link { - margin: 10px 50px 10px 0; - padding: 0; -} - - - -.htmlobject_tabs_box h1.apih1 { - margin: 0 0 15px 0; -} -#form .paginator { - border-bottom: 1px solid #91A7B4; - padding: 0 5px 15px 5px; - margin: 0 0 20px 0; -} -#form .paginator a{ - text-decoration: none; -} -#form .paginator .switch { - margin: 0 auto; - width: 580px; - text-align: center; -} -#form .paginator .switch a { - border: 1px solid; - display: block; - float: left; - width: 70px; - text-align: center; - margin: 2px; - padding: 3px; -} - - - -#documentation_content { - left: 0px; - padding: 0 5px !important; - position: relative; - top: 0px; - width: 750px; -} - -#plugin_content { - left: 0px; - padding: 0 5px !important; - position: relative; - top: 0px; - width: 255px; -} - -#form .toplink { - display: block; - text-align:right; - margin: 0 0 0 0; - padding:15px; - font-size:12px; - color:black; - text-decoration:none; -} -#form .apidoc { - padding: 15px; - border: 1px solid #ccc; - background: #eee; - margin: 0 0 10px 0; - color: black; -} -#form .apidoc h1 { - font-size: 18px; -} -#form .apidoc h3 { - background: transparent; - font-size: 14px; - border: 0px none; - font-weight: bold; -} -#form .apidoc code { - border:1px dotted #ccc; - display:block; - padding:10px; - margin: 10px 0 0 0; - background:#eee; - overflow: auto; - font-family: inherit; -} -#form .apidoc pre { - overflow: auto; - font-family: inherit; - background: white; - padding: 5px; -} -#form .apidoc pre.head { - border:1px solid #ccc; - padding: 10px; -} -#form .apidoc .links { - margin: 20px 0 40px 10px; -} -#form .apidoc .attribs { - background: #FFFFE0; - padding: 15px; - border: 1px solid #ccc; -} -#form .apidoc .methods { - background: #E4EEFF; - padding: 15px; - border: 1px solid #ccc; - margin: 20px 0 0 0; -} -#form .apidoc .attribs a, -#form .apidoc .methods a { - display:block; - text-align:right; - margin: 10px 0 0 0; - padding:10px; - font-size:12px; - color:black; - text-decoration:none; -} -#form .apidoc .attribs div, -#form .apidoc .methods div { - background: white; - border:1px solid #ccc; - margin: 0 0 0 0; - padding:10px; -} -#form .apidoc .attribs pre, -#form .apidoc .methods pre { - border: 0px none; - display: block; - font-size: 13px; - line-height: 15px; - margin: 0; - padding: 0; -} -#form .apidoc .attribs .indent, -#form .apidoc .methods .indent { - margin: 0; - border: none 0px; - padding: 15px 10px 0px 35px; - font-size:15px; -} - - -/* HOOKS */ -.hooktable td { - padding: 2px 20px 2px 0; -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/development/web/img/plugin.png deleted file mode 100644 index e952cbc..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/development/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/lang/de.development-about.ini b/openQRM-5.3.50-CE/src/plugins/development/web/lang/de.development-about.ini deleted file mode 100644 index a8c188c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/lang/de.development-about.ini +++ /dev/null @@ -1,12 +0,0 @@ -[documentation] -tab = "Über Development" -label = "Über Development" -introduction_title = "Einleitung" -introduction_content = "Das Development Plugin bietet Entwickler Informationen wie Übersetzung und Rest Api von Plugins." -requirements_title = "Anforderungen" -requirements_list = "keine" -tested_title = "Getestet mit" -tested_content = "Diese Plugin ist getestet mit Debian, Ubuntu und CentOS Linux Distributionen ." -type_title = "Plugin Typ" -type_content = "Misc" - diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/lang/de.development.ini b/openQRM-5.3.50-CE/src/plugins/development/web/lang/de.development.ini deleted file mode 100644 index 7c37854..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/lang/de.development.ini +++ /dev/null @@ -1,62 +0,0 @@ -[select] -tab = "Development" -label = "Development" -id = "Name" -action_rest = "rest" -action_lang = "lang" -action_docblock = "docblock" -action_template = "template" -please_wait = "Lade. Bitte warten .." -[rest] -tab = "Rest" -label_plugin = "Zeige Plugin %s Rest" -label_base = "Zeige %s Rest" -param_must_be_set_within_action = "muss innerhalb der Aktion gesetzt sein" -param_optional = "optional" -param_form_field = "Formular Feld" -param_required = "Pflichtfeld" -param_validator = "Validator" -please_wait = "Lade. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[lang] -tab = "Übersetzung" -label_plugin = "Zeige Plugin %s Übersetzung" -label_base = "Zeige %s Übersetzung" -please_wait = "Lade. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[docblock] -tab = "Docblock" -label_plugin = "Zeige Plugin %s Docblock" -label_base = "Zeige %s Docblock" -please_wait = "Lade. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[template] -tab = "Template" -label_plugin = "Zeige Plugin %s Templates" -label_base = "Zeige %s Templates" -please_wait = "Lade. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[hooks] -tab = "Hooks" -label_plugin = "Plugin %s Hooks" -label_base = "%s Hooks" -please_wait = "Lade. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -appliance-hook = "Der appliance-hook ermöglicht Plugins eigens definierte Kommandos während des Server Start/Stop-Vorgangs oder während eines Server-Updates auszuführen." -appliance-edit-hook = "Der appliance-edit hook erlaubt es Plugins einen Aktion-Item im Server Edit Formular hinzuzufügen." -appliance-link-hook = "Der appliance-edit hook erlaubt es Plugins einen Aktion-Item im Server Übersicht hinzuzufügen." -billing-hook = "Der billing-hook ermöglicht die Anbindung an externe Gebührenabrechnungssysteme." -cloud-hook = "Der cloud-hook lässt Virtualization Plugins selbst definieren wie Virtuelle Maschinene erstellt und entfernt werden." -dashboard-quicklink-hook = "Der dashboard-quicklink-hook erlaubt es Plugins einen Aktion-Item im openQRM Dashboard hinzuzufügen." -deployment-auth-hook/auth-hook = "Der deployment-auth-hook ermöglicht es dem Storage Plugins, das für den Image Deployment Typ des im Server konfigurierten Image verantwortlich ist, Kommandos zur Authentisierung des Volumes auf dem Storage Server auszuführen." -deployment-cloud-hook = "Der deployment-cloud-hook überlässt Storage Plugins die Aktionen Image Volumes für das automatisierte Cloud Deployment zu erstellen, zu entfernen, die Grösse zu verändern und zu Privatisieren." -event-hook = "Der event-hook ermöglicht es Plugins auf spezifische Events in openQRM zu reagieren." -external-dns-hook = "Der external-dns-hook erlaubt die Anbindung externer DNS Provider." -ha-cmd-hook = "Der ha-cmd-hook überlässt den Virtualizations Plugins zu definieren wie spezifische Virtuelle Maschinene im Falle eines Hochverfügbarkeits Fail-Over erstellt und abgeschaltet werden." -monitor-hook = "Der monitor-hook erlaubt es Plugins sich wiederholende Kommandos abzusetzen (z.b. für Status Updates)." -remote-console-hook = "Der remote-console-hook ermölicht Plugins die Einbindung einer VM-Konsole für spezifische Virtualizations Technologien." -resource-hook = "Der resource-hook erlaubt es Plugins zum Start, Stop oder Re-Start eines Servers selbstdefinierte Kommandos auszuführen." -resource-fence-hook = "Der resource-fence-hook definiert wie Ressourcen in openQRM im Falle eines Hochverfügbarkeits Fail-Over hart ausgeschaltet werden." -resource-virtual-command-hook = "Der resource-virtual-command-hook ermöglich es den Virtualizations Plugins eigene Kommandos zu definieren wie spezifische Virtuelle Machinen Typen gestartet und gestoppt werden." -role-hook = "Der role-hook erlaubt es Plugins Rollen-basierte Berechtigungen für jede einzel Aktion in openQRM zu vergeben." - diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/lang/en.development-about.ini b/openQRM-5.3.50-CE/src/plugins/development/web/lang/en.development-about.ini deleted file mode 100644 index 7d3affe..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/lang/en.development-about.ini +++ /dev/null @@ -1,11 +0,0 @@ -[documentation] -tab = "About Development" -label = "About Development" -introduction_title = "Introduction" -introduction_content = "The Development plugin provides developer informations like translation and rest api for base and plugins." -requirements_title = "Requirements" -requirements_list = "none" -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions." -type_title = "Plugin Type" -type_content = "Misc" diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/lang/en.development.ini b/openQRM-5.3.50-CE/src/plugins/development/web/lang/en.development.ini deleted file mode 100644 index f7cb5b9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/lang/en.development.ini +++ /dev/null @@ -1,64 +0,0 @@ -[select] -tab = "Development" -label = "Development" -id = "Name" -action_rest = "rest" -action_lang = "lang" -action_docblock = "docblock" -action_template = "template" -please_wait = "Loading. Please wait .." -[rest] -tab = "Rest" -label_plugin = "View Plugin %s Rest" -label_base = "View %s Rest" -param_must_be_set_within_action = "must be set within action" -param_optional = "optional" -param_form_field = "form field" -param_required = "required form field" -param_validator = "validator" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." -[lang] -tab = "Translation" -label_plugin = "View Plugin %s translation" -label_base = "View %s translation" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." -[docblock] -tab = "Docblock" -label_plugin = "View Plugin %s Docblock" -label_base = "View %s Docblock" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." -[template] -tab = "Template" -label_plugin = "View Plugin %s Templates" -label_base = "View %s Templates" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." -[hooks] -tab = "Hooks" -label_plugin = "View Plugin %s Hooks" -label_base = "View %s Hooks" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." -appliance-hook = "The appliance-hook allows plugins to run custom action during start, stop and update of a server." -appliance-edit-hook = "The appliance-edit hook provides plugins the capability to add an action item in the server edit section." -appliance-link-hook = "The appliance-edit hook provides plugins the capability to add an action item in the server overview section." -billing-hook = "The billing-hook allows to plugin custom external billing systems for the Cloud deployments." -cloud-hook = "The cloud-hook let the virtualization plugins define the way how specific VMs are created and removed." -dashboard-quicklink-hook = "The dashboard-quicklink-hook provides an option for plugins to add a icon and URL to the Quicklink setion on the openQRM dashboard." -deployment-auth-hook/auth-hook = "The deployment-auth-hook provides the storage plugins which is responsible for the specific image deployment types of the server image to run custom action on the storage object to authenticate/de-authenticate the image volume." -deployment-cloud-hook = "The deployment-cloud-hook let the storage plugins define a the way how the image volumes are created/removed/resized/privatized for the automated Cloud deployment." -event-hook = "The event-hook is triggered when a specific event arrives in openQRM and allows plugins to run custom actions." -external-dns-hook = "The external-dns-hook provides a way to interact with remote DNS services." -ha-cmd-hook = "The ha-cmd-hook let the virtualization plugins define the way how specific VMs are created and fenced in case of a highavailability fail-over." -monitor-hook = "The monitor-hook provides an option for plugins to run frequent repeated commands e.g. for status updates." -remote-console-hook = "The remote-console-hook allows plugins to embed a remote console for specific Virtualization technologies." -resource-hook = "The resource-hook allows plugins to run custom action during start, stop and restart of a server." -resource-fence-hook = "The resource-fence-hook defines how resources are fenced (STONITH) during highavailability fail-over." -resource-virtual-command-hook = "The resource-virtual-command-hook let the virtualization plugins define the way how specific VMs and Hosts are started and stopped through the Virtualization Host API." -role-hook = "The role-hook provides plugins the capability to define custom role-based permissions for every action in openQRM." - - - diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/development/web/menu.txt deleted file mode 100644 index 3b46830..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/menu.txt +++ /dev/null @@ -1,22 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|Development -...|API|index.php?plugin=development|Development -...|About|index.php?plugin=development&controller=development-about|How to use diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-about-documentation.tpl.php deleted file mode 100644 index 9b046ec..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-about-documentation.tpl.php +++ /dev/null @@ -1,36 +0,0 @@ - -

    {label}

    - -
    -
    -

    {introduction_title}

    - {introduction_content} - -

    {requirements_title}

    - {requirements_list} -
    - -
    -

    {type_title}

    - {type_content} - -

    {tested_title}

    - {tested_content} - -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-css.tpl.php b/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-css.tpl.php deleted file mode 100644 index 9c98f23..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-css.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ - -

    {label}

    - -
    - -
    -
    {previous}
    -
    {next}
    -
    - {switch} -
     
    -
    -
     
    -
    - -
    - {links} -
     
    -
    - -
    diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-docblock.tpl.php b/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-docblock.tpl.php deleted file mode 100644 index eb688ef..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-docblock.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    - -
    - -
    -
    {previous}
    -
    {next}
    -
    - {switch} -
     
    -
    -
     
    -
    - -
    -
      {links}
    - - {controllers} - -
     
    -
    - -
    diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-hooks.tpl.php b/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-hooks.tpl.php deleted file mode 100644 index b51a40a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-hooks.tpl.php +++ /dev/null @@ -1,22 +0,0 @@ - -

    {label}

    - -
    - -
    -
    {previous}
    -
    {next}
    -
    - {switch} -
     
    -
    -
     
    -
    - -
    -
    {table}
    -
    {legend}
    -
     
    -
    - -
    diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-js.tpl.php b/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-js.tpl.php deleted file mode 100644 index 9c98f23..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-js.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ - -

    {label}

    - -
    - -
    -
    {previous}
    -
    {next}
    -
    - {switch} -
     
    -
    -
     
    -
    - -
    - {links} -
     
    -
    - -
    diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-lang.tpl.php b/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-lang.tpl.php deleted file mode 100644 index bdee009..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-lang.tpl.php +++ /dev/null @@ -1,26 +0,0 @@ - -

    {label}

    - -
    - -
    -
    {previous}
    -
    {next}
    -
    - {switch} -
     
    -
    -
     
    -
    - -
    - {phpinfo} -
     
    -
    - -
    - {controllers} -
     
    -
    - -
    diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-rest.tpl.php b/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-rest.tpl.php deleted file mode 100644 index 8d13f06..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-rest.tpl.php +++ /dev/null @@ -1,27 +0,0 @@ - -

    {label}

    - -
    - -
    -
    {previous}
    -
    {next}
    -
    - {switch} -
     
    -
    -
     
    -
    - -
    - {phpinfo} -
     
    -
    - -
    - {legend} - {controllers} -
     
    -
    - -
    diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-select.tpl.php b/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-select.tpl.php deleted file mode 100644 index b6ff959..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-select.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    - -
    -

    Base

    - {table_base} -

    -

    Plugins

    - {table_plugins} -
    diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-template.tpl.php b/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-template.tpl.php deleted file mode 100644 index 8d13f06..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/development-template.tpl.php +++ /dev/null @@ -1,27 +0,0 @@ - -

    {label}

    - -
    - -
    -
    {previous}
    -
    {next}
    -
    - {switch} -
     
    -
    -
     
    -
    - -
    - {phpinfo} -
     
    -
    - -
    - {legend} - {controllers} -
     
    -
    - -
    diff --git a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/docblock.tpl.php b/openQRM-5.3.50-CE/src/plugins/development/web/tpl/docblock.tpl.php deleted file mode 100644 index 38da5ef..0000000 --- a/openQRM-5.3.50-CE/src/plugins/development/web/tpl/docblock.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ -
    -   -

    {classname}

    - {filename}
    - {extends}
    - {implements}
    -
    {docblock}
    - - - -
    -

    Attributes

    - {attribs}
    - -
    -

    Methods

    - {methods}
    - -
    diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/Makefile b/openQRM-5.3.50-CE/src/plugins/device-manager/Makefile deleted file mode 100644 index c37e757..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# this is the openQRM device-manager-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/device-manager* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/tpl/ - . $(OPENQRM_SERVER_CONF) && chmod 777 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/lang/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/bin/openqrm* - . $(OPENQRM_SERVER_CONF) && tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager -czvf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/boot-service-device-manager.tgz include/ bin/ etc/init.d/device-manager - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/device-manager - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/device-manager/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/bin/openqrm-device-manager b/openQRM-5.3.50-CE/src/plugins/device-manager/bin/openqrm-device-manager deleted file mode 100644 index 081ec7f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/bin/openqrm-device-manager +++ /dev/null @@ -1,350 +0,0 @@ -#!/bin/bash -# this script automatically manages device-manager -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/include/openqrm-plugin-device-manager-functions -OPENQRM_POSTENCODE="$OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-postencode" -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - OPENQRM_SERVER_IP=$resource_openqrmserver - OPENQRM_EXEC_PORT=$resource_execdport -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS - resource_id=0 - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL -fi -export LANG=C -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - -# lvm installed ? -if ! openqrm_full_fill_os_dependency lvm lvm2; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi -# procmail for lockfile -if ! openqrm_full_fill_os_dependency lockfile procmail; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi -# blkid -if ! openqrm_full_fill_os_dependency blkid util-linux; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi - -## for development !!!! ################################## -# avoiding using a real partition or disk for now ######## -#DD_FILE="/tmp/device-manager.lvm.img" -#if [ ! -f $DD_FILE ]; then -# dd if=/dev/zero of=$DD_FILE bs=1M seek=5000 count=0 -#fi -#if ! losetup -a | grep $DD_FILE 1>/dev/null; then -# losetup -d /dev/loop0 2>/dev/null -# losetup -f -v $DD_FILE -#fi -# -#DD_FILE1="/tmp/device-manager1.lvm.img" -#if [ ! -f $DD_FILE1 ]; then -# dd if=/dev/zero of=$DD_FILE1 bs=1M seek=5000 count=0 -#fi -#if ! losetup -a | grep $DD_FILE1 1>/dev/null; then -# losetup -d /dev/loop1 2>/dev/null -# losetup -f -v $DD_FILE1 -#fi -# - -#################################################################### - - - -function device_manager_usage() { - echo "Usage : $0 list <-u username> <-p password>" - echo " $0 add_vg <-d device-name> <-v volume-group-name> <-u username> <-p password>" - echo " $0 remove_vg <-v volume-group-name> <-u username> <-p password>" - echo "" - echo "Optional parameters:" - echo " [--openqrm-ui-user ]" - echo " [--openqrm-internal-cmd ]" - echo " [--openqrm-cmd-mode ]" - exit 1 -} - -FULL_COMMANDLINE="$0 $@" -DEVICE_MANAGER_MANAGER_COMMAND=$1 -shift - -while [ $# -ne 0 ]; do - case "$1" in - -d) - DEVICE_MANAGER_DEVICE_NAME=$2 - shift - ;; - -v) - DEVICE_MANAGER_VG_NAME=$2 - shift - ;; - -a) - DEVICE_MANAGER_ADD_DEV_TO_VG=$2 - shift - ;; - -u) - DEVICE_MANAGER_OPENQRM_USERNAME=$2 - shift - ;; - -p) - DEVICE_MANAGER_OPENQRM_PASSWORD=$2 - shift - ;; - --openqrm-ui-user) - OPENQRM_UI_USER=$2 - shift - ;; - --openqrm-internal-cmd) - OPENQRM_INTERNAL_CMD=$2 - shift - ;; - --openqrm-cmd-mode) - OPENQRM_CMD_MODE=$2 - shift - ;; - *) - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - echo "ERROR: Free commandline arguments are not allowed" - device_manager_manager_usage - exit 6 - ;; - esac - shift -done - -if [ "$OPENQRM_UI_USER" != "" ]; then - OPENQRM_UI_USER_PARAMETER=" --openqrm-ui-user $OPENQRM_UI_USER" -fi - -# main -case "$DEVICE_MANAGER_MANAGER_COMMAND" in - - list) - TMP_CONFIG_MOUNTED_BASE_DEV=`mktemp /tmp/device-manager-mounted.XXXXXX` - TMP_CONFIG_PVS_BASE_DEV=`mktemp /tmp/device-manager-pvs.XXXXXX` - TMP_CONFIG_MOUNTED_FULL_DEV=`mktemp /tmp/device-manager-mounted.XXXXXX` - TMP_CONFIG_PVS_FULL_DEV=`mktemp /tmp/device-manager-pvs.XXXXXX` - STORAGE_STATUS_TMP=$resource_id.device.stat - - LOCK_TIME=`openqrm_lock_queue aquire device-manager` - trap "openqrm_lock_queue release device-manager $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - > $STORAGE_STATUS_TMP - df | awk {' print $1 '} | grep ^/dev | grep -v "/dev/mapper/" | sed -e "s#[0-9].*##g" > $TMP_CONFIG_MOUNTED_BASE_DEV - pvs | awk {' print $1 '} | tail -n+2 | grep ^/dev | sed -e "s#[0-9].*##g" > $TMP_CONFIG_PVS_BASE_DEV - df | awk {' print $1 '} | grep ^/dev | grep -v "/dev/mapper/" > $TMP_CONFIG_MOUNTED_FULL_DEV - pvs | awk {' print $1 '} | tail -n+2 | grep ^/dev > $TMP_CONFIG_PVS_FULL_DEV - for PDEV in `cat /proc/partitions | grep -v ^major | awk {' print "/dev/"$4 '} | grep -v -w /dev/ | grep -v "dm-[0-9]" | grep -v "sr[0-9]"`; do - PDEV_MAIN_DISK=`echo $PDEV | sed -e "s#[0-9].*##g"` - if [ "$PDEV" == "$PDEV_MAIN_DISK" ]; then - continue - fi - echo "$PDEV" >> $STORAGE_STATUS_TMP - - #unset UUID - #eval `blkid $PDEV | awk '{ print $2 }'` - #if [ "$UUID" == "" ]; then - # if echo $PDEV | grep "/dev/loop" 1>/dev/null; then - # if ! grep -w $PDEV $TMP_CONFIG_MOUNTED_FULL_DEV 1>/dev/null; then - # if ! grep -w $PDEV $TMP_CONFIG_PVS_FULL_DEV 1>/dev/null; then - # echo "$PDEV" >> $STORAGE_STATUS_TMP - # fi - # fi - # else - # if ! grep -w $PDEV $TMP_CONFIG_MOUNTED_BASE_DEV 1>/dev/null; then - # if ! grep -w $PDEV $TMP_CONFIG_PVS_BASE_DEV 1>/dev/null; then - # echo "$PDEV" >> $STORAGE_STATUS_TMP - # fi - # fi - # fi - #fi - - done - rm -f $TMP_CONFIG_MOUNTED_BASE_DEV $TMP_CONFIG_PVS_BASE_DEV $TMP_CONFIG_MOUNTED_FULL_DEV $TMP_CONFIG_PVS_FULL_DEV - sed -i -e "s/ \{1,\}/@/g" $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$DEVICE_MANAGER_OPENQRM_USERNAME --http-password=$DEVICE_MANAGER_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/device-manager/device-manager-action.php?device_manager_command=get_device_list; then - openqrm_post_event 0 "post_vg" 2 "openqrm-device-manager" "Could not post the device list to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - - openqrm_lock_queue release device-manager $LOCK_TIME - trap '' EXIT - ;; - - add_vg) - RETURN_CODE=0 - RETURN_MSG="" - openqrm_post_event 0 "start" 5 "openqrm-device-manager" "Starting lvm on resource $resource_id." - if [ "$DEVICE_MANAGER_VG_NAME" == "" ] || [ "$DEVICE_MANAGER_DEVICE_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - device_manager_usage - fi - if [ ! -e "$DEVICE_MANAGER_DEVICE_NAME" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - RETURN_CODE=1 - RETURN_MSG="Device $DEVICE_MANAGER_DEVICE_NAME is not existing on resource resource $resource_id." - openqrm_post_event 0 "add_vg" 3 "openqrm-device-manager" "$RETURN_MSG" - fi - - LOCK_TIME=`openqrm_lock_queue aquire device-manager` - trap "openqrm_lock_queue release device-manager $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - if [ "$RETURN_CODE" == 0 ]; then - openqrm_post_event 0 "start" 5 "openqrm-device-manager" "Resource $resource_id is preparing $DEVICE_MANAGER_DEVICE_NAME for LVM Volume Group $DEVICE_MANAGER_VG_NAME." - if ! pvcreate -ff -y $DEVICE_MANAGER_DEVICE_NAME; then - RETURN_CODE=1 - RETURN_MSG="Could not init device $DEVICE_MANAGER_DEVICE_NAME for LVM on resource resource $resource_id." - openqrm_post_event 0 "add_vg" 3 "openqrm-device-manager" "$RETURN_MSG" - fi - fi - # new vg or extent existing vg - if [ "$RETURN_CODE" == 0 ]; then - if [ "$DEVICE_MANAGER_ADD_DEV_TO_VG" == "true" ]; then - if ! vgextend $DEVICE_MANAGER_VG_NAME $DEVICE_MANAGER_DEVICE_NAME; then - RETURN_CODE=1 - RETURN_MSG="Could not extent existing LVM Volume Group $DEVICE_MANAGER_VG_NAME with $DEVICE_MANAGER_DEVICE_NAME." - openqrm_post_event 0 "add_vg" 3 "openqrm-device-manager" "$RETURN_MSG" - fi - else - if ! vgcreate $DEVICE_MANAGER_VG_NAME $DEVICE_MANAGER_DEVICE_NAME; then - RETURN_CODE=1 - RETURN_MSG="Could not create new LVM Volume Group $DEVICE_MANAGER_VG_NAME from $DEVICE_MANAGER_DEVICE_NAME." - openqrm_post_event 0 "add_vg" 3 "openqrm-device-manager" "$RETURN_MSG" - fi - fi - fi - if [ "$RETURN_CODE" == 0 ]; then - RETURN_MSG="ok" - fi - # Send message - STORAGE_STATUS_TMP=$resource_id.device.stat - > $STORAGE_STATUS_TMP - echo $RETURN_MSG > $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$DEVICE_MANAGER_OPENQRM_USERNAME --http-password=$DEVICE_MANAGER_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/device-manager/device-manager-action.php?device_manager_command=get_device_list; then - openqrm_post_event 0 "lvm" 2 "openqrm-device-manager" "Could not post the device list to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $STORAGE_STATUS_TMP - - openqrm_lock_queue release device-manager $LOCK_TIME - trap '' EXIT - - exit $RETURN_CODE - ;; - - - remove_vg) - RETURN_CODE=0 - RETURN_MSG="" - openqrm_post_event 0 "start" 5 "openqrm-device-manager" "Removing volume group on resource $resource_id." - if [ "$DEVICE_MANAGER_VG_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - device_manager_usage - fi - - LOCK_TIME=`openqrm_lock_queue aquire device-manager` - trap "openqrm_lock_queue release device-manager $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # check that the vg does not contain any lvols - if lvs | grep -w $DEVICE_MANAGER_VG_NAME 1>/dev/null; then - RETURN_CODE=1 - RETURN_MSG="LVM Volume Group $DEVICE_MANAGER_VG_NAME on resource $resource_id still contains logical Volumes." - openqrm_post_event 0 "remove_vg" 3 "openqrm-device-manager" "$RETURN_MSG" - fi - # check which pvs are going to be free when removing the vg - for FREE_PVS in `pvs | grep -w $DEVICE_MANAGER_VG_NAME | awk {' print $1 '}`; do - FREE_PVS_LIST="$FREE_PVS_LIST $FREE_PVS" - done - # remove vg - if [ "$RETURN_CODE" == 0 ]; then - if ! vgremove -f $DEVICE_MANAGER_VG_NAME; then - RETURN_CODE=1 - RETURN_MSG="Could not remove LVM Volume Group $DEVICE_MANAGER_VG_NAME on resource $resource_id." - openqrm_post_event 0 "remove_vg" 3 "openqrm-device-manager" "$RETURN_MSG" - fi - fi - # remove freed pvs - if [ "$RETURN_CODE" == 0 ]; then - for FREE_PVS_DEV in $FREE_PVS_LIST; do - if ! pvremove -f -y $FREE_PVS_DEV; then - openqrm_post_event 0 "remove_vg" 3 "openqrm-device-manager" "Could not free physical Device $FREE_PVS_DEV on resource $resource_id." - fi - done - fi - if [ "$RETURN_CODE" == 0 ]; then - RETURN_MSG="ok" - openqrm_post_event 0 "remove_vg" 5 "openqrm-device-manager" "Resource $resource_id removed LVM Volume Group $DEVICE_MANAGER_VG_NAME." - fi - # Send message - STORAGE_STATUS_TMP=$resource_id.device.stat - > $STORAGE_STATUS_TMP - echo $RETURN_MSG > $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$DEVICE_MANAGER_OPENQRM_USERNAME --http-password=$DEVICE_MANAGER_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/device-manager/device-manager-action.php?device_manager_command=get_device_list; then - openqrm_post_event 0 "lvm" 2 "openqrm-device-manager" "Could not post the device list to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $STORAGE_STATUS_TMP - - openqrm_lock_queue release device-manager $LOCK_TIME - trap '' EXIT - - exit $RETURN_CODE - ;; - - - - - - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - echo "ERROR: Free commandline arguments are not allowed!" - device_manager_usage - exit 6 - ;; -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/etc/init.d/device-manager b/openQRM-5.3.50-CE/src/plugins/device-manager/etc/init.d/device-manager deleted file mode 100644 index 3f7e1e4..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/etc/init.d/device-manager +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the device-manager resources -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -# for including the package functions -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/include/openqrm-plugin-device-manager-functions -. $OPENQRM_RESOURCE_PARAMETER_FILE -OPENQRM_SERVER_IP=$resource_openqrmserver - -# do not run on idle resources -if [ "$resource_image" == "idle" ]; then - exit 0 -fi - -# also do not run before the real init of the rootfs -# if we have this file /etc/initrd-devices.conf we are still in the initrd -if [ -f /etc/initrd-devices.conf ]; then - - # TODO: add your commands to run in the initrd-stage on a managed system (network-deployment only) - - exit 0 -fi - - -function device_manager_start() { - echo "Starting the openQRM device-manager-plugin" - device_manager_stop 1>/dev/null 2>&1 -} - - -function device_manager_stop() { - echo "Stopping the openQRM device-manager-plugin" -} - - - - - -case "$1" in - start) - device_manager_start - ;; - stop) - device_manager_stop - ;; - restart) - device_manager_stop - sleep 1 - device_manager_start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 - -esac -exit $? - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/etc/init.d/openqrm-plugin-device-manager b/openQRM-5.3.50-CE/src/plugins/device-manager/etc/init.d/openqrm-plugin-device-manager deleted file mode 100644 index d0e1746..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/etc/init.d/openqrm-plugin-device-manager +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -# init script for the openQRM device-manager-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/include/openqrm-plugin-device-manager-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/etc/openqrm-plugin-device-manager.conf -openqrm_server_get_config -export LANG=C -# define wget to use with https -if [ "$OPENQRM_WEB_PROTOCOL" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - - -function openqrm_plugin_device_manager_start() { - echo "Starting the openQRM device-manager-plugin" - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/device-manager/.running -} - - -function openqrm_plugin_device_manager_stop() { - echo "Stopping the openQRM device-manager-plugin" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/device-manager/.running -} - -function openqrm_plugin_device_manager_uninstall() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "device-manager: Please give a username to uninstall the plugin : " - read USERNAME - echo - echo -n "device-manager: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Uninstalling the openQRM device-manager-plugin" - openqrm_plugin_device_manager_stop - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-device-manager.tgz - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/device-manager -} - -function openqrm_plugin_device_manager_init() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "device-manager: Please give a username to init the plugin : " - read USERNAME - echo - echo -n "device-manager: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - - echo "Initializing the openQRM device-manager-plugin" - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/device-manager - # link the boot-service - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/boot-service-device-manager.tgz $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-device-manager.tgz - # create storage dir for stat files - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/storage - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/storage - echo "Order deny,allow" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/storage/.htaccess - echo "Deny from all" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/device-manager/web/storage/.htaccess - -} - - - - - - - -USER=$2 -PASS=$3 - -case "$1" in - start) - openqrm_plugin_device_manager_start - ;; - stop) - openqrm_plugin_device_manager_stop - ;; - restart) - openqrm_plugin_device_manager_stop - sleep 1 - openqrm_plugin_device_manager_start - ;; - init) - openqrm_plugin_device_manager_init $USER $PASS - ;; - uninstall) - openqrm_plugin_device_manager_uninstall $USER $PASS - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/etc/init.d/openqrm-plugin-device-manager.postinstall b/openQRM-5.3.50-CE/src/plugins/device-manager/etc/init.d/openqrm-plugin-device-manager.postinstall deleted file mode 100644 index c9ebdb0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/etc/init.d/openqrm-plugin-device-manager.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-device-manager postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/etc/init.d/openqrm-plugin-device-manager.preremove b/openQRM-5.3.50-CE/src/plugins/device-manager/etc/init.d/openqrm-plugin-device-manager.preremove deleted file mode 100644 index 6363422..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/etc/init.d/openqrm-plugin-device-manager.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-device-manager preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-device-manager stop diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/etc/openqrm-plugin-device-manager.conf b/openQRM-5.3.50-CE/src/plugins/device-manager/etc/openqrm-plugin-device-manager.conf deleted file mode 100644 index b759caf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/etc/openqrm-plugin-device-manager.conf +++ /dev/null @@ -1,43 +0,0 @@ -# this is the openQRM-plugin-device-manager info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="A Device-manager to preconfigure LVM." -OPENQRM_PLUGIN_TYPE="management" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# list of storage types supported by this plugin -OPENQRM_DEVICE_MANAGER_STORAGE_TYPES="kvm-lvm-deployment, lvm-aoe-deployment, lvm-iscsi-deployment, lvm-nfs-deployment, aoe-san-deployment, iscsi-san-deployment, xen-lvm-deployment, clonezilla-deployment, openvz-deployment, lxc-lvm-deployment" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="" -# dirs which should be taken to the state backup -OPENQRM_PLUGIN_STATE_DIRS="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/web/device-manager/ $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/etc/" - diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/include/openqrm-plugin-device-manager-functions b/openQRM-5.3.50-CE/src/plugins/device-manager/include/openqrm-plugin-device-manager-functions deleted file mode 100644 index 59f283f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/include/openqrm-plugin-device-manager-functions +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# this is the functions file for the device-manager-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -################ common device-manager functions - - - -################ device-manager functions - diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/class/device-manager-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/device-manager/web/class/device-manager-about.controller.class.php deleted file mode 100644 index a85c20c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/web/class/device-manager-about.controller.class.php +++ /dev/null @@ -1,159 +0,0 @@ - - */ - - -class device_manager_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'device_manager_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'device_manager_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'device_manager_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'device_manager_about_identifier'; -/** -* path to device-managers -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About Device-manager', - 'label' => 'About Device-manager', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The Device-manager plugin provides an easy way to add or remove LVM Volume Groups. It is usefull to prepare system to be used as LVM based storages. If enabled, it is available for LVM based storage plugins.', - 'requirements_title' => 'Requirements', - 'requirements_list' => 'none', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - 'type_title' => 'Plugin Type', - 'type_content' => 'Deployment', - 'documentation_title' => 'Documentation', - ), -); - - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/device-manager/lang", 'device-manager-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/device-manager/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About Device-manager - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/device-manager/class/device-manager-about.documentation.class.php'); - $controller = new device_manager_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/class/device-manager-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/device-manager/web/class/device-manager-about.documentation.class.php deleted file mode 100644 index 2b92b6f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/web/class/device-manager-about.documentation.class.php +++ /dev/null @@ -1,99 +0,0 @@ - - */ - -class device_manager_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'device_manager_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'device_manager_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'device_manager_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'device_manager_about_identifier'; -/** -* path to device-managers -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_device-manager - */ - //-------------------------------------------- - function action() { - $svn_co_command = ""; - $t = $this->response->html->template($this->tpldir.'/device-manager-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/class/device-manager.addvg.class.php b/openQRM-5.3.50-CE/src/plugins/device-manager/web/class/device-manager.addvg.class.php deleted file mode 100644 index 11ab3f3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/web/class/device-manager.addvg.class.php +++ /dev/null @@ -1,297 +0,0 @@ - - */ - -class device_manager_addvg -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name; -/** -* message param -* @access public -* @var string -*/ -var $message_param; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name; -/** -* path to device-managers -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'label' => 'Add Volume Group to storage %s', - 'partition' => 'Partition', - 'name' => 'Name', - 'extend' => 'extend partition', - 'confirm_text' => 'All Data on %s will be erased.
    Are you sure to continue?', - 'msg_added' => 'Successfully added Volume Group %s', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - 'error_name' => 'Name must be %s only' - ); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->tpldir = $this->rootdir.'/plugins/device-manager/tpl'; - - $id = $this->response->html->request()->get('storage_id'); - $this->response->add('storage_id', $id); - - $storage = $this->openqrm->storage(); - $this->storage = $storage->get_instance_by_id($id); - - $resource = $this->openqrm->resource(); - $this->resource = $resource->get_instance_by_id($this->storage->resource_id); - - $this->statfile = $this->openqrm->get('basedir').'/plugins/device-manager/web/storage/'.$this->resource->id.'.device.stat'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action() { - $response = $this->addvg(); - $deployment = new deployment(); - $deployment->get_instance_by_id($this->storage->type); - - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - - $data['plugin'] = $deployment->storagetype; - $data['label'] = sprintf($this->lang['label'], $this->storage->name); - $data['baseurl'] = $this->openqrm->get('baseurl'); - $data['thisfile'] = $response->html->thisfile; - $t = $response->html->template($this->tpldir.'/device-manager-addvg.tpl.php'); - $t->add($response->form); - $t->add($data); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Ad Volume Group - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function addvg() { - // load partition file - $file = $this->statfile; - $command = $this->openqrm->get('basedir').'/plugins/device-manager/bin/openqrm-device-manager list'; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $this->resource->send_command($this->resource->ip, $command); - while (!$this->file->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - // get response - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $response->submit()) { - if($response->html->request()->get('confirm') !== '') { - $file = $this->statfile; - $command = $this->openqrm->get('basedir').'/plugins/device-manager/bin/openqrm-device-manager add_vg'; - $command .= ' -d '.$form->get_request('device'); - $command .= ' -v '.$form->get_request('name'); - $command .= ' -u '.$this->openqrm->admin()->name; - $command .= ' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - if($response->html->request()->get('extend') !== '') { - $command .= ' -a true'; - } - if($this->file->exists($file)) { - $this->file->remove($file); - } - $this->resource->send_command($this->resource->ip, $command); - while (!$this->file->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $result = trim($this->file->get_contents($file)); - if($result === 'ok') { - echo $command; - $response->msg = sprintf($this->lang['msg_added'], $form->get_request('name')); - } - else if($result !== 'ok') { - $response->error = $result; - } - } else { - $response = $this->get_response('confirm'); - } - } else { - if($form->get_errors()) { - $_REQUEST[$this->message_param] = implode("
    ", $form->get_errors()); - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param enum $mode [confirm] - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response($mode = '') { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'addvg'); - - if($mode !== 'confirm') { - $result = array(); - if($this->file->exists($this->statfile)) { - $result = trim($this->file->get_contents($this->statfile)); - $result = explode("\n", $result); - } - $select = array(); - foreach($result as $v) { - $select[] = array($v); - } - $d['select']['label'] = $this->lang['partition']; - $d['select']['required'] = true; - $d['select']['object']['type'] = 'htmlobject_select'; - $d['select']['object']['attrib']['name'] = 'device'; - $d['select']['object']['attrib']['index'] = array(0,0); - $d['select']['object']['attrib']['options'] = $select; - - $d['name']['label'] = $this->lang['name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9_-]+$/i'; - // TODO translation in kvm, .., etc - $d['name']['validate']['errormsg'] = sprintf('Name must be %s only', 'a-z0-9_-'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['name'] = 'name'; - - $d['extend']['label'] = $this->lang['extend']; - $d['extend']['object']['type'] = 'htmlobject_input'; - $d['extend']['object']['attrib']['type'] = 'checkbox'; - $d['extend']['object']['attrib']['name'] = 'extend'; - - $d['confirm']['object']['type'] = 'htmlobject_input'; - $d['confirm']['object']['attrib']['type'] = 'hidden'; - $d['confirm']['object']['attrib']['name'] = 'confirm'; - $d['confirm']['object']['attrib']['value'] = ''; - - $d['confirm_text'] = ''; - } - - if($mode === 'confirm') { - $d['select']['object']['type'] = 'htmlobject_input'; - $d['select']['object']['attrib']['type'] = 'hidden'; - $d['select']['object']['attrib']['name'] = 'device'; - $d['select']['object']['attrib']['value'] = $response->html->request()->get('device'); - - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['type'] = 'hidden'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['value'] = $response->html->request()->get('name'); - - $d['extend'] = ''; - if($response->html->request()->get('extend') !== '') { - $d['extend']['static'] = true; - $d['extend']['object']['type'] = 'htmlobject_input'; - $d['extend']['object']['attrib']['type'] = 'hidden'; - $d['extend']['object']['attrib']['name'] = 'extend'; - $d['extend']['object']['attrib']['value'] = 'true'; - } - - $d['confirm']['static'] = true; - $d['confirm']['object']['type'] = 'htmlobject_input'; - $d['confirm']['object']['attrib']['type'] = 'hidden'; - $d['confirm']['object']['attrib']['name'] = 'confirm'; - $d['confirm']['object']['attrib']['value'] = 'true'; - - $div = $response->html->div(); - $div->name = 'xxx'; - $div->style = 'margin: 0 0 20px 0;'; - $div->add(sprintf($this->lang['confirm_text'], $response->html->request()->get('device'))); - $form->add($div, 'confirm_text'); - } - - $form->add($d); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $cancel = $form->get_elements('cancel'); - $cancel->handler = 'onclick="cancel();"'; - $form->add($cancel, 'cancel'); - - $form->display_errors = false; - - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/class/device-manager.removevg.class.php b/openQRM-5.3.50-CE/src/plugins/device-manager/web/class/device-manager.removevg.class.php deleted file mode 100644 index 26153ed..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/web/class/device-manager.removevg.class.php +++ /dev/null @@ -1,198 +0,0 @@ - - */ - -class device_manager_removevg -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name; -/** -* message param -* @access public -* @var string -*/ -var $message_param; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name; -/** -* path to device-managers -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'label' => 'Remove Volume Group on storage %s', - 'confirm_text' => 'Do you realy want to remove Volume Group %s?', - 'msg_removed' => 'Successfully removed Volume Group %s', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->tpldir = $this->rootdir.'/plugins/device-manager/tpl'; - - $id = $this->response->html->request()->get('storage_id'); - $this->response->add('storage_id', $id); - $this->response->add('volgroup', $this->response->html->request()->get('volgroup')); - - $storage = new storage(); - $this->storage = $storage->get_instance_by_id($id); - - $resource = new resource(); - $this->resource = $resource->get_instance_by_id($this->storage->resource_id); - - $this->statfile = $this->openqrm->get('basedir').'/plugins/device-manager/web/storage/'.$this->resource->id.'.device.stat'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action() { - $response = $this->removevg(); - $deployment = new deployment(); - $deployment->get_instance_by_id($this->storage->type); - - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - - $data['confirm_text'] = sprintf($this->lang['confirm_text'], $this->response->html->request()->get('volgroup')); - $data['plugin'] = $deployment->storagetype; - $data['label'] = sprintf($this->lang['label'], $this->storage->name); - $data['baseurl'] = $this->openqrm->get('baseurl'); - $data['thisfile'] = $response->html->thisfile; - $t = $response->html->template($this->tpldir.'/device-manager-removevg.tpl.php'); - $t->add($response->form); - $t->add($data); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Remove Volume Group - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function removevg() { - // get response - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $response->submit()) { - $command = $this->openqrm->get('basedir').'/plugins/device-manager/bin/openqrm-device-manager remove_vg'; - $command .= ' -v '.$this->response->html->request()->get('volgroup'); - $command .= ' -u '.$this->openqrm->admin()->name; - $command .= ' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - if($this->file->exists($this->statfile)) { - $this->file->remove($this->statfile); - } - $this->resource->send_command($this->resource->ip, $command); - while (!$this->file->exists($this->statfile)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $result = trim($this->file->get_contents($this->statfile)); - if($result === 'ok') { - $response->msg = sprintf($this->lang['msg_removed'], $this->response->html->request()->get('volgroup')); - } - else if($result !== 'ok') { - $response->error = $result; - } - } else { - if($form->get_errors()) { - $_REQUEST[$this->message_param] = implode("
    ", $form->get_errors()); - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'removevg'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $cancel = $form->get_elements('cancel'); - $cancel->handler = 'onclick="cancel();"'; - $form->add($cancel, 'cancel'); - - $form->display_errors = false; - - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/css/device-manager.css b/openQRM-5.3.50-CE/src/plugins/device-manager/web/css/device-manager.css deleted file mode 100644 index e69de29..0000000 diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/device-manager-action.php b/openQRM-5.3.50-CE/src/plugins/device-manager/web/device-manager-action.php deleted file mode 100644 index 0f5a005..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/web/device-manager-action.php +++ /dev/null @@ -1,81 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$thisfile = basename($_SERVER['PHP_SELF']); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -$BaseDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -// filter inputs -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; - -$device_manager_command = $request->get('device_manager_command'); - -global $OPENQRM_SERVER_BASE_DIR; - -$event = new event(); -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $event; - -// place for the storage stat files -$device_statdir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/device-manager/storage'; - - -// user/role authentication -if ($OPENQRM_USER->role != "administrator") { - $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "device-manager-action", "Un-Authorized access to device-manager-actions from $OPENQRM_USER->name", "", "", 0, 0, 0); - exit(); -} - - -// main -$event->log("$device_manager_command", $_SERVER['REQUEST_TIME'], 5, "device-manager-action", "Processing device-manager command $device_manager_command", "", "", 0, 0, 0); - - switch ($device_manager_command) { - - case 'get_device_list': - if (!file_exists($device_statdir)) { - mkdir($device_statdir); - } - $filename = $device_statdir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - - - default: - $event->log("$device_manager_command", $_SERVER['REQUEST_TIME'], 3, "device-manager-action", "No such event command ($device_manager_command)", "", "", 0, 0, 0); - break; - - - } diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/device-manager/web/img/plugin.png deleted file mode 100644 index e952cbc..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/device-manager/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/lang/de.device-manager-about.ini b/openQRM-5.3.50-CE/src/plugins/device-manager/web/lang/de.device-manager-about.ini deleted file mode 100644 index 44b32fb..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/web/lang/de.device-manager-about.ini +++ /dev/null @@ -1,17 +0,0 @@ -[documentation] -tab = "Über Device-Manager" -label = "Über Device-Manager" - -introduction_title = "Einführung" -introduction_content = "Das Device-Manager plugin bietet einen einfachen Weg LVM-Volume-Groups anzulegen oder zu löschen. Wenn das Plugin aktiviert ist, stehen die Funktionen allen LVM basierten Storage-Plugins zur Verfügung." - -requirements_title = "Vorausetzungen" -requirements_list = "keine" - -tested_title = "Getestet mit" -tested_content = "Das Plugin wurde mit Debian, Ubuntu und CentOS Linux." - -type_title = "Plugin Typ" -type_content = "Deployment" - -documentation_title = "Dokumentation" diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/lang/en.device-manager-about.ini b/openQRM-5.3.50-CE/src/plugins/device-manager/web/lang/en.device-manager-about.ini deleted file mode 100644 index 6d3f8dd..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/web/lang/en.device-manager-about.ini +++ /dev/null @@ -1,17 +0,0 @@ -[documentation] -tab = "About Device manager" -label = "About Device manager" - -introduction_title = "Introduction" -introduction_content = "

    The Device manager plugin provides an easy way to add or remove LVM Volume Groups. It is usefull to prepare system to be used as LVM based storages. If enabled, it is available for LVM based storage plugins.

    " - -requirements_title = "Requirements" -requirements_list = "none" - -tested_title = "Tested with" -tested_content = "This plugin is tested with Debian, Ubuntu and CentOS." - -type_title = "Plugin Type" -type_content = "Deployment" - -documentation_title = "Documentation" diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/device-manager/web/menu.txt deleted file mode 100644 index 5f2916c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/web/menu.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|Device-manager|index.php?plugin=device-manager&controller=device-manager-about|How to use diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/tpl/device-manager-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/device-manager/web/tpl/device-manager-about-documentation.tpl.php deleted file mode 100644 index 3f35d82..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/web/tpl/device-manager-about-documentation.tpl.php +++ /dev/null @@ -1,37 +0,0 @@ - -

    {label}

    - -
    -
    -

    {introduction_title}

    - {introduction_content} - -

    {requirements_title}

    - {requirements_list} - -
    -
    - -

    {type_title}

    - {type_content} - -

    {tested_title}

    - {tested_content} - -
    -
    \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/tpl/device-manager-addvg.tpl.php b/openQRM-5.3.50-CE/src/plugins/device-manager/web/tpl/device-manager-addvg.tpl.php deleted file mode 100644 index 6342051..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/web/tpl/device-manager-addvg.tpl.php +++ /dev/null @@ -1,29 +0,0 @@ - -

    {label}

    - -
    -
    - {form} - {name} - {select} - {extend} - {confirm} - {confirm_text} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/device-manager/web/tpl/device-manager-removevg.tpl.php b/openQRM-5.3.50-CE/src/plugins/device-manager/web/tpl/device-manager-removevg.tpl.php deleted file mode 100644 index 3eab1f3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/device-manager/web/tpl/device-manager-removevg.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    - -
    -
    - {form} - {confirm_text} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/Makefile b/openQRM-5.3.50-CE/src/plugins/dhcpd/Makefile deleted file mode 100644 index 71f2f6b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# this is the openQRM dhcpd-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/bin/openqrm* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/ - . $(OPENQRM_SERVER_CONF) && cp etc/dhcpd-interfaces.conf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/templates - . $(OPENQRM_SERVER_CONF) && cp etc/templates/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/templates/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web/tpl/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web/lang/ - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/dhcpd - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/dhcpd/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/bin/openqrm-dhcpd-appliance b/openQRM-5.3.50-CE/src/plugins/dhcpd/bin/openqrm-dhcpd-appliance deleted file mode 100644 index c74daa0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/bin/openqrm-dhcpd-appliance +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/include/openqrm-plugin-dhcpd-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -openqrm_server_get_config -OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS -resource_id=0 -resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL - -DHCPD_HOST_TEMPLATE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-host.template" - -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - -function dhcpd_usage() { - echo "Usage: $0 add_hostname/remove_hostname -m -n " - exit 1 -} - -DHCPD_COMMAND=$1 -shift - -while [ $# -ne 0 ]; do - case "$1" in - -m) - PARAM_RESOURCE_MAC=$2 - shift - ;; - -n) - PARAM_APPLIANCE_NAME=$2 - shift - ;; - --openqrm-ui-user) - OPENQRM_UI_USER=$2 - shift - ;; - --openqrm-internal-cmd) - OPENQRM_INTERNAL_CMD=$2 - shift - ;; - --openqrm-cmd-mode) - OPENQRM_CMD_MODE=$2 - shift - ;; - *) - openqrm_unblock_starting_queue $@ - echo "ERROR: Free commandline arguments are not allowed" - dhcpd_usage - exit 6 - ;; - esac - shift -done - -# checks -if [ "$DHCPD_COMMAND" == "" ]; then - openqrm_unblock_starting_queue $@ - dhcpd_usage -fi - - -DHCPD_CONF=`grep -wr $PARAM_RESOURCE_MAC $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/dhcpd.conf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks/* | grep -v openqrm-dhcpd-appliance | awk '{ print $1 }' | cut -d':' -f 1` -if [ "$DHCPD_CONF" == "" ]; then - dhcpd_log openqrm-dhcpd-manager "Resource $RESOURCE_MAC does not exist in the dhcpd-server!" - exit 0 -fi - - - -# main -case "$DHCPD_COMMAND" in - - add_hostname) - if [ "$PARAM_APPLIANCE_NAME" == "" ]; then - openqrm_unblock_starting_queue $@ - dhcpd_usage - fi - if [ "$PARAM_RESOURCE_MAC" == "" ]; then - openqrm_unblock_starting_queue $@ - dhcpd_usage - fi - LOCK_TIME=`openqrm_lock_queue aquire dhcpd` - trap "openqrm_lock_queue release dhcpd $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $@ - - cp -f $DHCPD_CONF $DHCPD_CONF.openqrm-dhcpd-appliance - sed -i -e "s/hardware ethernet $PARAM_RESOURCE_MAC;/hardware ethernet $PARAM_RESOURCE_MAC; option host-name \"$PARAM_APPLIANCE_NAME\";/g" $DHCPD_CONF - ;; - - remove_hostname) - if [ "$PARAM_APPLIANCE_NAME" == "" ]; then - openqrm_unblock_starting_queue $@ - dhcpd_usage - fi - if [ "$PARAM_RESOURCE_MAC" == "" ]; then - openqrm_unblock_starting_queue $@ - dhcpd_usage - fi - - LOCK_TIME=`openqrm_lock_queue aquire dhcpd` - trap "openqrm_lock_queue release dhcpd $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $@ - - cp -f $DHCPD_CONF $DHCPD_CONF.openqrm-dhcpd-appliance - sed -i -e "s/option host-name \"$PARAM_APPLIANCE_NAME\";//g" $DHCPD_CONF - ;; - - *) - openqrm_unblock_starting_queue $@ - dhcpd_usage - ;; - - -esac - - - -# is dhcpd running ? do we have to restart ? -if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/dhcpd/.running ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd stop - if ! $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd start; then - dhcpd_log openqrm-dhcpd-manager "Adding Hostname for resource $PARAM_APPLIANCE_NAME - $PARAM_RESOURCE_MAC failed. Reverting dhcpd-configuration." - # restore previous version, better not to add it than to corrupt the config - cp -f $DHCPD_CONF.openqrm-dhcpd-appliance $DHCPD_CONF - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd start - fi -fi - -rm -f $DHCPD_CONF.openqrm-dhcpd-appliance - -openqrm_lock_queue release dhcpd $LOCK_TIME -trap '' EXIT diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/bin/openqrm-dhcpd-manager b/openQRM-5.3.50-CE/src/plugins/dhcpd/bin/openqrm-dhcpd-manager deleted file mode 100644 index a6fe598..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/bin/openqrm-dhcpd-manager +++ /dev/null @@ -1,484 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/include/openqrm-plugin-dhcpd-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -openqrm_server_get_config -OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS -resource_id=0 -resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL -DHCPD_CONF="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/dhcpd.conf" -DHCPD_HOST_TEMPLATE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-host.template" -export LANG=C -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - -function dhcpd_usage() { - echo "Usage: $0 add/remove -d [resource-id] -m [resource-mac] -s [resource-subnet] -i [resource-ip] -u [admin-user] -p [admin-password]" - echo " $0 remove_by_mac -m [resource_mac]" - echo " $0 add_network/remove_network -l [openqrm-server-interface]" - echo " $0 add_listen/remove_listen -l [openqrm-server-interface]" - exit 1 -} - -FULL_COMMANDLINE="$0 $@" -DHCPD_CMD=$1 -shift - -while [ $# -ne 0 ]; do - case "$1" in - -d) - RESOURCE_ID=$2 - HOSTNAME="resource$RESOURCE_ID" - shift - ;; - -m) - RESOURCE_MAC=$2 - shift - ;; - -i) - RESOURCE_IP=$2 - shift - ;; - -s) - RESOURCE_SUBNET=$2 - shift - ;; - -l) - LISTEN_INTERFACE=$2 - shift - ;; - -q) - RESOURCE_DOMAIN=$2 - shift - ;; - -u) - OPENQRM_USERNAME=$2 - shift - ;; - -p) - OPENQRM_PASSWORD=$2 - shift - ;; - --openqrm-ui-user) - OPENQRM_UI_USER=$2 - shift - ;; - --openqrm-internal-cmd) - OPENQRM_INTERNAL_CMD=$2 - shift - ;; - --openqrm-cmd-mode) - OPENQRM_CMD_MODE=$2 - shift - ;; - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - echo "ERROR: Free commandline arguments are not allowed" - dhcpd_usage - exit 6 - ;; - esac - shift -done - -# checks -if [ "$DHCPD_CMD" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - dhcpd_usage -fi - - -function guess_next_ip() { - OPENQRM_DHCPD_NETWORK=`grep subnet $DHCPD_CONF | grep netmask | awk '{ print $2 }'` - OPENQRM_DHCPD_SUBNETMASK=`grep subnet $DHCPD_CONF | grep netmask | awk '{ print $4 }'` - OPENQRM_DHCPD_FIRSTIP=`grep -w range $DHCPD_CONF | grep -v '#' | awk '{ print $2 }'` - if [ "$OPENQRM_DHCPD_FIRSTIP" == "" ]; then - OPENQRM_DHCPD_FIRSTIP=`openqrm_plugin_dhcpd_range_calculator $OPENQRM_DHCPD_NETWORK $OPENQRM_DHCPD_SUBNETMASK first` - fi - OPENQRM_DHCPD_LASTIP=`grep -w range $DHCPD_CONF | grep -v '#' | awk '{ print $3 }' | sed -e "s/;//g"` - if [ "$OPENQRM_DHCPD_LASTIP" == "" ]; then - OPENQRM_DHCPD_LASTIP=`openqrm_plugin_dhcpd_range_calculator $OPENQRM_DHCPD_NETWORK $OPENQRM_DHCPD_SUBNETMASK last` - fi - OPENQRM_DHCPD_LOOP=0 - while (true); do - if [ "$GUESSED_NEW_IP" == "$OPENQRM_DHCPD_FIRSTIP" ]; then - dhcpd_log openqrm-dhcpd-manager "WARNING: Reached start of available ip-range! No free ips available any more" - return - fi - GUESSED_NEW_IP=`openqrm_plugin_dhcpd_range_calculator $OPENQRM_DHCPD_NETWORK $OPENQRM_DHCPD_SUBNETMASK next $OPENQRM_DHCPD_LOOP` - IPCHECK_GUESSED=`echo $GUESSED_NEW_IP | sed -e "s/\.//g"` - IPCHECK_FIRST=`echo $OPENQRM_DHCPD_FIRSTIP | sed -e "s/\.//g"` - IPCHECK_LAST=`echo $OPENQRM_DHCPD_LASTIP | sed -e "s/\.//g"` - if [ "$IPCHECK_GUESSED" -gt "$IPCHECK_LAST" ]; then - OPENQRM_DHCPD_LOOP=$(( OPENQRM_DHCPD_LOOP + 1 )) - continue - fi - if [ "$IPCHECK_FIRST" -gt "$IPCHECK_GUESSED" ]; then - OPENQRM_DHCPD_LOOP=$(( OPENQRM_DHCPD_LOOP + 1 )) - continue - fi - if ! grep $GUESSED_NEW_IP $DHCPD_CONF | grep fixed-address 1>/dev/null; then - if ! ping -c 1 -i 1 -w 1 $GUESSED_NEW_IP 1>/dev/null; then - dhcpd_log openqrm-dhcpd-manager "NOTICE: Found $GUESSED_NEW_IP free and not pingable" - break - fi - fi - OPENQRM_DHCPD_LOOP=$(( OPENQRM_DHCPD_LOOP + 1 )) - done - echo "$GUESSED_NEW_IP" -} - - - -function restart_dhcpd() { - local DHCPD_PART=$1 - local DHCPD_RESOURCE_ID=$2 - local DHCPD_RESOURCE_MAC=$3 - # is dhcpd running ? do we have to restart ? - if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/dhcpd/.running ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd stop - if ! $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd start; then - dhcpd_log openqrm-dhcpd-manager "Adding Resource $DHCPD_RESOURCE_ID / $DHCPD_RESOURCE_MAC failed! Reverting dhcpd-configuration." - # restore previous version, better not to add it than to corrupt the config - case "$DHCPD_PART" in - main) - cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/dhcpd.conf $DHCPD_CONF - ;; - subnet) - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks - cp -aRf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/networks $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/ - ;; - esac - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd start - fi - fi -} - - - - -case "$DHCPD_CMD" in - add) - LOCK_TIME=`openqrm_lock_queue aquire dhcpd` - trap "openqrm_lock_queue release dhcpd $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - if [ "$RESOURCE_SUBNET" == "" ]; then - RESOURCE_SUBNET=`grep subnet $DHCPD_CONF | grep netmask | awk '{ print $4 }'` - fi - - # new VM without any ip yet ? - if [ "$RESOURCE_IP" == "0.0.0.0" ]; then - # this is when a new virtual machine is added - # running via the new-resource hook - # resource will be added to the default management network / set subnetmask to default network if empty - if [ "$RESOURCE_SUBNET" == "0.0.0.0" ]; then - RESOURCE_SUBNET=`grep subnet $DHCPD_CONF | grep netmask | awk '{ print $4 }'` - fi - NEXT_RESOURCE_IP=`guess_next_ip` - if [ "$NEXT_RESOURCE_IP" == "" ]; then - dhcpd_log openqrm-dhcpd-manager "Failed to guess the next ip address for Resource $HOSTNAME $RESOURCE_ID $RESOURCE_MAC. Not adding it." - - openqrm_lock_queue release dhcpd $LOCK_TIME - trap '' EXIT - - exit 0 - else - RESOURCE_IP=$NEXT_RESOURCE_IP - dhcpd_log openqrm-dhcpd-manager "Guessed next ip address $RESOURCE_IP for Resource $HOSTNAME $RESOURCE_ID $RESOURCE_MAC." - fi - fi - # decide to which network the resource should be added - NEW_RESOURCE_NETWORK=`openqrm_plugin_dhcpd_range_calculator $RESOURCE_IP $RESOURCE_SUBNET net` - if grep "subnet $NEW_RESOURCE_NETWORK netmask $RESOURCE_SUBNET" $DHCPD_CONF 1>/dev/null; then - # openQRM default Management network - if grep $RESOURCE_MAC $DHCPD_CONF | grep -v "^#" 1>/dev/null; then - dhcpd_log openqrm-dhcpd-manager "Resource $HOSTNAME $RESOURCE_ID $RESOURCE_MAC $RESOURCE_IP already existing in the dhcpd-server. Not adding it." - - openqrm_lock_queue release dhcpd $LOCK_TIME - trap '' EXIT - - exit 0 - fi - dhcpd_log openqrm-dhcpd-manager "adding $HOSTNAME $RESOURCE_ID $RESOURCE_MAC $RESOURCE_IP to default network" - TIMESTAMP=`date +%s` - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/ - cp -f $DHCPD_CONF $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/dhcpd.conf - cp -f $DHCPD_CONF $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/dhcpd.conf.$TIMESTAMP - grep -B 1000000 "^# end_static_ips" $DHCPD_CONF | sed -e "s/^# end_static_ips.*//g" > $DHCPD_CONF.first_part - grep -A 1000000 "^# end_static_ips" $DHCPD_CONF > $DHCPD_CONF.last_part - cat $DHCPD_HOST_TEMPLATE | \ - sed -e "s/DHCPD_RESOURCE_HOSTNAME/$HOSTNAME/g" | \ - sed -e "s/DHCPD_RESOURCE_MAC/$RESOURCE_MAC/g" | \ - sed -e "s/DHCPD_RESOURCE_IP/$RESOURCE_IP/g" > $DHCPD_CONF.host_part - cat $DHCPD_CONF.first_part $DHCPD_CONF.host_part $DHCPD_CONF.last_part > $DHCPD_CONF - sed -i -e '/^$/d' $DHCPD_CONF - rm -f $DHCPD_CONF.first_part $DHCPD_CONF.host_part $DHCPD_CONF.last_part - restart_dhcpd main $RESOURCE_IP $RESOURCE_MAC - - else - - # resource will be added to an additional managed network - if [ -d "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks" ]; then - for ADDITIONAL_DHCPD_CONF in `ls $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks/*.conf 2>/dev/null`; do - if grep "subnet $NEW_RESOURCE_NETWORK netmask $RESOURCE_SUBNET" $ADDITIONAL_DHCPD_CONF 1>/dev/null; then - if grep -i $RESOURCE_MAC $ADDITIONAL_DHCPD_CONF | grep -v "^#" 1>/dev/null; then - dhcpd_log openqrm-dhcpd-manager "Resource $HOSTNAME $RESOURCE_ID $RESOURCE_MAC $RESOURCE_IP already existing in $ADDITIONAL_DHCPD_CONF. Not adding it." - - openqrm_lock_queue release dhcpd $LOCK_TIME - trap '' EXIT - - exit 0 - fi - dhcpd_log openqrm-dhcpd-manager "adding $HOSTNAME $RESOURCE_ID $RESOURCE_MAC $RESOURCE_IP to $ADDITIONAL_DHCPD_CONF" - TIMESTAMP=`date +%s` - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/networks.$TIMESTAMP - cp -aRf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/ - cp -aRf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks/* $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/networks.$TIMESTAMP/ - grep -B 1000000 "^# end_static_ips" $ADDITIONAL_DHCPD_CONF | sed -e "s/^# end_static_ips.*//g" > $ADDITIONAL_DHCPD_CONF.first_part - grep -A 1000000 "^# end_static_ips" $ADDITIONAL_DHCPD_CONF > $ADDITIONAL_DHCPD_CONF.last_part - cat $DHCPD_HOST_TEMPLATE | \ - sed -e "s/DHCPD_RESOURCE_HOSTNAME/$HOSTNAME/g" | \ - sed -e "s/DHCPD_RESOURCE_MAC/$RESOURCE_MAC/g" | \ - sed -e "s/DHCPD_RESOURCE_IP/$RESOURCE_IP/g" > $ADDITIONAL_DHCPD_CONF.host_part - cat $ADDITIONAL_DHCPD_CONF.first_part $ADDITIONAL_DHCPD_CONF.host_part $ADDITIONAL_DHCPD_CONF.last_part > $ADDITIONAL_DHCPD_CONF - sed -i -e '/^$/d' $ADDITIONAL_DHCPD_CONF - rm -f $ADDITIONAL_DHCPD_CONF.first_part $ADDITIONAL_DHCPD_CONF.last_part $ADDITIONAL_DHCPD_CONF.host_part - restart_dhcpd subnet $RESOURCE_IP $RESOURCE_MAC - fi - done - fi - fi - # if we have a username + pass we send back the eventual new generated ip to update the resource_ip in the db - if [ "$OPENQRM_USERNAME" != "" ] && [ "$OPENQRM_PASSWORD" != "" ]; then - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$OPENQRM_USERNAME --http-password=$OPENQRM_PASSWORD "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/dhcpd/dhcpd-action.php?dhcpd_command=post_ip&resource_id=$RESOURCE_ID&resource_ip=$RESOURCE_IP"; then - dhcpd_log openqrm-dhcpd-manager "ERROR: Could not post resource ip $RESOURCE_IP to the openQRM-server at $resource_openqrmserver!" - fi - fi - - openqrm_lock_queue release dhcpd $LOCK_TIME - trap '' EXIT - ;; - remove) - LOCK_TIME=`openqrm_lock_queue aquire dhcpd` - trap "openqrm_lock_queue release dhcpd $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # default openQRM Management network - if grep -w $HOSTNAME $DHCPD_CONF 1>/dev/null; then - dhcpd_log openqrm-dhcpd-manager "removing $HOSTNAME $RESOURCE_ID $RESOURCE_MAC $RESOURCE_IP from default network" - TIMESTAMP=`date +%s` - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/ - cp -f $DHCPD_CONF $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/dhcpd.conf - cp -f $DHCPD_CONF $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/dhcpd.conf.$TIMESTAMP - # first - resource - grep -B 10000 -A 4 "^host $HOSTNAME {" $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/dhcpd.conf | sed -e :a -e '$d;N;2,5ba' -e 'P;D' > $DHCPD_CONF.first_part - # after resource - grep -A 10000 "^host $HOSTNAME {" $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/dhcpd.conf | sed '1,5d' > $DHCPD_CONF.last_part - cat $DHCPD_CONF.first_part $DHCPD_CONF.last_part > $DHCPD_CONF - sed -i -e '/^$/d' $DHCPD_CONF - rm -f $DHCPD_CONF.first_part $DHCPD_CONF.host_part $DHCPD_CONF.last_part - restart_dhcpd main $RESOURCE_IP $RESOURCE_MAC - - else - # additional managed networks - for ADDITIONAL_DHCPD_CONF in `ls $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks/*.conf 2>/dev/null`; do - if grep -w $HOSTNAME $ADDITIONAL_DHCPD_CONF 1>/dev/null; then - dhcpd_log openqrm-dhcpd-manager "removing $HOSTNAME $RESOURCE_ID $RESOURCE_MAC $RESOURCE_IP from $ADDITIONAL_DHCPD_CONF" - TIMESTAMP=`date +%s` - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/networks.$TIMESTAMP - cp -aRf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/ - cp -aRf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks/* $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/backup/networks.$TIMESTAMP/ - # first - resource - grep -B 10000 -A 4 "^host $HOSTNAME {" $ADDITIONAL_DHCPD_CONF | sed -e :a -e '$d;N;2,5ba' -e 'P;D' > $ADDITIONAL_DHCPD_CONF.first_part - # after resource - grep -A 10000 "^host $HOSTNAME {" $ADDITIONAL_DHCPD_CONF | sed '1,5d' > $ADDITIONAL_DHCPD_CONF.last_part - cat $ADDITIONAL_DHCPD_CONF.first_part $ADDITIONAL_DHCPD_CONF.last_part > $ADDITIONAL_DHCPD_CONF - sed -i -e '/^$/d' $ADDITIONAL_DHCPD_CONF - rm -f $ADDITIONAL_DHCPD_CONF.first_part $ADDITIONAL_DHCPD_CONF.last_part - restart_dhcpd subnet $RESOURCE_IP $RESOURCE_MAC - fi - done - fi - - openqrm_lock_queue release dhcpd $LOCK_TIME - trap '' EXIT - ;; - - - remove_by_mac) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # default openQRM Management network - if grep -i $RESOURCE_MAC $DHCPD_CONF 1>/dev/null; then - dhcpd_log openqrm-dhcpd-manager "removing $HOSTNAME $RESOURCE_ID $RESOURCE_MAC $RESOURCE_IP from default network" - RES_ID=`grep -B1 -i $RESOURCE_MAC $DHCPD_CONF | grep "^host resource" | sed -e "s/.*resource//g" | awk '{ print $1 }'` - RES_IP=`grep -A1 -i $RESOURCE_MAC $DHCPD_CONF | grep "fixed-address" | awk '{ print $2 }' | sed -e "s/;//g"` - RES_SUBNET=`grep -w subnet.*netmask $DHCPD_CONF | awk '{ print $4 }'` - if $0 remove -d $RES_ID -m $RESOURCE_MAC -i $RES_IP -s $RES_SUBNET; then - dhcpd_log openqrm-dhcpd-manager "Successfully removed $RES_ID $RESOURCE_MAC $RES_IP from $DHCPD_CONF" - else - dhcpd_log openqrm-dhcpd-manager "Failed removing $RES_ID $RESOURCE_MAC $RES_IP from $DHCPD_CONF" - fi - else - # additional managed networks - for ADDITIONAL_DHCPD_CONF in `ls $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks/*.conf 2>/dev/null`; do - if grep -i $RESOURCE_MAC $ADDITIONAL_DHCPD_CONF 1>/dev/null; then - dhcpd_log openqrm-dhcpd-manager "removing $HOSTNAME $RESOURCE_ID $RESOURCE_MAC $RESOURCE_IP from $ADDITIONAL_DHCPD_CONF" - RES_ID=`grep -B1 -i $RESOURCE_MAC $ADDITIONAL_DHCPD_CONF | grep "^host resource" | sed -e "s/.*resource//g" | awk '{ print $1 }'` - RES_IP=`grep -A1 -i $RESOURCE_MAC $ADDITIONAL_DHCPD_CONF | grep "fixed-address" | awk '{ print $2 }' | sed -e "s/;//g"` - RES_SUBNET=`grep -w subnet.*netmask $ADDITIONAL_DHCPD_CONF | awk '{ print $4 }'` - if $0 remove -d $RES_ID -m $RESOURCE_MAC -i $RES_IP -s $RES_SUBNET; then - dhcpd_log openqrm-dhcpd-manager "Successfully removed $RES_ID $RESOURCE_MAC $RES_IP from $ADDITIONAL_DHCPD_CONF" - else - dhcpd_log openqrm-dhcpd-manager "Failed removing $RES_ID $RESOURCE_MAC $RES_IP from $ADDITIONAL_DHCPD_CONF" - fi - fi - done - fi - ;; - - - - - - - - - - add_network) - LOCK_TIME=`openqrm_lock_queue aquire dhcpd` - trap "openqrm_lock_queue release dhcpd $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - ORIGIN_LISTEN_INTERFACE=$LISTEN_INTERFACE - if [ -e /etc/openqrm/openvswitch-manager/nat/$LISTEN_INTERFACE ]; then - . /etc/openqrm/openvswitch-manager/nat/$LISTEN_INTERFACE - if [ "$OVS_VLAN" != "" ] && [ "$OVS_VLAN" != 0 ]; then - LISTEN_INTERFACE=$LISTEN_INTERFACE"."$OVS_VLAN - fi - fi - - - OPENQRM_DHCPD_NETWORK_IP_ADDRESS=`ip a s $LISTEN_INTERFACE | grep -w $LISTEN_INTERFACE$ | grep -w inet | awk '{ print $2 }' | cut -d'/' -f1` - - echo "- configuring additional network for $LISTEN_INTERFACE - $OPENQRM_DHCPD_NETWORK_IP_ADDRESS" - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks - OPENQRM_DHCPD_NETWORK_BROADCAST_ADDRESS=`ip a s $LISTEN_INTERFACE | grep -w $LISTEN_INTERFACE$ | grep -w inet | awk '{ print $4 }' | cut -d'/' -f1` - OPENQRM_DHCPD_NETWORK_CIDR=`ip a s $LISTEN_INTERFACE | grep -w $LISTEN_INTERFACE$ | grep -w inet | awk '{ print $2 }' | cut -d'/' -f2` - OPENQRM_DHCPD_NETWORK_SUBNET_MASK=`cidr2subnet $OPENQRM_DHCPD_NETWORK_CIDR` - OPENQRM_DHCPD_NETWORK=`openqrm_plugin_dhcpd_range_calculator $OPENQRM_DHCPD_NETWORK_IP_ADDRESS $OPENQRM_DHCPD_NETWORK_SUBNET_MASK net` - OPENQRM_DHCPD_NETWORK_IP_RANGE_FIRST=`openqrm_plugin_dhcpd_range_calculator $OPENQRM_DHCPD_NETWORK_IP_ADDRESS $OPENQRM_DHCPD_NETWORK_SUBNET_MASK first` - OPENQRM_DHCPD_NETWORK_IP_RANGE_LAST=`openqrm_plugin_dhcpd_range_calculator $OPENQRM_DHCPD_NETWORK_IP_ADDRESS $OPENQRM_DHCPD_NETWORK_SUBNET_MASK last` - - cat $OPENQRM_PLUGIN_DHCPD_NETWORK_TEMPLATE | \ - sed -e "s/OPENQRM_DHCPD_NETWORK/$OPENQRM_DHCPD_NETWORK/g" | \ - sed -e "s/OPENQRM_DHCPD_SUBNET_MASK/$OPENQRM_DHCPD_NETWORK_SUBNET_MASK/g" | \ - sed -e "s/OPENQRM_DHCPD_RANGE_FIRST/$OPENQRM_DHCPD_NETWORK_IP_RANGE_FIRST/g" | \ - sed -e "s/OPENQRM_DHCPD_RANGE_LAST/$OPENQRM_DHCPD_NETWORK_IP_RANGE_LAST/g" | \ - sed -e "s/OPENQRM_DHCPD_DOMAIN/$RESOURCE_DOMAIN/g" \ - > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks/$ORIGIN_LISTEN_INTERFACE.conf - - # add as include to dhcpd.conf - sed -i -e "s#^}#include \"$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks/$ORIGIN_LISTEN_INTERFACE.conf\";\n}#" $OPENQRM_PLUGIN_DHCPD_CONF - - restart_dhcpd subnet - - openqrm_lock_queue release dhcpd $LOCK_TIME - trap '' EXIT - ;; - - remove_network) - LOCK_TIME=`openqrm_lock_queue aquire dhcpd` - trap "openqrm_lock_queue release dhcpd $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks/$LISTEN_INTERFACE.conf - # remove as include to dhcpd.conf - sed -i -e "s#include \"$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks/$LISTEN_INTERFACE.conf\";##" $OPENQRM_PLUGIN_DHCPD_CONF - - restart_dhcpd subnet - - openqrm_lock_queue release dhcpd $LOCK_TIME - trap '' EXIT - ;; - - - add_listen) - LOCK_TIME=`openqrm_lock_queue aquire dhcpd` - trap "openqrm_lock_queue release dhcpd $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - ORIGIN_LISTEN_INTERFACE=$LISTEN_INTERFACE - if [ -e /etc/openqrm/openvswitch-manager/nat/$LISTEN_INTERFACE ]; then - . /etc/openqrm/openvswitch-manager/nat/$LISTEN_INTERFACE - if [ "$OVS_VLAN" != "" ] && [ "$OVS_VLAN" != 0 ]; then - LISTEN_INTERFACE=$LISTEN_INTERFACE"."$OVS_VLAN - fi - fi - - - . $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/dhcpd-interfaces.conf - - sed -i -e "s/DHCPD_LISTEN_INTERFACES=.*/DHCPD_LISTEN_INTERFACES=\"$DHCPD_LISTEN_INTERFACES $LISTEN_INTERFACE\"/g" $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/dhcpd-interfaces.conf - - restart_dhcpd main - - openqrm_lock_queue release dhcpd $LOCK_TIME - trap '' EXIT - ;; - - remove_listen) - LOCK_TIME=`openqrm_lock_queue aquire dhcpd` - trap "openqrm_lock_queue release dhcpd $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - ORIGIN_LISTEN_INTERFACE=$LISTEN_INTERFACE - if [ -e /etc/openqrm/openvswitch-manager/nat/$LISTEN_INTERFACE ]; then - . /etc/openqrm/openvswitch-manager/nat/$LISTEN_INTERFACE - if [ "$OVS_VLAN" != "" ] && [ "$OVS_VLAN" != 0 ]; then - LISTEN_INTERFACE=$LISTEN_INTERFACE"."$OVS_VLAN - fi - fi - - sed -i -e "s/ $LISTEN_INTERFACE//g" $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/dhcpd-interfaces.conf - - restart_dhcpd main - - openqrm_lock_queue release dhcpd $LOCK_TIME - trap '' EXIT - ;; - - - - - - - - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - dhcpd_log openqrm-dhcpd-manager "Usage: $0 {add|remove} [resource_ip]" - exit 1 - ;; -esac diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/dhcpd-interfaces.conf b/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/dhcpd-interfaces.conf deleted file mode 100644 index 38aec89..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/dhcpd-interfaces.conf +++ /dev/null @@ -1,17 +0,0 @@ -# this is the openQRM-plugin-dhcpd info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -DHCPD_LISTEN_INTERFACES="" diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd b/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd deleted file mode 100644 index cebc75f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd +++ /dev/null @@ -1,233 +0,0 @@ -#!/bin/bash -# init script for the openQRM dhcpd plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/include/openqrm-plugin-dhcpd-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/openqrm-plugin-dhcpd.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/dhcpd-interfaces.conf - -function openqrm_plugin_dhcpd_start() { - echo "Starting the openQRM dhcpd-plugin" - openqrm_plugin_dhcpd_stop 1>/dev/null 2>&1 - # on debian/ubuntu dhcpd ver.3 is named dhcpd3 - if [ -x /usr/sbin/dhcpd3 ]; then - # fix for ubuntu jaunty which does not like the lease file in the plugin dir - if ! /usr/sbin/dhcpd3 -cf $OPENQRM_PLUGIN_DHCPD_CONF -lf $OPENQRM_PLUGIN_DHCPD_LEASE_DIR/dhcpd.leases $OPENQRM_SERVER_INTERFACE $DHCPD_LISTEN_INTERFACES 2>&1; then - /usr/sbin/dhcpd3 -cf $OPENQRM_PLUGIN_DHCPD_CONF $OPENQRM_SERVER_INTERFACE $DHCPD_LISTEN_INTERFACES 2>&1 - RET=$? - else - RET=0 - fi - elif [ -x /usr/sbin/dhcpd ]; then - /usr/sbin/dhcpd -cf $OPENQRM_PLUGIN_DHCPD_CONF -lf $OPENQRM_PLUGIN_DHCPD_LEASE_DIR/dhcpd.leases $OPENQRM_SERVER_INTERFACE $DHCPD_LISTEN_INTERFACES 2>&1 - RET=$? - else - echo "ERROR: Could not find the dhcpd (ver.3) binary" - exit 1 - fi - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/dhcpd/.running - return $RET - -} - - -function openqrm_plugin_dhcpd_stop() { - echo "Stopping the openQRM dhcpd-plugin" - killall dhcpd 1>/dev/null 2>&1 - killall dhcpd3 1>/dev/null 2>&1 - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/dhcpd/.running - return 0 -} - - -function openqrm_plugin_dhcpd_init() { - echo "Initializing the openQRM dhcpd-plugin" - openqrm_server_get_config - # create leases dir - mkdir -p $OPENQRM_PLUGIN_DHCPD_LEASE_DIR - touch $OPENQRM_PLUGIN_DHCPD_LEASE_DIR/dhcpd.leases - chmod -R 777 $OPENQRM_PLUGIN_DHCPD_LEASE_DIR - - - # openQRM Management network - - # calculate the defaults - OPENQRM_SERVER_NETWORK=`openqrm_plugin_dhcpd_range_calculator $OPENQRM_SERVER_IP_ADDRESS $OPENQRM_SERVER_SUBNET_MASK net` - OPENQRM_PLUGIN_DHCPD_IP_RANGE_FIRST=`openqrm_plugin_dhcpd_range_calculator $OPENQRM_SERVER_IP_ADDRESS $OPENQRM_SERVER_SUBNET_MASK first` - OPENQRM_PLUGIN_DHCPD_IP_RANGE_LAST=`openqrm_plugin_dhcpd_range_calculator $OPENQRM_SERVER_IP_ADDRESS $OPENQRM_SERVER_SUBNET_MASK last` - - OPENQRM_SERVER_DNS=`cat /etc/resolv.conf | grep -m 1 "nameserver" | awk {' print $2 '} | head -n1 2>/dev/null` - OPENQRM_SERVER_DEFAULT_GATEWAY=`route -n | grep '^0.0.0.0' | grep $OPENQRM_SERVER_INTERFACE | awk {' print $2 '} | head -n1 2>/dev/null` - OPENQRM_SERVER_DOMAIN=`cat /etc/resolv.conf | grep -m 1 "search" | awk '{print $2'} | head -n1 2>/dev/null` - - # make sure we have got values to put in the dhcpd.conf - if [ "$OPENQRM_SERVER_DEFAULT_GATEWAY" == "" ]; then - OPENQRM_SERVER_DEFAULT_GATEWAY=$OPENQRM_SERVER_IP_ADDRESS - if ! openqrm_validate_ip $OPENQRM_SERVER_DEFAULT_GATEWAY; then - OPENQRM_SERVER_DEFAULT_GATEWAY=$OPENQRM_SERVER_IP_ADDRESS - fi - fi - if [ "$OPENQRM_SERVER_DNS" == "" ]; then - OPENQRM_SERVER_DNS=$OPENQRM_SERVER_IP_ADDRESS - if ! openqrm_validate_ip $OPENQRM_SERVER_DNS; then - OPENQRM_SERVER_DNS=$OPENQRM_SERVER_IP_ADDRESS - fi - fi - if [ "$OPENQRM_SERVER_DOMAIN" == "" ]; then - OPENQRM_SERVER_DOMAIN=$OPENQRM_SERVER_DEFAULT_DOMAIN - fi - - # create default dhcpd configuration - cat $OPENQRM_PLUGIN_DHCPD_CONF_TEMPLATE | \ - sed -e "s/OPENQRM_SERVER_SUBNET_MASK/$OPENQRM_SERVER_SUBNET_MASK/g" | \ - sed -e "s/OPENQRM_SERVER_BROADCAST_ADDRESS/$OPENQRM_SERVER_BROADCAST_ADDRESS/g" | \ - sed -e "s/OPENQRM_SERVER_DEFAULT_GATEWAY/$OPENQRM_SERVER_DEFAULT_GATEWAY/g" | \ - sed -e "s/OPENQRM_SERVER_DOMAIN/$OPENQRM_SERVER_DOMAIN/g" | \ - sed -e "s/OPENQRM_SERVER_DNS/$OPENQRM_SERVER_DNS/g" | \ - sed -e "s/OPENQRM_SERVER_IP_ADDRESS/$OPENQRM_SERVER_IP_ADDRESS/g" | \ - sed -e "s/OPENQRM_SERVER_NETWORK/$OPENQRM_SERVER_NETWORK/g" | \ - sed -e "s/OPENQRM_PLUGIN_DHCPD_IP_RANGE_FIRST/$OPENQRM_PLUGIN_DHCPD_IP_RANGE_FIRST/g" | \ - sed -e "s/OPENQRM_PLUGIN_DHCPD_IP_RANGE_LAST/$OPENQRM_PLUGIN_DHCPD_IP_RANGE_LAST/g" \ - > $OPENQRM_PLUGIN_DHCPD_CONF - - # additional networks to configure - if [ "$OPENQRM_PLUGIN_DHCPD_INTERFACES" != "" ]; then - for OPENQRM_PLUGIN_DHCPD_INTERFACE in `echo $OPENQRM_PLUGIN_DHCPD_INTERFACES | sed -e "s/,/ /g"`; do - OPENQRM_DHCPD_NETWORK_IP_ADDRESS=`ip a s $OPENQRM_PLUGIN_DHCPD_INTERFACE | grep -w $OPENQRM_PLUGIN_DHCPD_INTERFACE$ | grep -w inet | awk '{ print $2 }' | cut -d'/' -f1` - # if it has an ip address we create the dhcpd subnet delcaration for it - if [ "$OPENQRM_DHCPD_NETWORK_IP_ADDRESS" != "" ]; then - echo "- configuring additional network for $OPENQRM_PLUGIN_DHCPD_INTERFACE" - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks - OPENQRM_DHCPD_NETWORK_BROADCAST_ADDRESS=`ip a s $OPENQRM_PLUGIN_DHCPD_INTERFACE | grep -w $OPENQRM_PLUGIN_DHCPD_INTERFACE$ | grep -w inet | awk '{ print $4 }' | cut -d'/' -f1` - OPENQRM_DHCPD_NETWORK_CIDR=`ip a s $OPENQRM_PLUGIN_DHCPD_INTERFACE | grep -w $OPENQRM_PLUGIN_DHCPD_INTERFACE$ | grep -w inet | awk '{ print $2 }' | cut -d'/' -f2` - OPENQRM_DHCPD_NETWORK_SUBNET_MASK=`cidr2subnet $OPENQRM_DHCPD_NETWORK_CIDR` - OPENQRM_DHCPD_NETWORK=`openqrm_plugin_dhcpd_range_calculator $OPENQRM_DHCPD_NETWORK_IP_ADDRESS $OPENQRM_DHCPD_NETWORK_SUBNET_MASK net` - OPENQRM_DHCPD_NETWORK_IP_RANGE_FIRST=`openqrm_plugin_dhcpd_range_calculator $OPENQRM_DHCPD_NETWORK_IP_ADDRESS $OPENQRM_DHCPD_NETWORK_SUBNET_MASK first` - OPENQRM_DHCPD_NETWORK_IP_RANGE_LAST=`openqrm_plugin_dhcpd_range_calculator $OPENQRM_DHCPD_NETWORK_IP_ADDRESS $OPENQRM_DHCPD_NETWORK_SUBNET_MASK last` - - cat $OPENQRM_PLUGIN_DHCPD_NETWORK_TEMPLATE | \ - sed -e "s/OPENQRM_DHCPD_NETWORK/$OPENQRM_DHCPD_NETWORK/g" | \ - sed -e "s/OPENQRM_DHCPD_SUBNET_MASK/$OPENQRM_DHCPD_NETWORK_SUBNET_MASK/g" | \ - sed -e "s/OPENQRM_DHCPD_RANGE_FIRST/$OPENQRM_DHCPD_NETWORK_IP_RANGE_FIRST/g" | \ - sed -e "s/OPENQRM_DHCPD_RANGE_LAST/$OPENQRM_DHCPD_NETWORK_IP_RANGE_LAST/g" \ - > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks/$OPENQRM_PLUGIN_DHCPD_INTERFACE.conf - - # add as include to dhcpd.conf - sed -i -e "s#^}#include \"$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks/$OPENQRM_PLUGIN_DHCPD_INTERFACE.conf\";\n}#" $OPENQRM_PLUGIN_DHCPD_CONF - - fi - done - fi - - # enable apparmor if needed - APPARMOR_DHCPD="" - if [ -f /etc/apparmor.d/usr.sbin.dhcpd3 ]; then - APPARMOR_DHCPD="/etc/apparmor.d/usr.sbin.dhcpd3" - elif [ -f /etc/apparmor.d/usr.sbin.dhcpd ]; then - APPARMOR_DHCPD="/etc/apparmor.d/usr.sbin.dhcpd" - fi - if [ "$APPARMOR_DHCPD" != "" ]; then - if ! grep openQRM $APPARMOR_DHCPD 1>/dev/null; then - sed -i -e "s#^}##g" $APPARMOR_DHCPD - echo " # openQRM" >> $APPARMOR_DHCPD - echo " $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/** rw," >> $APPARMOR_DHCPD - if [ -d /etc/openqrm/plugins/dhcpd/ ]; then - echo " /etc/openqrm/plugins/dhcpd/** rw," >> $APPARMOR_DHCPD - fi - echo " /var/run/dhcpd.pid rw," >> $APPARMOR_DHCPD - echo " $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/var/state/dhcp/** lrw," >> $APPARMOR_DHCPD - echo "}" >> $APPARMOR_DHCPD - echo >> $APPARMOR_DHCPD - if [ -x "/etc/init.d/apparmor" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d apparmor reload - else - /etc/init.d/apparmor reload - fi - fi - # create pid file - touch /var/run/dhcpd.pid - chown dhcpd:dhcpd /var/run/dhcpd.pid - fi - fi - - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/dhcpd - - return 0 -} - - -function openqrm_plugin_dhcpd_uninstall() { - echo "Uninstalling the openQRM dhcpd-plugin" - openqrm_plugin_dhcpd_stop - /bin/rm -f $OPENQRM_PLUGIN_DHCPD_CONF - /bin/rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/networks - - # remove apparmor setup - APPARMOR_DHCPD="" - if [ -f /etc/apparmor.d/usr.sbin.dhcpd3 ]; then - APPARMOR_DHCPD="/etc/apparmor.d/usr.sbin.dhcpd3" - elif [ -f /etc/apparmor.d/usr.sbin.dhcpd ]; then - APPARMOR_DHCPD="/etc/apparmor.d/usr.sbin.dhcpd" - fi - if [ "$APPARMOR_DHCPD" != "" ]; then - sed -i -e "s#.*openQRM.*##g" $APPARMOR_DHCPD - sed -i -e "s#.*openqrm.*##g" $APPARMOR_DHCPD - sed -i -e "s#/var/run/dhcpd.pid rw,##g" $APPARMOR_DHCPD - if [ -x "/etc/init.d/apparmor" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d apparmor reload - else - /etc/init.d/apparmor reload - fi - fi - fi - # unlinking the web dir - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/dhcpd -} - - - -case "$1" in - start) - openqrm_plugin_dhcpd_start - ;; - stop) - openqrm_plugin_dhcpd_stop - ;; - restart) - openqrm_plugin_dhcpd_stop - sleep 1 - openqrm_plugin_dhcpd_start - ;; - init) - openqrm_plugin_dhcpd_init - ;; - uninstall) - openqrm_plugin_dhcpd_uninstall - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd.postinstall b/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd.postinstall deleted file mode 100644 index d677ee8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-dhcpd postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd.preremove b/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd.preremove deleted file mode 100644 index f55468a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/init.d/openqrm-plugin-dhcpd.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-dhcpd preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-dhcpd stop \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/openqrm-plugin-dhcpd.conf b/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/openqrm-plugin-dhcpd.conf deleted file mode 100644 index 0b216f9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/openqrm-plugin-dhcpd.conf +++ /dev/null @@ -1,66 +0,0 @@ -# this is the openQRM-plugin-dhcpd info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="isc-dhcp-server, openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="dhcp, openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="dhcp-server, openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Automatically manages IP-Addresses for the openQRM managed network." -OPENQRM_PLUGIN_TYPE="network" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/openqrm-plugin-dhcpd.conf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/dhcpd.conf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/var/state/dhcp/dhcpd.leases" -# dirs which should be taken to the state backup -OPENQRM_PLUGIN_STATE_DIRS="" - -# additional interface to listen on, comma separated, eg. OPENQRM_PLUGIN_DHCPD_INTERFACES="eth1,eth2" -OPENQRM_PLUGIN_DHCPD_INTERFACES="" - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-configuration.template b/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-configuration.template deleted file mode 100644 index 0b1b726..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-configuration.template +++ /dev/null @@ -1,57 +0,0 @@ -# openQRM dhcpd-plugin default dhcpd.conf -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -allow booting; -allow bootp; - -# Standard configuration directives... -option subnet-mask OPENQRM_SERVER_SUBNET_MASK; -option broadcast-address OPENQRM_SERVER_BROADCAST_ADDRESS; -option routers OPENQRM_SERVER_DEFAULT_GATEWAY; -option domain-name "OPENQRM_SERVER_DOMAIN"; -option domain-name-servers OPENQRM_SERVER_DNS; -next-server OPENQRM_SERVER_IP_ADDRESS; - -# Group the PXE bootable hosts together -group { - # PXE-specific configuration directives... - option vendor-encapsulated-options 09:0f:80:00:0c:4e:65:74:77:6f:72:6b:20:62:6f:6f:74:0a:07:00:50:72:6f:6d:70:74:06:01:02:08:03:80:00:00:47:04:80:00:00:00:ff; - - subnet OPENQRM_SERVER_NETWORK netmask OPENQRM_SERVER_SUBNET_MASK { - default-lease-time 21600; - max-lease-time 43200; - - # the ip range to serve - range OPENQRM_PLUGIN_DHCPD_IP_RANGE_FIRST OPENQRM_PLUGIN_DHCPD_IP_RANGE_LAST; - filename "/pxelinux.0"; - - -# ! Please do NOT remove these lines ################ -# start_static_ips ################################## - - - - - - - -# end_static_ips #################################### - - } -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-host.template b/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-host.template deleted file mode 100644 index b84ce9e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-host.template +++ /dev/null @@ -1,5 +0,0 @@ -host DHCPD_RESOURCE_HOSTNAME { - hardware ethernet DHCPD_RESOURCE_MAC; - fixed-address DHCPD_RESOURCE_IP; - filename "/pxelinux.0"; -} diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-network.template b/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-network.template deleted file mode 100644 index 54f59f2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-network.template +++ /dev/null @@ -1,26 +0,0 @@ - option domain-name "OPENQRM_DHCPD_DOMAIN"; - subnet OPENQRM_DHCPD_NETWORK netmask OPENQRM_DHCPD_SUBNET_MASK { - default-lease-time 21600; - max-lease-time 43200; - - # the ip range to serve - range OPENQRM_DHCPD_RANGE_FIRST OPENQRM_DHCPD_RANGE_LAST; - filename "/pxelinux.0"; - - -# ! Please do NOT remove these lines ################ -# start_static_ips ################################## - - - - - - - -# end_static_ips #################################### - - } - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/include/openqrm-plugin-dhcpd-functions b/openQRM-5.3.50-CE/src/plugins/dhcpd/include/openqrm-plugin-dhcpd-functions deleted file mode 100644 index eea3a6c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/include/openqrm-plugin-dhcpd-functions +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# this is the functions file for the dhcpd-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_DEFAULT_DOMAIN="openqrm" -OPENQRM_PLUGIN_DHCPD_CONF_TEMPLATE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-configuration.template" -OPENQRM_PLUGIN_DHCPD_CONF="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/dhcpd.conf" -OPENQRM_PLUGIN_DHCPD_NETWORK_TEMPLATE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/etc/templates/openqrm-plugin-dhcpd-network.template" -OPENQRM_PLUGIN_DHCPD_LEASE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/var/state/dhcp" - -# logs for dhcpd -function dhcpd_log() { - local COMPONENT=$1 - shift - local MESSAGE=$@ - logger -i -t "dhcpd plug-in" "$COMPONENT : $MESSAGE" -} - - -# -# $1: ip address -# $2: subnet mask -# $3: [first/last/net] or $3 [next] [offset] -# out: net, first-ip, last-ip or next-ip -# -function openqrm_plugin_dhcpd_range_calculator() { - perl - $1 $2 $3 $4<<'EOF' -ipp($ARGV[0],$ARGV[1])."\n"; - -sub ipp -{ - -my $ipaddr=$ARGV[0]; -my $nmask=$ARGV[1]; -my $type=$ARGV[2]; -my $offset=$ARGV[3]; - -my @addrarr=split(/\./,$ipaddr); -my ( $ipaddress ) = unpack( "N", pack( "C4",@addrarr ) ); - -my @maskarr=split(/\./,$nmask); -my ( $netmask ) = unpack( "N", pack( "C4",@maskarr ) ); - -my $netadd = ( $ipaddress & $netmask ); -my @netarr=unpack( "C4", pack( "N",$netadd ) ); -my $netaddress=join(".",@netarr); - -if ($type eq 'last') { - my $bcast = ( $ipaddress & $netmask ) + ( ~ $netmask ) -1; - my @bcastarr=unpack( "C4", pack( "N",$bcast ) ) ; - my $lastaddress=join(".",@bcastarr); - print "$lastaddress \n"; -} elsif ($type eq 'net') { - my $netadd = ( $ipaddress & $netmask ); - my @netarr=unpack( "C4", pack( "N",$netadd ) ); - my $netaddress=join(".",@netarr); - print "$netaddress\n"; -} elsif ($type eq 'next') { - - my $bcast = ( $ipaddress & $netmask ) + ( ~ $netmask ) -1 - $offset; - my @bcastarr=unpack( "C4", pack( "N",$bcast ) ) ; - my $nextaddress=join(".",@bcastarr); - print "$nextaddress\n"; -} else { - my $firstadd = ( $ipaddress & $netmask ) + 1; - my @netarr=unpack( "C4", pack( "N",$firstadd ) ); - my $firstaddress=join(".",@netarr); - print "$firstaddress\n"; -} -} -EOF -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/class/dhcpd-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/class/dhcpd-about.controller.class.php deleted file mode 100644 index 90f5d60..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/class/dhcpd-about.controller.class.php +++ /dev/null @@ -1,279 +0,0 @@ - - */ - -class dhcpd_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'dhcpd_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'dhcpd_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'dhcpd_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'dhcpd_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About Dhcpd', - 'label' => 'About Dhcpd', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The dhcpd plugin automatically manages your ip-address assignment and network-boot environment for the rapid-deployment features of openQRM. - Since some of the dynamic deployment methods in openQRM are based on network-booting (PXE) a dhcpd-server is a fundamental service to assign ip-addresses to booting resources. - An automatic configured Dhcpd-server is provided by this plugin. - No manual configuration is needed. The dhcpd plugin configures a dhcpd.conf file during initialization.

    - The main configuration file (dhcpd.conf) of the dhcpd server provided by this plugin you can find at:', - - 'requirements_title' => 'Requirements', - 'requirements_list' => '
  • none
  • ', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - 'provides_title' => 'Provides', - 'provides_list' => '
  • Automatically manages ip-address of the openQRM Management network
  • ', - 'type_title' => 'Plugin Type', - 'type_content' => 'Network', - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - ), - 'usage' => array ( - 'tab' => 'About Dhcpd', - 'label' => 'Dhcpd Use-Cases', - ), - -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/dhcpd/lang", 'dhcpd-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/dhcpd/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "documentation"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - case 'bootservice': - $content[] = $this->bootservice(true); - break; - case 'vms': - $content[] = $this->vms(true); - break; - case 'usage': - $content[] = $this->usage(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About Dhcpd - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/dhcpd/class/dhcpd-about.documentation.class.php'); - $controller = new dhcpd_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Boot-Service - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function bootservice( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/dhcpd/class/dhcpd-about.bootservice.class.php'); - $controller = new dhcpd_about_bootservice($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['bootservice']; - $data = $controller->action(); - } - $content['label'] = $this->lang['bootservice']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'bootservice' ); - $content['onclick'] = false; - if($this->action === 'bootservice'){ - $content['active'] = true; - } - return $content; - } - - - - - //-------------------------------------------- - /** - * About Dhcpd VM management - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function vms( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/dhcpd/class/dhcpd-about.vms.class.php'); - $controller = new dhcpd_about_vms($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['vms']; - $data = $controller->action(); - } - $content['label'] = $this->lang['vms']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'vms' ); - $content['onclick'] = false; - if($this->action === 'vms'){ - $content['active'] = true; - } - return $content; - } - - - - //-------------------------------------------- - /** - * About Dhcpd Use-Cases - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function usage( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/dhcpd/class/dhcpd-about.usage.class.php'); - $controller = new dhcpd_about_usage($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['usage']; - $data = $controller->action(); - } - $content['label'] = $this->lang['usage']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'usage' ); - $content['onclick'] = false; - if($this->action === 'usage'){ - $content['active'] = true; - } - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/class/dhcpd-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/class/dhcpd-about.documentation.class.php deleted file mode 100644 index 503ef98..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/class/dhcpd-about.documentation.class.php +++ /dev/null @@ -1,90 +0,0 @@ - - */ - -class dhcpd_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'dhcpd_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "dhcpd_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/dhcpd-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->basedir."/plugins/dhcpd/etc/dhcpd.conf", 'config_file'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/class/dhcpd.controller.class.php b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/class/dhcpd.controller.class.php deleted file mode 100644 index 1f50ca3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/class/dhcpd.controller.class.php +++ /dev/null @@ -1,154 +0,0 @@ - - */ - -class dhcpd_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'dhcpd_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "dhcpd_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'dhcpd_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'dhcpd_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array( - 'tab' => 'Dhcpd', - 'label' => 'dhcpd.conf', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/dhcpd/lang", 'dhcpd.ini'); - $this->tpldir = $this->rootdir.'/plugins/dhcpd/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = 'select'; - } - - $content = array(); - switch( $this->action ) { - case '': - default: - case 'select': - $content[] = $this->select(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/dhcpd/class/dhcpd.select.class.php'); - $controller = new dhcpd_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/class/dhcpd.select.class.php b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/class/dhcpd.select.class.php deleted file mode 100644 index bdd839c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/class/dhcpd.select.class.php +++ /dev/null @@ -1,122 +0,0 @@ - - */ - -class dhcpd_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'dhcpd_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "dhcpd_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'dhcpd_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'dhcpd_identifier'; -/** -* path to dhcps -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->tpldir = $this->rootdir.'/plugins/dhcpd/tpl'; - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $response = $this->select(); - $t = $this->response->html->template($this->tpldir.'/dhcpd-select.tpl.php'); - $t->add($this->lang['label'], 'label'); - $t->add($response, 'content'); - return $t; - - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function select() { - - $resource = $this->openqrm->resource(); - - $file = $this->openqrm->file(); - $content = $file->get_contents($this->openqrm->get('basedir').'/plugins/dhcpd/etc/dhcpd.conf'); - - $list = $resource->display_overview(0, 10000, 'resource_id', 'ASC'); - foreach($list as $v) { - if(isset($v['resource_id']) && $v['resource_id'] !== '0') { - $content = str_replace('resource'.$v['resource_id'], 'resource'.$v['resource_id'].'', $content); - } - } - $content = str_replace("\t", ' ', $content); - $content = str_replace("\n", '
    ', $content); - return $content; - - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/css/dhcpd.css b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/css/dhcpd.css deleted file mode 100644 index 0475a3e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/css/dhcpd.css +++ /dev/null @@ -1,16 +0,0 @@ -/*-Icon classes ----- */ -a.graphs { - padding: 0; - border: 0px none; - width: 32px; - height: 32px; - display:block; - text-align: center; - text-decoration: none; - line-height: 0px; - overflow: hidden; - color: transparent; -} -a.graphs { - background: url('/openqrm/base/plugins/dhcpd/img/plugin.png') no-repeat center top; -} diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/dhcpd-action.php b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/dhcpd-action.php deleted file mode 100644 index 3ca5560..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/dhcpd-action.php +++ /dev/null @@ -1,76 +0,0 @@ - -*/ - - - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/authblocker.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -// filter inputs -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; - -global $IMAGE_INFO_TABLE; -global $DEPLOYMENT_INFO_TABLE; -global $OPENQRM_SERVER_BASE_DIR; - -// get params -$dhcpd_command = $request->get('dhcpd_command'); -$dhcpd_resource_id = $request->get('resource_id'); -$dhcpd_resource_ip = $request->get('resource_ip'); - -// get event + openQRM server -$event = new event(); -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $event; - -// user/role authentication -if ($OPENQRM_USER->role != "administrator") { - $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "dhcpd-action", "Un-Authorized access to dhcpd-actions from $OPENQRM_USER->name", "", "", 0, 0, 0); - exit(); -} - - -$event->log("$dhcpd_command", $_SERVER['REQUEST_TIME'], 5, "dhcpd-action", "Processing dhcpd command $dhcpd_command", "", "", 0, 0, 0); -switch ($dhcpd_command) { - case 'post_ip': - $event->log("$dhcpd_command", $_SERVER['REQUEST_TIME'], 5, "dhcpd-action", "Updateing resource $dhcpd_resource_id with ip $dhcpd_resource_ip", "", "", 0, 0, 0); - $dhcpd_resource = new resource(); - $dhcpd_resource->get_instance_by_id($dhcpd_resource_id); - $dhcpd_resource_fields["resource_ip"] = $dhcpd_resource_ip; - $dhcpd_resource->update_info($dhcpd_resource_id, $dhcpd_resource_fields); - break; - - default: - $event->log("$dhcpd_command", $_SERVER['REQUEST_TIME'], 3, "dhcpd-action", "No such dhcpd command ($dhcpd_command)", "", "", 0, 0, 0); - break; - - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/img/plugin.png deleted file mode 100644 index dc584e9..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/lang/de.dhcpd-about.ini b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/lang/de.dhcpd-about.ini deleted file mode 100644 index c14440a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/lang/de.dhcpd-about.ini +++ /dev/null @@ -1,25 +0,0 @@ -[documentation] -tab = "Über Dhcpd" -label = "Über Dhcpd" -introduction_title = "Einleitung" -introduction_content = "

    Das 'Dhcpd'-Plugin vergibt automatisch IP-Adressen im openQRM-Verwaltungsnetzwerk und stellt eine Netzwerk-Boot Umgebung für die 'Rapid-Deployment'-Funktionalitäten von openQRM bereit. Da einige Deployment-Methoden von openQRM mittels Netzwerk-Boot (PXE) arbeiten ist ein dhcpd-Server ein fundamentaler Dienst um IP-Adressen an startende System zu vergeben.

    -

    Ein automatisch konfigurierter Dhcpd Server wird von diesem Plugin bereitgestellt. Manuelle Konfiguration ist nicht nötig. Das Plugin erzeugt automatisch eine valide dhcpd.conf Konfigurations Datei während der Initialisierung. Die Konfigurationsdatei des im Plugin beinhalteten Dhcpd Servers finde Sie unter:

    " - -requirements_title = "Anforderungen" -requirements_list = "keine" -tested_title = "Getestet mit" -tested_content = "Dieses Plugin ist getestet mit Debian, Ubuntu und CentOS" - -provides_title = "Bietet" -provides_list = "Automatische IP-Adress-Vergabe für das openQRM-Verwaltungsnetzwerk" - -type_title = "Plugin-Typ" -type_content = "Netzwerk" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" - - -[usage] -tab = "Über Dhcpd" -label = "Dhcpd-Anwendungsfälle" diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/lang/en.dhcpd-about.ini b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/lang/en.dhcpd-about.ini deleted file mode 100644 index c20b657..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/lang/en.dhcpd-about.ini +++ /dev/null @@ -1,22 +0,0 @@ -[documentation] -tab = "About Dhcpd" -label = "About Dhcpd" -introduction_title = "Introduction" -introduction_content = "

    The dhcpd plugin automatically manages your ip address assignment and network boot environment for the rapid deployment features of openQRM. Since some of the dynamic deployment methods in openQRM are based on network-booting (PXE) a dhcpd server is a fundamental service to assign ip addresses to booting resources. An automatic configured dhcpd server is provided by this plugin.

    -

    No manual configuration is needed. The dhcpd plugin configures a dhcpd.conf file during initialization. The main configuration file (dhcpd.conf) of the dhcpd server provided by this plugin you can find at:"

    - -requirements_title = "Requirements" -requirements_list = "none" -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS." -provides_title = "Provides" -provides_list = "Automatically manages ip addresses in the openQRM management network." -type_title = "Plugin type" -type_content = "Network" -documentation_title = "Documentation" -use_case_title = "Use case" - - -[usage] -tab = "About dhcpd" -label = "Dhcpd use cases" diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/menu.txt deleted file mode 100644 index 62e55d3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/menu.txt +++ /dev/null @@ -1,22 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|Dhcpd -...|Overview|index.php?plugin=dhcpd|Overview -...|About|index.php?plugin=dhcpd&controller=dhcpd-about|How to use diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/openqrm-dhcpd-appliance-hook.php b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/openqrm-dhcpd-appliance-hook.php deleted file mode 100644 index 064f1ae..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/openqrm-dhcpd-appliance-hook.php +++ /dev/null @@ -1,69 +0,0 @@ - -*/ - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; - - -function openqrm_dhcpd_appliance($cmd, $appliance_fields) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_EXEC_PORT; - $openqrm_server = new openqrm_server(); - $OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); - $event = new event(); - $appliance_id=$appliance_fields["appliance_id"]; - $appliance_name=$appliance_fields["appliance_name"]; - $resource = new resource(); - $resource->get_instance_by_id($appliance_fields["appliance_resources"]); - $resource_mac=$resource->mac; - $resource_ip=$resource->ip; - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - if (($resource->id == "-1") || ($resource->id == "")) { - return; - } - - $event->log("openqrm_dhcpd_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-appliance-hook.php", "Handling $cmd event $appliance_id/$appliance_name/$resource_ip/$resource_mac", "", "", 0, 0, $resource->id); - switch($cmd) { - case "start": - $event->log("openqrm_dhcpd_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-appliance-hook.php", "Adding hostname ".$appliance->name." from resource ".$resource->id.".", "", "", 0, 0, $resource->id); - $dhcpd_command = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-appliance add_hostname -m ".$resource_mac." -n ".$appliance->name." --openqrm-cmd-mode background"; - $openqrm_server->send_command($dhcpd_command); - break; - - case "stop": - $event->log("openqrm_dhcpd_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-appliance-hook.php", "Removing hostname ".$appliance->name." from resource ".$resource->id.".", "", "", 0, 0, $resource->id); - $dhcpd_command = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-appliance remove_hostname -m ".$resource_mac." -n ".$appliance->name." --openqrm-cmd-mode background"; - $openqrm_server->send_command($dhcpd_command); - break; - } - - -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/openqrm-dhcpd-resource-hook.php b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/openqrm-dhcpd-resource-hook.php deleted file mode 100644 index d1f367d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/openqrm-dhcpd-resource-hook.php +++ /dev/null @@ -1,63 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $OPENQRM_SERVER_IP_ADDRESS; -$event = new event(); -global $event; - - - -function openqrm_dhcpd_resource($cmd, $resource_fields) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $resource_id=$resource_fields["resource_id"]; - $resource_ip=$resource_fields["resource_ip"]; - $resource_mac=$resource_fields["resource_mac"]; - if (isset($resource_fields["resource_subnet"])) { - $resource_subnet=$resource_fields["resource_subnet"]; - } else { - $resource_subnet="0.0.0.0"; - } - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - $openqrm_server = new openqrm_server(); - $event->log("openqrm_new_resource", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-resource-hook.php", "Handling $cmd event $resource_id/$resource_ip/$resource_subnet/$resource_mac", "", "", 0, 0, $resource_id); - switch($cmd) { - case "add": - $openqrm_server->send_command($OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-manager add -d ".$resource_id." -m ".$resource_mac." -i ".$resource_ip." -s ".$resource_subnet." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"); - break; - case "remove": - $openqrm_server->send_command("$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-manager remove -d ".$resource_id." -m ".$resource_mac." -i ".$resource_ip." -s ".$resource_subnet." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"); - break; - - } -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/tpl/dhcpd-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/tpl/dhcpd-about-documentation.tpl.php deleted file mode 100644 index c45377c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/tpl/dhcpd-about-documentation.tpl.php +++ /dev/null @@ -1,43 +0,0 @@ - -

    {label}

    - -
    -
    -

    {introduction_title}

    - {introduction_content} -
    {config_file}
    - -

    {provides_title}

    - {provides_list} - -

    {requirements_title}

    - {requirements_list} -
    - -
    - -

    {type_title}

    - {type_content} - -

    {tested_title}

    - {tested_content} -
    -
    - - - diff --git a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/tpl/dhcpd-select.tpl.php b/openQRM-5.3.50-CE/src/plugins/dhcpd/web/tpl/dhcpd-select.tpl.php deleted file mode 100644 index 92f8288..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dhcpd/web/tpl/dhcpd-select.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ - -

    {label}

    - -
    -{content} -
    - - diff --git a/openQRM-5.3.50-CE/src/plugins/dns/Makefile b/openQRM-5.3.50-CE/src/plugins/dns/Makefile deleted file mode 100644 index 2e82c1d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# this is the openQRM dns-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/bin/openqrm* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/templates - . $(OPENQRM_SERVER_CONF) && cp etc/templates/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/templates/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web/lang/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web/tpl/ - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/dns - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/dns/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/dns/bin/openqrm-dns-domain-manager b/openQRM-5.3.50-CE/src/plugins/dns/bin/openqrm-dns-domain-manager deleted file mode 100644 index 684e43e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/bin/openqrm-dns-domain-manager +++ /dev/null @@ -1,246 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/include/openqrm-plugin-dns-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -openqrm_server_get_config - -export LANG=C -BIND_BACKUP_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/bind/backup" - - -function dns_domain_usage() { - echo "Usage: $0 add_domain/remove_domain -n [dns-domain-name] -i [dns-name-server_ip] -u [admin-user] -p [admin-password]" - echo " $0 add_host/remove_host -n [dns-domain-name] -i [dns-ip] -q [dns-hostname] -u [admin-user] -p [admin-password]" - exit 1 -} - -FULL_COMMANDLINE="$0 $@" -DNS_CMD=$1 -shift - -while [ $# -ne 0 ]; do - case "$1" in - -n) - DNS_DOMAIN_NAME=$2 - shift - ;; - -i) - DNS_HOST_IP=$2 - shift - ;; - -q) - DNS_HOST_NAME=$2 - shift - ;; - -u) - OPENQRM_USERNAME=$2 - shift - ;; - -p) - OPENQRM_PASSWORD=$2 - shift - ;; - --openqrm-ui-user) - OPENQRM_UI_USER=$2 - shift - ;; - --openqrm-internal-cmd) - OPENQRM_INTERNAL_CMD=$2 - shift - ;; - --openqrm-cmd-mode) - OPENQRM_CMD_MODE=$2 - shift - ;; - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - echo "ERROR: Free commandline arguments are not allowed" - dns_domain_usage - exit 6 - ;; - esac - shift -done - -# checks -if [ "$DNS_CMD" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - dns_domain_usage -fi - - - - - - -case "$DNS_CMD" in - - add_domain) - if [ "$DNS_DOMAIN_NAME" == "" ] || [ "$DNS_HOST_IP" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - dns_domain_usage - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire dns` - trap "openqrm_lock_queue release dns $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - LAST_GOOD_ZONES_BACKUP=`dns_zone_backup` - - dns_create_domain $DNS_DOMAIN_NAME $DNS_HOST_IP - - if ! dns_reload $LAST_GOOD_ZONES_BACKUP; then - openqrm_post_event 0 "add_domain" 3 "openqrm-dns-domain-manager" "Failed adding custom domain $DNS_DOMAIN_NAME. Trying to revert custom zones" - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - - exit 0 - fi - - dns_remove_zone_backup $LAST_GOOD_ZONES_BACKUP - openqrm_post_event 0 "add_domain" 5 "openqrm-dns-domain-manager" "Added custom domain $DNS_DOMAIN_NAME" - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - ;; - - - remove_domain) - if [ "$DNS_DOMAIN_NAME" == "" ] || [ "$DNS_HOST_IP" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - dns_domain_usage - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire dns` - trap "openqrm_lock_queue release dns $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - LAST_GOOD_ZONES_BACKUP=`dns_zone_backup` - - dns_remove_domain $DNS_DOMAIN_NAME $DNS_HOST_IP - - if ! dns_reload $LAST_GOOD_ZONES_BACKUP; then - openqrm_post_event 0 "add_domain" 3 "openqrm-dns-domain-manager" "Failed removing custom domain $DNS_DOMAIN_NAME. Trying to revert custom zones" - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - - exit 0 - fi - - dns_remove_zone_backup $LAST_GOOD_ZONES_BACKUP - openqrm_post_event 0 "add_domain" 5 "openqrm-dns-domain-manager" "Removed custom domain $DNS_DOMAIN_NAME" - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - ;; - - - - - - add_host) - - if [ "$DNS_DOMAIN_NAME" == "" ] || [ "$DNS_HOST_IP" == "" ] || [ "$DNS_HOST_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - dns_domain_usage - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire dns` - trap "openqrm_lock_queue release dns $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - LAST_GOOD_ZONES_BACKUP=`dns_zone_backup` - - if ! dns_domain_manage_host add $DNS_DOMAIN_NAME $DNS_HOST_IP $DNS_HOST_NAME; then - openqrm_post_event 0 "add_host" 3 "openqrm-dns-domain-manager" "Failed adding $DNS_HOST_NAME to custom domain $DNS_DOMAIN_NAME." - fi - - if ! dns_reload $LAST_GOOD_ZONES_BACKUP; then - openqrm_post_event 0 "add_host" 3 "openqrm-dns-domain-manager" "Failed adding $DNS_HOST_NAME to custom domain $DNS_DOMAIN_NAME. Trying to revert custom zones" - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - - exit 0 - fi - - dns_remove_zone_backup $LAST_GOOD_ZONES_BACKUP - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - ;; - - - - - remove_host) - if [ "$DNS_DOMAIN_NAME" == "" ] || [ "$DNS_HOST_IP" == "" ] || [ "$DNS_HOST_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - dns_domain_usage - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire dns` - trap "openqrm_lock_queue release dns $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - LAST_GOOD_ZONES_BACKUP=`dns_zone_backup` - - if ! dns_domain_manage_host remove $DNS_DOMAIN_NAME $DNS_HOST_IP $DNS_HOST_NAME; then - openqrm_post_event 0 "remove_host" 3 "openqrm-dns-domain-manager" "Failed removing $DNS_HOST_NAME from custom domain $DNS_DOMAIN_NAME." - echo - fi - - if ! dns_reload $LAST_GOOD_ZONES_BACKUP; then - openqrm_post_event 0 "remove_host" 3 "openqrm-dns-domain-manager" "Failed removing $DNS_HOST_NAME from custom domain $DNS_DOMAIN_NAME. Trying to revert custom zones" - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - - exit 0 - fi - - dns_remove_zone_backup $LAST_GOOD_ZONES_BACKUP - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - ;; - - - - - - - - - - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - dns_log openqrm-dns-manager "Usage: $0 {start|stop|init} " - exit 1 - ;; -esac diff --git a/openQRM-5.3.50-CE/src/plugins/dns/bin/openqrm-dns-manager b/openQRM-5.3.50-CE/src/plugins/dns/bin/openqrm-dns-manager deleted file mode 100644 index e582387..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/bin/openqrm-dns-manager +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/include/openqrm-plugin-dns-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf -export LANG=C -BIND_BACKUP_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/bind/backup" -DNS_INDB_FILE=`basename $DNS_INDB` -DNS_REVDB_FILE=`basename $DNS_REVDB` - - -FULL_COMMANDLINE="$0 $@" -DNS_CMD=$1 -case "$DNS_CMD" in - start|stop) - APPLIANCE_ID=$2 - APPLIANCE_NAME=$3 - APPLIANCE_IP=$4 - if [ "$APPLIANCE_ID" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "start/stop" 3 "openqrm-dns-manager" "Missing Appliance ID in start/stop hook" - # exit good to avoid re-run - exit 0 - fi - if [ "$APPLIANCE_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "start/stop" 3 "openqrm-dns-manager" "Missing Name in start/stop hook for Appliance $APPLIANCE_ID" - # exit good to avoid re-run - exit 0 - fi - if [ "$APPLIANCE_IP" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "start/stop" 5 "openqrm-dns-manager" "Skipping start hook/stop for Appliance $APPLIANCE_ID. Missing IP." - # exit good to avoid re-run - exit 0 - fi - # get the last byte from the ip for the reverse entry - APPLIANCE_LAST_IP_BYTE=`echo $APPLIANCE_IP | cut -d'.' -f 4` - if [ "$APPLIANCE_LAST_IP_BYTE" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "start/stop" 3 "openqrm-dns-manager" "Failed to get reverse DNS entry for Appliance $APPLIANCE_ID" - # exit good to avoid re-run - exit 0 - fi - - LOCK_TIME=`openqrm_lock_queue aquire dns` - trap "openqrm_lock_queue release dns $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - dns_log openqrm-dns-manager "Appliance $APPLIANCE_NAME id $APPLIANCE_ID ip-address $APPLIANCE_IP" - # back lastgood state of the zone files - TIMESTAMP=`date +%s` - mkdir -p $BIND_BACKUP_DIR/$TIMESTAMP - cp -a $DNS_INDB $BIND_BACKUP_DIR/$TIMESTAMP/ - cp -a $DNS_REVDB $BIND_BACKUP_DIR/$TIMESTAMP/ - - # stop / remove in any case - cat $DNS_INDB | grep -v -w $APPLIANCE_IP > $DNS_INDB.tmp - mv -f $DNS_INDB.tmp $DNS_INDB - cat $DNS_REVDB | grep -v -w ^$APPLIANCE_LAST_IP_BYTE > $DNS_REVDB.tmp - mv -f $DNS_REVDB.tmp $DNS_REVDB - - # start - if [ "$DNS_CMD" == "start" ]; then - echo "$APPLIANCE_NAME IN A $APPLIANCE_IP" >> $DNS_INDB - echo "$APPLIANCE_LAST_IP_BYTE IN PTR $APPLIANCE_NAME.$OPENQRM_SERVER_DOMAIN." >> $DNS_REVDB - fi - - # update serial no / regular - SERIAL_INDB="`cat $DNS_INDB | grep -i ';.*erial' | awk '{print $1}'`" - if [ "$SERIAL_INDB" == "" ]; then - openqrm_post_event 0 "start/stop" 3 "openqrm-dns-manager" "Failed to get serial number (regular). Restoring Zones files ($TIMESTAMP)" - # restore - cp -a $BIND_BACKUP_DIR/$TIMESTAMP/$DNS_INDB_FILE $DNS_INDB - cp -a $BIND_BACKUP_DIR/$TIMESTAMP/$DNS_REVDB_FILE $DNS_REVDB - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - # exit good to avoid re-run - exit 0 - elif [ "$SERIAL_INDB" -ge 0 ]; then - SERIAL_INDB_NEW=$((SERIAL_INDB+1)) - sed -i -e "s/$SERIAL_INDB.*;.*erial/$SERIAL_INDB_NEW ; Serial/g" $DNS_INDB - fi - # update serial no / reverse - SERIAL_REVDB="`cat $DNS_REVDB | grep -i ';.*erial' | awk '{print $1}'`" - if [ "$SERIAL_REVDB" == "" ]; then - openqrm_post_event 0 "start/stop" 3 "openqrm-dns-manager" "Failed to get serial number (reverse). Restoring Zones files ($TIMESTAMP)" - # restore - cp -a $BIND_BACKUP_DIR/$TIMESTAMP/$DNS_INDB_FILE $DNS_INDB - cp -a $BIND_BACKUP_DIR/$TIMESTAMP/$DNS_REVDB_FILE $DNS_REVDB - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - # exit good to avoid re-run - exit 0 - elif [ "$SERIAL_REVDB" -ge 0 ]; then - SERIAL_REVDB_NEW=$((SERIAL_REVDB+1)) - sed -i -e "s/$SERIAL_REVDB.*;.*erial/$SERIAL_REVDB_NEW ; Serial/g" $DNS_REVDB - fi - - # reload dns - if ! $DNS_INIT reload; then - openqrm_post_event 0 "start/stop" 3 "openqrm-dns-manager" "DNS reload failed. Restoring Zones files ($TIMESTAMP)" - # restore - cp -a $BIND_BACKUP_DIR/$TIMESTAMP/$DNS_INDB_FILE $DNS_INDB - cp -a $BIND_BACKUP_DIR/$TIMESTAMP/$DNS_REVDB_FILE $DNS_REVDB - # retry restart again - $DNS_INIT stop - if ! $DNS_INIT start; then - openqrm_post_event 0 "start/stop" 3 "openqrm-dns-manager" "Failed to start DNS! Please recheck the DNS configuration!" - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - fi - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - fi - # restart name service cache daemon if installed - if [ -x /etc/init.d/nscd ]; then - /etc/init.d/nscd restart - fi - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - ;; - init) - LOCK_TIME=`openqrm_lock_queue aquire dns` - trap "openqrm_lock_queue release dns $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - dns_log openqrm-dns-manager "Initialysing bind (dns) configuration." - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/init.d/openqrm-plugin-dns init - - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - ;; - restart) - LOCK_TIME=`openqrm_lock_queue aquire dns` - trap "openqrm_lock_queue release dns $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - if ! $DNS_INIT restart; then - openqrm_post_event 0 "restart" 3 "openqrm-dns-manager" "Failed to restart DNS! Please recheck the DNS configuration!" - fi - # restart name service cache daemon if installed - if [ -x /etc/init.d/nscd ]; then - /etc/init.d/nscd restart - fi - openqrm_lock_queue release dns $LOCK_TIME - trap '' EXIT - ;; - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - dns_log openqrm-dns-manager "Usage: $0 {start|stop|init} " - exit 1 - ;; -esac diff --git a/openQRM-5.3.50-CE/src/plugins/dns/etc/init.d/openqrm-plugin-dns b/openQRM-5.3.50-CE/src/plugins/dns/etc/init.d/openqrm-plugin-dns deleted file mode 100644 index b72c401..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/etc/init.d/openqrm-plugin-dns +++ /dev/null @@ -1,261 +0,0 @@ -#!/bin/bash -# init script for the openQRM dns plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/include/openqrm-plugin-dns-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf - -function openqrm_plugin_dns_start() { - echo "Starting the openQRM dns-plugin" - openqrm_server_get_config - openqrm_plugin_dns_stop 1>/dev/null 2>&1 - if $DNS_INIT start; then - # do we want to adjust the resolv.conf ? - if [ "$OPENQRM_SERVER_ADJUST_RESOLV_CONF" == "yes" ]; then - # backup - if [ ! -f /etc/resolv.conf.openqrm-dns-plugin.backup ]; then - cp -f /etc/resolv.conf /etc/resolv.conf.openqrm-dns-plugin.backup - fi - # create new resolv.conf - echo "domain $OPENQRM_SERVER_DOMAIN" > /etc/resolv.conf - echo "search $OPENQRM_SERVER_DOMAIN $OPENQRM_SERVER_SEARCH_DOMAIN" >> /etc/resolv.conf - echo "nameserver $OPENQRM_SERVER_IP_ADDRESS" >> /etc/resolv.conf - fi - else - openqrm_post_event 0 "start" 3 "openqrm-plugin-dns" "Failed to start DNS! Please recheck the DNS configuration!" - return 1 - fi - - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/dns/.running - return $RET - -} - - -function openqrm_plugin_dns_stop() { - echo "Stopping the openQRM dns-plugin" - $DNS_INIT stop - # do we want to adjust the resolv.conf ? - if [ "$OPENQRM_SERVER_ADJUST_RESOLV_CONF" == "yes" ]; then - # restore - if [ -f /etc/resolv.conf.openqrm-dns-plugin.backup ]; then - cp -f /etc/resolv.conf.openqrm-dns-plugin.backup /etc/resolv.conf - fi - fi - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/dns/.running - return 0 -} - - -function openqrm_plugin_dns_init() { - echo "Initializing the openQRM dns-plugin" - openqrm_server_get_config - OPENQRM_SERVER_IP_LAST_BYTE=`echo $OPENQRM_SERVER_IP_ADDRESS | cut -d'.' -f 4` - OPENQRM_SERVER_IP_FIRST_BYTE=`echo $OPENQRM_SERVER_IP_ADDRESS | cut -d'.' -f1` - OPENQRM_SERVER_IP_SECOND_BYTE=`echo $OPENQRM_SERVER_IP_ADDRESS | cut -d'.' -f2` - OPENQRM_SERVER_IP_THIRD_BYTE=`echo $OPENQRM_SERVER_IP_ADDRESS | cut -d'.' -f3` - OPENQRM_SERVER_IP_FIRSTS_BYTES_REV="$OPENQRM_SERVER_IP_THIRD_BYTE.$OPENQRM_SERVER_IP_SECOND_BYTE.$OPENQRM_SERVER_IP_FIRST_BYTE" - - # take backups of an eventual existing config - if [ -f /etc/bind/named.conf.local ] && [ ! -f /etc/bind/named.conf.local.openqrm-dns-plugin.backup ]; then - cp -f /etc/bind/named.conf.local /etc/bind/named.conf.local.openqrm-dns-plugin.backup - fi - - # preparing bind config - mkdir -p /etc/bind/zones/ - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/bind/zones - - # named.conf local - cat $DNS_NAMED_LOCAL_TEMPLATE | \ - sed -e "s/@@OPENQRM_SERVER_IP_FIRSTS_BYTES_REV@@/$OPENQRM_SERVER_IP_FIRSTS_BYTES_REV/g" | \ - sed -e "s/@@OPENQRM_SERVER_DOMAIN@@/$OPENQRM_SERVER_DOMAIN/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/bind/named.conf.local - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/bind/named.conf.local /etc/bind/named.conf.local - - # in db - cat $DNS_INDB_TEMPLATE | \ - sed -e "s/@@OPENQRM_SERVER_DOMAIN@@/$OPENQRM_SERVER_DOMAIN/g" | \ - sed -e "s/@@OPENQRM_SERVER_IP_ADDRESS@@/$OPENQRM_SERVER_IP_ADDRESS/g" | \ - sed -e "s/@@OPENQRM_SERVER_IP_LAST_BYTE@@/$OPENQRM_SERVER_IP_LAST_BYTE/g" > $DNS_INDB - DNS_INDB_FSNAME=`basename $DNS_INDB` - ln -sf $DNS_INDB /etc/bind/zones/$DNS_INDB_FSNAME - - # rev db - cat $DNS_REVDB_TEMPLATE | \ - sed -e "s/@@OPENQRM_SERVER_DOMAIN@@/$OPENQRM_SERVER_DOMAIN/g" | \ - sed -e "s/@@OPENQRM_SERVER_IP_ADDRESS@@/$OPENQRM_SERVER_IP_ADDRESS/g" | \ - sed -e "s/@@OPENQRM_SERVER_IP_LAST_BYTE@@/$OPENQRM_SERVER_IP_LAST_BYTE/g" > $DNS_REVDB - DNS_REVDB_FSNAME=`basename $DNS_REVDB` - ln -sf $DNS_REVDB /etc/bind/zones/$DNS_REVDB_FSNAME - - # check if we have forwarders already - NAMED_OPTIONS_EXIST=true - if [ -f /etc/redhat-release ]; then - touch /etc/bind/named.conf.options - NAMED_OPTIONS_EXIST=false - fi - CONFIGURED_DNS_FORWARDERS=`cat /etc/bind/named.conf.options | grep -v "//" | grep -A2 forwarders | grep -v forwarders | grep -v "}" | head -n1 | awk {' print $1 '} | sed -e "s/;//g"` - if [ "$CONFIGURED_DNS_FORWARDERS" != "" ] && openqrm_validate_ip $CONFIGURED_DNS_FORWARDERS; then - echo "NOTICE: Found already configured dns-forwarders $CONFIGURED_DNS_FORWARDERS" - else - if [ -f /etc/resolv.conf.openqrm-dns-plugin.backup ]; then - CHECK_FOR_FORWARDERS="/etc/resolv.conf.openqrm-dns-plugin.backup" - else - CHECK_FOR_FORWARDERS="/etc/resolv.conf" - fi - DNS_FORWARDER=`cat $CHECK_FOR_FORWARDERS | grep -v ^# | grep nameserver | head -n1 | awk {' print $2 '}` - if [ "$DNS_FORWARDER" != "" ] && openqrm_validate_ip $DNS_FORWARDER; then - echo "NOTICE: Configuring dns-forwarder to $DNS_FORWARDER" - if [ ! -f /etc/bind/named.conf.options.openqrm-dns-plugin.backup ]; then - cp -f /etc/bind/named.conf.options /etc/bind/named.conf.options.openqrm-dns-plugin.backup - fi - rm -f /etc/bind/named.conf.options.new - if [ "$NAMED_OPTIONS_EXIST" == "false" ]; then - echo "options {" >> /etc/bind/named.conf.options.new - fi - cat /etc/bind/named.conf.options | grep -v "^};" >> /etc/bind/named.conf.options.new - echo " forwarders {" >> /etc/bind/named.conf.options.new - echo " $DNS_FORWARDER;" >> /etc/bind/named.conf.options.new - echo " };" >> /etc/bind/named.conf.options.new - echo "};" >> /etc/bind/named.conf.options.new - mv -f /etc/bind/named.conf.options.new /etc/bind/named.conf.options - else - openqrm_post_event 0 "init" 3 "openqrm-plugin-dns" "Could not find out any dns-forwarders! Please configure manually in /etc/bind/named.conf.options" - fi - fi - # link the named.conf file to /etc on redhat based systems - if [ -f /etc/redhat-release ]; then - if [ -f /etc/named.conf ]; then - mv -f /etc/named.conf /etc/named.conf.openqrm-backup - fi - ln -sf /etc/bind/named.conf.local /etc/named.conf - # include options - echo 'include "/etc/bind/named.conf.options";' >> /etc/bind/named.conf.local - elif [ -f /etc/SuSE-release ]; then - # chroot is not supported yet - sed -i -e 's/NAMED_RUN_CHROOTED.*/NAMED_RUN_CHROOTED="no"/g' /etc/sysconfig/named - if [ -f /etc/named.conf.include ]; then - /bin/cp -f /etc/named.conf.include /etc/named.conf.include.openqrm-backup - fi -cat >> /etc/named.conf.include << EOF -include "/etc/bind/named.conf.local"; -EOF - fi - - # enable apparmor if needed - if [ -f /etc/apparmor.d/usr.sbin.named ]; then - if ! grep openQRM /etc/apparmor.d/usr.sbin.named 1>/dev/null; then - sed -i -e "s#^}##g" /etc/apparmor.d/usr.sbin.named - echo " # openQRM" >> /etc/apparmor.d/usr.sbin.named - echo " $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/** rw," >> /etc/apparmor.d/usr.sbin.named - if [ -d /etc/openqrm/plugins/dhcpd/ ]; then - echo " /etc/openqrm/plugins/dns/** rw," >> /etc/apparmor.d/usr.sbin.named - fi - echo "}" >> /etc/apparmor.d/usr.sbin.named - echo >> /etc/apparmor.d/usr.sbin.named - if [ -x "/etc/init.d/apparmor" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d apparmor reload - else - /etc/init.d/apparmor reload - fi - fi - fi - fi - - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/dns - - return 0 -} - - -function openqrm_plugin_dns_uninstall() { - echo "Uninstalling the openQRM dns-plugin" - openqrm_plugin_dns_stop - - # cleaning up + restore bind config - rm -f /etc/bind/zones/$OPENQRM_SERVER_DOMAIN.*.db - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/dns/etc/bind/zones/$OPENQRM_SERVER_DOMAIN-*.db - - # restore eventual existing config - if [ -f /etc/bind/named.conf.local.openqrm-dns-plugin.backup ]; then - rm -f /etc/bind/named.conf.local - cp -f /etc/bind/named.conf.local.openqrm-dns-plugin.backup /etc/bind/named.conf.local - fi - if [ -f /etc/bind/named.conf.options.openqrm-dns-plugin.backup ]; then - cp -f /etc/bind/named.conf.options.openqrm-dns-plugin.backup /etc/bind/named.conf.options - fi - - # unlink the named.conf file to /etc on redhat based systems - if [ -f /etc/redhat-release ]; then - if [ -f /etc/named.conf.openqrm-backup ]; then - mv -f /etc/named.conf.openqrm-backup /etc/named.conf - fi - rm -f /etc/bind/named.conf.options - elif [ -f /etc/SuSE-release ]; then - if [ -f /etc/named.conf.include.openqrm-backup ]; then - /bin/cp -f /etc/named.conf.include.openqrm-backup /etc/named.conf.include - fi - fi - - # remove apparmor setup - if [ -f /etc/apparmor.d/usr.sbin.named ]; then - sed -i -e "s#.*openQRM.*##g" /etc/apparmor.d/usr.sbin.named - sed -i -e "s#.*openqrm.*##g" /etc/apparmor.d/usr.sbin.named - if [ -x "/etc/init.d/apparmor" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d apparmor reload - else - /etc/init.d/apparmor reload - fi - fi - fi - - # unlinking the web dir - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/dns -} - - - -case "$1" in - start) - openqrm_plugin_dns_start - ;; - stop) - openqrm_plugin_dns_stop - ;; - restart) - openqrm_plugin_dns_stop - sleep 1 - openqrm_plugin_dns_start - ;; - init) - openqrm_plugin_dns_init - ;; - uninstall) - openqrm_plugin_dns_uninstall - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - diff --git a/openQRM-5.3.50-CE/src/plugins/dns/etc/init.d/openqrm-plugin-dns.postinstall b/openQRM-5.3.50-CE/src/plugins/dns/etc/init.d/openqrm-plugin-dns.postinstall deleted file mode 100644 index d16cd53..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/etc/init.d/openqrm-plugin-dns.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-dns postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/dns/etc/init.d/openqrm-plugin-dns.preremove b/openQRM-5.3.50-CE/src/plugins/dns/etc/init.d/openqrm-plugin-dns.preremove deleted file mode 100644 index 428377a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/etc/init.d/openqrm-plugin-dns.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-dns preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-dns stop \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/plugins/dns/etc/openqrm-plugin-dns.conf b/openQRM-5.3.50-CE/src/plugins/dns/etc/openqrm-plugin-dns.conf deleted file mode 100644 index 8f29211..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/etc/openqrm-plugin-dns.conf +++ /dev/null @@ -1,49 +0,0 @@ -# this is the openQRM-plugin-dns info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="bind9, openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="bind, openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="bind, openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Automatically manage the DNS Service for the openQRM managed network." -OPENQRM_PLUGIN_TYPE="network" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/bind/named.conf.local $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf" -# dirs which should be taken to the state backup -OPENQRM_PLUGIN_STATE_DIRS="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/bind/zones" - -# please configure your domain name for the openQRM network here ! -OPENQRM_SERVER_DOMAIN="oqnet.org" - -# plese configure your domain search path for the openQRM network here ! -OPENQRM_SERVER_SEARCH_DOMAIN="" - -# please configure if the plugin should automatically adjust the /etc/resolv.conf of this server -OPENQRM_SERVER_ADJUST_RESOLV_CONF="yes" - diff --git a/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-custom-indb.template b/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-custom-indb.template deleted file mode 100644 index f53b92c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-custom-indb.template +++ /dev/null @@ -1,17 +0,0 @@ -; -; BIND data file -; -$TTL 604800 -@ IN SOA ns.@@OPENQRM_SERVER_DOMAIN@@. root.@@OPENQRM_SERVER_DOMAIN@@. ( - 1 ; Serial - 604800 ; Refresh - 86400 ; Retry - 2419200 ; Expire - 604800 ) ; Negative Cache TTL -; - -@@OPENQRM_SERVER_DOMAIN@@. IN NS ns.@@OPENQRM_SERVER_DOMAIN@@. -@@OPENQRM_SERVER_DOMAIN@@. IN MX 10 ns.@@OPENQRM_SERVER_DOMAIN@@. - -ns IN A @@OPENQRM_SERVER_IP_ADDRESS@@ -openqrm IN A @@OPENQRM_SERVER_IP_ADDRESS@@ diff --git a/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-custom-revdb.template b/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-custom-revdb.template deleted file mode 100644 index 1bd98f5..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-custom-revdb.template +++ /dev/null @@ -1,16 +0,0 @@ -; -; BIND reverse data file -; -$TTL 604800 -@ IN SOA ns.@@OPENQRM_SERVER_DOMAIN@@. root.@@OPENQRM_SERVER_DOMAIN@@. ( - 1 ; Serial - 604800 ; Refresh - 86400 ; Retry - 2419200 ; Expire - 604800 ) ; Negative Cache TTL -; - - IN NS ns.@@OPENQRM_SERVER_DOMAIN@@. - -@@OPENQRM_SERVER_IP_LAST_BYTE@@ IN PTR ns -@@OPENQRM_SERVER_IP_LAST_BYTE@@ IN PTR openqrm diff --git a/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-indb.template b/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-indb.template deleted file mode 100644 index 43c24e7..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-indb.template +++ /dev/null @@ -1,18 +0,0 @@ -; -; BIND data file -; -$TTL 604800 -@ IN SOA ns.@@OPENQRM_SERVER_DOMAIN@@. root.@@OPENQRM_SERVER_DOMAIN@@. ( - 1 ; Serial - 604800 ; Refresh - 86400 ; Retry - 2419200 ; Expire - 604800 ) ; Negative Cache TTL -; - -@@OPENQRM_SERVER_DOMAIN@@. IN NS ns.@@OPENQRM_SERVER_DOMAIN@@. -@@OPENQRM_SERVER_DOMAIN@@. IN MX 10 ns.@@OPENQRM_SERVER_DOMAIN@@. - -ns IN A @@OPENQRM_SERVER_IP_ADDRESS@@ -openqrm IN A @@OPENQRM_SERVER_IP_ADDRESS@@ -puppet CNAME openqrm diff --git a/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-named-local.template b/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-named-local.template deleted file mode 100644 index 7b38352..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-named-local.template +++ /dev/null @@ -1,10 +0,0 @@ - -zone "@@OPENQRM_SERVER_DOMAIN@@" IN { - type master; - file "/etc/bind/zones/@@OPENQRM_SERVER_DOMAIN@@.in.db"; -}; - -zone "@@OPENQRM_SERVER_IP_FIRSTS_BYTES_REV@@.in-addr.arpa" { - type master; - file "/etc/bind/zones/@@OPENQRM_SERVER_DOMAIN@@.rev.db"; -}; diff --git a/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-revdb.template b/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-revdb.template deleted file mode 100644 index 1bd98f5..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/etc/templates/openqrm-plugin-dns-revdb.template +++ /dev/null @@ -1,16 +0,0 @@ -; -; BIND reverse data file -; -$TTL 604800 -@ IN SOA ns.@@OPENQRM_SERVER_DOMAIN@@. root.@@OPENQRM_SERVER_DOMAIN@@. ( - 1 ; Serial - 604800 ; Refresh - 86400 ; Retry - 2419200 ; Expire - 604800 ) ; Negative Cache TTL -; - - IN NS ns.@@OPENQRM_SERVER_DOMAIN@@. - -@@OPENQRM_SERVER_IP_LAST_BYTE@@ IN PTR ns -@@OPENQRM_SERVER_IP_LAST_BYTE@@ IN PTR openqrm diff --git a/openQRM-5.3.50-CE/src/plugins/dns/include/openqrm-plugin-dns-functions b/openQRM-5.3.50-CE/src/plugins/dns/include/openqrm-plugin-dns-functions deleted file mode 100644 index 595b1b3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/include/openqrm-plugin-dns-functions +++ /dev/null @@ -1,240 +0,0 @@ -#!/bin/bash -# this is the functions file for the dns-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# where is the init script ? -if [ -f /etc/debian_version ]; then - DNS_INIT="/etc/init.d/bind9" -elif [ -f /etc/redhat-release ]; then - DNS_INIT="/etc/init.d/named" -elif [ -f /etc/SuSE-release ]; then - DNS_INIT="/etc/init.d/named" -fi -# source the config to get the domain name for the openQRM-network -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf -export OPENQRM_SERVER_DOMAIN -# the location of the tempaltes and db files -DNS_NAMED_LOCAL_TEMPLATE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/templates/openqrm-plugin-dns-named-local.template" -DNS_INDB_TEMPLATE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/templates/openqrm-plugin-dns-indb.template" -DNS_REVDB_TEMPLATE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/templates/openqrm-plugin-dns-revdb.template" -DNS_INDB="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/bind/zones/$OPENQRM_SERVER_DOMAIN.in.db" -DNS_REVDB="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/bind/zones/$OPENQRM_SERVER_DOMAIN.rev.db" - -DNS_NAMED_CONF_LOCAL="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/bind/named.conf.local" - -DNS_CUSTOM_ZONES_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/bind/zones/custom" -DNS_CUSTOM_INDB_TEMPLATE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/templates/openqrm-plugin-dns-custom-indb.template" -DNS_CUSTOM_REVDB_TEMPLATE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/templates/openqrm-plugin-dns-custom-revdb.template" - -if [ ! -d $DNS_CUSTOM_ZONES_DIR ]; then - mkdir -p $DNS_CUSTOM_ZONES_DIR -fi -if [ ! -d /etc/bind/zones/custom ]; then - mkdir -p /etc/bind/zones/custom -fi - - -# logs for dns -function dns_log() { - local COMPONENT=$1 - shift - local MESSAGE=$@ - logger -i -t "dns plug-in" "$COMPONENT : $MESSAGE" -} - - - - -# functions for custom networks # - - -function dns_create_domain() { - local DOMAIN_NAME=$1 - local NS_IP=$2 - local NS_IP_LAST_BYTE=`echo $NS_IP | cut -d'.' -f 4` - local NS_IP_FIRST_BYTE=`echo $NS_IP | cut -d'.' -f1` - local NS_IP_SECOND_BYTE=`echo $NS_IP | cut -d'.' -f2` - local NS_IP_THIRD_BYTE=`echo $NS_IP | cut -d'.' -f3` - local NS_IP_FIRSTS_BYTES_REV="$NS_IP_THIRD_BYTE.$NS_IP_SECOND_BYTE.$NS_IP_FIRST_BYTE" - - # indb - CUSTOM_INDB_FULL_PATH="$DNS_CUSTOM_ZONES_DIR/$DOMAIN_NAME.in.db" - cat $DNS_CUSTOM_INDB_TEMPLATE | \ - sed -e "s/@@OPENQRM_SERVER_DOMAIN@@/$DOMAIN_NAME/g" | \ - sed -e "s/@@OPENQRM_SERVER_IP_ADDRESS@@/$NS_IP/g" | \ - sed -e "s/@@OPENQRM_SERVER_IP_LAST_BYTE@@/$NS_IP_LAST_BYTE/g" > $CUSTOM_INDB_FULL_PATH - - CUSTOM_INDB_FILE=`basename $CUSTOM_INDB_FULL_PATH` - ln -sf $CUSTOM_INDB_FULL_PATH /etc/bind/zones/custom/$CUSTOM_INDB_FILE - - # revdb - CUSTOM_REVDB_FULL_PATH="$DNS_CUSTOM_ZONES_DIR/$DOMAIN_NAME.rev.db" - cat $DNS_CUSTOM_REVDB_TEMPLATE | \ - sed -e "s/@@OPENQRM_SERVER_DOMAIN@@/$DOMAIN_NAME/g" | \ - sed -e "s/@@OPENQRM_SERVER_IP_ADDRESS@@/$NS_IP/g" | \ - sed -e "s/@@OPENQRM_SERVER_IP_LAST_BYTE@@/$NS_IP_LAST_BYTE/g" > $CUSTOM_REVDB_FULL_PATH - - CUSTOM_REVDB_FILE=`basename $CUSTOM_REVDB_FULL_PATH` - ln -sf $CUSTOM_REVDB_FULL_PATH /etc/bind/zones/custom/$CUSTOM_REVDB_FILE - - # add to named.conf.local - echo "zone \"$DOMAIN_NAME\" IN {" >> $DNS_NAMED_CONF_LOCAL - echo " type master;" >> $DNS_NAMED_CONF_LOCAL - echo " file \"/etc/bind/zones/custom/$CUSTOM_INDB_FILE\";" >> $DNS_NAMED_CONF_LOCAL - echo "};" >> $DNS_NAMED_CONF_LOCAL - echo "zone \"$NS_IP_FIRSTS_BYTES_REV.in-addr.arpa\" {" >> $DNS_NAMED_CONF_LOCAL - echo " type master;" >> $DNS_NAMED_CONF_LOCAL - echo " file \"/etc/bind/zones/custom/$CUSTOM_REVDB_FILE\";" >> $DNS_NAMED_CONF_LOCAL - echo "};" >> $DNS_NAMED_CONF_LOCAL - -} - - - - -function dns_remove_domain() { - local DOMAIN_NAME=$1 - local NS_IP=$2 - local NS_IP_LAST_BYTE=`echo $NS_IP | cut -d'.' -f 4` - local NS_IP_FIRST_BYTE=`echo $NS_IP | cut -d'.' -f1` - local NS_IP_SECOND_BYTE=`echo $NS_IP | cut -d'.' -f2` - local NS_IP_THIRD_BYTE=`echo $NS_IP | cut -d'.' -f3` - local NS_IP_FIRSTS_BYTES_REV="$NS_IP_THIRD_BYTE.$NS_IP_SECOND_BYTE.$NS_IP_FIRST_BYTE" - - # remove from named.conf.local - sed -i -e "/\"$DOMAIN_NAME\" IN/,+3d" $DNS_NAMED_CONF_LOCAL - sed -i -e "/\"$NS_IP_FIRSTS_BYTES_REV.in-addr.arpa\"/,+3d" $DNS_NAMED_CONF_LOCAL - - # indb - CUSTOM_INDB_FULL_PATH="$DNS_CUSTOM_ZONES_DIR/$DOMAIN_NAME.in.db" - CUSTOM_INDB_FILE=`basename $CUSTOM_INDB_FULL_PATH` - rm -f $CUSTOM_INDB_FULL_PATH /etc/bind/zones/custom/$CUSTOM_INDB_FILE - - # revdb - CUSTOM_REVDB_FULL_PATH="$DNS_CUSTOM_ZONES_DIR/$DOMAIN_NAME.rev.db" - CUSTOM_REVDB_FILE=`basename $CUSTOM_REVDB_FULL_PATH` - rm -f $CUSTOM_REVDB_FULL_PATH /etc/bind/zones/custom/$CUSTOM_REVDB_FILE - -} - - - - -function dns_domain_manage_host() { - local MANAGE_CMD=$1 - local DOMAIN_NAME=$2 - local HOST_IP=$3 - local HOST_NAME=$4 - local HOST_IP_LAST_BYTE=`echo $HOST_IP | cut -d'.' -f 4` - local HOST_IP_FIRST_BYTE=`echo $HOST_IP | cut -d'.' -f1` - local HOST_IP_SECOND_BYTE=`echo $HOST_IP | cut -d'.' -f2` - local HOST_IP_THIRD_BYTE=`echo $HOST_IP | cut -d'.' -f3` - local HOST_IP_FIRSTS_BYTES_REV="$HOST_IP_THIRD_BYTE.$HOST_IP_SECOND_BYTE.$HOST_IP_FIRST_BYTE" - - # indb - CUSTOM_INDB_FULL_PATH="$DNS_CUSTOM_ZONES_DIR/$DOMAIN_NAME.in.db" - cat $CUSTOM_INDB_FULL_PATH | grep -v -w $HOST_IP > $CUSTOM_INDB_FULL_PATH.tmp - mv -f $CUSTOM_INDB_FULL_PATH.tmp $CUSTOM_INDB_FULL_PATH - - # revdb - CUSTOM_REVDB_FULL_PATH="$DNS_CUSTOM_ZONES_DIR/$DOMAIN_NAME.rev.db" - cat $CUSTOM_REVDB_FULL_PATH | grep -v -w ^$HOST_IP_LAST_BYTE > $CUSTOM_REVDB_FULL_PATH.tmp - mv -f $CUSTOM_REVDB_FULL_PATH.tmp $CUSTOM_REVDB_FULL_PATH - - if [ "$MANAGE_CMD" == "add" ]; then - echo "$HOST_NAME IN A $HOST_IP" >> $CUSTOM_INDB_FULL_PATH - echo "$HOST_IP_LAST_BYTE IN PTR $HOST_NAME.$DOMAIN_NAME." >> $CUSTOM_REVDB_FULL_PATH - fi - - if ! dns_update_serial $CUSTOM_INDB_FULL_PATH; then - return 1 - fi - if ! dns_update_serial $CUSTOM_REVDB_FULL_PATH; then - return 1 - fi - -} - - - - - - - - -function dns_reload() { - local LAST_BACKUP_TIMESTAMP=$1 - if ! $DNS_INIT reload; then - # restore - dns_zone_restore $LAST_BACKUP_TIMESTAMP - # retry restart again - $DNS_INIT stop - if ! $DNS_INIT start; then - return 1 - fi - fi - # restart name service cache daemon if installed - if [ -x /etc/init.d/nscd ]; then - /etc/init.d/nscd restart - fi - return 0 -} - - -function dns_zone_backup() { - TIMESTAMP=`date +%s` - mkdir -p $BIND_BACKUP_DIR/$TIMESTAMP - cp -a $DNS_CUSTOM_ZONES_DIR/* $BIND_BACKUP_DIR/$TIMESTAMP/ 2>/dev/null - echo $TIMESTAMP -} - - -function dns_remove_zone_backup() { - local LAST_BACKUP_TIMESTAMP=$1 - if [ "$LAST_BACKUP_TIMESTAMP" == "" ]; then - return - fi - if [ -d $BIND_BACKUP_DIR/$LAST_BACKUP_TIMESTAMP ]; then - rm -f $BIND_BACKUP_DIR/$LAST_BACKUP_TIMESTAMP/* - rmdir $BIND_BACKUP_DIR/$LAST_BACKUP_TIMESTAMP - fi -} - - -function dns_zone_restore() { - local LAST_BACKUP_TIMESTAMP=$1 - if [ "$LAST_BACKUP_TIMESTAMP" == "" ]; then - return - fi - cp -a $BIND_BACKUP_DIR/$LAST_BACKUP_TIMESTAMP/* $DNS_CUSTOM_ZONES_DIR/ -} - - - -function dns_update_serial() { - local ZONE_FILE=$1 - if [ ! -e $ZONE_FILE ]; then - return 1 - fi - SERIAL_NO="`cat $ZONE_FILE | grep -i ';.*erial' | awk '{print $1}'`" - if [ "$SERIAL_NO" == "" ]; then - return 1 - elif [ "$SERIAL_NO" -ge 0 ]; then - SERIAL_NO_NEW=$((SERIAL_NO+1)) - sed -i -e "s/$SERIAL_NO.*;.*erial/$SERIAL_NO_NEW ; Serial/g" $ZONE_FILE - return 0 - fi -} diff --git a/openQRM-5.3.50-CE/src/plugins/dns/web/class/dns-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/dns/web/class/dns-about.controller.class.php deleted file mode 100644 index ea018a9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/web/class/dns-about.controller.class.php +++ /dev/null @@ -1,279 +0,0 @@ - - */ - -class dns_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'dns_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'dns_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'dns_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'dns_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About DNS', - 'label' => 'About DNS', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The dns-plugin automatically manages ip-address to hostname resolving via bind/named for the entire openQRM network. - It configures the hostname/ip entries for the dns database and reloads the name-sever during start/stop of an appliance. - The hostnames are automatically set to the appliance name with the ip address of the appliance-resource. - An automatic configured DNS-server is provided by this plugin. - No manual configuration is needed. It automatically configures a DNS server during initialization with the domain name configured in:', - - 'requirements_title' => 'Requirements', - 'requirements_list' => '
  • none
  • ', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - 'provides_title' => 'Provides', - 'provides_list' => '
  • Automatically manages ip-address to hostname resolving in the openQRM Management network
  • ', - 'type_title' => 'Plugin Type', - 'type_content' => 'Network', - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - ), - 'usage' => array ( - 'tab' => 'About DNS', - 'label' => 'DNS Use-Cases', - ), - -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/dns/lang", 'dns-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/dns/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "documentation"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - case 'bootservice': - $content[] = $this->bootservice(true); - break; - case 'vms': - $content[] = $this->vms(true); - break; - case 'usage': - $content[] = $this->usage(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About DNS - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/dns/class/dns-about.documentation.class.php'); - $controller = new dns_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Boot-Service - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function bootservice( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/dns/class/dns-about.bootservice.class.php'); - $controller = new dns_about_bootservice($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['bootservice']; - $data = $controller->action(); - } - $content['label'] = $this->lang['bootservice']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'bootservice' ); - $content['onclick'] = false; - if($this->action === 'bootservice'){ - $content['active'] = true; - } - return $content; - } - - - - - //-------------------------------------------- - /** - * About DNS VM management - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function vms( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/dns/class/dns-about.vms.class.php'); - $controller = new dns_about_vms($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['vms']; - $data = $controller->action(); - } - $content['label'] = $this->lang['vms']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'vms' ); - $content['onclick'] = false; - if($this->action === 'vms'){ - $content['active'] = true; - } - return $content; - } - - - - //-------------------------------------------- - /** - * About DNS Use-Cases - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function usage( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/dns/class/dns-about.usage.class.php'); - $controller = new dns_about_usage($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['usage']; - $data = $controller->action(); - } - $content['label'] = $this->lang['usage']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'usage' ); - $content['onclick'] = false; - if($this->action === 'usage'){ - $content['active'] = true; - } - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/dns/web/class/dns-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/dns/web/class/dns-about.documentation.class.php deleted file mode 100644 index d066b35..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/web/class/dns-about.documentation.class.php +++ /dev/null @@ -1,90 +0,0 @@ - - */ - -class dns_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'dns_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "dns_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/dns-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->basedir."/plugins/dns/etc/openqrm-plugin-dns.conf", 'config_file'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/dns/web/css/dns.css b/openQRM-5.3.50-CE/src/plugins/dns/web/css/dns.css deleted file mode 100644 index 5cedb54..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/web/css/dns.css +++ /dev/null @@ -1,16 +0,0 @@ -/*-Icon classes ----- */ -a.graphs { - padding: 0; - border: 0px none; - width: 32px; - height: 32px; - display:block; - text-align: center; - text-decoration: none; - line-height: 0px; - overflow: hidden; - color: transparent; -} -a.graphs { - background: url('/openqrm/base/plugins/dns/img/plugin.png') no-repeat center top; -} diff --git a/openQRM-5.3.50-CE/src/plugins/dns/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/dns/web/img/plugin.png deleted file mode 100644 index d1c5696..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/dns/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/dns/web/lang/de.dns-about.ini b/openQRM-5.3.50-CE/src/plugins/dns/web/lang/de.dns-about.ini deleted file mode 100644 index 6eafa95..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/web/lang/de.dns-about.ini +++ /dev/null @@ -1,26 +0,0 @@ -[documentation] -tab = "Über DNS" -label = "Über DNS" -introduction_title = "Einleitung" -introduction_content = "

    Das 'DNS'-Plugin verwaltet automtisch die IP-Adressen und Hostname-Zuordnung im openQRM-Verwaltungsnetzwerk. - Es konfiguriert die Hostnamen und IP-Adressn der DNS-Datenbank automatisch mittels des Appliance-Start/Stop-Hooks. Die Hostnamen werden dabei auf den Server Namen gesetzt und mit der IP-Addresse der jeweiligen Resource verbunden. Ein automatisch konfigurierter DNS Server wird von diesem Plugin bereitgestellt.

    -

    Manuelle Konfiguration ist nicht nötig. Das Plugin erzeugt automatisch eine valide DNS-Konfiguration für die Domain die in der Konfigurationsdatei des Plugin konfiguriert ist. Die Konfigurationsdatei des DNS-Plugins finden Sie unter:

    " - -requirements_title = "Anforderungen" -requirements_list = "keine" -tested_title = "getestet mit" -tested_content = "Dieses Plugin ist getestet mit Debian, Ubuntu und CentOS" - -provides_title = "Bietet" -provides_list = "Automatische Vergabe von IP-Adressen sowie Hostname-Zuordnung für das openQRM-Verwaltungsnetzwerk" - -type_title = "Plugin Typ" -type_content = "Netzwerk" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" - - -[usage] -tab = "Über DNS" -label = "DNS-Anwendungsfälle" diff --git a/openQRM-5.3.50-CE/src/plugins/dns/web/lang/en.dns-about.ini b/openQRM-5.3.50-CE/src/plugins/dns/web/lang/en.dns-about.ini deleted file mode 100644 index e872b93..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/web/lang/en.dns-about.ini +++ /dev/null @@ -1,21 +0,0 @@ -[documentation] -tab = "About DNS" -label = "About DNS" -introduction_title = "Introduction" -introduction_content = "

    The dns plugin automatically manages ip address to hostname resolving via bind/named for the entire openQRM network. It configures the hostname/ip entries for the dns database and reloads the name sever during start/stop of a server. The hostnames are automatically set to the server name with the ip address of the server resource. An automatic configured dns Server is provided by this plugin.

    -

    No manual configuration is needed. It automatically configures a DNS Server during initialization with the domain name configured in:

    " - -requirements_title = "Requirements" -requirements_list = "none" -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS." -provides_title = "Provides" -provides_list = "Automatically manages ip address to hostname resolving in the openQRM management network" -type_title = "Plugin type" -type_content = "Network" -documentation_title = "Documentation" -use_case_title = "Use case" - -[usage] -tab = "About DNS" -label = "DNS use cases" diff --git a/openQRM-5.3.50-CE/src/plugins/dns/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/dns/web/menu.txt deleted file mode 100644 index 636feee..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/web/menu.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|DNS|index.php?plugin=dns&controller=dns-about|How to use diff --git a/openQRM-5.3.50-CE/src/plugins/dns/web/openqrm-dns-appliance-hook.php b/openQRM-5.3.50-CE/src/plugins/dns/web/openqrm-dns-appliance-hook.php deleted file mode 100644 index 84a984b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/web/openqrm-dns-appliance-hook.php +++ /dev/null @@ -1,64 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $OPENQRM_SERVER_IP_ADDRESS; -$event = new event(); -global $event; - - - -function openqrm_dns_appliance($cmd, $appliance_fields) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $appliance_id=$appliance_fields["appliance_id"]; - $appliance_name=$appliance_fields["appliance_name"]; - $resource = new resource(); - $resource->get_instance_by_id($appliance_fields["appliance_resources"]); - $appliance_ip=$resource->ip; - if (($resource->id == "-1") || ($resource->id == "")) { - return; - } - - - $event->log("openqrm_new_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dns-appliance-hook.php", "Handling $cmd event $appliance_id/$appliance_name/$appliance_ip", "", "", 0, 0, $appliance_id); - switch($cmd) { - case "start": - $openqrm_server = new openqrm_server(); - $openqrm_server->send_command("$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/bin/openqrm-dns-manager start ".$appliance_id." ".$appliance_name." ".$appliance_ip." --openqrm-cmd-mode background"); - break; - case "stop": - $openqrm_server = new openqrm_server(); - $openqrm_server->send_command("$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/bin/openqrm-dns-manager stop ".$appliance_id." ".$appliance_name." ".$appliance_ip." --openqrm-cmd-mode background"); - break; - - } -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/dns/web/tpl/dns-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/dns/web/tpl/dns-about-documentation.tpl.php deleted file mode 100644 index eae8bb2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/dns/web/tpl/dns-about-documentation.tpl.php +++ /dev/null @@ -1,43 +0,0 @@ - -

    {label}

    - -
    -
    -

    {introduction_title}

    - {introduction_content} -
    {config_file}
    - -

    {provides_title}

    - {provides_list} - -

    {requirements_title}

    - {requirements_list} -
    - - -
    -

    {type_title}

    - {type_content} - -

    {tested_title}

    - {tested_content} -
    -
    - - - diff --git a/openQRM-5.3.50-CE/src/plugins/docker/Makefile b/openQRM-5.3.50-CE/src/plugins/docker/Makefile deleted file mode 100644 index 492b1bd..0000000 --- a/openQRM-5.3.50-CE/src/plugins/docker/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/docker/etc - cp etc/openqrm-plugin-docker.conf /usr/share/openqrm/plugins/docker/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/docker/etc/openqrm-plugin-docker.conf b/openQRM-5.3.50-CE/src/plugins/docker/etc/openqrm-plugin-docker.conf deleted file mode 100644 index 8665c75..0000000 --- a/openQRM-5.3.50-CE/src/plugins/docker/etc/openqrm-plugin-docker.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Adminstration Web UI to manage Docker container.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="virtualization" diff --git a/openQRM-5.3.50-CE/src/plugins/esxinstall/Makefile b/openQRM-5.3.50-CE/src/plugins/esxinstall/Makefile deleted file mode 100644 index 33ca121..0000000 --- a/openQRM-5.3.50-CE/src/plugins/esxinstall/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/esxinstall/etc - cp etc/openqrm-plugin-esxinstall.conf /usr/share/openqrm/plugins/esxinstall/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/esxinstall/etc/openqrm-plugin-esxinstall.conf b/openQRM-5.3.50-CE/src/plugins/esxinstall/etc/openqrm-plugin-esxinstall.conf deleted file mode 100644 index c8e7f2b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/esxinstall/etc/openqrm-plugin-esxinstall.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Fully automated VMWare ESX installations for bare-metal systems.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="deployment" diff --git a/openQRM-5.3.50-CE/src/plugins/event-mailer/Makefile b/openQRM-5.3.50-CE/src/plugins/event-mailer/Makefile deleted file mode 100644 index d62a755..0000000 --- a/openQRM-5.3.50-CE/src/plugins/event-mailer/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/event-mailer/etc - cp etc/openqrm-plugin-event-mailer.conf /usr/share/openqrm/plugins/event-mailer/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/event-mailer/etc/openqrm-plugin-event-mailer.conf b/openQRM-5.3.50-CE/src/plugins/event-mailer/etc/openqrm-plugin-event-mailer.conf deleted file mode 100644 index e97e352..0000000 --- a/openQRM-5.3.50-CE/src/plugins/event-mailer/etc/openqrm-plugin-event-mailer.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Configure Event mails.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="management" diff --git a/openQRM-5.3.50-CE/src/plugins/fai/Makefile b/openQRM-5.3.50-CE/src/plugins/fai/Makefile deleted file mode 100644 index 972f424..0000000 --- a/openQRM-5.3.50-CE/src/plugins/fai/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/fai/etc - cp etc/openqrm-plugin-fai.conf /usr/share/openqrm/plugins/fai/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/fai/etc/openqrm-plugin-fai.conf b/openQRM-5.3.50-CE/src/plugins/fai/etc/openqrm-plugin-fai.conf deleted file mode 100644 index 6509714..0000000 --- a/openQRM-5.3.50-CE/src/plugins/fai/etc/openqrm-plugin-fai.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Integrates FAI Install Server for automatic Linux deployments (local-deployment).
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="deployment" diff --git a/openQRM-5.3.50-CE/src/plugins/highavailability/Makefile b/openQRM-5.3.50-CE/src/plugins/highavailability/Makefile deleted file mode 100644 index b241d12..0000000 --- a/openQRM-5.3.50-CE/src/plugins/highavailability/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/highavailability/etc - cp etc/openqrm-plugin-highavailability.conf /usr/share/openqrm/plugins/highavailability/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/highavailability/etc/openqrm-plugin-highavailability.conf b/openQRM-5.3.50-CE/src/plugins/highavailability/etc/openqrm-plugin-highavailability.conf deleted file mode 100644 index dca5f63..0000000 --- a/openQRM-5.3.50-CE/src/plugins/highavailability/etc/openqrm-plugin-highavailability.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Automatic Highavailability for Appliances.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="HA" diff --git a/openQRM-5.3.50-CE/src/plugins/hybrid-cloud/Makefile b/openQRM-5.3.50-CE/src/plugins/hybrid-cloud/Makefile deleted file mode 100644 index 9ba9235..0000000 --- a/openQRM-5.3.50-CE/src/plugins/hybrid-cloud/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/hybrid-cloud/etc - cp etc/openqrm-plugin-hybrid-cloud.conf /usr/share/openqrm/plugins/hybrid-cloud/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/hybrid-cloud/etc/openqrm-plugin-hybrid-cloud.conf b/openQRM-5.3.50-CE/src/plugins/hybrid-cloud/etc/openqrm-plugin-hybrid-cloud.conf deleted file mode 100644 index 837102c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/hybrid-cloud/etc/openqrm-plugin-hybrid-cloud.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Hybrid Cloud Computing with Amazon Public Cloud, Ubuntu Enterprise Cloud and Eucalyptus.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="cloud" diff --git a/openQRM-5.3.50-CE/src/plugins/hyperv/Makefile b/openQRM-5.3.50-CE/src/plugins/hyperv/Makefile deleted file mode 100644 index f13412f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/hyperv/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/hyperv/etc - cp etc/openqrm-plugin-hyperv.conf /usr/share/openqrm/plugins/hyperv/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/hyperv/etc/openqrm-plugin-hyperv.conf b/openQRM-5.3.50-CE/src/plugins/hyperv/etc/openqrm-plugin-hyperv.conf deleted file mode 100644 index 5ebc652..0000000 --- a/openQRM-5.3.50-CE/src/plugins/hyperv/etc/openqrm-plugin-hyperv.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Integrates the Hyper-V Virtualization Technology.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="virtualization" diff --git a/openQRM-5.3.50-CE/src/plugins/idoit/Makefile b/openQRM-5.3.50-CE/src/plugins/idoit/Makefile deleted file mode 100644 index eb328ce..0000000 --- a/openQRM-5.3.50-CE/src/plugins/idoit/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/idoit/etc - cp etc/openqrm-plugin-idoit.conf /usr/share/openqrm/plugins/idoit/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/idoit/etc/openqrm-plugin-idoit.conf b/openQRM-5.3.50-CE/src/plugins/idoit/etc/openqrm-plugin-idoit.conf deleted file mode 100644 index d52072d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/idoit/etc/openqrm-plugin-idoit.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Automatic System Documentation (CMDB) with I-doit.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="management" diff --git a/openQRM-5.3.50-CE/src/plugins/image-shelf/Makefile b/openQRM-5.3.50-CE/src/plugins/image-shelf/Makefile deleted file mode 100644 index 9445027..0000000 --- a/openQRM-5.3.50-CE/src/plugins/image-shelf/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/image-shelf/etc - cp etc/openqrm-plugin-image-shelf.conf /usr/share/openqrm/plugins/image-shelf/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/image-shelf/etc/openqrm-plugin-image-shelf.conf b/openQRM-5.3.50-CE/src/plugins/image-shelf/etc/openqrm-plugin-image-shelf.conf deleted file mode 100644 index 80328d2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/image-shelf/etc/openqrm-plugin-image-shelf.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Pre-made Server Templates for network-deployment.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="deployment" diff --git a/openQRM-5.3.50-CE/src/plugins/ip-mgmt/Makefile b/openQRM-5.3.50-CE/src/plugins/ip-mgmt/Makefile deleted file mode 100644 index dcbce4e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ip-mgmt/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/ip-mgmt/etc - cp etc/openqrm-plugin-ip-mgmt.conf /usr/share/openqrm/plugins/ip-mgmt/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/ip-mgmt/etc/openqrm-plugin-ip-mgmt.conf b/openQRM-5.3.50-CE/src/plugins/ip-mgmt/etc/openqrm-plugin-ip-mgmt.conf deleted file mode 100644 index 2469a38..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ip-mgmt/etc/openqrm-plugin-ip-mgmt.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Network-mangement for the Appliances public IP-addresses.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="network" diff --git a/openQRM-5.3.50-CE/src/plugins/ipmi/Makefile b/openQRM-5.3.50-CE/src/plugins/ipmi/Makefile deleted file mode 100644 index 5d2f323..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ipmi/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/ipmi/etc - cp etc/openqrm-plugin-ipmi.conf /usr/share/openqrm/plugins/ipmi/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/ipmi/etc/openqrm-plugin-ipmi.conf b/openQRM-5.3.50-CE/src/plugins/ipmi/etc/openqrm-plugin-ipmi.conf deleted file mode 100644 index 3fade9f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ipmi/etc/openqrm-plugin-ipmi.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Automatically controls the power status of physical systems via the IPMI technology.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="network" diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/Makefile b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/Makefile deleted file mode 100644 index 68d91c3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# this is the openQRM iscsi-storage-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/iscsi-storage $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.iscsi-deployment $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/tpl/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/lang/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/class/ - . $(OPENQRM_SERVER_CONF) && chmod 777 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/bin/openqrm* - . $(OPENQRM_SERVER_CONF) && tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage -czvf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/boot-service-iscsi-storage.tgz include/ bin/ etc/init.d/iscsi-storage etc/openqrm-plugin-iscsi-storage.conf - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/iscsi-storage - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/iscsi-storage/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/bin/openqrm-iscsi-storage b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/bin/openqrm-iscsi-storage deleted file mode 100644 index fd908dd..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/bin/openqrm-iscsi-storage +++ /dev/null @@ -1,543 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# this script automatically manages iscsi -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -# unblock starting command queue early for non-blocking + ui commands -ISCSI_COMMAND=$1 -if [ "$ISCSI_COMMAND" == "post_luns" ] || [ "$ISCSI_COMMAND" == "post_identifier" ] || [ "$ISCSI_COMMAND" == "list" ] || [ "$ISCSI_COMMAND" == "auth" ] || [ "$ISCSI_COMMAND" == "post_sync_progress" ] || [ "$ISCSI_COMMAND" == "post_sync_finished" ]; then - openqrm_unblock_starting_queue $@ - NON_BLOCKING=true -fi -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/include/openqrm-plugin-iscsi-storage-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/etc/openqrm-plugin-iscsi-storage.conf -OPENQRM_POSTENCODE="$OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-postencode" -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - OPENQRM_SERVER_IP=$resource_openqrmserver - OPENQRM_EXEC_PORT=$resource_execdport -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS - resource_id=0 - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL -fi -export LANG=C -# how long to wait for the volume authentication, each loop is 5 secs -MAX_VOLUME_AUTHENTICATION_LOOP=30 -export MAX_VOLUME_AUTHENTICATION_LOOP - -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - -if [ ! -d "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY" ]; then - mkdir -p $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY -fi - -# make sure required deps are installed -if ! check_iscsi_storage_deps; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi - -function iscsi_storage_usage() { - echo "Usage : $0 add/remove/clone|snap/list <-n image-name> <-i image-password>" - echo " [-m size in MB]" - echo " [-s image-snapshot-name]" - echo " $0 auth <-r image-rootdevice> <-i image-password>" - echo " $0 adapt <-n image-name> <-u username> <-p password> [-i image-password]" - echo " $0 post_luns <-u username> <-p password>" - echo " $0 post_identifier <-u username> <-p password>" - echo " $0 post_sync_progress <-n image-name> <-s image-snapshot-name> <-u username> <-p password>" - echo " $0 post_sync_finished <-n image-name> <-u username> <-p password>" - echo "" - echo "Optional parameters:" - echo " [--openqrm-ui-user ]" - echo " [--openqrm-internal-cmd ]" - echo " [--openqrm-cmd-mode ]" - exit 1 -} - - -FULL_COMMANDLINE="$0 $@" -ISCSI_COMMAND=$1 -shift - -while [ $# -ne 0 ]; do - case "$1" in - -n) - ISCSI_IMAGE_NAME=$2 - shift - ;; - -s) - ISCSI_IMAGE_SNAPSHOT_NAME=$2 - shift - ;; - -m) - ISCSI_IMAGE_SIZE=$2 - shift - ;; - -i) - ISCSI_IMAGE_PASSWORD=$2 - shift - ;; - -r) - ISCSI_IMAGE_ROOTDEVICE=$2 - shift - ;; - -u) - ISCSI_OPENQRM_USERNAME=$2 - shift - ;; - -p) - ISCSI_OPENQRM_PASSWORD=$2 - shift - ;; - --openqrm-ui-user) - OPENQRM_UI_USER=$2 - shift - ;; - --openqrm-internal-cmd) - OPENQRM_INTERNAL_CMD=$2 - shift - ;; - --openqrm-cmd-mode) - OPENQRM_CMD_MODE=$2 - shift - ;; - - *) - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - echo "ERROR: Free commandline arguments are not allowed" - iscsi_storage_usage - exit 6 - ;; - esac - shift -done - - - - -# main -if [ "$ISCSI_COMMAND" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - iscsi_storage_usage -fi - -if [ "$ISCSI_COMMAND" == "post_luns" ] || [ "$ISCSI_COMMAND" == "post_identifier" ]; then - if [ "$ISCSI_OPENQRM_USERNAME" == "" ]; then - iscsi_storage_usage - fi - if [ "$ISCSI_OPENQRM_PASSWORD" == "" ]; then - iscsi_storage_usage - fi -else - if [ "$ISCSI_COMMAND" != "list" ] && [ "$ISCSI_COMMAND" != "auth" ]; then - if [ "$ISCSI_IMAGE_NAME" == "" ]; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - iscsi_storage_usage - fi - fi -fi - -case "$ISCSI_COMMAND" in - - add) - if [ "$ISCSI_IMAGE_SIZE" == "" ]; then - ISCSI_IMAGE_SIZE=$DEFAULT_IMAGE_SIZE - fi - - if [ -f "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME" ]; then - openqrm_post_event 0 "add" 3 "iscsi-storage" "Volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME already exist." - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire iscsi-storage` - trap "openqrm_lock_queue release iscsi-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # add as target - export ISCSI_IMAGE_SIZE - echo -n "Creating ISCSI Lun for image $ISCSI_IMAGE_NAME" - manage_iscsi add regular $ISCSI_IMAGE_PASSWORD - - openqrm_lock_queue release iscsi-storage $LOCK_TIME - trap '' EXIT - - # in case we have a username + password post the updated list to the openQRM-server - if [ "$ISCSI_OPENQRM_USERNAME" != "" ] && [ "$ISCSI_OPENQRM_PASSWORD" != "" ]; then - $0 post_luns -u $ISCSI_OPENQRM_USERNAME -p $ISCSI_OPENQRM_PASSWORD --openqrm-internal-cmd true - fi - ;; - - remove) - # check that source fs-images exist - if [ ! -f "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME" ]; then - openqrm_post_event 0 "remove" 3 "iscsi-storage" "Volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME does not exists!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - # check that it is not in use by a syncing action - if ls $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME.sync_in_progress.* 1>/dev/null 2>&1; then - openqrm_post_event 0 "remove" 3 "iscsi-storage" "Volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME is currently in use by a sync action!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - if [ -f "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME.clone_in_progress" ]; then - openqrm_post_event 0 "remove" 3 "iscsi-storage" "Volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME is currently in use by a clone action!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire iscsi-storage` - trap "openqrm_lock_queue release iscsi-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - echo -n "Removing ISCSI export for image $ISCSI_IMAGE_NAME" - manage_iscsi remove - # physical remove - rm -f $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME.* - - openqrm_lock_queue release iscsi-storage $LOCK_TIME - trap '' EXIT - - # in case we have a username + password post the updated list to the openQRM-server - if [ "$ISCSI_OPENQRM_USERNAME" != "" ] && [ "$ISCSI_OPENQRM_PASSWORD" != "" ]; then - $0 post_luns -u $ISCSI_OPENQRM_USERNAME -p $ISCSI_OPENQRM_PASSWORD --openqrm-internal-cmd true - fi - ;; - - clone|snap) - if [ "$ISCSI_IMAGE_SNAPSHOT_NAME" == "" ]; then - openqrm_post_event 0 "snap" 3 "iscsi-storage" "No snapshot name given. Please use the -s cmdline parameter." - openqrm_unblock_starting_queue $FULL_COMMANDLINE - iscsi_storage_usage - fi - - # check that source fs-images exist - if [ ! -f $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME ]; then - openqrm_post_event 0 "snap" 3 "iscsi-storage" "Could not find source volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - if [ -f "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_SNAPSHOT_NAME.clone_in_progress" ]; then - openqrm_post_event 0 "clone" 3 "iscsi-storage" "There is already an active cloning action running for Volume $ISCSI_IMAGE_SNAPSHOT_NAME!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - if [ -f "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_SNAPSHOT_NAME" ]; then - openqrm_post_event 0 "clone" 3 "iscsi-storage" "Snapshot $ISCSI_IMAGE_SNAPSHOT_NAME already exists!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - if [ ! -f $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME.conf ]; then - openqrm_post_event 0 "clone" 3 "iscsi-storage" "Could not find source volume config $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME.conf." - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - else - . $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME.conf - ISCSI_ORIGINAL_IMAGE_SIZE=$LUN_SIZE - if [ "$ISCSI_ORIGINAL_IMAGE_SIZE" == "" ]; then - openqrm_post_event 0 "snap" 3 "iscsi-storage" "Could not find out original image size of $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - fi - - LOCK_TIME=`openqrm_lock_queue aquire iscsi-storage` - trap "openqrm_lock_queue release iscsi-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - echo -n "Creating snapshot from image $ISCSI_IMAGE_NAME -> $ISCSI_IMAGE_SNAPSHOT_NAME size $ISCSI_ORIGINAL_IMAGE_SIZE" - - # create lock in the origin for clone so remove is not able to remove the origin while syncing - touch "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME.sync_in_progress.$ISCSI_IMAGE_SNAPSHOT_NAME" - # create long-term-action start event - openqrm_post_event 0 "$ISCSI_IMAGE_SNAPSHOT_NAME" 9 "iscsi-storage" "Started to clone $ISCSI_IMAGE_SNAPSHOT_NAME from $ISCSI_IMAGE_NAME" - export ORG_IMAGE_NAME=$ISCSI_IMAGE_NAME - export ISCSI_IMAGE_NAME=$ISCSI_IMAGE_SNAPSHOT_NAME - export ISCSI_IMAGE_SIZE=$ISCSI_ORIGINAL_IMAGE_SIZE - # create a lock in the new created dir for post_exports + identifier - touch "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_SNAPSHOT_NAME.clone_in_progress" - # create an empty small file to be added as volume to iscsi first, we later overwrite this while syncing - touch $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_SNAPSHOT_NAME - manage_iscsi add snap $ISCSI_IMAGE_PASSWORD - # touch the snapshot as a file for post_luns - touch "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_SNAPSHOT_NAME" - - openqrm_lock_queue release iscsi-storage $LOCK_TIME - trap '' EXIT - - # in case we have a username + password post the updated list to the openQRM-server - # if we have a user + password we start sync-progress monitor - if [ "$ISCSI_OPENQRM_USERNAME" != "" ] && [ "$ISCSI_OPENQRM_PASSWORD" != "" ]; then - $0 post_sync_progress -n $ORG_IMAGE_NAME -s $ISCSI_IMAGE_SNAPSHOT_NAME -u $ISCSI_OPENQRM_USERNAME -p $ISCSI_OPENQRM_PASSWORD --openqrm-internal-cmd true & - fi - sleep 10 - # start to sync - if ! nice --20 cp -af $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ORG_IMAGE_NAME $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_SNAPSHOT_NAME; then - openqrm_post_event 0 "snap" 3 "iscsi-storage" "Error during cloning $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ORG_IMAGE_NAME to $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_SNAPSHOT_NAME." - fi - - LOCK_TIME=`openqrm_lock_queue aquire iscsi-storage` - trap "openqrm_lock_queue release iscsi-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # we now remove + re-add the volume to the iscsi-target - manage_iscsi remove - manage_iscsi add snap $ISCSI_IMAGE_PASSWORD - - # remove lock from the origin + snapshot - rm -f "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ORG_IMAGE_NAME.sync_in_progress.$ISCSI_IMAGE_SNAPSHOT_NAME" - rm -f "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_SNAPSHOT_NAME.clone_in_progress" - - openqrm_lock_queue release iscsi-storage $LOCK_TIME - trap '' EXIT - - # stop sync-progress monitor and send sync-finished to openQRM - $0 post_sync_finished -n $ISCSI_IMAGE_SNAPSHOT_NAME -u $ISCSI_OPENQRM_USERNAME -p $ISCSI_OPENQRM_PASSWORD --openqrm-internal-cmd true - # create long-term-action finished event - openqrm_post_event 0 "$ISCSI_IMAGE_SNAPSHOT_NAME" 10 "iscsi-storage" "Finished to clone $ISCSI_IMAGE_SNAPSHOT_NAME" - ;; - - auth) - if [ "$ISCSI_IMAGE_ROOTDEVICE" == "" ]; then - ISCSI_IMAGE_ROOTDEVICE="$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME" - fi - if [ "$ISCSI_IMAGE_NAME" == "" ]; then - ISCSI_IMAGE_NAME=`basename $ISCSI_IMAGE_ROOTDEVICE` - fi - echo -n "Authenticating ISCSI Lun for image rootdevice $ISCSI_IMAGE_ROOTDEVICE" - # this is just for starting auth, make sure the device is there, otherwise wait - if [ "$ISCSI_OPENQRM_USERNAME" != "" ] && [ "$ISCSI_OPENQRM_PASSWORD" != "" ] && [ "$ISCSI_IMAGE_NAME" != "" ]; then - MAX_AUTH_LOOP=0 - while (true); do - if [ -f "$ISCSI_IMAGE_ROOTDEVICE" ] && [ ! -f "$ISCSI_IMAGE_ROOTDEVICE.clone_in_progress" ]; then - break - fi - sleep 5 - if [ "$MAX_AUTH_LOOP" == "$MAX_VOLUME_AUTHENTICATION_LOOP" ]; then - openqrm_post_event 0 "auth" 3 "iscsi-storage" "Volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME does not exist. Cannot auth." - exit 1 - fi - MAX_AUTH_LOOP=$(( MAX_AUTH_LOOP + 1 )) - done - fi - - LOCK_TIME=`openqrm_lock_queue aquire iscsi-storage` - trap "openqrm_lock_queue release iscsi-storage $LOCK_TIME" EXIT - - manage_iscsi auth $ISCSI_IMAGE_PASSWORD - - openqrm_lock_queue release iscsi-storage $LOCK_TIME - trap '' EXIT - - # in case we have a username + password post the updated list to the openQRM-server - if [ "$ISCSI_OPENQRM_USERNAME" != "" ] && [ "$ISCSI_OPENQRM_PASSWORD" != "" ] && [ "$ISCSI_IMAGE_NAME" != "" ]; then - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$ISCSI_OPENQRM_USERNAME --http-password=$ISCSI_OPENQRM_PASSWORD "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/iscsi-storage/iscsi-storage-action.php?iscsi_storage_command=auth_finished&iscsi_image_name=$ISCSI_IMAGE_NAME"; then - openqrm_post_event 0 "auth" 3 "iscsi-storage" "Could not remove the storage-auth-blocker for volume Volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - fi - $0 post_luns -u $ISCSI_OPENQRM_USERNAME -p $ISCSI_OPENQRM_PASSWORD --openqrm-internal-cmd true - fi - ;; - - adapt) - # adapts an existing blockfile volume to iscsi-deployment - if [ ! -f "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME" ]; then - openqrm_post_event 0 "adapt" 3 "iscsi-storage" "iSCSI volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME does not exists." - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - # make sure it is not still used by another storage type - # check for aoe - if [ "$VBLADECONF" != "" ]; then - if grep -w "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME" $VBLADECONF | grep -v '^#'; then - if `which vblade 1>/dev/null`; then - for VBLADE_PID in `ps ax | grep vblade | grep -w $ISCSI_IMAGE_NAME | awk {' print $1 '}`; do - kill $VBLADE_PID - done - sync - grep -w -v "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME" $VBLADECONF > $VBLADECONF.new - mv -f $VBLADECONF.new $VBLADECONF - sed -i '/^$/d' $VBLADECONF - fi - fi - fi - - LOCK_TIME=`openqrm_lock_queue aquire iscsi-storage` - trap "openqrm_lock_queue release iscsi-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # add to ietd - manage_iscsi adapt $ISCSI_IMAGE_PASSWORD - - openqrm_lock_queue release iscsi-storage $LOCK_TIME - trap '' EXIT - - # posting volume and storage infos to openQRM - STORAGE_STATUS_TMP=$resource_id.iscsi.$ISCSI_IMAGE_NAME.adapt - > $STORAGE_STATUS_TMP - echo "$ISCSI_IMAGE_NAME,/dev/$ISCSI_IMAGE_NAME/$IMAGE_LUN" >> $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$ISCSI_OPENQRM_USERNAME --http-password=$ISCSI_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/iscsi-storage/iscsi-storage-action.php?iscsi_storage_command=get_ident; then - openqrm_post_event 0 "adapt" 3 "iscsi-storage" "Could not post the iscsi target identifier to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP - rm -f $STORAGE_STATUS_TMP.post - ;; - - list) - ls $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY - ;; - post_luns) - echo "Posting current iscsi-luns to the openQRM-server" - # get avail + used space - BACKEND_DIR_AVAIL_SPACE=`df --block-size MB $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY | grep -v Used | awk '{ print $2 }' | sed -e "s/MB//g"` - BACKEND_DIR_FREE_SPACE=`df --block-size MB $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY | grep -v Used | awk '{ print $4 }' | sed -e "s/MB//g"` - STORAGE_STATUS_TMP=$resource_id.iscsi.stat - echo "$BACKEND_DIR_AVAIL_SPACE""@""$BACKEND_DIR_FREE_SPACE""@""$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY" > $STORAGE_STATUS_TMP - for VOLUME in `ls $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY | grep -v sync_in_progress | grep -v clone_in_progress | grep -v ".conf"`; do - if grep -w $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$VOLUME $IETDCONF | grep -v '^#' | grep Lun 1>/dev/null; then - LUN_STR=`grep -w $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$VOLUME $IETDCONF | grep -v '^#' | grep Lun` - # get the size from the config file - if [ -f $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$VOLUME.conf ]; then - . $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$VOLUME.conf - IMAGE_SIZE=$LUN_SIZE - fi - if [ "$IMAGE_SIZE" == "" ]; then - IMAGE_SIZE=`ls --block-size=M -l $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$VOLUME | awk '{ print $5 }' | sed -e "s/M//g"` - fi - # get password - IMAGE_USERNAME=$VOLUME - IMAGE_PASSWORD=`grep -A1 ^"Target $VOLUME$" $IETDCONF | grep IncomingUser | awk '{ print $3 }'` - # check for clone-in-progress - if [ -f "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$VOLUME.clone_in_progress" ]; then - V_ALLOWED_MAC="-" - IMAGE_SIZE="clone_in_progress" - fi - echo "iscsi-deployment""@""$LUN""@""$VOLUME""@""$IMAGE_USERNAME""@""$IMAGE_PASSWORD""@""$IMAGE_SIZE" >> $STORAGE_STATUS_TMP - else - echo "@@""$VOLUME""@@@" >> $STORAGE_STATUS_TMP - fi - done - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$ISCSI_OPENQRM_USERNAME --http-password=$ISCSI_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/iscsi-storage/iscsi-storage-action.php?iscsi_storage_command=get_storage; then - openqrm_post_event 0 "post_luns" 3 "iscsi-storage" "Could not post the iscsi target status to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP - rm -f $STORAGE_STATUS_TMP.post - ;; - - post_identifier) - echo "Posting current iscsi-identifier to the openQRM-server" - STORAGE_STATUS_TMP=$resource_id.iscsi.ident - > $STORAGE_STATUS_TMP - OLD_IFS=$IFS -IFS=' -' - for LUN_STR in `cat $IETDCONF | grep -v "#" | grep Lun | grep $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY`; do - LUN=`echo $LUN_STR | awk {'print $2 '}` - IMAGE_NAME=`echo $LUN_STR | awk {'print $3 '}` - IMAGE_NAME=`basename $IMAGE_NAME | cut -d',' -f1` - echo "$IMAGE_NAME,/dev/$IMAGE_NAME/$LUN" - echo "$IMAGE_NAME,/dev/$IMAGE_NAME/$LUN" >> $STORAGE_STATUS_TMP - done - IFS=$OLD_IFS - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$ISCSI_OPENQRM_USERNAME --http-password=$ISCSI_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/iscsi-storage/iscsi-storage-action.php?iscsi_storage_command=get_ident; then - openqrm_post_event 0 "post_identifier" 3 "iscsi-storage" "Could not post the iscsi target identifier to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP - rm -f $STORAGE_STATUS_TMP.post - ;; - - post_sync_progress) - echo "Posting progress of the sync action for volume $ISCSI_IMAGE_SNAPSHOT_NAME syncing from $ISCSI_IMAGE_NAME to the openQRM-server" - STORAGE_STATUS_TMP=$resource_id.iscsi.$ISCSI_IMAGE_SNAPSHOT_NAME.sync_progress - - while (true); do - # if this is a snapshot volume we have to wait until the sync is ready - if [ -f "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_SNAPSHOT_NAME" ] && [ ! -f "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_SNAPSHOT_NAME.clone_in_progress" ]; then - # sync is ready - break - else - if [ ! -f "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_SNAPSHOT_NAME" ]; then - # cloning not started yet, waiting for the snapshot to appear - echo "0" > $STORAGE_STATUS_TMP - else - SOURCE_VOLUME_SIZE=`ls -l --block-size=M $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME | awk '{ print $5 }' | cut -d'M' -f1` - DESTINATION_VOLUME_SIZE=`ls -l --block-size=M $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_SNAPSHOT_NAME | awk '{ print $5 }' | cut -d'M' -f1` - if [ "$DESTINATION_VOLUME_SIZE" == 0 ]; then - DESTINATION_VOLUME_SIZE=1 - fi - CURRENT_SYNC_PROGRESS_IN_PERCENT=$(( SOURCE_VOLUME_SIZE / DESTINATION_VOLUME_SIZE )) - CURRENT_SYNC_PROGRESS_IN_PERCENT=$(( 100 / CURRENT_SYNC_PROGRESS_IN_PERCENT )) - # make sure to not send 100%, this is send by clone finished - CURRENT_SYNC_PROGRESS_IN_PERCENT=$(( CURRENT_SYNC_PROGRESS_IN_PERCENT - 1 )) - if (( $CURRENT_SYNC_PROGRESS_IN_PERCENT < 0 )); then - CURRENT_SYNC_PROGRESS_IN_PERCENT=0 - fi - echo "$CURRENT_SYNC_PROGRESS_IN_PERCENT" > $STORAGE_STATUS_TMP - fi - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$ISCSI_OPENQRM_USERNAME --http-password=$ISCSI_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/iscsi-storage/iscsi-storage-action.php?iscsi_storage_command=get_sync_progress; then - iscsi_storage_log "post_sync_progress" "Could not post the sync progress for volume $ISCSI_IMAGE_SNAPSHOT_NAME to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - fi - sleep 2 - done - ;; - - - post_sync_finished) - echo "Posting finished for volume $ISCSI_IMAGE_NAME to the openQRM-server" - STORAGE_STATUS_TMP=$resource_id.iscsi.$ISCSI_IMAGE_NAME.sync_progress - echo "100" > $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$ISCSI_OPENQRM_USERNAME --http-password=$ISCSI_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/iscsi-storage/iscsi-storage-action.php?iscsi_storage_command=get_sync_finished; then - iscsi_storage_log "post_sync_finished" "Could not post the sync progress for volume $ISCSI_IMAGE_NAME to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - ;; - - - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - iscsi_storage_usage - ;; - - -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/init.d/iscsi-storage b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/init.d/iscsi-storage deleted file mode 100644 index a78e874..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/init.d/iscsi-storage +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the iSCSI-Storage-hosts -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/include/openqrm-plugin-iscsi-storage-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/etc/openqrm-plugin-iscsi-storage.conf -LINE_IFS=' -' - -# do not start on the intitrd -if [ -f /etc/initrd-devices.conf ]; then - exit 0 -fi - -function iscsi_storage_start() { - echo "Starting the openQRM iscsi-storage-plugin" - if [ "$ISCSI_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/iscsi-target" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsi-target start - else - /etc/init.d/iscsi-target start - fi - elif [ -x /etc/init.d/iscsitarget ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsitarget start - else - /etc/init.d/iscsitarget start - fi - fi - fi -} - - -function iscsi_storage_stop() { - echo "Stopping the openQRM iscsi-storage-plugin" - if [ "$ISCSI_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/iscsi-target" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsi-target stop - else - /etc/init.d/iscsi-target stop - fi - elif [ -x /etc/init.d/iscsitarget ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsitarget stop - else - /etc/init.d/iscsitarget stop - fi - fi - fi -} - - - - - -case "$1" in - start) - iscsi_storage_start - ;; - stop) - iscsi_storage_stop - ;; - restart) - iscsi_storage_stop - sleep 1 - iscsi_storage_start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 - -esac -exit $? - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/init.d/openqrm-plugin-iscsi-storage b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/init.d/openqrm-plugin-iscsi-storage deleted file mode 100644 index 91a87e2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/init.d/openqrm-plugin-iscsi-storage +++ /dev/null @@ -1,166 +0,0 @@ -#!/bin/bash -# init script for the openQRM iscsi-storage-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/include/openqrm-plugin-iscsi-storage-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/etc/openqrm-plugin-iscsi-storage.conf - - - -function openqrm_plugin_iscsi_storage_start() { - openqrm_plugin_iscsi_storage_stop 1>/dev/null 2>&1 - echo "Starting the openQRM iscsi-storage-plugin" - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/iscsi-storage/.running - if [ "$ISCSI_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/iscsi-target" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsi-target start - else - /etc/init.d/iscsi-target start - fi - elif [ -x /etc/init.d/iscsitarget ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsitarget start - else - /etc/init.d/iscsitarget start - fi - fi - fi -} - - -function openqrm_plugin_iscsi_storage_stop() { - echo "Stopping the openQRM iscsi-storage-plugin" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/iscsi-storage/.running - if [ "$ISCSI_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/iscsi-target" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsi-target stop - else - /etc/init.d/iscsi-target stop - fi - elif [ -x /etc/init.d/iscsitarget ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsitarget stop - else - /etc/init.d/iscsitarget stop - fi - fi - fi -} - -function openqrm_plugin_iscsi_storage_uninstall() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "iscsi-storage: Please give a username to uninstall the plugin : " - read USERNAME - echo - echo -n "iscsi-storage: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Uninstalling the openQRM iscsi-storage-plugin" - openqrm_plugin_iscsi_storage_stop - openqrm_server_remove_deployment_type $USERNAME $PASSWORD iscsi-deployment - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/iscsi-storage - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.iscsi-deployment - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.iscsi-deployment.php - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-iscsi-storage.tgz - - # remove only if lvm-storage is not enabled - if ! ls $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/plugins | grep lvm-storage 1>/dev/null 2>&1; then - if ! ls $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/plugins | grep netapp-storage 1>/dev/null 2>&1; then - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/iscsid - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/iscsiadm - fi - fi -} - -function openqrm_plugin_iscsi_storage_init() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "iscsi-storage: Please give a username to init the plugin : " - read USERNAME - echo - echo -n "iscsi-storage: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Initializing the openQRM iscsi-storage-plugin" - openqrm_server_add_deployment_type $USERNAME $PASSWORD iscsi-deployment iscsi-deployment "Iscsi-root deployment" iscsi-storage "Iscsi Enterprise Target Storage" - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/iscsi-storage - # linking the boot-service - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/boot-service-iscsi-storage.tgz $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-iscsi-storage.tgz - # linking the root mount hook - chmod +x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/root-mount.iscsi-deployment - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/root-mount.iscsi-deployment $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.iscsi-deployment - # linking the default image-parameters - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/image.iscsi-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.iscsi-deployment.php - - # copying iscsid to boot-service dir - if [ ! -x $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/iscsid ]; then - cp -f `which iscsid` $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/ - fi - # copying iscsiadm to boot-service dir - if [ ! -x $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/iscsiadm ]; then - cp -f `which iscsiadm` $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/ - fi - # create storage dir for stat files - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/storage - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/storage - echo "Order deny,allow" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/storage/.htaccess - echo "Deny from all" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/web/storage/.htaccess - -} - -USER=$2 -PASS=$3 - -case "$1" in - start) - openqrm_plugin_iscsi_storage_start - ;; - stop) - openqrm_plugin_iscsi_storage_stop - ;; - restart) - openqrm_plugin_iscsi_storage_stop - sleep 1 - openqrm_plugin_iscsi_storage_start - ;; - init) - openqrm_plugin_iscsi_storage_init $USER $PASS - ;; - uninstall) - openqrm_plugin_iscsi_storage_uninstall $USER $PASS - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/init.d/openqrm-plugin-iscsi-storage.postinstall b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/init.d/openqrm-plugin-iscsi-storage.postinstall deleted file mode 100644 index 574fc00..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/init.d/openqrm-plugin-iscsi-storage.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-iscsi-storage postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/init.d/openqrm-plugin-iscsi-storage.preremove b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/init.d/openqrm-plugin-iscsi-storage.preremove deleted file mode 100644 index fcf2ed1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/init.d/openqrm-plugin-iscsi-storage.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-iscsi-storage preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-iscsi-storage stop \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/openqrm-plugin-iscsi-storage.conf b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/openqrm-plugin-iscsi-storage.conf deleted file mode 100644 index 79bddf7..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/etc/openqrm-plugin-iscsi-storage.conf +++ /dev/null @@ -1,42 +0,0 @@ -# this is the openQRM-plugin-iscsi-storage info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, open-iscsi" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, iscsi-initiator-utils" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, open-iscsi" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Integrates iSCSI Enterprise Target as Storage technology (network-deployment)." -OPENQRM_PLUGIN_TYPE="storage" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# The directory for the iSCSI-Deployment blockfiles -OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY="/storage" - -OPENQRM_PLUGIN_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/iscsi-storage/etc/openqrm-plugin-iscsi-storage.conf" - -# if openQRM should start/stop the storage component (yes/no), default no -ISCSI_STORAGE_AUTO_START=no diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/include/openqrm-plugin-iscsi-storage-functions b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/include/openqrm-plugin-iscsi-storage-functions deleted file mode 100644 index 5f9b161..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/include/openqrm-plugin-iscsi-storage-functions +++ /dev/null @@ -1,250 +0,0 @@ -#!/bin/bash -# this is the functions file for the iscsi-storage-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - - -# iscsi-target config file -IETDCONF=`find /etc/ -name ietd.conf -type f | head -n1` -if [ "$IETDCONF" == "" ]; then - IETDCONF="/etc/ietd.conf" -fi -VBLADECONF=/etc/vblade.conf - -# some definitions -DEFAULT_IMAGE_SIZE=5000 -ISCSI_TARGET_URL=http://iscsitarget.sourceforge.net/ -IMAGE_LUN=1 - -################ common iscsi-storage functions - -# logs for iscsi_storage -function iscsi_storage_log() { - local COMPONENT=$1 - shift - local MESSAGE=$@ - logger -i -t "iscsi-storage plug-in" "$COMPONENT : $MESSAGE" -} - -################ iscsi-storage functions - -# deps function -function check_iscsi_storage_deps() { - # check and fullfill dependencies - # screen - if ! openqrm_full_fill_os_dependency screen screen; then - return 1 - fi - if [ -x /usr/bin/screen.real ]; then - export RUNSCREEN="/usr/bin/screen.real" - else - export RUNSCREEN=`which screen` - fi - # wget - if ! openqrm_full_fill_os_dependency wget wget; then - return 1 - fi - # procmail for lockfile - if ! openqrm_full_fill_os_dependency lockfile procmail; then - return 1 - fi - if [ -f /etc/debian_version ]; then - # open-iscsi - if ! openqrm_full_fill_os_dependency iscsid open-iscsi; then - return 1 - fi - # open-iscsi-utils - if ! openqrm_full_fill_os_dependency iscsiadm open-iscsi-utils; then - return 1 - fi - # ietd - needs dkms package on debian/ubuntu - if ! openqrm_full_fill_os_dependency ietd iscsitarget-dkms; then - return 1 - fi - if ! openqrm_full_fill_os_dependency ietd iscsitarget; then - return 1 - fi - elif [ -f /etc/redhat-release ]; then - # iscsi-initiator-utils - if ! openqrm_full_fill_os_dependency iscsid iscsi-initiator-utils; then - return 1 - fi - # ietd - if ! openqrm_full_fill_os_dependency ietd iscsitarget; then - return 1 - fi - elif [ -f /etc/SuSE-release ]; then - # open-iscsi - if ! openqrm_full_fill_os_dependency iscsid open-iscsi; then - return 1 - fi - # ietd - if ! openqrm_full_fill_os_dependency ietd iscsitarget; then - return 1 - fi - fi - -} - - - -function manage_iscsi() { - - case "$1" in - add) - IMAGE_PASS=$3 - # if password is empty we generate one - if [ "$IMAGE_PASS" == "" ]; then - IMAGE_PASS=`cat /dev/urandom|tr -dc "a-zA-Z0-9-_\$\?"|fold -w 9|head -n1` - fi - # create the image file - if [ "$2" != "snap" ]; then - if ! dd if=/dev/zero of=$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME bs=1M seek=$ISCSI_IMAGE_SIZE count=1; then - openqrm_post_event 0 "add" 3 "iscsi-storage" "Could not create volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - return 1 - else - # create fs, currently static all ext3 - if ! mkfs.ext3 -F $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME; then - openqrm_post_event 0 "add" 3 "iscsi-storage" "Could not create filesystem on volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - return 1 - fi - - fi - fi - echo "Target $ISCSI_IMAGE_NAME" >> $IETDCONF - echo " IncomingUser $ISCSI_IMAGE_NAME $IMAGE_PASS" >> $IETDCONF - echo " Lun $IMAGE_LUN Path=$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME,Type=fileio" >> $IETDCONF - echo " MaxConnections 1 # $ISCSI_IMAGE_NAME" >> $IETDCONF - echo " MaxSessions 1 # $ISCSI_IMAGE_NAME" >> $IETDCONF - echo " NOPInterval 3 # $ISCSI_IMAGE_NAME" >> $IETDCONF - echo " NOPTimeout 3 # $ISCSI_IMAGE_NAME" >> $IETDCONF - # create config for keeping the size - echo "LUN_SIZE=$ISCSI_IMAGE_SIZE" > $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME.conf - LAST_TID=`grep tid: /proc/net/iet/volume | cut -d':' -f2 | awk {' print $1 '} | sort -g | tail -n1` - NEW_TID=$(( $LAST_TID + 1 )) - # dynamically add new target - if ! ietadm --op new --tid=$NEW_TID --params Name=$ISCSI_IMAGE_NAME; then - openqrm_post_event 0 "add" 3 "iscsi-storage" "Could not create target for volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - return 1 - fi - # set path to iscsi device in the new target - if ! ietadm --op new --tid=$NEW_TID --lun=$IMAGE_LUN --params Path=$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME; then - openqrm_post_event 0 "add" 3 "iscsi-storage" "Could not set target path for volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - return 1 - fi - # auth target - if ! ietadm --op new --tid=$NEW_TID --user --params IncomingUser=$ISCSI_IMAGE_NAME,Password=$IMAGE_PASS; then - openqrm_post_event 0 "add" 3 "iscsi-storage" "Could not set authentication for volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - return 1 - fi - ;; - auth) - IMAGE_PASS=$2 - # if password is empty we generate one - if [ "$IMAGE_PASS" == "" ]; then - IMAGE_PASS=`cat /dev/urandom|tr -dc "a-zA-Z0-9-_\$\?"|fold -w 9|head -n1` - fi - IMAGE_AUTHNAME=`basename $ISCSI_IMAGE_ROOTDEVICE` - sed -i -e "s#IncomingUser $IMAGE_AUTHNAME .*#IncomingUser $IMAGE_AUTHNAME $IMAGE_PASS#g" $IETDCONF - sed -i '/^$/d' $IETDCONF - TID_TO_AUTH=`cat /proc/net/iet/volume | grep "name:$IMAGE_AUTHNAME$" | cut -d':' -f2 | awk {' print $1 '}` - if [ "$TID_TO_AUTH" == "" ]; then - openqrm_post_event 0 "auth" 3 "iscsi-storage" "Could not find target for volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$IMAGE_AUTHNAME." - return 1 - fi - if ! ietadm --op new --tid=$TID_TO_AUTH --user --params IncomingUser=$IMAGE_AUTHNAME,Password=$IMAGE_PASS; then - openqrm_post_event 0 "auth" 3 "iscsi-storage" "Could not set authentication for volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$IMAGE_AUTHNAME." - return 1 - fi - ;; - adapt) - IMAGE_PASS=$2 - # if password is empty we generate one - if [ "$IMAGE_PASS" == "" ]; then - IMAGE_PASS=`cat /dev/urandom|tr -dc "a-zA-Z0-9-_\$\?"|fold -w 9|head -n1` - fi - if ! grep -w "$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME" $IETDCONF | grep Lun | grep -v '^#' 1>/dev/null; then - echo "Target $ISCSI_IMAGE_NAME" >> $IETDCONF - echo " IncomingUser $ISCSI_IMAGE_NAME $IMAGE_PASS" >> $IETDCONF - echo " Lun $IMAGE_LUN Path=$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME,Type=fileio" >> $IETDCONF - echo " MaxConnections 1 # $ISCSI_IMAGE_NAME" >> $IETDCONF - echo " MaxSessions 1 # $ISCSI_IMAGE_NAME" >> $IETDCONF - echo " NOPInterval 3 # $ISCSI_IMAGE_NAME" >> $IETDCONF - echo " NOPTimeout 3 # $ISCSI_IMAGE_NAME" >> $IETDCONF - # create config for keeping the size - ISCSI_IMAGE_SIZE=`ls --block-size=M -l $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME | awk '{ print $5 }' | sed -e "s/M//g"` - echo "LUN_SIZE=$ISCSI_IMAGE_SIZE" > $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME.conf - LAST_TID=`grep tid: /proc/net/iet/volume | cut -d':' -f2 | awk {' print $1 '} | sort -g | tail -n1` - NEW_TID=$(( $LAST_TID + 1 )) - # dynamically add new target - if ! ietadm --op new --tid=$NEW_TID --params Name=$ISCSI_IMAGE_NAME; then - openqrm_post_event 0 "adapt" 3 "iscsi-storage" "Could not create target for volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - return 1 - fi - # set path to iscsi device in the new target - if ! ietadm --op new --tid=$NEW_TID --lun=$IMAGE_LUN --params Path=$OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME; then - openqrm_post_event 0 "adapt" 3 "iscsi-storage" "Could not set target path for volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - return 1 - fi - # auth target - if ! ietadm --op new --tid=$NEW_TID --user --params IncomingUser=$ISCSI_IMAGE_NAME,Password=$IMAGE_PASS; then - openqrm_post_event 0 "adapt" 3 "iscsi-storage" "Could not set authentication for volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - return 1 - fi - fi - ;; - remove) - # remove from config file - cat $IETDCONF | grep -v -w $ISCSI_IMAGE_NAME > $IETDCONF.tmp - mv -f $IETDCONF.tmp $IETDCONF - sed -i '/^$/d' $IETDCONF - TID_TO_REMOVE=`cat /proc/net/iet/volume | grep "name:$ISCSI_IMAGE_NAME$" | cut -d':' -f2 | awk {' print $1 '}` - OPEN_SESSION=`cat /proc/net/iet/session | grep -w ^tid:$TID_TO_REMOVE -A1 | grep sid: | cut -d':' -f2 | awk {' print $1 '}` - if [ "$OPEN_SESSION" != "" ]; then - # first remove active session - if ! ietadm --op delete --tid=$TID_TO_REMOVE --sid=$OPEN_SESSION --cid=0; then - openqrm_post_event 0 "remove" 3 "iscsi-storage" "Could not remove active session for volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - return 1 - fi - fi - # remove lun - if ! ietadm --op delete --tid=$TID_TO_REMOVE --lun=$IMAGE_LUN; then - openqrm_post_event 0 "remove" 3 "iscsi-storage" "Could not remove the lun for volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - return 1 - fi - # remove target dynamically - if ! ietadm --op delete --tid=$TID_TO_REMOVE; then - openqrm_post_event 0 "remove" 3 "iscsi-storage" "Could not remove the target for volume $OPENQRM_ISCSI_STORAGE_SERVER_IMAGE_DIRECTORY/$ISCSI_IMAGE_NAME." - return 1 - fi - ;; - esac -} - - - - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/include/openqrm-plugin-iscsi-storage-kernel-hook b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/include/openqrm-plugin-iscsi-storage-kernel-hook deleted file mode 100644 index ddae709..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/include/openqrm-plugin-iscsi-storage-kernel-hook +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# this is a hook function for the kernel-creation phase -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -function iscsi_storage_kernel_hook() { - - local KERNEL_NAME=$1 - local KERNEL_VERSION=$2 - local KERNEL_LOCATION=$3 - local KERNEL_TYPE=$4 - - echo "iscsi-storage-plugin: Running iscsi_storage_kernel_hook $KERNEL_NAME $KERNEL_VERSION $KERNEL_LOCATION $KERNEL_TYPE" - echo "iscsi-storage-plugin: Running iscsi_storage_kernel_hook $KERNEL_NAME $KERNEL_VERSION $KERNEL_LOCATION $KERNEL_TYPE" | logger - - # try to find the iscsid + iscsiadm util fitting to the created kernel - if [ -x "$KERNEL_LOCATION/sbin/iscsid" ]; then - cp -a $KERNEL_LOCATION/sbin/iscsid $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsid.$KERNEL_NAME - echo "iscsi-storage-plugin: Found iscsid at $KERNEL_LOCATION/sbin/iscsid. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsid.$KERNEL_NAME" - echo "iscsi-storage-plugin: Found iscsid at $KERNEL_LOCATION/sbin/iscsid. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsid.$KERNEL_NAME" | logger - fi - if [ -x "$KERNEL_LOCATION/usr/sbin/iscsid" ]; then - cp -a $KERNEL_LOCATION/usr/sbin/iscsid $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsid.$KERNEL_NAME - echo "iscsi-storage-plugin: Found iscsid at $KERNEL_LOCATION/usr/sbin/iscsid. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsid.$KERNEL_NAME" - echo "iscsi-storage-plugin: Found iscsid at $KERNEL_LOCATION/usr/sbin/iscsid. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsid.$KERNEL_NAME" | logger - fi - if [ -x "$KERNEL_LOCATION/sbin/iscsiadm" ]; then - cp -a $KERNEL_LOCATION/sbin/iscsiadm $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsiadm.$KERNEL_NAME - echo "iscsi-storage-plugin: Found iscsiadm at $KERNEL_LOCATION/sbin/iscsiadm. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsiadm.$KERNEL_NAME" - echo "iscsi-storage-plugin: Found iscsiadm at $KERNEL_LOCATION/sbin/iscsiadm. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsiadm.$KERNEL_NAME" | logger - fi - if [ -x "$KERNEL_LOCATION/usr/bin/iscsiadm" ]; then - cp -a $KERNEL_LOCATION/usr/bin/iscsiadm $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsiadm.$KERNEL_NAME - echo "iscsi-storage-plugin: Found iscsiadm at $KERNEL_LOCATION/usr/bin/iscsiadm. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsiadm.$KERNEL_NAME" - echo "iscsi-storage-plugin: Found iscsiadm at $KERNEL_LOCATION/usr/bin/iscsiadm. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsiadm.$KERNEL_NAME" | logger - fi - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage-about.bootservice.class.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage-about.bootservice.class.php deleted file mode 100644 index 9615865..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage-about.bootservice.class.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ - -class iscsi_storage_about_bootservice -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'iscsi_storage_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "iscsi_storage_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/iscsi-storage-about-bootservice.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['boot_service_title'], 'boot_service_title'); - $t->add($this->lang['boot_service_content'], 'boot_service_content'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage-about.controller.class.php deleted file mode 100644 index 500cda3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage-about.controller.class.php +++ /dev/null @@ -1,254 +0,0 @@ - - */ - - -class iscsi_storage_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'iscsi_storage_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'iscsi_storage_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'iscsi_storage_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'iscsi_storage_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About iSCSI-Storage', - 'label' => 'About iSCSI-Storage', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The "iSCSI-Storage" plugin manages iSCSI-Server in openQRM. - ', - 'requirements_title' => 'Requirements', - 'requirements_list' => 'A resource for the iSCSI-Storage Storage (this can be a remote system integrated into openQRM e.g. via the "local-server" plugin or the openQRM server itself)', - - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - - 'provides_title' => 'Provides', - 'provides_list' => '
    • Storage type: "iSCSI Enterprise Target Storage"
    • -
    • Deployment types: "iSCSI-deployment"
    ', - 'type_title' => 'Plugin Type', - 'type_content' => 'Storage', - - 'deployment_title' => 'Deployment Type', - 'deployment_content' => 'Network-Deployment', - - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - 'network_deploymet' => 'Network-Deployment', - 'doc1' => '', - ), - 'bootservice' => array ( - 'tab' => 'Boot-Service', - 'label' => 'iSCSI-Storage Boot-Service', - 'boot_service_title' => 'iSCSI-Storage Host Boot-Service', - 'boot_service_content' => 'The iSCSI-Storage Plugin provides an openQRM Boot-Service. - This "iSCSI-Storage Boot-Service" is automatically downloaded and executed by the openQRM-Client on all integrated Systems. - The Boot-Service is located at:
    -
    - /usr/share/openqrm/plugins/iscsi-storage/web/boot-service-iscsi-storage.tgz -
    -
    - The "iSCSI-Storage Boot-Service contains the Client files of the iSCSI-Storage Plugin.
    - Also a configuration file for the iSCSI-Storage server is included in this Boot-Service.
    -
    - The Boot-Service configuration can be viewed and administrated by the "openqrm" utility.
    - To view the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n iscsi-storage -a default -
    -
    - To view a Boot-Service configuration of a specific appliance run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n iscsi-storage -a [appliance-name] -
    -
    - To adapt a parameter in the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n iscsi-storage -a default -k [key] -v [value] -
    -
    - To adapt a paramter in the Boot-Service configuration of a specific appliance run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n iscsi-storage -a [appliance-name] -k [key] -v [value] -
    -
    - In case the openmQRM Server itself is used as the iSCSI-Storage Storage please edit:
    -
    - /usr/share/openqrm/plugins/iscsi-storage/etc/openqrm-plugin-iscsi-storage.conf -
    -
    - and set the configuration keys.
    -
    - ', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/iscsi-storage/lang", 'iscsi-storage-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/iscsi-storage/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "documentation"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - case 'bootservice': - $content[] = $this->bootservice(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About iSCSI-Storage - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/iscsi-storage/class/iscsi-storage-about.documentation.class.php'); - $controller = new iscsi_storage_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Boot-Service - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function bootservice( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/iscsi-storage/class/iscsi-storage-about.bootservice.class.php'); - $controller = new iscsi_storage_about_bootservice($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['bootservice']; - $data = $controller->action(); - } - $content['label'] = $this->lang['bootservice']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'bootservice' ); - $content['onclick'] = false; - if($this->action === 'bootservice'){ - $content['active'] = true; - } - return $content; - } - - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage-about.documentation.class.php deleted file mode 100644 index d694f4b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage-about.documentation.class.php +++ /dev/null @@ -1,89 +0,0 @@ - - */ - -class iscsi_storage_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'iscsi_storage_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "iscsi_storage_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/iscsi-storage-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['deployment_title'], 'deployment_title'); - $t->add($this->lang['deployment_content'], 'deployment_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.add.class.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.add.class.php deleted file mode 100644 index 98f1c97..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.add.class.php +++ /dev/null @@ -1,301 +0,0 @@ - - */ - -class iscsi_storage_add -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'iscsi_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "iscsi_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'iscsi_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'iscsi_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - $this->controller = $controller; - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->user = $openqrm->user(); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = $this->openqrm->storage(); - $resource = $this->openqrm->resource(); - $deployment = $this->openqrm->deployment(); - $this->response->params['storage_id'] = $this->response->html->request()->get('storage_id'); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->set_max(); - $response = $this->add(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->controller->reload(); - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/iscsi-storage-add.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Add - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function add() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - if($form->get_request('size') > $this->max) { - $form->set_error('size', sprintf($this->lang['error_size_exeeded'], number_format($this->max, 0, '', '').' MB')); - } - if(!$form->get_errors()) { - $name = $form->get_request('name'); - $size = $form->get_request('size'); - $command = $this->openqrm->get('basedir')."/plugins/iscsi-storage/bin/openqrm-iscsi-storage add -n ".$name." -m ".$size; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = $this->storage; - $resource = $this->resource; - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $statfile = $this->openqrm->get('basedir').'/plugins/iscsi-storage/web/storage/'.$storage->resource_id.'.iscsi.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[2]; - if($name === $check) { - $error = sprintf($this->lang['error_exists'], $name); - } - } - } - } - } - if(isset($error)) { - $response->error = $error; - } else { - if($this->file->exists($statfile)) { - $this->file->remove($statfile); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($statfile)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - // add check that volume $name is now in the statfile - $created = false; - $volume_path = ""; - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[2]; - if($name === $check) { - $created = true; - $volume_path = '/dev/'.$name.'/1'; - break; - } - } - } - } - - if ($created) { - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $name; - $image_fields['image_type'] = $this->deployment->type; - $image_fields['image_rootfstype'] = 'ext3'; - $image_fields['image_storageid'] = $this->storage->id; - $image_fields['image_comment'] = "Image Object for volume $name"; - $image_fields['image_rootdevice'] = $volume_path; - $image_fields['image_size']=$size; - $image = new image(); - $image->add($image_fields); - $response->msg = sprintf($this->lang['msg_added'], $name); - // save image id in response for the wizard - $response->image_id = $image_fields["image_id"]; - - } else { - $response->msg = sprintf($this->lang['msg_add_failed'], $name); - } - } - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'add'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['css'] = 'namegen'; - $d['name']['object']['attrib']['customattribs'] = 'data-prefix="iscsi" data-length="6"'; - $d['name']['object']['attrib']['value'] = ''; - $d['name']['object']['attrib']['maxlength'] = 50; - - $d['size']['label'] = sprintf($this->lang['form_size'], number_format($this->max, 0, '', '').' MB'); - $d['size']['required'] = true; - $d['size']['validate']['regex'] = '/^[0-9]+$/i'; - $d['size']['validate']['errormsg'] = sprintf($this->lang['error_size'], '0-9'); - $d['size']['object']['type'] = 'htmlobject_input'; - $d['size']['object']['attrib']['name'] = 'size'; - $d['size']['object']['attrib']['type'] = 'text'; - $d['size']['object']['attrib']['value'] = ''; - $d['size']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - - //-------------------------------------------- - /** - * Set max - * - * @access protected - * @return bool - */ - //-------------------------------------------- - function set_max() { - $statfile = $this->openqrm->get('basedir').'/plugins/iscsi-storage/web/storage/'.$this->resource->id.'.iscsi.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $max = $line[1]; - $max = (int)$max; - $this->max = $max; - return true; - break; - } - } - } else { - return false; - } - } else { - return false; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.api.class.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.api.class.php deleted file mode 100644 index 9711613..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.api.class.php +++ /dev/null @@ -1,98 +0,0 @@ - - */ - -class iscsi_storage_api -{ - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param object $iscsi_storage_controller - */ - //-------------------------------------------- - function __construct($iscsi_storage_controller) { - $this->controller = $iscsi_storage_controller; - $this->user = $this->controller->user; - $this->html = $this->controller->response->html; - $this->response = $this->html->response(); - $this->file = $this->controller->file; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - */ - //-------------------------------------------- - function action() { - $action = $this->html->request()->get($this->controller->actions_name); - switch( $action ) { - case 'monitor': - $this->monitor(); - break; - case 'progress': - $this->progress(); - break; - } - } - - //-------------------------------------------- - /** - * Monitor - * - * @access public - */ - //-------------------------------------------- - function monitor() { - $filename = '/etc/ietd.conf'; - $lastmodif = isset($_GET['timestamp']) ? $_GET['timestamp'] : 0; - $currentmodif = filemtime($filename); - while ($currentmodif <= $lastmodif) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - $currentmodif = filemtime($filename); - } - echo 'changed'; - - } - - //-------------------------------------------- - /** - * Get progress - * - * @access public - */ - //-------------------------------------------- - function progress() { - $name = basename($this->response->html->request()->get('name')); - $file = $this->controller->openqrm->get('basedir').'/plugins/iscsi-storage/web/storage/'.$name; - if($this->file->exists($file)) { - echo $this->file->get_contents($file); - } else { - header("HTTP/1.0 404 Not Found"); - } - } - - - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.auth.class.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.auth.class.php deleted file mode 100644 index b066968..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.auth.class.php +++ /dev/null @@ -1,199 +0,0 @@ - - */ - -class iscsi_storage_auth -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'iscsi_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "iscsi_storage_msg"; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'iscsi_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'iscsi_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->file = $this->openqrm->file(); - $this->volume = $this->response->html->request()->get('volume'); - $this->response->params['volume'] = $this->volume; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->auth(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/iscsi-storage-auth.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add(sprintf($this->lang['label'], $this->volume), 'label'); - // explanation for auth - $t->add($this->lang['auth_explanation'], 'auth_explanation'); - $t->add($response->form); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Auth - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function auth() { - $response = $this->get_response(); - $export = $response->html->request()->get('volume'); - $form = $response->form; - if( $export !== '' ) { - if(!$form->get_errors() && $response->submit()) { - // set ENV - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - - $errors = array(); - $message = array(); - $auths = $form->get_request('pass'); - $statfile = $this->openqrm->get('basedir').'/plugins/iscsi-storage/web/storage/'.$resource->id.'.iscsi.stat'; - - $error = ''; - $command = $this->openqrm->get('basedir').'/plugins/iscsi-storage/bin/openqrm-iscsi-storage auth'; - $command .= ' -n '.$export.' -i '.$auths; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - if($this->file->exists($statfile)) { - $this->file->remove($statfile); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($statfile)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $message[] = sprintf($this->lang['msg_authd'], $export, $auths); - if(count($errors) === 0) { - $response->msg = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response->error = join('
    ', $msg); - } - } - } else { - $response->msg = ''; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'auth'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['pass']['label'] = $this->lang['form_pass']; - $d['pass']['required'] = true; - $d['pass']['object']['type'] = 'htmlobject_input'; - $d['pass']['object']['attrib']['name'] = 'pass'; - $d['pass']['object']['attrib']['type'] = 'password'; - $d['pass']['object']['attrib']['value'] = ''; - $d['pass']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.clone.class.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.clone.class.php deleted file mode 100644 index c8b59ba..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.clone.class.php +++ /dev/null @@ -1,239 +0,0 @@ - - */ - -class iscsi_storage_clone -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'iscsi_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "iscsi_storage_msg"; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'iscsi_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'iscsi_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->user = $openqrm->user(); - $this->volume = $this->response->html->request()->get('volume'); - $this->response->params['volume'] = $this->volume; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->duplicate(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/iscsi-storage-clone.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add(sprintf($this->lang['label'], $this->volume), 'label'); - $t->add($response->form); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Snap - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function duplicate() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $name = $form->get_request('name'); - $command = $this->openqrm->get('basedir').'/plugins/iscsi-storage/bin/openqrm-iscsi-storage clone'; - $command .= ' -n '.$this->volume; - $command .= ' -s '.$name; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $statfile = $this->openqrm->get('basedir').'/plugins/iscsi-storage/web/storage/'.$storage->resource_id.'.iscsi.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[2]; - if($name === $check) { - $error = sprintf($this->lang['error_exists'], $name); - } - } - } - } - } - if(isset($error)) { - $response->error = $error; - } else { - $file = $this->openqrm->get('basedir').'/plugins/iscsi-storage/web/storage/'.$resource->id.'.iscsi.'.$name.'.sync_progress'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - - $volume_path = '/dev/'.$name.'/1'; - $orgigin_image = new image(); - $orgigin_image->get_instance_by_name($this->volume); - - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $name; - $image_fields['image_type'] = $deployment->type; - $image_fields['image_rootfstype'] = 'ext3'; - $image_fields['image_storageid'] = $storage->id; - $image_fields['image_comment'] = "Image Object for volume $name"; - $image_fields['image_rootdevice'] = $volume_path; - $image_fields['image_size'] = $orgigin_image->size; - $image = new image(); - $image->add($image_fields); - - $response->msg = sprintf($this->lang['msg_cloned'], $this->volume, $name); - // save image id in response for the wizard - $response->image_id = $image_fields["image_id"]; - } - - } - return $response; - } - - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'clone'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['css'] = 'namegen'; - $d['name']['object']['attrib']['customattribs'] = 'data-prefix="iscsi" data-length="6"'; - $d['name']['object']['attrib']['value'] = $this->volume.'c'; - $d['name']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.controller.class.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.controller.class.php deleted file mode 100644 index ac0af38..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.controller.class.php +++ /dev/null @@ -1,528 +0,0 @@ - - */ - -class iscsi_storage_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'iscsi_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "iscsi_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'iscsi_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'iscsi_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array ( - 'tab' => 'Select iSCSI-storage', - 'label' => 'Select iSCSI-storage', - 'action_edit' => 'edit', - 'table_name' => 'Name', - 'table_id' => 'Id', - 'table_recource' => 'Resource', - 'table_type' => 'Type', - 'table_deployment' => 'Deployment', - 'error_no_storage' => 'No storage configured yet!

    Please create a iSCSI Storage first!', - 'new_storage' => 'New Storage', - 'please_wait' => 'Loading Storage. Please wait ..', - ), - 'edit' => array ( - 'tab' => 'Edit iSCSI-storage', - 'label' => 'iSCSI Volumes on storage %s', - 'lang_id' => 'ID', - 'lang_name' => 'Name', - 'lang_resource' => 'Resource', - 'lang_state' => 'State', - 'lang_vfree' => 'Free', - 'lang_vsize' => 'Total', - 'action_add' => 'Add new Volume', - 'action_refresh' => 'Reload Page', - 'action_auth' => 'auth', - 'action_clone' => 'clone', - 'action_remove' => 'remove', - 'action_add_image' => 'Add Image', - 'action_remove_image' => 'Remove Image', - 'action_clone_in_progress' => 'Synchronisation in progress - Please wait', - 'action_clone_finished' => 'Syncronisation finished!', - 'table_name' => 'Name', - 'table_size' => 'Size', - 'table_username' => 'Username', - 'table_password' => 'Password', - 'error_no_iscsi' => 'Storage %s is not of type iscsi-deployment', - 'please_wait' => 'Loading Volumes. Please wait ..', - 'manual_configured' => 'Storage is manually configured and can not be be edited by openQRM', - ), - 'add' => array ( - 'tab' => 'Add iSCSI Volume', - 'label' => 'Add new Volume', - 'form_name' => 'Name', - 'form_size' => 'Size (max. %s)', - 'msg_added' => 'Added Volume %s', - 'msg_add_failed' => 'Failed to add Volume %s', - 'error_exists' => 'Volume %s allready exists', - 'error_name' => 'Name must be %s', - 'error_size' => 'Size must be %s', - 'error_size_exeeded' => 'Size exeeds %s', - 'please_wait' => 'Adding Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'image' => array ( - 'label' => 'Add/Remove Image for Volume %s', - 'tab' => 'Add/Remove Image', - 'error_exists' => 'Image %s allready exists', - 'error_image_still_in_use' => 'Image id %s is still in use by Server(s) %s', - 'msg_added_image' => 'Added Image %s', - 'msg_removed_image' => 'Removed Image id %s', - 'please_wait' => 'Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'clone' => array ( - 'tab' => 'Clone iSCSI Volume', - 'label' => 'Clone Volume %s', - 'msg_cloned' => 'Cloned %s as %s', - 'msg_clone_failed' => 'Failed to clone Volume %s', - 'form_name' => 'Name', - 'error_exists' => 'Volume %s allready exists', - 'error_name' => 'Name must be %s', - 'please_wait' => 'Cloning Volume(s). Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'remove' => array ( - 'label' => 'Remove Volume(s)', - 'msg_removed' => 'Removed Volume %s', - 'msg_image_still_in_use' => 'Volume %s of Image id %s is still in use by appliance(s) %s', - 'please_wait' => 'Removing Volume(s). Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'auth' => array ( - 'tab' => 'Authenticate Volume', - 'label' => 'Authenticate Volume %s', - 'form_pass' => 'Password', - 'msg_authd' => 'Authenticated volume %s to %s', - 'auth_explanation' => 'Please notice: Volumes which are deployed as an Image via an Appliance are authenticated automatically!', - 'please_wait' => 'Authenticating Volume(s). Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/iscsi-storage/lang", 'iscsi-storage.ini'); - $this->tpldir = $this->rootdir.'/plugins/iscsi-storage/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "edit"; - } - if($this->action !== 'select') { - $this->response->params['storage_id'] = $this->response->html->request()->get('storage_id'); - } - $content = array(); - switch( $this->action ) { - case '': - case 'select': - $content[] = $this->select(true); - break; - case 'edit': - $content[] = $this->select(false); - $content[] = $this->edit(true); - break; - case 'reload': - $this->action = 'edit'; - $content[] = $this->select(false); - $content[] = $this->edit(true); - $this->reload(); - break; - case 'add': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->add(true); - break; - case 'image': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->image(true); - break; - case 'remove': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->remove(true); - break; - case 'clone': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->duplicate(true); - break; - case $this->lang['edit']['action_auth']: - case 'auth': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->auth(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * API - * - * @access public - */ - //-------------------------------------------- - function api() { - require_once($this->rootdir.'/plugins/iscsi-storage/class/iscsi-storage.api.class.php'); - $controller = new iscsi_storage_api($this); - $controller->action(); - } - - - //-------------------------------------------- - /** - * Select Storages of type iscsi - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/iscsi-storage/class/iscsi-storage.select.class.php'); - $controller = new iscsi_storage_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Edit iscsi-storage - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function edit( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - if($this->reload()) { - require_once($this->rootdir.'/plugins/iscsi-storage/class/iscsi-storage.edit.class.php'); - $controller = new iscsi_storage_edit($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['edit']; - $data = $controller->action(); - } - } - $content['label'] = $this->lang['edit']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'edit' ); - $content['onclick'] = false; - if($this->action === 'edit'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add new Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function add( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/iscsi-storage/class/iscsi-storage.add.class.php'); - $controller = new iscsi_storage_add($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['add']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['add']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'add' ); - $content['onclick'] = false; - if($this->action === 'add'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add/Remvoe Image object - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function image( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/iscsi-storage/class/iscsi-storage.image.class.php'); - $controller = new iscsi_storage_image($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['image']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['image']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'image' ); - $content['onclick'] = false; - if($this->action === 'image'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Remove Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function remove( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/iscsi-storage/class/iscsi-storage.remove.class.php'); - $controller = new iscsi_storage_remove($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['remove']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Remove'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'remove' ); - $content['onclick'] = false; - if($this->action === 'remove' || $this->action === $this->lang['edit']['action_remove']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Clone Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function duplicate( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/iscsi-storage/class/iscsi-storage.clone.class.php'); - $controller = new iscsi_storage_clone($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['clone']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['clone']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'clone' ); - $content['onclick'] = false; - if($this->action === 'clone' || $this->action === $this->lang['edit']['action_clone']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Auth Volume - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function auth( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/iscsi-storage/class/iscsi-storage.auth.class.php'); - $controller = new iscsi_storage_auth($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['auth']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['auth']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'auth' ); - $content['onclick'] = false; - if($this->action === 'auth' || $this->action === $this->lang['edit']['action_auth']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Reload Exports - * - * @access public - */ - //-------------------------------------------- - function reload() { - $OPENQRM_SERVER_BASE_DIR = $this->openqrm->get('basedir'); - $command = $OPENQRM_SERVER_BASE_DIR."/plugins/iscsi-storage/bin/openqrm-iscsi-storage post_luns"; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $storage->get_instance_by_id($storage_id); - $resource = new resource(); - $resource->get_instance_by_id($storage->resource_id); - $file = $this->openqrm->get('basedir').'/plugins/iscsi-storage/web/storage/'.$resource->id.'.iscsi.stat'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - return true; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.edit.class.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.edit.class.php deleted file mode 100644 index 93a9556..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.edit.class.php +++ /dev/null @@ -1,329 +0,0 @@ - - */ - -class iscsi_storage_edit -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'iscsi_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "iscsi_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'iscsi_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'iscsi_identifier'; -/** -* identifier name -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Init - * - * @access public - */ - //-------------------------------------------- - function init() { - $storage_id = $this->response->html->request()->get('storage_id'); - if($storage_id === '') { - return false; - } - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $this->resource = $resource; - $this->storage = $storage; - $this->deployment = $deployment; - - $this->statfile = $this->openqrm->get('basedir').'/plugins/iscsi-storage/web/storage/'.$resource->id.'.iscsi.stat'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->init(); - $data = $this->edit(); - if($data !== false) { - $t = $this->response->html->template($this->tpldir.'/iscsi-storage-edit.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($data); - $t->add($this->lang['lang_id'], 'lang_id'); - $t->add($this->lang['lang_name'], 'lang_name'); - $t->add($this->lang['lang_resource'], 'lang_resource'); - $t->add($this->lang['lang_state'], 'lang_state'); - $t->add($this->lang['lang_vfree'], 'lang_vfree'); - $t->add($this->lang['lang_vsize'], 'lang_vsize'); - $t->add(sprintf($this->lang['label'], $data['name']), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } else { - $msg = sprintf($this->lang['error_no_iscsi'], $this->response->html->request()->get('storage_id')); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return array|false - */ - //-------------------------------------------- - function edit() { - - - if($this->deployment->type === 'iscsi-deployment') { - $resource_icon_default="/img/resource.png"; - $storage_icon="/plugins/iscsi-storage/img/plugin.png"; - $state_icon = $this->openqrm->get('baseurl')."/img/".$this->resource->state.".png"; - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default=$storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - - $d['state'] = ""; - $d['icon'] = ""; - $d['resource'] = $this->resource->id.' / '.$this->resource->ip; - $d['name'] = $this->storage->name; - $d['id'] = $this->storage->id; - - $a = $this->response->html->a(); - $a->label = $this->lang['action_add']; - $a->css = 'add'; - $a->handler = 'onclick="wait();"'; - $a->href = $this->response->get_url($this->actions_name, "add"); - $d['add'] = $a->get_string(); - - $body = array(); - $identifier_disabled = array(); - $file = $this->statfile; - if(file_exists($file)) { - $lines = explode("\n", file_get_contents($file)); - if(count($lines) >= 1) { - $i = 0; - $t = $this->response->html->template($this->openqrm->get('webdir').'/js/openqrm-progressbar.js'); - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($i === 0) { - $d['vsize'] = number_format($line[0], 0, '', '').' MB'; - $d['vfree'] = number_format($line[1], 0, '', '').' MB'; - } else { - $name = $line[2]; - $volume_size = $line[5]; - $auth_link = ' '; - $clone_link = ' '; - // create/remove image object, check if image exists - $image_add_remove = ''; - $deployment_type = ''; - $image = new image(); - $image->get_instance_by_name($name); - if (strlen($image->id)) { - if( $image->type == $this->deployment->type ) { - if( $line[0] === $this->deployment->type ) { - if($d['vfree'] !== '0 MB' ) { - $a = $this->response->html->a(); - $a->title = $this->lang['action_clone']; - $a->label = $this->lang['action_clone']; - $a->handler = 'onclick="wait();"'; - $a->css = 'clone'; - $a->href = $this->response->get_url($this->actions_name, "clone").'&volume='.$name; - $clone_link = $a->get_string(); - } - $a = $this->response->html->a(); - $a->title = $this->lang['action_auth']; - $a->label = $this->lang['action_auth']; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($this->actions_name, "auth").'&volume='.$name; - $auth_link = $a->get_string(); - } else { - $identifier_disabled[] = $name; - } - } - } - - // create/remove image object, check if image exists - $deployment_type = $this->deployment->type; - if (strlen($image->id)) { - if( $image->type != $this->deployment->type ) { - $deployment_type = $image->type; - $identifier_disabled[] = $name; - } else { - $i = $this->response->html->a(); - $i->title = $this->lang['action_remove_image']; - $i->label = $this->lang['action_remove_image']; - $i->handler = 'onclick="wait();"'; - $i->css = 'edit'; - $i->href = $this->response->get_url($this->actions_name, "image").'&image_id='.$image->id.'&image_command=remove'; - $image_add_remove = $i; - } - } else { - $i = $this->response->html->a(); - $i->title = $this->lang['action_add_image']; - $i->label = $this->lang['action_add_image']; - $i->handler = 'onclick="wait();"'; - $i->css = 'edit'; - if($this->deployment->type === 'iscsi-deployment') { - $image_root_device = '/dev/'.$name.'/1'; - $i->href = $this->response->get_url($this->actions_name, "image").'&root_device='.$image_root_device.'&image_name='.$name.'&image_command=add'; - } - $identifier_disabled[] = $name; - $image_add_remove = $i; - } - if ($volume_size == "clone_in_progress") { - // add to disabled identifier - $identifier_disabled[] = $name; - $auth_link = " "; - $clone_link = " "; - $image_add_remove = " "; - // progressbar - $t->add(uniqid('b'), 'id'); - $t->add($this->openqrm->get('baseurl').'/api.php?action=plugin&plugin=iscsi-storage&iscsi_storage_action=progress&name='.$this->resource->id.'.iscsi.'.$name.'.sync_progress', 'url'); - $t->add($this->lang['action_clone_in_progress'], 'lang_in_progress'); - $t->add($this->lang['action_clone_finished'], 'lang_finished'); - $volume_size = $t->get_string(); - - } else { - if (is_numeric($volume_size)) { - $volume_size = number_format($line[5], 0, '', '').' MB'; - } else { - $volume_size = ''; - } - } - $body[] = array( - 'icon' => $d['icon'], - 'name' => $name, - 'username' => $line[3], - 'password' => $line[4], - 'size' => $volume_size, - 'image' => $image_add_remove, - 'auth' => $auth_link, - 'clone' => $clone_link, - ); - } - } - $i++; - } - } - } - - $h['icon'] = array(); - $h['icon']['title'] = ' '; - $h['icon']['sortable'] = false; - $h['name'] = array(); - $h['name']['title'] = $this->lang['table_name']; - $h['username'] = array(); - $h['username']['title'] = $this->lang['table_username']; - $h['password'] = array(); - $h['password']['title'] = $this->lang['table_password']; - $h['size'] = array(); - $h['size']['title'] = $this->lang['table_size']; - $h['image'] = array(); - $h['image']['title'] = ' '; - $h['image']['sortable'] = false; - $h['auth'] = array(); - $h['auth']['title'] = ' '; - $h['auth']['sortable'] = false; - $h['clone']['title'] = ' '; - $h['clone']['sortable'] = false; - - $table = $this->response->html->tablebuilder('iscsi_edit', $this->response->get_array($this->actions_name, 'edit')); - $table->sort = 'name'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = count($body); - $table->autosort = true; - $table->sort_link = false; - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $body; - $table->identifier = 'name'; - $table->identifier_name = $this->identifier_name; - $table->identifier_disabled = $identifier_disabled; - $table->actions_name = $this->actions_name; - $table->actions = array(array('remove' => $this->lang['action_remove'])); - - $d['table'] = $table->get_string(); - return $d; - } else { - return false; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.image.class.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.image.class.php deleted file mode 100644 index 805ff8f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.image.class.php +++ /dev/null @@ -1,197 +0,0 @@ - - */ - -class iscsi_storage_image -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'iscsi_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "iscsi_storage_msg"; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'iscsi_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'iscsi_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - $this->response->add('storage_id', $storage_id); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->image(); - $this->response->params['reload'] = 'false'; - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response) - ); - } - - //-------------------------------------------- - /** - * Add/Remove image object - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function image() { - $response = ''; - $errors = array(); - $message = array(); - $image_command = $this->response->html->request()->get('image_command'); - - if( $image_command !== '' ) { - switch ($image_command) { - case 'add': - $root_device = $this->response->html->request()->get('root_device'); - $image_name = $this->response->html->request()->get('image_name'); - // check if image name is not in use yet - $image = new image(); - $image->get_instance_by_name($image_name); - if (strlen($image->id)) { - $errors[] = sprintf($this->lang['error_exists'], $image_name); - } else { - $ident_file = $this->openqrm->get('basedir').'/plugins/iscsi-storage/web/storage/'.$this->resource->id.'.iscsi.'.$image_name.'.adapt'; - $get_ident_command = $this->openqrm->get('basedir').'/plugins/iscsi-storage/bin/openqrm-iscsi-storage adapt'; - $get_ident_command .= ' -n '.$image_name; - $get_ident_command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $get_ident_command .= ' --openqrm-ui-user '.$this->user->name; - $get_ident_command .= ' --openqrm-cmd-mode background'; - if(file_exists($ident_file)) { - unlink($ident_file); - } - $this->resource->send_command($this->resource->ip, $get_ident_command); - while (!file_exists($ident_file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - unlink($ident_file); - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $image_name; - $image_fields['image_type'] = $this->deployment->type; - $image_fields['image_rootfstype'] = 'ext3'; - $image_fields['image_storageid'] = $this->storage->id; - $image_fields['image_comment'] = "Image Object for volume $image_name"; - $image_fields['image_rootdevice'] = $root_device; - $image = new image(); - $image->add($image_fields); - $message[] = sprintf($this->lang['msg_added_image'], $image_name); - } - break; - - case 'remove': - $image_id = $this->response->html->request()->get('image_id'); - // check if image is not in use any more before removing - $remove_error = 0; - $appliance = new appliance(); - $appliance_id_list = $appliance->get_all_ids(); - foreach($appliance_id_list as $appliance_list) { - $appliance_id = $appliance_list['appliance_id']; - $app_image_remove_check = new appliance(); - $app_image_remove_check->get_instance_by_id($appliance_id); - if ($app_image_remove_check->imageid == $image_id) { - $image_is_used_by_appliance .= $appliance_id." "; - $remove_error = 1; - } - } - if ($remove_error == 1) { - $errors[] = sprintf($this->lang['error_image_still_in_use'], $image_id, $image_is_used_by_appliance); - } else { - $image_remove = new image(); - $image_remove->remove($image_id); - $message[] = sprintf($this->lang['msg_removed_image'], $image_id); - } - break; - } - if(count($errors) === 0) { - $response = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response = join('
    ', $msg); - } - } else { - $response = ''; - } - return $response; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.remove.class.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.remove.class.php deleted file mode 100644 index 3b08f1e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.remove.class.php +++ /dev/null @@ -1,217 +0,0 @@ - - */ - -class iscsi_storage_remove -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'iscsi_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "iscsi_storage_msg"; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'iscsi_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'iscsi_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->remove(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/iscsi-storage-remove.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($response->form); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Remove - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function remove() { - $response = $this->get_response(); - $exports = $response->html->request()->get($this->identifier_name); - $form = $response->form; - if( $exports !== '' ) { - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $i = 0; - foreach($exports as $ex) { - $d['param_f'.$i]['label'] = $ex; - $d['param_f'.$i]['object']['type'] = 'htmlobject_input'; - $d['param_f'.$i]['object']['attrib']['type'] = 'checkbox'; - $d['param_f'.$i]['object']['attrib']['name'] = $this->identifier_name.'['.$i.']'; - $d['param_f'.$i]['object']['attrib']['value'] = $ex; - $d['param_f'.$i]['object']['attrib']['checked'] = true; - $i++; - } - $form->add($d); - if(!$form->get_errors() && $response->submit()) { - $storage_id = $this->response->html->request()->get('storage_id'); - $name = $this->openqrm->admin()->name; - $pass = $this->openqrm->admin()->password; - $storage = new storage(); - $resource = new resource(); - $errors = array(); - $message = array(); - foreach($exports as $key => $export) { - // check if an appliance is still using the volume as an image - $image = new image(); - $image->get_instance_by_name($export); - - // check if it is still in use - $appliance = new appliance(); - $appliances_using_resource = $appliance->get_ids_per_image($image->id); - if (count($appliances_using_resource) > 0) { - $appliances_using_resource_str = implode(",", $appliances_using_resource[0]); - $errors[] = sprintf($this->lang['msg_image_still_in_use'], $export, $image->id, $appliances_using_resource_str); - } else { - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $command = $this->openqrm->get('basedir').'/plugins/iscsi-storage/bin/openqrm-iscsi-storage remove -n '.$export; - $command .= ' -u '.$name.' -p '.$pass; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $file = $this->openqrm->get('basedir').'/plugins/iscsi-storage/web/storage/'.$resource->id.'.iscsi.stat'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - - #$error = $resource->send_command($resource->ip, $command); - #if($error !== '' ) { - # $errors[] = $error; - #} else { - $form->remove($this->identifier_name.'['.$key.']'); - $message[] = sprintf($this->lang['msg_removed'], $export); - #} - // remove the image of the volume - $image->remove_by_name($export); - } - } - if(count($errors) === 0) { - $response->msg = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response->error = join('
    ', $msg); - } - } - } else { - $response->msg = ''; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'remove'); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.select.class.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.select.class.php deleted file mode 100644 index 299743a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/class/iscsi-storage.select.class.php +++ /dev/null @@ -1,214 +0,0 @@ - - */ - -class iscsi_storage_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'iscsi_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "iscsi_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'iscsi_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'iscsi_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $table = $this->select(); - $t = $this->response->html->template($this->tpldir.'/iscsi-storage-select.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($table, 'table'); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return htmlobject_tablebulider | htmlobject_div - */ - //-------------------------------------------- - function select() { - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - - $deployment->get_instance_by_type("iscsi-deployment"); - $table = $this->response->html->tablebuilder('iscsi', $this->response->get_array($this->actions_name, 'select')); - $table->sort = 'storage_id'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = $storage->get_count_per_type($deployment->id); - $table->autosort = false; - $table->sort_link = false; - $table->init(); - $storages = $storage->display_overview_per_type($deployment->id, $table->offset, $table->limit, $table->sort, $table->order); - - if(count($storages) >= 1) { - foreach($storages as $k => $v) { - $storage->get_instance_by_id($v["storage_id"]); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - $resource_icon_default="/img/resource.png"; - $storage_icon="/plugins/iscsi-storage/img/plugin.png"; - $state_icon = ''.$resource->state.''; - - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default=$storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - - $a = $this->response->html->a(); - $a->title = $this->lang['action_edit']; - $a->label = $this->lang['action_edit']; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($this->actions_name, "edit").'&storage_id='.$storage->id; - - $data = ''.$this->lang['table_recource'].': '.$resource->id.' / '.$resource->ip.'
    '; - $data .= ''.$this->lang['table_type'].': '.$deployment->type.'
    '; - $data .= ''.$this->lang['table_deployment'].': '.$deployment->storagedescription.'
    '; - - $b[] = array( - 'state' => $state_icon, -// 'icon' => 'Icon', - 'storage_id' => $storage->id, - 'storage_name' => $storage->name, - 'storage_resource_id' => $storage->resource_id, - 'storage_data' => $data, - 'storage_comment' => '', - 'storage_edit' => $a->get_string(), - ); - } - - $h = array(); - $h['state'] = array(); - $h['state']['title'] =' '; - $h['state']['sortable'] = false; -/* - $h['icon'] = array(); - $h['icon']['title'] =' '; - $h['icon']['sortable'] = false; -*/ - $h['storage_id'] = array(); - $h['storage_id']['title'] = $this->lang['table_id']; - $h['storage_name'] = array(); - $h['storage_name']['title'] = $this->lang['table_name']; - $h['storage_resource_id'] = array(); - $h['storage_resource_id']['title'] = $this->lang['table_recource']; - $h['storage_resource_id']['hidden'] = true; - $h['storage_data'] = array(); - $h['storage_data']['title'] = ' '; - $h['storage_data']['sortable'] = false; - $h['storage_comment'] = array(); - $h['storage_comment']['title'] =' '; - $h['storage_comment']['sortable'] = false; - $h['storage_edit'] = array(); - $h['storage_edit']['title'] = ' '; - $h['storage_edit']['sortable'] = false; - - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $b; - $table->limit_select = array( - array("value" => 10, "text" => 10), - array("value" => 20, "text" => 20), - array("value" => 30, "text" => 30), - array("value" => 40, "text" => 40), - array("value" => 50, "text" => 50), - ); - return $table->get_string(); - } else { - $a = $this->response->html->a(); - $a->title = $this->lang['new_storage']; - $a->label = $this->lang['new_storage']; - $a->handler = 'onclick="wait();"'; - $a->css = 'add'; - $a->href = $this->response->html->thisfile.'?base=storage&storage_action=add'; - - $box = $this->response->html->div(); - $box->id = 'Tabelle'; - $box->css = 'htmlobject_box'; - $content = $this->lang['error_no_storage'].'

    '; - $content .= $a->get_string(); - $box->add($content); - return $box->get_string(); - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/css/iscsi-storage.css b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/css/iscsi-storage.css deleted file mode 100644 index e69de29..0000000 diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/image.iscsi-deployment.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/image.iscsi-deployment.php deleted file mode 100644 index f2e913c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/image.iscsi-deployment.php +++ /dev/null @@ -1,106 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - - -function iscsi_deployment_wait_for_identfile($sfile) { - $refresh_delay=1; - $refresh_loop_max=20; - $refresh_loop=0; - while (!file_exists($sfile)) { - sleep($refresh_delay); - $refresh_loop++; - flush(); - if ($refresh_loop > $refresh_loop_max) { - return false; - } - } - return true; -} - - -function get_iscsi_deployment_image_rootdevice_identifier($iscsi_storage_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - - // place for the storage stat files - $StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/iscsi-storage/storage'; - $rootdevice_identifier_array = array(); - $storage = new storage(); - $storage->get_instance_by_id($iscsi_storage_id); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_resource_id = $storage_resource->id; - $ident_file = "$StorageDir/$storage_resource_id.iscsi.ident"; - if (file_exists($ident_file)) { - unlink($ident_file); - } - // send command - $resource_command=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/iscsi-storage/bin/openqrm-iscsi-storage post_identifier -u ".$OPENQRM_ADMIN->name." -p ".$OPENQRM_ADMIN->password." --openqrm-cmd-mode background"; - $storage_resource->send_command($storage_resource->ip, $resource_command); - if (!iscsi_deployment_wait_for_identfile($ident_file)) { - $event->log("get_image_rootdevice_identifier", $_SERVER['REQUEST_TIME'], 2, "image.iscsi-deployment", "Timeout while requesting image identifier from storage id $storage->id", "", "", 0, 0, 0); - return; - } - $fcontent = file($ident_file); - foreach($fcontent as $lun_info) { - $tpos = strpos($lun_info, ","); - $timage_name = trim(substr($lun_info, 0, $tpos)); - $troot_device = trim(substr($lun_info, $tpos+1)); - $rootdevice_identifier_array[] = array("value" => "$troot_device", "label" => "$timage_name"); - } - return $rootdevice_identifier_array; - -} - -function get_iscsi_deployment_image_default_rootfs() { - return "ext3"; -} - -function get_iscsi_deployment_rootfs_transfer_methods() { - return true; -} - -function get_iscsi_deployment_rootfs_set_password_method() { - return true; -} - -function get_iscsi_deployment_is_network_deployment() { - return true; -} - -function get_iscsi_deployment_local_deployment_enabled() { - return false; -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/img/plugin.png deleted file mode 100644 index bdd9f5e..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/iscsi-storage-action.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/iscsi-storage-action.php deleted file mode 100644 index ffb7cee..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/iscsi-storage-action.php +++ /dev/null @@ -1,120 +0,0 @@ - -*/ - - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/authblocker.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -// filter inputs -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; - -global $IMAGE_INFO_TABLE; -global $DEPLOYMENT_INFO_TABLE; -global $OPENQRM_SERVER_BASE_DIR; - -$iscsi_storage_command = $request->get('iscsi_storage_command'); -$iscsi_image_name = $request->get('iscsi_image_name'); - -// place for the storage stat files -$StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/iscsi-storage/storage'; -// global event for logging -$event = new event(); - -// user/role authentication -if ($OPENQRM_USER->role != "administrator") { - $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "iscsi-action", "Un-Authorized access to iscsi-actions from $OPENQRM_USER->name", "", "", 0, 0, 0); - exit(); -} - - -$event->log("$iscsi_storage_command", $_SERVER['REQUEST_TIME'], 5, "iscsi-storage-action", "Processing iscsi-storage command $iscsi_storage_command", "", "", 0, 0, 0); -switch ($iscsi_storage_command) { - case 'get_storage': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'get_ident': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'get_sync_progress': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'get_sync_finished': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - sleep(5); - unlink($filename); - break; - - case 'auth_finished': - // remove storage-auth-blocker if existing - $authblocker = new authblocker(); - $authblocker->get_instance_by_image_name($iscsi_image_name); - if (strlen($authblocker->id)) { - $event->log('auth_finished', $_SERVER['REQUEST_TIME'], 5, "iscsi-storage-action", "Removing authblocker for image $iscsi_image_name", "", "", 0, 0, 0); - $authblocker->remove($authblocker->id); - } - break; - - default: - $event->log("$iscsi_storage_command", $_SERVER['REQUEST_TIME'], 3, "iscsi-storage-action", "No such iscsi-storage command ($iscsi_storage_command)", "", "", 0, 0, 0); - break; -} - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/lang/de.iscsi-storage-about.ini b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/lang/de.iscsi-storage-about.ini deleted file mode 100644 index f3e56b7..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/lang/de.iscsi-storage-about.ini +++ /dev/null @@ -1,66 +0,0 @@ -[documentation] -tab = "Über iSCSI-Storage" -label = "Über iSCSI-Storage" -introduction_title = "Einleitung" -introduction_content = "Das 'iSCSI-Storage' Plugin verwaltet iSCSI Target Server." -requirements_title = "Anforderungen" -requirements_list = "Eine 'Resource' für die iSCSI-Storage Storage
    (dies kann ein System sein das mittels des "local-server" Plugin in openQRM eingebunden ist oder der openQRM Server selber)" - -tested_title = "Testet mit" -tested_content = "Diese Plugin ist getestet mit Debian, Ubuntu und CentOS Linux Distributionen" - -provides_title = "Bietet" -provides_list = "
    • Storage Typen: 'iSCSI Enterprise Target Storage'
    • -
    • Deployment types: 'iSCSI-deployment'
    " -type_title = "Plugin Typ" -type_content = "Storage" - -deployment_title = "Deployment Typ" -deployment_content = "Netzwerk-Deployment" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" -network_deploymet = "Netzwerk-Deployment" -doc1 = "" - - -[bootservice] -tab = "Boot-Service" -label = "iSCSI-Storage Boot-Service" -boot_service_title = "iSCSI-Storage Boot-Service" -boot_service_content = "Das iSCSI-Storage Plugin beinhaltet einen openQRM Boot-Service. - Dieser 'iSCSI-Storage Boot-Service' wird automatisch von allen in openQRM integrierten Systeme heruntergeladen und ausgeführt. - Der Boot-Service befindet sich unter:
    -
    - /usr/share/openqrm/plugins/iscsi-storage/web/boot-service-iscsi-storage.tgz -
    -
    - Der 'iSCSI-Storage Boot-Service' beinhaltet die 'Client' Dateien des iSCSI-Storage Plugin.
    - Eine Konfigurationsdatei für den iSCSI-Storage Server ist ebenfalls enhalten.
    -
    - Die Boot-Service konfiguration wird mittels des 'openqrm' Kommandozeilenwerkzeugs verwaltet.
    - Der folgende Befehl zeigt die die momentane 'default' Boot-Service Konfiguration an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n iscsi-storage -a default -
    -
    - Die Boot-Service Konfiguration eines speziellen Server zeigt der folgende Befehl an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n iscsi-storage -a [Server-name] -
    -
    - Der folgende Befehl passt einen Konfigurationparameter des 'default' Boot-Service an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n iscsi-storage -a default -k [key] -v [value] -
    -
    - Die Boot-Service Konfigurarationsparameter eines speziellen Server passt der folgende Befehl an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n iscsi-storage -a [Server-name] -k [key] -v [value] -
    -
    - Im Falle das der openmQRM Server selber als iSCSI-Storage genutzt wird werden die Konfigurationsparameter in der folgenden Datei manuell angeepasst:
    -
    - /usr/share/openqrm/plugins/iscsi-storage/etc/openqrm-plugin-iscsi-storage.conf -

    " - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/lang/de.iscsi-storage.ini b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/lang/de.iscsi-storage.ini deleted file mode 100644 index 115b47a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/lang/de.iscsi-storage.ini +++ /dev/null @@ -1,85 +0,0 @@ -[select] -tab = "iSCSI-storage auswählen" -label = "iSCSI-storage auswählen" -action_edit = "bearbeiten" -table_name = "Name" -table_id = "Id" -table_recource = "Resource" -table_type = "Type" -table_deployment = "Deployment" -error_no_storage = "Keine Storage angelegt!

    Bitte legen Sie erst eine iSCSI Storage an!" -new_storage = "Neue Storage" -please_wait = "Lade Storage. Bitte warten .." -[edit] -tab = "iSCSI-storage bearbeiten" -label = "iSCSI Volumes auf Storage %s" -lang_id = "ID" -lang_name = "Name" -lang_resource = "Resource" -lang_state = "Status" -lang_vfree = "Frei" -lang_vsize = "Gesamt" -action_add = "Neues Volume anlegen" -action_refresh = "Reload Page" -action_remove = "löschen" -action_auth = "auth" -action_clone = "klonen" -action_add_image = "Image hinzufügen" -action_remove_image = "Image entfernen" -action_clone_in_progress = "Syncronisation in Bearbeitung - Bitte warten" -action_clone_finished = "Syncronisation beendet!" -table_name = "Name" -table_size = "Grösse" -table_username = "Benutzer" -table_password = "Passwort" -error_no_iscsi = "Storage %s ist nicht vom nfs-deployment" -please_wait = "Lade Volumes. Bitte warten .." -manual_configured = "Storage ist manuell konfiguriert und kann nicht von openQRM verwaltet werden!" -[add] -tab = "Neues iSCSI Volume" -label = "Neues iSCSI Volume anlegen" -form_name = "Name" -form_size = "Size" -msg_added = "Volume %s angelegt" -msg_add_failed = "Fehler beim anlegen des Volumes %s" -error_exists = "Volume %s besteht bereits" -error_name = "Name darf nur %s beinhalten" -error_size = "Größe darf nur %s beinhalten" -error_size_exeeded = "Größe von %s überschritten" -please_wait = "Erstelle Volume. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -lang_name_generate = "Name generieren" -[image] -label = "Image für Volume %s hinzufügen/entfernen" -tab = "Image hinzufügen/entfernen" -error_exists = "Image %s existiert bereits" -error_image_still_in_use = "Image ID %s ist noch in benutztung von Server %s" -msg_added_image = "Image %s hinzugefügt" -msg_removed_image = "Image id %s entfernt" -please_wait = "Bitt warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[clone] -tab = "Klone iSCSI Volume" -label = "Klone Volume %s" -msg_cloned = "%s als %s geklont" -msg_clone_failed = "Volume %s konnte nicht geklont werden" -form_name = "Name" -lang_name_generate = "Name generieren" -error_exists = "Volume %s besteht bereits" -error_name = "Name darf nur %s beinhalten" -please_wait = "Klone Volume. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[remove] -label = "Volume(s) löschen" -msg_removed = "Volume %s gelöscht" -msg_image_still_in_use = "Das Volume %s des Image ID %s ist noch in benutztung von Server %s" -please_wait = "Lösche Volume(s). Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[auth] -tab = "Volume authentisieren" -label = "Volume %s authentisieren" -form_pass = "Passwort" -msg_authd = "Authentisiere volume %s" -auth_explanation = "Bitte beachten: Volumes die als Image eines Server eingestellt wurden, werden automatisch authentisiert!" -please_wait = "Authentisiere Volume. Please wait .." -canceled = "Operation abgebrochen. Bitte warten .." diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/lang/en.iscsi-storage-about.ini b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/lang/en.iscsi-storage-about.ini deleted file mode 100644 index 5a36e71..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/lang/en.iscsi-storage-about.ini +++ /dev/null @@ -1,69 +0,0 @@ -[documentation] -tab = "About iSCSI-Storage" -label = "About iSCSI-Storage" -introduction_title = "Introduction" -introduction_content = "The 'iSCSI-Storage' plugin manages iSCSI-Server in openQRM. - " -requirements_title = "Requirements" -requirements_list = "A resource for the iSCSI-Storage Storage (this can be a remote system integrated into openQRM e.g. via the 'local-server' plugin or the openQRM server itself)" - -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions." - -provides_title = "Provides" -provides_list = "
    • Storage type: 'iSCSI Enterprise Target Storage'
    • -
    • Deployment types: 'iSCSI-deployment'
    " -type_title = "Plugin Type" -type_content = "Storage" - -deployment_title = "Deployment Type" -deployment_content = "Network-Deployment" - -documentation_title = "Documentation" -use_case_title = "Use-Case" -network_deploymet = "Network-Deployment" -doc1 = "" - - -[bootservice] -tab = "Boot-Service" -label = "iSCSI-Storage Boot-Service" -boot_service_title = "iSCSI-Storage Host Boot-Service" -boot_service_content = "The iSCSI-Storage Plugin provides an openQRM Boot-Service. - This 'iSCSI-Storage Boot-Service' is automatically downloaded and executed by the openQRM-Client on all integrated Systems. - The Boot-Service is located at:
    -
    - /usr/share/openqrm/plugins/iscsi-storage/web/boot-service-iscsi-storage.tgz -
    -
    - The 'iSCSI-Storage Boot-Service contains the Client files of the iSCSI-Storage Plugin.
    - Also a configuration file for the iSCSI-Storage server is included in this Boot-Service.
    -
    - The Boot-Service configuration can be viewed and administrated by the 'openqrm' utility.
    - To view the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n iscsi-storage -a default -
    -
    - To view a Boot-Service configuration of a specific Server run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n iscsi-storage -a [Server-name] -
    -
    - To adapt a parameter in the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n iscsi-storage -a default -k [key] -v [value] -
    -
    - To adapt a paramter in the Boot-Service configuration of a specific Server run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n iscsi-storage -a [Server-name] -k [key] -v [value] -
    -
    - In case the openmQRM Server itself is used as the iSCSI-Storage Storage please edit:
    -
    - /usr/share/openqrm/plugins/iscsi-storage/etc/openqrm-plugin-iscsi-storage.conf -
    -
    - and set the configuration keys.
    -
    " diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/lang/en.iscsi-storage.ini b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/lang/en.iscsi-storage.ini deleted file mode 100644 index a8c983b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/lang/en.iscsi-storage.ini +++ /dev/null @@ -1,85 +0,0 @@ -[select] -tab = "Select iSCSI-storage" -label = "Select iSCSI-storage" -action_edit = "edit" -table_name = "Name" -table_id = "Id" -table_recource = "Resource" -table_type = "Type" -table_deployment = "Deployment" -error_no_storage = "No storage configured yet!

    Please create a iSCSI Storage first!" -new_storage = "New Storage" -please_wait = "Loading Storage. Please wait .." -[edit] -tab = "Edit iSCSI-storage" -label = "iSCSI Volumes on storage %s" -lang_id = "ID" -lang_name = "Name" -lang_resource = "Resource" -lang_state = "State" -lang_vfree = "Free" -lang_vsize = "Total" -action_add = "Add new Volume" -action_refresh = "Reload Page" -action_auth = "auth" -action_clone = "clone" -action_remove = "remove" -action_add_image = "Add Image" -action_remove_image = "Remove Image" -action_clone_in_progress = "Synchronisation in progress - Please wait" -action_clone_finished = "Syncronisation finished!" -table_name = "Name" -table_size = "Size" -table_username = "Username" -table_password = "Password" -error_no_iscsi = "Storage %s is not of type iscsi-deployment" -please_wait = "Loading Volumes. Please wait .." -manual_configured = "Storage is manually configured and can not be be edited by openQRM" -[add] -tab = "Add iSCSI Volume" -label = "Add new Volume" -form_name = "Name" -form_size = "Size (max. %s)" -msg_added = "Added Volume %s" -msg_add_failed = "Failed to add Volume %s" -error_exists = "Volume %s allready exists" -error_name = "Name must be %s" -error_size = "Size must be %s" -error_size_exeeded = "Size exeeds %s" -please_wait = "Adding Volume. Please wait .." -canceled = "Operation canceled. Please wait .." -lang_name_generate = "generate name" -[image] -label = "Add/Remove Image for Volume %s" -tab = "Add/Remove Image" -error_exists = "Image %s allready exists" -error_image_still_in_use = "Image id %s is still in use by Server(s) %s" -msg_added_image = "Added Image %s" -msg_removed_image = "Removed Image id %s" -please_wait = "Please wait .." -canceled = "Operation canceled. Please wait .." -[clone] -tab = "Clone iSCSI Volume" -label = "Clone Volume %s" -msg_cloned = "Cloned %s as %s" -msg_clone_failed = "Failed to clone Volume %s" -form_name = "Name" -lang_name_generate = "generate name" -error_exists = "Volume %s allready exists" -error_name = "Name must be %s" -please_wait = "Cloning Volume(s). Please wait .." -canceled = "Operation canceled. Please wait .." -[remove] -label = "Remove Volume(s)" -msg_removed = "Removed Volume %s" -msg_image_still_in_use = "Volume %s of Image id %s is still in use by Server %s" -please_wait = "Removing Volume(s). Please wait .." -canceled = "Operation canceled. Please wait .." -[auth] -tab = "Authenticate Volume" -label = "Authenticate Volume %s" -form_pass = "Password" -msg_authd = "Authenticated volume %s to %s" -auth_explanation = "Please notice: Volumes which are deployed as an Image via an Server are authenticated automatically!" -please_wait = "Authenticating Volume(s). Please wait .." -canceled = "Operation canceled. Please wait .." diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/menu.txt deleted file mode 100644 index d797c26..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/menu.txt +++ /dev/null @@ -1,23 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|Iscsi-Storage -...|Volume Admin|index.php?plugin=iscsi-storage|iSCSI Storage Manager -...|About|index.php?plugin=iscsi-storage&controller=iscsi-storage-about|How to use -...|Config|index.php?plugin=iscsi-storage&controller=iscsi-storage-about&iscsi_storage_about_action=bootservice|iSCSI Storage Boot-Service diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/openqrm-iscsi-deployment-auth-hook.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/openqrm-iscsi-deployment-auth-hook.php deleted file mode 100644 index 73c5977..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/openqrm-iscsi-deployment-auth-hook.php +++ /dev/null @@ -1,331 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/image_authentication.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; - -/** - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - */ - - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $IMAGE_AUTHENTICATION_TABLE; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - - - //-------------------------------------------------- - /** - * authenticates the storage volume for the appliance resource - * - * storage_auth_function("start", 2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_function($cmd, $appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $IMAGE_AUTHENTICATION_TABLE; - global $openqrm_server; - - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $resource_mac=$resource->mac; - $resource_ip=$resource->ip; - - switch($cmd) { - case "start": - // authenticate the rootfs / needs openqrm user + pass - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - // generate a password for the image - $image_password = $image->generatePassword(12); - $image_deployment_parameter = $image->deployment_parameter; - $image->set_deployment_parameters("IMAGE_ISCSI_AUTH", $image_password); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-iscsi-deployment-auth-hook.php", "Authenticating $image_name / $image_rootdevice to resource $resource_mac with password $image_password", "", "", 0, 0, $appliance_id); - $auth_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -n ".$image_name." -r ".$image_rootdevice." -i ".$image_password." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $resource->send_command($storage_ip, $auth_start_cmd); - - // authenticate the install-from-nfs export - $run_disable_deployment_export=0; - $install_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_INSTALL_FROM_NFS")); - if (strlen($install_from_nfs_param)) { - - // storage -> resource -> auth - $ip_storage_id=$deployment->parse_deployment_parameter("id", $install_from_nfs_param); - $ip_storage_ip=$deployment->parse_deployment_parameter("ip", $install_from_nfs_param); - $ip_image_rootdevice=$deployment->parse_deployment_parameter("path", $install_from_nfs_param); - - $ip_storage = new storage(); - $ip_storage->get_instance_by_id($ip_storage_id); - $ip_storage_resource = new resource(); - $ip_storage_resource->get_instance_by_id($ip_storage->resource_id); - $op_storage_ip = $ip_storage_resource->ip; - - $ip_deployment = new deployment(); - $ip_deployment->get_instance_by_id($ip_storage->type); - $ip_deployment_type = $ip_deployment->type; - $ip_deployment_plugin_name = $ip_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-iscsi-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $ip_storage_id:$ip_storage_ip:$ip_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$ip_deployment_plugin_name."/bin/openqrm-".$ip_deployment_plugin_name." auth -r ".$ip_image_rootdevice." -i ".$resource_ip." -t ".$ip_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($ip_storage_ip, $auth_install_from_nfs_start_cmd); - - $run_disable_deployment_export=1; - } - - // authenticate the transfer-to-nfs export - $transfer_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_TRANSFER_TO_NFS")); - if (strlen($transfer_from_nfs_param)) { - // storage -> resource -> auth - $tp_storage_id=$deployment->parse_deployment_parameter("id", $transfer_from_nfs_param); - $tp_storage_ip=$deployment->parse_deployment_parameter("ip", $transfer_from_nfs_param); - $tp_image_rootdevice=$deployment->parse_deployment_parameter("path", $transfer_from_nfs_param); - - $tp_storage = new storage(); - $tp_storage->get_instance_by_id($tp_storage_id); - $tp_storage_resource = new resource(); - $tp_storage_resource->get_instance_by_id($tp_storage->resource_id); - $op_storage_ip = $tp_storage_resource->ip; - - $tp_deployment = new deployment(); - $tp_deployment->get_instance_by_id($tp_storage->type); - $tp_deployment_type = $tp_deployment->type; - $tp_deployment_plugin_name = $tp_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-iscsi-deployment-auth-hook.php", "Transfer-to-NFS: Authenticating $resource_ip on storage id $tp_storage_id:$tp_storage_ip:$tp_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$tp_deployment_plugin_name."/bin/openqrm-".$tp_deployment_plugin_name." auth -r ".$tp_image_rootdevice." -i ".$resource_ip." -t ".$tp_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($tp_storage_ip, $auth_install_from_nfs_start_cmd); - - $run_disable_deployment_export=1; - } - - // do we need to disable the install-from/transfer-to-nfs exports ? - if ($run_disable_deployment_export == 1) { - $image_authentication = new image_authentication(); - $ia_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_auth_ar = array( - 'ia_id' => $ia_id, - 'ia_image_id' => $appliance->imageid, - 'ia_resource_id' => $appliance->resources, - 'ia_auth_type' => 1, - ); - $image_authentication->add($image_auth_ar); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-iscsi-deployment-auth-hook.php", "Registered image $appliance->imageid for de-authentication the deployment exports when resource $appliance->resources is fully up.", "", "", 0, 0, $appliance_id); - } - - break; - - case "stop": - $image_authentication = new image_authentication(); - $ia_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_auth_ar = array( - 'ia_id' => $ia_id, - 'ia_image_id' => $appliance->imageid, - 'ia_resource_id' => $appliance->resources, - 'ia_auth_type' => 0, - ); - $image_authentication->add($image_auth_ar); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-iscsi-deployment-auth-hook.php", "Registered image $appliance->imageid for de-authentication the root-fs exports when resource $appliance->resources is idle again.", "", "", 0, 0, $appliance_id); - break; - - } - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage volume for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - // generate a password for the image - $image_password = $image->generatePassword(12); - $image_deployment_parameter = $image->deployment_parameter; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $event->log("storage_auth_stop_in_background", $_SERVER['REQUEST_TIME'], 5, "openqrm-iscsi-deployment-auth-hook.php", "Authenticating $image_name / $image_rootdevice with password $image_password", "", "", 0, 0, $appliance_id); - $auth_stop_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -r ".$image_rootdevice." -i ".$image_password." --openqrm-cmd-mode background"; - $resource = new resource(); - $resource->send_command($storage_ip, $auth_stop_cmd); - // and update the image params - $image->set_deployment_parameters("IMAGE_ISCSI_AUTH", $image_password); - - } - - - //-------------------------------------------------- - /** - * de-authenticates the storage deployment volumes for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_deployment_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_deployment_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - // just for sending the commands - $resource = new resource(); - - // get install deployment params - $install_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_INSTALL_FROM_NFS")); - if (strlen($install_from_nfs_param)) { - // storage -> resource -> auth - $ip_storage_id=$deployment->parse_deployment_parameter("id", $install_from_nfs_param); - $ip_storage_ip=$deployment->parse_deployment_parameter("ip", $install_from_nfs_param); - $ip_image_rootdevice=$deployment->parse_deployment_parameter("path", $install_from_nfs_param); - - $ip_storage = new storage(); - $ip_storage->get_instance_by_id($ip_storage_id); - $ip_storage_resource = new resource(); - $ip_storage_resource->get_instance_by_id($ip_storage->resource_id); - $op_storage_ip = $ip_storage_resource->ip; - - $ip_deployment = new deployment(); - $ip_deployment->get_instance_by_id($ip_storage->type); - $ip_deployment_type = $ip_deployment->type; - $ip_deployment_plugin_name = $ip_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-iscsi-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $ip_storage_id:$ip_storage_ip:$ip_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$ip_deployment_plugin_name."/bin/openqrm-".$ip_deployment_plugin_name." auth -r ".$ip_image_rootdevice." -i ".$OPENQRM_SERVER_IP_ADDRESS." -t ".$ip_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($ip_storage_ip, $auth_install_from_nfs_start_cmd); - } - - // get transfer deployment params - $transfer_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_TRANSFER_TO_NFS")); - if (strlen($transfer_from_nfs_param)) { - // storage -> resource -> auth - $tp_storage_id=$deployment->parse_deployment_parameter("id", $transfer_from_nfs_param); - $tp_storage_ip=$deployment->parse_deployment_parameter("ip", $transfer_from_nfs_param); - $tp_image_rootdevice=$deployment->parse_deployment_parameter("path", $transfer_from_nfs_param); - - $tp_storage = new storage(); - $tp_storage->get_instance_by_id($tp_storage_id); - $tp_storage_resource = new resource(); - $tp_storage_resource->get_instance_by_id($tp_storage->resource_id); - $op_storage_ip = $tp_storage_resource->ip; - - $tp_deployment = new deployment(); - $tp_deployment->get_instance_by_id($tp_storage->type); - $tp_deployment_type = $tp_deployment->type; - $tp_deployment_plugin_name = $tp_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-iscsi-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $tp_storage_id:$tp_storage_ip:$tp_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$tp_deployment_plugin_name."/bin/openqrm-".$tp_deployment_plugin_name." auth -r ".$tp_image_rootdevice." -i ".$OPENQRM_SERVER_IP_ADDRESS." -t ".$tp_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($tp_storage_ip, $auth_install_from_nfs_start_cmd); - } - - } - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/openqrm-iscsi-deployment-cloud-hook.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/openqrm-iscsi-deployment-cloud-hook.php deleted file mode 100644 index 55aacf9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/openqrm-iscsi-deployment-cloud-hook.php +++ /dev/null @@ -1,174 +0,0 @@ - -*/ - - -// This file implements the cloud storage methods - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -// special cloud classes -require_once "$RootDir/plugins/cloud/class/cloudimage.class.php"; - -$event = new event(); -global $event; - -global $OPENQRM_SERVER_BASE_DIR; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $RESOURCE_INFO_TABLE; - - -// --------------------------------------------------------------------------------- -// general cloudstorage methods -// --------------------------------------------------------------------------------- - - -// clones the volume of an image -function create_clone_iscsi_deployment($cloud_image_id, $image_clone_name, $disk_size) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("create_clone", $_SERVER['REQUEST_TIME'], 5, "iscsi-deployment-cloud-hook", "Creating clone of image on storage", "", "", 0, 0, 0); - - // we got the cloudimage id here, get the image out of it - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image, this is already the new logical clone - // we just need to physical snapshot it and update the rootdevice - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - - // generate a new image password for the clone - $image->get_instance_by_id($image_id); - $image_password = $image->generatePassword(12); - $image->set_deployment_parameters("IMAGE_ISCSI_AUTH", $image_password); - $image_location=dirname($image_rootdevice); - $image_location_name=basename($image_location); - // update the image rootdevice parameter - $ar_image_update = array( - 'image_rootdevice' => "/dev/$image_clone_name/1", - ); - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "iscsi-deployment-cloud-hook", "Updating rootdevice of image $image_id / $image_name with /dev/$image_clone_name/1", "", "", 0, 0, 0); - $image->update($image_id, $ar_image_update); - $image_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/iscsi-storage/bin/openqrm-iscsi-storage snap -n ".$image_location_name." -s ".$image_clone_name." -i ".$image_password." --openqrm-cmd-mode background"; - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "iscsi-deployment-cloud-hook", "Running : $image_clone_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_clone_cmd); -} - - - -// removes the volume of an image -function remove_iscsi_deployment($cloud_image_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("remove_iscsi_deployment", $_SERVER['REQUEST_TIME'], 5, "iscsi-deployment-cloud-hook", "Removing image on storage", "", "", 0, 0, 0); - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - - $image_location=dirname($image_rootdevice); - $image_location_name=basename($image_location); - $image_remove_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/iscsi-storage/bin/openqrm-iscsi-storage remove -n ".$image_location_name." --openqrm-cmd-mode background"; - $event->log("remove_iscsi_deployment", $_SERVER['REQUEST_TIME'], 5, "iscsi-deployment-cloud-hook", "Running : $image_remove_clone_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_remove_clone_cmd); -} - - -// resizes the volume of an image -function resize_iscsi_deployment($cloud_image_id, $resize_value) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("resize_iscsi_deployment", $_SERVER['REQUEST_TIME'], 2, "iscsi-deployment-cloud-hook", "Resize image is not supported for iscsi-storage!", "", "", 0, 0, 0); -} - - - -// creates a private copy of the volume of an image -function create_private_iscsi_deployment($cloud_image_id, $private_disk, $private_image_name) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("create_private_iscsi_deployment", $_SERVER['REQUEST_TIME'], 2, "iscsi-deployment-cloud-hook", "Creating private image is not supported for iscsi-storage!", "", "", 0, 0, 0); -} - - - -// --------------------------------------------------------------------------------- - - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/root-mount.iscsi-deployment b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/root-mount.iscsi-deployment deleted file mode 100644 index 6259587..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/root-mount.iscsi-deployment +++ /dev/null @@ -1,356 +0,0 @@ -#!/bin/bash -# this is the root-mount initrd-service -# which proivdes function to mount/remount the remote -# iscsi-rootfs according to the image_deployment_parameters at /mnt -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# iscsi-storage -# Required defines in the image_deploy_paramters -# -# -# Optional parameters -# -# IMAGE_INSTALL_FROM_NFS - can be set to an (nfs) location from -# which the image will be installed at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_TRANSFER_TO_NFS - can be set to an (nfs) location from -# which the image will be transfered to at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_INSTALL_FROM_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this -# option will install the iscsi-storage image on -# boot-time from the local-device -# -# IMAGE_TRANSFER_TO_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this option will transfrom -# the iscsi-storage image on boot-time to the local-device -# -# -# -# IMAGE_INSTALL_FROM_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_TRANSFER_TO_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_NFS_MOUNT_OPTIONS - can be e.g. set to proto=tcp for the install/transform phase -# - -# get the deployment parameters from openqrm.conf -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -. $OPENQRM_RESOURCE_PARAMETER_FILE -eval $image_deployment_parameter -export OPENQRM_SERVER_BASE_DIR=$resource_basedir -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - -# nfs-options for the install+transform phase -if [ "$IMAGE_NFS_MOUNT_OPTIONS" != "" ]; then - IMAGE_NFS_MOUNT_OPTIONS=",$IMAGE_NFS_MOUNT_OPTIONS" -fi -# default to ext3 -if [ "$IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" == "" ]; then - IMAGE_INSTALL_FROM_LOCAL_FS_TYPE="ext3" -fi -if [ "$IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" == "" ]; then - IMAGE_TRANSFER_TO_LOCAL_FS_TYPE="ext3" -fi - -# here we gather the target name + lun from the image_rootdevice -IMAGE_TARGET=`echo $image_rootdevice | cut -d'/' -f3` -IMAGE_LUN=`echo $image_rootdevice | cut -d'/' -f4` - -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - export WGET="wget --no-check-certificate -q" -else - export WGET="wget -q" -fi -####################################################################### -# required functions ################################################## -####################################################################### - -function mount_rootfs() { - - # check to find the right binaries fitting to kernel + rootfs - if [ "$kernel_name" == "default" ]; then - # we get the default binaries - # get iscsid via wget from the openQRM-servers boot-service dir - $WGET -O /sbin/iscsid $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsid - $WGET -O /sbin/iscsiadm $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsiadm - else - # we try to get the binaries fitting to the kernel name - # -> if a special version is not available we go with the default - if ! $WGET -O /sbin/iscsid $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsid.$kernel_name; then - $WGET -O /sbin/iscsid $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsid - fi - if ! $WGET -O /sbin/iscsiadm $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsiadm.$kernel_name; then - $WGET -O /sbin/iscsiadm $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsiadm - fi - - fi - chmod +x /sbin/iscsi* - mkdir -p /tmp - - # load iscsi related modules - modprobe iscsi_tcp - modprobe libiscsi - modprobe scsi_transport_iscsi - modprobe scsi_mod - modprobe sg - modprobe sd_mod - modprobe ib_iser - - # create config /etc/iscsi/iscsid.conf - mkdir -p /etc/iscsi/ - cat >> /etc/iscsi/iscsid.conf << EOF -node.startup = manual -node.session.timeo.replacement_timeout = 120 -node.conn[0].timeo.login_timeout = 15 -node.conn[0].timeo.logout_timeout = 15 -node.conn[0].timeo.noop_out_interval = 10 -node.conn[0].timeo.noop_out_timeout = 15 -node.session.iscsi.InitialR2T = No -node.session.iscsi.ImmediateData = Yes -node.session.iscsi.FirstBurstLength = 262144 -node.session.iscsi.MaxBurstLength = 16776192 -node.conn[0].iscsi.MaxRecvDataSegmentLength = 65536 - -node.session.auth.authmethod = CHAP -node.session.auth.username = $IMAGE_TARGET -node.session.auth.password = $IMAGE_ISCSI_AUTH - -EOF - - # create /etc/iscsi/initiatorname.iscsi - cat >> /etc/iscsi/initiatorname.iscsi << EOF -InitiatorName=iqn.1993-08.org.debian:01:31721e7e6b8f -EOF - # also create /etc/initiatorname.iscsi, some open-iscsi version looking for that - cp /etc/iscsi/initiatorname.iscsi /etc/initiatorname.iscsi - - # start syslog + klogd - syslogd & - klogd& - - # start iscsid - /sbin/iscsid & - sleep 2 - - # - - # discover - echo "iscsi-storage: Discoverying Iscsi-target $image_storage_server_ip:3260" - iscsiadm -m discovery -t sendtargets -p $image_storage_server_ip:3260 - - # login - iscsiadm -m node -T $IMAGE_TARGET -p $image_storage_server_ip:3260 --login - - # let udev settle - sleep 4 - - # check that udev found the new device - FIND_ISCSI_BLOCK_DEVICE=`find /sys/class/iscsi_session/session*/device/target*/*/ -name block | head -n1` - if [ "$FIND_ISCSI_BLOCK_DEVICE" == "" ]; then - FIND_ISCSI_BLOCK_DEVICE=`find /sys/class/iscsi_session/session*/device/target*/*/ -name block:s* | head -n1` - if [ "$FIND_ISCSI_BLOCK_DEVICE" == "" ]; then - echo "ERROR: Udev did not detect the new device" - echo "ERROR: Could not look-up the Iscsi device in the sys-fs dir" - # give a shell for the admin - /bin/bash - fi - fi - # check for different sysfs styles - if [ -h $FIND_ISCSI_BLOCK_DEVICE ]; then - ISCSI_BLOCK_DEVICE_NAME=`readlink $FIND_ISCSI_BLOCK_DEVICE` - ISCSI_BLOCK_DEVICE_NAME=`basename $ISCSI_BLOCK_DEVICE_NAME` - echo "SUCCESS: Found $ISCSI_BLOCK_DEVICE_NAME in sys-fs (as symlink)" - elif [ -d $FIND_ISCSI_BLOCK_DEVICE ]; then - ISCSI_BLOCK_DEVICE_NAME=`ls $FIND_ISCSI_BLOCK_DEVICE` - echo "SUCCESS: Found $ISCSI_BLOCK_DEVICE_NAME in sys-fs (as dir)" - else - echo "ERROR: Udev did not detect the new device" - echo "ERROR: Could not look-up the Iscsi device in the sys-fs dir" - # give a shell for the admin - /bin/bash - fi - # export the blockdevice name for the further functions - export ISCSI_BLOCK_DEVICE="/dev/$ISCSI_BLOCK_DEVICE_NAME" - - # finallly mount - if ! mount -t $image_rootfstype $ISCSI_BLOCK_DEVICE /mnt; then - # in case we install from nfs we create a fs since this should be a new lun - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - echo "NOTICE: Found install-from-nfs enabled but failed mounting the rootdevice" - echo "NOTICE: Assuming a new (unformatted) Lun -> creating $image_rootfstype filesystem on $ISCSI_BLOCK_DEVICE" - mke2fs -F -j $ISCSI_BLOCK_DEVICE - if ! mount -t $image_rootfstype $ISCSI_BLOCK_DEVICE /mnt; then - echo "ERROR: Could not mount $ISCSI_BLOCK_DEVICE via iscsi" - # give a shell for the admin - /bin/bash - else - echo "iscsi-storage: Mounted $ISCSI_BLOCK_DEVICE rw" - fi - else - echo "ERROR: Could not mount $ISCSI_BLOCK_DEVICE via iscsi" - # give a shell for the admin - /bin/bash - fi - else - echo "iscsi-storage: Mounted $ISCSI_BLOCK_DEVICE rw" - fi - - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - install_rootfs_from_nfs - else - echo "iscsi-storage: Skipping install phase" - fi - if [ "$IMAGE_TRANSFER_TO_NFS" != "" ]; then - transfer_rootfs_to_nfs - else - echo "iscsi-storage: Skipping transfer-to-nfs phase" - fi - if [ "$IMAGE_INSTALL_FROM_LOCAL" != "" ]; then - install_rootfs_from_local - else - echo "iscsi-storage: Skipping install-from-local phase" - fi - if [ "$IMAGE_TRANSFER_TO_LOCAL" != "" ]; then - transfer_rootfs_to_local - else - echo "iscsi-storage: Skipping transfer-to-local phase" - fi -} - - -function remount_rootfs() { - - # Debian/Ubuntu Systems want their nfs-rootfs in rw mode - if [ -f /mnt/etc/apt/sources.list ]; then - if grep ubuntu /mnt/etc/apt/sources.list >/remountlog; then - echo "iscsi-storage: Skipping Re-mount $ISCSI_BLOCK_DEVICE ro" - rm -f /remountlog - return - fi - fi - REMOUNT_LOOP=0 - # remont /mnt ro - while ! mount -t $image_rootfstype -o ro,remount $ISCSI_BLOCK_DEVICE /mnt; do - echo -n "." - sleep 1 - REMOUNT_LOOP=$[ REMOUNT_LOOP + 1 ] - if [ "$REMOUNT_LOOP" == "10" ]; then - echo "ERROR: iscsi-storage could not remount /mnt " - /bin/bash - fi - done - echo "iscsi-storage: Re-mounted $ISCSI_BLOCK_DEVICE ro" - -} - - -function create_fstab() { - rm -f $IMAGE_FSTAB - echo "$ISCSI_BLOCK_DEVICE / $image_rootfstype defaults 0 0" >> $IMAGE_FSTAB -} - - -####################################################################### -# optional functions ################################################## -####################################################################### - -function install_rootfs_from_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f1` - IMAGE_INSTALL_FROM_NFS=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f2-` - echo "iscsi-storage: Installing $resource_image from $IMAGE_INSTALL_FROM_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o ro$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_INSTALL_FROM_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "iscsi-storage: Starting install-from-nfs phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "iscsi-storage: Install-from-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function transfer_rootfs_to_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f1` - IMAGE_TRANSFER_TO_NFS=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f2-` - echo "iscsi-storage: Transfering $resource_image to $IMAGE_TRANSFER_TO_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o rw$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_TRANSFER_TO_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "iscsi-storage: Starting transfer-to-nfs phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "iscsi-storage: Transfer-to-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function install_rootfs_from_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE -o ro $IMAGE_INSTALL_FROM_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_LOCAL / $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "iscsi-storage: Starting install-to-local phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "iscsi-storage: Install-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - -function transfer_rootfs_to_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE -o rw $IMAGE_TRANSFER_TO_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_LOCAL / $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "iscsi-storage: Starting transfer-to-local phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "iscsi-storage: Transfer-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-about-bootservice.tpl.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-about-bootservice.tpl.php deleted file mode 100644 index 96fac92..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-about-bootservice.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    - -
    -
    -

    {boot_service_title}

    - {boot_service_content} -
    -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-about-documentation.tpl.php deleted file mode 100644 index 9ebab02..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-about-documentation.tpl.php +++ /dev/null @@ -1,47 +0,0 @@ - -

    {label}

    - -
    -
    -

    {introduction_title}

    - {introduction_content} - -

    {provides_title}

    - {provides_list} - -

    {requirements_title}

    - {requirements_list} - - -
    -
    -

    {type_title}

    - {type_content} - -

    {deployment_title}

    - {deployment_content} - -

    {tested_title}

    - {tested_content} - -
    -
    - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-add.tpl.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-add.tpl.php deleted file mode 100644 index d80ea69..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-add.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    -
    -{form} -
    - {name} - {size} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-auth.tpl.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-auth.tpl.php deleted file mode 100644 index 8c635b8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-auth.tpl.php +++ /dev/null @@ -1,27 +0,0 @@ - -

    {label}

    - -
    -
    - {auth_explanation} -

    - {form} - {pass} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-clone.tpl.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-clone.tpl.php deleted file mode 100644 index b25b437..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-clone.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    -
    -{form} -
    - {name} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-edit.tpl.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-edit.tpl.php deleted file mode 100644 index 4208c3b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-edit.tpl.php +++ /dev/null @@ -1,36 +0,0 @@ - -

    {label}

    - -
    -
    -
    {lang_id}: {id}
    -
    {lang_name}: {name}
    -
    {lang_resource}: {resource}
    -
    {lang_state}: {state}
    -
    - -
    -
    {lang_vsize} / {lang_vfree}: {vsize} / {vfree}
    -
    - -
    -
    {add}
    -
    -
     
    - {table} -
    diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-remove.tpl.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-remove.tpl.php deleted file mode 100644 index cafa6a6..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-remove.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    - -
    -
    - {form} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-select.tpl.php b/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-select.tpl.php deleted file mode 100644 index 111f228..0000000 --- a/openQRM-5.3.50-CE/src/plugins/iscsi-storage/web/tpl/iscsi-storage-select.tpl.php +++ /dev/null @@ -1,18 +0,0 @@ - -

    {label}

    -{table} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/Makefile b/openQRM-5.3.50-CE/src/plugins/kvm/Makefile deleted file mode 100644 index 661e971..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# this is the openQRM kvm-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/kvm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates - . $(OPENQRM_SERVER_CONF) && cp etc/templates/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-vm - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/js/ - . $(OPENQRM_SERVER_CONF) && cp web/js/*.js $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/js/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/ - . $(OPENQRM_SERVER_CONF) && cp web/image* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/img/ - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/img/ - . $(OPENQRM_SERVER_CONF) && chmod 777 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/class/ - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/css/ - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/lang/ - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/lang/ - . $(OPENQRM_SERVER_CONF) && chmod 777 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/tpl/ - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/tpl/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin - . $(OPENQRM_SERVER_CONF) && cp sbin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/openqrm* - . $(OPENQRM_SERVER_CONF) && tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm -czf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/boot-service-kvm.tgz include/ bin/ etc/init.d/kvm etc/templates/ etc/openqrm-plugin-kvm.conf sbin/ - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/kvm - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/kvm/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/bin/openqrm-kvm b/openQRM-5.3.50-CE/src/plugins/kvm/bin/openqrm-kvm deleted file mode 100644 index 2e095a3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/bin/openqrm-kvm +++ /dev/null @@ -1,1651 +0,0 @@ -#!/bin/bash -# this script automatically manages the lvm volumes for the kvm virtual machines -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -# unblock starting command queue early for non-blocking + ui commands -KVM_COMMAND=$1 -if [ "$KVM_COMMAND" == "post_lv" ] || [ "$KVM_COMMAND" == "post_vg" ] || [ "$KVM_COMMAND" == "post_identifier" ] || [ "$KVM_COMMAND" == "list" ] || [ "$KVM_COMMAND" == "auth" ] || [ "$KVM_COMMAND" == "post_sync_progress" ] || [ "$KVM_COMMAND" == "post_sync_finished" ]; then - openqrm_unblock_starting_queue $@ - NON_BLOCKING=true -fi -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/include/openqrm-plugin-kvm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf -OPENQRM_POSTENCODE="$OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-postencode" -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - OPENQRM_SERVER_IP=$resource_openqrmserver - OPENQRM_EXEC_PORT=$resource_execdport -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS - resource_ip=$OPENQRM_SERVER_IP_ADDRESS - resource_id=0 - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL -fi -export LANG=C -LINEBR=' -' -# how long to wait for the volume authentication, each loop is 5 secs -MAX_VOLUME_AUTHENTICATION_LOOP=1500 -export MAX_VOLUME_AUTHENTICATION_LOOP -# set default deployment type to lvm -OPENQRM_PLUGIN_KVM_FILE_BACKEND="false" -# dir for progress stats -SYNC_PROGRESS_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/lock" -if [ ! -d "$SYNC_PROGRESS_DIR" ]; then - mkdir -p $SYNC_PROGRESS_DIR -fi - -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - -# make sure required deps are installed -if ! check_kvm_deps; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi -# in packages from newer distros qemu-img is named kvm-img -KVM_QEMU_IMG=`which qemu-img` -if [ "$KVM_QEMU_IMG" == "" ]; then - KVM_QEMU_IMG=`which kvm-img` - if [ "$KVM_QEMU_IMG" == "" ]; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - openqrm_post_event 0 "dependencies" 2 "openqrm-kvm" "qemu-img utility missing. Please install qemu-img on resource $resource_id!" - exit 1 - fi -fi - - -function kvm_usage() { - echo "Usage : $0 add/remove/snap/list/resize/clone <-n image-name> <-v volume-group> [-t ]" - echo " [-m size in MB]" - echo " [-s image-snapshot-name]" - echo " [-o image-type e.g. raw, qcow2]" - echo " $0 auth <-r image-rootdevice> <-i authidentifier> [-t ]" - echo " $0 post_vg <-u username> <-p password> [-t ]" - echo " $0 post_lv <-u username> <-p password> <-v volume-group> [-t ]" - echo " $0 post_identifier <-u username> <-p password> [-t ]" - echo " $0 post_sync_progress <-n image-name> <-s image-snapshot-name> <-v volume-group> <-t kvm-bf-deployment/kvm-lvm-deployment> <-u username> <-p password>" - echo " $0 post_sync_finished <-n image-name> <-v volume-group> <-t kvm-bf-deployment/kvm-lvm-deployment> <-u username> <-p password>" - echo " $0 purge_cache <-n image-name/all>" - echo " $0 list_cache" - echo "" - echo "Optional parameters:" - echo " [--openqrm-ui-user ]" - echo " [--openqrm-internal-cmd ]" - echo " [--openqrm-cmd-mode ]" - exit 1 -} - - - - -FULL_COMMANDLINE="$0 $@" -KVM_COMMAND=$1 -shift - -while [ $# -ne 0 ]; do - case "$1" in - -n) - KVM_IMAGE_NAME=$2 - shift - ;; - -m) - KVM_IMAGE_SIZE=$2 - shift - ;; - -s) - KVM_IMAGE_SNAPSHOT_NAME=$2 - shift - ;; - -i) - KVM_IMAGE_AUTH=$2 - shift - ;; - -r) - KVM_IMAGE_ROOTDEVICE=$2 - shift - ;; - -u) - KVM_OPENQRM_USERNAME=$2 - shift - ;; - -p) - KVM_OPENQRM_PASSWORD=$2 - shift - ;; - -v) - KVM_VOLUME_LOCATION=$2 - shift - ;; - -t) - KVM_DEPLOYMENT_TYPE=$2 - shift - ;; - -o) - KVM_IMAGE_TYPE=$2 - shift - ;; - --caching) - KVM_IMAGE_CACHE=$2 - shift - ;; - --openqrm-ui-user) - OPENQRM_UI_USER=$2 - shift - ;; - --openqrm-internal-cmd) - OPENQRM_INTERNAL_CMD=$2 - shift - ;; - --openqrm-cmd-mode) - OPENQRM_CMD_MODE=$2 - shift - ;; - - *) - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - echo "ERROR: Free commandline arguments are not allowed" - kvm_usage - exit 6 - ;; - esac - shift -done - - - - -# main -if [ "$KVM_COMMAND" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage -fi -if [ "$KVM_COMMAND" == "post_lv" ] || [ "$KVM_COMMAND" == "post_vg" ] || [ "$KVM_COMMAND" == "post_identifier" ]; then - if [ "$KVM_OPENQRM_USERNAME" == "" ]; then - kvm_usage - fi - if [ "$KVM_OPENQRM_PASSWORD" == "" ]; then - kvm_usage - fi - if [ "$KVM_COMMAND" == "post_lv" ]; then - if [ "$KVM_VOLUME_LOCATION" == "" ]; then - kvm_usage - fi - fi -else - if [ "$KVM_COMMAND" != "list" ] && [ "$KVM_COMMAND" != "auth" ] && [ "$KVM_COMMAND" != "list_cache" ]; then - if [ "$KVM_IMAGE_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - - if [ "$KVM_COMMAND" != "purge_cache" ]; then - if [ "$KVM_VOLUME_LOCATION" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - fi - fi -fi -if [ "$KVM_DEPLOYMENT_TYPE" == "" ]; then - if [ "$KVM_COMMAND" != "purge_cache" ] && [ "$KVM_COMMAND" != "list_cache" ]; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - kvm_usage - fi -elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-gluster-deployment" ]; then - if ! which gluster 1>/dev/null 2>&1; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - openqrm_post_event 0 "check" 2 "openqrm-kvm" "Gluster/Glusterfs is not installed on resource id $resource_id!" - exit 1 - fi -elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-ceph-deployment" ]; then - if ! which rbd 1>/dev/null 2>&1; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - openqrm_post_event 0 "check" 2 "openqrm-kvm" "Ceph (rbd) is not installed on resource id $resource_id!" - exit 1 - fi -fi - -if [ "$KVM_DEPLOYMENT_TYPE" == "kvm-lvm-deployment" ]; then - # load required lvm modules if needed - if ! grep dm_mod /proc/modules 1>/dev/null; then - modprobe dm-mod 1>/dev/null 2>&1 - modprobe dm-snapshot 1>/dev/null 2>&1 - fi - # check if volume group exists - if ! vgs --unbuffered $KVM_VOLUME_LOCATION 1>/dev/null 2>&1; then - openqrm_post_event 0 "check" 2 "openqrm-kvm" "Could not find volume group $KVM_VOLUME_LOCATION on the storage-server!" - echo "ERROR: Could not find volume-group $KVM_VOLUME_LOCATION on the storage-server!" - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - exit 1 - fi -fi -# set some default if not given by cmdline params -if [ "$KVM_IMAGE_TYPE" == "" ]; then - KVM_IMAGE_TYPE=$OPENQRM_PLUGIN_KVM_DEFAULT_IMAGE_TYPE -fi -if [ "$OPENQRM_UI_USER" != "" ]; then - OPENQRM_UI_USER_PARAMETER=" --openqrm-ui-user $OPENQRM_UI_USER" -fi -if [ "$KVM_IMAGE_CACHE" == "" ]; then - KVM_IMAGE_CACHE=true -fi - - -case "$KVM_COMMAND" in - - add) - if [ "$KVM_DEPLOYMENT_TYPE" == "kvm-bf-deployment" ]; then - # check if already exists - FILE_BACKEND_DIR=`kvm_get_backend_dir $KVM_VOLUME_LOCATION` - if [ -e "$FILE_BACKEND_DIR/$KVM_IMAGE_NAME" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Volume $KVM_IMAGE_NAME already exists" - exit 1 - fi - echo "Creating local blockfile $KVM_IMAGE_NAME size $KVM_IMAGE_SIZE MB using location $KVM_VOLUME_LOCATION" - if [ ! -d "$FILE_BACKEND_DIR" ]; then - mkdir -p $FILE_BACKEND_DIR - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # Convert MB to Bytes - IMGSIZE=$(( $KVM_IMAGE_SIZE * 1000 * 1000 )) - - CMD_ERR=`$KVM_QEMU_IMG create -f $KVM_IMAGE_TYPE $FILE_BACKEND_DIR/$KVM_IMAGE_NAME $IMGSIZE 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Error creating volume $KVM_IMAGE_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-lvm-deployment" ]; then - # check if already exists - if [ -e /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Volume $KVM_IMAGE_NAME already exists" - exit 1 - fi - echo "Creating logical volume $KVM_IMAGE_NAME size $KVM_IMAGE_SIZE MB using volume group $KVM_VOLUME_LOCATION" - - # aquire lock for kvm - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # aquire global lock for lvm operations - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock aquire lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD $LOCK_TIME "Creating volume $KVM_IMAGE_NAME" - fi - fi - - kvm_refresh_lvm - CMD_ERR=`lvcreate $OPENQRM_PLUGIN_KVM_LVCREATE_CUSTOM_PARAM -L$KVM_IMAGE_SIZE"M" -n$KVM_IMAGE_NAME $KVM_VOLUME_LOCATION 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Error creating volume $KVM_IMAGE_NAME! $CMD_ERR" - - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - # release lock for kvm - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-gluster-deployment" ]; then - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - CMD_ERR=`$KVM_QEMU_IMG create -f $KVM_IMAGE_TYPE gluster://$resource_ip/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME $KVM_IMAGE_SIZE"M" 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Error creating volume $KVM_IMAGE_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-ceph-deployment" ]; then - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - CMD_ERR=`rbd create $KVM_IMAGE_NAME --size $KVM_IMAGE_SIZE --pool $KVM_VOLUME_LOCATION --image-format 2 $OPENQRM_PLUGIN_KVM_CEPH_IMAGE_FEATURE 2>&1` -# CMD_ERR=`$KVM_QEMU_IMG create -f $KVM_IMAGE_TYPE rbd:$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME $KVM_IMAGE_SIZE"M" 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Error creating volume $KVM_IMAGE_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - fi - # if we have an image name send size back to openQRM - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?lvm_command=set_image_size&kvm_image_name=$KVM_IMAGE_NAME&kvm_image_size=$KVM_IMAGE_SIZE"; then - openqrm_post_event 0 "add" 2 "openqrm-kvm" "Could post size of volume $KVM_IMAGE_NAME!" - fi - # in case we have a username + password post the updated list to the openQRM-server - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - $0 post_lv -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD -v $KVM_VOLUME_LOCATION -t $KVM_DEPLOYMENT_TYPE $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - fi - openqrm_post_event 0 "add" 5 "openqrm-kvm" "Created volume $KVM_IMAGE_NAME at $KVM_VOLUME_LOCATION." - ;; - - remove) - if [ "$KVM_DEPLOYMENT_TYPE" == "kvm-bf-deployment" ]; then - FILE_BACKEND_DIR=`kvm_get_backend_dir $KVM_VOLUME_LOCATION` - if [ ! -e "$FILE_BACKEND_DIR/$KVM_IMAGE_NAME" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "remove" 5 "openqrm-kvm" "Volume $FILE_BACKEND_DIR/$KVM_IMAGE_NAME does not exists!" - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - CMD_ERR=`/bin/rm -f $FILE_BACKEND_DIR/$KVM_IMAGE_NAME 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Error removing volume $KVM_IMAGE_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-lvm-deployment" ]; then - # check that no snapshots existing with this volume as the origin - if lvs | awk '{ print $5 }' | grep -w $KVM_IMAGE_NAME 1>/dev/null; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "remove" 3 "openqrm-kvm" "Snapshot exist from volume /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME. Not removing!" - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # aquire global lock for lvm operations - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock aquire lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD $LOCK_TIME "Removing volume $KVM_IMAGE_NAME" - fi - fi - kvm_refresh_lvm - # make sure no dev mappings keeping the volume busy - kvm_clean_dev_maps $KVM_IMAGE_NAME $KVM_VOLUME_LOCATION - lvchange -a n -y /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME - CMD_ERR=`lvremove -f /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME 2>&1` - if [ "$?" != 0 ]; then - # try again, lvm sometimes is fancy - sleep 2 - CMD_ERR=`lvremove -f /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME 2>&1` - if [ "$?" != 0 ]; then - sleep 2 - if [ -e /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - VOL_STATUS=`lvs /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME | tail -n1` - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Error removing volume $KVM_IMAGE_NAME! $CMD_ERR" - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Volume status $KVM_IMAGE_NAME: $VOL_STATUS" - - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - fi - fi - - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-gluster-deployment" ]; then - # remove needs to be done through a glusterfs client, mount via nfs - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - GLUSTER_VOL_TMP_DIR="/tmp/kvm-gluster.$KVM_IMAGE_NAME" - mkdir -p $GLUSTER_VOL_TMP_DIR - - # mount - CMD_ERR=`mount -t nfs $resource_ip:$KVM_VOLUME_LOCATION $GLUSTER_VOL_TMP_DIR 2>&1` - if [ "$?" != 0 ]; then - rmdir $GLUSTER_VOL_TMP_DIR - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Error mounting Gluster $resource_ip:$KVM_VOLUME_LOCATION! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - # remove - CMD_ERR=`rm -f $GLUSTER_VOL_TMP_DIR/$KVM_IMAGE_NAME 2>&1` - if [ "$?" != 0 ]; then - rmdir $GLUSTER_VOL_TMP_DIR - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Error removing volume $KVM_IMAGE_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - # umount - CMD_ERR=`umount $GLUSTER_VOL_TMP_DIR 2>&1` - if [ "$?" != 0 ]; then - rmdir $GLUSTER_VOL_TMP_DIR - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Error umounting Gluster $resource_ip:$KVM_VOLUME_LOCATION! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - rmdir $GLUSTER_VOL_TMP_DIR - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-ceph-deployment" ]; then - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - - # remove - snap or origin? - if echo $KVM_IMAGE_NAME | grep '@' 1>/dev/null; then - CMD_ERR=`rbd snap rm $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME 2>&1` - else - CMD_ERR=`rbd rm $KVM_IMAGE_NAME -p $KVM_VOLUME_LOCATION 2>&1` - fi - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Error removing volume $KVM_IMAGE_NAME from pool $KVM_VOLUME_LOCATION! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - fi - # in case we have a username + password post the updated list to the openQRM-server - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - $0 post_lv -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD -v $KVM_VOLUME_LOCATION -t $KVM_DEPLOYMENT_TYPE $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - fi - openqrm_post_event 0 "remove" 5 "openqrm-kvm" "Removed volume $KVM_IMAGE_NAME from $KVM_VOLUME_LOCATION." - ;; - - snap) - if [ "$KVM_IMAGE_SNAPSHOT_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_DEPLOYMENT_TYPE" == "kvm-bf-deployment" ]; then - # check that source fs-images exist - # notice : here the kvm-volume-location comes from the cloud-hook and uses the dirname of the rootfs-ident - FILE_BACKEND_DIR=`kvm_get_backend_dir $KVM_VOLUME_LOCATION` - if [ ! -e "$FILE_BACKEND_DIR/$KVM_IMAGE_NAME" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "snap" 2 "openqrm-kvm" "Could not find $FILE_BACKEND_DIR/$KVM_IMAGE_NAME on the storage-server!" - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - touch $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - - CMD_ERR=`$KVM_QEMU_IMG create -f qcow2 -b $FILE_BACKEND_DIR/$KVM_IMAGE_NAME $FILE_BACKEND_DIR/$KVM_IMAGE_SNAPSHOT_NAME 2>&1` - if [ "$?" != 0 ]; then - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "snap" 3 "openqrm-kvm" "Error creating snapshot $FILE_BACKEND_DIR/$KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - # Get size of snaped image - KVM_IMAGE_SIZE=$($KVM_QEMU_IMG info $FILE_BACKEND_DIR/$KVM_IMAGE_SNAPSHOT_NAME | grep ^"virtual size" | awk {' print $4 '} | sed -e s/\(//) - KVM_IMAGE_SIZE=$(( $KVM_IMAGE_SIZE / 1000 / 1000 )) - - - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-lvm-deployment" ]; then - # check that source fs-images exist - if ! `lvdisplay /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME 1>/dev/null`; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "snap" 2 "openqrm-kvm" "Could not find /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME on the storage-server!" - exit 1 - fi - RESIZE_FILESYSTEM=false - ORIGIN_SIZE=`lvs --noheadings -o lv_size --units m --nosuffix /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME | awk '{ print $1 }' | cut -d'.' -f1` - if [ "$ORIGIN_SIZE" == "" ]; then - openqrm_post_event 0 "snap" 2 "openqrm-kvm" "Could not find out origin volume size of /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME!" - exit 1 - fi - if [ "$KVM_IMAGE_SIZE" != "" ]; then - if (( $KVM_IMAGE_SIZE > $ORIGIN_SIZE )); then - openqrm_post_event 0 "snap" 2 "openqrm-kvm" "Snapshot size must not be bigger than the origin volume size! ( $KVM_IMAGE_SIZE > $ORIGIN_SIZE )" - exit 1 - elif [ "$KVM_IMAGE_SIZE" == "$ORIGIN_SIZE" ]; then - RESIZE_FILESYSTEM=false - else - ORIGIN_SIZE=$KVM_IMAGE_SIZE - RESIZE_FILESYSTEM=true - fi - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # aquire global lock for lvm operations - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock aquire lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD $LOCK_TIME "Snapshot volume $KVM_IMAGE_NAME tp $KVM_IMAGE_SNAPSHOT_NAME" - fi - fi - kvm_refresh_lvm - touch $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - lvchange -ay -y /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME - CMD_ERR=`lvcreate $OPENQRM_PLUGIN_KVM_LVCREATE_CUSTOM_PARAM --size $ORIGIN_SIZE"M" --snapshot --name $KVM_IMAGE_SNAPSHOT_NAME /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME 2>&1` - if [ "$?" != 0 ]; then - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "snap" 3 "openqrm-kvm" "Error creating snapshot $KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - if [ "$OPENQRM_PLUGIN_KVM_RESIZE_SNAPSHOTS_FILESYSTEM" == "true" ] && [ "$RESIZE_FILESYSTEM" == "true" ]; then - # find the rootfs and resize it - if ! kvm_resize_fs /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_SNAPSHOT_NAME; then - openqrm_post_event 0 "snap" 2 "openqrm-kvm" "Failed resizing volume /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_SNAPSHOT_NAME!" - fi - fi - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-gluster-deployment" ]; then - FILE_BACKEND_DIR=`kvm_get_gluster_backend_dir $KVM_VOLUME_LOCATION` - if [ ! -e "$FILE_BACKEND_DIR/$KVM_IMAGE_NAME" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "snap" 2 "openqrm-kvm" "Could not find $FILE_BACKEND_DIR/$KVM_IMAGE_NAME on the storage-server!" - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - touch $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - - CMD_ERR=`$KVM_QEMU_IMG create -f qcow2 -b $FILE_BACKEND_DIR/$KVM_IMAGE_NAME $FILE_BACKEND_DIR/$KVM_IMAGE_SNAPSHOT_NAME 2>&1` - if [ "$?" != 0 ]; then - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "snap" 3 "openqrm-kvm" "Error creating snapshot gluster:$resource_ip://$FILE_BACKEND_DIR/$KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - if ! `kvm_trigger_gluster_replication $KVM_VOLUME_LOCATION $KVM_IMAGE_SNAPSHOT_NAME`; then - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - openqrm_post_event 0 "snap" 3 "openqrm-kvm" "Error triggering replication for gluster:$resource_ip://$FILE_BACKEND_DIR/$KVM_IMAGE_SNAPSHOT_NAME!" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-ceph-deployment" ]; then - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - CMD_ERR=`rbd snap create $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME 2>&1` - if [ "$?" != 0 ]; then - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "snap" 3 "openqrm-kvm" "Error creating rbd snapshot $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - fi - # in case we have a username + password post the updated list to the openQRM-server - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - # if we have an image name send size back to openQRM - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?lvm_command=set_image_size&kvm_image_name=$KVM_IMAGE_SNAPSHOT_NAME&kvm_image_size=$KVM_IMAGE_SIZE"; then - openqrm_post_event 0 "add" 2 "openqrm-kvm" "Could post size of volume $KVM_IMAGE_SNAPSHOT_NAME!" - fi - $0 post_lv -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD -v $KVM_VOLUME_LOCATION -t $KVM_DEPLOYMENT_TYPE $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - fi - openqrm_post_event 0 "snap" 5 "openqrm-kvm" "Created snapshot from volume $KVM_IMAGE_NAME -> $KVM_IMAGE_SNAPSHOT_NAME." - ;; - - auth) - # this is just for starting auth, make sure the device is there, otherwise wait - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ] && [ "$KVM_IMAGE_NAME" != "" ]; then - MAX_AUTH_LOOP=0 - while (true); do - -# commented out, this is running during resize and changes the lvol meta data -# if [ "$KVM_DEPLOYMENT_TYPE" == "kvm-lvm-deployment" ]; then -# # aquire global lock for lvm operations -# if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then -# if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then -# openqrm_global_lock aquire lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD auth "Auth for volume $KVM_IMAGE_NAME" -# fi -# fi -# lvchange -ay -y $KVM_IMAGE_ROOTDEVICE -# -# # release global lock -# if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then -# if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then -# openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD -# fi -# fi -# fi - - if [ "$KVM_DEPLOYMENT_TYPE" == "kvm-lvm-deployment" ] || [ "$KVM_DEPLOYMENT_TYPE" == "kvm-bf-deployment" ]; then - if [ -e "$KVM_IMAGE_ROOTDEVICE" ]; then - # fs resize active ? - if [ ! -f "$SYNC_PROGRESS_DIR/$KVM_IMAGE_NAME" ]; then - break - fi - fi - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-gluster-deployment" ]; then - # get the volume location from the image-root-devicev since it is not posted - VOLUME_LOCATION=`echo $KVM_IMAGE_ROOTDEVICE | cut -d':' -f3 | cut -d'/' -f3` - FILE_BACKEND_DIR=`kvm_get_gluster_backend_dir $VOLUME_LOCATION` - if [ -e "$FILE_BACKEND_DIR/$KVM_IMAGE_NAME" ]; then - # fs resize active ? - if [ ! -f "$SYNC_PROGRESS_DIR/$KVM_IMAGE_NAME" ]; then - break - fi - fi - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-ceph-deployment" ]; then - VOLUME_LOCATION=`echo $KVM_IMAGE_ROOTDEVICE | cut -d':' -f2 | cut -d'/' -f1` - if rbd --image $KVM_IMAGE_NAME -p $VOLUME_LOCATION info 2>/dev/null 1>/dev/null; then - # fs resize active ? - if [ ! -f "$SYNC_PROGRESS_DIR/$KVM_IMAGE_NAME" ]; then - break - fi - fi - fi - sleep 5 - if [ "$MAX_AUTH_LOOP" == "$MAX_VOLUME_AUTHENTICATION_LOOP" ]; then - openqrm_post_event 0 "auth" 2 "openqrm-kvm" "Volume volume $KVM_IMAGE_ROOTDEVICE does not exist! Auth to $KVM_IMAGE_AUTH failed!" - exit 1 - fi - MAX_AUTH_LOOP=$(( MAX_AUTH_LOOP + 1 )) - done - # if we have an image name send back to openQRM that storage auth finished to remvoe the storage-auth-blocker - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?lvm_command=auth_finished&kvm_image_name=$KVM_IMAGE_NAME"; then - openqrm_post_event 0 "auth" 2 "openqrm-kvm" "Could not remove auth-blocker for volume $KVM_IMAGE_NAME!" - fi - fi - ;; - - list) - lvm lvs - ;; - post_vg) - STORAGE_STATUS_TMP=$resource_id.vg.stat - #> $STORAGE_STATUS_TMP - if [ "$KVM_DEPLOYMENT_TYPE" == "kvm-bf-deployment" ]; then - for FILE_BACKEND in `echo $OPENQRM_PLUGIN_KVM_FILE_BACKEND_DIRECTORIES`; do - BACKEND_LOCATION_NAME=`echo $FILE_BACKEND | cut -d':' -f1` - FILE_BACKEND_DIR=`echo $FILE_BACKEND | cut -d':' -f2` - if [ ! -d "$FILE_BACKEND_DIR" ]; then - mkdir -p $FILE_BACKEND_DIR - fi - BACKEN_DIR_AVAIL_SPACE=`df --block-size MB -P $FILE_BACKEND_DIR | grep -v Used | awk '{ print $2 }'` - BACKEN_DIR_FREE_SPACE=`df --block-size MB -P $FILE_BACKEND_DIR | grep -v Used | awk '{ print $4 }'` - echo "$BACKEND_LOCATION_NAME@$FILE_BACKEND_DIR@-@-@-@"$BACKEN_DIR_AVAIL_SPACE"@"$BACKEN_DIR_FREE_SPACE"" >> $STORAGE_STATUS_TMP - done - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-lvm-deployment" ]; then - vgs --units m | grep -v VFree | sed -e "s/ \{1,\}//" > $STORAGE_STATUS_TMP - sed -i -e "s/ \{1,\}/@/g" $STORAGE_STATUS_TMP - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-gluster-deployment" ]; then - VOL_LOOP=0 - for GLUSTER_VOL in `gluster volume list`; do - GLUSTER_VOL_TMP=`mktemp /tmp/kvm-gluster.XXXXXX` - gluster volume info $GLUSTER_VOL > $GLUSTER_VOL_TMP - G_TYPE=`grep -w ^Type $GLUSTER_VOL_TMP | awk '{ print $2 }'` - G_STATUS=`grep -w ^Status $GLUSTER_VOL_TMP | awk '{ print $2 }'` - G_BRICK_COUNT=`grep -w ^Number $GLUSTER_VOL_TMP | cut -d':' -f2 | sed -e "s/ \{1,\}//g"` - G_TRANSPORT=`grep ^Transport-type $GLUSTER_VOL_TMP | awk '{ print $2 }'` - for GLUSTER_BRICK in `grep -w "^Brick[0-9].*" $GLUSTER_VOL_TMP | awk '{ print $2 }'`; do - if [ "$VOL_LOOP" == 0 ]; then - G_BRICKS="$GLUSTER_BRICK" - # get size/free - GLUSTER_BRICK_BACKEND_DIR=`echo $GLUSTER_BRICK | cut -d':' -f2` - GLUSTER_BRICK_BACKEND_DIR=`dirname $GLUSTER_BRICK_BACKEND_DIR` - BACKEN_DIR_AVAIL_SPACE=`df --block-size MB -P $GLUSTER_BRICK_BACKEND_DIR | grep -v Used | awk '{ print $2 }'` - BACKEN_DIR_FREE_SPACE=`df --block-size MB -P $GLUSTER_BRICK_BACKEND_DIR | grep -v Used | awk '{ print $4 }'` - else - G_BRICKS="$G_BRICKS"",""$GLUSTER_BRICK" - fi - VOL_LOOP=$(( VOL_LOOP + 1 )) - done - echo $GLUSTER_VOL"@"$G_TYPE"@"$G_STATUS"@"$G_BRICK_COUNT"@"$G_TRANSPORT"@"$BACKEN_DIR_AVAIL_SPACE"@"$BACKEN_DIR_FREE_SPACE"@"$G_BRICKS"" >> $STORAGE_STATUS_TMP - rm -f $GLUSTER_VOL_TMP - done - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-ceph-deployment" ]; then - for CEPH_POOL in `rados lspools`; do - BACKEND_SUMMARY=`ceph df | grep ^" " | awk '{ print $1","$2","$3","$4","$5","$6 }' | grep -A 1000 -w ^NAME | grep -w ^$CEPH_POOL` - BACKEND_USED_SPACE_PERCENT=`echo $BACKEND_SUMMARY | cut -d',' -f4` - BACKEND_ID=`echo $BACKEND_SUMMARY | cut -d',' -f2` - BACKEND_OBJECTS=`echo $BACKEND_SUMMARY | cut -d',' -f6` - BACKEND_USED_SPACE=`echo $BACKEND_SUMMARY | cut -d',' -f3` - BACKEND_USED_SPACE=`ceph_inmb $BACKEND_USED_SPACE` - BACKEND_AVAIL_SPACE=`echo $BACKEND_SUMMARY | cut -d',' -f5` - BACKEND_AVAIL_SPACE=`ceph_inmb $BACKEND_AVAIL_SPACE` - echo "$CEPH_POOL@"$BACKEND_ID"@"$BACKEND_OBJECTS"@"$BACKEND_USED_SPACE_PERCENT"@"$BACKEND_USED_SPACE"@-@"$BACKEND_AVAIL_SPACE"" >> $STORAGE_STATUS_TMP - done - fi - - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?lvm_command=get; then - openqrm_post_event 0 "post_vg" 2 "openqrm-kvm" "Could not post the volume group status to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - ;; - post_lv) - STORAGE_STATUS_TMP=$resource_id.$KVM_VOLUME_LOCATION.lv.stat - > $STORAGE_STATUS_TMP - if [ "$KVM_DEPLOYMENT_TYPE" == "kvm-bf-deployment" ]; then - FILE_BACKEND_DIR=`kvm_get_backend_dir $KVM_VOLUME_LOCATION` - if [ -d "$FILE_BACKEND_DIR" ]; then - for FILE_BACKEND in `ls $FILE_BACKEND_DIR/*`; do - VOLUME_FILENAME=`basename $FILE_BACKEND` - VOLUME_FILE_SIZE=$($KVM_QEMU_IMG info $FILE_BACKEND_DIR/$VOLUME_FILENAME | grep ^"virtual size" | awk {' print $4 '} | sed -e s/\(//) - VOLUME_ORIGIN="x" - if [ -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$VOLUME_FILENAME.clone_in_progress" ]; then - echo "kvm-bf-deployment@$VOLUME_FILENAME@$FILE_BACKEND@file@clone_in_progress@x@x@" >> $STORAGE_STATUS_TMP - else - FT=`kvm_get_image_type $FILE_BACKEND` - if [ "$FT" == "snapshot" ]; then - VOLUME_ORIGIN=`file $FILE_BACKEND | sed -e "s/.*(path //g" | cut -d')' -f1` - fi - echo "kvm-bf-deployment@$VOLUME_FILENAME@$FILE_BACKEND@$FT@$VOLUME_FILE_SIZE@$VOLUME_ORIGIN@x@" >> $STORAGE_STATUS_TMP - fi - done - fi - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-lvm-deployment" ]; then - lvs $KVM_VOLUME_LOCATION --noheadings --units m -o lv_name,vg_name,lv_attr,lv_size,origin | sed -e "s/ \{1,\}//" > $STORAGE_STATUS_TMP.tmp - for LVOL in `cat $STORAGE_STATUS_TMP.tmp | awk {' print $1 '}`; do - # check for clone-in-progress - if [ -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$LVOL.clone_in_progress" ]; then - echo "kvm-lvm-deployment@$LVOL@$KVM_VOLUME_LOCATION@-@clone_in_progress@@@" >> $STORAGE_STATUS_TMP - else - echo -n "kvm-lvm-deployment " >> $STORAGE_STATUS_TMP - grep -w ^$LVOL $STORAGE_STATUS_TMP.tmp >> $STORAGE_STATUS_TMP - fi - done - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-gluster-deployment" ]; then - FILE_BACKEND_DIR=`kvm_get_gluster_backend_dir $KVM_VOLUME_LOCATION` - if [ -d "$FILE_BACKEND_DIR" ]; then - for FILE_BACKEND in `ls $FILE_BACKEND_DIR/*`; do - VOLUME_FILENAME=`basename $FILE_BACKEND` - VOLUME_FILE_SIZE=`ls -l $FILE_BACKEND | awk '{ print $5 }'` - VOLUME_ORIGIN="x" - if [ -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$VOLUME_FILENAME.clone_in_progress" ]; then - echo "kvm-gluster-deployment@$VOLUME_FILENAME@$FILE_BACKEND@file@clone_in_progress@x@x@" >> $STORAGE_STATUS_TMP - else - FT=`kvm_get_image_type $FILE_BACKEND` - if [ "$FT" == "snapshot" ]; then - VOLUME_ORIGIN=`file $FILE_BACKEND | sed -e "s/.*(path //g" | cut -d')' -f1` - VOLUME_ORIGIN=`basename $VOLUME_ORIGIN` - fi - echo "kvm-gluster-deployment@$VOLUME_FILENAME@$FILE_BACKEND@$FT@$VOLUME_FILE_SIZE@$VOLUME_ORIGIN@x@" >> $STORAGE_STATUS_TMP - fi - done - fi - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-ceph-deployment" ]; then - - for CVOLUME in `rbd ls -l $KVM_VOLUME_LOCATION | sed '1d' | awk '{ print $1 }'`; do - # origin or snap - if echo $CVOLUME | grep '@' 1>/dev/null; then - CORIGIN=`echo $CVOLUME | cut -d'@' -f1` - else - CORIGIN="" - fi - - CVOLINFO=`rbd info $KVM_VOLUME_LOCATION/$CVOLUME` - CVOLSIZE=`echo $CVOLINFO | sed -e "s#.*size ##" | awk '{ print $1 }'` - CVOLSIZETYPE=`echo $CVOLINFO | sed -e "s#.*size ##" | awk '{ print $2 }'` - case "$CVOLSIZETYPE" in - MiB) - CVOLSIZE=$CVOLSIZE"M" - ;; - GiB) - CVOLSIZE=$CVOLSIZE"G" - ;; - TiB) - CVOLSIZE=$CVOLSIZE"T" - ;; - esac - CVOLSIZE=`ceph_inmb $CVOLSIZE` - CVOLORDER=`echo $CVOLINFO | sed -e "s#.*order ##" | awk '{ print $1 }'` - CVOLUME=`echo $CVOLUME | sed -e "s/@/%/g"` - CVOLROOT="rbd:$KVM_VOLUME_LOCATION/$CVOLUME" - echo "kvm-ceph-deployment@$CVOLUME@$CVOLROOT@@$CVOLSIZE@$CORIGIN@x@" >> $STORAGE_STATUS_TMP - - done - - fi - sed -i -e "s/ \{1,\}/@/g" $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?lvm_command=get; then - openqrm_post_event 0 "post_lv" 2 "openqrm-kvm" "Could not post the volume status to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post $STORAGE_STATUS_TMP.tmp - ;; - post_identifier) - if [ "$KVM_DEPLOYMENT_TYPE" == "kvm-bf-deployment" ]; then - STORAGE_STATUS_TMP=$resource_id.lv.kvm-bf-deployment.ident - > $STORAGE_STATUS_TMP - for FILE_BACKEND in `echo $OPENQRM_PLUGIN_KVM_FILE_BACKEND_DIRECTORIES`; do - BACKEND_LOCATION_NAME=`echo $FILE_BACKEND | cut -d':' -f1` - FILE_BACKEND_DIR=`echo $FILE_BACKEND | cut -d':' -f2` - if [ -d "$FILE_BACKEND_DIR" ]; then - for FILE_BACKEND in `ls $FILE_BACKEND_DIR/*`; do - BACKEND_FILENAME=`basename $FILE_BACKEND` - echo "$BACKEND_LOCATION_NAME - $BACKEND_FILENAME:$FILE_BACKEND" >> $STORAGE_STATUS_TMP - done - fi - done - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-lvm-deployment" ]; then - STORAGE_STATUS_TMP=$resource_id.lv.kvm-lvm-deployment.ident - > $STORAGE_STATUS_TMP - for LVOL in `openqrm_get_lvm_volume_paths`; do - LVOL_SHORT=`basename $LVOL` - IMAGE_NAME=$LVOL_SHORT - VOLUME_GROUP=`echo $LVOL | cut -d'/' -f3` - echo "$IMAGE_NAME:/dev/$VOLUME_GROUP/$IMAGE_NAME" >> $STORAGE_STATUS_TMP - - done - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-gluster-deployment" ]; then - STORAGE_STATUS_TMP=$resource_id.lv.kvm-gluster-deployment.ident - > $STORAGE_STATUS_TMP - for GLUSTER_VOL in `gluster volume list`; do - FILE_BACKEND_DIR=`kvm_get_gluster_backend_dir $GLUSTER_VOL` - if [ -d "$FILE_BACKEND_DIR" ]; then - for FILE_BACKEND in `ls $FILE_BACKEND_DIR/*`; do - VOLUME_FILENAME=`basename $FILE_BACKEND` - echo "$VOLUME_FILENAME:gluster:$resource_ip://$GLUSTER_VOL/$VOLUME_FILENAME" >> $STORAGE_STATUS_TMP - done - fi - done - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-ceph-deployment" ]; then - STORAGE_STATUS_TMP=$resource_id.lv.kvm-ceph-deployment.ident - > $STORAGE_STATUS_TMP - for CEPH_POOL in `ceph osd lspools`; do - for IMAGE_NAME in `rbd ls $CEPH_POOL`; do - echo "rbd:$CEPH_POOL/$IMAGE_NAME" >> $STORAGE_STATUS_TMP - done - done - fi - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?lvm_command=get_ident; then - openqrm_post_event 0 "post_identifier" 2 "openqrm-kvm" "Could not post the volume identifier to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - ;; - - - resize) - if [ "$KVM_DEPLOYMENT_TYPE" == "kvm-bf-deployment" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "resize" 2 "openqrm-kvm" "Resize is not supported for local blockfile backends!" - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-lvm-deployment" ]; then - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # aquire global lock for lvm operations - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock aquire lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD $LOCK_TIME "Resize volume $KVM_IMAGE_NAME" - fi - fi - kvm_refresh_lvm - touch $SYNC_PROGRESS_DIR/$KVM_IMAGE_NAME - lvchange -ay -y /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME - CMD_ERR=`lvresize -L $KVM_IMAGE_SIZE /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Error lvm resisiging volume /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME! $CMD_ERR" - - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - if [ "$OPENQRM_PLUGIN_KVM_RESIZE_SNAPSHOTS_FILESYSTEM" == "true" ]; then - # resize partition and rootfs - if kvm_resize_fs /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME; then - openqrm_post_event 0 "resize" 5 "openqrm-kvm" "Resized logical volume $KVM_IMAGE_NAME on volume group $KVM_VOLUME_LOCATION." - else - openqrm_post_event 0 "resize" 2 "openqrm-kvm" "Failed resizing logical volume $KVM_IMAGE_NAME on volume group $KVM_VOLUME_LOCATION." - fi - fi - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_NAME - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-gluster-deployment" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "resize" 2 "openqrm-kvm" "Resize is not supported for Gluster backends!" - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-ceph-deployment" ]; then - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - touch $SYNC_PROGRESS_DIR/$KVM_IMAGE_NAME - - CMD_ERR=`rbd resize -p $KVM_VOLUME_LOCATION --image $KVM_IMAGE_NAME --size $KVM_IMAGE_SIZE --allow-shrink 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "add" 3 "openqrm-kvm" "Error resizing rbd volume rbd:$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - if [ "$OPENQRM_PLUGIN_KVM_RESIZE_SNAPSHOTS_FILESYSTEM" == "true" ]; then - kvm_resize_ceph_fs $KVM_IMAGE_NAME $KVM_VOLUME_LOCATION - fi - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_NAME - fi - # in case we have a username + password post the updated list to the openQRM-server - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - # if we have an image name send size back to openQRM - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?lvm_command=set_image_size&kvm_image_name=$KVM_IMAGE_NAME&kvm_image_size=$KVM_IMAGE_SIZE"; then - openqrm_post_event 0 "add" 2 "openqrm-kvm" "Could post size of volume $KVM_IMAGE_NAME!" - fi - $0 post_lv -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD -v $KVM_VOLUME_LOCATION -t $KVM_DEPLOYMENT_TYPE $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - fi - ;; - - - clone) - # cloning is similar to snapshots but since lvm cannot (yet) create snapshots - # from snapshots we have to dd the origin (which may be a snapshot) to a - # new lvol. - if [ "$KVM_IMAGE_SNAPSHOT_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_DEPLOYMENT_TYPE" == "kvm-bf-deployment" ]; then - # check that source fs-images exist - # notice : here the kvm-volume-location comes from the cloud-hook and uses the dirname of the rootfs-ident - FILE_BACKEND_DIR=`kvm_get_backend_dir $KVM_VOLUME_LOCATION` - if [ ! -e "$FILE_BACKEND_DIR/$KVM_IMAGE_NAME" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "snap" 2 "openqrm-kvm" "Could not find $FILE_BACKEND_DIR/$KVM_IMAGE_NAME on the storage-server!" - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # create locks for origin + snapshot - touch "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - touch "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - touch $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - # no plugin lock for copying - # we copy to a tmp name first, then move - # copying will take some time, as soon as we moved the auth-hook will succeed - # but not before copying has finished - # create long-term-action start event - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 9 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - # post exports early, we show the progress in the ui - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - $0 post_sync_progress -n $KVM_IMAGE_SNAPSHOT_NAME -v $FILE_BACKEND_DIR -t kvm-bf-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true & - fi - # delay start sync - sleep 10 - - CMD_ERR=`/bin/cp -f $FILE_BACKEND_DIR/$KVM_IMAGE_NAME $FILE_BACKEND_DIR/$KVM_IMAGE_SNAPSHOT_NAME 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "clone" 2 "openqrm-kvm" "Could not copy target logical volume $KVM_IMAGE_NAME! $CMD_ERR" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - exit 1 - fi - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - # stop sync-progress monitor and send sync-finished to openQRM - $0 post_sync_finished -n $KVM_IMAGE_SNAPSHOT_NAME -v $FILE_BACKEND_DIR -t kvm-bf-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - # Get size of cloned image - ORIGIN_SIZE=$($KVM_QEMU_IMG info $FILE_BACKEND_DIR/$KVM_IMAGE_SNAPSHOT_NAME | grep ^"virtual size" | awk {' print $4 '} | sed -e s/\(//) - ORIGIN_SIZE=$(( $ORIGIN_SIZE / 1000 / 1000 )) - - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-lvm-deployment" ]; then - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - RESIZE_FILESYSTEM=false - ORIGIN_SIZE="" - ORIGIN_VOLUME="/dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME" - # if source volume is a snapshot find out the size of the origin - VOLUME_IS_SNAPSHOT=`lvs --noheadings -o origin $ORIGIN_VOLUME | awk '{ print $1 }'` - if [ "$VOLUME_IS_SNAPSHOT" != "" ]; then - ORIGIN_VOLUME="/dev/$KVM_VOLUME_LOCATION/$VOLUME_IS_SNAPSHOT" - fi - ORIGIN_SIZE=`lvs --noheadings -o lv_size --units m --nosuffix $ORIGIN_VOLUME | awk '{ print $1 }' | cut -d'.' -f1` - if [ "$ORIGIN_SIZE" == "" ]; then - openqrm_post_event 0 "clone" 2 "openqrm-kvm" "Could not find out origin volume size!" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - # if the image size is set we clone and resize to the bigger image size - if [ "$KVM_IMAGE_SIZE" != "" ]; then - if (( $KVM_IMAGE_SIZE < $ORIGIN_SIZE )); then - openqrm_post_event 0 "clone" 2 "openqrm-kvm" "Clone size must not be smaller than the origin volume size! ( $KVM_IMAGE_SIZE > $ORIGIN_SIZE )" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - elif [ "$KVM_IMAGE_SIZE" == "$ORIGIN_SIZE" ]; then - RESIZE_FILESYSTEM=false - else - ORIGIN_SIZE=$KVM_IMAGE_SIZE - RESIZE_FILESYSTEM=true - fi - fi - - # create locks for origin + snapshot - touch "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - touch "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - touch $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - # create long-term-action start event - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 9 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - - # aquire global lock for lvm operations - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock aquire lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD $LOCK_TIME "Cloning volume $KVM_IMAGE_NAME to $KVM_IMAGE_SNAPSHOT_NAME" - fi - fi - kvm_refresh_lvm - CMD_ERR=`lvcreate $OPENQRM_PLUGIN_KVM_LVCREATE_CUSTOM_PARAM -L$ORIGIN_SIZE""M -n$KVM_IMAGE_SNAPSHOT_NAME $KVM_VOLUME_LOCATION 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - openqrm_post_event 0 "clone" 2 "openqrm-kvm" "Could not create volume $KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - lvchange -ay -y /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME - lvchange -ay -y /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_SNAPSHOT_NAME - - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - - # post exports early, we show the progress in the ui - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - $0 post_sync_progress -n $KVM_IMAGE_SNAPSHOT_NAME -v $KVM_VOLUME_LOCATION -t kvm-lvm-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true & - fi - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - -###### Caching start - - IMAGE_CLONE_EXISTS=false - # check for the local cache dir - if [ "$OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE" != "" ] && [ "$KVM_IMAGE_CACHE" == "true" ]; then - if [ ! -d "$OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE" ]; then - mkdir -p "$OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE" - fi - # here we create a local zipped copy of the master image in the cache dir - if [ ! -f "$OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE/$KVM_IMAGE_NAME.gz" ]; then - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 9 "kvm" "Caching volume $KVM_IMAGE_NAME on resource $resource_id" - CMD_ERR=`dd if=/dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME bs=64K | gzip -c > $OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE/$KVM_IMAGE_NAME.gz` - if [ "$?" == 0 ] && [ -f "$OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE/$KVM_IMAGE_NAME.gz" ]; then - # copy from the local cloned master image - IMAGE_CLONE_EXISTS=true - else - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - # log error and copy directly from the master image - openqrm_post_event 0 "clone" 2 "openqrm-kvm" "Error caching volume $KVM_IMAGE_NAME! $CMD_ERR" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "Caching volume $KVM_IMAGE_NAME on resource $resource_id" - fi - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "Caching volume $KVM_IMAGE_NAME on resource $resource_id" - else - # copy from the local cloned master image - GZ_SIZE=$(ls -l $OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE/$KVM_IMAGE_NAME.gz | awk '{ print $5 }') - sleep 2 - while [ true ] ; do - CURRENT_SIZE=$(ls -l $OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE/$KVM_IMAGE_NAME.gz | awk '{ print $5 }') - if [ $CURRENT_SIZE == $GZ_SIZE ]; then - IMAGE_CLONE_EXISTS=true - break - else - GZ_SIZE=$CURRENT_SIZE - sleep 2 - fi - done - fi - fi - - sleep 2 - if [ "$IMAGE_CLONE_EXISTS" == "true" ]; then - # copy content from cloned master - CMD_ERR=`nice --20 gunzip -c $OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE/$KVM_IMAGE_NAME.gz | dd of=/dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_SNAPSHOT_NAME bs=64K 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - openqrm_post_event 0 "clone" 2 "openqrm-kvm" "Error copying content for volume $KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - exit 1 - fi - else - # copy content directly from master - CMD_ERR=`nice --20 dd if=/dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME of=/dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_SNAPSHOT_NAME bs=64K 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - openqrm_post_event 0 "clone" 2 "openqrm-kvm" "Error cloning volume $KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - exit 1 - fi - fi - -###### Resize - - if [ "$OPENQRM_PLUGIN_KVM_RESIZE_SNAPSHOTS_FILESYSTEM" == "true" ] && [ "$RESIZE_FILESYSTEM" == "true" ]; then - # resize partition and rootfs - if ! kvm_resize_fs /dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_SNAPSHOT_NAME; then - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - fi - fi - - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - # stop sync-progress monitor and send sync-finished to openQRM - $0 post_sync_finished -n $KVM_IMAGE_SNAPSHOT_NAME -v $KVM_VOLUME_LOCATION -t kvm-lvm-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - - - - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-gluster-deployment" ]; then - FILE_BACKEND_DIR=`kvm_get_gluster_backend_dir $KVM_VOLUME_LOCATION` - if [ ! -e "$FILE_BACKEND_DIR/$KVM_IMAGE_NAME" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "clone" 2 "openqrm-kvm" "Could not find $FILE_BACKEND_DIR/$KVM_IMAGE_NAME on the storage-server!" - exit 1 - fi - # create locks for origin + snapshot - touch $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - touch "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - touch "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - # post exports early, we show the progress in the ui - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 9 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - $0 post_sync_progress -n $KVM_IMAGE_SNAPSHOT_NAME -v $KVM_VOLUME_LOCATION -t kvm-gluster-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true & - fi - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - CMD_ERR=`cp -af $FILE_BACKEND_DIR/$KVM_IMAGE_NAME $FILE_BACKEND_DIR/$KVM_IMAGE_SNAPSHOT_NAME 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - openqrm_post_event 0 "clone" 3 "openqrm-kvm" "Error cloning volume $FILE_BACKEND_DIR/$KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - exit 1 - fi - if ! `kvm_trigger_gluster_replication $KVM_VOLUME_LOCATION $KVM_IMAGE_SNAPSHOT_NAME`; then - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - openqrm_post_event 0 "clone" 3 "openqrm-kvm" "Error triggering replication for gluster:$resource_ip://$FILE_BACKEND_DIR/$KVM_IMAGE_SNAPSHOT_NAME!" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - exit 1 - fi - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - # stop sync-progress monitor and send sync-finished to openQRM - $0 post_sync_finished -n $KVM_IMAGE_SNAPSHOT_NAME -v $FILE_BACKEND_DIR -t kvm-gluster-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-ceph-deployment" ]; then - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # create locks for origin + snapshot - touch $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - touch "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - touch "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - # post exports early, we show the progress in the ui - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 9 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - $0 post_sync_progress -n $KVM_IMAGE_SNAPSHOT_NAME -v $KVM_VOLUME_LOCATION -t kvm-ceph-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true & - fi - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - # get volume size - CVOLINFO=`rbd info $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME` - ORIGIN_SIZE=`echo $CVOLINFO | sed -e "s#.*size ##" | awk '{ print $1 }'` - - CMD_ERR=`rbd snap create $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - $0 post_sync_finished -n $KVM_IMAGE_SNAPSHOT_NAME -v $KVM_VOLUME_LOCATION -t kvm-ceph-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - openqrm_post_event 0 "clone" 3 "openqrm-kvm" "Error creating snapshot for cloning volume $KVM_VOLUME_LOCATION/$KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - exit 1 - fi - - CMD_ERR=`rbd snap protect $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME 2>&1` - if [ "$?" != 0 ]; then - # try to cleanup first - rbd snap rm $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME 2>&1 - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - $0 post_sync_finished -n $KVM_IMAGE_SNAPSHOT_NAME -v $KVM_VOLUME_LOCATION -t kvm-ceph-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - openqrm_post_event 0 "clone" 3 "openqrm-kvm" "Error protecting snapshot volume $KVM_VOLUME_LOCATION/$KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - exit 1 - fi - - CMD_ERR=`rbd clone $OPENQRM_PLUGIN_CEPH_IMAGE_FEATURE $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME $KVM_VOLUME_LOCATION/$KVM_IMAGE_SNAPSHOT_NAME 2>&1` - if [ "$?" != 0 ]; then - # try to cleanup first - rbd snap unprotect $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME 2>&1 - rbd snap rm $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME 2>&1 - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - $0 post_sync_finished -n $KVM_IMAGE_SNAPSHOT_NAME -v $KVM_VOLUME_LOCATION -t kvm-ceph-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - openqrm_post_event 0 "clone" 3 "openqrm-kvm" "Error cloning volume $KVM_VOLUME_LOCATION/$KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - exit 1 - fi - - CMD_ERR=`rbd flatten $KVM_VOLUME_LOCATION/$KVM_IMAGE_SNAPSHOT_NAME 2>&1` - if [ "$?" != 0 ]; then - # try to cleanup first - rbd snap unprotect $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME 2>&1 - rbd snap rm $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME 2>&1 - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - $0 post_sync_finished -n $KVM_IMAGE_SNAPSHOT_NAME -v $KVM_VOLUME_LOCATION -t kvm-ceph-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - openqrm_post_event 0 "clone" 3 "openqrm-kvm" "Error syncing/flatten volume $KVM_VOLUME_LOCATION/$KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - exit 1 - fi - - CMD_ERR=`rbd snap unprotect $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - $0 post_sync_finished -n $KVM_IMAGE_SNAPSHOT_NAME -v $KVM_VOLUME_LOCATION -t kvm-ceph-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - openqrm_post_event 0 "clone" 3 "openqrm-kvm" "Error unprotecting snapshot $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - exit 1 - fi - - - CMD_ERR=`rbd snap rm $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - $0 post_sync_finished -n $KVM_IMAGE_SNAPSHOT_NAME -v $KVM_VOLUME_LOCATION -t kvm-ceph-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - openqrm_post_event 0 "clone" 3 "openqrm-kvm" "Error removing snapshot $KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME@$KVM_IMAGE_SNAPSHOT_NAME! $CMD_ERR" - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - exit 1 - fi - - - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_NAME.sync_in_progress.$KVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$KVM_VOLUME_LOCATION-$KVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - rm -f $SYNC_PROGRESS_DIR/$KVM_IMAGE_SNAPSHOT_NAME - # stop sync-progress monitor and send sync-finished to openQRM - $0 post_sync_finished -n $KVM_IMAGE_SNAPSHOT_NAME -v $KVM_VOLUME_LOCATION -t kvm-ceph-deployment -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD $OPENQRM_UI_USER_PARAMETER --openqrm-internal-cmd true - fi - - # create long-term-action finished event - openqrm_post_event 0 "$KVM_IMAGE_SNAPSHOT_NAME" 10 "kvm" "Started to clone $KVM_IMAGE_SNAPSHOT_NAME from $KVM_IMAGE_NAME" - - # here we notify openQRM that cloning has finished - # in case we have a username + password post the updated list to the openQRM-server - # and notify openQRM that cloning has finished - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - CLONE_FINISHED="$KVM_IMAGE_SNAPSHOT_NAME.clone" - touch $CLONE_FINISHED - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $CLONE_FINISHED` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?lvm_command=clone_finished; then - openqrm_post_event 0 "clone" 2 "openqrm-kvm" "Could not post clone-finished status to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - # if we have an image name send size back to openQRM - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?lvm_command=set_image_size&kvm_image_name=$KVM_IMAGE_SNAPSHOT_NAME&kvm_image_size=$ORIGIN_SIZE"; then - openqrm_post_event 0 "add" 2 "openqrm-kvm" "Could post size of volume $KVM_IMAGE_SNAPSHOT_NAME!" - fi - rm -f $CLONE_FINISHED $CLONE_FINISHED.post - fi - openqrm_post_event 0 "clone" 5 "openqrm-kvm" "Cloned volume $KVM_IMAGE_NAME to $KVM_IMAGE_SNAPSHOT_NAME on volume group $KVM_VOLUME_LOCATION" - ;; - - - post_sync_progress) - echo "Posting progress of the sync action for volume $KVM_IMAGE_NAME to the openQRM-server" - STORAGE_STATUS_TMP=$resource_id.lvm.$KVM_IMAGE_NAME.sync_progress - # posting also the root-device identifier once - VOLUME_ROOT_DEVICE_IDENTIFIER=$resource_id.$KVM_IMAGE_NAME.root_device - if [ "$KVM_DEPLOYMENT_TYPE" == "kvm-bf-deployment" ]; then - FILE_BACKEND_DIR=`kvm_get_backend_dir $KVM_VOLUME_LOCATION` - echo "$FILE_BACKEND_DIR/$KVM_IMAGE_NAME" > $VOLUME_ROOT_DEVICE_IDENTIFIER - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-lvm-deployment" ]; then - echo "/dev/$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME" > $VOLUME_ROOT_DEVICE_IDENTIFIER - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-gluster-deployment" ]; then - echo "gluster:$resource_ip://$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME" > $VOLUME_ROOT_DEVICE_IDENTIFIER - elif [ "$KVM_DEPLOYMENT_TYPE" == "kvm-ceph-deployment" ]; then - echo "rbd:$KVM_VOLUME_LOCATION/$KVM_IMAGE_NAME" > $VOLUME_ROOT_DEVICE_IDENTIFIER - fi - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $VOLUME_ROOT_DEVICE_IDENTIFIER` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?lvm_command=get_sync_progress; then - kvm_log "post_sync_progress" "Could not post the root-device ident for volume $KVM_IMAGE_NAME to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $VOLUME_ROOT_DEVICE_IDENTIFIER $VOLUME_ROOT_DEVICE_IDENTIFIER.post - # sync in progress - for SEQ in `seq 0 99`; do - # check if we are finished already - if [ -f "$STORAGE_STATUS_TMP" ]; then - CURRENT_PROGRESS=`cat $STORAGE_STATUS_TMP` - if [ "$CURRENT_PROGRESS" == "100" ]; then - exit 0 - fi - fi - echo "$SEQ" > $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?lvm_command=get_sync_progress; then - kvm_log "post_sync_progress" "Could not post the sync progress for volume $KVM_IMAGE_NAME to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - sleep 2 - done - ;; - - - post_sync_finished) - echo "Posting finished for volume $KVM_IMAGE_NAME to the openQRM-server" - STORAGE_STATUS_TMP=$resource_id.lvm.$KVM_IMAGE_NAME.sync_progress - echo "100" > $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?lvm_command=get_sync_finished; then - kvm_log "post_sync_finished" "Could not post the sync progress for volume $KVM_IMAGE_NAME to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - ;; - - - purge_cache) - if [ "$KVM_IMAGE_NAME" == "" ]; then - kvm_usage - fi - if [ "$OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE" == "" ]; then - echo "No LVM image cache configured" - exit 1 - fi - if [ ! -d "$OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE" ]; then - echo "No LVM image cache existing" - exit 1 - fi - if [ "$KVM_IMAGE_NAME" == "all" ]; then - rm -f $OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE/*.gz - echo "Purged LVM image cache" - else - if [ -e "$OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE/$KVM_IMAGE_NAME.gz" ]; then - rm -f $OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE/$KVM_IMAGE_NAME.gz - echo "Purged LVM volume $KVM_IMAGE_NAME from image cache" - else - echo "Volume $KVM_IMAGE_NAME does not exists in the image cache" - fi - fi - ;; - - list_cache) - if [ "$OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE" == "" ]; then - echo "No LVM image cache configured" - exit 1 - fi - if [ ! -d "$OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE" ]; then - echo "No LVM image cache existing" - exit 1 - fi - basename `ls $OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE/*.gz 2>/dev/null | sed -e "s/\.gz//g"` 2>/dev/null - ;; - - - - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - ;; - - -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/bin/openqrm-kvm-sysinfo b/openQRM-5.3.50-CE/src/plugins/kvm/bin/openqrm-kvm-sysinfo deleted file mode 100644 index 0be885a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/bin/openqrm-kvm-sysinfo +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash -# this script provides sys information -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/include/openqrm-plugin-kvm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf -OPENQRM_POSTENCODE="$OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-postencode" -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - OPENQRM_SERVER_IP=$resource_openqrmserver - OPENQRM_EXEC_PORT=$resource_execdport -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS - resource_ip=$OPENQRM_SERVER_IP_ADDRESS - resource_id=0 - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL -fi -export LANG=C -FULL_COMMANDLINE="$0 $@" -KVM_COMMAND=$1 -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - -while [ $# -ne 0 ]; do - case "$1" in - -u) - KVM_OPENQRM_USERNAME=$2 - shift - ;; - -p) - KVM_OPENQRM_PASSWORD=$2 - shift - ;; - --file-name) - KVM_STATS_FILE_NAME=$2 - shift - ;; - esac - shift -done - -# Set defaults -if [ "$KVM_STATS_FILE_NAME" == "" ]; then - KVM_STATS_FILE_NAME='test.html' -fi -TMP=$KVM_STATS_FILE_NAME -if [ -f $KVM_STATS_FILE_NAME ]; then - rm $KVM_STATS_FILE_NAME -fi - -# Commands -PS=$( ps ax | grep -v openqrm-kvm-stats | grep -v openqrm-kvm-sysinfo | grep [k]vm ) -NET=$( ifconfig ) -CACHE=$( ls -l $OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE ) -#KVMLOCK=$( ls -l $OPENQRM_SERVER_BASE_DIR"/openqrm/plugins/kvm/lock" ) -VMS=$( ls -l $OPENQRM_PLUGIN_STATE_DIRS ) -PVSCAN=$( pvscan ) -PVDISP=$( pvdisplay ) -VGSCAN=$( vgscan ) -VGDISP=$( vgdisplay ) -LVSCAN=$( lvscan ) -LVDISP=$( lvdisplay ) - -# Format Message -echo -e "

    SYSTEM

    \n" > $TMP -echo -e "ps ax | grep kvm" >> $TMP -echo -e "
    $PS
    " >> $TMP -echo -e "ifconfig" >> $TMP -echo -e "
    $NET
    " >> $TMP -echo -e "VMs: $OPENQRM_PLUGIN_STATE_DIRS" >> $TMP -echo -e "
    $VMS\n
    " >> $TMP -echo -e "Cache: $OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE" >> $TMP -echo -e "
    $CACHE
    " >> $TMP -#echo -e "KVM Lock: OPENQRM_SERVER_BASE_DIR"/openqrm/plugins/kvm/lock" >> $TMP -#echo -e "
    $KVMLOCK
    " >> $TMP -echo -e "

    LVM

    \n" >> $TMP -echo -e "pvscan
    $PVSCAN
    " >> $TMP -echo -e "pvdisplay
    $PVDISP
    " >> $TMP -echo -e "vgscan
    $VGSCAN
    " >> $TMP -echo -e "vgdisplay
    $VGDISP
    " >> $TMP -echo -e "lvscan
    $LVSCAN
    " >> $TMP -echo -e "lvdisplay
    $LVDISP
    " >> $TMP - -# Post Message -if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?kvm_server_command=put_stats; then - openqrm_post_event 0 "create" 2 "openqrm-kvm-vm" "Could not post stats to the openQRM-server at $OPENQRM_SERVER_IP!" -fi - -# Clean up -if [ -f $KVM_STATS_FILE_NAME ]; then - rm $KVM_STATS_FILE_NAME -fi -if [ -f $KVM_STATS_FILE_NAME.post ]; then - rm $KVM_STATS_FILE_NAME.post -fi diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/bin/openqrm-kvm-vm b/openQRM-5.3.50-CE/src/plugins/kvm/bin/openqrm-kvm-vm deleted file mode 100644 index f18904e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/bin/openqrm-kvm-vm +++ /dev/null @@ -1,2464 +0,0 @@ -#!/bin/bash -# this script automatically manages kvm -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2012, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2012, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -# unblock starting command queue early for non-blocking + ui commands -KVM_COMMAND=$1 -if [ "$KVM_COMMAND" == "update" ] || [ "$KVM_COMMAND" == "clone" ] || [ "$KVM_COMMAND" == "post_vm_list" ] || [ "$KVM_COMMAND" == "post_vm_config" ] || [ "$KVM_COMMAND" == "list" ] || [ "$KVM_COMMAND" == "post_bridge_config" ] || [ "$KVM_COMMAND" == "iso" ] || [ "$KVM_COMMAND" == "monitor_migration" ]; then - openqrm_unblock_starting_queue $@ - NON_BLOCKING=true -fi - -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/include/openqrm-plugin-kvm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - OPENQRM_SERVER_IP=$resource_openqrmserver - OPENQRM_EXEC_PORT=$resource_execdport -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS - resource_id=0 - resource_ip=$OPENQRM_SERVER_IP_ADDRESS - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL -fi -OPENQRM_POSTENCODE="$OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-postencode" -OPENQRM_KVM_VM_TEMPLATE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-vm" -OPENQRM_VM_DIR="/var/lib/kvm/openqrm/" -OPENQRM_VM_MIGRATION_PORT_RANGE_START="7500" -OPENQRM_VM_MONITOR_DIR="/var/run/openqrm/kvm" -KVM_MIGRATION_MAX_WAIT=360 -KVM_REMOVE_MAX_WAIT=30 -KVM_VM_SHUTDOWN_DELAY=90 -OPENQRM_FIRST_VNC_ID=50 -export LANG=C -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - -# make sure required deps are installed -if ! check_kvm_deps; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi - -# which screen binary to use -if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" -else - RUNSCREEN=`which screen` -fi - - - -function kvm_usage() { - echo "Usage : $0 start/stop/reboot/delete/list <-n vm-name>" - echo " $0 restart_by_mac/start_by_mac <-m vm-mac> <-d root-disk>" - echo " $0 setboot <-m mac-address> <-b local/net>" - echo " $0 create/update <-n vm-name> <-m mac-address> <-r memory> [-c cpus ] [-o disk-interface(ide/virtio) ] [-b local/net/cdrom/iso] [-i iso-boot-image] [-v vncpassword ] [-l vnckeymap ]" - echo " $0 clone <-n vm-name> <-w vm-clone-name> <-m vm-clone-mac>" - echo " $0 post_vm_list <-u username> <-p password>" - echo " $0 post_vm_config <-n vm-name> <-u username> <-p password>" - echo " $0 post_bridge_config <-u username> <-p password>" - echo " $0 update_vm_ram <-r memory> <-n vm-name>" - echo " $0 update_vm_vnc <-v vncpassword> <-n vm-name>" - echo " $0 add_vm_nic <-s nic-number> <-m mac-address> <-n vm-name>" - echo " $0 remove_vm_nic <-s nic-number> <-n vm-name>" - echo " $0 fence <-m mac-address>" - echo " $0 start_as_incoming <-n vm-name> <-j migration-port>" - echo " $0 migrate <-n vm-name> <-k destination-host-ip> <-j migration-port>" - echo " $0 transfer_vm_config <-n vm-name> <-k destination-host-ip> <-k1 source-host-ip>" - echo " $0 monitor_migrate <-n vm-name> <-j migration-port>" - echo " $0 reset_vlans_by_mac <-m mac-address> <-b start/stop>" - echo " $0 iso <-q path> <-u username> <-p password>" - exit 1 -} - - - -function kvm_gen_mac() { - CMAC=`dd if=/dev/urandom bs=1 count=5 2>/dev/null | od -tx1 | head -1 | cut -d' ' -f2- | awk '{ print $1":"$2":"$3":"$4":"$5 }' | tr "[:upper:]" "[:lower:]"` - CMAC="00:"$CMAC - echo $CMAC -} - -function get_vm_type() { - local VM=$1 - if [ "$KVM_VM_TYPE" == "" ]; then - if [ -f "$OPENQRM_VM_DIR/$VM/vm-type" ]; then - . $OPENQRM_VM_DIR/$VM/vm-type - else - KVM_VM_TYPE="kvm-vm-local" - fi - fi - echo "$KVM_VM_TYPE" -} - - -FULL_COMMANDLINE="$0 $@" -KVM_COMMAND=$1 -shift - -while [ $# -ne 0 ]; do - case "$1" in - -n) - KVM_VM_NAME=$2 - shift - ;; - -m) - KVM_VM_MAC=$2 - shift - ;; - -m1) - KVM_VM_MAC2=$2 - shift - ;; - -m2) - KVM_VM_MAC3=$2 - shift - ;; - -m3) - KVM_VM_MAC4=$2 - shift - ;; - -m4) - KVM_VM_MAC5=$2 - shift - ;; - -r) - KVM_VM_RAM=$2 - shift - ;; - -d) - KVM_VM_DISK=$2 - shift - ;; - -s) - KVM_VM_SWAP=$2 - shift - ;; - -x) - KVM_VM_COMPONENT_NUMBER=$2 - shift - ;; - -u) - KVM_OPENQRM_USERNAME=$2 - shift - ;; - -p) - KVM_OPENQRM_PASSWORD=$2 - shift - ;; - -b) - KVM_VM_BOOT=$2 - shift - ;; - -i) - KVM_VM_BOOT_ISO=$2 - shift - ;; - -t) - KVM_VM_NIC_TYPE=$2 - shift - ;; - -t1) - KVM_VM_NIC_TYPE2=$2 - shift - ;; - -t2) - KVM_VM_NIC_TYPE3=$2 - shift - ;; - -t3) - KVM_VM_NIC_TYPE4=$2 - shift - ;; - -t4) - KVM_VM_NIC_TYPE5=$2 - shift - ;; - -z) - KVM_VM_MAC_BRIDGE=$2 - shift - ;; - -z1) - KVM_VM_MAC_BRIDGE2=$2 - shift - ;; - -z2) - KVM_VM_MAC_BRIDGE3=$2 - shift - ;; - -z3) - KVM_VM_MAC_BRIDGE4=$2 - shift - ;; - -z4) - KVM_VM_MAC_BRIDGE5=$2 - shift - ;; - -c) - KVM_VM_CPUS=$2 - shift - ;; - -o) - KVM_VM_DISK_INTERFACE=$2 - shift - ;; - -k) - KVM_MIGRATION_DESTINATION_HOST=$2 - shift - ;; - -k1) - KVM_MIGRATION_SOURCE_HOST=$2 - shift - ;; - -j) - KVM_MIGRATION_PORT=$2 - shift - ;; - -v) - KVM_VM_VNCPASSWORD=$2 - shift - ;; - -l) - KVM_VM_VNCKEYMAP=$2 - shift - ;; - -w) - KVM_VM_CLONE_NAME=$2 - shift - ;; - -q) - KVM_HOST_PATH=$2 - shift - ;; - -y) - KVM_VM_TYPE=$2 - shift - ;; - -cdrom) - KVM_VM_CDROM2=$2 - shift - ;; - --openqrm-ui-user) - OPENQRM_UI_USER=$2 - shift - ;; - --openqrm-internal-cmd) - OPENQRM_INTERNAL_CMD=$2 - shift - ;; - --openqrm-cmd-mode) - OPENQRM_CMD_MODE=$2 - shift - ;; - - *) - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - echo "ERROR: Free commandline arguments are not allowed: $@" - kvm_usage - exit 6 - ;; - esac - shift -done - - - - -# main -if [ "$KVM_COMMAND" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage -fi - -if [ "$KVM_COMMAND" == "post_vm_list" ] || [ "$KVM_COMMAND" == "post_vm_config" ]; then - if [ "$KVM_OPENQRM_USERNAME" == "" ]; then - kvm_usage - fi - if [ "$KVM_OPENQRM_PASSWORD" == "" ]; then - kvm_usage - fi -else - - if [ "$KVM_COMMAND" != "list" ] && [ "$KVM_COMMAND" != "setboot" ] && [ "$KVM_COMMAND" != "start_by_mac" ] && [ "$KVM_COMMAND" != "restart_by_mac" ] && [ "$KVM_COMMAND" != "post_bridge_config" ] && [ "$KVM_COMMAND" != "stop_by_mac" ] && [ "$KVM_COMMAND" != "fence" ] && [ "$KVM_COMMAND" != "iso" ] && [ "$KVM_COMMAND" != "reset_vlans_by_mac" ]; then - if [ "$KVM_VM_NAME" == "" ]; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - kvm_usage - fi - fi -fi - -# set defaults from the config -if [ "$KVM_VM_NIC_TYPE" == "" ]; then - KVM_VM_NIC_TYPE=$OPENQRM_PLUGIN_KVM_PRIMARY_NIC_TYPE -fi -if [ "$KVM_VM_NIC_TYPE2" == "" ]; then - KVM_VM_NIC_TYPE2=$OPENQRM_PLUGIN_KVM_ADDITIONAL_NIC_TYPE -fi -if [ "$KVM_VM_NIC_TYPE3" == "" ]; then - KVM_VM_NIC_TYPE3=$OPENQRM_PLUGIN_KVM_ADDITIONAL_NIC_TYPE -fi -if [ "$KVM_VM_NIC_TYPE4" == "" ]; then - KVM_VM_NIC_TYPE4=$OPENQRM_PLUGIN_KVM_ADDITIONAL_NIC_TYPE -fi -if [ "$KVM_VM_NIC_TYPE5" == "" ]; then - KVM_VM_NIC_TYPE5=$OPENQRM_PLUGIN_KVM_ADDITIONAL_NIC_TYPE -fi -if [ "$KVM_VM_MAC_BRIDGE" == "" ]; then - KVM_VM_MAC_BRIDGE=$OPENQRM_PLUGIN_KVM_BRIDGE_NET1 -fi -if [ "$KVM_VM_MAC_BRIDGE2" == "" ]; then - KVM_VM_MAC_BRIDGE2=$OPENQRM_PLUGIN_KVM_BRIDGE_NET2 -fi -if [ "$KVM_VM_MAC_BRIDGE3" == "" ]; then - KVM_VM_MAC_BRIDGE3=$OPENQRM_PLUGIN_KVM_BRIDGE_NET3 -fi -if [ "$KVM_VM_MAC_BRIDGE4" == "" ]; then - KVM_VM_MAC_BRIDGE4=$OPENQRM_PLUGIN_KVM_BRIDGE_NET4 -fi -if [ "$KVM_VM_MAC_BRIDGE5" == "" ]; then - KVM_VM_MAC_BRIDGE5=OPENQRM_PLUGIN_KVM_BRIDGE_NET5 -fi -if [ "$KVM_VM_VNCKEYMAP" == "" ]; then - KVM_VM_VNCKEYMAP=$OPENQRM_PLUGIN_KVM_DEFAULT_VNC_KEYMAP -fi - - -# calculate migration port -if [ "$KVM_MIGRATION_PORT" == "" ]; then - KVM_MIGRATION_PORT=$OPENQRM_VM_MIGRATION_PORT_RANGE_START -else - KVM_MIGRATION_PORT=$(( OPENQRM_VM_MIGRATION_PORT_RANGE_START + KVM_MIGRATION_PORT )) -fi - -case "$KVM_COMMAND" in - - create) - if [ "$KVM_VM_MAC" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_VM_RAM" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_VM_CPUS" == "" ]; then - KVM_VM_CPUS=1 - fi - if [ "$KVM_VM_BOOT" == "" ]; then - KVM_VM_BOOT=net - fi - # default vm type - if [ "$KVM_VM_TYPE" == "" ]; then - KVM_VM_TYPE="kvm-vm-local" - fi - # default disk interface ide - if [ "$KVM_VM_DISK_INTERFACE" == "" ]; then - KVM_VM_DISK_INTERFACE="virtio" - fi - # already existing ? - if [ -f $OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "create" 2 "openqrm-kvm" "KVM VM $KVM_VM_NAME already exist on this Host. Not creating new VM!" - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # creating the kvm start script - mkdir -p $OPENQRM_VM_DIR/$KVM_VM_NAME/ - cp -f $OPENQRM_KVM_VM_TEMPLATE $OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm - cp -f $OPENQRM_KVM_VM_TEMPLATE.incoming $OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm.incoming - # cpus - echo "KVM_VM_CPUS=\"$KVM_VM_CPUS\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/cpus - # ram - echo "KVM_VM_RAM=\"$KVM_VM_RAM\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/ram - # disk interface - echo "KVM_VM_DISK_INTERFACE=\"$KVM_VM_DISK_INTERFACE\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/disk-interface - # vm type - echo "KVM_VM_TYPE=\"$KVM_VM_TYPE\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/vm-type - - # network - case "$OPENQRM_PLUGIN_KVM_BRIDGE_TYPE" in - bridge) - # regular bridging - # nic1 - echo "KVM_VM_MAC_1=\"$KVM_VM_MAC\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - echo "KVM_VM_NET_1=\"-net nic,vlan=1,macaddr=$KVM_VM_MAC,model=$KVM_VM_NIC_TYPE -net tap,vlan=1,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - echo "KVM_VM_NIC_TYPE_1=\"$KVM_VM_NIC_TYPE\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - echo "KVM_VM_MAC_BRIDGE_1=\"$KVM_VM_MAC_BRIDGE\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - echo "KVM_VM_DETACH_MANAGEMENT_NIC=\"$OPENQRM_PLUGIN_VM_DETACH_MANAGEMENT_NIC\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE/g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE/g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE - # nic2 - 5 - if [ "$KVM_VM_MAC2" != "" ]; then - echo "KVM_VM_NET_2=\"-net nic,vlan=2,macaddr=$KVM_VM_MAC2,model=$KVM_VM_NIC_TYPE2 -net tap,vlan=2,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE2,downscript=no\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_MAC_2=\"$KVM_VM_MAC2\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_NIC_TYPE_2=\"$KVM_VM_NIC_TYPE2\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_MAC_BRIDGE_2=\"$KVM_VM_MAC_BRIDGE2\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE2/g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE2 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE2/g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE2 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE2 - else - echo "KVM_VM_NET_2=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_MAC_2=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_NIC_TYPE_2=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_MAC_BRIDGE_2=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - fi - if [ "$KVM_VM_MAC3" != "" ]; then - echo "KVM_VM_NET_3=\"-net nic,vlan=3,macaddr=$KVM_VM_MAC3,model=$KVM_VM_NIC_TYPE3 -net tap,vlan=3,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE3,downscript=no\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_MAC_3=\"$KVM_VM_MAC3\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_NIC_TYPE_3=\"$KVM_VM_NIC_TYPE3\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_MAC_BRIDGE_3=\"$KVM_VM_MAC_BRIDGE3\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE3/g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE3 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE3/g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE3 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-down-$KVM_VM_MAC_BRIDGE3 - else - echo "KVM_VM_NET_3=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_MAC_3=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_NIC_TYPE_3=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_MAC_BRIDGE_3=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - fi - if [ "$KVM_VM_MAC4" != "" ]; then - echo "KVM_VM_NET_4=\"-net nic,vlan=4,macaddr=$KVM_VM_MAC4,model=$KVM_VM_NIC_TYPE4 -net tap,vlan=4,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE4,downscript=no\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_MAC_4=\"$KVM_VM_MAC4\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_NIC_TYPE_4=\"$KVM_VM_NIC_TYPE4\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_MAC_BRIDGE_4=\"$KVM_VM_MAC_BRIDGE4\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE4/g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE4 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE4/g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE4 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE4 - else - echo "KVM_VM_NET_4=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_MAC_4=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_NIC_TYPE_4=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_MAC_BRIDGE_4=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - fi - if [ "$KVM_VM_MAC5" != "" ]; then - echo "KVM_VM_NET_5=\"-net nic,vlan=5,macaddr=$KVM_VM_MAC5,model=$KVM_VM_NIC_TYPE5 -net tap,vlan=5,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE5,downscript=no\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_MAC_5=\"$KVM_VM_MAC5\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_NIC_TYPE_5=\"$KVM_VM_NIC_TYPE5\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_MAC_BRIDGE_5=\"$KVM_VM_MAC_BRIDGE5\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE5/g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE5 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net-$KVM_VM_MAC_BRIDGE5 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE5/g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE5 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE5 - else - echo "KVM_VM_NET_5=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_MAC_5=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_NIC_TYPE_5=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_MAC_BRIDGE_5=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - fi - chmod +x $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-kvm-ifup-net* - ;; - - openvswitch) - # openvswitch - # setup the nics - echo "KVM_VM_NET_1=\"-net nic,vlan=1,macaddr=$KVM_VM_MAC,model=$KVM_VM_NIC_TYPE -net tap,vlan=1,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - echo "KVM_VM_MAC_1=\"$KVM_VM_MAC\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - echo "KVM_VM_NIC_TYPE_1=\"$KVM_VM_NIC_TYPE\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - echo "KVM_VM_MAC_BRIDGE_1=\"$KVM_VM_MAC_BRIDGE\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - echo "KVM_VM_DETACH_MANAGEMENT_NIC=\"$OPENQRM_PLUGIN_VM_DETACH_MANAGEMENT_NIC\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#1#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#1#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-$KVM_VM_MAC_BRIDGE - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-$KVM_VM_MAC_BRIDGE - if [ "$KVM_VM_MAC2" != "" ]; then - echo "KVM_VM_NET_2=\"-net nic,vlan=2,macaddr=$KVM_VM_MAC2,model=$KVM_VM_NIC_TYPE2 -net tap,vlan=2,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE2,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE2\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_MAC_2=\"$KVM_VM_MAC2\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_NIC_TYPE_2=\"$KVM_VM_NIC_TYPE2\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_MAC_BRIDGE_2=\"$KVM_VM_MAC_BRIDGE2\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE2/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#2#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE2 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE2/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#2#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-$KVM_VM_MAC_BRIDGE2 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE2 - else - echo "KVM_VM_NET_2=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_MAC_2=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_NIC_TYPE_2=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_MAC_BRIDGE_2=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - fi - if [ "$KVM_VM_MAC3" != "" ]; then - echo "KVM_VM_NET_3=\"-net nic,vlan=3,macaddr=$KVM_VM_MAC3,model=$KVM_VM_NIC_TYPE3 -net tap,vlan=3,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE3,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE3\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_MAC_3=\"$KVM_VM_MAC3\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_NIC_TYPE_3=\"$KVM_VM_NIC_TYPE3\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_MAC_BRIDGE_3=\"$KVM_VM_MAC_BRIDGE3\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE3/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#3#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE3 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE3/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#3#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-$KVM_VM_MAC_BRIDGE3 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-$KVM_VM_MAC_BRIDGE3 - else - echo "KVM_VM_NET_3=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_MAC_3=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_NIC_TYPE_3=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_MAC_BRIDGE_3=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - fi - if [ "$KVM_VM_MAC4" != "" ]; then - echo "KVM_VM_NET_4=\"-net nic,vlan=4,macaddr=$KVM_VM_MAC4,model=$KVM_VM_NIC_TYPE4 -net tap,vlan=4,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE4,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE4\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_MAC_4=\"$KVM_VM_MAC4\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_NIC_TYPE_4=\"$KVM_VM_NIC_TYPE4\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_MAC_BRIDGE_4=\"$KVM_VM_MAC_BRIDGE4\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE4/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#4#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE4 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE4/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#4#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-$KVM_VM_MAC_BRIDGE4 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-$KVM_VM_MAC_BRIDGE4 - else - echo "KVM_VM_NET_4=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_MAC_4=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_NIC_TYPE_4=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_MAC_BRIDGE_4=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - fi - if [ "$KVM_VM_MAC5" != "" ]; then - echo "KVM_VM_NET_5=\"-net nic,vlan=5,macaddr=$KVM_VM_MAC5,model=$KVM_VM_NIC_TYPE5 -net tap,vlan=5,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE5,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE5\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_MAC_5=\"$KVM_VM_MAC5\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_NIC_TYPE_5=\"$KVM_VM_NIC_TYPE5\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_MAC_BRIDGE_5=\"$KVM_VM_MAC_BRIDGE5\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE5/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#5#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE5 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup-$KVM_VM_MAC_BRIDGE5 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE5/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#5#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-$KVM_VM_MAC_BRIDGE5 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-$KVM_VM_MAC_BRIDGE5 - else - echo "KVM_VM_NET_5=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_MAC_5=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_NIC_TYPE_5=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_MAC_BRIDGE_5=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - fi - chmod +x $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-* - ;; - - - vlanbridge) - # bridged vlans - modprobe 8021q - # setup the nics - echo "KVM_VM_NET_1=\"-net nic,vlan=1,macaddr=$KVM_VM_MAC,model=$KVM_VM_NIC_TYPE -net tap,vlan=1,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - echo "KVM_VM_MAC_1=\"$KVM_VM_MAC\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - echo "KVM_VM_NIC_TYPE_1=\"$KVM_VM_NIC_TYPE\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - echo "KVM_VM_MAC_BRIDGE_1=\"$KVM_VM_MAC_BRIDGE\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - echo "KVM_VM_DETACH_MANAGEMENT_NIC=\"$OPENQRM_PLUGIN_VM_DETACH_MANAGEMENT_NIC\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#0#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#0#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE - if [ "$KVM_VM_MAC2" != "" ]; then - echo "KVM_VM_NET_2=\"-net nic,vlan=2,macaddr=$KVM_VM_MAC2,model=$KVM_VM_NIC_TYPE2 -net tap,vlan=2,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE2,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE2\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_MAC_2=\"$KVM_VM_MAC2\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_NIC_TYPE_2=\"$KVM_VM_NIC_TYPE2\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_MAC_BRIDGE_2=\"$KVM_VM_MAC_BRIDGE2\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE2/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#1#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE2 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE2/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#1#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE2 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE2 - else - echo "KVM_VM_NET_2=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_MAC_2=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_NIC_TYPE_2=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - echo "KVM_VM_MAC_BRIDGE_2=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - fi - if [ "$KVM_VM_MAC3" != "" ]; then - echo "KVM_VM_NET_3=\"-net nic,vlan=3,macaddr=$KVM_VM_MAC3,model=$KVM_VM_NIC_TYPE3 -net tap,vlan=3,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE3,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE3\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_MAC_3=\"$KVM_VM_MAC3\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_NIC_TYPE_3=\"$KVM_VM_NIC_TYPE3\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_MAC_BRIDGE_3=\"$KVM_VM_MAC_BRIDGE3\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE3/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#2#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE3 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE3/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#2#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE3 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE3 - else - echo "KVM_VM_NET_3=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_MAC_3=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_NIC_TYPE_3=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - echo "KVM_VM_MAC_BRIDGE_3=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - fi - if [ "$KVM_VM_MAC4" != "" ]; then - echo "KVM_VM_NET_4=\"-net nic,vlan=4,macaddr=$KVM_VM_MAC4,model=$KVM_VM_NIC_TYPE4 -net tap,vlan=4,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE4,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE4\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_MAC_4=\"$KVM_VM_MAC4\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_NIC_TYPE_4=\"$KVM_VM_NIC_TYPE4\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_MAC_BRIDGE_4=\"$KVM_VM_MAC_BRIDGE4\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE4/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#3#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE4 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE4/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#3#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE4 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE4 - else - echo "KVM_VM_NET_4=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_MAC_4=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_NIC_TYPE_4=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - echo "KVM_VM_MAC_BRIDGE_4=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - fi - if [ "$KVM_VM_MAC5" != "" ]; then - echo "KVM_VM_NET_5=\"-net nic,vlan=5,macaddr=$KVM_VM_MAC5,model=$KVM_VM_NIC_TYPE5 -net tap,vlan=5,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE5,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE5\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_MAC_5=\"$KVM_VM_MAC5\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_NIC_TYPE_5=\"$KVM_VM_NIC_TYPE5\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_MAC_BRIDGE_5=\"$KVM_VM_MAC_BRIDGE5\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE5/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#4#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE5 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net-$KVM_VM_MAC_BRIDGE5 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_VM_MAC_BRIDGE5/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#4#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE5 - sed -i -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net-$KVM_VM_MAC_BRIDGE5 - else - echo "KVM_VM_NET_5=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_MAC_5=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_NIC_TYPE_5=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - echo "KVM_VM_MAC_BRIDGE_5=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - fi - chmod +x $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-* - ;; - - esac - - # disk - # add empty disk disk parameter - echo "KVM_VM_DISK_1=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/disk1 - echo "KVM_VM_DISK_SIZE_1=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/disk1 - # empty 2. and 3. disk - echo "KVM_VM_DISK_2=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/disk2 - echo "KVM_VM_DISK_SIZE_2=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/disk2 - echo "KVM_VM_DISK_3=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/disk3 - echo "KVM_VM_DISK_SIZE_3=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/disk3 - # add empty disk disk parameter - echo "KVM_VM_DISK_4=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/disk4 - echo "KVM_VM_DISK_SIZE_4=\"\"" >> $OPENQRM_VM_DIR/$KVM_VM_NAME/disk4 - - # CDROM - if [ "$KVM_VM_CDROM2" == "" ]; then - echo "KVM_VM_CDROM2=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom2 - else - echo "KVM_VM_CDROM2=\"-drive file=$KVM_VM_CDROM2,media=cdrom\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom2 - fi - - # kvm-vm-local or kvm-vm-net - if [ "$KVM_VM_TYPE" == "kvm-vm-local" ]; then - # a cdrom/iso - if [ "$KVM_VM_BOOT_ISO" == "" ]; then - echo "KVM_VM_CDROM=\"\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom - else - echo "KVM_VM_CDROM=\"-cdrom $KVM_VM_BOOT_ISO\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom - fi - # boot from - case "$KVM_VM_BOOT" in - local) - echo "KVM_VM_BOOT=\"-boot cn\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - ;; - net) - echo "KVM_VM_BOOT=\"-boot n\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - ;; - network) - echo "KVM_VM_BOOT=\"-boot n\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - ;; - cdrom) - echo "KVM_VM_BOOT=\"-boot d\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - echo "KVM_VM_CDROM=\"-cdrom /dev/cdrom\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom - ;; - iso) - echo "KVM_VM_BOOT=\"-boot d\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - echo "KVM_VM_CDROM=\"-cdrom $KVM_VM_BOOT_ISO\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom - ;; - esac - - elif [ "$KVM_VM_TYPE" == "kvm-vm-net" ]; then - echo "KVM_VM_BOOT=\"-boot n\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - echo "" > $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom - fi - - # vnc : check on which vnc display which can run it - ALREADY_USED_VNC_IDS="" - for VNC_CONF in `find $OPENQRM_VM_DIR/* -name vnc`; do - unset KVM_VM_VNC - . $VNC_CONF - USED_VNC_ID=`echo $KVM_VM_VNC | cut -d':' -f2` - ALREADY_USED_VNC_IDS="$USED_VNC_ID $ALREADY_USED_VNC_IDS" - done - NEW_VNC_ID=$OPENQRM_FIRST_VNC_ID - while (true); do - FOUND_VNC_ID="false" - for VNC_ID in $ALREADY_USED_VNC_IDS; do - if [ "$VNC_ID" == "$NEW_VNC_ID" ]; then - FOUND_VNC_ID="true" - continue - fi - done - if [ "$FOUND_VNC_ID" == "false" ]; then - break - else - NEW_VNC_ID=$(( NEW_VNC_ID + 1 )) - fi - done - # on which network to listen ? - if [ "$OPENQRM_PLUGIN_VM_VNC_LISTEN" == "all" ]; then - echo "KVM_VM_VNC=\"0.0.0.0:$NEW_VNC_ID\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/vnc - # prepare a list of all configured interfaces for the cloud vnc access - CLOUD_VNC_LISTEN="" - for LISTEN_IP in `ip a s | grep -w inet | awk '{ print $2 }' | cut -d'/' -f1 | grep -v 127.0.0.1`; do - CLOUD_VNC_LISTEN="$CLOUD_VNC_LISTEN, $LISTEN_IP:$NEW_VNC_ID" - done - CLOUD_VNC_LISTEN=`echo $CLOUD_VNC_LISTEN | sed -e "s/,//"` - else - echo "KVM_VM_VNC=\"$resource_ip:$NEW_VNC_ID\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/vnc - CLOUD_VNC_LISTEN="$resource_ip:$NEW_VNC_ID" - fi - # store the vnc infos for the cloud - echo "$CLOUD_VNC_LISTEN" > $KVM_VM_MAC.vnc - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $KVM_VM_MAC.vnc` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?kvm_server_command=put_vnc; then - openqrm_post_event 0 "create" 2 "openqrm-kvm-vm" "Could not post VM VNC access data to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $KVM_VM_MAC.vnc $KVM_VM_MAC.vnc.post - if [ "$KVM_VM_VNCPASSWORD" == "" ]; then - KVM_VM_VNCPASSWORD=` $OPENQRM_VM_DIR/$KVM_VM_NAME/vncpassword - # vnc keymap - echo "KVM_VM_VNCKEYMAP=\"$KVM_VM_VNCKEYMAP\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/vnckeymap - # prepare directory for monitor sockets - mkdir -p $OPENQRM_VM_MONITOR_DIR - # do not start but fake as idle :) - chmod +x $OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm $OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm.incoming - # kvm-vm-local or kvm-vm-net - if [ "$KVM_VM_TYPE" == "kvm-vm-local" ]; then - # start monitor for the fake idle resource - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC | awk {' print $1 '}` 2>/dev/null - $RUNSCREEN -dmS $KVM_VM_MAC $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/openqrm-kvm-monitord $KVM_VM_MAC - elif [ "$KVM_VM_TYPE" == "kvm-vm-net" ]; then - - CMD_ERR=`$OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "create" 3 "openqrm-kvm-vm" "Error starting KVM VM $KVM_VM_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - fi - touch $OPENQRM_VM_DIR/$KVM_VM_NAME/autostart.$resource_id - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - openqrm_post_event 0 "create" 5 "openqrm-kvm-vm" "Created KVM VM $KVM_VM_NAME." - ;; - - update) - if [ "$KVM_VM_MAC" == "" ]; then - kvm_usage - fi - if [ "$KVM_VM_RAM" == "" ]; then - kvm_usage - fi - if [ "$KVM_VM_CPUS" == "" ]; then - KVM_VM_CPUS=1 - fi - if [ "$KVM_VM_BOOT" == "" ]; then - KVM_VM_BOOT=net - fi - # get vm type - KVM_VM_TYPE=`get_vm_type $KVM_VM_NAME` - # already existing ? - if [ ! -f $OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm ]; then - openqrm_post_event 0 "update" 2 "openqrm-kvm" "KVM VM $KVM_VM_NAME does not exist on this Host. Not updating the VM!" - exit 1 - fi - # prepare possible additional network cards - if [ "$KVM_VM_MAC2" != "" ]; then - KVM_VM_NET_CONFIG2=" -m1 $KVM_VM_MAC2 -t1 $KVM_VM_NIC_TYPE2 -z1 $KVM_VM_MAC_BRIDGE2" - fi - if [ "$KVM_VM_MAC3" != "" ]; then - KVM_VM_NET_CONFIG3=" -m2 $KVM_VM_MAC3 -t2 $KVM_VM_NIC_TYPE3 -z2 $KVM_VM_MAC_BRIDGE3" - fi - if [ "$KVM_VM_MAC4" != "" ]; then - KVM_VM_NET_CONFIG4=" -m3 $KVM_VM_MAC4 -t3 $KVM_VM_NIC_TYPE4 -z3 $KVM_VM_MAC_BRIDGE4" - fi - if [ "$KVM_VM_MAC5" != "" ]; then - KVM_VM_NET_CONFIG5=" -m4 $KVM_VM_MAC5 -t4 $KVM_VM_NIC_TYPE5 -z4 $KVM_VM_MAC_BRIDGE5" - fi - KVM_VM_NET_CONFIG="$KVM_VM_NET_CONFIG2 $KVM_VM_NET_CONFIG3 $KVM_VM_NET_CONFIG4 $KVM_VM_NET_CONFIG5" - # disk interface - if [ "$KVM_VM_DISK_INTERFACE" == "" ]; then - if [ -f "$OPENQRM_VM_DIR/$KVM_VM_NAME/disk-interface" ]; then - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk-interface - else - KVM_VM_DISK_INTERFACE="ide" - fi - fi - # CDROM - if [ "$KVM_VM_CDROM2" != "" ]; then - KVM_VM_CDROM2="-cdrom $KVM_VM_CDROM2" - else - KVM_VM_CDROM2="" - fi - - # kvm-vm-local or kvm-vm-net - if [ "$KVM_VM_TYPE" == "kvm-vm-local" ]; then - # boot ? - KVM_VM_BOOT_DEV_PARAM="local" - if [ "$KVM_VM_BOOT" != "" ]; then - case "$KVM_VM_BOOT" in - local) - KVM_VM_BOOT_DEV_PARAM="local" - ;; - network) - KVM_VM_BOOT_DEV_PARAM="net" - ;; - iso) - KVM_VM_BOOT_DEV_PARAM="iso" - ;; - cdrom) - KVM_VM_BOOT_DEV_PARAM="cdrom" - ;; - esac - fi - # iso ? - if [ "$KVM_VM_BOOT_ISO" != "" ]; then - KVM_VM_ISO_CONFIG="-i $KVM_VM_BOOT_ISO" - fi - elif [ "$KVM_VM_TYPE" == "kvm-vm-net" ]; then - KVM_VM_BOOT_DEV_PARAM="net" - fi - - # vnc keymap - if [ "$KVM_VM_VNCKEYMAP" != "" ]; then - VNCKEYMAP_PARAMETER="-l $KVM_VM_VNCKEYMAP" - fi - # no lock for update since remove + create are locking - # save the disk files, we want to update everything else - KVM_VM_DISK_TMP_DIR=`mktemp -d /tmp/kvm-vm-disk-$KVM_VM_NAME.XXXXXX` - cp -f $OPENQRM_VM_DIR/$KVM_VM_NAME/disk[0-9] $KVM_VM_DISK_TMP_DIR/ - # delete - $0 delete -n $KVM_VM_NAME - # re-create - $0 create -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD -n $KVM_VM_NAME -y $KVM_VM_TYPE -c $KVM_VM_CPUS -r $KVM_VM_RAM -o $KVM_VM_DISK_INTERFACE $KVM_VM_CDROM2 -b $KVM_VM_BOOT_DEV_PARAM $KVM_VM_ISO_CONFIG -m $KVM_VM_MAC -t $KVM_VM_NIC_TYPE -z $KVM_VM_MAC_BRIDGE $KVM_VM_NET_CONFIG -v $KVM_VM_VNCPASSWORD $VNCKEYMAP_PARAMETER - cp -f $KVM_VM_DISK_TMP_DIR/disk[0-9] $OPENQRM_VM_DIR/$KVM_VM_NAME/ - rm -f $KVM_VM_DISK_TMP_DIR/disk* - rmdir $KVM_VM_DISK_TMP_DIR - openqrm_post_event 0 "update" 5 "openqrm-kvm-vm" "Updated KVM VM $KVM_VM_NAME." - ;; - - - - clone) - # new mac address - if [ "$KVM_VM_MAC" == "" ]; then - kvm_usage - fi - # origin existing ? - if [ ! -f $OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm ]; then - openqrm_post_event 0 "clone" 2 "openqrm-kvm" "KVM VM $KVM_VM_NAME does not exist on this Host. Not cloning the VM $KVM_VM_NAME!" - exit 1 - fi - # clone name already existing ? - if [ -f $OPENQRM_VM_DIR/$KVM_VM_CLONE_NAME/$KVM_VM_CLONE_NAME.kvm ]; then - openqrm_post_event 0 "clone" 2 "openqrm-kvm" "KVM VM $KVM_VM_CLONE_NAME already exist on this Host. Not cloning the VM $KVM_VM_NAME!" - exit 1 - fi - # read origin VM config - . $OPENQRM_VM_DIR/$KVM_VM_NAME/cpus - . $OPENQRM_VM_DIR/$KVM_VM_NAME/ram - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk1 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk2 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk3 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk4 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/vnc - . $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - - if [ -f "$OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom2" ]; then - . $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom2 - fi - if [ -f "$OPENQRM_VM_DIR/$KVM_VM_NAME/vncpassword" ]; then - . $OPENQRM_VM_DIR/$KVM_VM_NAME/vncpassword - fi - if [ -f "$OPENQRM_VM_DIR/$KVM_VM_NAME/vnckeymap" ]; then - . $OPENQRM_VM_DIR/$KVM_VM_NAME/vnckeymap - fi - # disk interface - if [ "$KVM_VM_DISK_INTERFACE" == "" ]; then - if [ -f "$OPENQRM_VM_DIR/$KVM_VM_NAME/disk-interface" ]; then - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk-interface - else - KVM_VM_DISK_INTERFACE="ide" - fi - fi - # CDROM - if [ -f "$OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom2" ]; then - . $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom2 - if [ "$KVM_VM_CDROM2" != "" ]; then - KVM_VM_CDROM2=$(echo "$KVM_VM_CDROM2" | sed -e 's/-drive file=//' | sed -e 's/,media=cdrom//') - KVM_VM_CDROM2="-cdrom $KVM_VM_CDROM2" - else - KVM_VM_CDROM2="" - fi - else - KVM_VM_CDROM2="" - fi - # get vm type - KVM_VM_TYPE=`get_vm_type $KVM_VM_NAME` - # prepare possible additional network cards - if [ "$KVM_VM_MAC_2" != "" ]; then - # generate new mac - KVM_VM_MAC_2=`kvm_gen_mac` - KVM_VM_NET_CONFIG_2=" -m1 $KVM_VM_MAC_2 -t1 $KVM_VM_NIC_TYPE_2 -z1 $KVM_VM_MAC_BRIDGE_2" - fi - if [ "$KVM_VM_MAC_3" != "" ]; then - KVM_VM_MAC_3=`kvm_gen_mac` - KVM_VM_NET_CONFIG_3=" -m2 $KVM_VM_MAC_3 -t2 $KVM_VM_NIC_TYPE_3 -z2 $KVM_VM_MAC_BRIDGE_3" - fi - if [ "$KVM_VM_MAC_4" != "" ]; then - KVM_VM_MAC_4=`kvm_gen_mac` - KVM_VM_NET_CONFIG_4=" -m3 $KVM_VM_MAC_4 -t3 $KVM_VM_NIC_TYPE_4 -z3 $KVM_VM_MAC_BRIDGE_4" - fi - if [ "$KVM_VM_MAC_5" != "" ]; then - KVM_VM_MAC_5=`kvm_gen_mac` - KVM_VM_NET_CONFIG_5=" -m4 $KVM_VM_MAC_5 -t4 $KVM_VM_NIC_TYPE_5 -z4 $KVM_VM_MAC_BRIDGE_5" - fi - KVM_VM_NET_CONFIG="$KVM_VM_NET_CONFIG_2 $KVM_VM_NET_CONFIG_3 $KVM_VM_NET_CONFIG_4 $KVM_VM_NET_CONFIG_5" - # kvm-vm-local or kvm-vm-net - if [ "$KVM_VM_TYPE" == "kvm-vm-local" ]; then - # boot ? - KVM_VM_BOOT_DEV_PARAM="local" - if [ "$KVM_VM_BOOT" != "" ]; then - KVM_VM_BOOT_DEV=`echo $KVM_VM_BOOT | awk '{ print $2 }'` - case "$KVM_VM_BOOT_DEV" in - c) - KVM_VM_BOOT_DEV_PARAM="local" - ;; - n) - KVM_VM_BOOT_DEV_PARAM="net" - ;; - d) - KVM_VM_BOOT_DEV_PARAM="iso" - ;; - esac - fi - # iso ? - if [ "$KVM_VM_BOOT_ISO" != "" ]; then - KVM_VM_BOOT_ISO_DEV=`echo $KVM_VM_BOOT_ISO | awk '{ print $2 }'` - KVM_VM_ISO_CONFIG="-i $KVM_VM_BOOT_ISO_DEV" - fi - elif [ "$KVM_VM_TYPE" == "kvm-vm-net" ]; then - KVM_VM_BOOT_DEV_PARAM="net" - fi - # vnc - if [ "$KVM_VM_VNCPASSWORD" != "" ]; then - KVM_VM_VNCPASSWORD_CONFIG=" -v $KVM_VM_VNCPASSWORD" - fi - # vnc keymap - if [ "$KVM_VM_VNCKEYMAP" != "" ]; then - VNCKEYMAP_PARAMETER="-l $KVM_VM_VNCKEYMAP" - fi - - $0 create -n $KVM_VM_CLONE_NAME -y $KVM_VM_TYPE -c $KVM_VM_CPUS -r $KVM_VM_RAM -o $KVM_VM_DISK_INTERFACE $KVM_VM_CDROM2 -b $KVM_VM_BOOT_DEV_PARAM $KVM_VM_ISO_CONFIG -m $KVM_VM_MAC -t $KVM_VM_NIC_TYPE_1 -z $KVM_VM_MAC_BRIDGE_1 $KVM_VM_NET_CONFIG $KVM_VM_VNCPASSWORD_CONFIG $VNCKEYMAP_PARAMETER $KVM_CDROM2 - openqrm_post_event 0 "clone" 5 "openqrm-kvm-vm" "Cloned KVM VM $KVM_VM_NAME to $KVM_VM_CLONE_NAME." - ;; - - - start) - # get vm type - KVM_VM_TYPE=`get_vm_type $KVM_VM_NAME` - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # kvm-vm-local or kvm-vm-net - if [ "$KVM_VM_TYPE" == "kvm-vm-local" ]; then - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - # start only if we have a root-disk - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk1 - if [ "$KVM_VM_DISK_1" != "" ]; then - # lvol or blockfile ? - if echo $KVM_VM_DISK_1 | grep ^/dev 1>/dev/null; then - # aquire global lock for lvm operations - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock aquire lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD $LOCK_TIME "Start of VM $KVM_VM_NAME on volume $KVM_VM_DISK_1" - fi - fi - if [ ! -e "$KVM_VM_DISK_1" ]; then - # activate the lvol - kvm_refresh_lvm - lvchange -ay -y $KVM_VM_DISK_1 - if [ ! -e "$KVM_VM_DISK_1" ]; then - lvchange -ay -y $KVM_VM_DISK_1 - fi - fi - lvchange -ay -y $KVM_VM_DISK_1 - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - fi - # start the vm - CMD_ERR=`$OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "start" 3 "openqrm-kvm-vm" "Error starting KVM VM $KVM_VM_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - # monitoring on the host or vm ? - if [ "$OPENQRM_PLUGIN_KVM_VM_MONITORING_ON_HOST" != "false" ]; then - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC_1 | awk {' print $1 '}` 2>/dev/null - $RUNSCREEN -dmS $KVM_VM_MAC_1 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/openqrm-kvm-monitord $KVM_VM_MAC_1 - fi - else - # idle, start the vm monitord / make sure it is stopped before - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC_1 | awk {' print $1 '}` 2>/dev/null - $RUNSCREEN -dmS $KVM_VM_MAC_1 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/openqrm-kvm-monitord $KVM_VM_MAC_1 - fi - elif [ "$KVM_VM_TYPE" == "kvm-vm-net" ]; then - - CMD_ERR=`$OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "start" 3 "openqrm-kvm-vm" "Error starting KVM VM $KVM_VM_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - fi - touch $OPENQRM_VM_DIR/$KVM_VM_NAME/autostart.$resource_id - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - openqrm_post_event 0 "start" 5 "openqrm-kvm-vm" "Started KVM VM $KVM_VM_NAME." - ;; - start_by_mac) - KVM_VM_NAME=`grep -rHi $KVM_VM_MAC $OPENQRM_VM_DIR/*/net1 2>/dev/null | grep KVM_VM_MAC | cut -d':' -f1 2>/dev/null` 2>/dev/null - KVM_VM_NAME=`dirname $KVM_VM_NAME` 2>/dev/null - KVM_VM_NAME=`basename $KVM_VM_NAME` 2>/dev/null - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "start_by_mac" 2 "openqrm-kvm-vm" "Could not find KVM VM $KVM_VM_MAC on host." - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # get vm type - KVM_VM_TYPE=`get_vm_type $KVM_VM_NAME` - # kvm-vm-local or kvm-vm-net - if [ "$KVM_VM_TYPE" == "kvm-vm-local" ]; then - echo "KVM_VM_DISK_1=\"$KVM_VM_DISK\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/disk1 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk1 - # start only if we have a root-disk - if [ "$KVM_VM_DISK_1" != "" ]; then - # lvol or blockfile ? - if echo $KVM_VM_DISK_1 | grep ^/dev 1>/dev/null; then - # aquire global lock for lvm operations - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock aquire lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD $LOCK_TIME "Start-by-mac of VM $KVM_VM_NAME on volume $KVM_VM_DISK_1" - fi - fi - if [ ! -e "$KVM_VM_DISK_1" ]; then - # activate the lvol - kvm_refresh_lvm - lvchange -ay -y $KVM_VM_DISK_1 - if [ ! -e "$KVM_VM_DISK_1" ]; then - lvchange -ay -y $KVM_VM_DISK_1 - fi - fi - # always activate the lvol - lvchange -ay -y $KVM_VM_DISK_1 - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - - # ! We do not start here since this is done by the restart_by_mac function - # start + boot local - # $OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm - fi - fi - # ! We do not start here since this is done by the restart_by_mac function - # # start the vm monitord / make sure it is stopped before - # kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC | awk {' print $1 '}` 2>/dev/null - # $RUNSCREEN -dmS $KVM_VM_MAC $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/openqrm-kvm-monitord $KVM_VM_MAC - # touch $OPENQRM_VM_DIR/$KVM_VM_NAME/autostart.$resource_id - elif [ "$KVM_VM_TYPE" == "kvm-vm-net" ]; then - CMD_ERR=`$OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "start_by_mac" 2 "openqrm-kvm-vm" "Error starting KVM VM $KVM_VM_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - fi - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - openqrm_post_event 0 "start_by_mac" 5 "openqrm-kvm-vm" "Started KVM VM $KVM_VM_NAME." - ;; - stop) - if [ ! -e "$OPENQRM_VM_DIR/$KVM_VM_NAME/net1" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "stop" 2 "openqrm-kvm-vm" "Network configuration of KVM VM $KVM_VM_NAME does not exists!" - exit 1 - fi - # get mac - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - if [ "$KVM_VM_MAC_1" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "stop" 2 "openqrm-kvm-vm" "Could not find mac address of KVM VM $KVM_VM_NAME!" - exit 1 - fi - # get vm type - KVM_VM_TYPE=`get_vm_type $KVM_VM_NAME` - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # send powerdown - if [ -e "$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon" ]; then - echo "system_powerdown" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - fi - # wait until shutdown-delay, if VM is not down then stop hard - KVM_VM_SHUTDOWN_LOOP=0 - while ps ax | grep -i "macaddr=$KVM_VM_MAC_1" | grep kvm | grep -i screen | grep -v grep 1>/dev/null; do - sleep 1 - KVM_VM_SHUTDOWN_LOOP=$(( KVM_VM_SHUTDOWN_LOOP + 1 )) - if [ "$KVM_VM_SHUTDOWN_LOOP" == "$KVM_VM_SHUTDOWN_DELAY" ]; then - break - fi - # send powerdown again - echo "system_powerdown" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - done - - # quit via the monitor socket does not run ifdown-net-script - VM_PID=`ps ax | grep -i "macaddr=$KVM_VM_MAC_1" | grep kvm | grep -i screen | grep -v grep | awk {' print $1 '}` - if [ "$VM_PID" != "" ]; then - if [ "$KVM_VM_TYPE" == "kvm-vm-local" ]; then - openqrm_post_event 0 "stop" 5 "openqrm-kvm-vm" "Force stopping KVM VM $KVM_VM_NAME! Stopping PID $VM_PID" - fi - kill $VM_PID - fi - # kill the status monitor - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC_1 | awk {' print $1 '}` 2>/dev/null - rm -f $OPENQRM_VM_DIR/$KVM_VM_NAME/autostart.$resource_id - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - openqrm_post_event 0 "stop" 5 "openqrm-kvm-vm" "Stopped KVM VM $KVM_VM_NAME." - ;; - - stop_by_mac) - KVM_VM_NAME=`grep -rHi $KVM_VM_MAC $OPENQRM_VM_DIR/*/net1 2>/dev/null | grep KVM_VM_MAC | cut -d':' -f1 2>/dev/null` 2>/dev/null - KVM_VM_NAME=`dirname $KVM_VM_NAME` 2>/dev/null - KVM_VM_NAME=`basename $KVM_VM_NAME` 2>/dev/null - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "stop_by_mac" 2 "openqrm-kvm-vm" "Could not find KVM VM $KVM_VM_MAC on host." - exit 1 - fi - if [ ! -e "$OPENQRM_VM_DIR/$KVM_VM_NAME/net1" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "stop_by_mac" 2 "openqrm-kvm-vm" "Network configuration of KVM VM $KVM_VM_NAME does not exists!" - exit 1 - fi - # refresh mac - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - if [ "$KVM_VM_MAC_1" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "stop_by_mac" 2 "openqrm-kvm-vm" "Could not find mac address of KVM VM $KVM_VM_NAME!" - exit 1 - fi - if [ "$KVM_VM_MAC" != "$KVM_VM_MAC_1" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "stop_by_mac" 2 "openqrm-kvm-vm" "Mac address mismatch on KVM VM $KVM_VM_NAME!" - exit 1 - fi - - # get vm type - KVM_VM_TYPE=`get_vm_type $KVM_VM_NAME` - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # send powerdown - if [ -e "$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon" ]; then - echo "system_powerdown" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - fi - # wait until shutdown-delay, if VM is not down then stop hard - KVM_VM_SHUTDOWN_LOOP=0 - while ps ax | grep -i "macaddr=$KVM_VM_MAC_1" | grep kvm | grep -i screen | grep -v grep 1>/dev/null; do - sleep 1 - KVM_VM_SHUTDOWN_LOOP=$(( KVM_VM_SHUTDOWN_LOOP + 1 )) - if [ "$KVM_VM_SHUTDOWN_LOOP" == "$KVM_VM_SHUTDOWN_DELAY" ]; then - break - fi - # send powerdown again - echo "system_powerdown" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - done - - VM_PID=`ps ax | grep -i "macaddr=$KVM_VM_MAC_1" | grep kvm | grep -i screen | grep -v grep | awk {' print $1 '}` - if [ "$VM_PID" != "" ]; then - if [ "$KVM_VM_TYPE" == "kvm-vm-local" ]; then - openqrm_post_event 0 "stop_by_mac" 5 "openqrm-kvm-vm" "Force stopping KVM VM $KVM_VM_NAME." - fi - kill $VM_PID - fi - #echo "quit" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - # kill the status monitor - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC_1 | awk {' print $1 '}` 2>/dev/null - rm -f $OPENQRM_VM_DIR/$KVM_VM_NAME/autostart.$resource_id - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - openqrm_post_event 0 "stop_by_mac" 5 "openqrm-kvm-vm" "Stopped KVM VM $KVM_VM_NAME." - ;; - - restart_by_mac) - KVM_VM_NAME=`grep -rHi $KVM_VM_MAC $OPENQRM_VM_DIR/*/net1 2>/dev/null | grep KVM_VM_MAC | cut -d':' -f1 2>/dev/null` 2>/dev/null - KVM_VM_NAME=`dirname $KVM_VM_NAME` 2>/dev/null - KVM_VM_NAME=`basename $KVM_VM_NAME` 2>/dev/null - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "restart_by_mac" 2 "openqrm-kvm-vm" "Could not find KVM VM $KVM_VM_MAC on host." - exit 1 - fi - if [ ! -e "$OPENQRM_VM_DIR/$KVM_VM_NAME/net1" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "stop_by_mac" 2 "openqrm-kvm-vm" "Network configuration of KVM VM $KVM_VM_NAME does not exists!" - exit 1 - fi - # refresh mac - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - if [ "$KVM_VM_MAC_1" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "restart_by_mac" 2 "openqrm-kvm-vm" "Could not find mac address of KVM VM $KVM_VM_NAME!" - exit 1 - fi - if [ "$KVM_VM_MAC" != "$KVM_VM_MAC_1" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "restart_by_mac" 2 "openqrm-kvm-vm" "Mac address mismatch on KVM VM $KVM_VM_NAME!" - exit 1 - fi - - # get vm type - KVM_VM_TYPE=`get_vm_type $KVM_VM_NAME` - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # kvm-vm-local or kvm-vm-net - if [ "$KVM_VM_TYPE" == "kvm-vm-local" ]; then - # send powerdown - if [ -e "$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon" ]; then - echo "system_powerdown" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - fi - # vm is not running, we can skip waiting for shutdown - # wait until shutdown-delay, if VM is not down then stop hard - KVM_VM_SHUTDOWN_LOOP=0 - while ps ax | grep -i "macaddr=$KVM_VM_MAC_1" | grep kvm | grep -i screen | grep -v grep 1>/dev/null; do - sleep 1 - KVM_VM_SHUTDOWN_LOOP=$(( KVM_VM_SHUTDOWN_LOOP + 1 )) - if [ "$KVM_VM_SHUTDOWN_LOOP" == "$KVM_VM_SHUTDOWN_DELAY" ]; then - break - fi - # send powerdown again - echo "system_powerdown" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - done - VM_PID=`ps ax | grep -i "macaddr=$KVM_VM_MAC_1" | grep kvm | grep -i screen | grep -v grep | awk {' print $1 '}` - if [ "$VM_PID" != "" ]; then - openqrm_post_event 0 "restart_by_mac" 5 "openqrm-kvm-vm" "Force stopping KVM VM $KVM_VM_NAME $VM_PID." - kill $VM_PID - fi - # add disk disk parameter if disk param is not set to noop - if [ "$KVM_VM_DISK" != "noop" ]; then - echo "KVM_VM_DISK_1=\"$KVM_VM_DISK\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/disk1 - fi - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk1 - if [ "$KVM_VM_DISK_1" != "" ]; then - # lvol or blockfile ? - if echo $KVM_VM_DISK_1 | grep ^/dev 1>/dev/null; then - # aquire global lock for lvm operations - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock aquire lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD $LOCK_TIME "Restart-by-mac of VM $KVM_VM_NAME on volume $KVM_VM_DISK_1" - fi - fi - if [ ! -e "$KVM_VM_DISK_1" ]; then - # activate the lvol - kvm_refresh_lvm - lvchange -ay -y $KVM_VM_DISK_1 - if [ ! -e "$KVM_VM_DISK_1" ]; then - lvchange -ay -y $KVM_VM_DISK_1 - fi - fi - # activate the lvol - lvchange -ay -y $KVM_VM_DISK_1 - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - fi - fi - # stop the vm monitor - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC | awk {' print $1 '}` 2>/dev/null - - # start only if we have a root-disk - if [ "$KVM_VM_DISK_1" != "" ]; then - - if [ "$OPENQRM_PLUGIN_KVM_E2FSCK_AFTER_CLONE" == "true" ]; then - # filesystem resize e2fsck - FIRST_PARTITION=`kpartx -av $KVM_VM_DISK_1 | awk '{ print $3 }' | head -n1` - if [ "$?" != 0 ]; then - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm-vm" "Adding device maps for volume $KVM_VM_DISK_1 failed!" - return - fi - sleep 2 - # wait until the device link is created - DEVICE_MAPPER_TIMEOUT=30 - if [ "$FIRST_PARTITION" != "" ]; then - while (:); do - if [ -e "/dev/mapper/$FIRST_PARTITION" ]; then - break - fi - sleep 1 - DLT=$(( $DLT + 1 )) - if [ "$DLT" == $DEVICE_MAPPER_TIMEOUT ]; then - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm-vm" "Adding device maps for volume /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME timed out! Not resizsing!" - break - fi - done - FSCKERROR=$(e2fsck -fy /dev/mapper/$FIRST_PARTITION 2>&1) - if [ $? != 0 ] ; then - openqrm_post_event 0 "kvm_resize_fs" 5 "openqrm-kvm-vm" "e2fsck -fy /dev/mapper/$FIRST_PARTITION: $? $FSCKERROR" - fi - fi - kpartx -d $KVM_VM_DISK_1 - fi - - # :) start + boot local - CMD_ERR=`$OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "restart_by_mac" 2 "openqrm-kvm-vm" "Error restarting KVM VM $KVM_VM_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - # monitoring on the host or vm ? - if [ "$OPENQRM_PLUGIN_KVM_VM_MONITORING_ON_HOST" != "false" ]; then - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC | awk {' print $1 '}` 2>/dev/null - $RUNSCREEN -dmS $KVM_VM_MAC $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/openqrm-kvm-monitord $KVM_VM_MAC - fi - else - # start the vm monitord - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC | awk {' print $1 '}` 2>/dev/null - $RUNSCREEN -dmS $KVM_VM_MAC $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/openqrm-kvm-monitord $KVM_VM_MAC - fi - touch $OPENQRM_VM_DIR/$KVM_VM_NAME/autostart.$resource_id - openqrm_post_event 0 "restart_by_mac" 5 "openqrm-kvm-vm" "Restarted KVM VM $KVM_VM_NAME." - fi - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - reboot) - if [ ! -e "$OPENQRM_VM_DIR/$KVM_VM_NAME/net1" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "stop_by_mac" 2 "openqrm-kvm-vm" "Network configuration of KVM VM $KVM_VM_NAME does not exists!" - exit 1 - fi - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - if [ "$KVM_VM_MAC_1" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "restart_by_mac" 2 "openqrm-kvm-vm" "Could not find mac address of KVM VM $KVM_VM_NAME!" - exit 1 - fi - # get vm type - KVM_VM_TYPE=`get_vm_type $KVM_VM_NAME` - # kvm-vm-local or kvm-vm-net - if [ "$KVM_VM_TYPE" == "kvm-vm-local" ]; then - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # send powerdown - if [ -e "$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon" ]; then - echo "system_powerdown" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - fi - # wait until shutdown-delay, if VM is not down then stop hard - KVM_VM_SHUTDOWN_LOOP=0 - while ps ax | grep -i "macaddr=$KVM_VM_MAC_1" | grep kvm | grep -i screen | grep -v grep 1>/dev/null; do - sleep 1 - KVM_VM_SHUTDOWN_LOOP=$(( KVM_VM_SHUTDOWN_LOOP + 1 )) - if [ "$KVM_VM_SHUTDOWN_LOOP" == "$KVM_VM_SHUTDOWN_DELAY" ]; then - break - fi - # send powerdown again - echo "system_powerdown" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - done - VM_PID=`ps ax | grep -i "macaddr=$KVM_VM_MAC_1" | grep kvm | grep -i screen | grep -v grep | awk {' print $1 '}` - if [ "$VM_PID" != "" ]; then - openqrm_post_event 0 "reboot" 5 "openqrm-kvm-vm" "Force stopping KVM VM $KVM_VM_NAME! $VM_PID" - kill $VM_PID - fi - - # start only if we have a root-disk - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk1 - if [ "$KVM_VM_DISK_1" != "" ]; then - CMD_ERR=`$OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "reboot" 2 "openqrm-kvm-vm" "Error rebooting KVM VM $KVM_VM_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - # monitoring on the host or vm ? - if [ "$OPENQRM_PLUGIN_KVM_VM_MONITORING_ON_HOST" != "false" ]; then - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC_1 | awk {' print $1 '}` 2>/dev/null - $RUNSCREEN -dmS $KVM_VM_MAC_1 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/openqrm-kvm-monitord $KVM_VM_MAC_1 - fi - else - # restart the vm monitord - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC_1 | awk {' print $1 '}` 2>/dev/null - $RUNSCREEN -dmS $KVM_VM_MAC_1 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/openqrm-kvm-monitord $KVM_VM_MAC_1 - fi - touch $OPENQRM_VM_DIR/$KVM_VM_NAME/autostart.$resource_id - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - elif [ "$KVM_VM_TYPE" == "kvm-vm-net" ]; then - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - echo "system_reset" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - touch $OPENQRM_VM_DIR/$KVM_VM_NAME/autostart.$resource_id - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - fi - openqrm_post_event 0 "reboot" 5 "openqrm-kvm-vm" "Rebooted KVM VM $KVM_VM_NAME." - ;; - delete) - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - if [ -e "$OPENQRM_VM_DIR/$KVM_VM_NAME/net1" ]; then - # be sure it is stopped - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - if [ "$KVM_VM_MAC_1" != "" ]; then - # wait until shutdown-delay, if VM is not down then stop hard - KVM_VM_SHUTDOWN_LOOP=0 - while ps ax | grep -i "macaddr=$KVM_VM_MAC_1" | grep kvm | grep -i screen | grep -v grep 1>/dev/null; do - sleep 1 - KVM_VM_SHUTDOWN_LOOP=$(( KVM_VM_SHUTDOWN_LOOP + 1 )) - if [ "$KVM_VM_SHUTDOWN_LOOP" == "$KVM_VM_SHUTDOWN_DELAY" ]; then - break - fi - # send powerdown again - echo "system_powerdown" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - done - # still running, force stop - VM_PID=`ps ax | grep -i "macaddr=$KVM_VM_MAC_1" | grep kvm | grep -i screen | grep -v grep | awk {' print $1 '}` - if [ "$VM_PID" != "" ]; then - openqrm_post_event 0 "delete" 5 "openqrm-kvm-vm" "KVM VM $KVM_VM_NAME still running in delete! Stopping $VM_PID" - kill $VM_PID - fi - fi - fi - #echo "quit" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - sleep 2 - - rm -rf $OPENQRM_VM_DIR/$KVM_VM_NAME - rm -f $OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - # we have to wait here because when having a shared config dir - # nfs can still have files in use/lock - KVM_REMOVE_WAIT=0 - while (:); do - if [ -d "$OPENQRM_VM_DIR/$KVM_VM_NAME" ]; then - openqrm_post_event 0 "delete" 5 "openqrm-kvm-vm" "Delete KVM VM $KVM_VM_NAME failed, retrying." - else - openqrm_post_event 0 "delete" 5 "openqrm-kvm-vm" "Delete KVM VM $KVM_VM_NAME success." - break - fi - if [ "$KVM_REMOVE_WAIT" == "$KVM_REMOVE_MAX_WAIT" ]; then - openqrm_post_event 0 "delete" 3 "openqrm-kvm-vm" "Delete KVM VM $KVM_VM_NAME failed, giving up!" - break - fi - KVM_REMOVE_WAIT=$(( KVM_REMOVE_WAIT + 1 )) - rm -rf $OPENQRM_VM_DIR/$KVM_VM_NAME - sleep 1 - done - openqrm_post_event 0 "delete" 5 "openqrm-kvm-vm" "Deleted KVM VM $KVM_VM_NAME." - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - list) - ls $OPENQRM_VM_DIR/ - ;; - post_vm_list) - VM_LIST_TMP=$resource_id.vm_list - > $VM_LIST_TMP - if [ ! -d $OPENQRM_VM_DIR ]; then - mkdir -p $OPENQRM_VM_DIR - fi - # create processlist - ps ax > $resource_id.process_list - for kvmvm in `ls $OPENQRM_VM_DIR/`; do - if [ ! -f "$OPENQRM_VM_DIR/$kvmvm/cpus" ]; then - continue - fi - # get mac address - . $OPENQRM_VM_DIR/$kvmvm/cpus - . $OPENQRM_VM_DIR/$kvmvm/ram - . $OPENQRM_VM_DIR/$kvmvm/net1 - . $OPENQRM_VM_DIR/$kvmvm/net2 - . $OPENQRM_VM_DIR/$kvmvm/net3 - . $OPENQRM_VM_DIR/$kvmvm/net4 - . $OPENQRM_VM_DIR/$kvmvm/net5 - . $OPENQRM_VM_DIR/$kvmvm/vnc - . $OPENQRM_VM_DIR/$kvmvm/vncpassword - - # check if active - if grep -i "macaddr=$KVM_VM_MAC_1" $resource_id.process_list | grep -i screen 1>/dev/null; then - if [ -f "$OPENQRM_VM_DIR/$kvmvm/migration_in_progress" ]; then - # migration active ! - VM_ACTIVE=2 - else - VM_ACTIVE=1 - fi - else - VM_ACTIVE=0 - fi - echo "$VM_ACTIVE""@""$kvmvm""@""$KVM_VM_MAC_1""@""$KVM_VM_CPUS""@""$KVM_VM_RAM""@""$KVM_VM_VNC""@""$KVM_VM_VNCPASSWORD""@""$KVM_VM_MAC_2,$KVM_VM_MAC_3,$KVM_VM_MAC_4,$KVM_VM_MAC_5""@" >> $VM_LIST_TMP - done - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $VM_LIST_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?kvm_server_command=get_kvm_server; then - openqrm_post_event 0 "post_vm_list" 2 "openqrm-kvm-vm" "Could not post VM list to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $resource_id.process_list - rm -f $VM_LIST_TMP - rm -f $VM_LIST_TMP.post - ;; - post_vm_config) - if [ "$KVM_VM_NAME" == "" ]; then - kvm_usage - fi - VM_CONFIG_TMP=$resource_id.$KVM_VM_NAME.vm_config - . $OPENQRM_VM_DIR/$KVM_VM_NAME/cpus - . $OPENQRM_VM_DIR/$KVM_VM_NAME/ram - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk1 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk2 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk3 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk4 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom - . $OPENQRM_VM_DIR/$KVM_VM_NAME/vnc - . $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - if [ -f "$OPENQRM_VM_DIR/$KVM_VM_NAME/vncpassword" ]; then - . $OPENQRM_VM_DIR/$KVM_VM_NAME/vncpassword - fi - if [ -f "$OPENQRM_VM_DIR/$KVM_VM_NAME/vnckeymap" ]; then - . $OPENQRM_VM_DIR/$KVM_VM_NAME/vnckeymap - fi - # disk interface - if [ -f "$OPENQRM_VM_DIR/$KVM_VM_NAME/disk-interface" ]; then - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk-interface - else - KVM_VM_DISK_INTERFACE="ide" - fi - # CDROM - if [ -f "$OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom2" ]; then - . $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom2 - else - KVM_VM_CDROM2="" - fi - # get vm type - KVM_VM_TYPE=`get_vm_type $KVM_VM_NAME` - # made the boot device readable - KVM_VM_BOOT_STR="local" - KVM_VM_BOOT=`echo $KVM_VM_BOOT | awk {' print $2 '}` - case "$KVM_VM_BOOT" in - d*) - if echo $KVM_VM_CDROM | grep /dev/cdrom &>/dev/null; then - KVM_VM_BOOT_STR="cdrom" - else - KVM_VM_ISO=`echo $KVM_VM_CDROM | awk '{ print $2 }'` - KVM_VM_BOOT_STR="iso:$KVM_VM_ISO" - fi - ;; - c*) - KVM_VM_BOOT_STR="local" - ;; - n*) - KVM_VM_BOOT_STR="network" - ;; - esac - - echo "OPENQRM_KVM_VM_CPUS=\"$KVM_VM_CPUS\"" > $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_RAM=\"$KVM_VM_RAM\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_NET_1=\"$KVM_VM_NET_1\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_MAC_1=\"$KVM_VM_MAC_1\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_BRIDGE_1=\"$KVM_VM_MAC_BRIDGE_1\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_NIC_TYPE_1=\"$KVM_VM_NIC_TYPE_1\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_NET_2=\"$KVM_VM_NET_2\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_MAC_2=\"$KVM_VM_MAC_2\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_BRIDGE_2=\"$KVM_VM_MAC_BRIDGE_2\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_NIC_TYPE_2=\"$KVM_VM_NIC_TYPE_2\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_NET_3=\"$KVM_VM_NET_3\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_MAC_3=\"$KVM_VM_MAC_3\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_BRIDGE_3=\"$KVM_VM_MAC_BRIDGE_3\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_NIC_TYPE_3=\"$KVM_VM_NIC_TYPE_3\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_NET_4=\"$KVM_VM_NET_4\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_MAC_4=\"$KVM_VM_MAC_4\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_BRIDGE_4=\"$KVM_VM_MAC_BRIDGE_4\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_NIC_TYPE_4=\"$KVM_VM_NIC_TYPE_4\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_NET_5=\"$KVM_VM_NET_5\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_MAC_5=\"$KVM_VM_MAC_5\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_BRIDGE_5=\"$KVM_VM_MAC_BRIDGE_5\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_NIC_TYPE_5=\"$KVM_VM_NIC_TYPE_5\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_DISK_1=\"$KVM_VM_DISK_1\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_DISK_SIZE_1=\"$KVM_VM_DISK_SIZE_1\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_DISK_2=\"$KVM_VM_DISK_2\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_DISK_SIZE_2=\"$KVM_VM_DISK_SIZE_2\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_DISK_3=\"$KVM_VM_DISK_3\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_DISK_SIZE_3=\"$KVM_VM_DISK_SIZE_3\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_DISK_4=\"$KVM_VM_DISK_4\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_DISK_SIZE_4=\"$KVM_VM_DISK_SIZE_4\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_DISK_INTERFACE=\"$KVM_VM_DISK_INTERFACE\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_CDROM=\"$KVM_VM_CDROM\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_CDROM2=\"$KVM_VM_CDROM2\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_VNC=\"$KVM_VM_VNC\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_VNCPASSWORD=\"$KVM_VM_VNCPASSWORD\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_VNCKEYMAP=\"$KVM_VM_VNCKEYMAP\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_BOOT=\"$KVM_VM_BOOT_STR\"" >> $VM_CONFIG_TMP - echo "OPENQRM_KVM_VM_TYPE=\"$KVM_VM_TYPE\"" >> $VM_CONFIG_TMP - # and the host bridge config to avoid a second script run - echo -n "OPENQRM_KVM_BRIDGES=\"" >> $VM_CONFIG_TMP - for BRIDGE in `brctl show | tail -n+2 | awk '{ print $1 }'`; do - echo -n "$BRIDGE"":" >> $VM_CONFIG_TMP - done - if which ovs-vsctl 1>/dev/null; then - for OVS in `ovs-vsctl show | grep -w Bridge | awk '{ print $2 }' | sed -e 's/\"//g'`; do - echo -n "$OVS"":" >> $VM_CONFIG_TMP - done - - fi - echo -n "\"" >> $VM_CONFIG_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $VM_CONFIG_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?kvm_server_command=get_kvm_config; then - openqrm_post_event 0 "post_vm_config" 2 "openqrm-kvm-vm" "Could not post VM $KVM_VM_NAME config to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $VM_CONFIG_TMP - rm -f $VM_CONFIG_TMP.post - ;; - - post_bridge_config) - BRIDGE_CONFIG_TMP=$resource_id.bridge_config - echo -n "OPENQRM_KVM_BRIDGES=\"" > $BRIDGE_CONFIG_TMP - for BRIDGE in `brctl show | tail -n+2 | awk '{ print $1 }'`; do - echo -n "$BRIDGE"":" >> $BRIDGE_CONFIG_TMP - done - if which ovs-vsctl 1>/dev/null; then - for OVS in `ovs-vsctl show | grep -w Bridge | awk '{ print $2 }' | sed -e 's/\"//g'`; do - echo -n "$OVS"":" >> $BRIDGE_CONFIG_TMP - done - - fi - echo -n "\"" >> $BRIDGE_CONFIG_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $BRIDGE_CONFIG_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?kvm_server_command=get_bridge_config; then - openqrm_post_event 0 "post_bridge_config" 2 "openqrm-kvm-vm" "Could not post bridge config to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $BRIDGE_CONFIG_TMP - rm -f $BRIDGE_CONFIG_TMP.post - ;; - - - update_vm_cpus) - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_VM_CPUS" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - sed -i -e s"#KVM_VM_CPUS=.*#KVM_VM_CPUS=\"$KVM_VM_CPUS\"#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/cpus - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - - - update_vm_ram) - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_VM_RAM" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - sed -i -e s"#KVM_VM_RAM=.*#KVM_VM_RAM=\"$KVM_VM_RAM\"#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/ram - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - - - update_vm_vnc) - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_VM_VNCPASSWORD" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - sed -i -e s"#KVM_VM_VNCPASSWORD=.*#KVM_VM_VNCPASSWORD=\"$KVM_VM_VNCPASSWORD\"#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/vncpassword - # change it directly if the vm is running - echo "change vnc password $KVM_VM_VNCPASSWORD" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - - add_vm_nic) - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_VM_MAC" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_VM_COMPONENT_NUMBER" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - OPENQRM_APP_NIC=$(( $KVM_VM_COMPONENT_NUMBER - 1 )) - case "$KVM_VM_MAC_BRIDGE" in - 1) - KVM_BRIDGE_NAME=$OPENQRM_PLUGIN_KVM_BRIDGE_NET1 - ;; - 2) - KVM_BRIDGE_NAME=$OPENQRM_PLUGIN_KVM_BRIDGE_NET2 - ;; - 3) - KVM_BRIDGE_NAME=$OPENQRM_PLUGIN_KVM_BRIDGE_NET3 - ;; - 4) - KVM_BRIDGE_NAME=$OPENQRM_PLUGIN_KVM_BRIDGE_NET4 - ;; - 5) - KVM_BRIDGE_NAME=$OPENQRM_PLUGIN_KVM_BRIDGE_NET5 - ;; - esac - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - # network - case "$OPENQRM_PLUGIN_KVM_BRIDGE_TYPE" in - bridge) - # regular bridging - sed -i -e s"#KVM_VM_NET_$KVM_VM_COMPONENT_NUMBER=.*#KVM_VM_NET_$KVM_VM_COMPONENT_NUMBER=\"-net nic,vlan=$KVM_VM_COMPONENT_NUMBER,macaddr=$KVM_VM_MAC,model=$KVM_VM_NIC_TYPE -net tap,vlan=$KVM_VM_COMPONENT_NUMBER,script=$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifup-net$KVM_VM_MAC_BRIDGE,downscript=$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifdown-net$KVM_VM_MAC_BRIDGE\"#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/net""$KVM_VM_COMPONENT_NUMBER - ;; - openvswitch) - # ovs - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_BRIDGE_NAME/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#$OPENQRM_APP_NIC#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup""$KVM_VM_MAC_BRIDGE.$KVM_VM_COMPONENT_NUMBER - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_BRIDGE_NAME/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#$OPENQRM_APP_NIC#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-net""$KVM_VM_MAC_BRIDGE.$KVM_VM_COMPONENT_NUMBER - chmod +x $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm* - sed -i -e s"#KVM_VM_NET_$KVM_VM_COMPONENT_NUMBER=.*#KVM_VM_NET_$KVM_VM_COMPONENT_NUMBER=\"-net nic,vlan=$KVM_VM_COMPONENT_NUMBER,macaddr=$KVM_VM_MAC,model=$KVM_VM_NIC_TYPE -net tap,vlan=$KVM_VM_COMPONENT_NUMBER,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifup$KVM_VM_MAC_BRIDGE.$KVM_VM_COMPONENT_NUMBER,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-ovs-kvm-ifdown-net$KVM_VM_MAC_BRIDGE.$KVM_VM_COMPONENT_NUMBER\"#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/net""$KVM_VM_COMPONENT_NUMBER - ;; - vlanbridge) - # bridged vlans - # here we need to create a new ifup/down script with the right app_nic number in it - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_BRIDGE_NAME/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#$OPENQRM_APP_NIC#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net""$KVM_VM_MAC_BRIDGE.$KVM_VM_COMPONENT_NUMBER - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$KVM_BRIDGE_NAME/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#$OPENQRM_APP_NIC#g" > $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net""$KVM_VM_MAC_BRIDGE.$KVM_VM_COMPONENT_NUMBER - chmod +x $OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm* - sed -i -e s"#KVM_VM_NET_$KVM_VM_COMPONENT_NUMBER=.*#KVM_VM_NET_$KVM_VM_COMPONENT_NUMBER=\"-net nic,vlan=$KVM_VM_COMPONENT_NUMBER,macaddr=$KVM_VM_MAC,model=$KVM_VM_NIC_TYPE -net tap,vlan=$KVM_VM_COMPONENT_NUMBER,script=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifup-net$KVM_VM_MAC_BRIDGE.$KVM_VM_COMPONENT_NUMBER,downscript=$OPENQRM_VM_DIR/$KVM_VM_NAME/openqrm-vlan-kvm-ifdown-net$KVM_VM_MAC_BRIDGE.$KVM_VM_COMPONENT_NUMBER\"#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/net""$KVM_VM_COMPONENT_NUMBER - ;; - - esac - sed -i -e s"#KVM_VM_MAC_$KVM_VM_COMPONENT_NUMBER=.*#KVM_VM_MAC_$KVM_VM_COMPONENT_NUMBER=\"$KVM_VM_MAC\"#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/net""$KVM_VM_COMPONENT_NUMBER - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - remove_vm_nic) - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_VM_COMPONENT_NUMBER" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - sed -i -e s"#KVM_VM_NET_$KVM_VM_COMPONENT_NUMBER=.*#KVM_VM_NET_$KVM_VM_COMPONENT_NUMBER=\"\"#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/net""$KVM_VM_COMPONENT_NUMBER - sed -i -e s"#KVM_VM_MAC_$KVM_VM_COMPONENT_NUMBER=.*#KVM_VM_MAC_$KVM_VM_COMPONENT_NUMBER=\"\"#g" $OPENQRM_VM_DIR/$KVM_VM_NAME/net""$KVM_VM_COMPONENT_NUMBER - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - - setboot) - unset KVM_VM_NAME - if [ "$KVM_VM_MAC" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_VM_BOOT" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # this command is is running from the openQRM engine which does - # not know about the kvm-name - KVM_VM_NAME=`grep -rHi $KVM_VM_MAC $OPENQRM_VM_DIR/*/net1 2>/dev/null | grep KVM_VM_MAC | cut -d':' -f1 2>/dev/null` 2>/dev/null - KVM_VM_NAME=`dirname $KVM_VM_NAME` 2>/dev/null - KVM_VM_NAME=`basename $KVM_VM_NAME` 2>/dev/null - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_post_event 0 "setboot" 2 "openqrm-kvm-vm" "Could not find KVM VM $KVM_VM_MAC on host." - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - case "$KVM_VM_BOOT" in - local) - echo "KVM_VM_BOOT=\"-boot cn\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - echo "boot_set c" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - ;; - net) - echo "KVM_VM_BOOT=\"-boot n\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - echo "boot_set n" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - ;; - network) - echo "KVM_VM_BOOT=\"-boot n\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - echo "boot_set n" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - ;; - cdrom) - echo "KVM_VM_BOOT=\"-boot d\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - echo "KVM_VM_CDROM=\"-cdrom /dev/cdrom\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom - echo "boot_set d" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - ;; - iso) - echo "KVM_VM_BOOT=\"-boot d\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - echo "KVM_VM_CDROM=\"-cdrom $KVM_VM_BOOT_ISO\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom - echo "boot_set d" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - ;; - esac - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - - - setboot_by_name) - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_VM_BOOT" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - case "$KVM_VM_BOOT" in - local) - echo "KVM_VM_BOOT=\"-boot c\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - ;; - net) - echo "KVM_VM_BOOT=\"-boot n\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - ;; - network) - echo "KVM_VM_BOOT=\"-boot n\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - ;; - cdrom) - echo "KVM_VM_BOOT=\"-boot d\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - echo "KVM_VM_CDROM=\"-cdrom /dev/cdrom\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom - ;; - iso) - echo "KVM_VM_BOOT=\"-boot d\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/boot - echo "KVM_VM_CDROM=\"-cdrom $KVM_VM_BOOT_ISO\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/cdrom - ;; - esac - # no restart here, this is from the vm config - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - - - fence) - unset KVM_VM_NAME - if [ "$KVM_VM_MAC" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - # this command is is running from the openQRM engine which does - # not know about the kvm-name - KVM_VM_NAME=`grep -rHi $KVM_VM_MAC $OPENQRM_VM_DIR/*/net1 2>/dev/null | grep KVM_VM_MAC | cut -d':' -f1 2>/dev/null` 2>/dev/null - KVM_VM_NAME=`dirname $KVM_VM_NAME` 2>/dev/null - KVM_VM_NAME=`basename $KVM_VM_NAME` 2>/dev/null - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "fence" 2 "openqrm-kvm-vm" "Could not find KVM VM $KVM_VM_MAC on host." - exit 1 - fi - if [ ! -e "$OPENQRM_VM_DIR/$KVM_VM_NAME/net1" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "fence" 2 "openqrm-kvm-vm" "Network configuration of KVM VM $KVM_VM_NAME does not exists!" - exit 1 - fi - # refresh mac - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - if [ "$KVM_VM_MAC_1" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "fence" 2 "openqrm-kvm-vm" "Could not find mac address of KVM VM $KVM_VM_NAME!" - exit 1 - fi - if [ "$KVM_VM_MAC" != "$KVM_VM_MAC_1" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "fence" 2 "openqrm-kvm-vm" "Mac address mismatch on KVM VM $KVM_VM_NAME!" - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # stop it hard - VM_PID=`ps ax | grep -i "macaddr=$KVM_VM_MAC_1" | grep kvm | grep -i screen | grep -v grep | awk {' print $1 '}` - if [ "$VM_PID" != "" ]; then - kill $VM_PID - openqrm_post_event 0 "fence" 5 "openqrm-kvm-vm" "Fenced KVM VM $KVM_VM_MAC! $VM_PID" - fi - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - - - transfer_vm_config) - # this is running on the openQRM server to transfer a VM config from one host to another - if [ "$KVM_VM_NAME" == "" ] || [ "$KVM_MIGRATION_DESTINATION_HOST" == "" ] || [ "$KVM_MIGRATION_SOURCE_HOST" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_MIGRATION_DESTINATION_HOST" == "$KVM_MIGRATION_SOURCE_HOST" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/tmp/ - KVM_VM_TRANSFER_TMP_DIR=`mktemp -d $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/tmp/kvm-transfer-$KVM_VM_NAME.XXXXXX` - - CMD_ERR=`rsync -a -e "dbclient -K 10 -y -i $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/dropbear_rsa_host_key -p $OPENQRM_EXEC_PORT" $KVM_MIGRATION_SOURCE_HOST:$OPENQRM_VM_DIR/$KVM_VM_NAME $KVM_VM_TRANSFER_TMP_DIR/ 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "transfer_vm_config" 2 "openqrm-kvm-vm" "Error get KVM VM $KVM_VM_NAME from $KVM_MIGRATION_SOURCE_HOST! $CMD_ERR" - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/tmp/kvm-transfer-$KVM_VM_NAME.* - - echo "Failed to get the configuration for VM $KVM_VM_NAME from Host $KVM_MIGRATION_SOURCE_HOST" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/$KVM_VM_NAME.transfer_status_tmp - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/$KVM_VM_NAME.transfer_status_tmp - mv $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/$KVM_VM_NAME.transfer_status_tmp $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/$KVM_VM_NAME.transfer_status - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - CMD_ERR=`rsync -a -e "dbclient -K 10 -y -i $OPENQRM_SERVER_BASE_DIR/openqrm/etc/dropbear/dropbear_rsa_host_key -p $OPENQRM_EXEC_PORT" $KVM_VM_TRANSFER_TMP_DIR/$KVM_VM_NAME $KVM_MIGRATION_DESTINATION_HOST:$OPENQRM_VM_DIR/ 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "transfer_vm_config" 2 "openqrm-kvm-vm" "Error transfering KVM VM $KVM_VM_NAME to $KVM_MIGRATION_DESTINATION_HOST! $CMD_ERR" - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/tmp/kvm-transfer-$KVM_VM_NAME.* - - echo "Failed to transfer configuration for the VM $KVM_VM_NAME to Host $KVM_MIGRATION_DESTINATION_HOST" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/$KVM_VM_NAME.transfer_status_tmp - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/$KVM_VM_NAME.transfer_status_tmp - mv $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/$KVM_VM_NAME.transfer_status_tmp $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/$KVM_VM_NAME.transfer_status - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/tmp/kvm-transfer-$KVM_VM_NAME.* - echo "ok" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/$KVM_VM_NAME.transfer_status_tmp - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/$KVM_VM_NAME.transfer_status_tmp - mv $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/$KVM_VM_NAME.transfer_status_tmp $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/$KVM_VM_NAME.transfer_status - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - - - start_as_incoming) - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_MIGRATION_PORT" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ ! -e "$OPENQRM_VM_DIR/$KVM_VM_NAME/net1" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "start_as_incoming" 2 "openqrm-kvm-vm" "Network configuration of KVM VM $KVM_VM_NAME does not exists!" - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # make sure it is stopped before - if [ -e "$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon" ]; then - echo "quit" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - fi - # if we have a disk make sure it is activated - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk1 - if [ "$KVM_VM_DISK_1" != "" ]; then - # lvol or blockfile ? - if echo $KVM_VM_DISK_1 | grep ^/dev 1>/dev/null; then - # aquire global lock for lvm operations - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock aquire lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD $LOCK_TIME "Start_as_incoming of VM $KVM_VM_NAME on volume $KVM_VM_DISK_1" - fi - fi - if [ ! -e "$KVM_VM_DISK_1" ]; then - # activate the lvol - kvm_refresh_lvm - lvchange -ay -y $KVM_VM_DISK_1 - if [ ! -e "$KVM_VM_DISK_1" ]; then - lvchange -ay -y $KVM_VM_DISK_1 - fi - fi - lvchange -ay -y $KVM_VM_DISK_1 - # release global lock - if [ "$OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK" == "true" ]; then - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - openqrm_global_lock release lvm $KVM_OPENQRM_USERNAME $KVM_OPENQRM_PASSWORD - fi - fi - fi - fi - # before we start as incoming we have to adjust the vnc server ip in the vm config - . $OPENQRM_VM_DIR/$KVM_VM_NAME/vnc - VM_VNC_ID=`echo $KVM_VM_VNC | cut -d':' -f2` - if [ "$OPENQRM_PLUGIN_VM_VNC_LISTEN" == "all" ]; then - echo "KVM_VM_VNC=\"0.0.0.0:$VM_VNC_ID\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/vnc - else - echo "KVM_VM_VNC=\"$resource_ip:$VM_VNC_ID\"" > $OPENQRM_VM_DIR/$KVM_VM_NAME/vnc - fi - # and remove the source host autostart file - rm -f $OPENQRM_VM_DIR/$KVM_VM_NAME/autostart.* - # create long-term-action start event - openqrm_post_event 0 "$KVM_VM_NAME" 9 "kvm" "Started migration of KVM VM $KVM_VM_NAME" - #touch $OPENQRM_VM_DIR/$KVM_VM_NAME/migration_in_progress - rm -f $OPENQRM_VM_DIR/$KVM_VM_NAME/migration_in_progress - - # posting migration progress 0 to openQRM - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - # post 0% - KVM_VM_MIGRATION_PROGRESS=0 - echo "$KVM_VM_MIGRATION_PROGRESS" > $KVM_VM_NAME.vm_migration_progress - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $KVM_VM_NAME.vm_migration_progress` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?kvm_server_command=get_vm_migration; then - openqrm_post_event 0 "start_as_incoming" 2 "openqrm-kvm-vm" "Could not post KVM VM $KVM_VM_NAME migration progress the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $KVM_VM_NAME.vm_migration_progress - rm -f $KVM_VM_NAME.vm_migration_progress.post - fi - - # now start as incoming migration - CMD_ERR=`$OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm.incoming $KVM_MIGRATION_PORT 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "start_as_incoming" 2 "openqrm-kvm-vm" "Error starting KVM VM $KVM_VM_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - # restart the vm monitord - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - # monitoring on the host or vm ? - if [ "$OPENQRM_PLUGIN_KVM_VM_MONITORING_ON_HOST" != "false" ]; then - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC_1 | awk {' print $1 '}` 2>/dev/null - $RUNSCREEN -dmS $KVM_VM_MAC_1 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/openqrm-kvm-monitord $KVM_VM_MAC_1 - fi - touch $OPENQRM_VM_DIR/$KVM_VM_NAME/autostart.$resource_id - openqrm_post_event 0 "start_as_incoming" 5 "openqrm-kvm-vm" "Started KVM VM $KVM_VM_NAME as incoming migration." - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - - migrate) - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_MIGRATION_PORT" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_MIGRATION_DESTINATION_HOST" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ ! -e "$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon" ]; then - # end long term event - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "$KVM_VM_NAME" 10 "kvm" "Stopped migration of VM $KVM_VM_NAME" - openqrm_post_event 0 "migrate" 3 "openqrm-kvm-vm" "Migrating KVM VM $KVM_VM_NAME failed. VM is not running!" - rm -f $OPENQRM_VM_DIR/$KVM_VM_NAME/migration_in_progress - exit 1 - fi - # migrate runs after start_as_incoming so we delay the trigger for the migrate action a bit - sleep 10 - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - echo "migrate -d tcp:$KVM_MIGRATION_DESTINATION_HOST:$KVM_MIGRATION_PORT" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - # release the lock early - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - # start to monitor the migration, this stop the source vm when migration completed - $RUNSCREEN -dmS migration_monitor.$KVM_VM_NAME $0 monitor_migration -n $KVM_VM_NAME -j $KVM_MIGRATION_PORT -u $KVM_OPENQRM_USERNAME -p $KVM_OPENQRM_PASSWORD --openqrm-internal-cmd true - openqrm_post_event 0 "migrate" 5 "openqrm-kvm-vm" "Migrating KVM VM $KVM_VM_MAC to $KVM_MIGRATION_DESTINATION_HOST." - ;; - - - monitor_migration) - if [ "$KVM_VM_NAME" == "" ]; then - kvm_usage - fi - if [ "$KVM_MIGRATION_PORT" == "" ]; then - kvm_usage - fi - # no need to lock - # monitor migration and stop the vm on the source host after the transfer is complete - KVM_MIGRATION_LOG="/tmp/kvm-migration.$KVM_VM_NAME.log" - KVM_MIGRATION_LOOP=0 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - while (true); do - if ! echo "info migrate" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon > $KVM_MIGRATION_LOG; then - # socket is gone, migration finished - # posting migration success to openQRM - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - echo "success" > $KVM_VM_NAME.vm_migrated_successfully - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $KVM_VM_NAME.vm_migrated_successfully` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?kvm_server_command=get_vm_migration; then - openqrm_post_event 0 "migrate" 2 "openqrm-kvm-vm" "Could not post KVM VM $KVM_VM_NAME migration status the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $KVM_VM_NAME.vm_migrated_successfully - rm -f $KVM_VM_NAME.vm_migrated_successfully.post - # post 100% - KVM_VM_MIGRATION_PROGRESS=100 - echo "$KVM_VM_MIGRATION_PROGRESS" > $KVM_VM_NAME.vm_migration_progress - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $KVM_VM_NAME.vm_migration_progress` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?kvm_server_command=get_vm_migration; then - openqrm_post_event 0 "migrate" 2 "openqrm-kvm-vm" "Could not post KVM VM $KVM_VM_NAME migration progress the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $KVM_VM_NAME.vm_migration_progress - rm -f $KVM_VM_NAME.vm_migration_progress.post - fi - rm -f $OPENQRM_VM_DIR/$KVM_VM_NAME/migration_in_progress - # end long term event - openqrm_post_event 0 "$KVM_VM_NAME" 10 "kvm" "Finished migration of VM $KVM_VM_NAME" - break - - fi - - if grep completed $KVM_MIGRATION_LOG 1>/dev/null; then - # quit via the monitor socket does not run ifdown-net-script - VM_PID=`ps ax | grep $KVM_VM_MAC_1 | grep kvm | grep -v monitor_migration | grep -i screen | grep -v grep | awk {' print $1 '}` - if [ "$VM_PID" != "" ]; then - kill $VM_PID - fi - #echo "quit" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - # posting migration success to openQRM - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - echo "success" > $KVM_VM_NAME.vm_migrated_successfully - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $KVM_VM_NAME.vm_migrated_successfully` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?kvm_server_command=get_vm_migration; then - openqrm_post_event 0 "migrate" 2 "openqrm-kvm-vm" "Could not post KVM VM $KVM_VM_NAME migration status the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $KVM_VM_NAME.vm_migrated_successfully - rm -f $KVM_VM_NAME.vm_migrated_successfully.post - # post 100% - KVM_VM_MIGRATION_PROGRESS=100 - echo "$KVM_VM_MIGRATION_PROGRESS" > $KVM_VM_NAME.vm_migration_progress - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $KVM_VM_NAME.vm_migration_progress` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?kvm_server_command=get_vm_migration; then - openqrm_post_event 0 "migrate" 2 "openqrm-kvm-vm" "Could not post KVM VM $KVM_VM_NAME migration progress the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $KVM_VM_NAME.vm_migration_progress - rm -f $KVM_VM_NAME.vm_migration_progress.post - fi - rm -f $OPENQRM_VM_DIR/$KVM_VM_NAME/migration_in_progress - # end long term event - openqrm_post_event 0 "$KVM_VM_NAME" 10 "kvm" "Finished migration of VM $KVM_VM_NAME" - break - fi - if grep failed $KVM_MIGRATION_LOG 1>/dev/null; then - # end long term event - openqrm_post_event 0 "$KVM_VM_NAME" 10 "kvm" "Stopped migration of VM $KVM_VM_NAME" - # post error - openqrm_post_event 0 "migrate" 2 "openqrm-kvm-vm" "Migration of KVM VM $KVM_VM_NAME failed!" - rm -f $OPENQRM_VM_DIR/$KVM_VM_NAME/migration_in_progress - break - fi - KVM_MIGRATION_LOOP=$(( KVM_MIGRATION_LOOP + 1 )) - if [ "$KVM_MIGRATION_LOOP" == "$KVM_MIGRATION_MAX_WAIT" ]; then - # end long term event - openqrm_post_event 0 "$KVM_VM_NAME" 10 "kvm" "Stopped migration of VM $KVM_VM_NAME" - # post error - openqrm_post_event 0 "migrate" 2 "openqrm-kvm-vm" "Migration of KVM VM $KVM_VM_NAME timed out!" - rm -f $OPENQRM_VM_DIR/$KVM_VM_NAME/migration_in_progress - break - fi - - # posting migration progress to openQRM - this is for the progressbar - if [ "$KVM_OPENQRM_USERNAME" != "" ] && [ "$KVM_OPENQRM_PASSWORD" != "" ]; then - # do not post more than 99% - KVM_VM_MIGRATION_PROGRESS=$KVM_MIGRATION_LOOP - if [ $KVM_VM_MIGRATION_PROGRESS -ge 100 ]; then - KVM_VM_MIGRATION_PROGRESS=99 - fi - echo "$KVM_VM_MIGRATION_PROGRESS" > $KVM_VM_NAME.vm_migration_progress - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $KVM_VM_NAME.vm_migration_progress` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?kvm_server_command=get_vm_migration; then - openqrm_post_event 0 "migrate" 2 "openqrm-kvm-vm" "Could not post KVM VM $KVM_VM_NAME migration progress the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $KVM_VM_NAME.vm_migration_progress - rm -f $KVM_VM_NAME.vm_migration_progress.post - fi - - sleep 1 - done - - # here we remove the VM configuration from the source host - VM_PID=`ps ax | grep $KVM_VM_MAC_1 | grep kvm | grep -v monitor_migration | grep -i screen | grep -v grep | awk {' print $1 '}` - if [ "$VM_PID" != "" ]; then - openqrm_post_event 0 "migrate" 5 "openqrm-kvm-vm" "Force stopping KVM VM $KVM_VM_NAME on source Host!" - kill $VM_PID - fi - rm -f $OPENQRM_VM_DIR/$KVM_VM_NAME/* - rmdir $OPENQRM_VM_DIR/$KVM_VM_NAME - rm -f $KVM_MIGRATION_LOG - ;; - - # this is used to re-attach the virtual network devices to the configured vlans - reset_vlans_by_mac) - if [ "$KVM_VM_MAC" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - if [ "$KVM_VM_BOOT" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - fi - # find vm-name according its mac - KVM_VM_NAME=`grep -rHi $KVM_VM_MAC $OPENQRM_VM_DIR/*/net1 2>/dev/null | grep KVM_VM_MAC | cut -d':' -f1 2>/dev/null` 2>/dev/null - KVM_VM_NAME=`dirname $KVM_VM_NAME` 2>/dev/null - KVM_VM_NAME=`basename $KVM_VM_NAME` 2>/dev/null - if [ "$KVM_VM_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "reset_vlans_by_mac" 2 "openqrm-kvm-vm" "Could not find KVM VM $KVM_VM_MAC on host!" - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire kvm` - trap "openqrm_lock_queue release kvm $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - if [ "$KVM_VM_BOOT" == "stop" ]; then - # send powerdown - if [ -e "$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon" ]; then - echo "system_powerdown" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - fi - # vm is not running, we can skip waiting for shutdown - # wait until shutdown-delay, if VM is not down then stop hard - KVM_VM_SHUTDOWN_LOOP=0 - while ps ax | grep -i "macaddr=$KVM_VM_MAC_1" | grep kvm | grep -i screen | grep -v grep 1>/dev/null; do - sleep 1 - KVM_VM_SHUTDOWN_LOOP=$(( KVM_VM_SHUTDOWN_LOOP + 1 )) - if [ "$KVM_VM_SHUTDOWN_LOOP" == "$KVM_VM_SHUTDOWN_DELAY" ]; then - break - fi - # send powerdown again - echo "system_powerdown" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - done - fi - # stop hard, this will make the vm re-attach the network devices - VM_PID=`ps ax | grep $KVM_VM_MAC | grep kvm | grep -v reset_vlans_by_mac | grep -i screen | grep -v grep | awk {' print $1 '}` - if [ "$VM_PID" != "" ]; then - openqrm_post_event 0 "reset_vlans_by_mac" 3 "openqrm-kvm-vm" "KVM VM $KVM_VM_NAME still running in reset_vlans_by_mac! Stopping $VM_PID" - kill $VM_PID - fi - # echo "quit" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$KVM_VM_NAME.mon - rm -f $OPENQRM_VM_DIR/$KVM_VM_NAME/autostart.$resource_id - # delay startup to make sure the old taps are gone - sleep 4 - CMD_ERR=`$OPENQRM_VM_DIR/$KVM_VM_NAME/$KVM_VM_NAME.kvm 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "reset_vlans_by_mac" 3 "openqrm-kvm-vm" "Error starting KVM VM $KVM_VM_NAME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - touch $OPENQRM_VM_DIR/$KVM_VM_NAME/autostart.$resource_id - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - ;; - - - iso) - if [ "$KVM_HOST_PATH" == "" ]; then - kvm_usage - fi - # validate path - KVM_HOST_PATH=`echo "$KVM_HOST_PATH" | cut -d';' -f1` - KVM_HOST_PATH=`echo "$KVM_HOST_PATH" | cut -d'&' -f1` - KVM_HOST_PATH=`echo "$KVM_HOST_PATH" | cut -d' ' -f1` - KVM_HOST_PATH=`echo "$KVM_HOST_PATH" | cut -d'$' -f1` - if [ ! -d "$KVM_HOST_PATH" ]; then - openqrm_post_event 0 "iso" 2 "openqrm-kvm-vm" "No such directory $KVM_HOST_PATH !" - exit 1 - fi - # post dir list - PICK_ISO_CONFIG_TMP=$resource_id.pick_iso_config - echo "P@$KVM_HOST_PATH" > $PICK_ISO_CONFIG_TMP - for DIR_CONTENT in `ls -f $KVM_HOST_PATH`; do - if [ -d "$KVM_HOST_PATH"/"$DIR_CONTENT" ]; then - echo "D@$DIR_CONTENT" >> $PICK_ISO_CONFIG_TMP - elif [ -f "$KVM_HOST_PATH"/"$DIR_CONTENT" ]; then - echo "F@$DIR_CONTENT" >> $PICK_ISO_CONFIG_TMP - fi - done - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$KVM_OPENQRM_USERNAME --http-password=$KVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $PICK_ISO_CONFIG_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/kvm/kvm-action.php?kvm_server_command=get_pick_iso_config; then - openqrm_post_event 0 "iso" 2 "openqrm-kvm-vm" "Could not post pick_iso_config to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $PICK_ISO_CONFIG_TMP - rm -f $PICK_ISO_CONFIG_TMP.post - ;; - - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - kvm_usage - ;; - - -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/init.d/kvm b/openQRM-5.3.50-CE/src/plugins/kvm/etc/init.d/kvm deleted file mode 100644 index 05b0302..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/init.d/kvm +++ /dev/null @@ -1,218 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the Kvm-server hosts -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -# for including the package functions -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/include/openqrm-plugin-kvm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - OPENQRM_SERVER_IP=$resource_openqrmserver -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS -fi -OPENQRM_VM_DIR="/var/lib/kvm/openqrm/" -export OPENQRM_VM_DIR -OPENQRM_VM_MONITOR_DIR="/var/run/openqrm/kvm" -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET="wget -q --no-check-certificate" -else - WGET="wget -q" -fi -# which screen binary to use -if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" -else - RUNSCREEN=`which screen` -fi - -# do not start on the intitrd -if [ -f /etc/initrd-devices.conf ]; then - exit 0 -fi - - -function kvm_start() { - echo "Starting the openQRM kvm-plugin" - # preparing the nic-bios in case the openQRM server itself is the kvm-host - if [ ! -d /usr/share/kvm/ ]; then - mkdir -p /usr/share/kvm - fi - # be sure to have the tun device - if [ ! -e /dev/tun ]; then - mknod /dev/tun c 10 200 - fi - depmod -a - modprobe tun - # setting the kvm-ifup +kvm-ifdown script to the internal and external bridge - # internal - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET1/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifup-net1 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET1/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifdown-net1 - # external - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET2/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifup-net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET2/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifdown-net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET3/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifup-net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET3/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifdown-net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET4/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifup-net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET4/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifdown-net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET5/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifup-net5 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET5/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifdown-net5 - # ifup/down scripts for openvswitch - # internal - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET1/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#0#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifup-net1 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET1/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#0#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifdown-net1 - # external - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET2/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#1#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifup-net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET2/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#1#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifdown-net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET3/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#2#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifup-net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET3/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#2#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifdown-net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET4/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#3#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifup-net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET4/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#3#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifdown-net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET5/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#4#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifup-net5 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET5/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#4#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifdown-net5 - - # ifup/down scripts for bridged vlans - # internal - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET1/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#0#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifup-net1 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET1/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#0#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifdown-net1 - # external - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET2/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#1#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifup-net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET2/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#1#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifdown-net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET3/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#2#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifup-net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET3/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#2#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifdown-net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET4/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#3#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifup-net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET4/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#3#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifdown-net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET5/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#4#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifup-net5 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET5/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#4#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifdown-net5 - - chmod +x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/* - - # make sure the kvm modules are loaded - modprobe kvm - if grep flags.*vmx /proc/cpuinfo 1>/dev/null; then modprobe kvm-intel; fi - if grep flags.*svm /proc/cpuinfo 1>/dev/null; then modprobe kvm-amd; fi - - # start the vm status autostart - if [ -d "$OPENQRM_VM_DIR" ]; then - for VM_CONFIG in `find $OPENQRM_VM_DIR/* -name autostart.$resource_id 2>/dev/null`; do - VM_NAME=`dirname $VM_CONFIG` - VM_NAME=`basename $VM_NAME` - . $OPENQRM_VM_DIR/$VM_NAME/net1 - if ps ax | grep -i "$KVM_VM_MAC_1" | grep -v grep | grep -i screen 1>/dev/null; then - echo "- VM $VM_NAME is running already, not auto-starting it ..." - continue - fi - # ask openQRM what to do - if ! $WGET -O $OPENQRM_VM_DIR/$VM_NAME/resource-parameter.conf "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_mac=$KVM_VM_MAC_1"; then - echo "- Could not get parameters for VM $VM_NAME, not auto-starting it ..." - continue - fi - unset appliance_state - unset image_rootdevice - . $OPENQRM_VM_DIR/$VM_NAME/resource-parameter.conf - # is really active ? - if [ "$appliance_state" == "active" ] && [ "$image_rootdevice" != "ram" ]; then - echo "- Activating Rootdevice $image_rootdevice for VM $VM_NAME" - lvchange -ay -y $image_rootdevice - sleep 2 - # make sure the lvm device is active - if [ -e "$image_rootdevice" ]; then - echo "- auto-starting active VM $VM_NAME" - # make sure the rigth device is in the VM config - echo "KVM_VM_DISK_1=\"$image_rootdevice\"" > $OPENQRM_VM_DIR/$VM_NAME/disk1 - $OPENQRM_VM_DIR/$VM_NAME/$VM_NAME.kvm - sleep $OPENQRM_PLUGIN_VM_AUTOSTART_DELAY - else - echo "- Rootdevice $image_rootdevice for VM $VM_NAME not existing, not autostarting it ..." - continue - fi - else - # make sure the VM is not still attached to the disk - echo 'KVM_VM_DISK_1=""' > $OPENQRM_VM_DIR/$VM_NAME/disk1 - # start the kvm monitor - echo "- auto-starting idle VM $VM_NAME" - fi - # starting the monitor for active + idle - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC_1 | awk {' print $1 '}` 2>/dev/null - $RUNSCREEN -dmS $KVM_VM_MAC_1 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/openqrm-kvm-monitord $KVM_VM_MAC_1 - done - fi - -} - - -function kvm_stop() { - echo "Stopping the openQRM kvm-plugin" - # by default we do not stop the active VMs, otherwise openqrm-client restart would restart VMs -# if [ -d "$OPENQRM_VM_DIR" ]; then -# for VM_CONFIG in `find $OPENQRM_VM_DIR/* -name autostart.$resource_id 2>/dev/null`; do -# VM_NAME=`dirname $VM_CONFIG` -# VM_NAME=`basename $VM_NAME` -# if [ -e "$OPENQRM_VM_MONITOR_DIR/kvm.$VM_NAME.mon" ]; then -# echo "- Stopping VM $VM_NAME" -# echo "system_powerdown" | socat stdio unix:$OPENQRM_VM_MONITOR_DIR/kvm.$VM_NAME.mon -# fi -# done -# fi - - - - -} - - - - - -case "$1" in - start) - kvm_start - ;; - stop) - kvm_stop - ;; - restart) - kvm_stop - sleep 1 - kvm_start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 - -esac -exit $? - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/init.d/openqrm-plugin-kvm b/openQRM-5.3.50-CE/src/plugins/kvm/etc/init.d/openqrm-plugin-kvm deleted file mode 100644 index 2562222..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/init.d/openqrm-plugin-kvm +++ /dev/null @@ -1,271 +0,0 @@ -#!/bin/bash -# init script for the openQRM kvm-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/include/openqrm-plugin-kvm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf -openqrm_server_get_config -OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS -OPENQRM_VM_DIR="/var/lib/kvm/openqrm/" -export OPENQRM_VM_DIR -OPENQRM_VM_MONITOR_DIR="/var/run/openqrm/kvm" -export resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -export LANG=C -# define wget to use with https -if [ "$OPENQRM_WEB_PROTOCOL" == "https" ]; then - WGET="wget -q --no-check-certificate" -else - WGET="wget -q" -fi -# which screen binary to use -if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" -else - RUNSCREEN=`which screen` -fi - -LINE_IFS=' -' - -function openqrm_plugin_kvm_start() { - openqrm_plugin_kvm_stop 1>/dev/null 2>&1 - echo "Starting the openQRM kvm-plugin" - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/kvm/.running - # start the vm status autostart - if [ -d "$OPENQRM_VM_DIR" ]; then - for VM_CONFIG in `find $OPENQRM_VM_DIR/* -name autostart.0 2>/dev/null`; do - VM_NAME=`dirname $VM_CONFIG` - VM_NAME=`basename $VM_NAME` - . $OPENQRM_VM_DIR/$VM_NAME/net1 - if ps ax | grep -i "$KVM_VM_MAC_1" | grep -v grep | grep -i screen 1>/dev/null; then - echo "- VM $VM_NAME is running already, not auto-starting it ..." - continue - fi - # ask openQRM what to do - if ! $WGET -O $OPENQRM_VM_DIR/$VM_NAME/resource-parameter.conf "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_mac=$KVM_VM_MAC_1"; then - echo "- Could not get parameters for VM $VM_NAME, not auto-starting it ..." - continue - fi - unset appliance_state - unset image_rootdevice - . $OPENQRM_VM_DIR/$VM_NAME/resource-parameter.conf - # is really active ? - if [ "$appliance_state" == "active" ] && [ "$image_rootdevice" != "ram" ]; then - # make sure the lvm device is active - if [ "$image_type" == "kvm-lvm-deployment" ]; then - echo "- Activating LVM Rootdevice $image_rootdevice for VM $VM_NAME" - lvchange -ay -y $image_rootdevice - sleep 2 - fi - if [ "$image_type" == "kvm-lvm-deployment" ] || [ "$image_type" == "kvm-bf-deployment" ]; then - if [ ! -e "$image_rootdevice" ]; then - echo "- Rootdevice $image_rootdevice for VM $VM_NAME not existing, not autostarting it ..." - continue - fi - fi - - echo "- auto-starting active VM $VM_NAME" - # make sure the right device is in the VM config - echo "KVM_VM_DISK_1=\"$image_rootdevice\"" > $OPENQRM_VM_DIR/$VM_NAME/disk1 - $OPENQRM_VM_DIR/$VM_NAME/$VM_NAME.kvm - sleep $OPENQRM_PLUGIN_VM_AUTOSTART_DELAY - else - # make sure the VM is not still attached to the disk - echo 'KVM_VM_DISK_1=""' > $OPENQRM_VM_DIR/$VM_NAME/disk1 - # start the kvm monitor - echo "- auto-starting idle VM $VM_NAME" - fi - # starting the monitor for active + idle - kill `ps ax | grep openqrm-kvm-monitord | grep -v grep | grep -i $KVM_VM_MAC_1 | awk {' print $1 '}` 2>/dev/null - $RUNSCREEN -dmS $KVM_VM_MAC_1 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/sbin/openqrm-kvm-monitord $KVM_VM_MAC_1 - done - fi - -} - - -function openqrm_plugin_kvm_stop() { - echo "Stopping the openQRM kvm-plugin" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/kvm/.running -} - -function openqrm_plugin_kvm_uninstall() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "kvm: Please give a username to uninstall the plugin : " - read USERNAME - echo - echo -n "kvm: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Uninstalling the openQRM kvm-plugin" - openqrm_plugin_kvm_stop - - # trigger init action to eventually remove cloud products - if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/cloud ]; then - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$USERNAME --http-password=$PASSWORD "$OPENQRM_WEB_PROTOCOL://$resource_openqrmserver/openqrm/base/plugins/kvm/kvm-action.php?kvm_command=uninstall"; then - openqrm_post_event 0 "openqrm_plugin_kvm_start" 3 "openqrm-plugin-kvm" "Could not trigger database hook. Please manually remove any Kvm Cloud products!" - fi - fi - - openqrm_server_remove_deployment_type $USERNAME $PASSWORD kvm-lvm-deployment - openqrm_server_remove_deployment_type $USERNAME $PASSWORD kvm-bf-deployment - openqrm_server_remove_deployment_type $USERNAME $PASSWORD kvm-gluster-deployment - openqrm_server_remove_deployment_type $USERNAME $PASSWORD kvm-ceph-deployment - openqrm_server_remove_virtualization_type $USERNAME $PASSWORD kvm - openqrm_server_remove_virtualization_type $USERNAME $PASSWORD kvm-vm-local - openqrm_server_remove_virtualization_type $USERNAME $PASSWORD kvm-vm-net - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/kvm - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-kvm.tgz - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.kvm-lvm-deployment.php - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.kvm-bf-deployment.php - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.kvm-gluster-deployment.php - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.kvm-ceph-deployment.php - return 0 - -} - -function openqrm_plugin_kvm_init() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "kvm: Please give a username to init the plugin : " - read USERNAME - echo - echo -n "kvm: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Initializing the openQRM kvm-plugin" - openqrm_server_add_deployment_type $USERNAME $PASSWORD kvm-lvm-deployment kvm-lvm-deployment "LVM deployment for KVM" kvm "KVM LVM Storage" - openqrm_server_add_deployment_type $USERNAME $PASSWORD kvm-bf-deployment kvm-bf-deployment "Blockfile deployment for KVM" kvm "KVM Blockfile Storage" - openqrm_server_add_deployment_type $USERNAME $PASSWORD kvm-gluster-deployment kvm-gluster-deployment "Glusterfs deployment for KVM" kvm "KVM Gluster Storage" - openqrm_server_add_deployment_type $USERNAME $PASSWORD kvm-ceph-deployment kvm-ceph-deployment "Ceph deployment for KVM" kvm "KVM Ceph Storage" - openqrm_server_add_virtualization_type $USERNAME $PASSWORD kvm "KVM Host" - openqrm_server_add_virtualization_type $USERNAME $PASSWORD kvm-vm-local "KVM VM (localboot)" - openqrm_server_add_virtualization_type $USERNAME $PASSWORD kvm-vm-net "KVM VM (networkboot)" - - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/kvm - # link the boot-service - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/boot-service-kvm.tgz $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-kvm.tgz - # linking the image deployment parameters menu - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/image.kvm-lvm-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.kvm-lvm-deployment.php - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/image.kvm-bf-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.kvm-bf-deployment.php - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/image.kvm-gluster-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.kvm-gluster-deployment.php - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/image.kvm-ceph-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.kvm-ceph-deployment.php - # create storage dir for stat files - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/storage - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/storage - echo "Order deny,allow" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/storage/.htaccess - echo "Deny from all" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/storage/.htaccess - - # setting the kvm-ifup +kvm-ifdown script to the internal and external bridge - # internal - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET1/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifup-net1 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET1/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifdown-net1 - # external - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET2/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifup-net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET2/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifdown-net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET3/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifup-net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET3/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifdown-net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET4/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifup-net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET4/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifdown-net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET5/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifup-net5 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET5/g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-ifdown-net5 - - # ifup/down scripts for openvswitch - # internal - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET1/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#0#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifup-net1 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET1/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#0#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifdown-net1 - # external - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET2/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#1#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifup-net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET2/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#1#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifdown-net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET3/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#2#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifup-net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET3/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#2#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifdown-net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET4/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#3#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifup-net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET4/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#3#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifdown-net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET5/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#4#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifup-net5 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET5/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#4#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-ovs-kvm-ifdown-net5 - chmod +x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/* - - # ifup/down scripts for bridged vlans - # internal - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET1/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#0#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifup-net1 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET1/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#0#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifdown-net1 - # external - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET2/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#1#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifup-net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET2/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#1#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifdown-net2 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET3/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#2#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifup-net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET3/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#2#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifdown-net3 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET4/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#3#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifup-net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET4/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#3#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifdown-net4 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET5/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#4#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifup-net5 - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown | sed -e "s/@@OPENQRM_PLUGIN_KVM_BRIDGE@@/$OPENQRM_PLUGIN_KVM_BRIDGE_NET5/g" | sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | sed -e "s#@@OPENQRM_APP_NIC@@#4#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-vlan-kvm-ifdown-net5 - chmod +x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/* - - # create kvm-stat dir - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat - chmod -R 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat - echo "Order deny,allow" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/.htaccess - echo "Deny from all" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/web/kvm-stat/.htaccess - - # trigger init action to eventually add cloud products - if [ -e $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/cloud ]; then - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$USERNAME --http-password=$PASSWORD "$OPENQRM_WEB_PROTOCOL://$resource_openqrmserver/openqrm/base/plugins/kvm/kvm-action.php?kvm_command=init"; then - openqrm_post_event 0 "openqrm_plugin_kvm_start" 3 "openqrm-plugin-kvm" "Could not trigger database hook. Please manually add Kvm Cloud products!" - fi - fi - return 0 -} - -USER=$2 -PASS=$3 - -case "$1" in - start) - openqrm_plugin_kvm_start - ;; - stop) - openqrm_plugin_kvm_stop - ;; - restart) - openqrm_plugin_kvm_stop - sleep 1 - openqrm_plugin_kvm_start - ;; - init) - openqrm_plugin_kvm_init $USER $PASS - ;; - uninstall) - openqrm_plugin_kvm_uninstall $USER $PASS - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/init.d/openqrm-plugin-kvm.postinstall b/openQRM-5.3.50-CE/src/plugins/kvm/etc/init.d/openqrm-plugin-kvm.postinstall deleted file mode 100644 index c2af1c8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/init.d/openqrm-plugin-kvm.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-kvm postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/init.d/openqrm-plugin-kvm.preremove b/openQRM-5.3.50-CE/src/plugins/kvm/etc/init.d/openqrm-plugin-kvm.preremove deleted file mode 100644 index bfb1ad1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/init.d/openqrm-plugin-kvm.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-kvm preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-kvm stop \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/openqrm-plugin-kvm.conf b/openQRM-5.3.50-CE/src/plugins/kvm/etc/openqrm-plugin-kvm.conf deleted file mode 100644 index d4ca27a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/openqrm-plugin-kvm.conf +++ /dev/null @@ -1,119 +0,0 @@ -# this is the openQRM-plugin-kvm info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Integrates the KVM Virtualization Technology" -OPENQRM_PLUGIN_TYPE="virtualization" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="local-server, device-manager, network-manager" - -# required parameter to set the internal Kvm bridge -# by default openQRM will use the internal bridge eth0 for the virtual -# network-interface routed to the management/openQRM network on the Kvm vms. -OPENQRM_PLUGIN_KVM_BRIDGE_NET1=br0 - -# required parameter to set the external Kvm bridges -# by default openQRM will use external bridge eth0 for the virtual -# network-interface(s) routed to the public network (internet) on the Kvm vms -OPENQRM_PLUGIN_KVM_BRIDGE_NET2=br0 -OPENQRM_PLUGIN_KVM_BRIDGE_NET3=br0 -OPENQRM_PLUGIN_KVM_BRIDGE_NET4=br0 -OPENQRM_PLUGIN_KVM_BRIDGE_NET5=br0 - -# the default nic type for the additional network cards -# supported values are : rtl8139, e1000, virtio -OPENQRM_PLUGIN_KVM_PRIMARY_NIC_TYPE=e1000 -OPENQRM_PLUGIN_KVM_ADDITIONAL_NIC_TYPE=e1000 - -# using regular bridging or openvswitch for the virtual nics -# possible values are : -# bridge - for regular bridging via bridge-utils -# vlanbridge - for dynamically created VLAN bridges -# openvswitch - using openvswitch for bridging -# OPENQRM_PLUGIN_KVM_BRIDGE_TYPE="openvswitch" -# OPENQRM_PLUGIN_KVM_BRIDGE_TYPE="vlanbridge" -OPENQRM_PLUGIN_KVM_BRIDGE_TYPE="bridge" - -# for Blockfile-deployment only - location-name:directory for placing the blockfiles, space separated -OPENQRM_PLUGIN_KVM_FILE_BACKEND_DIRECTORIES="storage1:/var/lib/kvm/storage1 storage2:/var/lib/kvm/storage2" - -# for KVM LVM deployment: automatically resize the filesystem on LVM snapshots + clones (true/false, default true) -# setting this option to true requires that the lvm volumes are installed with the root-filesytem on the first partition (no separated /boot dir for linux) -OPENQRM_PLUGIN_KVM_RESIZE_SNAPSHOTS_FILESYSTEM="true" - -# KVM VMs by default are monitored through their Hosts. -# If openqrm-monitord is installed and running on the KVM VMs set the following paramter to false -OPENQRM_PLUGIN_KVM_VM_MONITORING_ON_HOST="true" - -# Glusterfs default KVM image type (e.g. raw, qcow2) -OPENQRM_PLUGIN_KVM_DEFAULT_IMAGE_TYPE="raw" - -# VM start delay when the Host is restarting in seconds. Adjust it to avoid overloading a Host when rebooting it -OPENQRM_PLUGIN_VM_AUTOSTART_DELAY=1 - -# defines on which network to listen for the VNC console access -# possible values: -# all - listen on all interfaces -# onlyinternal - only listen on the internal openQRM management network -OPENQRM_PLUGIN_VM_VNC_LISTEN="all" - -# defines the amount of swap space of the volume size in percent -# This option is for volume->clone which re-creates root + swap partition on the volume before resising -OPENQRM_PLUGIN_KVM_SWAP_PERCENT=5 - -# defines a local cache directory for caching the master images during clone actions -# please clean this directory in case of changes in the master images -OPENQRM_PLUGIN_KVM_LOCAL_IMAGE_CACHE="/var/cache/openqrm/kvm" - -# creates a global lock for all lvm operations if set to true -OPENQRM_PLUGIN_KVM_GLOBAL_LVM_LOCK=false - -# defines the Cloud action for creating a new volume. Can be snap or clone, default is clone -OPENQRM_PLUGIN_KVM_CLOUD_CREATE_VOLUME_ACTION=clone - -# run e2fsck after clone finished true/false -OPENQRM_PLUGIN_KVM_E2FSCK_AFTER_CLONE="true" - -# custom params for lvcreate eg. -i5 -OPENQRM_PLUGIN_KVM_LVCREATE_CUSTOM_PARAM="" - -# default vnc keymap for accessing the KVM VM console -OPENQRM_PLUGIN_KVM_DEFAULT_VNC_KEYMAP="en-us" - -# ceph image feature configuration for add/create/clone -OPENQRM_PLUGIN_KVM_CEPH_IMAGE_FEATURE="--image-feature layering" - -# If set the Management Network-card gets detached after the delay in seconds -# This is usefull for e.g. public openQRM Cloud where a permanrent connection to the openQRM Management network is not "wanted" -#OPENQRM_PLUGIN_VM_DETACH_MANAGEMENT_NIC=120 - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf" -# dirs which should be taken to the state backup -OPENQRM_PLUGIN_STATE_DIRS="/var/lib/kvm/openqrm/" diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-kvm-ifdown b/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-kvm-ifdown deleted file mode 100644 index 680e24d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-kvm-ifdown +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -ifconfig $1 down -exit 0 - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-kvm-ifup b/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-kvm-ifup deleted file mode 100644 index 0a08b42..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-kvm-ifup +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -export PATH=/usr/sbin:/usr/bin:/sbin:/bin -ifconfig $1 0.0.0.0 promisc up -brctl addif @@OPENQRM_PLUGIN_KVM_BRIDGE@@ $1 -sleep 2 - -# bandwidth monitor hook enabled ? -if [ -x "@@OPENQRM_SERVER_BASE_DIR@@/openqrm/plugins/bandwidth/sbin/kvm-bandwidth-monitor" ]; then - - RUNSCREEN=`which screen` - if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" - fi - - # find vm name - VM_BASE_DIR=$(pushd $(dirname $0) > /dev/null; echo $PWD; popd > /dev/null) - KVM_VM_NAME=`basename $VM_BASE_DIR` - - kill `ps ax | grep kvm-bandwidth-monitor | grep -v grep | grep -w $1 | awk {' print $1 '}` 2>/dev/null - $RUNSCREEN -dmS $1 @@OPENQRM_SERVER_BASE_DIR@@/openqrm/plugins/bandwidth/sbin/kvm-bandwidth-monitor $KVM_VM_NAME $1 -fi - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-kvm-vm b/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-kvm-vm deleted file mode 100644 index 1b60b5c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-kvm-vm +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -KVM=`which kvm 2>/dev/null` -if [ "$KVM" == "" ]; then - KVM=`which qemu-kvm 2>/dev/null` - if [ "$KVM" == "" ]; then - # maybe it is centos and not in the path - if [ -x /usr/libexec/qemu-kvm ]; then - KVM=/usr/libexec/qemu-kvm - else - echo "ERROR: kvm ist not installed on this system !" | logger - exit 1 - fi - fi -fi -# which screen binary to use -if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" -else - RUNSCREEN=`which screen` -fi -mkdir -p /var/run/openqrm/kvm - -MOUSE="--usbdevice tablet" - -# source the component config files -VM_CONF_DIR=`dirname $0` -VM_CONF_DIR=`cd $VM_CONF_DIR && pwd && cd - 1>/dev/null` -VM_NAME=`basename $VM_CONF_DIR` -. $VM_CONF_DIR/cpus -. $VM_CONF_DIR/ram -. $VM_CONF_DIR/disk1 -. $VM_CONF_DIR/disk2 -. $VM_CONF_DIR/disk3 -. $VM_CONF_DIR/disk4 -. $VM_CONF_DIR/cdrom -. $VM_CONF_DIR/net1 -. $VM_CONF_DIR/net2 -. $VM_CONF_DIR/net3 -. $VM_CONF_DIR/net4 -. $VM_CONF_DIR/net5 -. $VM_CONF_DIR/vnc -. $VM_CONF_DIR/boot -if [ -f "$VM_CONF_DIR/vncpassword" ]; then - . $VM_CONF_DIR/vncpassword -fi -if [ -f "$VM_CONF_DIR/vnckeymap" ]; then - . $VM_CONF_DIR/vnckeymap - if [ "$KVM_VM_VNCKEYMAP" != "" ] && [ "$KVM_VM_VNCKEYMAP" != "none" ]; then - VNCKEYMAP_PARAMETER="-k $KVM_VM_VNCKEYMAP" - fi -fi -# CDROM -if [ -f "$VM_CONF_DIR/cdrom2" ]; then - . $VM_CONF_DIR/cdrom2 -else - KVM_VM_CDROM2="" -fi -# disk interface -if [ -f "$VM_CONF_DIR/disk-interface" ]; then - . $VM_CONF_DIR/disk-interface -else - KVM_VM_DISK_INTERFACE="ide" -fi -case "$KVM_VM_DISK_INTERFACE" in - ide) - KVM_VM_DISK="$KVM_VM_DISK_1 $KVM_VM_DISK_2 $KVM_VM_DISK_3 $KVM_VM_DISK_4" - ;; - - virtio) - if [ "$KVM_VM_DISK_1" != "" ]; then - if echo $KVM_VM_DISK_1 | grep ^/dev/ 1>/dev/null; then - KVM_VM_DISK=" -drive file=$KVM_VM_DISK_1,index=0,if=virtio,format=raw,cache=writeback" - elif echo $KVM_VM_DISK_1 | grep ^rbd: 1>/dev/null; then - KVM_VM_DISK=" -drive file=$KVM_VM_DISK_1,index=0,if=virtio,format=raw,cache=writeback" - else - KVM_VM_DISK=" -drive file=$KVM_VM_DISK_1,index=0,if=virtio,cache=writeback" - fi - fi - if [ "$KVM_VM_DISK_2" != "" ]; then - if echo $KVM_VM_DISK_2 | grep ^/dev/ 1>/dev/null; then - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_2,index=1,if=virtio,format=raw,cache=writeback" - elif echo $KVM_VM_DISK_2 | grep ^rbd: 1>/dev/null; then - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_2,index=1,if=virtio,format=raw,cache=writeback" - else - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_2,index=1,if=virtio,cache=writeback" - fi - fi - if [ "$KVM_VM_DISK_3" != "" ]; then - if echo $KVM_VM_DISK_3 | grep ^/dev/ 1>/dev/null; then - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_3,index=2,if=virtio,format=raw,cache=writeback" - elif echo $KVM_VM_DISK_3 | grep ^rbd: 1>/dev/null; then - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_3,index=2,if=virtio,format=raw,cache=writeback" - else - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_3,index=2,if=virtio,cache=writeback" - fi - fi - if [ "$KVM_VM_DISK_4" != "" ]; then - if echo $KVM_VM_DISK_4 | grep ^/dev/ 1>/dev/null; then - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_4,index=3,if=virtio,format=raw,cache=writeback" - elif echo $KVM_VM_DISK_4 | grep ^rbd 1>/dev/null; then - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_4,index=3,if=virtio,format=raw,cache=writeback" - else - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_4,index=3,if=virtio,cache=writeback" - fi - fi - ;; -esac -KVM_VM_NET="$KVM_VM_NET_1 $KVM_VM_NET_2 $KVM_VM_NET_3 $KVM_VM_NET_4 $KVM_VM_NET_5" - -echo "KVM vm $VM_NAME starting up ..." | logger -$RUNSCREEN -dmS $KVM_VM_MAC_1 bash -c "$KVM $KVM_VM_DISK $KVM_VM_CDROM -m $KVM_VM_RAM -smp $KVM_VM_CPUS $KVM_VM_BOOT $KVM_VM_NET -vnc $KVM_VM_VNC $VNCKEYMAP_PARAMETER -balloon virtio -monitor unix:/var/run/openqrm/kvm/kvm.$VM_NAME.mon,server,nowait -vga std $KVM_VM_CDROM2 $MOUSE > /var/run/openqrm/kvm/kvm.$VM_NAME.log 2>&1" -# if there is an error starting the kvm VM the error message is now in the log file -# we cat it here to provide the real error message for the ui event -# we need to wait a bit for the kvm error message -sleep 5 -CMD_ERR=`cat /var/run/openqrm/kvm/kvm.$VM_NAME.log` -if [ "$CMD_ERR" != "" ]; then - cat /var/run/openqrm/kvm/kvm.$VM_NAME.log - exit 1 -fi -rm -f /var/run/openqrm/kvm/kvm.$VM_NAME.log - -# set vnc password -if [ "$KVM_VM_VNCPASSWORD" ]; then - while ! echo "change vnc password $KVM_VM_VNCPASSWORD" | socat stdio unix:/var/run/openqrm/kvm/kvm.$VM_NAME.mon; do - sleep 1 - LOOP=$(( LOOP + 1 )) - if [ "$LOOP" == 10 ]; then - break - fi - done -fi - -# detach-mgmt-nic if set in kvm plugin config -if [ "$KVM_VM_DETACH_MANAGEMENT_NIC" != "" ]; then - echo "sleep $KVM_VM_DETACH_MANAGEMENT_NIC" > $VM_CONF_DIR/detach_mgmt_nic - echo "echo "host_net_remove 1 tap.0" | socat stdio unix:/var/run/openqrm/kvm/kvm.$VM_NAME.mon" >> $VM_CONF_DIR/detach_mgmt_nic - echo "rm -f $VM_CONF_DIR/detach_mgmt_nic" >> $VM_CONF_DIR/detach_mgmt_nic - chmod +x $VM_CONF_DIR/detach_mgmt_nic - $RUNSCREEN -dmS $KVM_VM_MAC_1.0 $VM_CONF_DIR/detach_mgmt_nic -fi -exit 0 diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-kvm-vm.incoming b/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-kvm-vm.incoming deleted file mode 100644 index 1cb2811..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-kvm-vm.incoming +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -KVM_MIGRATION_PORT=$1 -if [ "$KVM_MIGRATION_PORT" == "" ]; then - echo "Usage : $0 " - exit 1 -fi - -KVM=`which kvm 2>/dev/null` -if [ "$KVM" == "" ]; then - KVM=`which qemu-kvm 2>/dev/null` - if [ "$KVM" == "" ]; then - # maybe it is centos and not in the path - if [ -x /usr/libexec/qemu-kvm ]; then - KVM=/usr/libexec/qemu-kvm - else - echo "ERROR: kvm ist not installed on this system !" | logger - exit 1 - fi - fi -fi -# which screen binary to use -if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" -else - RUNSCREEN=`which screen` -fi -mkdir -p /var/run/openqrm/kvm - -MOUSE="--usbdevice tablet" - -# source the component config files -VM_CONF_DIR=`dirname $0` -VM_CONF_DIR=`cd $VM_CONF_DIR && pwd && cd - 1>/dev/null` -VM_NAME=`basename $VM_CONF_DIR` -. $VM_CONF_DIR/cpus -. $VM_CONF_DIR/ram -. $VM_CONF_DIR/disk1 -. $VM_CONF_DIR/disk2 -. $VM_CONF_DIR/disk3 -. $VM_CONF_DIR/disk4 -. $VM_CONF_DIR/cdrom -. $VM_CONF_DIR/net1 -. $VM_CONF_DIR/net2 -. $VM_CONF_DIR/net3 -. $VM_CONF_DIR/net4 -. $VM_CONF_DIR/net5 -. $VM_CONF_DIR/vnc -. $VM_CONF_DIR/boot -if [ -f "$VM_CONF_DIR/vncpassword" ]; then - . $VM_CONF_DIR/vncpassword -fi -if [ -f "$VM_CONF_DIR/vnckeymap" ]; then - . $VM_CONF_DIR/vnckeymap - if [ "$KVM_VM_VNCKEYMAP" != "" ] && [ "$KVM_VM_VNCKEYMAP" != "none" ]; then - VNCKEYMAP_PARAMETER="-k $KVM_VM_VNCKEYMAP" - fi -fi -# CDROM -if [ -f "$VM_CONF_DIR/cdrom2" ]; then - . $VM_CONF_DIR/cdrom2 -else - KVM_VM_CDROM2="" -fi -# disk interface -if [ -f "$VM_CONF_DIR/disk-interface" ]; then - . $VM_CONF_DIR/disk-interface -else - KVM_VM_DISK_INTERFACE="ide" -fi -case "$KVM_VM_DISK_INTERFACE" in - ide) - KVM_VM_DISK="$KVM_VM_DISK_1 $KVM_VM_DISK_2 $KVM_VM_DISK_3 $KVM_VM_DISK_4" - ;; - - virtio) - if [ "$KVM_VM_DISK_1" != "" ]; then - if echo $KVM_VM_DISK_1 | grep ^/dev/ 1>/dev/null; then - KVM_VM_DISK=" -drive file=$KVM_VM_DISK_1,index=0,if=virtio,format=raw,cache=writeback" - elif echo $KVM_VM_DISK_1 | grep ^rbd: 1>/dev/null; then - KVM_VM_DISK=" -drive file=$KVM_VM_DISK_1,index=0,if=virtio,format=raw,cache=writeback" - else - KVM_VM_DISK=" -drive file=$KVM_VM_DISK_1,index=0,if=virtio,cache=writeback" - fi - fi - if [ "$KVM_VM_DISK_2" != "" ]; then - if echo $KVM_VM_DISK_2 | grep ^/dev/ 1>/dev/null; then - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_2,index=1,if=virtio,format=raw,cache=writeback" - elif echo $KVM_VM_DISK_2 | grep ^rbd: 1>/dev/null; then - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_2,index=1,if=virtio,format=raw,cache=writeback" - else - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_2,index=1,if=virtio,cache=writeback" - fi - fi - if [ "$KVM_VM_DISK_3" != "" ]; then - if echo $KVM_VM_DISK_3 | grep ^/dev/ 1>/dev/null; then - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_3,index=2,if=virtio,format=raw,cache=writeback" - elif echo $KVM_VM_DISK_3 | grep ^rbd: 1>/dev/null; then - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_3,index=2,if=virtio,format=raw,cache=writeback" - else - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_3,index=2,if=virtio,cache=writeback" - fi - fi - if [ "$KVM_VM_DISK_4" != "" ]; then - if echo $KVM_VM_DISK_4 | grep ^/dev/ 1>/dev/null; then - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_4,index=3,if=virtio,format=raw,cache=writeback" - elif echo $KVM_VM_DISK_4 | grep ^rbd 1>/dev/null; then - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_4,index=3,if=virtio,format=raw,cache=writeback" - else - KVM_VM_DISK="$KVM_VM_DISK -drive file=$KVM_VM_DISK_4,index=3,if=virtio,cache=writeback" - fi - fi - ;; -esac -KVM_VM_NET="$KVM_VM_NET_1 $KVM_VM_NET_2 $KVM_VM_NET_3 $KVM_VM_NET_4 $KVM_VM_NET_5" - -echo "KVM vm $VM_NAME starting up as incoming on port $KVM_MIGRATION_PORT ..." | logger -$RUNSCREEN -dmS $KVM_VM_MAC_1 bash -c "$KVM $KVM_VM_DISK $KVM_VM_CDROM -m $KVM_VM_RAM -smp $KVM_VM_CPUS $KVM_VM_BOOT $KVM_VM_NET -vnc $KVM_VM_VNC $VNCKEYMAP_PARAMETER -balloon virtio -monitor unix:/var/run/openqrm/kvm/kvm.$VM_NAME.mon,server,nowait -incoming tcp:0:$KVM_MIGRATION_PORT -vga std $KVM_VM_CDROM2 $MOUSE > /var/run/openqrm/kvm/kvm.$VM_NAME.log 2>&1" -# if there is an error starting the kvm VM the error message is now in the log file -# we cat it here to provide the real error message for the ui event -# we need to wait a bit for the kvm error message -sleep 5 -CMD_ERR=`cat /var/run/openqrm/kvm/kvm.$VM_NAME.log` -if [ "$CMD_ERR" != "" ]; then - cat /var/run/openqrm/kvm/kvm.$VM_NAME.log - exit 1 -fi -rm -f /var/run/openqrm/kvm/kvm.$VM_NAME.log - -# set vnc password -if [ "$KVM_VM_VNCPASSWORD" ]; then - while ! echo "change vnc password $KVM_VM_VNCPASSWORD" | socat stdio unix:/var/run/openqrm/kvm/kvm.$VM_NAME.mon; do - sleep 1 - LOOP=$(( LOOP + 1 )) - if [ "$LOOP" == 10 ]; then - break - fi - done -fi - -# detach-mgmt-nic if set in kvm plugin config -if [ "$KVM_VM_DETACH_MANAGEMENT_NIC" != "" ]; then - echo "sleep $KVM_VM_DETACH_MANAGEMENT_NIC" > $VM_CONF_DIR/detach_mgmt_nic - echo "echo "host_net_remove 1 tap.0" | socat stdio unix:/var/run/openqrm/kvm/kvm.$VM_NAME.mon" >> $VM_CONF_DIR/detach_mgmt_nic - echo "rm -f $VM_CONF_DIR/detach_mgmt_nic" >> $VM_CONF_DIR/detach_mgmt_nic - chmod +x $VM_CONF_DIR/detach_mgmt_nic - $RUNSCREEN -dmS $KVM_VM_MAC_1.0 $VM_CONF_DIR/detach_mgmt_nic -fi - -while (true); do - echo "info status" | socat stdio unix:/var/run/openqrm/kvm/kvm.$VM_NAME.mon > $VM_CONF_DIR/starting_as_incoming - if grep status $VM_CONF_DIR/starting_as_incoming | grep running 1>/dev/null; then - echo "NOTICE: KVM VM $VM_NAME successfully started as incoming migration!" | logger - rm -f $VM_CONF_DIR/starting_as_incoming - rm -f $VM_CONF_DIR/migration_in_progress - exit 0 - fi - if grep -i error $VM_CONF_DIR/starting_as_incoming 1>/dev/null; then - echo "ERROR: KVM VM $VM_NAME failed to un-block!" | logger - echo "ERROR: KVM VM $VM_NAME failed to un-block!" - rm -f $VM_CONF_DIR/starting_as_incoming - rm -f $VM_CONF_DIR/migration_in_progress - exit 1 - fi - - LOOP1=$(( LOOP1 + 1 )) - if [ "$LOOP1" == 1800 ]; then - echo "ERROR: KVM VM $VM_NAME failed to start as incoming migration!" | logger - echo "ERROR: KVM VM $VM_NAME failed to start as incoming migration!" - exit 1 - fi - sleep 1 -done - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown b/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown deleted file mode 100644 index decc9ac..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifdown +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the Kvm-server hosts -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_BASE_DIR=@@OPENQRM_SERVER_BASE_DIR@@ -export OPENVSWITCH=@@OPENQRM_PLUGIN_KVM_BRIDGE@@ -export PATH=/usr/sbin:/usr/bin:/sbin:/bin - -# remove the tap dev -ifconfig $1 0.0.0.0 down -ovs-vsctl del-port ${OPENVSWITCH} $1 - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup b/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup deleted file mode 100644 index 177f3dd..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-ovs-kvm-ifup +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the Kvm-server hosts -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_BASE_DIR=@@OPENQRM_SERVER_BASE_DIR@@ -export OPENVSWITCH=@@OPENQRM_PLUGIN_KVM_BRIDGE@@ -export APP_NIC=@@OPENQRM_APP_NIC@@ -export PATH=/usr/sbin:/usr/bin:/sbin:/bin - -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/include/openqrm-plugin-kvm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - resource_id=0 - openqrm_server_get_config - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL -fi -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET="wget -q --no-check-certificate" -else - WGET="wget -q" -fi - -# find out the name -VM_BASE_DIR=$(pushd $(dirname $0) > /dev/null; echo $PWD; popd > /dev/null) -VM_NAME=`basename $VM_BASE_DIR` -# get the net config of the vm -. $VM_BASE_DIR/net1 - -# get vms resource parameters -if ! $WGET -q -t 1 -T 4 -O $VM_BASE_DIR/openqrm-resource.conf "$openqrm_web_protocol://${resource_openqrmserver}/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_mac=$KVM_VM_MAC_1"; then - echo "ERROR: Could not refresh VMs resource-parameters!" | logger -else - . $VM_BASE_DIR/openqrm-resource.conf -fi -# get ip config -eval $appliance_capabilities -if [ "$IPT" != "" ]; then - IP_TOKEN=`echo $IPT | cut -d'=' -f1` - echo "- getting network configuration for token $IP_TOKEN nic $APP_NIC" | logger - if ! $WGET -O $VM_BASE_DIR/openqrm-network.$APP_NIC.conf "$openqrm_web_protocol://${resource_openqrmserver}/openqrm/boot-service/ip-mgmt-appliance-config.php?ip_mgmt_command=get_config&appliance_id=$appliance_id&ip_mgmt_nic_id=$APP_NIC&ip_mgmt_token=$IP_TOKEN"; then - echo "ERROR: Could not get ip-configuration from openQRM-server at ${resource_openqrmserver}!" - exit -1 - fi - . $VM_BASE_DIR/openqrm-network.$APP_NIC.conf -else - echo "NOTICE: No ip-configuration for VM available. Continuing..." | logger -fi - -# now attach the tap device to the bridge -ifconfig $1 0.0.0.0 up -if [ "$VLAN_ID" != "" ]; then - VLAN_TAG_PARAMETER="tag=$VLAN_ID" -fi -# make sure it is not setup already -ovs-vsctl del-port ${OPENVSWITCH} $1 2>/dev/null -# attach tap -ovs-vsctl add-port ${OPENVSWITCH} $1 $VLAN_TAG_PARAMETER - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown b/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown deleted file mode 100644 index 691f59a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifdown +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash -# this is the ifup/ifdown kvm script to attach the vm nics to the bridge -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_BASE_DIR=@@OPENQRM_SERVER_BASE_DIR@@ -export APP_NIC=@@OPENQRM_APP_NIC@@ -export PATH=/usr/sbin:/usr/bin:/sbin:/bin - -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/include/openqrm-plugin-kvm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - resource_id=0 - openqrm_server_get_config - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL -fi -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET="wget -q --no-check-certificate" -else - WGET="wget -q" -fi - -# find out the name -VM_BASE_DIR=$(pushd $(dirname $0) > /dev/null; echo $PWD; popd > /dev/null) -VM_NAME=`basename $VM_BASE_DIR` -# get the net config of the vm -. $VM_BASE_DIR/net1 - - -if [ ! -f "$VM_BASE_DIR/openqrm-resource.conf" ]; then - # get vms resource parameters - if ! $WGET -q -t 1 -T 4 -O $VM_BASE_DIR/openqrm-resource.conf "$openqrm_web_protocol://${resource_openqrmserver}/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_mac=$KVM_VM_MAC_1"; then - echo "ERROR: Could not refresh VMs resource-parameters!" | logger - exit -1 - fi -fi -. $VM_BASE_DIR/openqrm-resource.conf - -# get ip config -eval $appliance_capabilities -if [ "$IPT" != "" ]; then - IP_TOKEN=`echo $IPT | cut -d'=' -f1` - if [ ! -f "$VM_BASE_DIR/openqrm-network.$APP_NIC.conf" ]; then - echo "- getting network configuration for token $IP_TOKEN nic $APP_NIC" | logger - if ! $WGET -O $VM_BASE_DIR/openqrm-network.$APP_NIC.conf "$openqrm_web_protocol://${resource_openqrmserver}/openqrm/boot-service/ip-mgmt-appliance-config.php?ip_mgmt_command=get_config&appliance_id=$appliance_id&ip_mgmt_nic_id=$APP_NIC&ip_mgmt_token=$IP_TOKEN"; then - echo "ERROR: Could not get ip-configuration from openQRM-server at ${resource_openqrmserver}!" | logger - exit -1 - fi - else - echo "- using exiting network configuration for token $IP_TOKEN nic $APP_NIC" | logger - fi - . $VM_BASE_DIR/openqrm-network.$APP_NIC.conf -else - echo "NOTICE: No ip-configuration for VM available. Continuing with regular bridging ..." | logger -fi - - -if [ "$VLAN_ID" != "" ]; then - - echo "NOTICE: if-down - got ip-configuration for VM -> $APP_NIC nic to $VLAN_ID ..." | logger - # find out which interface to use according to which bridge is used - # get the brigdge, get the phys ethx interface from the bridge - PHYS_MAC=`brctl showmacs @@OPENQRM_PLUGIN_KVM_BRIDGE@@ | grep yes | awk '{ print $2 }' | head -n1` - if [ "$PHYS_MAC" == "" ]; then - echo "ERROR: Could not find the mac address of the phys. interface of @@OPENQRM_PLUGIN_KVM_BRIDGE@@!" | logger - exit -1 - fi - echo "NOTICE: Found phys. interface mac adress $PHYS_MAC belongs to @@OPENQRM_PLUGIN_KVM_BRIDGE@@!" | logger - PHYS_NIC=`ip a s | grep -A1 ^[0-9] | grep -v lo | grep -i -B1 $PHYS_MAC | grep ^[0-9] | head -n1 | awk {' print $2 '} | cut -d':' -f1` - if [ "$PHYS_NIC" == "" ]; then - echo "ERROR: Could not find the phys. interface of @@OPENQRM_PLUGIN_KVM_BRIDGE@@!" | logger - exit -1 - fi - - # remove the tap from the bridge - brctl delif brvlan$VLAN_ID $1 - - if brctl show | grep -A1 brvlan$VLAN_ID | grep -A1 $PHYS_NIC.$VLAN_ID | grep tap &>/dev/null; then - echo "NOTICE: Not removing brvlan$VLAN_ID because it is still in use ..." | logger - else - echo "NOTICE: removing $PHYS_NIC.$VLAN_ID from brvlan$VLAN_ID" | logger - brctl delif brvlan$VLAN_ID $PHYS_NIC.$VLAN_ID - echo "NOTICE: removing brvlan$VLAN_ID" | logger - ifconfig brvlan$VLAN_ID down - brctl delbr brvlan$VLAN_ID - echo "NOTICE: removing $PHYS_NIC.$VLAN_ID" | logger - vconfig rem $PHYS_NIC.$VLAN_ID - fi -fi - -# remove the tap dev -ifconfig $1 0.0.0.0 down -sleep 2 - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup b/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup deleted file mode 100644 index 2f78cb3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/etc/templates/openqrm-vlan-kvm-ifup +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# this is the ifup/ifdown kvm script to attach the vm nics to the bridge -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_BASE_DIR=@@OPENQRM_SERVER_BASE_DIR@@ -export APP_NIC=@@OPENQRM_APP_NIC@@ -export PATH=/usr/sbin:/usr/bin:/sbin:/bin - -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/include/openqrm-plugin-kvm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - resource_id=0 - openqrm_server_get_config - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL -fi -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET="wget -q --no-check-certificate" -else - WGET="wget -q" -fi - -# find out the name -VM_BASE_DIR=$(pushd $(dirname $0) > /dev/null; echo $PWD; popd > /dev/null) -VM_NAME=`basename $VM_BASE_DIR` -# get the net config of the vm -. $VM_BASE_DIR/net1 - -# get vms resource parameters -if ! $WGET -q -t 1 -T 4 -O $VM_BASE_DIR/openqrm-resource.conf "$openqrm_web_protocol://${resource_openqrmserver}/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_mac=$KVM_VM_MAC_1"; then - echo "ERROR: Could not refresh VMs resource-parameters!" | logger -else - . $VM_BASE_DIR/openqrm-resource.conf -fi -# get ip config -eval $appliance_capabilities -if [ "$IPT" != "" ]; then - IP_TOKEN=`echo $IPT | cut -d'=' -f1` - echo "- getting network configuration for token $IP_TOKEN nic $APP_NIC" | logger - if ! $WGET -O $VM_BASE_DIR/openqrm-network.$APP_NIC.conf "$openqrm_web_protocol://${resource_openqrmserver}/openqrm/boot-service/ip-mgmt-appliance-config.php?ip_mgmt_command=get_config&appliance_id=$appliance_id&ip_mgmt_nic_id=$APP_NIC&ip_mgmt_token=$IP_TOKEN"; then - echo "ERROR: Could not get ip-configuration from openQRM-server at ${resource_openqrmserver}!" | logger - exit -1 - fi - . $VM_BASE_DIR/openqrm-network.$APP_NIC.conf -else - echo "NOTICE: No ip-configuration for VM available. Continuing with regular bridging ..." | logger -fi - -if [ "$VLAN_ID" == "" ]; then - ifconfig $1 0.0.0.0 promisc up - brctl addif @@OPENQRM_PLUGIN_KVM_BRIDGE@@ $1 - sleep 2 -else - echo "NOTICE: Got ip-configuration for VM -> $APP_NIC nic to $VLAN_ID ..." | logger - # find out which interface to use according to which bridge is used - # get the brigdge, get the phys ethx interface from the bridge - PHYS_MAC=`brctl showmacs @@OPENQRM_PLUGIN_KVM_BRIDGE@@ | grep yes | awk '{ print $2 }' | head -n1` - if [ "$PHYS_MAC" == "" ]; then - echo "ERROR: Could not find the mac address of the phys. interface of @@OPENQRM_PLUGIN_KVM_BRIDGE@@!" | logger - exit -1 - fi - echo "NOTICE: Found phys. interface mac adress $PHYS_MAC belongs to @@OPENQRM_PLUGIN_KVM_BRIDGE@@!" | logger - PHYS_NIC=`ip a s | grep -A1 ^[0-9] | grep -v lo | grep -i -B1 $PHYS_MAC | grep ^[0-9] | head -n1 | awk {' print $2 '} | cut -d':' -f1` - if [ "$PHYS_NIC" == "" ]; then - echo "ERROR: Could not find the phys. interface of @@OPENQRM_PLUGIN_KVM_BRIDGE@@!" | logger - exit -1 - fi - - # add vlan dev - if ! ifconfig $PHYS_NIC.$VLAN_ID &>/dev/null; then - echo "NOTICE: adding vlan dev $VLAN_ID on $PHYS_NIC" | logger - vconfig add $PHYS_NIC $VLAN_ID 1>/dev/null - ifconfig $PHYS_NIC.$VLAN_ID up - else - echo "NOTICE: vlan dev $VLAN_ID on $PHYS_NIC already exists. Not re-creating it ..." | logger - fi - - # add vlan bridge - if ! ifconfig brvlan$VLAN_ID &>/dev/null; then - echo "NOTICE: adding bridge brvlan$VLAN_ID" | logger - brctl addbr brvlan$VLAN_ID - # add vlan interface to bridge - echo "NOTICE: adding eth0.$VLAN_ID to brvlan$VLAN_ID" | logger - brctl addif brvlan$VLAN_ID $PHYS_NIC.$VLAN_ID - # enable stp - brctl stp brvlan$VLAN_ID on - # bring up the bridge - ifconfig brvlan$VLAN_ID up - else - echo "NOTICE: bridge brvlan$VLAN_ID already exists. Not re-creating it ..." | logger - fi - - # add vms tap to vlan bridge - echo "NOTICE: adding VMs $1 to brvlan$VLAN_ID - $PHYS_NIC.$VLAN_ID" | logger - ifconfig $1 0.0.0.0 promisc up - brctl addif brvlan$VLAN_ID $1 - sleep 2 - - -fi - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/include/openqrm-plugin-kvm-functions b/openQRM-5.3.50-CE/src/plugins/kvm/include/openqrm-plugin-kvm-functions deleted file mode 100644 index 6780eaf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/include/openqrm-plugin-kvm-functions +++ /dev/null @@ -1,565 +0,0 @@ -#!/bin/bash -# this is the functions file for the kvm-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - - -# some definitions -DEFAULT_IMAGE_SIZE=5000 -LV_SIZE_DEFAULT=5000 -DEVICE_MAPPER_TIMEOUT=120 - -################ common kvm functions - -# logs for kvm -function kvm_log() { - local COMPONENT=$1 - shift - local MESSAGE=$@ - logger -i -t "kvm plug-in" "$COMPONENT : $MESSAGE" -} - - -# deps function -function check_kvm_deps() { - - # check and fullfill dependencies - # screen - if ! openqrm_full_fill_os_dependency screen screen; then - return 1 - fi - if [ -x /usr/bin/screen.real ]; then - export RUNSCREEN="/usr/bin/screen.real" - else - export RUNSCREEN=`which screen` - fi - # wget - if ! openqrm_full_fill_os_dependency wget wget; then - return 1 - fi - # procmail for lockfile - if ! openqrm_full_fill_os_dependency lockfile procmail; then - return 1 - fi - # socat - if ! openqrm_full_fill_os_dependency socat socat; then - return 1 - fi - # rsync - if ! openqrm_full_fill_os_dependency rsync rsync; then - return 1 - fi - # resize2fs - if ! openqrm_full_fill_os_dependency resize2fs e2fsprogs; then - return 1 - fi - # kpartx - if ! openqrm_full_fill_os_dependency kpartx kpartx; then - return 1 - fi - # parted - if ! openqrm_full_fill_os_dependency parted parted; then - return 1 - fi - # lvm2 - if ! openqrm_full_fill_os_dependency lvs lvm2; then - return 1 - fi - # bridge-utils - if ! openqrm_full_fill_os_dependency brctl bridge-utils; then - return 1 - fi - - # different package names for different distros - if [ -f /etc/debian_version ]; then - if ! openqrm_full_fill_os_dependency vconfig vlan; then - return 1 - fi - if ! openqrm_install_os_dependency ntfsprogs; then - if ! openqrm_full_fill_os_dependency ntfsresize ntfs-3g; then - return 1 - fi - fi - # nfs-common - if ! openqrm_full_fill_os_dependency mount.nfs nfs-common; then - return 1 - fi - # qemu-kvm - if ! openqrm_full_fill_os_dependency kvm qemu-kvm; then - return 1 - fi - elif [ -f /etc/redhat-release ]; then - if ! openqrm_full_fill_os_dependency vconfig vconfig; then - return 1 - fi - if ! openqrm_full_fill_os_dependency ntfsresize ntfsprogs; then - return 1 - fi - # nfs-utils - if ! openqrm_full_fill_os_dependency mount.nfs nfs-utils; then - return 1 - fi - # qemu-kvm - if ! openqrm_full_fill_os_dependency ksmtuned qemu-kvm; then - return 1 - fi - - elif [ -f /etc/SuSE-release ]; then - if ! openqrm_full_fill_os_dependency vconfig vlan; then - return 1 - fi - if ! openqrm_full_fill_os_dependency ntfsresize ntfsprogs; then - return 1 - fi - # nfs-utils - if ! openqrm_full_fill_os_dependency mount.nfs nfs-client; then - return 1 - fi - # qemu-kvm - if ! openqrm_full_fill_os_dependency qemu-kvm kvm; then - return 1 - fi - fi - return 0 - - -} - - - - -################ kvm functions - -# refresh lvm metadata -function kvm_refresh_lvm() { - openqrm_post_event 0 "refresh_lvm" 5 "openqrm-kvm" "Refreshing lvm meta-data!" - for LVMCMD in pvscan vgscan lvscan; do - CMD_ERR=`$LVMCMD 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "refresh_lvm" 3 "openqrm-kvm" "Error refreshing lvm meta-data! $CMD_ERR" - return 1 - fi - done - -# CMD_ERR=`vgchange --refresh 2>&1` -# if [ "$?" != 0 ]; then -# CMD_ERR=`openqrm_format_error_msg $CMD_ERR` -# openqrm_post_event 0 "refresh_lvm" 3 "openqrm-kvm" "Error refreshing VG lvm meta-data! $CMD_ERR" -# return 1 -# fi - return 0 -} - - - -function kvm_get_backend_dir() { - local STORAGE_LOC_NAME=$1 - for FILE_BACKEND in `echo $OPENQRM_PLUGIN_KVM_FILE_BACKEND_DIRECTORIES`; do - BACKEND_LOCATION_NAME=`echo $FILE_BACKEND | cut -d':' -f1` - if [ "$BACKEND_LOCATION_NAME" == "$STORAGE_LOC_NAME" ]; then - FILE_BACKEND_DIR=`echo $FILE_BACKEND | cut -d':' -f2` - break - fi - done - if [ "$FILE_BACKEND_DIR" == "" ]; then - echo $STORAGE_LOC_NAME - else - echo $FILE_BACKEND_DIR - fi -} - - -function kvm_get_gluster_backend_dir() { - local STORAGE_LOC_NAME=$1 - GET_BACKEND_TMP=`mktemp /tmp/kvm-gluster.XXXXXX` - gluster volume info $STORAGE_LOC_NAME > $GET_BACKEND_TMP - for GLUSTER_BRICK in `grep -w "^Brick[0-9].*" $GET_BACKEND_TMP | awk '{ print $2 }'`; do - FILE_BACKEND_DIR=`echo $GLUSTER_BRICK | cut -d':' -f2` - break - done - rm -f $GET_BACKEND_TMP - echo $FILE_BACKEND_DIR -} - - -function kvm_get_image_type() { - local FILE_PATH=$1 - local FILE_TYPE="" - FILE_TYPE_STR=`file $FILE_PATH` - if echo $FILE_TYPE_STR | grep -w "backing file" 1>/dev/null; then - # snap - FILE_TYPE="snapshot" - elif echo $FILE_TYPE_STR | grep -w "User-mode" 1>/dev/null; then - # cow - FILE_TYPE="cow" - elif echo $FILE_TYPE_STR | grep -w "QEMU QCOW Image (v1)" 1>/dev/null; then - # qcow - FILE_TYPE="qcow" - elif echo $FILE_TYPE_STR | grep -w "QEMU QCOW Image (v2)" 1>/dev/null; then - # qcow2 - FILE_TYPE="qcow2" - else - FILE_TYPE="raw" - fi - echo $FILE_TYPE -} - - -function kvm_trigger_gluster_replication() { - local VLOC=$1 - local VNAME=$2 - V_VOL_TMP_DIR="/tmp/kvm-gluster.$VNAME" - mkdir -p $V_VOL_TMP_DIR - - CMD_ERR=`mount -t nfs $resource_ip:$VLOC $V_VOL_TMP_DIR 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "snap" 3 "openqrm-kvm" "Error mounting $resource_ip:$VLOC/$VNAME. Not replicating! $CMD_ERR" - rmdir $V_VOL_TMP_DIR - return 1 - fi - touch $V_VOL_TMP_DIR/$VNAME - umount $V_VOL_TMP_DIR - rmdir $V_VOL_TMP_DIR - return 0 -} - - - -function kvm_clean_dev_maps() { - local INAME=$1 - local VOLG=$2 - kpartx -d /dev/mapper/$VOLG-$INAME - for DM in `ls /dev/mapper/$VOLG-$INAME""p*`; do - dmsetup remove $DM - done -} - - - -function kvm_resize_fs() { - - local LVM_VOLUME=$1 - local LVM_VOLUME_NAME=`basename $LVM_VOLUME` - local LVM_VOLUME_GROUP=`dirname $LVM_VOLUME` - local LVM_VOLUME_GROUP=`basename $LVM_VOLUME_GROUP` - - if [ "$LVM_VOLUME" == "" ]; then - return - fi - # find the rootfs and resize it - kvm_clean_dev_maps $LVM_VOLUME_NAME $LVM_VOLUME_GROUP - PARTITION_START=`parted -s /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME unit B print | grep -A1 ^Number | grep ^" 1" | awk '{ print $2 }'` - if [ "$?" != 0 ]; then - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Error finding partition start for volume $LVM_VOLUME_NAME! skipping resize!" - return 1 - fi - # get the full disk size - ROOTFS_SIZE=`parted -s /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME unit MB print | head -n3 | grep -w ^Disk | grep MB | awk {' print $3 '} | sed -e "s/MB//g" | cut -d',' -f1 | cut -d'.' -f1` - if [ "$ROOTFS_SIZE" == "" ]; then - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Error finding disk size for volume $LVM_VOLUME_NAME! $ROOTFS_SIZE skipping resize!" - return 1 - fi - ORIGIN_DISK_SIZE=$ROOTFS_SIZE - - # check if we can find swap space - CREATE_SWAPSPACE=false - SWAPSPACE_SIZE=`parted -s /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME unit MB print 2>/dev/null | grep "linux-swap" | head -n1 | awk {' print $4 '} | sed -e "s/MB//g" | cut -d',' -f1 | cut -d'.' -f1` - if [ "$SWAPSPACE_SIZE" != "" ]; then - CREATE_SWAPSPACE=true - ROOTFS_SIZE=$(( $ROOTFS_SIZE - $SWAPSPACE_SIZE )) - else - SWAPSPACE_SIZE=`parted -s /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME unit MB print 2>/dev/null | grep "type=82" | head -n1 | awk {' print $4 '} | sed -e "s/MB//g" | cut -d',' -f1 | cut -d'.' -f1` - if [ "$SWAPSPACE_SIZE" != "" ]; then - CREATE_SWAPSPACE=true - ROOTFS_SIZE=$(( $ROOTFS_SIZE - $SWAPSPACE_SIZE )) - fi - fi - # remove partitions - for N in `seq 1 5`; do - parted -s /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME rm $N - done - - # recreate root-partition - parted -s /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME mkpart primary $PARTITION_START $ROOTFS_SIZE""MB - # make it bootable - parted -s /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME set 1 boot on - - if [ "$CREATE_SWAPSPACE" == "true" ]; then - # recreate swap - parted -s /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME mkpart primary linux-swap $ROOTFS_SIZE""MB $ORIGIN_DISK_SIZE""MB - - # creating partitions on the lvol triggers device-mapper to create p1 + p2 devices in /dev/mapper/vg-lv - # this results in the device being already busy when trying to re-create the dev-maps - kvm_clean_dev_maps $LVM_VOLUME_NAME $LVM_VOLUME_GROUP - SWAP_PARTITION=`kpartx -av /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME | awk '{ print $3 }' | tail -n1` - if [ "$?" == 0 ] && [ "$SWAP_PARTITION" != "" ]; then - # wait until the device link is created - while (:); do - if [ -e "/dev/mapper/$SWAP_PARTITION" ]; then - break - fi - sleep 1 - DL=$(( $DL + 1 )) - if [ "$DL" == $DEVICE_MAPPER_TIMEOUT ]; then - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Adding device maps for volume /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME! Not creating swap /dev/mapper/$SWAP_PARTITION - $CMD_ERR!" - break - fi - done - CMD_ERR=`mkswap /dev/mapper/$SWAP_PARTITION 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Could not create swap space /dev/mapper/$SWAP_PARTITION on /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME - $CMD_ERR!" - fi - kpartx -dv /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME - fi - sync - sleep 2 - kvm_clean_dev_maps $LVM_VOLUME_NAME $LVM_VOLUME_GROUP - sleep 2 - fi - - # filesystem resize - FIRST_PARTITION=`kpartx -av /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME | awk '{ print $3 }' | head -n1` - if [ "$?" != 0 ]; then - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Adding device maps for volume /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME failed!" - return - fi - sleep 2 - # wait until the device link is created - if [ "$FIRST_PARTITION" != "" ]; then - while (:); do - if [ -e "/dev/mapper/$FIRST_PARTITION" ]; then - break - fi - sleep 1 - DLT=$(( $DLT + 1 )) - if [ "$DLT" == $DEVICE_MAPPER_TIMEOUT ]; then - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Adding device maps for volume /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME timed out! Not resizsing!" - break - fi - done - fi - - if [ "$FIRST_PARTITION" != "" ] && [ -e /dev/mapper/$FIRST_PARTITION ]; then - PARTITION_TYPE=`fdisk -l /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME | grep ^/dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME | head -n1 | sed -e "s#\*##g" | awk '{ print $5 }'` - case "$PARTITION_TYPE" in - 83) - e2fsck -y /dev/mapper/$FIRST_PARTITION - openqrm_post_event 0 "/dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME" 5 "openqrm-kvm" "Resizing Linux filesystem of volume /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME." - CMD_ERR=`resize2fs -f -p /dev/mapper/$FIRST_PARTITION 2>&1` - if [ "$?" == 0 ]; then - openqrm_post_event 0 "kvm_resize_fs" 5 "openqrm-kvm" "Successfully resized volume /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME." - else - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Errors during resizing volume /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME! $CMD_ERR" - if ! e2fsck -fy /dev/mapper/$FIRST_PARTITION; then - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Errors on filesystem of volume /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME!" - fi - fi - e2fsck -fy /dev/mapper/$FIRST_PARTITION - ;; - 7) - VOLUME_SIZE_PARAM="-s $ROOTFS_SIZE""M" - openqrm_post_event 0 "/dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME" 5 "openqrm-kvm" "Resizing Windows filesystem of volume /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME to $ROOTFS_SIZE MB." - CMD_ERR=`ntfsresize $VOLUME_SIZE_PARAM -b -f /dev/mapper/$FIRST_PARTITION 2>&1` - if [ "$?" == 0 ]; then - openqrm_post_event 0 "kvm_resize_fs" 5 "openqrm-kvm" "Successfully resized volume /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME to $ROOTFS_SIZE MB." - else - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Errors during resizing volume /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME! $CMD_ERR" - fi - ;; - *) - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Could not find out filesystem type of volume /dev/$LVM_VOLUME_GROUP/$LVM_VOLUME_NAME. Not resizing." - ;; - esac - fi - sync - sleep 2 - kvm_clean_dev_maps $LVM_VOLUME_NAME $LVM_VOLUME_GROUP - return 0 - -} - - - -function kvm_resize_ceph_fs() { - - local CEPH_VOLUME=$1 - local CEPH_POOL=$2 - - if [ "$CEPH_VOLUME" == "" ] || [ "$CEPH_POOL" == "" ]; then - return - fi - - # map - rbd unmap $CEPH_VOLUME --pool $CEPH_POOL 2>&1 - CMD_ERR=`rbd map $CEPH_VOLUME --pool $CEPH_POOL 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "resize" 3 "openqrm-kvm" "Error mapping rbd volume rbd:$CEPH_POOL/$CEPH_VOLUME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - else - CEPHDEV=$CMD_ERR - fi - - - openqrm_post_event 0 "resize" 2 "openqrm-kvm" "Found dev $CEPHDEV for rbd volume rbd:$CEPH_POOL/$CEPH_VOLUME!" - - # find the rootfs and resize it - PARTITION_START=`parted -s $CEPHDEV unit B print | grep -A1 ^Number | grep ^" 1" | awk '{ print $2 }'` - if [ "$?" != 0 ]; then - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Error finding partition start for volume $CEPHDEV! skipping resize!" - return 1 - fi - # get the full disk size - ROOTFS_SIZE=`parted -s $CEPHDEV unit MB print | head -n3 | grep -w ^Disk | grep MB | awk {' print $3 '} | sed -e "s/MB//g" | cut -d',' -f1 | cut -d'.' -f1` - if [ "$ROOTFS_SIZE" == "" ]; then - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Error finding disk size for volume $CEPHDEV! Skipping resize!" - return 1 - fi - ORIGIN_DISK_SIZE=$ROOTFS_SIZE - - # check if we can find swap space - CREATE_SWAPSPACE=false - SWAPSPACE_SIZE=`parted -s $CEPHDEV unit MB print 2>/dev/null | grep "linux-swap" | head -n1 | awk {' print $4 '} | sed -e "s/MB//g" | cut -d',' -f1 | cut -d'.' -f1` - if [ "$SWAPSPACE_SIZE" != "" ]; then - CREATE_SWAPSPACE=true - ROOTFS_SIZE=$(( $ROOTFS_SIZE - $SWAPSPACE_SIZE )) - else - SWAPSPACE_SIZE=`parted -s $CEPHDEV unit MB print 2>/dev/null | grep "type=82" | head -n1 | awk {' print $4 '} | sed -e "s/MB//g" | cut -d',' -f1 | cut -d'.' -f1` - if [ "$SWAPSPACE_SIZE" != "" ]; then - CREATE_SWAPSPACE=true - ROOTFS_SIZE=$(( $ROOTFS_SIZE - $SWAPSPACE_SIZE )) - fi - fi - - # remove partitions - for N in `seq 1 5`; do - parted -s $CEPHDEV rm $N - done - - # recreate root-partition - parted -s $CEPHDEV mkpart primary $PARTITION_START $ROOTFS_SIZE""MB - # make it bootable - parted -s $CEPHDEV set 1 boot on - - if [ "$CREATE_SWAPSPACE" == "true" ]; then - # recreate swap - parted -s $CEPHDEV mkpart primary linux-swap $ROOTFS_SIZE""MB $ORIGIN_DISK_SIZE""MB - - CMD_ERR=`mkswap $CEPHDEV""p2 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Could not create swap space on $CEPHDEV - $CMD_ERR!" - fi - sync - sleep 2 - fi - - FIRST_PARTITION=$CEPHDEV""p1 - - # filesystem resize - if [ -e $FIRST_PARTITION ]; then - PARTITION_TYPE=`fdisk -l $CEPHDEV | grep ^$CEPHDEV | head -n1 | sed -e "s#\*##g" | awk '{ print $5 }'` - case "$PARTITION_TYPE" in - 83) - e2fsck -y $FIRST_PARTITION - openqrm_post_event 0 "$CEPHDEV" 5 "openqrm-kvm" "Resizing Linux filesystem of volume $CEPHDEV." - CMD_ERR=`resize2fs -f -p $FIRST_PARTITION 2>&1` - if [ "$?" == 0 ]; then - openqrm_post_event 0 "kvm_resize_fs" 5 "openqrm-kvm" "Successfully resized volume $CEPHDEV." - else - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Errors during resizing volume $CEPHDEV! $CMD_ERR" - if ! e2fsck -fy $FIRST_PARTITION; then - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Errors on filesystem of volume $CEPHDEV!" - fi - fi - e2fsck -fy $FIRST_PARTITION - ;; - 7) - VOLUME_SIZE_PARAM="-s $ROOTFS_SIZE""M" - openqrm_post_event 0 "$CEPHDEV" 5 "openqrm-kvm" "Resizing Windows filesystem of volume $CEPHDEV to $ROOTFS_SIZE MB." - CMD_ERR=`ntfsresize $VOLUME_SIZE_PARAM -b -f $FIRST_PARTITION 2>&1` - if [ "$?" == 0 ]; then - openqrm_post_event 0 "kvm_resize_fs" 5 "openqrm-kvm" "Successfully resized volume $CEPHDEV to $ROOTFS_SIZE MB." - else - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Errors during resizing volume $CEPHDEV! $CMD_ERR" - fi - ;; - *) - openqrm_post_event 0 "kvm_resize_fs" 2 "openqrm-kvm" "Could not find out filesystem type of volume $CEPHDEV. Not resizing." - ;; - esac - fi - sync - sleep 2 - - - # unmap - CMD_ERR=`rbd unmap $CEPH_VOLUME --pool $CEPH_POOL 2>&1` - CMD_ERR=`rbd unmap $CEPHDEV 2>&1` - if [ "$?" != 0 ]; then - CMD_ERR=`openqrm_format_error_msg $CMD_ERR` - openqrm_post_event 0 "resize" 3 "openqrm-kvm" "Error unmapping rbd volume rbd:$CEPH_POOL/$CEPH_VOLUME! $CMD_ERR" - - openqrm_lock_queue release kvm $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - - return 0 - -} - - - -# translates ceph df output in MB (can be M, G, T) -function ceph_inmb() { - local CNUM=$1 - if echo $CNUM | grep M 1>/dev/null; then - COUTPUT=`echo $CNUM | sed -e "s/MiB//g"` - COUTPUT=$(echo $COUTPUT | cut -d'.' -f1) - elif echo $CNUM | grep G 1>/dev/null; then - COUTPUT=`echo $CNUM | sed -e "s/GiB//g"` - COUTPUT=$(echo $COUTPUT*1000 | bc | cut -d'.' -f1) - elif echo $CNUM | grep T 1>/dev/null; then - COUTPUT=`echo $CNUM | sed -e "s/TiB//g"` - COUTPUT=$(echo $COUTPUT*1000*1000 | bc | cut -d'.' -f1) - else - COUTPUT=$CNUM - fi - echo $COUTPUT -} - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/sbin/openqrm-kvm-monitord b/openQRM-5.3.50-CE/src/plugins/kvm/sbin/openqrm-kvm-monitord deleted file mode 100644 index 9358c77..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/sbin/openqrm-kvm-monitord +++ /dev/null @@ -1,226 +0,0 @@ -#!/bin/bash -# this script automatically monitors kvm vms -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/include/openqrm-plugin-kvm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - OPENQRM_SERVER_IP=$resource_openqrmserver - export SERVER_PROTOCOL=$openqrm_web_protocol -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS - resource_id=0 - export resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - export SERVER_PROTOCOL=$OPENQRM_WEB_PROTOCOL - export resource_senddelay=10 -fi -OPENQRM_POSTENCODE="$OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-postencode" -OPENQRM_VM_DIR="/var/lib/kvm/openqrm/" -export LANG=C -OPENQRM_EVENT="statistics" -OPENQRM_ACTIVE_STATE="active" -OPENQRM_STARTING_STATE="starting" - -# define wget to use with https -if [ "$SERVER_PROTOCOL" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate --random-file=/dev/random" -fi - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - -# mac is the identifier -KVM_VM_MAC=$1 -if [ "$KVM_VM_MAC" == "" ]; then - echo "Usage: $0 " - exit 1 -fi - -KVM_VM_NAME=`grep -rHi $KVM_VM_MAC $OPENQRM_VM_DIR/*/net1 2>/dev/null | grep KVM_VM_MAC | cut -d':' -f1 2>/dev/null` 2>/dev/null -KVM_VM_NAME=`dirname $KVM_VM_NAME` 2>/dev/null -KVM_VM_NAME=`basename $KVM_VM_NAME` 2>/dev/null -if [ "$KVM_VM_NAME" == "" ]; then - echo "NOTICE: Cloud not find KVM-storage vm $KVM_VM_MAC on this host" | logger - exit 1 -fi - - -# local used functions -function send_info() { - current_state=`urlencodestring $OPENQRM_ACTIVE_STATE` - current_event=`urlencodestring $OPENQRM_EVENT` - MESSAGEDATA="resource_id=$resource_id&resource_uptime=$current_uptime&resource_cpunumber=$current_cpu_number&resource_cpuspeed=$current_cpu_speed&resource_cpumodel=$current_cpu_model&resource_memtotal=$current_mem_total&resource_memused=$current_mem_used&resource_swaptotal=$current_swap_total&resource_swapused=$current_swap_used&resource_hostname=$current_hostname&resource_load=$current_cpu_load&resource_nics=$current_nic_count&resource_state=$current_state&resource_event=$current_event"; - OPENQRM_RESOURCE_INFO_URL="$SERVER_PROTOCOL://$resource_openqrmserver/openqrm/action/resource-monitor.php?resource_command=update_info&$MESSAGEDATA" - wget $WGET_NO_CERT_CHECK -q -O /dev/null "$OPENQRM_RESOURCE_INFO_URL" -} - -# uptime -function find_uptime() { - if [ -f /proc/uptime ]; then - current_uptime=`cat /proc/uptime | cut -d'.' -f 1` - fi - if [ -z "$current_uptime" ]; then - current_uptime=0 - fi -} -# cpu_speed -function find_cpu_speed() { - if [ -f /proc/cpuinfo ]; then - current_cpu_speed=(`cat /proc/cpuinfo | grep "cpu.*MHz"`) - current_cpu_speed=${current_cpu_speed[3]/\.*/} - fi - if [ -z "$current_cpu_speed" ]; then - current_cpu_speed=0 - fi -} -# used mem -function find_mem_used() { - local VP=$1 - if [ -f /proc/$VP/status ]; then - VM_RSS=`cat /proc/$VP/status | grep ^VmRSS: | awk '{ print $2 }'` - current_mem_used=$(( VM_RSS / 1024 )) - else - current_mem_used=0 - fi - if [ "$current_mem_used" -gt "$current_mem_total" ]; then - current_mem_used=$current_mem_total - fi - export current_mem_used -} -# used cpu load -function find_cpu_load() { - local VP=$1 - VM_CPU_SLICE=`ps -p $VP -o %cpu | tail -n+2` - current_cpu_load=`perl -E "say $VM_CPU_SLICE/10"` - export current_cpu_load -} - - -# get parameters for the vm resource -KVM_VM_RESOURCE_PARAMETER="$OPENQRM_VM_DIR/$KVM_VM_NAME/resource-parameter.conf" -# sending resource-id will add the resource if not existing (-1 = new resource) -# loop get-parameters in case the network card is still not ready initialized -NETWORKCARD_LOOP=0 -# send id -1 if resource parameters are not existing -if [ ! -f $KVM_VM_RESOURCE_PARAMETER ]; then - NEW_RES_ID="&resource_id=-1" -fi - -while (true); do - if wget $WGET_NO_CERT_CHECK -q -O $KVM_VM_RESOURCE_PARAMETER "$SERVER_PROTOCOL://$resource_openqrmserver/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_mac=$KVM_VM_MAC$NEW_RES_ID"; then - if grep resource_id $KVM_VM_RESOURCE_PARAMETER 1>/dev/null 2>&1; then - break - fi - fi - # no chance ? - if [ "$NETWORKCARD_LOOP" == "10" ]; then - echo "ERROR: Could not reach the openQRM-Server at $OPENQRM_SERVER_IP_ADDRESS!" - exit 1 - fi - NETWORKCARD_LOOP=$(( NETWORKCARD_LOOP + 1 )) - sleep 5 -done -# source parameters -. $KVM_VM_RESOURCE_PARAMETER -echo "$0: Gathering resources-information" | logger -# gather cpu speed only once -find_cpu_speed -# main loop -while (true); do - # if we have a disk, check that the vm is still running - . $OPENQRM_VM_DIR/$KVM_VM_NAME/disk1 - if [ "$KVM_VM_DISK_1" != "" ]; then - if ! ps ax | grep kvm | grep -v grep | grep -i "macaddr=$KVM_VM_MAC" 1>/dev/null; then - exit 1 - fi - # get the used mem from the VM - VM_PID=`ps ax | grep kvm | grep -v grep | grep -i "macaddr=$KVM_VM_MAC" | grep -v -i screen | head -n1 | awk '{ print $1 }'` - if [ "$VM_PID" != "" ]; then - find_mem_used $VM_PID - find_cpu_load $VM_PID - fi - fi - # exit if vm got removed - if [ ! -d "$OPENQRM_VM_DIR/$KVM_VM_NAME" ]; then - exit 1 - fi - # gathering the values, those may be dynamic e.g. if the VM is updated - # source kvm vm config - . $OPENQRM_VM_DIR/$KVM_VM_NAME/cpus - . $OPENQRM_VM_DIR/$KVM_VM_NAME/ram - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net1 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net2 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net3 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net4 - . $OPENQRM_VM_DIR/$KVM_VM_NAME/net5 - export current_hostname=$KVM_VM_NAME - export resource_cpumodel="Qemu Virtual CPU" - export current_cpu_number=$KVM_VM_CPUS - export current_mem_total=$KVM_VM_RAM - # nic count - TOTAL_NIC_COUNT=0 - if [ "$KVM_VM_MAC_1" != "" ]; then - TOTAL_NIC_COUNT=$(( TOTAL_NIC_COUNT + 1 )) - fi - if [ "$KVM_VM_MAC_2" != "" ]; then - TOTAL_NIC_COUNT=$(( TOTAL_NIC_COUNT + 1 )) - fi - if [ "$KVM_VM_MAC_3" != "" ]; then - TOTAL_NIC_COUNT=$(( TOTAL_NIC_COUNT + 1 )) - fi - if [ "$KVM_VM_MAC_4" != "" ]; then - TOTAL_NIC_COUNT=$(( TOTAL_NIC_COUNT + 1 )) - fi - if [ "$KVM_VM_MAC_5" != "" ]; then - TOTAL_NIC_COUNT=$(( TOTAL_NIC_COUNT + 1 )) - fi - export current_nic_count=$TOTAL_NIC_COUNT - # uptime - find_uptime - # sending statistics - send_info - # delay - sleep $resource_senddelay -done -# never reached -exit 0 - - - - - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.bootservice.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.bootservice.class.php deleted file mode 100644 index 3a1b060..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.bootservice.class.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ - -class kvm_about_bootservice -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "kvm_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/kvm-about-bootservice.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['boot_service_title'], 'boot_service_title'); - $t->add($this->lang['boot_service_content'], 'boot_service_content'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.controller.class.php deleted file mode 100644 index ba32b29..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.controller.class.php +++ /dev/null @@ -1,392 +0,0 @@ - - */ - -class kvm_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About KVM', - 'label' => 'About KVM', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The "KVM" plugin manages KVM Virtual Machines and their belonging virtual disk. - As common in openQRM the Virtual Machines and their virtual disk volumes are managed separately. - Therefore the "KVM" plugin splits up into VM- and Volume-Management. - The VM part provides the Virtual Machines which are abstracted as "Resources". - The Storage part provides volumes which are abstracted as "Images". - Appliance deployment automatically combines "Resource" and "Image".', - 'requirements_title' => 'Requirements', - 'requirements_list' => '
    • A resource for the KVM Host Appliance
      (this can be a remote system integrated into openQRM e.g. via the "local-server" plugin or the openQRM server itself)
    • -
    • The server needs VT (Virtualization Technology) Support in its CPU (requirement for KVM)
    • -
    • The following packages must be installed: kvm (eventual kvm-pxe), socat, bridge-utils, lvm2
    • -
    • For KVM LVM Storage: One (or more) lvm volume group(s) with free space dedicated for the KVM VM storage
    • -
    • For KVM Blockfile Storage: free space dedicated for the KVM VM storage
    • -
    • For KVM Gluster Storage: One or more Gluster Storage Cluster
    • -
    • One or more bridges configured for the virtual machines
    ', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with KVM Version kvm-62 or better
    To benefit from the KVM "virtio" feature at least kvm-84 is needed', - - 'provides_title' => 'Provides', - 'provides_list' => '
    • Virtualization types: "KVM Host", "KVM VM (localboot)" and "KVM VM (netboot)"
    • -
    • Storage types: "KVM LVM Storage", "KVM Blockfile Storage" and "KVM Gluster Storage"
    • -
    • Deployment types: "LVM deployment for KVM", "Blockfile deployment for KVM" and "Gluster deployment for KVM"
    ', - 'type_title' => 'Plugin Type', - 'type_content' => 'Virtualization and Storage', - - 'deployment_title' => 'Deployment Type', - 'deployment_content' => 'Local and Network Deployment for Virtual Machines', - - 'migration_title' => 'Requirements for KVM live-migration', - 'migration_content' => 'Shared storage between the KVM Hosts for the location of the VM config files (/var/lib/kvm/openqrm) - and a shared LVM volume group between the KVM Hosts', - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - 'network_deploymet' => 'Network-Deployment', - 'doc1' => '', - ), - 'bootservice' => array ( - 'tab' => 'Boot-Service', - 'label' => 'KVM Boot-Service', - 'boot_service_title' => 'KVM Host Boot-Service', - 'boot_service_content' => 'The KVM Plugin provides an openQRM Boot-Service. - This "KVM Boot-Service" is automatically downloaded and executed by the openQRM-Client on all integrated Systems. - The Boot-Service is located at:
    -
    - /usr/share/openqrm/plugins/kvm/web/boot-service-kvm.tgz -
    -
    - The "KVM Boot-Service" contains the Client files of the KVM Plugin.
    - Also a configuration file for the KVM Hosts is included in this Boot-Service.
    -
    - The Boot-Service configuration can be viewed and administrated by the "openqrm" utility.
    - To view the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n kvm -a default -
    -
    - To view a Boot-Service configuration of a specific appliance run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n kvm -a [appliance-name] -
    -
    - To adapt a parameter in the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n kvm -a default -k [key] -v [value] -
    -
    - To adapt a paramter in the Boot-Service configuration of a specific appliance run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n kvm -a [appliance-name] -k [key] -v [value] -
    -
    - In case the openmQRM Server itself is used as the KVM Host please edit:
    -
    - /usr/share/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf -
    -
    - and set the configuration keys according to your bridge-configuration.
    -
    - ', - ), - 'storage' => array ( - 'tab' => 'About KVM', - 'label' => 'About Storage in KVM', - 'storage_mgmt_title' => 'KVM Storage Management', - 'storage_mgmt_list' => '
      li>Create a new storage from type "KVM LVM Storage" or "KVM Blockfile Storage" -
    • Create a new Volume on this storage (either LVM or Blockfile)
    • -
    • Creating the Volume automatically creates a new Image using volume as root-device
    ', - - ), - 'vms' => array ( - 'tab' => 'About KVM', - 'label' => 'About Virtual Machines in KVM', - 'vm_mgmt_title' => 'KVM VM Management', - 'vm_mgmt_list' => '
    • Create a new appliance and set its resource type to "KVM Host"
    • -
    • Create and manage KVM virtual machines via the KVM VM Manager
    ', - ), - 'usage' => array ( - 'tab' => 'About KVM', - 'label' => 'KVM Use-Cases', - ), - -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/kvm/lang", 'kvm-about.ini'); - - - $this->tpldir = $this->rootdir.'/plugins/kvm/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "documentation"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - case 'bootservice': - $content[] = $this->bootservice(true); - break; - case 'storage': - $content[] = $this->storage(true); - break; - case 'vms': - $content[] = $this->vms(true); - break; - case 'usage': - $content[] = $this->usage(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About KVM - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-about.documentation.class.php'); - $controller = new kvm_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Boot-Service - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function bootservice( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-about.bootservice.class.php'); - $controller = new kvm_about_bootservice($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['bootservice']; - $data = $controller->action(); - } - $content['label'] = $this->lang['bootservice']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'bootservice' ); - $content['onclick'] = false; - if($this->action === 'bootservice'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * About Storage - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function storage( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-about.storage.class.php'); - $controller = new kvm_about_storage($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['storage']; - $data = $controller->action(); - } - $content['label'] = $this->lang['storage']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'storage' ); - $content['onclick'] = false; - if($this->action === 'storage'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * About KVM VM management - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function vms( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-about.vms.class.php'); - $controller = new kvm_about_vms($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['vms']; - $data = $controller->action(); - } - $content['label'] = $this->lang['vms']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'vms' ); - $content['onclick'] = false; - if($this->action === 'vms'){ - $content['active'] = true; - } - return $content; - } - - - - //-------------------------------------------- - /** - * About KVM Use-Cases - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function usage( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-about.usage.class.php'); - $controller = new kvm_about_usage($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['usage']; - $data = $controller->action(); - } - $content['label'] = $this->lang['usage']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'usage' ); - $content['onclick'] = false; - if($this->action === 'usage'){ - $content['active'] = true; - } - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.documentation.class.php deleted file mode 100644 index 725d75f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.documentation.class.php +++ /dev/null @@ -1,91 +0,0 @@ - - */ - -class kvm_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "kvm_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/kvm-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['deployment_title'], 'deployment_title'); - $t->add($this->lang['deployment_content'], 'deployment_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->lang['migration_title'], 'migration_title'); - $t->add($this->lang['migration_content'], 'migration_content'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.storage.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.storage.class.php deleted file mode 100644 index 7cf11f8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.storage.class.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ - -class kvm_about_storage -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "kvm_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/kvm-about-storage.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['storage_mgmt_title'], 'storage_mgmt_title'); - $t->add($this->lang['storage_mgmt_list'], 'storage_mgmt_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.usage.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.usage.class.php deleted file mode 100644 index 3c8e052..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.usage.class.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ - -class kvm_about_usage -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "kvm_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/kvm-about-usage.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.vms.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.vms.class.php deleted file mode 100644 index b02b678..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-about.vms.class.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ - -class kvm_about_vms -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "kvm_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/kvm-about-vms.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['vm_mgmt_title'], 'vm_mgmt_title'); - $t->add($this->lang['vm_mgmt_list'], 'vm_mgmt_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.add.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.add.class.php deleted file mode 100644 index fe2e288..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.add.class.php +++ /dev/null @@ -1,1044 +0,0 @@ - - */ - -class kvm_vm_add -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - $this->controller = $controller; - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $id = $this->response->html->request()->get('appliance_id'); - $this->user = $openqrm->user(); - $appliance = $this->openqrm->appliance(); - $resource = $this->openqrm->resource(); - $appliance->get_instance_by_id($id); - $resource->get_instance_by_id($appliance->resources); - $this->resource = $resource; - $this->appliance = $appliance; - $this->statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$resource->id.'.vm_list'; - $this->response->add('appliance_id', $id); - $this->response->add('vmtype', $this->response->html->request()->get('vmtype')); - - require_once $this->openqrm->get('basedir').'/plugins/ip-mgmt/web/class/ip-mgmt.class.php'; - $ip_mgmt = new ip_mgmt(); - $this->ip_mgmt = $ip_mgmt; - - $this->plugin = new plugin(); - $this->plugins_enabled = $this->plugin->enabled(); - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->add(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 2) { - $this->controller->reload(); - $vmtype = $this->response->html->request()->get('vmtype'); - $foward_to_step = $this->user->wizard_step; - $foward_to_step = 2; - if($vmtype === 'kvm-vm-local') { - if ($this->response->html->request()->get('localboot_image') !== '') { - $foward_to_step = 4; - } - } - if($vmtype === 'kvm-vm-net') { - if ($this->response->html->request()->get('netboot_image') !== '') { - $foward_to_step = 4; - } - } - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$foward_to_step.'&appliance_id='.$this->user->wizard_id.'&resource_id='.$response->resource_id - ); - } else { - if ($response->image_configured) { - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_msg='.$response->msg.'&resource_filter='.$response->resource_id - ); - } else { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - - $a = $this->response->html->a(); - $a->label = $this->lang['action_add_vm_image']; - $a->css = 'add'; - $a->handler = 'onclick="wait();"'; - $a->href = $this->response->html->thisfile.'?base=image&image_action=add'; - $action_add_vm_image = $a->get_string(); - - $t = $this->response->html->template($this->tpldir.'/kvm-vm-add.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['lang_basic'], 'lang_basic'); - $t->add($this->lang['lang_hardware'], 'lang_hardware'); - $t->add($this->lang['lang_net'], 'lang_net'); - $t->add($this->lang['lang_net_0'], 'lang_net_0'); - $t->add($this->lang['lang_net_1'], 'lang_net_1'); - $t->add($this->lang['lang_net_2'], 'lang_net_2'); - $t->add($this->lang['lang_net_3'], 'lang_net_3'); - $t->add($this->lang['lang_net_4'], 'lang_net_4'); - $t->add($this->lang['lang_boot'], 'lang_boot'); - $t->add($this->lang['lang_virtual_disk'], 'lang_virtual_disk'); - $t->add($this->lang['lang_vnc'], 'lang_vnc'); - $t->add($this->lang['lang_browser'], 'lang_browser'); - $t->add($this->lang['lang_password_generate'], 'lang_password_generate'); - $t->add($this->lang['lang_password_show'], 'lang_password_show'); - $t->add($this->lang['lang_password_hide'], 'lang_password_hide'); - $t->add($action_add_vm_image, 'add_vm_image'); - $t->add($this->response->html->request()->get('appliance_id'), 'appliance_id'); - $t->add($this->actions_name, 'actions_name'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Add - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function add() { - $response = $this->get_response(); - $form = $response->form; - - // handle no bridge error - if(!isset($respnse->msg)) { - // check vnc password - $vnc = $form->get_request('vnc'); - if($vnc !== '' && $vnc !== $form->get_request('vnc_1')) { - $form->set_error('vnc_1', $this->lang['error_vnc_password']); - } - if(isset($vnc) && $vnc !== '' && strlen($vnc) < 6) { - $form->set_error('vnc', $this->lang['error_vnc_password_count']); - } - $vnckeymap = $form->get_request('vnc_keymap'); - $vnckeymap_parameter = ''; - if($vnc !== '') { - $vnckeymap_parameter = ' -l '.$vnckeymap; - } - // disk interface - $disk_interface = $form->get_request('disk_interface'); - $disk_interface_parameter = ''; - if($disk_interface !== '') { - $disk_interface_parameter = ' -o '.$disk_interface; - } - $iso_path = ''; - if($form->get_request('boot') !== '' && $form->get_request('boot') === 'iso') { - if($form->get_request('iso_path') === '') { - $form->set_error('iso_path', $this->lang['error_iso_path']); - } else { - $iso_path = ' -i '.$form->get_request('iso_path'); - } - } - - $image = new image(); - $vm_using_existing_image = false; - if ($form->get_request('localboot_image') !== '') { - $image->get_instance_by_id($form->get_request('localboot_image')); - $vm_using_existing_image = true; - } else if ($form->get_request('netboot_image') !== '') { - $image->get_instance_by_id($form->get_request('netboot_image')); - $vm_using_existing_image = true; - } - - if(!$form->get_errors() && $this->response->submit()) { - $errors = array(); - $name = $form->get_request('name'); - if($form->get_request('boot') === '') { - $errors[] = $this->lang['error_boot']; - } - - $enabled = array(); - for($i = 1; $i < 5; $i++) { - $enabled[$i] = true; - if($form->get_request('net'.$i) !== '') { - if($form->get_request('mac'.$i) === '') { - $form->set_error('mac'.$i, $this->lang['error_mac']); - $enabled[$i] = false; - } - if($form->get_request('nic'.$i) === '') { - $form->set_error('nic'.$i, $this->lang['error_nic']); - $enabled[$i] = false; - } - if($form->get_request('bridge'.$i) === '') { - $form->set_error('bridge'.$i, $this->lang['error_bridge']); - $enabled[$i] = false; - } - } else { - $enabled[$i] = false; - } - } - // check vm name - if ($this->file->exists($this->statfile)) { - $lines = explode("\n", $this->file->get_contents($this->statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[1]; - if($name === $check) { - $errors[] = sprintf($this->lang['error_exists'], $name); - } - } - } - } - } - if(count($errors) > 0 || $form->get_errors()) { - $response->error = join('
    ', $errors); - } else { - $tables = $this->openqrm->get('table'); - $resource = new resource(); - $id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $ip = ""; - $subnet = ""; - - // default management network or custom ip - if($form->get_request('ovs_ip0') === '') { - $ip = "0.0.0.0"; - $subnet = "0.0.0.0"; - } else { - $ovs_ip0_id = $form->get_request('ovs_ip0'); - $ovs_ip0_array = $this->ip_mgmt->get_instance('id', $ovs_ip0_id); - $ovs_ip0_mgmt_name = trim($ovs_ip0_array['ip_mgmt_name']); - $ovs_ip0_mgmt_address = trim($ovs_ip0_array['ip_mgmt_address']); - $ovs_ip0_mgmt_network = trim($ovs_ip0_array['ip_mgmt_network']); - $ovs_ip0_mgmt_subnet = trim($ovs_ip0_array['ip_mgmt_subnet']); - $ovs_ip0_mgmt_broadcast = trim($ovs_ip0_array['ip_mgmt_broadcast']); - $ovs_ip0_mgmt_dns1 = trim($ovs_ip0_array['ip_mgmt_dns1']); - $ovs_ip0_mgmt_dns2 = trim($ovs_ip0_array['ip_mgmt_dns2']); - $ovs_ip0_mgmt_domain = trim($ovs_ip0_array['ip_mgmt_domain']); - $ovs_ip0_mgmt_vlan_id = trim($ovs_ip0_array['ip_mgmt_vlan_id']); - $ovs_ip0_mgmt_comment = trim($ovs_ip0_array['ip_mgmt_comment']); - - - // still need to save the ip config in ip-mgmt - - // use first ip as resource ip + subnet to trigger the dhcpd plugin to add it to custom ip-mgmt network - $ip = $ovs_ip0_mgmt_address; - $subnet = $ovs_ip0_mgmt_subnet; - - } - - - - - - $mac = strtolower($form->get_request('mac')); - // send command to the openQRM-server - $openqrm = new openqrm_server(); - $openqrm->send_command('openqrm_server_add_resource '.$id.' '.$mac.' '.$ip); - // set resource type - $vmtype = $this->response->html->request()->get('vmtype'); - if($vmtype === 'kvm-vm-net') { - $virtualization = new virtualization(); - $virtualization->get_instance_by_type("kvm-vm-net"); - } else { - $virtualization = new virtualization(); - $virtualization->get_instance_by_type("kvm-vm-local"); - } - // add to openQRM database - $fields["resource_id"] = $id; - $fields["resource_ip"] = $ip; - $fields["resource_subnet"] = $subnet; - $fields["resource_mac"] = $mac; - $fields["resource_localboot"] = 0; - $fields["resource_vtype"] = $virtualization->id; - $fields["resource_vhostid"] = $this->resource->id; - $fields["resource_vname"] = $name; - $this->resource->add($fields); - - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm-vm create'; - $command .= ' -n '.$name; - $command .= ' -y '.$vmtype; - $command .= ' -m '.$mac; - $command .= ' -r '.$form->get_request('memory'); - $command .= ' -c '.$form->get_request('cpus'); - $command .= ' -t '.$form->get_request('nic'); - // ovs bridge param from ip_mgmt - if (in_array("openvswitch-manager", $this->plugins_enabled)) { - $ovs0_ip_id = $form->get_request('ovs_ip0'); - $ovs0_ip_array = $this->ip_mgmt->get_instance('id', $ovs0_ip_id); - $ovs0_ip_mgmt_bridge_name = trim($ovs0_ip_array['ip_mgmt_bridge_name']); - $command .= ' -z '.$ovs0_ip_mgmt_bridge_name; - // update ip-mgmt object - $ovs0_update_array['ip_mgmt_resource_id'] = $id; - $this->ip_mgmt->update_ip($ovs0_ip_id, $ovs0_update_array); - - foreach($enabled as $key => $value) { - if($value === true) { - $ovsx_ip_id = $form->get_request('ovs_ip'.$key); - $ovsx_ip_array = $this->ip_mgmt->get_instance('id', $ovsx_ip_id); - $ovsx_ip_mgmt_bridge_name = trim($ovsx_ip_array['ip_mgmt_bridge_name']); - $command .= ' -m'.$key.' '.$form->get_request('mac'.$key); - $command .= ' -t'.$key.' '.$form->get_request('nic'.$key); - $command .= ' -z'.$key.' '.$ovsx_ip_mgmt_bridge_name; - // update ip-mgmt object - $ovsx_update_array['ip_mgmt_resource_id'] = $id; - $this->ip_mgmt->update_ip($ovsx_ip_id, $ovsx_update_array); - - } - } - - } else { - // regular bridges from form - $command .= ' -z '.$form->get_request('bridge'); - foreach($enabled as $key => $value) { - if($value === true) { - $command .= ' -m'.$key.' '.$form->get_request('mac'.$key); - $command .= ' -t'.$key.' '.$form->get_request('nic'.$key); - $command .= ' -z'.$key.' '.$form->get_request('bridge'.$key); - } - } - } - - - - if($form->get_request('cdrom')) { - $command .= ' -cdrom '.$form->get_request('cdrom'); - } - - $command .= ' -b '.$form->get_request('boot'); - $command .= ' -v '.$form->get_request('vnc'); - $command .= $iso_path; - $command .= $vnckeymap_parameter; - $command .= $disk_interface_parameter; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - - $this->resource->send_command($this->resource->ip, $command); - $response->resource_id = $id; - $response->msg = sprintf($this->lang['msg_added'], $name); - - // create server object - $response->image_configured = false; - if ($vm_using_existing_image) { - $response->image_configured = true; - // add/update server if any type of image was set - $now=$_SERVER['REQUEST_TIME']; - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 2) { - // update appliance for this VM if we are coming from the wizard - $afields['appliance_resources'] = $id; - $afields['appliance_kernelid'] = '1'; - $afields['appliance_imageid'] = $image->id; - $afields["appliance_virtual"]= 0; - $afields["appliance_virtualization"]=$virtualization->id; - $afields['appliance_wizard'] = ''; - $afields['appliance_comment'] = 'KVM VM for resource '.$id; - $afields['appliance_stoptime']=$now; - $afields['appliance_starttime']=''; - $afields['appliance_state']='stopped'; - $this->appliance->update($this->user->wizard_id, $afields); - } else { - // auto create the appliance for this VM if we are not coming from the wizard - $appliance_name = str_replace("_", "-", strtolower(trim($name))); - $new_appliance_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $afields['appliance_id'] = $new_appliance_id; - $afields['appliance_name'] = $appliance_name; - $afields['appliance_resources'] = $id; - $afields['appliance_kernelid'] = '1'; - $afields['appliance_imageid'] = $image->id; - $afields["appliance_virtual"]= 0; - $afields["appliance_virtualization"]=$virtualization->id; - $afields['appliance_wizard'] = ''; - $afields['appliance_comment'] = 'KVM VM for resource '.$id; - $this->appliance->add($afields); - // update state/start+stoptime - $aufields['appliance_stoptime']=$now; - $aufields['appliance_starttime']=''; - $aufields['appliance_state']='stopped'; - $this->appliance->update($new_appliance_id, $aufields); - } - } - - // when ovs is enabled configure addtional ip addresses in dhcpd + dns - if (in_array("openvswitch-manager", $this->plugins_enabled)) { - $openqrm_resource = new resource(); - $openqrm_resource->get_instance_by_id(0); - - // first nic dns, dhcpd comes from new resource hook - $ovs0_ip_id = $form->get_request('ovs_ip0'); - $ovs0_ip_array = $this->ip_mgmt->get_instance('id', $ovs0_ip_id); - $ovs0_ip_mgmt_address = trim($ovs0_ip_array['ip_mgmt_address']); - $ovs0_ip_mgmt_domain = trim($ovs0_ip_array['ip_mgmt_domain']); - - $dns_command = $this->openqrm->get('basedir').'/plugins/dns/bin/openqrm-dns-domain-manager add_host'; - $dns_command .= ' -n '.$ovs0_ip_mgmt_domain; - $dns_command .= ' -i '.$ovs0_ip_mgmt_address; - $dns_command .= ' -q '.$name; - $openqrm_resource->send_command($openqrm_resource->ip, $dns_command); - - // additional nics dhcpd + dns - foreach($enabled as $key => $value) { - if($value === true) { - $ovs_mac = $form->get_request('mac'.$key); - $ovs_ip_id = $form->get_request('ovs_ip'.$key); - $ovs_ip_array = $this->ip_mgmt->get_instance('id', $ovs_ip_id); - $ovs_ip_mgmt_address = trim($ovs_ip_array['ip_mgmt_address']); - $ovs_ip_mgmt_subnet = trim($ovs_ip_array['ip_mgmt_subnet']); - $ovs_ip_mgmt_domain = trim($ovs_ip_array['ip_mgmt_domain']); - - // dhcpd - $command = $this->openqrm->get('basedir').'/plugins/dhcpd/bin/openqrm-dhcpd-manager add'; - $command .= ' -d '.$id.$key; - $command .= ' -i '.$ovs_ip_mgmt_address; - $command .= ' -s '.$ovs_ip_mgmt_subnet; - $command .= ' -m '.$ovs_mac; - $openqrm_resource->send_command($openqrm_resource->ip, $command); - - // dns - $dns_command = $this->openqrm->get('basedir').'/plugins/dns/bin/openqrm-dns-domain-manager add_host'; - $dns_command .= ' -n '.$ovs_ip_mgmt_domain; - $dns_command .= ' -i '.$ovs_ip_mgmt_address; - $dns_command .= ' -q '.$name; - $openqrm_resource->send_command($openqrm_resource->ip, $dns_command); - - - } - } - - } - // end ovs - - - } - } else if($form->get_errors()) { - $response->error = implode('
    ', $form->get_errors()); - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $OPENQRM_SERVER_BASE_DIR = $this->openqrm->get('basedir'); - $response = $this->response; - $form = $response->get_form($this->actions_name, 'add'); - - $cpus[] = array("1", "1 CPU"); - $cpus[] = array("2", "2 CPUs"); - $cpus[] = array("4", "4 CPUs"); - $cpus[] = array("8", "8 CPUs"); - $cpus[] = array("16", "16 CPUs"); - - $ram[] = array("256", "256 MB"); - $ram[] = array("512", "512 MB"); - $ram[] = array("1024", "1 GB"); - $ram[] = array("2048", "2 GB"); - $ram[] = array("4096", "4 GB"); - $ram[] = array("8192", "8 GB"); - $ram[] = array("16384", "16 GB"); - $ram[] = array("32768", "32 GB"); - $ram[] = array("65536", "64 GB"); - - $nics[] = array("virtio", $this->lang['form_net_virtio']); - $nics[] = array("e1000", $this->lang['form_net_e1000']); - $nics[] = array("rtl8139", $this->lang['form_net_rtl8139']); - - $keymaps[] = array("de", "de"); - $keymaps[] = array("en-us", "en-us"); - $keymaps[] = array("es", "es"); - $keymaps[] = array("fr", "fr"); - $keymaps[] = array("it", "it"); - $keymaps[] = array("ja", "ja"); - $keymaps[] = array("nl", "nl"); - $keymaps[] = array("ru", "ru"); - $keymaps[] = array("none", "none"); - - $disk_interfaces[] = array("virtio", "Virtio"); - $disk_interfaces[] = array("ide", "IDE"); - - $swap_select_arr[] = array('1024', '1 GB'); - $swap_select_arr[] = array('2048', '2 GB'); - $swap_select_arr[] = array('4096', '4 GB'); - - // if we come from the wizard suggest the server name - $vm_name_suggestion = ''; - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 2) { - $appliance = new appliance(); - $appliance->get_instance_by_id($this->user->wizard_id); - $vm_name_suggestion = $appliance->name; - } - - // get a list of existing kvm localboot images to select - $existing_image_arr = array(); - $image = new image(); - $image_image_id_ar = $image->get_ids_by_type('kvm-lvm-deployment'); - foreach ($image_image_id_ar as $iid_ar) { - $image_id = $iid_ar['image_id']; - $image->get_instance_by_id($image_id); - $existing_image_arr[] = array($image->id, $image->name); - } - $image_image_id_ar = $image->get_ids_by_type('kvm-bf-deployment'); - foreach ($image_image_id_ar as $iid_ar) { - $image_id = $iid_ar['image_id']; - $image->get_instance_by_id($image_id); - $existing_image_arr[] = array($image->id, $image->name); - } - $image_image_id_ar = $image->get_ids_by_type('kvm-gluster-deployment'); - foreach ($image_image_id_ar as $iid_ar) { - $image_id = $iid_ar['image_id']; - $image->get_instance_by_id($image_id); - $existing_image_arr[] = array($image->id, $image->name); - } - $existing_image_arr[] = array('', ''); - - // get a list of network-deployment images for netboot vms - $existing_netboot_image_arr = array(); - $existing_netboot_image_id_ar = $image->get_ids(); - foreach ($existing_netboot_image_id_ar as $iid_ar) { - $image_id = $iid_ar['image_id']; - $image->get_instance_by_id($image_id); - if ($image->is_network_deployment()) { - $existing_netboot_image_arr[] = array($image->id, $image->name); - } - } - $existing_netboot_image_arr[] = array('', ''); - - - // ip addresses for ovs from ip-mgmt - // TODO !!!!!!! get network from selected ovs via mapping object - //$ip_addresse_ids = $this->ip_mgmt->get_ips_by_name($this->network); - - $ip_addresse_ids = []; - $ip_network_names_array = $this->ip_mgmt->get_names(); - foreach($ip_network_names_array as $ip_network_name) { -// $ip_addresse_ids = $this->ip_mgmt->get_ips_by_name($ip_network_name); - array_push($ip_addresse_ids, $this->ip_mgmt->get_ips_by_name($ip_network_name)); - } - - // TODO !!!!!!! get network from selected ovs via mapping object - - - foreach($ip_addresse_ids as $ip_adress_network_array) { - foreach($ip_adress_network_array as $ip_adress_id) { - $ip_array = $this->ip_mgmt->get_instance('id', $ip_adress_id); - $ip_mgmt_appliance_id = trim($ip_array['ip_mgmt_appliance_id']); - $ip_mgmt_resource_id = trim($ip_array['ip_mgmt_resource_id']); - if ($ip_mgmt_appliance_id != NULL) { - continue; - } - if ($ip_mgmt_resource_id != NULL) { - continue; - } - $ip_mgmt_name = trim($ip_array['ip_mgmt_name']); - $ip_mgmt_domain = trim($ip_array['ip_mgmt_domain']); - $ip_mgmt_address = trim($ip_array['ip_mgmt_address']); - $ip_mgmt_list_per_user_arr[] = array("value" => $ip_adress_id, "label" => $ip_mgmt_address.' ('.$ip_mgmt_domain.')'); - } - } - - - $file = $OPENQRM_SERVER_BASE_DIR.'/plugins/kvm/web/kvm-stat/'.$this->resource->id.'.bridge_config'; - $data = openqrm_parse_conf($file); - $bridges = array(); - $bridge_list = $data['OPENQRM_KVM_BRIDGES']; - $bridge_list = rtrim($bridge_list, ":"); - $bridge_array = explode(':', $bridge_list); - - // handle no bridge error - if(isset($bridge_array[0]) && $bridge_array[0] !== '') { - foreach ($bridge_array as $b) { - $bridges[] = array($b, $b); - } - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['css'] = 'namegen'; - $d['name']['object']['attrib']['customattribs'] = 'data-prefix="kvm" data-length="6"'; - $d['name']['object']['attrib']['value'] = $vm_name_suggestion; - $d['name']['object']['attrib']['maxlength'] = 50; - - $d['cpus']['label'] = $this->lang['form_cpus']; - $d['cpus']['required'] = true; - $d['cpus']['object']['type'] = 'htmlobject_select'; - $d['cpus']['object']['attrib']['name'] = 'cpus'; - $d['cpus']['object']['attrib']['index'] = array(0,1); - $d['cpus']['object']['attrib']['options'] = $cpus; - - $d['memory']['label'] = $this->lang['form_memory']; - $d['memory']['required'] = true; - $d['memory']['object']['type'] = 'htmlobject_select'; - $d['memory']['object']['attrib']['name'] = 'memory'; - $d['memory']['object']['attrib']['index'] = array(0,1); - $d['memory']['object']['attrib']['options'] = $ram; - $d['memory']['object']['attrib']['selected'] = array(512); - - $vmtype = $this->response->html->request()->get('vmtype'); - if($vmtype === 'kvm-vm-net') { - - $d['netboot_image']['label'] = $this->lang['form_existing_disk']; - $d['netboot_image']['object']['type'] = 'htmlobject_select'; - $d['netboot_image']['object']['attrib']['index'] = array(0,1); - $d['netboot_image']['object']['attrib']['id'] = 'netboot_image'; - $d['netboot_image']['object']['attrib']['name'] = 'netboot_image'; - $d['netboot_image']['object']['attrib']['options'] = $existing_netboot_image_arr; - $d['netboot_image']['object']['attrib']['selected'] = array(''); - - $d['disk_interface'] = ""; - $d['localboot_image'] = ""; - $d['cdrom_iso_path'] = ""; - $d['cdrom_button'] = ""; - - } else { - - $d['localboot_image']['label'] = $this->lang['form_existing_disk']; - $d['localboot_image']['object']['type'] = 'htmlobject_select'; - $d['localboot_image']['object']['attrib']['index'] = array(0,1); - $d['localboot_image']['object']['attrib']['id'] = 'localboot_image'; - $d['localboot_image']['object']['attrib']['name'] = 'localboot_image'; - $d['localboot_image']['object']['attrib']['options'] = $existing_image_arr; - $d['localboot_image']['object']['attrib']['selected'] = array(''); - - $d['disk_interface']['label'] = $this->lang['form_disk_interface']; - $d['disk_interface']['required'] = true; - $d['disk_interface']['object']['type'] = 'htmlobject_select'; - $d['disk_interface']['object']['attrib']['name'] = 'disk_interface'; - $d['disk_interface']['object']['attrib']['id'] = 'disk_interface'; - $d['disk_interface']['object']['attrib']['index'] = array(0,1); - $d['disk_interface']['object']['attrib']['options'] = $disk_interfaces; - - $d['cdrom_iso_path']['label'] = $this->lang['form_cdrom']; - $d['cdrom_iso_path']['object']['type'] = 'htmlobject_input'; - $d['cdrom_iso_path']['object']['attrib']['type'] = 'text'; - $d['cdrom_iso_path']['object']['attrib']['id'] = 'cdrom'; - $d['cdrom_iso_path']['object']['attrib']['name'] = 'cdrom'; - - $d['cdrom_button']['static'] = true; - $d['cdrom_button']['object']['type'] = 'htmlobject_input'; - $d['cdrom_button']['object']['attrib']['type'] = 'button'; - $d['cdrom_button']['object']['attrib']['name'] = 'cdrom_button'; - $d['cdrom_button']['object']['attrib']['id'] = 'cdrom_button'; - $d['cdrom_button']['object']['attrib']['css'] = 'browse-button'; - $d['cdrom_button']['object']['attrib']['handler'] = 'onclick="filepicker.init(\'cdrom\'); return false;"'; - $d['cdrom_button']['object']['attrib']['style'] = "display:none;"; - $d['cdrom_button']['object']['attrib']['value'] = $this->lang['lang_browse']; - - $d['netboot_image'] = ""; - - } - - $mac = ''; - if(isset($this->resource)) { - $this->resource->generate_mac(); - $mac = $this->resource->mac; - } - - $d['net0']['label'] = $this->lang['lang_net_0']; - $d['net0']['object']['type'] = 'htmlobject_input'; - $d['net0']['object']['attrib']['type'] = 'checkbox'; - $d['net0']['object']['attrib']['id'] = 'net0'; - $d['net0']['object']['attrib']['name'] = 'net0'; - $d['net0']['object']['attrib']['value'] = 'enabled'; - $d['net0']['object']['attrib']['checked'] = true; - $d['net0']['object']['attrib']['disabled'] = true; - - $d['mac']['label'] = $this->lang['form_mac']; - $d['mac']['required'] = true; - $d['mac']['object']['type'] = 'htmlobject_input'; - $d['mac']['object']['attrib']['name'] = 'mac'; - $d['mac']['object']['attrib']['type'] = 'text'; - $d['mac']['object']['attrib']['value'] = $mac; - $d['mac']['object']['attrib']['maxlength'] = 50; - - $d['nic']['label'] = $this->lang['form_netdevice']; - $d['nic']['required'] = true; - $d['nic']['object']['type'] = 'htmlobject_select'; - $d['nic']['object']['attrib']['name'] = 'nic'; - $d['nic']['object']['attrib']['index'] = array(0,1); - $d['nic']['object']['attrib']['options'] = $nics; - - if (in_array("openvswitch-manager", $this->plugins_enabled)) { - $d['ovs_ip0']['label'] = $this->lang['form_ipaddress']; - $d['ovs_ip0']['object']['type'] = 'htmlobject_select'; - $d['ovs_ip0']['object']['attrib']['index'] = array('value', 'label'); - $d['ovs_ip0']['object']['attrib']['id'] = 'ovs_ip0'; - $d['ovs_ip0']['object']['attrib']['name'] = 'ovs_ip0'; - $d['ovs_ip0']['object']['attrib']['options'] = $ip_mgmt_list_per_user_arr; - - $d['bridge'] = ''; - - } else { - $d['bridge']['label'] = $this->lang['form_bridge']; - $d['bridge']['required'] = true; - $d['bridge']['object']['type'] = 'htmlobject_select'; - $d['bridge']['object']['attrib']['name'] = 'bridge'; - $d['bridge']['object']['attrib']['index'] = array(0,1); - $d['bridge']['object']['attrib']['options'] = $bridges; - - $d['ovs_ip0'] = ''; - - } - - // net 1 - if(isset($this->resource)) { - $this->resource->generate_mac(); - $mac = $this->resource->mac; - } - - $d['net1']['label'] = $this->lang['lang_net_1']; - $d['net1']['object']['type'] = 'htmlobject_input'; - $d['net1']['object']['attrib']['type'] = 'checkbox'; - $d['net1']['object']['attrib']['id'] = 'net1'; - $d['net1']['object']['attrib']['name'] = 'net1'; - $d['net1']['object']['attrib']['value'] = 'enabled'; - $d['net1']['object']['attrib']['handler'] = 'onchange="nettoggle(this);"'; - - $d['mac1']['label'] = $this->lang['form_mac']; - $d['mac1']['object']['type'] = 'htmlobject_input'; - $d['mac1']['object']['attrib']['name'] = 'mac1'; - $d['mac1']['object']['attrib']['type'] = 'text'; - $d['mac1']['object']['attrib']['value'] = $mac; - $d['mac1']['object']['attrib']['maxlength'] = 50; - - $d['bridge1']['label'] = $this->lang['form_bridge']; - $d['bridge1']['object']['type'] = 'htmlobject_select'; - $d['bridge1']['object']['attrib']['name'] = 'bridge1'; - $d['bridge1']['object']['attrib']['index'] = array(0,1); - $d['bridge1']['object']['attrib']['options'] = $bridges; - - $d['nic1']['label'] = $this->lang['form_netdevice']; - $d['nic1']['object']['type'] = 'htmlobject_select'; - $d['nic1']['object']['attrib']['name'] = 'nic1'; - $d['nic1']['object']['attrib']['index'] = array(0,1); - $d['nic1']['object']['attrib']['options'] = $nics; - - if (in_array("openvswitch-manager", $this->plugins_enabled)) { - $d['ovs_ip1']['label'] = $this->lang['form_ipaddress']; - $d['ovs_ip1']['object']['type'] = 'htmlobject_select'; - $d['ovs_ip1']['object']['attrib']['index'] = array('value', 'label'); - $d['ovs_ip1']['object']['attrib']['id'] = 'ovs_ip1'; - $d['ovs_ip1']['object']['attrib']['name'] = 'ovs_ip1'; - $d['ovs_ip1']['object']['attrib']['options'] = $ip_mgmt_list_per_user_arr; - } else { - $d['ovs_ip1'] = ''; - } - - // net 2 - if(isset($this->resource)) { - $this->resource->generate_mac(); - $mac = $this->resource->mac; - } - - $d['net2']['label'] = $this->lang['lang_net_2']; - $d['net2']['object']['type'] = 'htmlobject_input'; - $d['net2']['object']['attrib']['type'] = 'checkbox'; - $d['net2']['object']['attrib']['id'] = 'net2'; - $d['net2']['object']['attrib']['name'] = 'net2'; - $d['net2']['object']['attrib']['value'] = 'enabled'; - $d['net2']['object']['attrib']['handler'] = 'onchange="nettoggle(this);"'; - - $d['mac2']['label'] = $this->lang['form_mac']; - $d['mac2']['object']['type'] = 'htmlobject_input'; - $d['mac2']['object']['attrib']['name'] = 'mac2'; - $d['mac2']['object']['attrib']['type'] = 'text'; - $d['mac2']['object']['attrib']['value'] = $mac; - $d['mac2']['object']['attrib']['maxlength'] = 50; - - $d['bridge2']['label'] = $this->lang['form_bridge']; - $d['bridge2']['object']['type'] = 'htmlobject_select'; - $d['bridge2']['object']['attrib']['name'] = 'bridge2'; - $d['bridge2']['object']['attrib']['index'] = array(0,1); - $d['bridge2']['object']['attrib']['options'] = $bridges; - - $d['nic2']['label'] = $this->lang['form_netdevice']; - $d['nic2']['object']['type'] = 'htmlobject_select'; - $d['nic2']['object']['attrib']['name'] = 'nic2'; - $d['nic2']['object']['attrib']['index'] = array(0,1); - $d['nic2']['object']['attrib']['options'] = $nics; - - if (in_array("openvswitch-manager", $this->plugins_enabled)) { - $d['ovs_ip2']['label'] = $this->lang['form_ipaddress']; - $d['ovs_ip2']['object']['type'] = 'htmlobject_select'; - $d['ovs_ip2']['object']['attrib']['index'] = array('value', 'label'); - $d['ovs_ip2']['object']['attrib']['id'] = 'ovs_ip2'; - $d['ovs_ip2']['object']['attrib']['name'] = 'ovs_ip2'; - $d['ovs_ip2']['object']['attrib']['options'] = $ip_mgmt_list_per_user_arr; - } else { - $d['ovs_ip2'] = ''; - } - - // net 3 - if(isset($this->resource)) { - $this->resource->generate_mac(); - $mac = $this->resource->mac; - } - - $d['net3']['label'] = $this->lang['lang_net_3']; - $d['net3']['object']['type'] = 'htmlobject_input'; - $d['net3']['object']['attrib']['type'] = 'checkbox'; - $d['net3']['object']['attrib']['id'] = 'net3'; - $d['net3']['object']['attrib']['name'] = 'net3'; - $d['net3']['object']['attrib']['value'] = 'enabled'; - $d['net3']['object']['attrib']['handler'] = 'onchange="nettoggle(this);"'; - - $d['mac3']['label'] = $this->lang['form_mac']; - $d['mac3']['object']['type'] = 'htmlobject_input'; - $d['mac3']['object']['attrib']['name'] = 'mac3'; - $d['mac3']['object']['attrib']['type'] = 'text'; - $d['mac3']['object']['attrib']['value'] = $mac; - $d['mac3']['object']['attrib']['maxlength'] = 50; - - $d['bridge3']['label'] = $this->lang['form_bridge']; - $d['bridge3']['object']['type'] = 'htmlobject_select'; - $d['bridge3']['object']['attrib']['name'] = 'bridge3'; - $d['bridge3']['object']['attrib']['index'] = array(0,1); - $d['bridge3']['object']['attrib']['options'] = $bridges; - - $d['nic3']['label'] = $this->lang['form_netdevice']; - $d['nic3']['object']['type'] = 'htmlobject_select'; - $d['nic3']['object']['attrib']['name'] = 'nic3'; - $d['nic3']['object']['attrib']['index'] = array(0,1); - $d['nic3']['object']['attrib']['options'] = $nics; - - if (in_array("openvswitch-manager", $this->plugins_enabled)) { - $d['ovs_ip3']['label'] = $this->lang['form_ipaddress']; - $d['ovs_ip3']['object']['type'] = 'htmlobject_select'; - $d['ovs_ip3']['object']['attrib']['index'] = array('value', 'label'); - $d['ovs_ip3']['object']['attrib']['id'] = 'ovs_ip3'; - $d['ovs_ip3']['object']['attrib']['name'] = 'ovs_ip3'; - $d['ovs_ip3']['object']['attrib']['options'] = $ip_mgmt_list_per_user_arr; - } else { - $d['ovs_ip3'] = ''; - } - - // net 4 - if(isset($this->resource)) { - $this->resource->generate_mac(); - $mac = $this->resource->mac; - } - - $d['net4']['label'] = $this->lang['lang_net_4']; - $d['net4']['object']['type'] = 'htmlobject_input'; - $d['net4']['object']['attrib']['type'] = 'checkbox'; - $d['net4']['object']['attrib']['name'] = 'net4'; - $d['net4']['object']['attrib']['id'] = 'net4'; - $d['net4']['object']['attrib']['value'] = 'enabled'; - $d['net4']['object']['attrib']['handler'] = 'onchange="nettoggle(this);"'; - - $d['mac4']['label'] = $this->lang['form_mac']; - $d['mac4']['object']['type'] = 'htmlobject_input'; - $d['mac4']['object']['attrib']['name'] = 'mac4'; - $d['mac4']['object']['attrib']['type'] = 'text'; - $d['mac4']['object']['attrib']['value'] = $mac; - $d['mac4']['object']['attrib']['maxlength'] = 50; - - $d['bridge4']['label'] = $this->lang['form_bridge']; - $d['bridge4']['object']['type'] = 'htmlobject_select'; - $d['bridge4']['object']['attrib']['name'] = 'bridge4'; - $d['bridge4']['object']['attrib']['index'] = array(0,1); - $d['bridge4']['object']['attrib']['options'] = $bridges; - - $d['nic4']['label'] = $this->lang['form_netdevice']; - $d['nic4']['object']['type'] = 'htmlobject_select'; - $d['nic4']['object']['attrib']['name'] = 'nic4'; - $d['nic4']['object']['attrib']['index'] = array(0,1); - $d['nic4']['object']['attrib']['options'] = $nics; - - if (in_array("openvswitch-manager", $this->plugins_enabled)) { - $d['ovs_ip4']['label'] = $this->lang['form_ipaddress']; - $d['ovs_ip4']['object']['type'] = 'htmlobject_select'; - $d['ovs_ip4']['object']['attrib']['index'] = array('value', 'label'); - $d['ovs_ip4']['object']['attrib']['id'] = 'ovs_ip4'; - $d['ovs_ip4']['object']['attrib']['name'] = 'ovs_ip4'; - $d['ovs_ip4']['object']['attrib']['options'] = $ip_mgmt_list_per_user_arr; - } else { - $d['ovs_ip4'] = ''; - } - - - // boot from - $d['boot_cd'] = ''; - $d['boot_iso'] = ''; - $d['boot_iso_path'] = ''; - $d['boot_local'] = ''; - $d['browse_button'] = ''; - if($vmtype !== 'kvm-vm-net') { - $d['boot_cd']['label'] = $this->lang['form_boot_cd']; - $d['boot_cd']['object']['type'] = 'htmlobject_input'; - $d['boot_cd']['object']['attrib']['type'] = 'radio'; - $d['boot_cd']['object']['attrib']['name'] = 'boot'; - $d['boot_cd']['object']['attrib']['value'] = 'cdrom'; - - $d['boot_iso']['label'] = $this->lang['form_boot_iso']; - $d['boot_iso']['object']['type'] = 'htmlobject_input'; - $d['boot_iso']['object']['attrib']['type'] = 'radio'; - $d['boot_iso']['object']['attrib']['id'] = 'boot_iso'; - $d['boot_iso']['object']['attrib']['name'] = 'boot'; - $d['boot_iso']['object']['attrib']['value'] = 'iso'; - - $d['boot_iso_path']['label'] = $this->lang['form_iso_path']; - $d['boot_iso_path']['object']['type'] = 'htmlobject_input'; - $d['boot_iso_path']['object']['attrib']['type'] = 'text'; - $d['boot_iso_path']['object']['attrib']['id'] = 'iso_path'; - $d['boot_iso_path']['object']['attrib']['name'] = 'iso_path'; - - $d['boot_local']['label'] = $this->lang['form_boot_local']; - $d['boot_local']['object']['type'] = 'htmlobject_input'; - $d['boot_local']['object']['attrib']['type'] = 'radio'; - $d['boot_local']['object']['attrib']['name'] = 'boot'; - $d['boot_local']['object']['attrib']['value'] = 'local'; - $d['boot_local']['object']['attrib']['checked'] = true; - - $d['browse_button']['static'] = true; - $d['browse_button']['object']['type'] = 'htmlobject_input'; - $d['browse_button']['object']['attrib']['type'] = 'button'; - $d['browse_button']['object']['attrib']['name'] = 'browse_button'; - $d['browse_button']['object']['attrib']['id'] = 'browsebutton'; - $d['browse_button']['object']['attrib']['css'] = 'browse-button'; - $d['browse_button']['object']['attrib']['handler'] = 'onclick="filepicker.init(\'iso_path\'); return false;"'; - $d['browse_button']['object']['attrib']['style'] = "display:none;"; - $d['browse_button']['object']['attrib']['value'] = $this->lang['lang_browse']; - } - $d['boot_net']['label'] = $this->lang['form_boot_net']; - $d['boot_net']['object']['type'] = 'htmlobject_input'; - $d['boot_net']['object']['attrib']['type'] = 'radio'; - $d['boot_net']['object']['attrib']['name'] = 'boot'; - $d['boot_net']['object']['attrib']['value'] = 'network'; - if($vmtype === 'kvm-vm-net') { - $d['boot_net']['object']['attrib']['checked'] = true; - } - - $d['vnc']['label'] = $this->lang['form_vnc']; - $d['vnc']['required'] = true; - $d['vnc']['object']['type'] = 'htmlobject_input'; - $d['vnc']['object']['attrib']['name'] = 'vnc'; - $d['vnc']['object']['attrib']['id'] = 'vnc'; - $d['vnc']['object']['attrib']['type'] = 'password'; - $d['vnc']['object']['attrib']['value'] = ''; - $d['vnc']['object']['attrib']['maxlength'] = 50; - - $d['vnc_1']['label'] = $this->lang['form_vnc_repeat']; - $d['vnc_1']['required'] = true; - $d['vnc_1']['object']['type'] = 'htmlobject_input'; - $d['vnc_1']['object']['attrib']['name'] = 'vnc_1'; - $d['vnc_1']['object']['attrib']['id'] = 'vnc_1'; - $d['vnc_1']['object']['attrib']['value'] = ''; - $d['vnc_1']['object']['attrib']['type'] = 'password'; - $d['vnc_1']['object']['attrib']['maxlength'] = 50; - - $d['vnc_keymap']['label'] = $this->lang['form_vnc_keymap']; - $d['vnc_keymap']['object']['type'] = 'htmlobject_select'; - $d['vnc_keymap']['object']['attrib']['name'] = 'vnc_keymap'; - $d['vnc_keymap']['object']['attrib']['index'] = array(0,1); - $d['vnc_keymap']['object']['attrib']['options'] = $keymaps; - - $form->add($d); - $response->form = $form; - - } else { - $response->msg = $this->lang['error_no_bridge']; - $response->form = $form; - } - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.api.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.api.class.php deleted file mode 100644 index e8dc456..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.api.class.php +++ /dev/null @@ -1,199 +0,0 @@ - - */ - -class kvm_vm_api -{ - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param object $controller - */ - //-------------------------------------------- - function __construct($controller) { - $this->controller = $controller; - $this->user = $this->controller->user; - $this->html = $this->controller->response->html; - $this->response = $this->html->response(); - $this->file = $this->controller->file; - $this->admin = $this->controller->openqrm->admin(); - - $id = $this->response->html->request()->get('appliance_id'); - if($id === '') { - return false; - } - // set ENV - $this->response->params['appliance_id'] = $id; - $appliance = new appliance(); - $resource = new resource(); - - $appliance->get_instance_by_id($id); - $resource->get_instance_by_id($appliance->resources); - - $this->resource = $resource; - $this->appliance = $appliance; - #$this->statfile = 'kvm-stat/'.$resource->id.'.pick_iso_config'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - */ - //-------------------------------------------- - function action() { - $action = $this->html->request()->get($this->controller->actions_name); - switch( $action ) { - case 'filepicker': - $this->filepicker(); - break; - } - } - - - //-------------------------------------------- - /** - * Filepicker - * - * @access public - */ - //-------------------------------------------- - function filepicker() { - $response = $this->response; - $iso_path = $response->html->request()->get('path'); - if ($iso_path !== '') { - - $command = $this->controller->openqrm->get('basedir')."/plugins/kvm/bin/openqrm-kvm-vm iso"; - $command .= ' -q '.$iso_path; - $command .= ' -u '.$this->admin->name.' -p '.$this->admin->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $file = $this->controller->openqrm->get('webdir').'/plugins/kvm/kvm-stat/'.$this->resource->id.'.pick_iso_config'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $this->resource->send_command($this->resource->ip, $command); - while (!$this->file->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $lines = $this->file->get_contents($file); - $lines = explode("\n", $lines); - - if(is_array($lines) && count($lines) > 1) { - $i = 0; - foreach($lines as $c) { - $tmp = explode('@', $c); - if($tmp[0] === 'P') { - $base = $tmp[1]; - } else { - if(isset($tmp[1]) && $tmp[1] !== '.') { - $a = $response->html->a(); - $a->label = $tmp[1]; - if($tmp['1'] === '..') { - if($base !== '/') { - $path = substr($base, 0, strrpos($base,'/')); - if($path === '') { - $path = '/'; - } - $a->href = '#'; - $a->handler = 'onclick="filepicker.browse(\''.$path.'\'); return false;"'; - $a->css = 'folder'; - $body[$i]['file'] = $c; - $body[$i]['name'] = $a->get_string(); - $i++; - } - } else { - if($base !== '/') { - $tmp[1] = '/'.$tmp[1]; - } - if($tmp[0] === 'F') { - $a->handler = 'onclick="filepicker.insert(\''.$base.$tmp[1].'\'); return false;"'; - $a->href = '#'; - $a->css = 'file'; - } - if($tmp[0] === 'D') { - $a->href = '#'; - $a->handler = 'onclick="filepicker.browse(\''.$base.$tmp['1'].'\'); return false;"'; - $a->css = 'folder'; - } - $body[$i]['file'] = $c; - $body[$i]['name'] = $a->get_string(); - $i++; - } - } - } - } - } - $table = $response->html->tablebuilder('kvm_vm_api', $response); - - $head['file']['hidden'] = true; - $head['file']['sortable'] = false; - $head['name']['title'] = 'Name'; - $head['name']['map'] = 'file'; - - $table->max = count($body); - $table->limit = count($body); - $table->offset = 0; - $table->order = 'ASC'; - $table->form_action = $response->html->thisfile; - $table->form_method = 'GET'; - $table->css = 'filepicker_table'; - $table->border = 1; - $table->id = 'Table'; - $table->head = $head; - $table->body = $body; - $table->sort = 'file'; - $table->sort_form = false; - $table->sort_link = false; - $table->autosort = true; - - $table = $table->get_object(); - unset($table->__elements['pageturn_head']); - unset($table->__elements[0]); - - echo $table->get_string(); - } else { - echo 'no'; - } - - } - - //-------------------------------------------- - /** - * Get progress - * - * @access public - */ - //-------------------------------------------- - function progress() { - $name = basename($this->response->html->request()->get('name')); - $file = $this->controller->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$name; - if($this->file->exists($file)) { - echo $this->file->get_contents($file); - } else { - header("HTTP/1.0 404 Not Found"); - } - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.clone.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.clone.class.php deleted file mode 100644 index 83abdf2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.clone.class.php +++ /dev/null @@ -1,245 +0,0 @@ - - */ - -class kvm_vm_clone -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $id = $this->response->html->request()->get('appliance_id'); - if($id === '') { - return false; - } - $vm = $this->response->html->request()->get('vm'); - if($vm === '') { - return false; - } - $vm_mac = $this->response->html->request()->get('mac'); - if($vm_mac === '') { - return false; - } - $this->vm = $vm; - $this->vm_mac = $vm_mac; - $this->response->add('vm', $this->vm); - $this->response->add('mac', $this->vm_mac); - $appliance = new appliance(); - $resource = new resource(); - $appliance->get_instance_by_id($id); - $resource->get_instance_by_id($appliance->resources); - $this->resource = $resource; - $this->appliance = $appliance; - $this->statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$resource->id.'.vm_list'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->duplicate(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 2) { - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&resource_id='.$response->resource_id - ); - } else { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/kvm-vm-clone.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add(sprintf($this->lang['label'], $this->vm), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * clone - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function duplicate() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - $mac_gen_resource = new resource(); - $mac_gen_resource->generate_mac(); - $name = $form->get_request('name'); - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm-vm clone'; - $command .= ' -n '.$this->vm; - $command .= ' -w '.$name; - $command .= ' -m '.$mac_gen_resource->mac; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - $statfile = $this->statfile; - if ($this->file->exists($statfile)) { - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[1]; - if($name === $check) { - $error = sprintf($this->lang['error_exists'], $name); - } - } - } - } - } - if(isset($error)) { - $response->error = $error; - } else { - - $tables = $this->openqrm->get('table'); - $id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $ip = "0.0.0.0"; - $mac = $mac_gen_resource->mac; - // set resource type, get virt type from origin vm - $mac_gen_resource->get_instance_by_mac($this->vm_mac); - $virtualization = new virtualization(); - $virtualization->get_instance_by_id($mac_gen_resource->vtype); - // send command to the openQRM-server - $openqrm = new openqrm_server(); - $openqrm->send_command('openqrm_server_add_resource '.$id.' '.$mac.' '.$ip); - // add to openQRM database - $fields["resource_id"] = $id; - $fields["resource_ip"] = $ip; - $fields["resource_mac"] = $mac; - $fields["resource_localboot"] = 0; - $fields["resource_vtype"] = $virtualization->id; - $fields["resource_vhostid"] = $this->resource->id; - $this->resource->add($fields); - $this->resource->send_command($this->resource->ip, $command); - $response->resource_id = $id; - - $response->msg = sprintf($this->lang['msg_cloned'], $this->vm, $name); - } - - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'clone'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['css'] = 'namegen'; - $d['name']['object']['attrib']['customattribs'] = 'data-prefix="kvm" data-length="6"'; - $d['name']['object']['attrib']['value'] = $this->vm.'c'; - $d['name']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.controller.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.controller.class.php deleted file mode 100644 index 8fdaf96..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.controller.class.php +++ /dev/null @@ -1,885 +0,0 @@ - - */ - -class kvm_vm_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array ( - 'tab' => 'Select KVM Host', - 'label' => 'Select KVM Host Appliance', - 'action_edit' => 'edit', - 'table_name' => 'Name', - 'table_id' => 'Id', - 'table_recource' => 'Resource', - 'table_type' => 'Type', - 'table_deployment' => 'Deployment', - 'title_vms' => 'Edit Virtual Machines', - 'title_lvm' => 'Edit LVM Storage', - 'title_bf' => 'Edit Blockfile Storage', - 'title_glusterfs' => 'Edit GlusterFS Storage', - 'error_no_host' => 'No KVM Host Appliance configured yet!

    Please create a KVM Host Appliance first!', - 'new' => 'New Appliance', - 'network_manager' => 'Network', - 'please_wait' => 'Loading VMs. Please wait ..', - 'new_storage' => 'New Storage', - ), - 'edit' => array ( - 'tab' => 'Select VM', - 'label' => 'KVM VMs on KVM Host Appliance %s', - 'lang_id' => 'ID', - 'lang_name' => 'Name', - 'lang_resource' => 'Resource', - 'lang_state' => 'State', - 'lang_vfree' => 'Free', - 'lang_vsize' => 'Total', - 'lang_password_show' => 'show password', - 'lang_password_hide' => 'hide password', - 'action_add_local_vm' => 'Add local VM', - 'action_add_network_vm' => 'Add network VM', - 'action_remove' => 'delete', - 'action_stop' => 'stop', - 'action_start' => 'start', - 'action_reboot' => 'reboot', - 'action_update' => 'update', - 'action_console' => 'console', - 'action_migrate' => 'migrate', - 'action_clone' => 'clone', - 'action_migrate_in_progress' => 'Migration in progress - Please wait', - 'action_migrate_finished' => 'Migration finished!', - 'table_state' => 'State', - 'table_name' => 'Name', - 'table_type' => 'Type', - 'table_mac' => 'Mac', - 'table_ram' => 'RAM', - 'table_cpu' => 'CPU', - 'table_nics' => 'NIC', - 'table_id' => 'ID', - 'table_ip' => 'IP', - 'table_vnc' => 'VNC', - 'table_vncpassword' => 'VNC password', - 'table_appliance' => 'Server', - 'table_kernel' => 'Kernel', - 'table_image' => 'Image', - 'table_storage' => 'Storage', - 'error_no_host' => 'No KVM Host Appliance configured yet!

    Please create a KVM Host Appliance first!', - 'please_wait' => 'Loading VMs. Please wait ..', - ), - 'add' => array ( - 'tab' => 'Add VM', - 'label' => 'Add new VM', - 'lang_basic' => 'Basic', - 'lang_hardware' => 'Hardware', - 'lang_net' => 'Network', - 'lang_net_0' => 'Network_0', - 'lang_net_1' => 'Network_1', - 'lang_net_2' => 'Network_2', - 'lang_net_3' => 'Network_3', - 'lang_net_4' => 'Network_4', - 'lang_boot' => 'Boot from', - 'lang_vnc' => 'VNC Password', - 'lang_virtual_disk' => 'Virtual disk image', - 'lang_browse' => 'browse', - 'lang_browser' => 'Filepicker', - 'lang_password_generate' => 'generate password', - 'lang_password_show' => 'show password', - 'lang_password_hide' => 'hide password', - 'form_name' => 'Name', - 'form_cpus' => 'CPU(s)', - 'form_mac' => 'Mac', - 'form_ipaddress' => 'IP Address', - 'form_memory' => 'Memory', - 'form_bridge' => 'Bridge', - 'form_boot_cd' => 'CD', - 'form_boot_iso' => 'Iso', - 'form_iso_path' => 'Path', - 'form_boot_net' => 'Net', - 'form_boot_local' => 'Local', - 'form_existing_disk' => 'Existing disk', - 'form_enable' => 'enable', - 'form_net_virtio' => 'Virtio', - 'form_net_e1000' => 'E1000', - 'form_net_rtl8139' => 'Rtl8139', - 'form_netdevice' => 'Networkcard', - 'form_disk_interface' => 'Disk Interface', - 'form_swap' => 'Swap', - 'form_disk' => 'Disk', - 'form_cdrom' => 'Cdrom (iso)', - 'form_vnc' => 'Password', - 'form_vnc_repeat' => 'Password (repeat)', - 'form_vnc_keymap' => 'VNC Keymap', - 'action_add_vm_image' => 'Add a new VM Image', - 'msg_added' => 'Added VM %s', - 'error_exists' => 'VM %s already exists', - 'error_name' => 'Name must be %s', - 'error_memory' => 'Memory must be %s', - 'error_mac' => 'Mac is not valid', - 'error_bridge' => 'Bridge is not valid', - 'error_nic' => 'Nic is not valid', - 'error_boot' => 'Please select a boot device', - 'error_iso_path' => 'Path must not be empty', - 'error_vnc_password' => 'Password (repeat) does not match Password', - 'error_vnc_password_count' => 'Password must have at least 6 chars', - 'error_no_bridge' => 'Error: No network bridge found.', - 'please_wait' => 'Adding VM. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'update' => array ( - 'tab' => 'Update VM', - 'label' => 'Update VM %s', - 'lang_basic' => 'Basic', - 'lang_hardware' => 'Hardware', - 'lang_virtual_disk' => 'Virtual disk image', - 'lang_net' => 'Network', - 'lang_net_0' => 'Network_0', - 'lang_net_1' => 'Network_1', - 'lang_net_2' => 'Network_2', - 'lang_net_3' => 'Network_3', - 'lang_net_4' => 'Network_4', - 'lang_boot' => 'Boot from', - 'lang_vnc' => 'VNC Password', - 'lang_browse' => 'browse', - 'lang_browser' => 'Filepicker', - 'lang_password_generate' => 'generate password', - 'lang_password_show' => 'show password', - 'lang_password_hide' => 'hide password', - 'form_name' => 'Name', - 'form_cpus' => 'CPU(s)', - 'form_mac' => 'Mac', - 'form_memory' => 'Memory', - 'form_bridge' => 'Bridge', - 'form_boot_cd' => 'CD', - 'form_boot_iso' => 'Iso', - 'form_iso_path' => 'Path', - 'form_boot_net' => 'Net', - 'form_boot_local' => 'Local', - 'form_enable' => 'enable', - 'form_net_virtio' => 'Virtio', - 'form_net_e1000' => 'E1000', - 'form_net_rtl8139' => 'Rtl8139', - 'form_netdevice' => 'Networkcard', - 'form_disk_interface' => 'Disk Interface', - 'form_swap' => 'Swap', - 'form_disk' => 'Disk', - 'form_cdrom' => 'Cdrom (iso)', - 'form_vnc' => 'Password', - 'form_vnc_repeat' => 'Password (repeat)', - 'form_vnc_keymap' => 'VNC Keymap', - 'msg_updated' => 'Updated VM %s', - 'error_exists' => 'VM %s already exists', - 'error_name' => 'Name must be %s', - 'error_memory' => 'Memory must be %s', - 'error_mac' => 'Mac is not valid', - 'error_bridge' => 'Bridge is not valid', - 'error_nic' => 'Nic is not valid', - 'error_boot' => 'Please select a boot device', - 'error_iso_path' => 'Path must not be empty', - 'error_vnc_password' => 'Password (repeat) does not match Password', - 'error_vnc_password_count' => 'Password must have at least 6 chars', - 'error_no_bridge' => 'Error: No network bridge found.', - 'please_wait' => 'Updating VM. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'clone' => array ( - 'label' => 'Clone VM %s', - 'tab' => 'Clone VM', - 'msg_cloned' => 'Cloned %s as %s', - 'form_name' => 'Name', - 'error_exists' => 'VM %s allready exists', - 'error_name' => 'Name must be %s', - 'please_wait' => 'Cloning VM. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'migrate' => array ( - 'label' => 'Migrate VM %s', - 'tab' => 'Migrate VM', - 'msg_migrated' => 'Migrated %s to %s', - 'error_no_hosts' => 'No KVM Host found to migrate to', - 'form_target' => 'Target Host Resource', - 'please_wait' => 'Migrating VM. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'start' => array ( - 'msg_started' => 'Started VM %s', - ), - 'stop' => array ( - 'msg_stoped' => 'Stopped VM %s', - ), - 'reboot' => array ( - 'msg_rebooted' => 'Rebooted VM %s', - ), - 'remove' => array ( - 'label' => 'Delete VM(s)', - 'msg_removed' => 'Deleted VM %s', - 'msg_vm_resource_still_in_use' => 'VM %s resource id %s is still in use by appliance(s) %s', - 'please_wait' => 'Removing VM(s). Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->get('user'); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/kvm/lang", 'kvm-vm.ini'); - $this->tpldir = $this->rootdir.'/plugins/kvm/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "edit"; - } - if($this->action !== 'select') { - $this->response->params['appliance_id'] = $this->response->html->request()->get('appliance_id'); - } - $content = array(); - switch( $this->action ) { - case '': - case 'select': - $content[] = $this->select(true); - break; - case 'edit': - $content[] = $this->select(false); - $content[] = $this->edit(true); - break; - case 'reload': - $this->action = 'edit'; - $content[] = $this->select(false); - $content[] = $this->edit(true); - $this->reload(); - break; - case 'add': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->add(true); - break; - case 'update': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->update(true); - break; - case 'clone': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->duplicate(true); - break; - case 'migrate': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->migrate(true); - break; - case $this->lang['edit']['action_remove']: - case 'remove': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->remove(true); - break; - case $this->lang['edit']['action_start']: - case 'start': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->start(true); - break; - case $this->lang['edit']['action_stop']: - case 'stop': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->stop(true); - break; - case $this->lang['edit']['action_reboot']: - case 'reboot': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->reboot(true); - break; - case 'sysinfo': - $content[] = $this->select(false); - $content[] = $this->sysinfo(true); - break; - // to pick an iso image for boot - case 'iso': - $content[] = $this->iso(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * API - * - * @access public - */ - //-------------------------------------------- - function api() { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.api.class.php'); - $controller = new kvm_vm_api($this); - $controller->action(); - } - - - //-------------------------------------------- - /** - * Select KVM VM Host - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.select.class.php'); - $controller = new kvm_vm_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Edit KVM-VM - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function edit( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - if($this->reload()) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.edit.class.php'); - $controller = new kvm_vm_edit($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['edit']; - $data = $controller->action(); - } - } - $content['label'] = $this->lang['edit']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'edit' ); - $content['onclick'] = false; - if($this->action === 'edit'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add new VM - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function add( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - if($this->reload() && $this->reload_bridges()) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.add.class.php'); - $controller = new kvm_vm_add($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['add']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - } - $content['label'] = $this->lang['add']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'add' ); - $content['onclick'] = false; - if($this->action === 'add'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Update VM - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function update( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - if($this->reload() && $this->reload_bridges()) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.update.class.php'); - $controller = new kvm_vm_update($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['update']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - } - $content['label'] = $this->lang['update']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'update' ); - $content['onclick'] = false; - if($this->action === 'update'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Clone VM - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function duplicate( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - if($this->reload()) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.clone.class.php'); - $controller = new kvm_vm_clone($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['clone']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - } - $content['label'] = $this->lang['clone']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'clone' ); - $content['onclick'] = false; - if($this->action === 'clone'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Migrate VM - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function migrate( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.migrate.class.php'); - $controller = new kvm_vm_migrate($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['migrate']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['migrate']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'migrate' ); - $content['onclick'] = false; - if($this->action === 'migrate'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Remove VM - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function remove( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.remove.class.php'); - $controller = new kvm_vm_remove($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['remove']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Remove'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'remove' ); - $content['onclick'] = false; - if($this->action === 'remove' || $this->action === $this->lang['edit']['action_remove']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Start VM - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function start( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.start.class.php'); - $controller = new kvm_vm_start($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['start']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Start'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'start' ); - $content['onclick'] = false; - if($this->action === 'start' || $this->action === $this->lang['edit']['action_start']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Stop VM - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function stop( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.stop.class.php'); - $controller = new kvm_vm_stop($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['stop']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Stop'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'stop' ); - $content['onclick'] = false; - if($this->action === 'stop' || $this->action === $this->lang['edit']['action_stop']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Reboot VM - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function reboot( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.reboot.class.php'); - $controller = new kvm_vm_reboot($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['reboot']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Reboot'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'reboot' ); - $content['onclick'] = false; - if($this->action === 'reboot' || $this->action === $this->lang['edit']['action_reboot']){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Pick iso - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function iso( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.iso.class.php'); - $controller = new kvm_vm_iso($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = array(); - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Pick ISO Image'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'iso' ); - $content['onclick'] = false; - if($this->action === 'iso'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Sysinfo - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function sysinfo( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.sysinfo.class.php'); - $controller = new kvm_vm_sysinfo($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = array(); - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Sysinfo'; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'sysinfo' ); - $content['onclick'] = false; - if($this->action === 'sysinfo'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Reload VMs - * - * @access public - */ - //-------------------------------------------- - function reload() { - $OPENQRM_SERVER_BASE_DIR = $this->openqrm->get('basedir'); - $command = $OPENQRM_SERVER_BASE_DIR.'/plugins/kvm/bin/openqrm-kvm-vm post_vm_list'; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - $id = $this->response->html->request()->get('appliance_id'); - $appliance = new appliance(); - $appliance->get_instance_by_id($id); - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $file = $OPENQRM_SERVER_BASE_DIR.'/plugins/kvm/web/kvm-stat/'.$resource->id.'.vm_list'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - return true; - } - - //-------------------------------------------- - /** - * Reload Bridges - * - * @access public - */ - //-------------------------------------------- - function reload_bridges() { - $OPENQRM_SERVER_BASE_DIR = $this->openqrm->get('basedir'); - $command = $OPENQRM_SERVER_BASE_DIR.'/plugins/kvm/bin/openqrm-kvm-vm post_bridge_config'; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - $id = $this->response->html->request()->get('appliance_id'); - $appliance = new appliance(); - $appliance->get_instance_by_id($id); - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $file = $OPENQRM_SERVER_BASE_DIR.'/plugins/kvm/web/kvm-stat/'.$resource->id.'.bridge_config'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - return true; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.edit.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.edit.class.php deleted file mode 100644 index 0767dd3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.edit.class.php +++ /dev/null @@ -1,444 +0,0 @@ - - */ - -class kvm_vm_edit -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* identifier name -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->response->add('appliance_id', $this->response->html->request()->get('appliance_id')); - } - - //-------------------------------------------- - /** - * Init - * - * @access public - */ - //-------------------------------------------- - function init() { - $id = $this->response->html->request()->get('appliance_id'); - if($id === '') { - return false; - } - $appliance = new appliance(); - $resource = new resource(); - $appliance->get_instance_by_id($id); - $resource->get_instance_by_id($appliance->resources); - $this->resource = $resource; - $this->appliance = $appliance; - $this->statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$resource->id.'.vm_list'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->init(); - $data = $this->edit(); - if($data !== false) { - $t = $this->response->html->template($this->tpldir.'/kvm-vm-edit.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($data); - $t->add($this->lang['lang_id'], 'lang_id'); - $t->add($this->lang['lang_name'], 'lang_name'); - $t->add($this->lang['lang_resource'], 'lang_resource'); - $t->add($this->lang['lang_state'], 'lang_state'); - $t->add($this->lang['lang_password_show'], 'lang_password_show'); - $t->add($this->lang['lang_password_hide'], 'lang_password_hide'); - $t->add(sprintf($this->lang['label'], $data['name']), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } else { - $msg = sprintf($this->lang['error_no_host'], $this->response->html->request()->get('appliance_id')); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return array|false - */ - //-------------------------------------------- - function edit() { - $resource_icon_default = "/img/resource.png"; - $storage_icon = "/plugins/kvm/img/plugin.png"; - //$state_icon = $this->openqrm->get('baseurl')."/img/".$this->resource->state.".png"; - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default = $storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - // check if we have a plugin implementing the remote console - $remote_console = false; - $plugin = new plugin(); - $enabled_plugins = $plugin->enabled(); - foreach ($enabled_plugins as $index => $plugin_name) { - //$plugin_remote_console_running = $this->openqrm->get('webdir')."/plugins/".$plugin_name."/.running"; - $plugin_remote_console_hook = $this->openqrm->get('webdir')."/plugins/".$plugin_name."/openqrm-".$plugin_name."-remote-console-hook.php"; - if ($this->file->exists($plugin_remote_console_hook)) { - require_once "$plugin_remote_console_hook"; - $link_function = str_replace("-", "_", "openqrm_"."$plugin_name"."_remote_console"); - if(function_exists($link_function)) { - $remote_functions[] = $link_function; - $remote_console = true; - } - } - } - // prepare list of all Host resource id for the migration select - // we need a select with the ids/ips from all resources which - // are used by appliances with kvm capabilities - $kvm_hosts = array(); - $appliance_list = new appliance(); - $appliance_list_array = $appliance_list->get_list(); - foreach ($appliance_list_array as $index => $app) { - $appliance_kvm_host_check = new appliance(); - $appliance_kvm_host_check->get_instance_by_id($app["value"]); - // only active appliances - if ((!strcmp($appliance_kvm_host_check->state, "active")) || ($appliance_kvm_host_check->resources == 0)) { - $virtualization = new virtualization(); - $virtualization->get_instance_by_id($appliance_kvm_host_check->virtualization); - if ((!strcmp($virtualization->type, "kvm")) && (!strstr($virtualization->type, "kvm-vm"))) { - $kvm_host_resource = new resource(); - $kvm_host_resource->get_instance_by_id($appliance_kvm_host_check->resources); - // exclude source host - #if ($kvm_host_resource->id == $this->resource->id) { - # continue; - #} - // only active appliances - if (!strcmp($kvm_host_resource->state, "active")) { - $migration_select_label = "Res. ".$kvm_host_resource->id."/".$kvm_host_resource->ip; - $kvm_hosts[] = array("value"=>$kvm_host_resource->id, "label"=> $migration_select_label,); - } - } - } - } - - $d['state'] = ''.$this->resource->state.''; - $d['resource'] = $this->resource->id.' / '.$this->resource->ip; - $d['name'] = $this->appliance->name; - $d['id'] = $this->appliance->id; - - $a = $this->response->html->a(); - $a->label = $this->lang['action_add_local_vm']; - $a->css = 'add'; - $a->handler = 'onclick="wait();"'; - $a->href = $this->response->get_url($this->actions_name, "add").'&vmtype=kvm-vm-local'; - $d['add_local_vm'] = $a->get_string(); - - // only show network deployment VMs if dhcpd is enabled - $plugin = $this->openqrm->plugin(); - $enabled_plugins = $plugin->enabled(); - if (in_array("dhcpd", $enabled_plugins)) { - $a = $this->response->html->a(); - $a->label = $this->lang['action_add_network_vm']; - $a->css = 'add'; - $a->handler = 'onclick="wait();"'; - $a->href = $this->response->get_url($this->actions_name, "add").'&vmtype=kvm-vm-net'; - $d['add_network_vm'] = $a->get_string(); - } else { - $d['add_network_vm'] = ''; - } - - $body = array(); - $identifier_disabled = array(); - $file = $this->statfile; - if($this->file->exists($file)) { - $lines = explode("\n", $this->file->get_contents($file)); - if(count($lines) >= 1) { - $i = 0; - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - - $state = $line[0]; - $name = $line[1]; - $mac = $line[2]; - - $resource = new resource(); - $resource->get_instance_by_mac($mac); - if ($resource->vhostid != $this->resource->id) { - continue; - } - $res_virtualization = new virtualization(); - $res_virtualization->get_instance_by_id($resource->vtype); - - $update = ''; - $a = $this->response->html->a(); - $a->title = $this->lang['action_update']; - $a->label = $this->lang['action_update']; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($this->actions_name, "update").'&vm='.$name.'&vmtype='.$res_virtualization->type; - $update_link = $a->get_string(); - - $clone = ''; - $a = $this->response->html->a(); - $a->title = $this->lang['action_clone']; - $a->label = $this->lang['action_clone']; - $a->handler = 'onclick="wait();"'; - $a->css = 'clone'; - $a->href = $this->response->get_url($this->actions_name, "clone").'&vm='.$name.'&mac='.$mac; - $clone_link = $a->get_string(); - - if ($res_virtualization->type == 'kvm-vm-local') { - if(($state === '0') && ($resource->image === 'idle')) { - $update = $update_link; - $clone = $clone_link; - } - } - if ($res_virtualization->type == 'kvm-vm-net') { - if(($state !== '2') && ($resource->image === 'idle')) { - $update = $update_link; - $clone = $clone_link; - } - } - - $migrate = ''; - $a = $this->response->html->a(); - $a->title = $this->lang['action_migrate']; - $a->label = $this->lang['action_migrate']; - $a->handler = 'onclick="wait();"'; - $a->css = 'migrate'; - $a->href = $this->response->get_url($this->actions_name, "migrate").'&vm='.$name.'&mac='.$mac; - if(count($kvm_hosts) >= 1 && $state === '1') { - $migrate = $a->get_string(); - } - - $vnc_password_input = ""; - $vnc_password_input .= " "; - - - $data = ''.$this->lang['table_id'].': '.$resource->id.'
    '; - $data .= ''.$this->lang['table_name'].': '.$name.'
    '; - $data .= ''.$this->lang['table_type'].': '.$res_virtualization->name.'
    '; - $data .= ''.$this->lang['table_ip'].': '.$resource->ip.'
    '; - $data .= ''.$this->lang['table_mac'].': '.$mac.'
    '; - $data .= ''.$this->lang['table_cpu'].': '.$line[3].'
    '; - $data .= ''.$this->lang['table_ram'].': '.$line[4].'
    '; - $data .= ''.$this->lang['table_nics'].': '.$resource->nics; - - $appliance = new appliance(); - $appliance->get_instance_by_virtualization_and_resource($resource->vtype, $resource->id); - $server = array(); - $server[0] = ''; - $server[1] = '1000000000000000000000000'; - if($appliance->id !== '') { - $kernel = new kernel(); - $kernel->get_instance_by_id($appliance->kernelid); - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - - $s = ''.$this->lang['table_appliance'].': '.$appliance->id.'
    '; - $s .= ''.$this->lang['table_name'].': '.$appliance->name.'
    '; - $s .= ''.$this->lang['table_kernel'].': '.$kernel->name.'
    '; - $s .= ''.$this->lang['table_image'].': '.$image->name.'
    '; - $s .= ''.$this->lang['table_storage'].': '.$storage->name.'

    '; - - $s .= ''.$this->lang['table_vnc'].': '.$line[5].'
    '; - $s .= ''.$this->lang['table_vncpassword'].': '.$vnc_password_input.'
    '; - - - $server[0] = $s; - $server[1] = $appliance->id; - } - - $console = ''; - if($state === '2') { - $t = $this->response->html->template($this->openqrm->get('webdir').'/js/openqrm-progressbar.js'); - $identifier_disabled[] = $name; - // progressbar - $t->add(uniqid('b'), 'id'); - $t->add($this->openqrm->get('baseurl').'/api.php?action=plugin&plugin=kvm&controller=kvm-vm&kvm_vm_action=progress&name='.$name.'.vm_migration_progress', 'url'); - $t->add($this->lang['action_migrate_in_progress'], 'lang_in_progress'); - $t->add($this->lang['action_migrate_finished'], 'lang_finished'); - $console = $t->get_string(); - } else { - if($remote_console === true && $resource->imageid !== 1 && $state === '1') { - foreach($remote_functions as $function) { - $a = $function($resource->id); - if(is_object($a)) { - $console .= $a->get_string(); - } - } - } - } - - $state = array(); - $state[0] = 'idle'; - $state[1] = 'i'; - if(($line[0] === '1') && ($resource->image !== 'idle')) { - $state[0] = 'active'; - $state[1] = 'a'; - } - if (($res_virtualization->type == 'kvm-vm-net') && ($line[0] === '0')) { - $state[0] = 'off'; - $state[1] = 'o'; - } - - - $action = ''; - if(!in_array($name, $identifier_disabled)) { - $action = $update.$clone.$migrate; - } - - $body[$i] = array( - 'state' => $state[0], - 'state_s' => $state[1], - 'name' => $name, - 'id' => $resource->id, - 'mac' => $mac, - 'cpu' => $line[3], - 'ram' => $line[4], - 'ip' => $resource->ip, - 'vnc' => $line[5], - 'data' => $data, - 'appliance' => $server[0], - 'appliance_s' => $server[1], - 'plugins' => $console, - 'action' => $action, - ); - } - $i++; - } - } - } - - $h['state']['title'] = $this->lang['table_state']; - $h['state']['sortable'] = false; - $h['state_s']['title'] = $this->lang['table_state']; - $h['state_s']['sortable'] = true; - $h['state_s']['hidden'] = true; - $h['id']['title'] = $this->lang['table_id']; - $h['id']['hidden'] = true; - $h['name']['title'] = $this->lang['table_name']; - $h['name']['hidden'] = true; - $h['ip']['title'] = $this->lang['table_ip']; - $h['ip']['hidden'] = true; - $h['mac']['title'] = $this->lang['table_mac']; - $h['mac']['hidden'] = true; - $h['vnc']['title'] = $this->lang['table_vnc']; - $h['vnc']['hidden'] = true; - $h['cpu']['title'] = $this->lang['table_cpu']; - $h['cpu']['hidden'] = true; - $h['ram']['title'] = $this->lang['table_ram']; - $h['ram']['hidden'] = true; - $h['nics']['title'] = $this->lang['table_nics']; - $h['nics']['hidden'] = true; - $h['data']['title'] = ' '; - $h['data']['sortable'] = false; - $h['appliance']['title'] = ' '; - $h['appliance']['sortable'] = false; - $h['appliance_s']['title'] = $this->lang['table_appliance']; - $h['appliance_s']['sortable'] = true; - $h['appliance_s']['hidden'] = true; - $h['plugins']['title'] = ' '; - $h['plugins']['sortable'] = false; - $h['action']['title'] = ' '; - $h['action']['sortable'] = false; - - $table = $this->response->html->tablebuilder('kvm_vm_edit', $this->response->get_array($this->actions_name, 'edit')); - $table->sort = 'name'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = count($body); - $table->autosort = true; - $table->sort_link = false; - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $body; - $table->identifier = 'name'; - $table->identifier_name = $this->identifier_name; - $table->identifier_disabled = $identifier_disabled; - $table->actions_name = $this->actions_name; - $table->actions = array( - array('start' => $this->lang['action_start']), - array('stop' => $this->lang['action_stop']), - array('reboot' => $this->lang['action_reboot']), - array('remove' => $this->lang['action_remove']) - ); - - $d['table'] = $table->get_string(); - return $d; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.iso.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.iso.class.php deleted file mode 100644 index 51fbe89..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.iso.class.php +++ /dev/null @@ -1,227 +0,0 @@ - - */ - -class kvm_vm_iso -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $id = $this->response->html->request()->get('appliance_id'); - if($id === '') { - return false; - } - $appliance = new appliance(); - $resource = new resource(); - $appliance->get_instance_by_id($id); - $resource->get_instance_by_id($appliance->resources); - $this->resource = $resource; - $this->appliance = $appliance; - $this->statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$resource->id.'.pick_iso_config'; - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { -// $response = $this->iso(); - - #$this->response->redirect( - # $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response) - #); -// echo $response; - - $this->iso(); - } - - //-------------------------------------------- - /** - * ISO - * - * @access public - * @return htmlobject_response - * - * - * for testing - * http://cloud/openqrm/base/plugins/kvm/index-vm.php?appliance_id=&kvm_vm_action=iso&appliance_id=2&path=/tmp - * - */ - //-------------------------------------------- - function iso() { - $response = $this->response; - - $iso_path = $response->html->request()->get('path'); - - // TODO better validation - if ($iso_path !== '') { - - $command = $this->openqrm->get('basedir')."/plugins/kvm/bin/openqrm-kvm-vm iso"; - $command .= ' -q '.$iso_path; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $file = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$this->resource->id.'.pick_iso_config'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $this->resource->send_command($this->resource->ip, $command); - while (!$this->file->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $lines = $this->file->get_contents($file); - $lines = explode("\n", $lines); - - if(is_array($lines) && count($lines) > 1) { - $i = 0; - foreach($lines as $c) { - $tmp = explode('@', $c); - if($tmp[0] === 'P') { - $base = $tmp[1]; - } else { - if($tmp[1] !== '.') { - $a = $response->html->a(); - $a->label = $tmp[1]; - if($tmp['1'] === '..') { - if($base !== '/') { - $path = substr($base, 0, strrpos($base,'/')); - if($path === '') { - $path = '/'; - } - $a->href = $response->get_url($this->actions_name, 'iso' ).'&path='.$path; - $a->css = 'folder'; - $body[$i]['file'] = $c; - $body[$i]['name'] = $a->get_string(); - $i++; - } - } else { - if($tmp[0] === 'F') { - $a->handler = 'onclick="alert(\''.$base.'/'.$tmp[1].'\');"'; - $a->css = 'file'; - } - if($tmp[0] === 'D') { - $a->href = $response->get_url($this->actions_name, 'iso' ).'&path='.$base.'/'.$tmp['1']; - $a->css = 'folder'; - } - $body[$i]['file'] = $c; - $body[$i]['name'] = $a->get_string(); - $i++; - } - } - } - } - } - - - $table = $response->html->tablebuilder('kvm_vm_iso', $response); - - $head['file']['hidden'] = true; - $head['file']['sortable'] = false; - $head['name']['title'] = 'Name'; - $head['name']['map'] = 'file'; - - $table->max = count($body); - $table->limit = count($body); - $table->offset = 0; - $table->order = 'ASC'; - $table->form_action = $html->thisfile; - $table->form_method = 'GET'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->id = 'Table'; - $table->head = $head; - $table->body = $body; - $table->sort = 'file'; - $table->sort_form = false; - $table->sort_link = false; - $table->autosort = true; - - $table = $table->get_object(); - unset($table->__elements['pageturn_head']); - unset($table->__elements[0]); - - - echo $table->get_string(); - - - } else { - echo 'no'; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.migrate.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.migrate.class.php deleted file mode 100644 index 842af66..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.migrate.class.php +++ /dev/null @@ -1,285 +0,0 @@ - - */ - -class kvm_vm_migrate -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $id = $this->response->html->request()->get('appliance_id'); - if($id === '') { - return false; - } - $vm = $this->response->html->request()->get('vm'); - if($vm === '') { - return false; - } - $this->vm = $vm; - $this->response->params['vm'] = $this->vm; - $mac = $this->response->html->request()->get('mac'); - if($mac === '') { - return false; - } - $this->mac = $mac; - $this->response->params['mac'] = $this->mac; - $appliance = new appliance(); - $resource = new resource(); - $appliance->get_instance_by_id($id); - $resource->get_instance_by_id($appliance->resources); - $this->resource = $resource; - $this->appliance = $appliance; - $this->statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$resource->id.'.vm_list'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->migrate(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/kvm-vm-migrate.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add(sprintf($this->lang['label'], $this->vm), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * clone - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function migrate() { - $response = $this->get_response(); - if(isset($response->msg)) { - return $response; - } - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - $target = $form->get_request('target'); - $vm_resource = new resource(); - $vm_resource->get_instance_by_mac($this->mac); - $dest_host_resource = new resource(); - $dest_host_resource->get_instance_by_id($target); - $source_host_resource = new resource(); - $source_host_resource->get_instance_by_id($vm_resource->vhostid); - - // first transfer the VM config from source to destination - $tstatfile=$this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$this->vm.'.transfer_status'; - if ($this->file->exists($tstatfile)) { - $this->file->remove($tstatfile); - } - $t_command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm-vm transfer_vm_config'; - $t_command .= ' -n '.$this->vm; - $t_command .= ' -k '.$dest_host_resource->ip; - $t_command .= ' -k1 '.$source_host_resource->ip; - $t_command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $t_command .= ' --openqrm-ui-user '.$this->user->name; - $t_command .= ' --openqrm-cmd-mode background'; - - $openqrm = new openqrm_server(); - $openqrm->send_command($t_command, NULL, true); - - while (!$this->file->exists($tstatfile)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $msg = trim($this->file->get_contents($tstatfile)); - if($msg !== "ok") { - $response->error = $msg; - return $response; - } - - // calcuate the migration port - list($o1, $o2, $o3, $o4) = explode(".", $vm_resource->ip, 4); - $kvm_vm_migration_port = $o4 + 6000; - - - // start as incoming on destination - $s_command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm-vm start_as_incoming'; - $s_command .= ' -n '.$this->vm; - $s_command .= ' -j '.$kvm_vm_migration_port; - $s_command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $s_command .= ' --openqrm-ui-user '.$this->user->name; - $s_command .= ' --openqrm-cmd-mode background'; - - $statfile=$this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$this->vm.'.vm_migrated_successfully'; - if ($this->file->exists($statfile)) { - $this->file->remove($statfile); - } - - $dest_host_resource->send_command($dest_host_resource->ip, $s_command); - sleep(5); - - $m_command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm-vm migrate'; - $m_command .= ' -n '.$this->vm; - $m_command .= ' -k '.$dest_host_resource->ip; - $m_command .= ' -j '.$kvm_vm_migration_port; - $m_command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $m_command .= ' --openqrm-ui-user '.$this->user->name; - $m_command .= ' --openqrm-cmd-mode background'; - $this->resource->send_command($this->resource->ip, $m_command); - - $fields=array(); - $fields["resource_vhostid"] = $dest_host_resource->id; - $vm_resource->update_info($vm_resource->id, $fields); - - $response->msg = sprintf($this->lang['msg_migrated'], $this->vm, $dest_host_resource->id.' / '.$dest_host_resource->ip); - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'migrate'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $targets = array(); - $list = array(); - if(isset($this->appliance)) { - $list = $this->appliance->get_list(); - } - foreach ($list as $key => $app) { - $appliance = new appliance(); - $appliance->get_instance_by_id($app["value"]); - // only active appliances - if ((!strcmp($appliance->state, "active")) || ($appliance->resources == 0)) { - $virtualization = new virtualization(); - $virtualization->get_instance_by_id($appliance->virtualization); - if ((!strcmp($virtualization->type, "kvm")) && (!strstr($virtualization->type, "kvm-vm"))) { - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - // exclude source host - if ($resource->id === $this->resource->id) { - continue; - } - // only active appliances - if (!strcmp($resource->state, "active")) { - $label = $resource->id." / ".$resource->ip; - $targets[] = array($resource->id, $label); - } - } - } - } - - if(count($targets) >= 1 ) { - $d['target']['label'] = $this->lang['form_target']; - $d['target']['required'] = true; - $d['target']['object']['type'] = 'htmlobject_select'; - $d['target']['object']['attrib']['name'] = 'target'; - $d['target']['object']['attrib']['index'] = array(0,1); - $d['target']['object']['attrib']['options'] = $targets; - $form->add($d); - $response->form = $form; - } else { - $response->msg = $this->lang['error_no_hosts']; - } - return $response; - } - -} - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.reboot.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.reboot.class.php deleted file mode 100644 index 6a6c256..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.reboot.class.php +++ /dev/null @@ -1,142 +0,0 @@ - - */ - -class kvm_vm_reboot -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->reboot(); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response) - ); - } - - //-------------------------------------------- - /** - * Stop - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function reboot() { - $response = ''; - $vms = $this->response->html->request()->get($this->identifier_name); - if( $vms !== '' ) { - $appliance = $this->openqrm->appliance(); - $appliance->get_instance_by_id($this->response->html->request()->get('appliance_id')); - $server = $this->openqrm->resource(); - $server->get_instance_by_id($appliance->resources); - - $resource = $this->openqrm->resource(); - $virttype = $this->openqrm->virtualization(); - $errors = array(); - $message = array(); - foreach($vms as $key => $vm) { - $resource->get_instance_id_by_hostname($vm); - $resource->get_instance_by_id($resource->id); - $virttype->get_instance_by_id($resource->vtype); - - $file = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$resource->id.'.vm_list'; - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm-vm reboot -n '.$vm; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' -y '.$virttype->type; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $server->send_command($resource->ip, $command); - $message[] = sprintf($this->lang['msg_rebooted'], $vm); - } - if(count($errors) === 0) { - $response = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response = join('
    ', $msg); - } - } else { - $response = ''; - } - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.remove.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.remove.class.php deleted file mode 100644 index 8b7d9ef..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.remove.class.php +++ /dev/null @@ -1,282 +0,0 @@ - - */ - -class kvm_vm_remove -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - - require_once $this->openqrm->get('basedir').'/plugins/ip-mgmt/web/class/ip-mgmt.class.php'; - $ip_mgmt = new ip_mgmt(); - $this->ip_mgmt = $ip_mgmt; - - $this->plugin = new plugin(); - $this->plugins_enabled = $this->plugin->enabled(); - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->remove(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/kvm-vm-remove.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($response->form); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Remove - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function remove() { - $event = new event(); - $response = $this->get_response(); - $vms = $response->html->request()->get($this->identifier_name); - $form = $response->form; - $openqrm_resource = new resource(); - $openqrm_resource->get_instance_by_id(0); - - if( $vms !== '' ) { - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $i = 0; - foreach($vms as $ex) { - $d['param_f'.$i]['label'] = $ex; - $d['param_f'.$i]['object']['type'] = 'htmlobject_input'; - $d['param_f'.$i]['object']['attrib']['type'] = 'checkbox'; - $d['param_f'.$i]['object']['attrib']['name'] = $this->identifier_name.'['.$i.']'; - $d['param_f'.$i]['object']['attrib']['value'] = $ex; - $d['param_f'.$i]['object']['attrib']['checked'] = true; - $i++; - } - $form->add($d); - if(!$form->get_errors() && $response->submit()) { - $appliance_id = $this->response->html->request()->get('appliance_id'); - $appliance = new appliance(); - $resource = new resource(); - $errors = array(); - $message = array(); - foreach($vms as $key => $vm) { - $appliance->get_instance_by_id($appliance_id); - $resource->get_instance_by_id($appliance->resources); - $file = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$resource->id.'.vm_list'; - if($this->file->exists($file)) { - $lines = explode("\n", $this->file->get_contents($file)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($vm === $line[1]) { - $kvm = new resource(); - $kvm->get_instance_by_mac($line[2]); - - // check if it is still in use - $appliances_using_resource = $appliance->get_ids_per_resource($kvm->id); - if (count($appliances_using_resource) > 0) { - $appliances_using_resource_str = implode(",", $appliances_using_resource[0]); - $errors[] = sprintf($this->lang['msg_vm_resource_still_in_use'], $vm, $kvm->id, $appliances_using_resource_str); - } else { - - // remove all nics by mac from dhcpd - if($line[7] !== '') { - $openqrm_resource = new resource(); - $openqrm_resource->get_instance_by_id(0); - $all_mac_array = explode(',', $line[7]); - foreach ($all_mac_array as $addional_mac) { - if ($addional_mac == '') { - continue; - } - $dhcpd_remove_command = $this->openqrm->get('basedir').'/plugins/dhcpd/bin/openqrm-dhcpd-manager remove_by_mac -m '.$addional_mac; - $dhcpd_remove_command .= ' --openqrm-cmd-mode background'; - $event->log("console", $_SERVER['REQUEST_TIME'], 5, "kvm-storge-vm.remove.class.php", 'Removing '.$addional_mac.' from dhcpd server.', "", "", 0, 0, $kvm->id); - $openqrm_resource->send_command($openqrm_resource->ip, $dhcpd_remove_command); - } - } - - - // remove all ips from dns - $kvm_ip_id_array = $this->ip_mgmt->get_ids_per_resource($kvm->id); - foreach($kvm_ip_id_array as $kvm_ip_id) { - - $ovs_ip_array = $this->ip_mgmt->get_instance('id', $kvm_ip_id); - $ovs_ip_mgmt_address = trim($ovs_ip_array['ip_mgmt_address']); - $ovs_ip_mgmt_domain = trim($ovs_ip_array['ip_mgmt_domain']); - - $dns_command = $this->openqrm->get('basedir').'/plugins/dns/bin/openqrm-dns-domain-manager remove_host'; - $dns_command .= ' -n '.$ovs_ip_mgmt_domain; - $dns_command .= ' -i '.$ovs_ip_mgmt_address; - $dns_command .= ' -q '.$kvm->vname; - $openqrm_resource->send_command($openqrm_resource->ip, $dns_command); - - $ovs_update_array['ip_mgmt_resource_id'] = NULL; - $this->ip_mgmt->update_ip($kvm_ip_id, $ovs_update_array); - - } - - - $kvm->remove($kvm->id, $line[2]); - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm-vm delete -n '.$vm; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - $resource->send_command($resource->ip, $command); - $form->remove($this->identifier_name.'['.$key.']'); - $message[] = sprintf($this->lang['msg_removed'], $vm); - - // stop remote console - $tmp = explode(':',$line[5]); - $server = $tmp[0]; - $port = $tmp[1]; - $mac = $line[2]; - $rid = $kvm->id; - $plugin = new plugin(); - $enabled = $plugin->enabled(); - foreach ($enabled as $index => $name) { - $running = $this->openqrm->get('webdir').'/plugins/'.$name.'/.running'; - $hook = $this->openqrm->get('webdir').'/plugins/'.$name.'/openqrm-'.$name.'-remote-console-hook.php'; - if (file_exists($hook)) { - if (file_exists($running)) { - $event->log("console", $_SERVER['REQUEST_TIME'], 5, "kvm-storge-vm.remove.class.php", 'Stopping '.$name.' remote console.', "", "", 0, 0, $kvm->id); - require_once($hook); - $console_function = 'openqrm_'.$name.'_disable_remote_console'; - $console_function = str_replace("-", "_", $console_function); - $console_function($server, $port, $rid, $mac, $vm); - } - } - } - } - } - } - } - } - } - } - if(count($errors) === 0) { - $response->msg = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response->error = join('
    ', $msg); - } - } - } else { - $response->msg = ''; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'remove'); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.select.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.select.class.php deleted file mode 100644 index 7a0a00e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.select.class.php +++ /dev/null @@ -1,291 +0,0 @@ - - */ - -class kvm_vm_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $table = $this->select(); - $t = $this->response->html->template($this->tpldir.'/kvm-vm-select.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($table, 'table'); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return htmlobject_tablebulider | htmlobject_div - */ - //-------------------------------------------- - function select() { - // set ENV - $resource = $this->openqrm->resource(); - $virtualization = $this->openqrm->virtualization(); - $virtualization->get_instance_by_type("kvm"); - $appliance = $this->openqrm->appliance(); - $storage = $this->openqrm->storage(); - $deployment = $this->openqrm->deployment(); - - $table = $this->response->html->tablebuilder('kvm_vm', $this->response->get_array($this->actions_name, 'select')); - $table->sort = 'appliance_id'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = $appliance->get_count_per_virtualization($virtualization->id); - $table->autosort = false; - $table->sort_link = false; - $table->init(); - - // handle tab in tab - if($this->response->html->request()->get('iplugin') !== '') { - $strControler = 'icontroller'; - } - else if($this->response->html->request()->get('rplugin') !== '') { - $strControler = 'rcontroller'; - } - else if($this->response->html->request()->get('aplugin') !== '') { - $strControler = 'acontroller'; - } else { - $strControler = 'controller'; - } - - // storages - $deployment->get_instance_by_type('kvm'); - $storages = $storage->display_overview(0, 10000, 'storage_id', 'ASC'); - $s = array(); - if(count($storages) >= 1) { - foreach($storages as $k => $v) { - $storage->get_instance_by_id($v["storage_id"]); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - if($deployment->storagetype === 'kvm') { - // replace id by string - $v['storage_type'] = $deployment->type; - $s[] = $v; - } - } - } - - $servers = $appliance->display_overview_per_virtualization($virtualization->id, $table->offset, $table->limit, $table->sort, $table->order); - - if(count($servers) >= 1) { - foreach($servers as $k => $v) { - $resource->get_instance_by_id($v["appliance_resources"]); - $state_icon = ''.$resource->state.''; - - $a = $this->response->html->a(); - $a->title = $this->lang['title_vms']; - $a->label = 'VMS'; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($strControler, "kvm-vm").'&kvm_vm_action=edit&appliance_id='.$v['appliance_id']; - $links = $a->get_string(); - - // handle storages - $slinks = ''; - foreach($s as $storage) { - if($storage['storage_resource_id'] === $resource->id) { - if($storage['storage_type'] === 'kvm-lvm-deployment') { - $a = $this->response->html->a(); - $a->title = $this->lang['title_lvm']; - $a->label = 'LVM'; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($strControler, "kvm").'&kvm_action=edit&storage_id='.$storage['storage_id']; - $slinks .= $a->get_string(); - } - else if($storage['storage_type'] === 'kvm-bf-deployment') { - $a = $this->response->html->a(); - $a->title = $this->lang['title_bf']; - $a->label = 'Blockfiles'; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($strControler, "kvm").'&kvm_action=edit&storage_id='.$storage['storage_id']; - $slinks .= $a->get_string(); - } - else if($storage['storage_type'] === 'kvm-gluster-deployment') { - $a = $this->response->html->a(); - $a->title = $this->lang['title_glusterfs']; - $a->label = 'GlusterFS'; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($strControler, "kvm").'&kvm_action=edit&storage_id='.$storage['storage_id']; - $slinks .= $a->get_string(); - } - else if($storage['storage_type'] === 'kvm-ceph-deployment') { - $a = $this->response->html->a(); - $a->title = $this->lang['title_ceph']; - $a->label = 'Ceph'; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($strControler, "kvm").'&kvm_action=edit&storage_id='.$storage['storage_id']; - $slinks .= $a->get_string(); - } - } - } - // handle missing storage - if($slinks === '') { - $a = $this->response->html->a(); - $a->title = $this->lang['new_storage']; - $a->label = $this->lang['new_storage']; - $a->handler = 'onclick="wait();"'; - $a->css = 'add'; - $a->href = $this->response->html->thisfile.'?base=storage&storage_action=add'; - $links .= $a->get_string(); - } else { - $links .= $slinks; - } - - // Network Manager - $n = $this->response->html->a(); - $n->label = $this->lang['network_manager']; - $n->css = 'enable'; - $n->handler = 'onclick="wait();"'; - $n->href = $this->response->html->thisfile.'?plugin=network-manager&appliance_id='.$v['appliance_id']; - $plugins = $n->get_string(); - // Sysinfo - $n = $this->response->html->a(); - $n->label = 'Sysinfo'; - $n->css = 'enable'; - $n->handler = 'onclick="wait();"'; - $n->href = $this->response->html->thisfile.'?plugin=kvm&controller=kvm-vm&kvm_vm_action=sysinfo&appliance_id='.$v['appliance_id']; - $plugins .= $n->get_string(); - - $data = ''.$this->lang['table_id'].': '.$v['appliance_id'].'
    '; - $data .= ''.$this->lang['table_name'].': '.$v['appliance_name'].'
    '; - $data .= ''.$this->lang['table_recource'].': '.$resource->hostname.'
    '; - $data .= 'IP: '.$resource->ip; - - $b[] = array( - 'state' => $state_icon, - 'appliance_id' => $v['appliance_id'], - 'name' => $v['appliance_name'], - 'appliance_resources' => $resource->id, - 'data' => $data, - 'comment' => $v['appliance_comment'].'
    '.$plugins, - 'action' => $links, - ); - } - - $h['state']['title'] =' '; - $h['state']['sortable'] = false; - $h['appliance_id']['title'] = $this->lang['table_id']; - $h['appliance_id']['hidden'] = true; - $h['name']['title'] = $this->lang['table_name']; - $h['name']['hidden'] = true; - $h['appliance_resources']['title'] = $this->lang['table_recource']; - $h['appliance_resources']['hidden'] = true; - $h['data']['title'] = ' '; - $h['data']['sortable'] = false; - $h['comment']['title'] =' '; - $h['comment']['sortable'] = false; - $h['action']['title'] = ' '; - $h['action']['sortable'] = false; - - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $b; - $table->limit_select = array( - array("value" => 10, "text" => 10), - array("value" => 20, "text" => 20), - array("value" => 30, "text" => 30), - array("value" => 40, "text" => 40), - array("value" => 50, "text" => 50), - ); - return $table->get_string(); - } else { - $box = $this->response->html->div(); - $box->id = 'htmlobject_box_add'; - $box->css = 'htmlobject_box'; - $box_content = $this->lang['error_no_host'].'

    '; - $box_content .= ''.$this->lang['new'].''; - $box->add($box_content); - return $box->get_string(); - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.start.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.start.class.php deleted file mode 100644 index 3015e9b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.start.class.php +++ /dev/null @@ -1,135 +0,0 @@ - - */ - -class kvm_vm_start -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->start(); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response) - ); - } - - //-------------------------------------------- - /** - * Start - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function start() { - $response = ''; - $vms = $this->response->html->request()->get($this->identifier_name); - if( $vms !== '' ) { - $appliance_id = $this->response->html->request()->get('appliance_id'); - $appliance = new appliance(); - $resource = new resource(); - $errors = array(); - $message = array(); - foreach($vms as $key => $vm) { - $appliance->get_instance_by_id($appliance_id); - $resource->get_instance_by_id($appliance->resources); - $file = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$resource->id.'.vm_list'; - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm-vm start -n '.$vm; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - $resource->send_command($resource->ip, $command); - $message[] = sprintf($this->lang['msg_started'], $vm); - } - if(count($errors) === 0) { - $response = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response = join('
    ', $msg); - } - } else { - $response = ''; - } - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.stop.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.stop.class.php deleted file mode 100644 index 6267040..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.stop.class.php +++ /dev/null @@ -1,168 +0,0 @@ - - */ - -class kvm_vm_stop -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->stop(); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response) - ); - } - - //-------------------------------------------- - /** - * Stop - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function stop() { - $response = ''; - $vms = $this->response->html->request()->get($this->identifier_name); - if( $vms !== '' ) { - $appliance_id = $this->response->html->request()->get('appliance_id'); - $appliance = new appliance(); - $resource = new resource(); - $errors = array(); - $message = array(); - foreach($vms as $key => $vm) { - $appliance->get_instance_by_id($appliance_id); - $resource->get_instance_by_id($appliance->resources); - $file = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$resource->id.'.vm_list'; - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm-vm stop -n '.$vm; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - $resource->send_command($resource->ip, $command); - $message[] = sprintf($this->lang['msg_stoped'], $vm); - - $file = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$resource->id.'.vm_list'; - if($this->file->exists($file)) { - $lines = explode("\n", $this->file->get_contents($file)); - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[1] === $vm) { - $tmp = explode(':',$line[5]); - $server = $tmp[0]; - $port = $tmp[1]; - $mac = $line[2]; - $resource->get_instance_by_mac($mac); - $rid = $resource->id; - } - } - $event = new event(); - $plugin = new plugin(); - $enabled = $plugin->enabled(); - foreach ($enabled as $index => $name) { - $running = $this->openqrm->get('webdir').'/plugins/'.$name.'/.running'; - $hook = $this->openqrm->get('webdir').'/plugins/'.$name.'/openqrm-'.$name.'-remote-console-hook.php'; - if (file_exists($hook)) { - if (file_exists($running)) { - $event->log("console", $_SERVER['REQUEST_TIME'], 5, "kvm-vm.console.class.php", 'Found plugin '.$name.' providing a remote console.', "", "", 0, 0, $resource->id); - require_once($hook); - $console_function = 'openqrm_'.$name.'_disable_remote_console'; - $console_function = str_replace("-", "_", $console_function); - $console_function($server, $port, $rid, $mac, $vm); - } - } - } - } - } - } - if(count($errors) === 0) { - $response = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response = join('
    ', $msg); - } - } else { - $response = ''; - } - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.sysinfo.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.sysinfo.class.php deleted file mode 100644 index 6fe8099..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.sysinfo.class.php +++ /dev/null @@ -1,146 +0,0 @@ - - */ - -class kvm_vm_sysinfo -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->sysinfo(); - return $response; - } - - //-------------------------------------------- - /** - * Sysinfo - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function sysinfo() { - - $appliance = $this->openqrm->appliance(); - $appliance->get_instance_by_id($this->response->html->request()->get('appliance_id')); - $resource = $this->openqrm->resource(); - $resource->get_instance_by_id($appliance->resources); - - $filename = $resource->id.'.sysinfo'; - $file = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$filename; - - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm-sysinfo'; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --file-name '.$filename; - #$command .= ' --openqrm-cmd-mode background'; - - if($this->openqrm->file()->exists($file)) { - $this->openqrm->file()->remove($file); - } - $resource->send_command($resource->ip, $command); - while (!$this->openqrm->file()->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - - $content = $this->openqrm->file()->get_contents($file); - - $image = $this->openqrm->image(); - $list = $image->display_overview(0,10000,'image_id','ASC'); - foreach($list as $v) { - if($v['image_rootdevice'] !== '') { - $content = preg_replace('~[^=]('.$v['image_rootdevice'].')([^a-zA-Z0-9])~', '$1$2', $content); - } - } - - $resource = $this->openqrm->resource(); - $list = $resource->display_overview(0,10000,'resource_id','ASC'); - foreach($list as $v) { - if($v['resource_hostname'] !== '') { - $content = preg_replace('~([0-9] )('.$v['resource_hostname'].')\n~', '$1$2'."\n", $content); - } - } - - $d = $this->response->html->div(); - $d->id = "kvm-sysinfo"; - $d->add($content); - - $this->openqrm->file()->remove($file); - - return $d; - - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.update.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.update.class.php deleted file mode 100644 index 0d015fc..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm-vm.update.class.php +++ /dev/null @@ -1,746 +0,0 @@ - - */ - -class kvm_vm_update -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_vm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_vm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_vm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_vm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $id = $this->response->html->request()->get('appliance_id'); - $vm = $this->response->html->request()->get('vm'); - $this->vm = $vm; - $appliance = new appliance(); - $resource = new resource(); - $appliance->get_instance_by_id($id); - $resource->get_instance_by_id($appliance->resources); - $this->resource = $resource; - $this->appliance = $appliance; - $this->statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$resource->id.'.vm_list'; - - $this->response->add('appliance_id', $id); - $this->response->add('vm', $this->vm); - $this->response->add('vmtype', $this->response->html->request()->get('vmtype')); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->update(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/kvm-vm-update.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add(sprintf($this->lang['label'], $this->vm), 'label'); - $t->add($this->lang['lang_basic'], 'lang_basic'); - $t->add($this->lang['lang_hardware'], 'lang_hardware'); - $t->add($this->lang['lang_virtual_disk'], 'lang_virtual_disk'); - $t->add($this->lang['lang_net'], 'lang_net'); - $t->add($this->lang['lang_net_0'], 'lang_net_0'); - $t->add($this->lang['lang_net_1'], 'lang_net_1'); - $t->add($this->lang['lang_net_2'], 'lang_net_2'); - $t->add($this->lang['lang_net_3'], 'lang_net_3'); - $t->add($this->lang['lang_net_4'], 'lang_net_4'); - $t->add($this->lang['lang_boot'], 'lang_boot'); - $t->add($this->lang['lang_vnc'], 'lang_vnc'); - $t->add($this->lang['lang_browse'], 'lang_browse'); - $t->add($this->lang['lang_browser'], 'lang_browser'); - $t->add($this->lang['lang_password_generate'], 'lang_password_generate'); - $t->add($this->lang['lang_password_show'], 'lang_password_show'); - $t->add($this->lang['lang_password_hide'], 'lang_password_hide'); - $t->add($this->response->html->request()->get('appliance_id'), 'appliance_id'); - $t->add($this->actions_name, 'actions_name'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Update - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function update() { - $this->reload(); - $response = $this->get_response(); - $form = $response->form; - - // handle no bridge error - if(!isset($respnse->msg)) { - // check vnc password - $vnc = $form->get_request('vnc'); - if($vnc !== '' && $vnc !== $form->get_request('vnc_1')) { - $form->set_error('vnc_1', $this->lang['error_vnc_password']); - } - if(isset($vnc) && $vnc !== '' && strlen($vnc) < 6) { - $form->set_error('vnc', $this->lang['error_vnc_password_count']); - } - $vnckeymap = $form->get_request('vnc_keymap'); - $vnckeymap_parameter = ''; - if($vnc !== '') { - $vnckeymap_parameter = ' -l '.$vnckeymap; - } - // disk interface - $disk_interface = $form->get_request('disk_interface'); - $disk_interface_parameter = ''; - if($disk_interface !== '') { - $disk_interface_parameter = ' -o '.$disk_interface; - } - $iso_path = ''; - if($form->get_request('boot') !== '' && $form->get_request('boot') === 'iso') { - if($form->get_request('iso_path') === '') { - $form->set_error('iso_path', $this->lang['error_iso_path']); - } else { - $iso_path = ' -i '.$form->get_request('iso_path'); - } - } - - if(!$form->get_errors() && $this->response->submit()) { - $errors = array(); - if($form->get_request('boot') === '') { - $errors[] = $this->lang['error_boot']; - } - - $enabled = array(); - for($i = 1; $i < 5; $i++) { - $enabled[$i] = true; - if($form->get_request('net'.$i) !== '') { - if($form->get_request('mac'.$i) === '') { - $form->set_error('mac'.$i, $this->lang['error_mac']); - $enabled[$i] = false; - } - if($form->get_request('nic'.$i) === '') { - $form->set_error('nic'.$i, $this->lang['error_nic']); - $enabled[$i] = false; - } - if($form->get_request('bridge'.$i) === '') { - $form->set_error('bridge'.$i, $this->lang['error_bridge']); - $enabled[$i] = false; - } - } else { - $enabled[$i] = false; - } - } - - if(count($errors) > 0 || $form->get_errors()) { - $response->error = join('
    ', $errors); - } else { - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm-vm update'; - $command .= ' -n '.$this->vm; - $command .= ' -m '.strtolower($form->get_static('mac')); - $command .= ' -r '.$form->get_request('memory'); - $command .= ' -c '.$form->get_request('cpus'); - $command .= ' -t '.$form->get_request('nic'); - $command .= ' -z '.$form->get_request('bridge'); - - foreach($enabled as $key => $value) { - if($value === true) { - $command .= ' -m'.$key.' '.$form->get_request('mac'.$key); - $command .= ' -t'.$key.' '.$form->get_request('nic'.$key); - $command .= ' -z'.$key.' '.$form->get_request('bridge'.$key); - } - } - - if($form->get_request('cdrom')) { - $command .= ' -cdrom '.$form->get_request('cdrom'); - } - - $command .= ' -b '.$form->get_request('boot'); - $command .= ' -v '.$form->get_request('vnc'); - $command .= $iso_path; - $command .= $vnckeymap_parameter; - $command .= $disk_interface_parameter; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $this->resource->send_command($this->resource->ip, $command); - $response->msg = sprintf($this->lang['msg_updated'], $this->vm); - } - } - else if($form->get_errors()) { - $response->error = implode('
    ', $form->get_errors()); - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - - $response = $this->response; - $form = $response->get_form($this->actions_name, 'update'); - - $cpus[] = array("1", "1 CPU"); - $cpus[] = array("2", "2 CPUs"); - $cpus[] = array("4", "4 CPUs"); - $cpus[] = array("8", "8 CPUs"); - $cpus[] = array("16", "16 CPUs"); - - $ram[] = array("256", "256 MB"); - $ram[] = array("512", "512 MB"); - $ram[] = array("1024", "1 GB"); - $ram[] = array("2048", "2 GB"); - $ram[] = array("4096", "4 GB"); - $ram[] = array("8192", "8 GB"); - $ram[] = array("16384", "16 GB"); - $ram[] = array("32768", "32 GB"); - $ram[] = array("65536", "64 GB"); - - $nics[] = array("virtio", $this->lang['form_net_virtio']); - $nics[] = array("e1000", $this->lang['form_net_e1000']); - $nics[] = array("rtl8139", $this->lang['form_net_rtl8139']); - - $keymaps[] = array("de", "de"); - $keymaps[] = array("en-us", "en-us"); - $keymaps[] = array("es", "es"); - $keymaps[] = array("fr", "fr"); - $keymaps[] = array("it", "it"); - $keymaps[] = array("ja", "ja"); - $keymaps[] = array("nl", "nl"); - $keymaps[] = array("ru", "ru"); - $keymaps[] = array("none", "none"); - - $disk_interfaces[] = array("virtio", "Virtio"); - $disk_interfaces[] = array("ide", "IDE"); - - $disk_select_arr[] = array('1024','1 GB'); - $disk_select_arr[] = array('2048','2 GB'); - $disk_select_arr[] = array('10240','10 GB'); - $disk_select_arr[] = array('20480','20 GB'); - $disk_select_arr[] = array('51200','50 GB'); - $disk_select_arr[] = array('102400','100 GB'); - - $swap_select_arr[] = array('1024', '1 GB'); - $swap_select_arr[] = array('2048','2 GB'); - - $file = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$this->resource->id.'.'.$this->vm.'.vm_config'; - $ini = openqrm_parse_conf($file); - - $bridges = array(); - $bridge_list = $ini['OPENQRM_KVM_BRIDGES']; - $bridge_list = rtrim($bridge_list, ":"); - $bridge_array = explode(':', $bridge_list); - - // handle no bridge error - if(isset($bridge_array[0]) && $bridge_array[0] !== '') { - foreach ($bridge_array as $b) { - $bridges[] = array($b, $b); - } - - $this->response->params['mac'] = $ini['OPENQRM_KVM_VM_MAC_1']; - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['static'] = true; - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['value'] = $this->vm; - $d['name']['object']['attrib']['disabled'] = true; - - $d['cpus']['label'] = $this->lang['form_cpus']; - $d['cpus']['required'] = true; - $d['cpus']['object']['type'] = 'htmlobject_select'; - $d['cpus']['object']['attrib']['name'] = 'cpus'; - $d['cpus']['object']['attrib']['index'] = array(0,1); - $d['cpus']['object']['attrib']['options'] = $cpus; - $d['cpus']['object']['attrib']['selected'] = array($ini['OPENQRM_KVM_VM_CPUS']); - - $d['memory']['label'] = $this->lang['form_memory']; - $d['memory']['required'] = true; - $d['memory']['object']['type'] = 'htmlobject_select'; - $d['memory']['object']['attrib']['name'] = 'memory'; - $d['memory']['object']['attrib']['index'] = array(0,1); - $d['memory']['object']['attrib']['options'] = $ram; - if($ini['OPENQRM_KVM_VM_RAM'] !== '') { - $d['memory']['object']['attrib']['selected'] = array($ini['OPENQRM_KVM_VM_RAM']); - } - - $vmtype = $this->response->html->request()->get('vmtype'); - if($vmtype === 'kvm-vm-net') { - $d['disk']['label'] = $this->lang['form_swap']; - $d['disk']['object']['type'] = 'htmlobject_select'; - $d['disk']['object']['attrib']['index'] = array(0,1); - $d['disk']['object']['attrib']['id'] = 'disk'; - $d['disk']['object']['attrib']['name'] = 'disk'; - $d['disk']['object']['attrib']['options'] = $swap_select_arr; - - $d['cdrom_iso_path'] = ""; - $d['cdrom_button'] = ""; - } else { - $d['disk']['label'] = $this->lang['form_disk']; - $d['disk']['object']['type'] = 'htmlobject_select'; - $d['disk']['object']['attrib']['index'] = array(0,1); - $d['disk']['object']['attrib']['id'] = 'disk'; - $d['disk']['object']['attrib']['name'] = 'disk'; - $d['disk']['object']['attrib']['options'] = $disk_select_arr; - - $d['cdrom_iso_path']['label'] = $this->lang['form_cdrom']; - $d['cdrom_iso_path']['object']['type'] = 'htmlobject_input'; - $d['cdrom_iso_path']['object']['attrib']['type'] = 'text'; - $d['cdrom_iso_path']['object']['attrib']['id'] = 'cdrom'; - $d['cdrom_iso_path']['object']['attrib']['name'] = 'cdrom'; - if($ini['OPENQRM_KVM_VM_CDROM2'] !== '') { - $cdrompath = str_replace('-drive file=', '',$ini['OPENQRM_KVM_VM_CDROM2']); - $cdrompath = str_replace(',media=cdrom', '',$cdrompath); - $d['cdrom_iso_path']['object']['attrib']['value'] = $cdrompath; - } - - $d['cdrom_button']['static'] = true; - $d['cdrom_button']['object']['type'] = 'htmlobject_input'; - $d['cdrom_button']['object']['attrib']['type'] = 'button'; - $d['cdrom_button']['object']['attrib']['name'] = 'cdrom_button'; - $d['cdrom_button']['object']['attrib']['id'] = 'cdrom_button'; - $d['cdrom_button']['object']['attrib']['css'] = 'browse-button'; - $d['cdrom_button']['object']['attrib']['handler'] = 'onclick="filepicker.init(\'cdrom\'); return false;"'; - $d['cdrom_button']['object']['attrib']['style'] = "display:none;"; - $d['cdrom_button']['object']['attrib']['value'] = $this->lang['lang_browse']; - - } - - $d['disk_interface']['label'] = $this->lang['form_disk_interface']; - $d['disk_interface']['required'] = true; - $d['disk_interface']['object']['type'] = 'htmlobject_select'; - $d['disk_interface']['object']['attrib']['name'] = 'disk_interface'; - $d['disk_interface']['object']['attrib']['id'] = 'disk_interface'; - $d['disk_interface']['object']['attrib']['index'] = array(0,1); - $d['disk_interface']['object']['attrib']['options'] = $disk_interfaces; - $d['disk_interface']['object']['attrib']['selected']= array($ini['OPENQRM_KVM_VM_DISK_INTERFACE']); - - $d['net0']['label'] = $this->lang['lang_net_0']; - $d['net0']['object']['type'] = 'htmlobject_input'; - $d['net0']['object']['attrib']['type'] = 'checkbox'; - $d['net0']['object']['attrib']['id'] = 'net0'; - $d['net0']['object']['attrib']['name'] = 'net0'; - $d['net0']['object']['attrib']['value'] = 'enabled'; - $d['net0']['object']['attrib']['checked'] = true; - $d['net0']['object']['attrib']['disabled'] = true; - - $d['mac']['label'] = $this->lang['form_mac']; - $d['mac']['static'] = true; - $d['mac']['object']['type'] = 'htmlobject_input'; - $d['mac']['object']['attrib']['name'] = 'dummy'; - $d['mac']['object']['attrib']['type'] = 'text'; - $d['mac']['object']['attrib']['value'] = $ini['OPENQRM_KVM_VM_MAC_1']; - $d['mac']['object']['attrib']['maxlength'] = 50; - $d['mac']['object']['attrib']['disabled'] = true; - - $d['bridge']['label'] = $this->lang['form_bridge']; - $d['bridge']['required'] = true; - $d['bridge']['object']['type'] = 'htmlobject_select'; - $d['bridge']['object']['attrib']['name'] = 'bridge'; - $d['bridge']['object']['attrib']['index'] = array(0,1); - $d['bridge']['object']['attrib']['options'] = $bridges; - $d['bridge']['object']['attrib']['selected'] = array($ini['OPENQRM_KVM_VM_BRIDGE_1']); - - $d['nic']['label'] = $this->lang['form_netdevice']; - $d['nic']['required'] = true; - $d['nic']['object']['type'] = 'htmlobject_select'; - $d['nic']['object']['attrib']['name'] = 'nic'; - $d['nic']['object']['attrib']['index'] = array(0,1); - $d['nic']['object']['attrib']['options'] = $nics; - $d['nic']['object']['attrib']['selected'] = array($ini['OPENQRM_KVM_VM_NIC_TYPE_1']); - - // net 1 - $checked = false; - if($ini['OPENQRM_KVM_VM_MAC_2'] !== '' ) { - $mac = $ini['OPENQRM_KVM_VM_MAC_2']; - $checked = true; - } else { - $this->resource->generate_mac(); - $mac = $this->resource->mac; - } - - $d['net1']['label'] = $this->lang['lang_net_1']; - $d['net1']['object']['type'] = 'htmlobject_input'; - $d['net1']['object']['attrib']['type'] = 'checkbox'; - $d['net1']['object']['attrib']['id'] = 'net1'; - $d['net1']['object']['attrib']['name'] = 'net1'; - $d['net1']['object']['attrib']['value'] = 'enabled'; - $d['net1']['object']['attrib']['checked'] = $checked; - $d['net1']['object']['attrib']['handler'] = 'onchange="nettoggle(this);"'; - - $d['mac1']['label'] = $this->lang['form_mac']; - $d['mac1']['object']['type'] = 'htmlobject_input'; - $d['mac1']['object']['attrib']['name'] = 'mac1'; - $d['mac1']['object']['attrib']['type'] = 'text'; - $d['mac1']['object']['attrib']['value'] = $mac; - $d['mac1']['object']['attrib']['maxlength'] = 50; - - $d['bridge1']['label'] = $this->lang['form_bridge']; - $d['bridge1']['object']['type'] = 'htmlobject_select'; - $d['bridge1']['object']['attrib']['name'] = 'bridge1'; - $d['bridge1']['object']['attrib']['index'] = array(0,1); - $d['bridge1']['object']['attrib']['options'] = $bridges; - if(isset($ini['OPENQRM_KVM_VM_BRIDGE_2']) && $checked === true) { - $d['bridge1']['object']['attrib']['selected'] = array($ini['OPENQRM_KVM_VM_BRIDGE_2']); - } - - $d['nic1']['label'] = $this->lang['form_netdevice']; - $d['nic1']['object']['type'] = 'htmlobject_select'; - $d['nic1']['object']['attrib']['name'] = 'nic1'; - $d['nic1']['object']['attrib']['index'] = array(0,1); - $d['nic1']['object']['attrib']['options'] = $nics; - if($checked === true) { - $d['nic1']['object']['attrib']['selected'] = array($ini['OPENQRM_KVM_VM_NIC_TYPE_2']); - } - - // net 2 - $checked = false; - if($ini['OPENQRM_KVM_VM_MAC_3'] !== '' ) { - $mac = $ini['OPENQRM_KVM_VM_MAC_3']; - $checked = true; - } else { - $this->resource->generate_mac(); - $mac = $this->resource->mac; - } - - $d['net2']['label'] = $this->lang['lang_net_2']; - $d['net2']['object']['type'] = 'htmlobject_input'; - $d['net2']['object']['attrib']['type'] = 'checkbox'; - $d['net2']['object']['attrib']['id'] = 'net2'; - $d['net2']['object']['attrib']['name'] = 'net2'; - $d['net2']['object']['attrib']['value'] = 'enabled'; - $d['net2']['object']['attrib']['checked'] = $checked; - $d['net2']['object']['attrib']['handler'] = 'onchange="nettoggle(this);"'; - - $d['mac2']['label'] = $this->lang['form_mac']; - $d['mac2']['object']['type'] = 'htmlobject_input'; - $d['mac2']['object']['attrib']['name'] = 'mac2'; - $d['mac2']['object']['attrib']['type'] = 'text'; - $d['mac2']['object']['attrib']['maxlength'] = 50; - $d['mac2']['object']['attrib']['value'] = $mac; - - $d['bridge2']['label'] = $this->lang['form_bridge']; - $d['bridge2']['object']['type'] = 'htmlobject_select'; - $d['bridge2']['object']['attrib']['name'] = 'bridge2'; - $d['bridge2']['object']['attrib']['index'] = array(0,1); - $d['bridge2']['object']['attrib']['options'] = $bridges; - if(isset($ini['OPENQRM_KVM_VM_BRIDGE_3']) && $checked === true) { - $d['bridge2']['object']['attrib']['selected'] = array($ini['OPENQRM_KVM_VM_BRIDGE_3']); - } - - $d['nic2']['label'] = $this->lang['form_netdevice']; - $d['nic2']['object']['type'] = 'htmlobject_select'; - $d['nic2']['object']['attrib']['name'] = 'nic2'; - $d['nic2']['object']['attrib']['index'] = array(0,1); - $d['nic2']['object']['attrib']['options'] = $nics; - if($checked === true) { - $d['nic2']['object']['attrib']['selected'] = array($ini['OPENQRM_KVM_VM_NIC_TYPE_3']); - } - - // net 3 - $checked = false; - if($ini['OPENQRM_KVM_VM_MAC_4'] !== '' ) { - $mac = $ini['OPENQRM_KVM_VM_MAC_4']; - $checked = true; - } else { - $this->resource->generate_mac(); - $mac = $this->resource->mac; - } - - $d['net3']['label'] = $this->lang['lang_net_3']; - $d['net3']['object']['type'] = 'htmlobject_input'; - $d['net3']['object']['attrib']['type'] = 'checkbox'; - $d['net3']['object']['attrib']['id'] = 'net3'; - $d['net3']['object']['attrib']['name'] = 'net3'; - $d['net3']['object']['attrib']['value'] = 'enabled'; - $d['net3']['object']['attrib']['checked'] = $checked; - $d['net3']['object']['attrib']['handler'] = 'onchange="nettoggle(this);"'; - - $d['mac3']['label'] = $this->lang['form_mac']; - $d['mac3']['object']['type'] = 'htmlobject_input'; - $d['mac3']['object']['attrib']['name'] = 'mac3'; - $d['mac3']['object']['attrib']['type'] = 'text'; - $d['mac3']['object']['attrib']['value'] = $mac; - $d['mac3']['object']['attrib']['maxlength'] = 50; - - $d['bridge3']['label'] = $this->lang['form_bridge']; - $d['bridge3']['object']['type'] = 'htmlobject_select'; - $d['bridge3']['object']['attrib']['name'] = 'bridge3'; - $d['bridge3']['object']['attrib']['index'] = array(0,1); - $d['bridge3']['object']['attrib']['options'] = $bridges; - if(isset($ini['OPENQRM_KVM_VM_BRIDGE_4']) && $checked === true) { - $d['bridge3']['object']['attrib']['selected'] = array($ini['OPENQRM_KVM_VM_BRIDGE_4']); - } - - $d['nic3']['label'] = $this->lang['form_netdevice']; - $d['nic3']['object']['type'] = 'htmlobject_select'; - $d['nic3']['object']['attrib']['name'] = 'nic3'; - $d['nic3']['object']['attrib']['index'] = array(0,1); - $d['nic3']['object']['attrib']['options'] = $nics; - if($checked === true) { - $d['nic3']['object']['attrib']['selected'] = array($ini['OPENQRM_KVM_VM_NIC_TYPE_4']); - } - - // net 4 - $checked = false; - if($ini['OPENQRM_KVM_VM_MAC_5'] !== '' ) { - $mac = $ini['OPENQRM_KVM_VM_MAC_5']; - $checked = true; - } else { - $this->resource->generate_mac(); - $mac = $this->resource->mac; - } - - $d['net4']['label'] = $this->lang['lang_net_4']; - $d['net4']['object']['type'] = 'htmlobject_input'; - $d['net4']['object']['attrib']['type'] = 'checkbox'; - $d['net4']['object']['attrib']['id'] = 'net4'; - $d['net4']['object']['attrib']['name'] = 'net4'; - $d['net4']['object']['attrib']['value'] = 'enabled'; - $d['net4']['object']['attrib']['checked'] = $checked; - $d['net4']['object']['attrib']['handler'] = 'onchange="nettoggle(this);"'; - - $d['mac4']['label'] = $this->lang['form_mac']; - $d['mac4']['object']['type'] = 'htmlobject_input'; - $d['mac4']['object']['attrib']['name'] = 'mac4'; - $d['mac4']['object']['attrib']['type'] = 'text'; - $d['mac4']['object']['attrib']['value'] = $mac; - $d['mac4']['object']['attrib']['maxlength'] = 50; - - $d['bridge4']['label'] = $this->lang['form_bridge']; - $d['bridge4']['object']['type'] = 'htmlobject_select'; - $d['bridge4']['object']['attrib']['name'] = 'bridge4'; - $d['bridge4']['object']['attrib']['index'] = array(0,1); - $d['bridge4']['object']['attrib']['options'] = $bridges; - if(isset($ini['OPENQRM_KVM_VM_BRIDGE_5']) && $checked === true) { - $d['bridge4']['object']['attrib']['selected'] = array($ini['OPENQRM_KVM_VM_BRIDGE_5']); - } - - $d['nic4']['label'] = $this->lang['form_netdevice']; - $d['nic4']['object']['type'] = 'htmlobject_select'; - $d['nic4']['object']['attrib']['name'] = 'nic4'; - $d['nic4']['object']['attrib']['index'] = array(0,1); - $d['nic4']['object']['attrib']['options'] = $nics; - if($checked === true) { - $d['nic4']['object']['attrib']['selected'] = array($ini['OPENQRM_KVM_VM_NIC_TYPE_5']); - } - - // boot from - $d['boot_cd'] = ''; - $d['boot_iso'] = ''; - $d['boot_iso_path'] = ''; - $d['boot_local'] = ''; - $d['browse_button'] = ''; - if($vmtype !== 'kvm-vm-net') { - $d['boot_cd']['label'] = $this->lang['form_boot_cd']; - $d['boot_cd']['object']['type'] = 'htmlobject_input'; - $d['boot_cd']['object']['attrib']['type'] = 'radio'; - $d['boot_cd']['object']['attrib']['name'] = 'boot'; - $d['boot_cd']['object']['attrib']['value'] = 'cdrom'; - if($ini['OPENQRM_KVM_VM_BOOT'] === 'cdrom') { - $d['boot_cd']['object']['attrib']['checked'] = true; - } - - $d['boot_iso']['label'] = $this->lang['form_boot_iso']; - $d['boot_iso']['object']['type'] = 'htmlobject_input'; - $d['boot_iso']['object']['attrib']['type'] = 'radio'; - $d['boot_iso']['object']['attrib']['id'] = 'boot_iso'; - $d['boot_iso']['object']['attrib']['name'] = 'boot'; - $d['boot_iso']['object']['attrib']['value'] = 'iso'; - if(strpos($ini['OPENQRM_KVM_VM_BOOT'], 'iso') !== false) { - $isopath = str_replace('iso:', '',$ini['OPENQRM_KVM_VM_BOOT']); - $d['boot_iso']['object']['attrib']['checked'] = true; - } - - $d['boot_iso_path']['label'] = $this->lang['form_iso_path']; - $d['boot_iso_path']['object']['type'] = 'htmlobject_input'; - $d['boot_iso_path']['object']['attrib']['type'] = 'text'; - $d['boot_iso_path']['object']['attrib']['id'] = 'iso_path'; - $d['boot_iso_path']['object']['attrib']['name'] = 'iso_path'; - if(isset($isopath)) { - $d['boot_iso_path']['object']['attrib']['value'] = $isopath; - } - - $d['browse_button']['static'] = true; - $d['browse_button']['object']['type'] = 'htmlobject_input'; - $d['browse_button']['object']['attrib']['type'] = 'button'; - $d['browse_button']['object']['attrib']['name'] = 'browse_button'; - $d['browse_button']['object']['attrib']['id'] = 'browsebutton'; - $d['browse_button']['object']['attrib']['css'] = 'browse-button'; - $d['browse_button']['object']['attrib']['handler'] = 'onclick="filepicker.init(\'iso_path\'); return false;"'; - $d['browse_button']['object']['attrib']['style'] = "display:none;"; - $d['browse_button']['object']['attrib']['value'] = $this->lang['lang_browse']; - - $d['boot_local']['label'] = $this->lang['form_boot_local']; - $d['boot_local']['object']['type'] = 'htmlobject_input'; - $d['boot_local']['object']['attrib']['type'] = 'radio'; - $d['boot_local']['object']['attrib']['name'] = 'boot'; - $d['boot_local']['object']['attrib']['value'] = 'local'; - if($ini['OPENQRM_KVM_VM_BOOT'] === 'local') { - $d['boot_local']['object']['attrib']['checked'] = true; - } - } - $d['boot_net']['label'] = $this->lang['form_boot_net']; - $d['boot_net']['object']['type'] = 'htmlobject_input'; - $d['boot_net']['object']['attrib']['type'] = 'radio'; - $d['boot_net']['object']['attrib']['name'] = 'boot'; - $d['boot_net']['object']['attrib']['value'] = 'network'; - if($ini['OPENQRM_KVM_VM_BOOT'] === 'network') { - $d['boot_net']['object']['attrib']['checked'] = true; - } - - $d['vnc']['label'] = $this->lang['form_vnc']; - $d['vnc']['required'] = true; - $d['vnc']['object']['type'] = 'htmlobject_input'; - $d['vnc']['object']['attrib']['name'] = 'vnc'; - $d['vnc']['object']['attrib']['id'] = 'vnc'; - $d['vnc']['object']['attrib']['type'] = 'password'; - $d['vnc']['object']['attrib']['value'] = $ini['OPENQRM_KVM_VM_VNCPASSWORD']; - $d['vnc']['object']['attrib']['maxlength'] = 50; - - $d['vnc_1']['label'] = $this->lang['form_vnc_repeat']; - $d['vnc_1']['required'] = true; - $d['vnc_1']['object']['type'] = 'htmlobject_input'; - $d['vnc_1']['object']['attrib']['name'] = 'vnc_1'; - $d['vnc_1']['object']['attrib']['id'] = 'vnc_1'; - $d['vnc_1']['object']['attrib']['type'] = 'password'; - $d['vnc_1']['object']['attrib']['value'] = $ini['OPENQRM_KVM_VM_VNCPASSWORD']; - $d['vnc_1']['object']['attrib']['maxlength'] = 50; - - $d['vnc_keymap']['label'] = $this->lang['form_vnc_keymap']; - $d['vnc_keymap']['object']['type'] = 'htmlobject_select'; - $d['vnc_keymap']['object']['attrib']['name'] = 'vnc_keymap'; - $d['vnc_keymap']['object']['attrib']['index'] = array(0,1); - $d['vnc_keymap']['object']['attrib']['options'] = $keymaps; - $d['vnc_keymap']['object']['attrib']['selected']= array($ini['OPENQRM_KVM_VM_VNCKEYMAP']); - - $form->add($d); - $response->form = $form; - } else { - $response->msg = $this->lang['error_no_bridge']; - $response->form = $form; - } - return $response; - } - - //-------------------------------------------- - /** - * Reload - * - * @access public - */ - //-------------------------------------------- - function reload() { - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm-vm post_vm_config'; - $command .= ' -n '.$this->vm; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $id = $this->response->html->request()->get('appliance_id'); - $appliance = new appliance(); - $appliance->get_instance_by_id($id); - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $file = $this->openqrm->get('basedir').'/plugins/kvm/web/kvm-stat/'.$resource->id.'.'.$this->vm.'.vm_config'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - return true; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.add.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.add.class.php deleted file mode 100644 index 001b081..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.add.class.php +++ /dev/null @@ -1,362 +0,0 @@ - - */ - -class kvm_add -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - $this->controller = $controller; - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->volgroup = $this->response->html->request()->get('volgroup'); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - - $this->response->add('storage_id', $storage_id); - $this->response->add('volgroup', $this->volgroup); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->set_max(); - $response = $this->add(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->controller->__reload('lv'); - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->params['reload'] = 'false'; - $this->response->redirect( - $this->response->get_url($this->actions_name, 'volgroup', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/kvm-add.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add(sprintf($this->lang['label'], $this->volgroup), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->add($this->lang['lang_name_generate'], 'lang_name_generate'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Add - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function add() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - if($form->get_request('size') > $this->max) { - $form->set_error('size', sprintf($this->lang['error_size_exeeded'], $this->max)); - } - if(!$form->get_errors()) { - $name = $form->get_request('name'); - $create_type = $form->get_request('type'); - if ($create_type == '') { - $create_type = 'raw'; - } - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm add'; - $command .= ' -n '.$name.' -m '.$form->get_request('size'); - $command .= ' -o '.$create_type; - $command .= ' -t '.$this->deployment->type.' -v '.$this->volgroup; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if ($this->file->exists($statfile)) { - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[1]; - if($name === $check) { - $error = sprintf($this->lang['error_exists'], $name); - } - } - } - } - } - // check for image name - $image = new image(); - $image->get_instance_by_name($name); - if ((isset($image->id)) && ($image->id > 1)) { - $error = sprintf($this->lang['error_exists'], $name); - } - - if(isset($error)) { - $response->error = $error; - } else { - if($this->file->exists($statfile)) { - $this->file->remove($statfile); - } - $this->resource->send_command($this->resource->ip, $command); - while (!$this->file->exists($statfile)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - // add check that volume $name is now in the statfile - $created = false; - $bf_volume_path = ""; - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[1]; - if($name === $check) { - $created = true; - $bf_volume_path = $line[2]; - break; - } - } - } - } - - if ($created) { - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $name; - $image_fields['image_type'] = $this->deployment->type; - $image_fields['image_rootfstype'] = 'local'; - $image_fields['image_storageid'] = $this->storage->id; - $image_fields['image_size'] = $form->get_request('size'); - $image_fields['image_comment'] = "Image Object for volume $name"; - switch($this->deployment->type) { - case 'kvm-lvm-deployment': - $image_fields['image_rootdevice'] = '/dev/'.$this->volgroup.'/'.$name; - break; - case 'kvm-bf-deployment': - $image_fields['image_rootdevice'] = $bf_volume_path; - break; - case 'kvm-gluster-deployment': - $image_fields['image_rootdevice'] = "gluster://".$this->resource->ip."/".$this->volgroup."/".$name; - break; - case 'kvm-ceph-deployment': - $image_fields['image_rootdevice'] = "rbd:".$this->volgroup."/".$name; - break; - } - $image = new image(); - $image->add($image_fields); - $response->msg = sprintf($this->lang['msg_added'], $name); - // save image id in response for the wizard - $response->image_id = $image_fields["image_id"]; - - } else { - $response->msg = sprintf($this->lang['msg_add_failed'], $name); - } - } - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'add'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - // create the image type select array - $show_type_select = false; - switch($this->deployment->type) { - case 'kvm-bf-deployment': - $image_types[] = array('qcow2','qcow2'); - $image_types[] = array('raw','raw'); - $image_types[] = array('qcow','qcow'); - $image_types[] = array('cow','cow'); - $show_type_select = true; - break; - } - - // if we come from the wizard suggest the server name - $vm_volume_name_suggestion = ''; - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $appliance = new appliance(); - $appliance->get_instance_by_id($this->user->wizard_id); - $vm_volume_name_suggestion = $appliance->name; - } - - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['css'] = 'namegen'; - $d['name']['object']['attrib']['customattribs'] = 'data-prefix="kvm" data-length="6"'; - $d['name']['object']['attrib']['value'] = $vm_volume_name_suggestion; - $d['name']['object']['attrib']['maxlength'] = 50; - - $d['size']['label'] = sprintf($this->lang['form_size'], number_format($this->max, 0, '', '')); - $d['size']['required'] = true; - $d['size']['validate']['regex'] = '/^[0-9]+$/i'; - $d['size']['validate']['errormsg'] = sprintf($this->lang['error_size'], '0-9'); - $d['size']['object']['type'] = 'htmlobject_input'; - $d['size']['object']['attrib']['name'] = 'size'; - $d['size']['object']['attrib']['type'] = 'text'; - $d['size']['object']['attrib']['value'] = ''; - $d['size']['object']['attrib']['maxlength'] = 50; - - if ($show_type_select) { - $d['type']['label'] = $this->lang['form_type']; - $d['type']['object']['type'] = 'htmlobject_select'; - $d['type']['object']['attrib']['name'] = 'type'; - $d['type']['object']['attrib']['index'] = array(0,1); - $d['type']['object']['attrib']['options'] = $image_types; - } else { - $d['type'] = ''; - } - - $form->add($d); - $response->form = $form; - return $response; - } - - //-------------------------------------------- - /** - * Set max - * - * @access protected - * @return bool - */ - //-------------------------------------------- - function set_max() { - $statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.vg.stat'; - if ($this->file->exists($statfile)) { - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[0] === $this->volgroup) { - $max = $line[6]; - if(strpos($max, 'g') !== false) { - $max = str_replace('g', '', $max); - $max = floor(($max * 1000) * 1.0486); - $this->max = $max; - return true; - } else { - $max = str_replace('m', '', $max); - $max = (int)$max; - $this->max = $max; - return true; - } - } - } - } - } else { - return false; - } - } else { - return false; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.addvg.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.addvg.class.php deleted file mode 100644 index d2dca1f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.addvg.class.php +++ /dev/null @@ -1,19 +0,0 @@ - - */ -require_once($_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/device-manager/class/device-manager.addvg.class.php'); -class kvm_addvg extends device_manager_addvg { } diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.api.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.api.class.php deleted file mode 100644 index 7a5f8c8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.api.class.php +++ /dev/null @@ -1,87 +0,0 @@ - - */ - -class kvm_api -{ - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param object $controller - */ - //-------------------------------------------- - function __construct($controller) { - $this->controller = $controller; - $this->user = $this->controller->user; - $this->html = $this->controller->response->html; - $this->response = $this->html->response(); - $this->file = $this->controller->file; - #$this->admin = $this->controller->openqrm->admin(); - - #$id = $this->response->html->request()->get('appliance_id'); - #if($id === '') { - # return false; - #} - #// set ENV - #$this->response->params['appliance_id'] = $id; - #$appliance = new appliance(); - #$resource = new resource(); - - #$appliance->get_instance_by_id($id); - #$resource->get_instance_by_id($appliance->resources); - - #$this->resource = $resource; - #$this->appliance = $appliance; - #$this->statfile = 'kvm-stat/'.$resource->id.'.pick_iso_config'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - */ - //-------------------------------------------- - function action() { - $action = $this->html->request()->get($this->controller->actions_name); - switch( $action ) { - case 'progress': - $this->progress(); - break; - } - } - - //-------------------------------------------- - /** - * Get progress - * - * @access public - */ - //-------------------------------------------- - function progress() { - $name = basename($this->response->html->request()->get('name')); - $file = $this->controller->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$name; - if($this->file->exists($file)) { - echo $this->file->get_contents($file); - } else { - header("HTTP/1.0 404 Not Found"); - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.clone.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.clone.class.php deleted file mode 100644 index a3bed71..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.clone.class.php +++ /dev/null @@ -1,284 +0,0 @@ - - */ - -class kvm_clone -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->volgroup = $this->response->html->request()->get('volgroup'); - $this->lvol = $this->response->html->request()->get('lvol'); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - - $this->response->add('storage_id', $storage_id); - $this->response->add('volgroup', $this->volgroup); - $this->response->add('lvol', $this->lvol); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->duplicate(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'volgroup', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/kvm-clone.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add(sprintf($this->lang['label'], $this->lvol), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * clone - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function duplicate() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - $name = $form->get_request('name'); - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm clone'; - $command .= ' -t '.$this->deployment->type; - $command .= ' -v '.$this->volgroup; - $command .= ' -n '.$this->lvol; - $command .= ' -s '.$name; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --caching false'; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if ($this->file->exists($statfile)) { - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[1]; - if($name === $check) { - $error = sprintf($this->lang['error_exists'], $name); - } - } - } - } - } - // check for image name - $image = new image(); - $image->get_instance_by_name($name); - if ((isset($image->id)) && ($image->id > 1)) { - $error = sprintf($this->lang['error_exists'], $name); - } - - if(isset($error)) { - $response->error = $error; - } else { - $file = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.lvm.'.$name.'.sync_progress'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $root_device_ident = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.'.$name.'.root_device'; - if($this->file->exists($root_device_ident)) { - $this->file->remove($root_device_ident); - } - $this->resource->send_command($this->resource->ip, $command); - while (!$this->file->exists($file)) - { - usleep(10000); - clearstatcache(); - } - // wait for the root-device identifier - while (!$this->file->exists($root_device_ident)) - { - usleep(10000); - clearstatcache(); - } - $root_device = trim($this->file->get_contents($root_device_ident)); - $this->file->remove($root_device_ident); - - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $name; - $image_fields['image_type'] = $this->deployment->type; - $image_fields['image_rootfstype'] = 'local'; - $image_fields['image_storageid'] = $this->storage->id; - $image_fields['image_comment'] = "Image Object for volume $name"; - $image_fields['image_rootdevice'] = $root_device; - $image_fields['image_size'] = 0; - $image = new image(); - $image->add($image_fields); - $response->image_id = $image_fields["image_id"]; - $response->msg = sprintf($this->lang['msg_cloned'], $this->lvol, $name); - } - - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'clone'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['value'] = $this->lvol.'c'; - $d['name']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - - - //-------------------------------------------- - /** - * Set max - * - * @access protected - * @return bool - */ - //-------------------------------------------- - function set_max() { - $vgmax = ''; - $kvmax = ''; - $statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if ($this->file->exists($statfile)) { - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[1] === $this->lvol) { - $kvmax = str_replace('.', '', $line[4]); - $kvmax = str_replace('m', '', $kvmax); - $kvmax = (int)$kvmax / 100; - } - } - } - } - } - return $kvmax; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.controller.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.controller.class.php deleted file mode 100644 index c81f67b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.controller.class.php +++ /dev/null @@ -1,793 +0,0 @@ - - */ - -class kvm_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array ( - 'tab' => 'Select KVM Host', - 'label' => 'Select KVM Host', - 'action_edit' => 'edit', - 'table_name' => 'Name', - 'table_id' => 'Id', - 'table_recource' => 'Resource', - 'table_type' => 'Type', - 'table_deployment' => 'Deployment', - 'title_vms' => 'Edit Virtual Machines', - 'title_lvm' => 'Edit LVM Storage', - 'title_bf' => 'Edit Blockfile Storage', - 'title_glusterfs' => 'Edit GlusterFS Storage', - 'error_no_storage' => 'No storage configured yet!

    Please create a KVM first!', - 'new_storage' => 'New Storage', - 'network_manager' => 'Network', - 'please_wait' => 'Loading Volume groups. Please wait ..', - ), - 'edit' => array ( - 'tab' => 'Select Volume group', - 'label' => 'Select Volume group on KVM %s', - 'lang_id' => 'ID', - 'lang_name' => 'Name', - 'lang_resource' => 'Resource', - 'lang_state' => 'State', - 'lang_deployment' => 'Deployment', - 'action_edit' => 'select', - 'action_add' => 'Add new Volume Group', - 'action_remove' => 'remove', - 'table_name' => 'Name', - 'table_pv' => 'PV', - 'table_lv' => 'LV', - 'table_sn' => 'SN', - 'table_attr' => 'Attributes', - 'table_vg' => 'Volue Group Details', - 'table_bricks' => 'Gluster Bricks', - 'table_type' => 'Type', - 'table_status' => 'Status', - 'table_topology' => 'Topology', - 'table_transport' => 'Transport', - 'table_vsize' => 'Size', - 'table_vfree' => 'Free', - 'error_no_kvm' => 'Storage %s is not of type kvm', - 'please_wait' => 'Loading Volume group. Please wait ..', - ), - 'addvg' => array( - 'tab' => 'Add Volume Group', - 'label' => 'Add Volume Group to storage %s', - 'partition' => 'Partition', - 'name' => 'Name', - 'extend' => 'extend partition', - 'confirm_text' => 'All Data on %s will be erased.
    Are you sure to continue?', - 'msg_added' => 'Successfully added Volume Group %s', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'removevg' => array( - 'tab' => 'Remove Volume Group', - 'label' => 'Remove Volume Group on storage %s', - 'confirm_text' => 'Do you realy want to remove Volume Group %s?', - 'msg_removed' => 'Successfully removed Volume Group %s', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'volgroup' => array ( - 'tab' => 'Edit Volume group', - 'label' => 'Edit Volume group %s on KVM %s', - 'lang_id' => 'ID', - 'lang_name' => 'Name', - 'lang_deployment' => 'Deployment', - 'lang_resource' => 'Resource', - 'lang_state' => 'State', - 'lang_attr' => 'Attributes', - 'lang_pv' => 'PV / LV / SN', - 'lang_size' => 'Size / Free', - 'action_add' => 'Add new logical volume', - 'action_remove' => 'remove', - 'action_resize' => 'resize', - 'action_snap' => 'snap', - 'action_clone' => 'clone', - 'action_add_image' => 'Add', - 'action_sync' => 'Sync', - 'action_remove_image' => 'Remove', - 'action_sync_in_progress' => 'Source of synchronisation - Please wait', - 'action_clone_in_progress' => 'Synchronisation in progress - Please wait', - 'action_clone_finished' => 'Syncronisation finished!', - 'table_state' => 'State', - 'table_name' => 'Lvol', - 'table_deployment' => 'Deployment', - 'table_attr' => 'Attributes', - 'table_path' => 'Path', - 'table_size' => 'Size', - 'table_source' => 'Source', - 'table_path_physical' => 'Physical', - 'table_path_glusters' => 'Logical', - 'error_no_kvm' => 'Storage %s is not of type kvm-deployment', - 'please_wait' => 'Loading Volume group. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'add' => array ( - 'tab' => 'Add Logical Volume', - 'label' => 'Add Logical Volume to Volume group %s', - 'form_name' => 'Name', - 'form_size' => 'Size (max: %s MB)', - 'form_type' => 'Volume Type', - 'msg_added' => 'Added Logical Volume %s', - 'msg_add_failed' => 'Failed adding Logical Volume %s', - 'error_exists' => 'Logical Volume %s allready exists', - 'error_name' => 'Name must be %s', - 'error_size' => 'Size must be %s', - 'error_size_exeeded' => 'Size exeeds %s MB', - 'lang_name_generate' => 'generate name', - 'please_wait' => 'Adding Logical Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'image' => array ( - 'label' => 'Add/Remove Image for Logical Volume %s', - 'tab' => 'Add/Remove Image', - 'error_exists' => 'Image %s allready exists', - 'error_image_still_in_use' => 'Image id %s is still in use by Server(s) %s', - 'msg_added_image' => 'Added Image %s', - 'msg_removed_image' => 'Removed Image id %s', - 'msg_synced_image' => 'Synced Image id %s', - 'please_wait' => 'Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'snap' => array ( - 'label' => 'Snap Logical Volume %s', - 'tab' => 'Snap Logical Volume', - 'msg_snaped' => 'Snaped %s to %s', - 'msg_snap_failed' => 'Snapping failed for %s to %s', - 'form_name' => 'Name', - 'form_size' => 'Size (max: %s MB)', - 'error_exists' => 'Volume %s allready exists', - 'error_name' => 'Name must be %s', - 'error_size' => 'Size must be %s', - 'error_size_exeeded' => 'Size exeeds %s MB', - 'please_wait' => 'Snaping Logical Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'clone' => array ( - 'label' => 'Clone Logical Volume %s', - 'tab' => 'Clone Logical Volume', - 'msg_cloned' => 'Cloned %s as %s', - 'msg_clone_failed' => 'Clone failed for %s as %s', - 'form_name' => 'Name', - 'error_exists' => 'Volume %s allready exists', - 'error_name' => 'Name must be %s', - 'please_wait' => 'Cloning Logical Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'remove' => array ( - 'label' => 'Delete Logical Volume(s)', - 'msg_removed' => 'Deleted Logical Volume %s', - 'msg_vm_image_still_in_use' => 'Volume %s of Image id %s is still in use by appliance(s) %s', - 'please_wait' => 'Deleting Logical Volume(s). Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'resize' => array ( - 'label' => 'Resize Logical Volume %s', - 'tab' => 'Resize Logical Volume', - 'size' => 'min. %s MB, max. %s MB', - 'error_size' => 'Size must be %s', - 'error_size_exeeded' => 'Size exeeds %s MB', - 'error_size_undercut' => 'Size undercuts %s MB', - 'msg_resized' => 'Resized Logical Volume %s', - 'please_wait' => 'Resizing Logical Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/kvm/lang", 'kvm.ini'); - $this->tpldir = $this->rootdir.'/plugins/kvm/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - if($this->action === 'addvg' || $this->action === 'removevg') { - $this->action = 'edit'; - } else { - $this->action = 'volgroup'; - } - } - if($this->action === '') { - $this->action = 'select'; - } - // Set response and reload statfile - if($this->action !== 'select') { - $this->response->add('storage_id', $this->response->html->request()->get('storage_id')); - if($this->action !== 'remove' && $this->action !== 'addvg' && $this->action !== 'removevg') { - $this->__reload('vg'); - } - if($this->action !== 'edit') { - $this->response->add('volgroup', $this->response->html->request()->get('volgroup')); - } - } - $content = array(); - switch( $this->action ) { - case '': - case 'select': - $content[] = $this->select(true); - break; - case 'edit': - $content[] = $this->select(false); - $content[] = $this->edit(true); - break; - case 'addvg': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->addvg(true); - break; - case 'removevg': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->removevg(true); - break; - case 'volgroup': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(true); - break; - case 'add': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(false); - $content[] = $this->add(true); - break; - case 'resize': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(false); - $content[] = $this->resize(true); - break; - case 'image': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(false); - $content[] = $this->image(true); - break; - case 'snap': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(false); - $content[] = $this->snap(true); - break; - case 'clone': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(false); - $content[] = $this->duplicate(true); - break; - case 'remove': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(false); - $content[] = $this->remove(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * API - * - * @access public - */ - //-------------------------------------------- - function api() { - require_once($this->rootdir.'/plugins/kvm/class/kvm.api.class.php'); - $controller = new kvm_api($this); - $controller->action(); - } - - //-------------------------------------------- - /** - * Select Storages of type KVM - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm-vm.select.class.php'); - $controller = new kvm_vm_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Edit KVM - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function edit( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm.edit.class.php'); - $controller = new kvm_edit($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['edit']; - $data = $controller->action(); - } - $content['label'] = $this->lang['edit']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'edit' ); - $content['onclick'] = false; - if($this->action === 'edit'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add lvm volume group - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function addvg( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm.addvg.class.php'); - $controller = new kvm_addvg($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->rootdir.'/plugins/device-manager/tpl/'; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['addvg']; - $data = $controller->action(); - } - $content['label'] = $this->lang['addvg']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'addvg' ); - $content['onclick'] = false; - if($this->action === 'addvg'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Remove lvm volume group - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function removevg( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm.removevg.class.php'); - $controller = new kvm_removevg($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->rootdir.'/plugins/device-manager/tpl/'; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['removevg']; - $data = $controller->action(); - } - $content['label'] = $this->lang['removevg']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'removevg' ); - $content['onclick'] = false; - if($this->action === 'removevg'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Edit KVM volgroup - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function volgroup( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - if($this->response->html->request()->get('reload') !== 'false') { - $this->__reload('lv'); - } - require_once($this->rootdir.'/plugins/kvm/class/kvm.volgroup.class.php'); - $controller = new kvm_volgroup($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['volgroup']; - $data = $controller->action(); - } - $content['label'] = $this->lang['volgroup']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'volgroup' ); - $content['onclick'] = false; - if($this->action === 'volgroup'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add new Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function add( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm.add.class.php'); - $controller = new kvm_add($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['add']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['add']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'add' ); - $content['onclick'] = false; - if($this->action === 'add'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Remove Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function remove( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm.remove.class.php'); - $controller = new kvm_remove($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['remove']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Remove'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'remove' ); - $content['onclick'] = false; - if($this->action === 'remove' || $this->action === $this->lang['volgroup']['action_remove']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add/Remvoe Image object - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function image( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm.image.class.php'); - $controller = new kvm_image($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['image']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['image']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'image' ); - $content['onclick'] = false; - if($this->action === 'image'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Snapshot Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function snap( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm.snap.class.php'); - $controller = new kvm_snap($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['snap']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['snap']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'snap' ); - $content['onclick'] = false; - if($this->action === 'snap' || $this->action === $this->lang['edit']['action_snap']){ - $content['active'] = true; - } - return $content; - } - - - - //-------------------------------------------- - /** - * Clone Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function duplicate( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm.clone.class.php'); - $controller = new kvm_clone($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['clone']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['clone']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'clone' ); - $content['onclick'] = false; - if($this->action === 'clone' || $this->action === $this->lang['edit']['action_clone']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Resize Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function resize( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/kvm/class/kvm.resize.class.php'); - $controller = new kvm_resize($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['resize']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['resize']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'resize' ); - $content['onclick'] = false; - if($this->action === 'resize'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Reload Exports - * - * @access public - */ - //-------------------------------------------- - function __reload($mode) { - $OPENQRM_SERVER_BASE_DIR = $this->openqrm->get('basedir'); - - $storage_id = $this->response->html->request()->get('storage_id'); - $volgroup = $this->response->html->request()->get('volgroup'); - - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $command = ''; - $file = ''; - // reload volume group - if($mode === 'vg') { - $file = $OPENQRM_SERVER_BASE_DIR.'/plugins/kvm/web/storage/'.$resource->id.'.vg.stat'; - $command .= $OPENQRM_SERVER_BASE_DIR.'/plugins/kvm/bin/openqrm-kvm post_vg -t '.$deployment->type; - } - // reload logical volumes - if($mode === 'lv') { - $file = $OPENQRM_SERVER_BASE_DIR.'/plugins/kvm/web/storage/'.$resource->id.'.'.$volgroup.'.lv.stat'; - $command .= $OPENQRM_SERVER_BASE_DIR.'/plugins/kvm/bin/openqrm-kvm post_lv'; - $command .= ' -v '.$volgroup.' -t '.$deployment->type; - } - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - return true; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.edit.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.edit.class.php deleted file mode 100644 index 6d8460b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.edit.class.php +++ /dev/null @@ -1,331 +0,0 @@ - - */ - -class kvm_edit -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_identifier'; -/** -* identifier name -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - - $this->response->add('storage_id', $this->response->html->request()->get('storage_id')); - } - - //-------------------------------------------- - /** - * Init - * - * @access public - */ - //-------------------------------------------- - function init() { - $storage_id = $this->response->html->request()->get('storage_id'); - if($storage_id === '') { - return false; - } - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $this->resource = $resource; - $this->storage = $storage; - $this->deployment = $deployment; - $this->statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$resource->id.'.vg.stat'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->init(); - $data = $this->edit(); - if($data !== false) { - $t = $this->response->html->template($this->tpldir.'/kvm-edit.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($data); - $t->add($this->lang['lang_id'], 'lang_id'); - $t->add($this->lang['lang_name'], 'lang_name'); - $t->add($this->lang['lang_resource'], 'lang_resource'); - $t->add($this->lang['lang_deployment'], 'lang_deployment'); - $t->add($this->lang['lang_state'], 'lang_state'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->add(sprintf($this->lang['label'], $data['name']), 'label'); - return $t; - } else { - $msg = sprintf($this->lang['error_no_kvm'], $this->response->html->request()->get('storage_id')); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return array|false - */ - //-------------------------------------------- - function edit() { - if(strpos($this->deployment->type, 'kvm') !== false) { - - // check device-manager - $devicemgm = false; - if($this->file->exists($this->openqrm->get('webdir').'/plugins/device-manager/class/device-manager.addvg.class.php')) { - $devicemgm = true; - } - - $d['state'] = ''.$this->resource->state.''; - $d['resource'] = $this->resource->id.' / '.$this->resource->ip; - $d['deployment'] = $this->deployment->type; - $d['name'] = $this->storage->name; - $d['id'] = $this->storage->id; - - $body = array(); - $file = $this->statfile; - if($this->file->exists($file)) { - $lines = explode("\n", $this->file->get_contents($file)); - if(count($lines) >= 1) { - $i = 0; - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $name = substr($line[0], strripos($line[0], '/')); - - //handle format send by df - $line[5] = str_replace('MB', '.00', $line[5]); - $line[6] = str_replace('MB', '.00', $line[6]); - - $vsize = number_format(substr($line[5], 0, strpos($line[5], '.')), 0, '', '').' MB'; - $vfree = str_replace('m', '', $line[6]); - if($vfree !== '0') { - $vfree = number_format(substr($line[6], 0, strpos($line[6], '.')), 0, '', ''); - } - $a = $this->response->html->a(); - $a->title = $this->lang['action_edit']; - $a->label = $this->lang['action_edit']; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($this->actions_name, "volgroup").'&volgroup='.$name; - - if($d['deployment'] === 'kvm-lvm-deployment') { - $body[$i] = array( - 'name' => $name, - 'pv' => $line[1], - 'lv' => $line[2], - 'sn' => $line[3], - 'attr' => $line[4], - 'vsize' => $vsize, - 'vfree' => $vfree.' MB', - 'action' => $a->get_string(), - ); - if($devicemgm === true) { - if($line[2] === '0' && $line[3] === '0') { - $a = $this->response->html->a(); - $a->title = $this->lang['action_remove']; - $a->label = $this->lang['action_remove']; - $a->handler = 'onclick="wait();"'; - $a->css = 'remove'; - $a->href = $this->response->get_url($this->actions_name, "removevg").'&volgroup='.$name; - $body[$i]['action'] = $body[$i]['action'].$a->get_string(); - } - } - } - if($d['deployment'] === 'kvm-bf-deployment') { - $body[$i] = array( - 'name' => $name, - 'vsize' => $vsize, - 'vfree' => $vfree.' MB', - 'attr' => ' ', - 'action' => $a->get_string(), - ); - } - if($d['deployment'] === 'kvm-gluster-deployment') { - $vg = ''.$this->lang['table_type'].': '.$line[1].'
    '; - $vg .= ''.$this->lang['table_status'].': '.$line[2].'
    '; - $vg .= ''.$this->lang['table_topology'].': '.$line[3].'
    '; - $vg .= ''.$this->lang['table_transport'].': '.$line[4]; - $brick_arr = explode(',', $line[7]); - $bricks = ''; - foreach($brick_arr as $brick) { - $bricks .= ''.$brick.'
    '; - } - $body[$i] = array( - 'name' => $name, - 'vg' => $vg, - 'bricks' => $bricks, - 'vsize' => $vsize, - 'vfree' => $vfree.' MB', - 'action' => $a->get_string(), - ); - } - if($d['deployment'] === 'kvm-ceph-deployment') { - $body[$i] = array( - 'name' => $name, - 'poolid' => $line[1], - 'vusedpercent' => $line[3].' %', - 'vused' => $line[4].' MB', - 'available' => $line[6].' MB', - 'objects' => $line[2], - 'action' => $a->get_string(), - ); - } - - } - $i++; - } - } - } - - if($d['deployment'] === 'kvm-lvm-deployment') { - $h['name']['title'] = $this->lang['table_name']; - $h['vsize']['title'] = $this->lang['table_vsize']; - $h['vfree']['title'] = $this->lang['table_vfree']; - $h['pv']['title'] = $this->lang['table_pv']; - $h['lv']['title'] = $this->lang['table_lv']; - $h['sn']['title'] = $this->lang['table_sn']; - $h['attr']['title'] = $this->lang['table_attr']; - $h['action']['title'] = ' '; - $h['action']['sortable'] = false; - } - if($d['deployment'] === 'kvm-bf-deployment') { - $h['name']['title'] = $this->lang['table_name']; - $h['vsize']['title'] = $this->lang['table_vsize']; - $h['vfree']['title'] = $this->lang['table_vfree']; - $h['attr']['title'] = ' '; - $h['attr']['sortable'] = false; - $h['action']['title'] = ' '; - $h['action']['sortable'] = false; - } - if($d['deployment'] === 'kvm-gluster-deployment') { - $h['name']['title'] = $this->lang['table_name']; - $h['vg']['title'] = $this->lang['table_vg']; - $h['bricks']['title'] = $this->lang['table_bricks']; - $h['vsize']['title'] = $this->lang['table_vsize']; - $h['vfree']['title'] = $this->lang['table_vfree']; - $h['edit']['title'] = ' '; - $h['edit']['sortable'] = false; - } - if($d['deployment'] === 'kvm-ceph-deployment') { - $h['name']['title'] = $this->lang['table_name']; - $h['poolid']['title'] = $this->lang['lang_id']; - $h['vusedpercent']['title'] = $this->lang['table_vusedpercent']; - $h['vusedpercent']['title'] = $this->lang['table_vusedpercent']; - $h['vused']['title'] = $this->lang['table_vused']; - $h['vused']['title'] = $this->lang['table_vused']; - $h['available']['title'] = $this->lang['table_available']; - $h['available']['title'] = $this->lang['table_available']; - $h['objects']['title'] = $this->lang['table_objects']; - $h['objects']['title'] = $this->lang['table_objects']; - $h['action']['title'] = ' '; - $h['action']['sortable'] = false; - } - - $table = $this->response->html->tablebuilder('kvm_edit', $this->response->get_array($this->actions_name, 'edit')); - $table->sort = 'name'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = count($body); - $table->autosort = true; - $table->sort_link = false; - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $body; - - $d['add'] = ''; - if($devicemgm === true && $d['deployment'] === 'kvm-lvm-deployment') { - $a = $this->response->html->a(); - $a->title = $this->lang['action_add']; - $a->label = $this->lang['action_add']; - $a->handler = 'onclick="wait();"'; - $a->css = 'add'; - $a->href = $this->response->get_url($this->actions_name, "addvg"); - $d['add'] = $a->get_string(); - } - - $d['table'] = $table->get_string(); - return $d; - } else { - return false; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.image.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.image.class.php deleted file mode 100644 index c89ef65..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.image.class.php +++ /dev/null @@ -1,191 +0,0 @@ - - */ - -class kvm_image -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->volgroup = $this->response->html->request()->get('volgroup'); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - - $this->response->add('storage_id', $storage_id); - $this->response->add('volgroup', $this->volgroup); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->image(); - $this->response->params['reload'] = 'false'; - $this->response->redirect( - $this->response->get_url($this->actions_name, 'volgroup', $this->message_param, $response) - ); - } - - //-------------------------------------------- - /** - * Add/Remove image object - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function image() { - $response = ''; - $errors = array(); - $message = array(); - $image_command = $this->response->html->request()->get('image_command'); - - if( $image_command !== '' ) { - switch ($image_command) { - case 'add': - $root_device = $this->response->html->request()->get('root_device'); - if ($this->deployment->type == 'kvm-gluster-deployment') { - $image_name = $this->response->html->request()->get('image_name'); - } else { - $image_name = basename($root_device); - } - - // check if image name is not in use yet - $image = new image(); - $image->get_instance_by_name($image_name); - if (strlen($image->id)) { - $errors[] = sprintf($this->lang['error_exists'], $image_name); - } else { - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $image_name; - $image_fields['image_type'] = $this->deployment->type; - $image_fields['image_rootfstype'] = 'local'; - $image_fields['image_storageid'] = $this->storage->id; - $image_fields['image_comment'] = "Image Object for volume $image_name"; - $image_fields['image_rootdevice'] = $root_device; - $image_fields['image_size'] = $this->response->html->request()->get('size'); - $image = new image(); - $image->add($image_fields); - $message[] = sprintf($this->lang['msg_added_image'], $image_name); - } - break; - - case 'remove': - $image_id = $this->response->html->request()->get('image_id'); - // check if image is not in use any more before removing - $remove_error = 0; - $appliance = new appliance(); - $appliance_id_list = $appliance->get_all_ids(); - foreach($appliance_id_list as $appliance_list) { - $appliance_id = $appliance_list['appliance_id']; - $app_image_remove_check = new appliance(); - $app_image_remove_check->get_instance_by_id($appliance_id); - if ($app_image_remove_check->imageid == $image_id) { - $image_is_used_by_appliance .= $appliance_id." "; - $remove_error = 1; - } - } - if ($remove_error == 1) { - $errors[] = sprintf($this->lang['error_image_still_in_use'], $image_id, $image_is_used_by_appliance); - } else { - $image_remove = new image(); - $image_remove->remove($image_id); - $message[] = sprintf($this->lang['msg_removed_image'], $image_id); - } - break; - case 'sync': - $image_id = $this->response->html->request()->get('image_id'); - $image = $this->openqrm->image(); - $image_fields['image_size'] = $this->response->html->request()->get('size'); - $image->update($image_id, $image_fields); - $message[] = sprintf($this->lang['msg_synced_image'], $image_id); - break; - } - if(count($errors) === 0) { - $response = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response = join('
    ', $msg); - } - } else { - $response = ''; - } - return $response; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.remove.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.remove.class.php deleted file mode 100644 index 8b97d09..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.remove.class.php +++ /dev/null @@ -1,225 +0,0 @@ - - */ - -class kvm_remove -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->volgroup = $this->response->html->request()->get('volgroup'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->remove(); - if(isset($response->msg)) { - $this->response->params['reload'] = 'false'; - $this->response->redirect( - $this->response->get_url($this->actions_name, 'volgroup', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/kvm-remove.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->add($response->form); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Remove - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function remove() { - $response = $this->get_response(); - $lvols = $response->html->request()->get($this->identifier_name); - $form = $response->form; - if( $lvols !== '' ) { - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $i = 0; - foreach($lvols as $ex) { - $d['param_f'.$i]['label'] = $ex; - $d['param_f'.$i]['object']['type'] = 'htmlobject_input'; - $d['param_f'.$i]['object']['attrib']['type'] = 'checkbox'; - $d['param_f'.$i]['object']['attrib']['name'] = $this->identifier_name.'['.$i.']'; - $d['param_f'.$i]['object']['attrib']['value'] = $ex; - $d['param_f'.$i]['object']['attrib']['checked'] = true; - $i++; - } - $form->add($d); - if(!$form->get_errors() && $response->submit()) { - $name = $this->openqrm->admin()->name; - $pass = $this->openqrm->admin()->password; - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - - $storage->get_instance_by_id($this->response->html->request()->get('storage_id')); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $errors = array(); - $message = array(); - foreach($lvols as $key => $lvol) { - // check if an appliance is still using the volume as an image - $image = new image(); - $image->get_instance_by_name($lvol); - - // check if it is still in use - $appliance = new appliance(); - $appliances_using_resource = $appliance->get_ids_per_image($image->id); - if (count($appliances_using_resource) > 0) { - $appliances_using_resource_str = implode(",", $appliances_using_resource[0]); - $errors[] = sprintf($this->lang['msg_vm_image_still_in_use'], $lvol, $image->id, $appliances_using_resource_str); - } else { - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm remove'; - $command .= ' -n '.$lvol; - $command .= ' -v '.$this->volgroup; - $command .= ' -t '.$deployment->type; - $command .= ' -u '.$name.' -p '.$pass; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $file = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$resource->id.'.'.$this->volgroup.'.lv.stat'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - - $form->remove($this->identifier_name.'['.$key.']'); - $message[] = sprintf($this->lang['msg_removed'], $lvol); - // remove the image of the volume - $image->remove_by_name($lvol); - } - - } - if(count($errors) === 0) { - $response->msg = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response->error = join('
    ', $msg); - } - } - } else { - $response->msg = ''; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $this->response->add('storage_id', $this->response->html->request()->get('storage_id')); - $this->response->add('volgroup', $this->response->html->request()->get('volgroup')); - $this->response->add($this->identifier_name.'[]', ''); - - $response = $this->response; - $form = $response->get_form($this->actions_name, 'remove'); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.removevg.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.removevg.class.php deleted file mode 100644 index 6d2faee..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.removevg.class.php +++ /dev/null @@ -1,19 +0,0 @@ - - */ -require_once($_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/device-manager/class/device-manager.removevg.class.php'); -class kvm_removevg extends device_manager_removevg { } diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.resize.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.resize.class.php deleted file mode 100644 index f265b79..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.resize.class.php +++ /dev/null @@ -1,255 +0,0 @@ - - */ - -class kvm_resize -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->volgroup = $this->response->html->request()->get('volgroup'); - $this->lvol = $this->response->html->request()->get('lvol'); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - - $this->response->add('storage_id', $storage_id); - $this->response->add('volgroup', $this->volgroup); - $this->response->add('lvol', $this->lvol); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - - $response = $this->resize(); - if(isset($response->msg)) { - $this->response->params['reload'] = 'false'; - $this->response->redirect( - $this->response->get_url($this->actions_name, 'volgroup', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/kvm-resize.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add(sprintf($this->lang['label'], $this->lvol), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->add($response->form); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * resize - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function resize() { - $this->set_max(); - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - if ($this->deployment->type === 'kvm-lvm-deployment') { - if($form->get_request('size') > $this->max) { - $form->set_error('size', sprintf($this->lang['error_size_exeeded'], number_format($this->max, 0, '', ''))); - } - if($form->get_request('size') < $this->min) { - $form->set_error('size', sprintf($this->lang['error_size_undercut'], number_format($this->min, 0, '', ''))); - } - } - if(!$form->get_errors()) { - $name = $form->get_request('name'); - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm resize'; - $command .= ' -t '.$this->deployment->type; - $command .= ' -v '.$this->volgroup; - $command .= ' -n '.$this->lvol; - $command .= ' -m '.$form->get_request('size'); - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if($this->file->exists($statfile)) { - $this->file->remove($statfile); - } - $this->resource->send_command($this->resource->ip, $command); - while (!$this->file->exists($statfile)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $response->msg = sprintf($this->lang['msg_resized'], $this->lvol); - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'resize'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - - if ($this->deployment->type === 'kvm-ceph-deployment') { - $d['size']['label'] = $this->lang['ceph_size']; - } else { - $d['size']['label'] = sprintf($this->lang['size'],number_format($this->min, 0, '', ''), number_format($this->max, 0, '', '')); - } - $d['size']['required'] = true; - $d['size']['validate']['regex'] = '/^[0-9]+$/i'; - $d['size']['validate']['errormsg'] = sprintf($this->lang['error_size'], '0-9'); - $d['size']['object']['type'] = 'htmlobject_input'; - $d['size']['object']['attrib']['name'] = 'size'; - $d['size']['object']['attrib']['type'] = 'text'; - $d['size']['object']['attrib']['value'] = ''; - $d['size']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - - //-------------------------------------------- - /** - * Set min and max - * - * @access protected - */ - //-------------------------------------------- - function set_max() { - $vgmax = ''; - $kvmax = ''; - $statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if ($this->file->exists($statfile)) { - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[1] === $this->lvol) { - $kvmax = str_replace('.', '', $line[4]); - $kvmax = str_replace('m', '', $kvmax); - $kvmax = (int)$kvmax / 100; - $this->min = $kvmax; - } - } - } - } - } - $statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.vg.stat'; - if ($this->file->exists($statfile)) { - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[0] === $this->volgroup) { - $vgmax = str_replace('.', '', $line[6]); - $vgmax = str_replace('m', '', $vgmax); - $vgmax = (int)$vgmax / 100; - $this->max = $vgmax + $kvmax; - } - } - } - } - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.select.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.select.class.php deleted file mode 100644 index bdd2335..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.select.class.php +++ /dev/null @@ -1,214 +0,0 @@ - - */ - -class kvm_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $table = $this->select(); - $t = $this->response->html->template($this->tpldir.'/kvm-select.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($table, 'table'); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return htmlobject_tablebulider | htmlobject_div - */ - //-------------------------------------------- - function select() { - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - $type = $this->response->html->request()->get('storage_type'); - if($type === '') { - $type = 'kvm'; - } - $deployment->get_instance_by_type($type); - $storages = $storage->display_overview(0, $storage->get_count(), 'storage_id', 'ASC'); - $b = array(); - if(count($storages) >= 1) { - foreach($storages as $k => $v) { - $storage->get_instance_by_id($v["storage_id"]); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - if($deployment->storagetype === 'kvm') { - $resource_icon_default = "/img/resource.png"; - $storage_icon = "/plugins/kvm/img/plugin.png"; - $state_icon = $this->openqrm->get('baseurl')."/img/".$resource->state.".png"; - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default = $storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - - $a = $this->response->html->a(); - $a->title = $this->lang['action_edit']; - $a->label = $this->lang['action_edit']; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($this->actions_name, "edit").'&storage_id='.$storage->id; - - $data = ''.$this->lang['table_recource'].': '.$resource->id.' / '.$resource->ip.'
    '; - $data .= ''.$this->lang['table_type'].': '.$deployment->storagetype.'
    '; - $data .= ''.$this->lang['table_deployment'].': '.$deployment->storagedescription.'
    '; - - $b[] = array( - 'state' => 'State', - 'icon' => 'Icon', - 'storage_id' => $storage->id, - 'name' => $storage->name, - 'storage_resource_id' => $storage->resource_id, - 'deployment' => $deployment->storagedescription, - 'data' => $data, - 'comment' => '', - 'edit' => $a->get_string(), - ); - } - } - - $h = array(); - $h['state'] = array(); - $h['state']['title'] =' '; - $h['state']['sortable'] = false; - $h['icon'] = array(); - $h['icon']['title'] =' '; - $h['icon']['sortable'] = false; - $h['storage_id'] = array(); - $h['storage_id']['title'] = $this->lang['table_id']; - $h['name'] = array(); - $h['name']['title'] = $this->lang['table_name']; - $h['storage_resource_id'] = array(); - $h['storage_resource_id']['title'] = $this->lang['table_recource']; - $h['storage_resource_id']['hidden'] = true; - $h['data'] = array(); - $h['data']['title'] = ' '; - $h['data']['sortable'] = false; - $h['deployment'] = array(); - $h['deployment']['title'] = $this->lang['table_deployment']; - $h['deployment']['hidden'] = true; - $h['comment'] = array(); - $h['comment']['title'] =' '; - $h['comment']['sortable'] = false; - $h['edit'] = array(); - $h['edit']['title'] = ' '; - $h['edit']['sortable'] = false; - - $table = $this->response->html->tablebuilder('kvm', $this->response->get_array($this->actions_name, 'select')); - $table->sort = 'storage_id'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = count($b); - $table->autosort = false; - $table->sort_link = false; - $table->autosort = true; - - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $b; - return $table->get_string(); - } else { - $a = $this->response->html->a(); - $a->title = $this->lang['new_storage']; - $a->label = $this->lang['new_storage']; - $a->handler = 'onclick="wait();"'; - $a->css = 'add'; - $a->href = $this->response->html->thisfile.'?base=storage&storage_action=add'; - - $box = $this->response->html->div(); - $box->id = 'Tabelle'; - $box->css = 'htmlobject_box'; - $content = $this->lang['error_no_storage'].'

    '; - $content .= $a->get_string(); - $box->add($content); - return $box->get_string(); - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.snap.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.snap.class.php deleted file mode 100644 index ab0fc49..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.snap.class.php +++ /dev/null @@ -1,375 +0,0 @@ - - */ - -class kvm_snap -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->lvol = $this->response->html->request()->get('lvol'); - $this->volgroup = $this->response->html->request()->get('volgroup'); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - - $this->response->add('storage_id', $storage_id); - $this->response->add('volgroup', $this->volgroup); - $this->response->add('lvol', $this->lvol); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->set_max(); - $response = $this->snap(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->params['reload'] = 'false'; - $this->response->redirect( - $this->response->get_url($this->actions_name, 'volgroup', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/kvm-snap.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add(sprintf($this->lang['label'], $this->lvol), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * snap - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function snap() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - if($form->get_request('size') > $this->max) { - $form->set_error('size', sprintf($this->lang['error_size_exeeded'], number_format($this->max, 0, '', ''))); - } - if(!$form->get_errors()) { - - $name = $form->get_request('name'); - $name_check = $name; - $command = $this->openqrm->get('basedir').'/plugins/kvm/bin/openqrm-kvm snap'; - $command .= ' -t '.$this->deployment->type; - $command .= ' -v '.$this->volgroup; - $command .= ' -n '.$this->lvol; - if ($this->deployment->type == 'kvm-lvm-deployment') { - // snapshot size is only valid for kvm-lvm-deployment - $command .= ' -m '.$form->get_request('size'); - } - $command .= ' -s '.$name; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if ($this->file->exists($statfile)) { - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[1]; - if ($this->deployment->type == 'kvm-ceph-deployment') { - $check = str_replace('%', '@', $check); - $name_check = $this->lvol."@".$name; - } - if($name_check === $check) { - $error = sprintf($this->lang['error_exists'], $name); - } - } - } - } - } - // check for image name - $image = new image(); - $image->get_instance_by_name($name); - if ((isset($image->id)) && ($image->id > 1)) { - $error = sprintf($this->lang['error_exists'], $name); - } - - if(isset($error)) { - $response->error = $error; - } else { - - // create the image - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - if ($this->deployment->type == 'kvm-ceph-deployment') { - $image_fields['image_name'] = $this->lvol . "@" . $name; - $image_origin = new image(); - $image_origin->get_instance_by_name($this->lvol); - $image_fields['image_size'] = $image_origin->size; - } else { - $image_fields['image_name'] = $name; - $image_fields['image_size'] = 0; - } - $image_fields['image_type'] = $this->deployment->type; - $image_fields['image_rootfstype'] = 'local'; - $image_fields['image_storageid'] = $this->storage->id; - $image_fields['image_comment'] = "Image Object for volume $name"; - $image = $this->openqrm->image(); - $image->add($image_fields); - - if($this->file->exists($statfile)) { - $this->file->remove($statfile); - } - $this->resource->send_command($this->resource->ip, $command); - while (!$this->file->exists($statfile)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - - $created = false; - $bf_volume_path = ""; - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[1]; - if ($this->deployment->type == 'kvm-ceph-deployment') { - $check = str_replace('%', '@', $check); - $name_check = $this->lvol."@".$name; - } - if($name_check === $check) { - $created = true; - $bf_volume_path = $line[2]; - break; - } - } - } - } - - if ($created) { - // set image rootdevice - switch($this->deployment->type) { - case 'kvm-lvm-deployment': - $rootdevice = '/dev/'.$this->volgroup.'/'.$name; - break; - case 'kvm-bf-deployment': - $rootdevice = $bf_volume_path; - break; - case 'kvm-gluster-deployment': - $rootdevice = "gluster://".$this->resource->ip."/".$this->volgroup."/".$name; - break; - case 'kvm-ceph-deployment': - $rootdevice = "rbd:".$this->volgroup."/".$this->lvol."@".$name; - break; - } - $image->update($image_fields["image_id"], array('image_rootdevice' => $rootdevice)); - $response->image_id = $image_fields["image_id"]; - $response->msg = sprintf($this->lang['msg_snaped'], $this->lvol, $name); - } else { - // if created failed remove the image - $image->remove_by_name($name); - $response->msg = sprintf($this->lang['msg_snap_failed'], $this->lvol, $name); - } - } - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'snap'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['value'] = $this->lvol.'s'; - $d['name']['object']['attrib']['maxlength'] = 50; - - switch($this->deployment->type) { - case 'kvm-lvm-deployment': - $d['size']['label'] = sprintf($this->lang['form_size'], number_format($this->max, 0, '', '')); - $d['size']['required'] = true; - $d['size']['validate']['regex'] = '/^[0-9]+$/i'; - $d['size']['validate']['errormsg'] = sprintf($this->lang['error_size'], '0-9'); - $d['size']['object']['type'] = 'htmlobject_input'; - $d['size']['object']['attrib']['name'] = 'size'; - $d['size']['object']['attrib']['type'] = 'text'; - $d['size']['object']['attrib']['value'] = ''; - $d['size']['object']['attrib']['maxlength'] = 50; - break; - default: - $d['size'] = ''; - break; - } - $form->add($d); - $response->form = $form; - return $response; - } - - //-------------------------------------------- - /** - * Set max - * - * @access protected - * @return bool - */ - //-------------------------------------------- - function set_max() { - $vgmax = ''; - $kvmax = ''; - $statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if ($this->file->exists($statfile)) { - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[1] === $this->lvol) { - $kvmax = str_replace('.', '', $line[4]); - $kvmax = str_replace('m', '', $kvmax); - $kvmax = (int)$kvmax / 100; - } - } - } - } - } - $statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.vg.stat'; - if ($this->file->exists($statfile)) { - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[0] === $this->volgroup) { - $vgmax = str_replace('.', '', $line[6]); - $vgmax = str_replace('m', '', $vgmax); - $vgmax = (int)$vgmax / 100; - } - } - } - } - } - - if( $vgmax < $kvmax ) { - $max = $vgmax; - } else { - $max = $kvmax; - } - $this->max = $max; - return true; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.volgroup.class.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.volgroup.class.php deleted file mode 100644 index 5bdb3c0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/class/kvm.volgroup.class.php +++ /dev/null @@ -1,597 +0,0 @@ - - */ - -class kvm_volgroup -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'kvm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'kvm_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'kvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'kvm_identifier'; -/** -* identifier name -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - - $this->response->add('storage_id', $this->response->html->request()->get('storage_id')); - $this->response->add('volgroup', $this->response->html->request()->get('volgroup')); - - $this->volgroup = $this->response->params['volgroup']; - } - - //-------------------------------------------- - /** - * Init - * - * @access public - */ - //-------------------------------------------- - function init() { - $storage_id = $this->response->html->request()->get('storage_id'); - if($storage_id === '') { - return false; - } - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $this->resource = $resource; - $this->storage = $storage; - $this->deployment = $deployment; - - $this->statfile = $this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$resource->id.'.'.$this->volgroup.'.lv.stat'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->init(); - $data = $this->edit(); - if($data !== false) { - if($this->deployment->type === 'kvm-ceph-deployment') { - $t = $this->response->html->template($this->tpldir.'/kvm-volgroup-ceph.tpl.php'); - } else { - $t = $this->response->html->template($this->tpldir.'/kvm-volgroup.tpl.php'); - } - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($data); - $t->add($this->lang['lang_id'], 'lang_id'); - $t->add($this->lang['lang_name'], 'lang_name'); - $t->add($this->lang['lang_free'], 'lang_free'); - $t->add($this->lang['lang_resource'], 'lang_resource'); - $t->add($this->lang['lang_deployment'], 'lang_deployment'); - $t->add($this->lang['lang_state'], 'lang_state'); - $t->add($this->lang['lang_attr'], 'lang_attr'); - $t->add($this->lang['lang_pv'], 'lang_pv'); - $t->add($this->lang['lang_size'], 'lang_size'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->add(sprintf($this->lang['label'], $this->volgroup, $data['name']), 'label'); - return $t; - } else { - $msg = sprintf($this->lang['error_no_kvm'], $this->response->html->request()->get('storage_id')); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return array|false - */ - //-------------------------------------------- - function edit() { - if(strpos($this->deployment->type, 'kvm') !== false) { - $resource_icon_default = "/img/resource.png"; - $storage_icon = "/plugins/kvm/img/plugin.png"; - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default = $storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - - // Storage info - $d['state'] = ''.$this->resource->state.''; - $d['resource'] = $this->resource->id.' / '.$this->resource->ip; - $d['name'] = $this->storage->name; - $d['deployment'] = $this->deployment->type; - $d['id'] = $this->storage->id; - - // Volgroup info - $lines = explode("\n", $this->file->get_contents($this->openqrm->get('basedir').'/plugins/kvm/web/storage/'.$this->resource->id.'.vg.stat')); - foreach($lines as $line) { - $line = explode("@", $line); - if(isset($line[0]) && $line[0] === $this->volgroup) { - - //handle format sent by df - $line[5] = str_replace('MB', '.00', $line[5]); - $line[6] = str_replace('MB', '.00', $line[6]); - - $vsize = number_format(substr($line[5], 0, strpos($line[5], '.')), 0, '', '').' MB'; - if($d['deployment'] === 'kvm-ceph-deployment') { - $vfree = $line[6]; - } else { - $vfree = str_replace('m', '', $line[6]); - if($vfree !== '0') { - $vfree = substr($line[6], 0, strpos($line[6], '.')); - } - } - $d['volgroup_name'] = $line[0]; - if($d['deployment'] === 'kvm-lvm-deployment') { - $d['volgroup_pv'] = $line[1]; - $d['volgroup_lv'] = $line[2]; - $d['volgroup_sn'] = $line[3]; - $d['volgroup_attr'] = $line[4]; - $d['volgroup_vsize'] = $vsize; - $d['volgroup_vfree'] = number_format($vfree, 0, '', '').' MB'; - } - if($d['deployment'] === 'kvm-bf-deployment') { - $d['volgroup_pv'] = '-'; - $d['volgroup_lv'] = '-'; - $d['volgroup_sn'] = '-'; - $d['volgroup_attr'] = 'file'; - $d['volgroup_vsize'] = $vsize; - $d['volgroup_vfree'] = number_format($vfree, 0, '', '').' MB'; - } - if($d['deployment'] === 'kvm-gluster-deployment') { - $d['volgroup_pv'] = '-'; - $d['volgroup_lv'] = '-'; - $d['volgroup_sn'] = '-'; - $d['volgroup_attr'] = 'gluster'; - $d['volgroup_vsize'] = $vsize; - $d['volgroup_vfree'] = number_format($vfree, 0, '', '').' MB'; - } - if($d['deployment'] === 'kvm-ceph-deployment') { - $d['volgroup_attr'] = 'ceph'; - $d['volgroup_vfree'] = $line[6].' MB'; - } - } - } - - $a = ' '; - if($d['volgroup_vfree'] !== '0 MB') { - $a = $this->response->html->a(); - $a->label = $this->lang['action_add']; - $a->css = 'add'; - $a->handler = 'onclick="wait();"'; - $a->href = $this->response->get_url($this->actions_name, "add"); - } - $d['add'] = $a; - - $body = array(); - - $file = $this->statfile; - if($this->file->exists($file)) { - $lines = explode("\n", $this->file->get_contents($file)); - if(count($lines) >= 1) { - $disabled = array(); - $t = $this->response->html->template($this->openqrm->get('webdir').'/js/openqrm-progressbar.js'); - foreach($lines as $line) { - if($line !== '') { - $image_add_remove = ''; - $deployment_type = ''; - $line = explode('@', $line); - $name = $line[1]; - $mode = substr($line[3], 0, 1); - $s = ''; - $c = ''; - $r = ''; - $src = ''; - $progress = ''; - if ($line[4] == "clone_in_progress") { - // add to disabled identifier - $disabled[] = $name; - // progressbar - $t->add(uniqid('b'), 'id'); - $t->add($this->openqrm->get('baseurl').'/api.php?action=plugin&plugin=kvm&kvm_action=progress&name='.$this->resource->id.'.lvm.'.$name.'.sync_progress', 'url'); - $t->add($this->lang['action_clone_in_progress'], 'lang_in_progress'); - $t->add($this->lang['action_clone_finished'], 'lang_finished'); - $progress = $t->get_string(); - } else if ($line[4] == "sync_in_progress") { - $progress = $this->lang['action_sync_in_progress']; - $disabled[] = $name; - } else { - if($d['deployment'] === 'kvm-lvm-deployment') { - $volume_size = number_format(substr($line[4], 0, strpos($line[4], '.')), 0, '', ''); - $volume_clone_size = (int)substr($line[4], 0, strpos($line[4], '.')); - } - if($d['deployment'] === 'kvm-bf-deployment') { - $volume_size = number_format(($line[4]/(1000*1000)), 0, '', ''); - $volume_clone_size = (int)substr($line[4], 0, strpos($line[4], '.')); - } - if($d['deployment'] === 'kvm-gluster-deployment') { - $volume_size = number_format(($line[4]/(1000*1000)), 0, '', ''); - $volume_clone_size = (int)substr($line[4], 0, strpos($line[4], '.')); - } - if($d['deployment'] === 'kvm-ceph-deployment') { - $volume_size = $line[4]; - $name = str_replace('%', '@', $name); - $volume_clone_size = $line[4]; - } - - $image_add_remove = ''; - $deployment_type = ''; - $image = $this->openqrm->image(); - $image->get_instance_by_name($name); - if (strlen($image->id)) { - if( $image->type == $this->deployment->type ) { - if( $line[0] === $this->deployment->type && $line[4] !== "sync_in_progress" && $line[4] !== "clone_in_progress" ) { - if($volume_size !== $image->size) { - $r = $this->response->html->a(); - $r->title = $this->lang['action_sync']; - $r->label = $this->lang['action_sync']; - $r->handler = 'onclick="wait();"'; - $r->css = 'enable'; - $r->href = $this->response->get_url($this->actions_name, "image").'&image_command=sync&image_id='.$image->id.'&size='.$volume_size; - $r = $r->get_string(); - $volume_size = ''.$volume_size.''; - } - else if($d['volgroup_vfree'] !== '0 MB' ) { - if($mode !== 's') { - $s = $this->response->html->a(); - $s->title = $this->lang['action_snap']; - $s->label = $this->lang['action_snap']; - $s->handler = 'onclick="wait();"'; - $s->css = 'snap'; - $s->href = $this->response->get_url($this->actions_name, "snap").'&lvol='.$line[1]; - $s = $s->get_string(); - } else { - $disabled[] = $line[5]; - $src = $line[5]; - } - if($vfree >= $volume_clone_size) { - $c = $this->response->html->a(); - $c->title = $this->lang['action_clone']; - $c->label = $this->lang['action_clone']; - $c->handler = 'onclick="wait();"'; - $c->css = 'clone'; - $c->href = $this->response->get_url($this->actions_name, "clone").'&lvol='.$line[1]; - $c = $c->get_string(); - } - $r = $this->response->html->a(); - $r->title = $this->lang['action_resize']; - $r->label = $this->lang['action_resize']; - $r->handler = 'onclick="wait();"'; - $r->css = 'resize'; - $r->href = $this->response->get_url($this->actions_name, "resize").'&lvol='.$line[1]; - $r = $r->get_string(); - } - $deployment_type = $this->deployment->type; - } else { - $disabled[] = $name; - } - } - } - // create/remove image object, check if image exists - if($d['deployment'] === 'kvm-gluster-deployment') { - $path_glusters = "gluster://".$this->resource->ip."/".$this->volgroup."/".$name; - $path = ''.$this->lang['table_path_physical'].': '.$line[2].'
    '; - $path .= ''.$this->lang['table_path_glusters'].': '.$path_glusters.'
    '; - } - if (strlen($image->id)) { - if( $image->type != $this->deployment->type ) { - $deployment_type = $image->type; - $disabled[] = $name; - } else { - $i = $this->response->html->a(); - $i->title = $this->lang['action_remove_image']; - $i->label = $this->lang['action_remove_image']; - $i->handler = 'onclick="wait();"'; - $i->css = 'remove'; - $i->href = $this->response->get_url($this->actions_name, "image").'&image_id='.$image->id.'&image_command=remove'; - $image_add_remove = $i->get_string(); - } - } else { - $i = $this->response->html->a(); - $i->title = $this->lang['action_add_image']; - $i->label = $this->lang['action_add_image']; - $i->handler = 'onclick="wait();"'; - $i->css = 'add'; - if($d['deployment'] === 'kvm-lvm-deployment') { - $i->href = $this->response->get_url($this->actions_name, "image").'&root_device=/dev/'.$this->volgroup.'/'.$name.'&image_command=add&size='.$volume_size; - } else if($d['deployment'] === 'kvm-bf-deployment') { - $i->href = $this->response->get_url($this->actions_name, "image").'&root_device='.$line[2].'&image_command=add&size='.$volume_size; - } else if($d['deployment'] === 'kvm-gluster-deployment') { - $i->href = $this->response->get_url($this->actions_name, "image").'&root_device='.$path_glusters.'&image_name='.$name.'&image_command=add&size='.$volume_size; - } else if($d['deployment'] === 'kvm-ceph-deployment') { - $path_ceph = "rbd:".$this->volgroup."/".$name; - $i->href = $this->response->get_url($this->actions_name, "image").'&root_device='.$path_ceph.'&image_name='.$name.'&image_command=add&size='.$volume_size; - } - $disabled[] = $name; - $image_add_remove = $i->get_string(); - } - } - - $state = 'unaligned'; - if($d['deployment'] === 'kvm-lvm-deployment') { - switch($image->isactive) { - case '0': - $state = 'idle'; - break; - case '1': - $state = 'active'; - break; - } - - $data = ''.$this->lang['table_name'].': '.$name.'
    '; - $data .= ''.$this->lang['table_deployment'].': '.$deployment_type.'
    '; - $data .= ''.$this->lang['table_attr'].': '.$line[3].'
    '; - $data .= ''.$this->lang['table_size'].': '.$volume_size.' MB
    '; - $data .= ''.'Root'.': '.str_replace('/'.$name, '', $image->rootdevice).'
    '; - $data .= ''.$this->lang['table_source'].': '.$src.'
    '; - $data .= '

    '; - $body[] = array( - 'state' => $state, - 'deploy' => $deployment_type, - 'name' => $name, - 'attr' => $line[3], - 'source' => $src, - 'size' => $volume_size, - 'data' => $data, - 'progress' => $progress, - 'action' => $image_add_remove.$c.$s.$r, - ); - } - if($d['deployment'] === 'kvm-bf-deployment') { - switch($image->isactive) { - case '0': - $state = 'idle'; - break; - case '1': - $state = 'active'; - break; - } - $root = str_replace('/'.$name, '', $image->rootdevice); - $data = ''.$this->lang['table_name'].': '.$name.'
    '; - $data .= ''.$this->lang['table_deployment'].': '.$deployment_type.'
    '; - $data .= ''.$this->lang['table_attr'].': '.$line[3].'
    '; - $data .= ''.$this->lang['table_size'].': '.$volume_size.' MB
    '; - $data .= ''.'Root'.': '.$root.'
    '; - $data .= ''.$this->lang['table_source'].': '.str_replace($root.'/', '',$src).'
    '; - $data .= '
    '; - $body[] = array( - 'state' => $state, - 'deploy' => $deployment_type, - 'name' => $name, - 'attr' => $line[3], - 'source' => $src, - 'size' => $volume_size, - 'data' => $data, - 'progress' => $progress, - 'action' => $image_add_remove.$c.$s, - ); - } - if($d['deployment'] === 'kvm-gluster-deployment') { - $body[] = array( - 'deploy' => $deployment_type, - 'name' => $name, - 'path' => $path, - 'source' => $src, - 'size' => $volume_size, - 'image' => $image_add_remove, - 'snap' => $s, - 'clone' => $c, - ); - } - if($d['deployment'] === 'kvm-ceph-deployment') { - switch($image->isactive) { - case '0': - $state = 'idle'; - break; - case '1': - $state = 'active'; - break; - } - - $is_snapshot = false; - $pos = strpos($name, '@'); - if ($pos === false) { - $is_snapshot = false; - } else { - $is_snapshot = true; - } - - $root = str_replace('/'.$name, '', $image->rootdevice); - $data = ''.$this->lang['table_name'].': '.$name.'
    '; - $data .= ''.$this->lang['table_size'].': '.$volume_size.' MB
    '; - if ($image->id != "") { - $data .= ''.'Root'.': '.$image->rootdevice.'
    '; - if ($is_snapshot) { - $data .= ''.$this->lang['table_source'].': '.$line[5].'
    '; - } - } - $data .= '
    '; - - if ($is_snapshot) { - $image_action = $image_add_remove.$c.$r; - } else { - $image_action = $image_add_remove.$c.$r.$s; - } - - $body[] = array( - 'state' => $state, - 'deploy' => $deployment_type, - 'name' => $name, - 'source' => $src, - 'size' => $volume_size, - 'data' => $data, - 'progress' => $progress, - 'action' => $image_action, - ); - } - } - - } - } - } - - if($d['deployment'] === 'kvm-lvm-deployment') { - $h['state']['title'] = $this->lang['table_state']; - $h['name']['title'] = $this->lang['table_name']; - $h['name']['hidden'] = true; - $h['deploy']['title'] = $this->lang['table_deployment']; - $h['deploy']['hidden'] = true; - $h['attr']['title'] = $this->lang['table_attr']; - $h['attr']['hidden'] = true; - $h['size']['title'] = $this->lang['table_size']; - $h['size']['hidden'] = true; - $h['source']['title'] = $this->lang['table_source']; - $h['source']['hidden'] = true; - $h['data']['title'] = ' '; - $h['data']['sortable'] = false; - $h['progress']['title'] = ' '; - $h['progress']['sortable'] = false; - $h['action']['title'] = ' '; - $h['action']['sortable'] = false; - } - if($d['deployment'] === 'kvm-bf-deployment') { - $h['state']['title'] = $this->lang['table_state']; - $h['name']['title'] = $this->lang['table_name']; - $h['name']['hidden'] = true; - $h['deploy']['title'] = $this->lang['table_deployment']; - $h['deploy']['hidden'] = true; - $h['attr']['title'] = $this->lang['table_attr']; - $h['attr']['hidden'] = true; - $h['size']['title'] = $this->lang['table_size']; - $h['size']['hidden'] = true; - $h['source']['title'] = $this->lang['table_source']; - $h['source']['hidden'] = true; - $h['data']['title'] = ' '; - $h['data']['sortable'] = false; - $h['progress']['title'] = ' '; - $h['progress']['sortable'] = false; - $h['action']['title'] = ' '; - $h['action']['sortable'] = false; - } - if($d['deployment'] === 'kvm-gluster-deployment') { - #$h['icon']['title'] = ' '; - #$h['icon']['sortable'] = false; - $h['name']['title'] = $this->lang['table_name']; - $h['deploy']['title'] = $this->lang['table_deployment']; - $h['path']['title'] = $this->lang['table_path']; - $h['source']['title'] = $this->lang['table_source']; - $h['size']['title'] = $this->lang['table_size']; - $h['image']['title'] = ' '; - $h['image']['sortable'] = false; - $h['snap']['title'] = ' '; - $h['snap']['sortable'] = false; - $h['clone']['title'] = ' '; - $h['clone']['sortable'] = false; - } - if($d['deployment'] === 'kvm-ceph-deployment') { - $h['state']['title'] = $this->lang['table_state']; - $h['name']['title'] = $this->lang['table_name']; - $h['name']['hidden'] = true; - $h['deploy']['title'] = $this->lang['table_deployment']; - $h['deploy']['hidden'] = true; - $h['size']['title'] = $this->lang['table_size']; - $h['size']['hidden'] = true; - $h['source']['title'] = $this->lang['table_source']; - $h['source']['hidden'] = true; - $h['data']['title'] = ' '; - $h['data']['sortable'] = false; - $h['progress']['title'] = ' '; - $h['progress']['sortable'] = false; - $h['action']['title'] = ' '; - $h['action']['sortable'] = false; - } - - $table = $this->response->html->tablebuilder('kvm_lvols', $this->response->get_array($this->actions_name, 'volgroup')); - $table->sort = 'name'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = count($body); - $table->autosort = true; - $table->sort_link = false; - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $body; - $table->identifier = 'name'; - $table->identifier_name = $this->identifier_name; - $table->identifier_disabled = $disabled; - $table->actions_name = $this->actions_name; - $table->actions = array(array('remove' => $this->lang['action_remove'])); - - $d['table'] = $table->get_string(); - return $d; - } else { - return false; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/css/kvm.css b/openQRM-5.3.50-CE/src/plugins/kvm/web/css/kvm.css deleted file mode 100644 index bf6db19..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/css/kvm.css +++ /dev/null @@ -1,125 +0,0 @@ -/* Edit */ -.htmlobject_table .htmlobject_td.state { - width: 60px; - vertical-align:top; -} -.htmlobject_table .htmlobject_td.data, -.htmlobject_table .htmlobject_td.appliance { - width: 300px; - vertical-align:top; -} -.htmlobject_table .htmlobject_th.pv, -.htmlobject_table .htmlobject_td.pv, -.htmlobject_table .htmlobject_th.lv, -.htmlobject_table .htmlobject_td.lv, -.htmlobject_table .htmlobject_th.sn, -.htmlobject_table .htmlobject_td.sn { - width: 30px; - vertical-align:top; - text-align: center; -} -.htmlobject_table .htmlobject_th.name, -.htmlobject_table .htmlobject_td.name { - width: 120px; - vertical-align:top; - text-align: left; -} -.htmlobject_table .htmlobject_th.vsize, -.htmlobject_table .htmlobject_td.vsize, -.htmlobject_table .htmlobject_th.vfree, -.htmlobject_table .htmlobject_td.vfree { - width: 110px; - vertical-align:top; - text-align: left; -} -.htmlobject_table .htmlobject_th.attr, -.htmlobject_table .htmlobject_td.attr { - vertical-align:top; - text-align: center; -} -.htmlobject_table .htmlobject_td.progress { - vertical-align:top; -} -.htmlobject_table .htmlobject_td.action { - width: 110px; - vertical-align:top; -} -.htmlobject_table .htmlobject_td.action a{ - display: block; - text-align: left; -} -#addbuttons { - float: right; - margin: 0 30px 0 0; -} -#kvm_edit .row { - margin: 0 0 20px 0; -} - -/* Add / Update */ -#net0_box .left, -#net1_box .left, -#net2_box .left, -#net3_box .left, -#net4_box .left { - float: right; - width: auto; -} -#net0_box .right, -#net1_box .right, -#net2_box .right, -#net3_box .right, -#net4_box .right { - float: right; - padding: 3px 8px 0 0; -} -#boot_iso_box { - width: 250px; - float: left; -} -#cdrom_box, -#iso_path_box{ - float:left; -} -#iso_path_box.htmlobject_box .left{ - width: 60px; -} -.browse-button { - margin: 3px 0 0 15px; -} -.netbox { - display: block; - clear: both; - padding: 5px 0 10px 24px; - /* border-top: 1px solid #ccc; */ -} -/* Progressbar */ -.ui-progressbar { width:280px; margin: 25px 0 0 0; } -.progress_watcher { width:280px; text-align: center; } - -/* Sysinfo */ -#kvm-sysinfo pre { - overflow:auto; - white-space: pre; - word-break: break-all; - word-wrap: break-word; - color: #000; -} -#kvm-sysinfo b { - padding: 0 0 15px 0; - display: block; -} - -.vm_vncpasswd { - width: 60px; - height: 10px ! important; - margin: 0 ! important; -} - - -.vm_vnctoggle { - height: 17px ! important; - padding-bottom: 0 ! important; - padding-top: 0 ! important; - -} \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/image.kvm-bf-deployment.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/image.kvm-bf-deployment.php deleted file mode 100644 index 86dcdb8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/image.kvm-bf-deployment.php +++ /dev/null @@ -1,113 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - -function kvm_bf_deployment_wait_for_identfile($sfile) { - $refresh_delay=1; - $refresh_loop_max=20; - $refresh_loop=0; - while (!file_exists($sfile)) { - sleep($refresh_delay); - $refresh_loop++; - flush(); - if ($refresh_loop > $refresh_loop_max) { - return false; - } - } - return true; -} - - -function get_kvm_bf_deployment_image_rootdevice_identifier($kvm_bf_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - - // place for the storage stat files - $StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/kvm/storage'; - $rootdevice_identifier_array = array(); - $storage = new storage(); - $storage->get_instance_by_id($kvm_bf_id); - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_resource_id = $storage_resource->id; - $ident_file = $StorageDir."/".$storage_resource_id.".lv.kvm-bf-deployment.ident"; - if (file_exists($ident_file)) { - unlink($ident_file); - } - // send command - $resource_command=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm post_identifier -u ".$OPENQRM_ADMIN->name." -p ".$OPENQRM_ADMIN->password." -t ".$deployment->type; - $storage_resource->send_command($storage_resource->ip, $resource_command); - if (!kvm_bf_deployment_wait_for_identfile($ident_file)) { - $event->log("get_image_rootdevice_identifier", $_SERVER['REQUEST_TIME'], 2, "image.kvm-bf-deployment", "Timeout while requesting image identifier from storage id $storage->id", "", "", 0, 0, 0); - return; - } - $fcontent = file($ident_file); - foreach($fcontent as $lun_info) { - $ident_params = explode(":", $lun_info); - $timage_name = trim($ident_params[0]); - $troot_device = trim($ident_params[1]); - $rootdevice_identifier_array[] = array("value" => "$troot_device", "label" => "$timage_name"); - } - return $rootdevice_identifier_array; -} - - -function get_kvm_bf_deployment_image_default_rootfs() { - return "local"; -} - -function get_kvm_bf_deployment_rootfs_transfer_methods() { - return false; -} - -function get_kvm_bf_deployment_rootfs_set_password_method() { - return true; -} - -function get_kvm_bf_deployment_is_network_deployment() { - return false; -} - -function get_kvm_bf_deployment_local_deployment_enabled() { - return true; -} - -function get_kvm_bf_deployment_is_resizable() { - return false; -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/image.kvm-ceph-deployment.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/image.kvm-ceph-deployment.php deleted file mode 100644 index ace8364..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/image.kvm-ceph-deployment.php +++ /dev/null @@ -1,114 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - -function kvm_ceph_deployment_wait_for_identfile($sfile) { - $refresh_delay=1; - $refresh_loop_max=20; - $refresh_loop=0; - while (!file_exists($sfile)) { - sleep($refresh_delay); - $refresh_loop++; - flush(); - if ($refresh_loop > $refresh_loop_max) { - return false; - } - } - return true; -} - - -function get_kvm_ceph_deployment_image_rootdevice_identifier($kvm_ceph_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - - // place for the storage stat files - $StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/kvm/storage'; - $rootdevice_identifier_array = array(); - $storage = new storage(); - $storage->get_instance_by_id($kvm_ceph_id); - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_resource_id = $storage_resource->id; - $ident_file = $StorageDir."/".$storage_resource_id.".lv.kvm-bf-deployment.ident"; - if (file_exists($ident_file)) { - unlink($ident_file); - } - // send command - $resource_command=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm post_identifier -u ".$OPENQRM_ADMIN->name." -p ".$OPENQRM_ADMIN->password." -t ".$deployment->type; - $storage_resource->send_command($storage_resource->ip, $resource_command); - if (!kvm_ceph_deployment_wait_for_identfile($ident_file)) { - $event->log("get_image_rootdevice_identifier", $_SERVER['REQUEST_TIME'], 2, "image.kvm-bf-deployment", "Timeout while requesting image identifier from storage id $storage->id", "", "", 0, 0, 0); - return; - } - $fcontent = file($ident_file); - foreach($fcontent as $lun_info) { - $ident_params = explode(":", $lun_info); - $timage_name = trim($ident_params[0]); - $troot_device = trim($ident_params[1]); - $rootdevice_identifier_array[] = array("value" => "$troot_device", "label" => "$timage_name"); - } - return $rootdevice_identifier_array; -} - - -function get_kvm_ceph_deployment_image_default_rootfs() { - return "local"; -} - -function get_kvm_ceph_deployment_rootfs_transfer_methods() { - return false; -} - -function get_kvm_ceph_deployment_rootfs_set_password_method() { - return true; -} - -function get_kvm_ceph_deployment_is_network_deployment() { - return false; -} - -function get_kvm_ceph_deployment_local_deployment_enabled() { - return true; -} - -function get_kvm_ceph_deployment_is_resizable() { - return false; -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/image.kvm-gluster-deployment.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/image.kvm-gluster-deployment.php deleted file mode 100644 index 0bf7df5..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/image.kvm-gluster-deployment.php +++ /dev/null @@ -1,114 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - -function kvm_gluster_deployment_wait_for_identfile($sfile) { - $refresh_delay=1; - $refresh_loop_max=20; - $refresh_loop=0; - while (!file_exists($sfile)) { - sleep($refresh_delay); - $refresh_loop++; - flush(); - if ($refresh_loop > $refresh_loop_max) { - return false; - } - } - return true; -} - - -function get_kvm_gluster_deployment_image_rootdevice_identifier($kvm_gluster_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - - // place for the storage stat files - $StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/kvm/storage'; - $rootdevice_identifier_array = array(); - $storage = new storage(); - $storage->get_instance_by_id($kvm_gluster_id); - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_resource_id = $storage_resource->id; - $ident_file = $StorageDir."/".$storage_resource_id.".lv.kvm-bf-deployment.ident"; - if (file_exists($ident_file)) { - unlink($ident_file); - } - // send command - $resource_command=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm post_identifier -u ".$OPENQRM_ADMIN->name." -p ".$OPENQRM_ADMIN->password." -t ".$deployment->type; - $storage_resource->send_command($storage_resource->ip, $resource_command); - if (!kvm_gluster_deployment_wait_for_identfile($ident_file)) { - $event->log("get_image_rootdevice_identifier", $_SERVER['REQUEST_TIME'], 2, "image.kvm-bf-deployment", "Timeout while requesting image identifier from storage id $storage->id", "", "", 0, 0, 0); - return; - } - $fcontent = file($ident_file); - foreach($fcontent as $lun_info) { - $ident_params = explode(":", $lun_info); - $timage_name = trim($ident_params[0]); - $troot_device = trim($ident_params[1]); - $rootdevice_identifier_array[] = array("value" => "$troot_device", "label" => "$timage_name"); - } - return $rootdevice_identifier_array; -} - - -function get_kvm_gluster_deployment_image_default_rootfs() { - return "local"; -} - -function get_kvm_gluster_deployment_rootfs_transfer_methods() { - return false; -} - -function get_kvm_gluster_deployment_rootfs_set_password_method() { - return true; -} - -function get_kvm_gluster_deployment_is_network_deployment() { - return false; -} - -function get_kvm_gluster_deployment_local_deployment_enabled() { - return true; -} - -function get_kvm_gluster_deployment_is_resizable() { - return false; -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/image.kvm-lvm-deployment.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/image.kvm-lvm-deployment.php deleted file mode 100644 index 4f8ddf3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/image.kvm-lvm-deployment.php +++ /dev/null @@ -1,113 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - -function kvm_lvm_deployment_wait_for_identfile($sfile) { - $refresh_delay=1; - $refresh_loop_max=20; - $refresh_loop=0; - while (!file_exists($sfile)) { - sleep($refresh_delay); - $refresh_loop++; - flush(); - if ($refresh_loop > $refresh_loop_max) { - return false; - } - } - return true; -} - - -function get_kvm_lvm_deployment_image_rootdevice_identifier($kvm_lvm_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - - // place for the storage stat files - $StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/kvm/storage'; - $rootdevice_identifier_array = array(); - $storage = new storage(); - $storage->get_instance_by_id($kvm_lvm_id); - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_resource_id = $storage_resource->id; - $ident_file = $StorageDir."/".$storage_resource_id.".lv.kvm-lvm-deployment.ident"; - if (file_exists($ident_file)) { - unlink($ident_file); - } - // send command - $resource_command=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm post_identifier -u ".$OPENQRM_ADMIN->name." -p ".$OPENQRM_ADMIN->password." -t ".$deployment->type; - $storage_resource->send_command($storage_resource->ip, $resource_command); - if (!kvm_lvm_deployment_wait_for_identfile($ident_file)) { - $event->log("get_image_rootdevice_identifier", $_SERVER['REQUEST_TIME'], 2, "image.kvm-lvm-deployment", "Timeout while requesting image identifier from storage id $storage->id", "", "", 0, 0, 0); - return; - } - $fcontent = file($ident_file); - foreach($fcontent as $lun_info) { - $tpos = strpos($lun_info, ":"); - $timage_name = trim(substr($lun_info, 0, $tpos)); - $troot_device = trim(substr($lun_info, $tpos+1)); - $rootdevice_identifier_array[] = array("value" => "$troot_device", "label" => "$timage_name"); - } - return $rootdevice_identifier_array; -} - - -function get_kvm_lvm_deployment_image_default_rootfs() { - return "local"; -} - -function get_kvm_lvm_deployment_rootfs_transfer_methods() { - return false; -} - -function get_kvm_lvm_deployment_rootfs_set_password_method() { - return true; -} - -function get_kvm_lvm_deployment_is_network_deployment() { - return false; -} - -function get_kvm_lvm_deployment_local_deployment_enabled() { - return true; -} - -function get_kvm_lvm_deployment_is_resizable() { - return true; -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/img/kvm-lvm-deployment.png b/openQRM-5.3.50-CE/src/plugins/kvm/web/img/kvm-lvm-deployment.png deleted file mode 100644 index 1231960..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/kvm/web/img/kvm-lvm-deployment.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/img/kvm-network-deployment.png b/openQRM-5.3.50-CE/src/plugins/kvm/web/img/kvm-network-deployment.png deleted file mode 100644 index 3adddf5..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/kvm/web/img/kvm-network-deployment.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/kvm/web/img/plugin.png deleted file mode 100644 index 16abe90..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/kvm/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/js/helpers.js b/openQRM-5.3.50-CE/src/plugins/kvm/web/js/helpers.js deleted file mode 100644 index 8ecca6d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/js/helpers.js +++ /dev/null @@ -1,364 +0,0 @@ -/** - * Get Browser Infos - * - */ -var BrowserInfo = { - swfVersion : function() { - var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; - var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; - var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; - var version = "false"; - if (navigator.plugins != null && navigator.plugins.length > 0) { - if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { - var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; - var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; - var descArray = flashDescription.split(" "); - var tempArrayMajor = descArray[2].split("."); - var vMa = tempArrayMajor[0]; - var vMin = tempArrayMajor[1]; - var vRev = descArray[3]; - if (vRev == "") { - vRev = descArray[4]; - } - if (vRev[0] == "d") { - vRev = vRev.substring(1); - } else if (vRev[0] == "r") { - vRev = vRev.substring(1); - if (vRev.indexOf("d") > 0) { - vRev = vRev.substring(0, vRev.indexOf("d")); - } - } - version = vMa + "," + vMin + "," + vRev; - } - } - else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) version = 4; - else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) version = 3; - else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) version = 2; - else if (isIE && isWin && !isOpera) { - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); - version = axo.GetVariable("$version"); - } catch (e) {} - if (!version) - { - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); - version = "WIN 6,0,21,0"; - axo.AllowScriptAccess = "always"; - version = axo.GetVariable("$version"); - } catch (e) {} - } - if (!version) - { - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); - version = axo.GetVariable("$version"); - } catch (e) {} - } - if (!version) - { - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); - version = "WIN 3,0,18,0"; - } catch (e) {} - } - if (!version) - { - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); - version = "WIN 2,0,0,11"; - } catch (e) { version = "false"; } - } - } - version = version.replace(/[a-z ]/gi, ''); - version = version.replace(/,/g, '.'); - return version; - }, - info : function() { - info = { - CODENAME : navigator.appCodeName, - APPNAME : navigator.appName, - VERSION : navigator.appVersion, - COOKIES : navigator.cookieEnabled, - LANGUAGE : navigator.language, - PLATFORM : navigator.platform, - USERAGENT : navigator.userAgent, - WxH : screen.width +" x "+ screen.height, - COLORDEPTH : screen.colorDepth, - FLASH : this.swfVersion() - } - return info; - } -}; - -/** - * Drag functions - * - */ -var Drag = { - - obj : null, - init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper) - { - o.onmousedown = Drag.start; - o.hmode = bSwapHorzRef ? false : true ; - o.vmode = bSwapVertRef ? false : true ; - o.root = oRoot && oRoot != null ? oRoot : o ; - - if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px"; - if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px"; - if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px"; - if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px"; - - o.minX = typeof minX != 'undefined' ? minX : 0; - o.minY = typeof minY != 'undefined' ? minY : 0; - o.maxX = typeof maxX != 'undefined' ? maxX : null; - o.maxY = typeof maxY != 'undefined' ? maxY : null; - - o.xMapper = fXMapper ? fXMapper : null; - o.yMapper = fYMapper ? fYMapper : null; - - o.root.onDragStart = new Function(); - o.root.onDragEnd = new Function(); - o.root.onDrag = new Function(); - }, - - start : function(e) - { - var o = Drag.obj = this; - e = Drag.fixE(e); - var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); - var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); - o.root.onDragStart(x, y); - - o.lastMouseX = e.clientX; - o.lastMouseY = e.clientY; - - if (o.hmode) { - if (o.minX != null) o.minMouseX = e.clientX - x + o.minX; - if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX; - } else { - if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x; - if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x; - } - - if (o.vmode) { - if (o.minY != null) o.minMouseY = e.clientY - y + o.minY; - if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY; - } else { - if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y; - if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y; - } - - document.onmousemove = Drag.drag; - document.onmouseup = Drag.end; - - return false; - }, - - drag : function(e) - { - e = Drag.fixE(e); - var o = Drag.obj; - - var ey = e.clientY; - var ex = e.clientX; - var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); - var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); - var nx, ny; - - if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX); - if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX); - if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY); - if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY); - - nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1)); - ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1)); - - if (o.xMapper) nx = o.xMapper(y) - else if (o.yMapper) ny = o.yMapper(x) - - Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px"; - Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px"; - Drag.obj.lastMouseX = ex; - Drag.obj.lastMouseY = ey; - - Drag.obj.root.onDrag(nx, ny); - return false; - }, - - end : function() - { - document.onmousemove = null; - document.onmouseup = null; - Drag.obj.root.onDragEnd( parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), - parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"])); - Drag.obj = null; - }, - - fixE : function(e) - { - if (typeof e == 'undefined') e = window.event; - if (typeof e.layerX == 'undefined') e.layerX = e.offsetX; - if (typeof e.layerY == 'undefined') e.layerY = e.offsetY; - return e; - } -}; - -/** - * Get current mouse position - * - */ -var MousePosition = { - init : function () - { - this.x = ''; - this.y = ''; - this.MicrosoftModel = 0; - if (document.all){ - this.MicrosoftModel = 1; - document.onmousemove = this.capture; - } - if (!(this.MicrosoftModel)){ - if (typeof(document.addEventListener) == "function"){ - document.addEventListener("mousemove", this.capture, true); - } else if (document.runner){ - window.captureEvents(Event.MOUSEMOVE); - window.onmousemove = this.capture; - } - } - }, - capture : function( event ){ - if (!event){ event = window.event; } - if (typeof(event)!="object") return; - if (document.all){ - x = event.clientX; - y = event.clientY + document.documentElement.scrollTop; - } else { - x = event.pageX; - y = event.pageY; - } - MousePosition.x = x; - MousePosition.y = y; - }, - get : function (){ - return { x: this.x, y: this.y }; - } -}; - -/** - * Get window size - * - */ -var WindowSize = function() { - height = ""; - if(window.innerHeight != "undefined") { - height = window.innerHeight; - } - if(document.body.clientHeight != "undefined") { - height = document.body.clientHeight; - } - if(document.documentElement.clientHeight != "undefined") { - height = document.documentElement.clientHeight; - } - - width = ""; - if(window.innerWidth != "undefined") { - width = window.innerWidth; - } - if(document.body.clientWidth != "undefined") { - width = document.body.clientWidth; - } - if(document.documentElement.clientWidth != "undefined") { - width = document.documentElement.clientWidth; - } - - return { height: height, width: width }; -}; - -/** - * Get or Set Selection or Insert at Selection of an element - * - */ -var SelectionRange = { - - get : function(element){ - if(window.getSelection) { - start = element.selectionStart; - end = element.selectionEnd; - } - else if( document.selection ){ - // current selection - range = document.selection.createRange(); - // use this as a 'dummy' - stored_range = range.duplicate(); - // select all text - stored_range.moveToElementText( element ); - // move 'dummy' end point to end point of original range - stored_range.setEndPoint( 'EndToEnd', range ); - // calculate start and end points - start = parseInt(stored_range.text.length) - parseInt(range.text.length); - end = parseInt(start) + parseInt(range.text.length); - } - return {start: start, end: end}; - }, - - set : function(element, start, end){ - if (element.setSelectionRange) { - element.focus(); - element.setSelectionRange(start, end); - } - else if (element.createTextRange) { - range = element.createTextRange(); - start = element.value.substring(0, start).replace(/\r/g,""); - end = element.value.substring(0, end).replace(/\r/g,""); - range.collapse(true); - range.moveEnd('character', end.length); - range.moveStart('character', start.length); - range.select(); - } - }, - - insert : function(element, content){ - st = element.scrollTop; - sl = element.scrollLeft; - sel = this.get(element); - element.value = element.value.substring(0, sel.start) + content + element.value.substring(sel.end, element.value.length); - this.set(element, parseInt(sel.start) + parseInt(content.length), parseInt(sel.start) + parseInt(content.length)); - element.scrollTop = st; - element.scrollLeft = sl; - } - -}; - -/** - * Parse object attributes - * - * - */ -function objects(obj) { - val = new Array(); - i = 0; - for (var attrib in obj) { - val[i] = attrib + ' : ' + obj[attrib]; - i = i+1; - } - val.sort(); - alert(val.join(", ")); -} - -/** - * Generate Password - * - * - */ -function GeneratePassword() { - var password = ""; - var password_characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - var one_random_char; - for (j=0; j<8; j++) { - one_random_char = password_characters.charAt(Math.floor(Math.random()*password_characters.length)); - password += one_random_char; - } - return password; -} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/kvm-action.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/kvm-action.php deleted file mode 100644 index 075ec2d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/kvm-action.php +++ /dev/null @@ -1,307 +0,0 @@ - -*/ - - - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/authblocker.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -// filter inputs -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; - -global $IMAGE_INFO_TABLE; -global $DEPLOYMENT_INFO_TABLE; -global $OPENQRM_SERVER_BASE_DIR; - -$cloud_product_hook = $RootDir.'/plugins/kvm/openqrm-kvm-cloud-product-hook.php'; -$cloud_selector_class = $RootDir.'/plugins/cloud/class/cloudselector.class.php'; -$cloud_usergroup_class = $RootDir.'/plugins/cloud/class/cloudusergroup.class.php'; - -// place for the storage stat files -$StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/kvm/storage'; -// place for the kvm_server stat files -$KvmDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/kvm/kvm-stat'; -// get params -$lvm_command = $request->get('lvm_command'); -$kvm_server_command = $request->get('kvm_server_command'); -$kvm_server_id = $request->get('kvm_server_id'); -if (!strlen($lvm_command)) { - $lvm_command = $kvm_server_command; -} -$kvm_image_name = $request->get('kvm_image_name'); - - -// global event for logging -$event = new event(); - -// user/role authentication -if ($OPENQRM_USER->role != "administrator") { - $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "lvm-action", "Un-Authorized access to lvm-actions from $OPENQRM_USER->name", "", "", 0, 0, 0); - exit(); -} - - -// $event->log("$lvm_command", $_SERVER['REQUEST_TIME'], 5, "kvm-action", "Processing kvm command $lvm_command", "", "", 0, 0, 0); -switch ($lvm_command) { - // storage commands - case 'get': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'get_ident': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'clone_finished': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'get_sync_progress': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'get_sync_finished': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - sleep(5); - unlink($filename); - break; - - case 'auth_finished': - // remove storage-auth-blocker if existing - $authblocker = new authblocker(); - $authblocker->get_instance_by_image_name($kvm_image_name); - if (strlen($authblocker->id)) { - $event->log('auth_finished', $_SERVER['REQUEST_TIME'], 5, "kvm-action", "Removing authblocker for image $kvm_image_name", "", "", 0, 0, 0); - $authblocker->remove($authblocker->id); - } - break; - - - // vm commands - // get the incoming vm list - case 'get_kvm_server': - if (!file_exists($KvmDir)) { - mkdir($KvmDir); - } - $filename = $KvmDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - // send command to send the vm list - case 'refresh_vm_list': - $kvm_appliance = new appliance(); - $kvm_appliance->get_instance_by_id($kvm_server_id); - $kvm_server = new resource(); - $kvm_server->get_instance_by_id($kvm_appliance->resources); - $resource_command="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-vm post_vm_list -u $OPENQRM_ADMIN->name -p $OPENQRM_ADMIN->password"; - $kvm_server->send_command($kvm_server->ip, $resource_command); - break; - - // get the incoming vm config - case 'get_kvm_config': - if (!file_exists($KvmDir)) { - mkdir($KvmDir); - } - $filename = $KvmDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - // send command to send the vm config - case 'refresh_vm_config': - $kvm_appliance = new appliance(); - $kvm_appliance->get_instance_by_id($kvm_server_id); - $kvm_server = new resource(); - $kvm_server->get_instance_by_id($kvm_appliance->resources); - $resource_command="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-vm post_vm_config -n $kvm_server_name -u $OPENQRM_ADMIN->name -p $OPENQRM_ADMIN->password"; - $kvm_server->send_command($kvm_server->ip, $resource_command); - break; - - // get the incoming bridge config - case 'get_bridge_config': - if (!file_exists($KvmDir)) { - mkdir($KvmDir); - } - $filename = $KvmDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - // get VM migration status - case 'get_vm_migration': - if (!file_exists($KvmDir)) { - mkdir($KvmDir); - } - $filename = $KvmDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - // get pick_iso config - case 'get_pick_iso_config': - if (!file_exists($KvmDir)) { - mkdir($KvmDir); - } - $filename = $KvmDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'init': - // add cloud products - if (file_exists($cloud_usergroup_class)) { - require_once $cloud_usergroup_class; - $cloud_project = new cloudusergroup(); - $cloud_project->get_instance_by_name('Admin'); - if (file_exists($cloud_selector_class)) { - if (file_exists($cloud_product_hook)) { - $cloud_hook_config = array(); - $cloud_hook_config['cloud_admin_procect'] = $cloud_project->id; - require_once $cloud_product_hook; - openqrm_kvm_cloud_product("add", $cloud_hook_config); - } - } - } - break; - - case 'uninstall': - // remove cloud products - if (file_exists($cloud_usergroup_class)) { - require_once $cloud_usergroup_class; - $cloud_project = new cloudusergroup(); - $cloud_project->get_instance_by_name('Admin'); - if (file_exists($cloud_selector_class)) { - if (file_exists($cloud_product_hook)) { - $cloud_hook_config = array(); - $cloud_hook_config['cloud_admin_procect'] = $cloud_project->id; - require_once $cloud_product_hook; - openqrm_kvm_cloud_product("remove", $cloud_hook_config); - } - } - } - break; - - case 'put_vnc': - $cloud_vnc_dir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/action/cloud-conf/'; - if (!file_exists($cloud_vnc_dir)) { - mkdir($cloud_vnc_dir); - } - $filename = $cloud_vnc_dir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'put_stats': - $cloud_vnc_dir = $KvmDir; - if (!file_exists($KvmDir)) { - mkdir($KvmDir); - } - $filename = $KvmDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'set_image_size': - $kvm_image_name = $request->get('kvm_image_name'); - $kvm_image_size = $request->get('kvm_image_size'); - if($kvm_image_name !== '' && $kvm_image_size !== '') { - $kvm_image = new image(); - $kvm_image->get_instance_by_name($kvm_image_name); - if($kvm_image->id !== '') { - $kvm_image->update($kvm_image->id, array('image_size' => $kvm_image_size)); - } - } - break; - - default: - $event->log("$lvm_command", $_SERVER['REQUEST_TIME'], 3, "kvm-action", "No such kvm command ($lvm_command)", "", "", 0, 0, 0); - break; - - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/de.kvm-about.ini b/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/de.kvm-about.ini deleted file mode 100644 index d5f3611..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/de.kvm-about.ini +++ /dev/null @@ -1,99 +0,0 @@ -[documentation] -tab = "Über KVM" -label = "Über KVM" -introduction_title = "Einleitung" -introduction_content = "Das 'KVM' Plugin verwaltet KVM Virtuellen Maschinen und deren zugehörige virtuelle Festplatte. - Wie üblich in openQRM openQRM ist dier Verwaltung der Virtuellen Maschineen und das die Storage/Volume-Verwaltung separiert. - Das 'KVM' Plugin teilt sich also in VM- und Volume-Management auf. - Der VM Teil bietet Virtuelle Maschinen, die in openQRM als 'Ressources' abstrahiert sind. - Der Storage Teil beinhaltet die Volumes die als 'Image' abstrahiert sind. - Server deployment verbindet automatisch 'Ressource' und 'Image'." -requirements_title = "Anforderungen" -requirements_list = "
    • Eine 'Resource' für die KVM Host Server
      (dies kann ein System sein das mittels des "local-server" Plugin in openQRM eingebunden ist oder der openQRM Server selber)
    • -
    • Der Server benötigt die VT (Virtualization Technology) Extension in der CPU (benötigt für KVM)
    • -
    • Die folgenden Paket werden benötigt: kvm (eventuel kvm-pxe), socat, bridge-utils, lvm2
    • -
    • Für KVM LVM Storage: Eine (oder mehrere) LVM Volume Group(s) mit freiem Speicher dediziert für KVM VM storage
    • -
    • Für KVM Blockfile Storage: freiem Speicher dediziert für KVM VM storage
    • -
    • For KVM Gluster Storage: Ein oder mehrere Gluster Storage Cluster
    • -
    • Eine (oder mehrere) 'bridges' konfiguriert für die virtuellen Netzwerkkarten der Virtuellen Maschinen
    " -tested_title = "Testet mit" -tested_content = "Diese Plugin ist getestet ab KVM Version kvm-62. Für KVM 'virtio' wird kvm-84 (oder besser) benötigt" - -provides_title = "Bietet" -provides_list = "
    • Virtualization Typen: 'KVM Host', 'KVM VM (localboot)' und 'KVM VM (netboot)'
    • -
    • Storage Typen: 'KVM LVM Storage', 'KVM Blockfile Storage' und 'KVM Gluster Storage'
    • -
    • Deployment types: 'LVM deployment für KVM', 'Blockfile deployment für KVM' und 'Gluster deployment für KVM'
    " -type_title = "Plugin Typ" -type_content = "Virtualization und Storage" - -deployment_title = "Deployment Typ" -deployment_content = "Local und Network Deployment für Virtuelle Maschinen" - -migration_title = "Anforderungen für KVM live-migration" -migration_content = "Verteilte Storage zwischen den KVM Hosts für die VM Konfigurationdateien (/var/lib/kvm/openqrm) - und eine verteiltes LVM Volume Group zwischen den KVM Hosts" -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" -network_deploymet = "Network-Deployment" -doc1 = "" - - -[bootservice] -tab = "Boot-Service" -label = "KVM Boot-Service" -boot_service_title = "KVM Host Boot-Service" -boot_service_content = "Das KVM Plugin beinhaltet einen openQRM Boot-Service. - Dieser 'KVM Boot-Service' wird automatisch von allen in openQRM integrierten Systeme heruntergeladen und ausgeführt. - Der Boot-Service befindet sich unter:
    -
    - /usr/share/openqrm/plugins/kvm/web/boot-service-kvm.tgz -
    -
    - Der 'KVM Boot-Service' beinhaltet die 'Client' Dateien des KVM Plugin.
    - Eine Konfigurationsdatei für den KVM Hosts ist ebenfalls enhalten.
    -
    - Die Boot-Service konfiguration wird mittels des 'openqrm' Kommandozeilenwerkzeugs verwaltet.
    - Der folgende Befehl zeigt die die momentane 'default' Boot-Service Konfiguration an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n kvm -a default -
    -
    - Die Boot-Service Konfiguration eines speziellen Server zeigt der folgende Befehl an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n kvm -a [Server-name] -
    -
    - Der folgende Befehl passt einen Konfigurationparameter des 'default' Boot-Service an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n kvm -a default -k [key] -v [value] -
    -
    - Die Boot-Service Konfigurarationsparameter eines speziellen Server passt der folgende Befehl an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n kvm -a [Server-name] -k [key] -v [value] -
    -
    - Im Falle das der openmQRM Server selber als KVM Host genutzt wird werden die Konfigurationsparameter in der folgenden Datei manuell angeepasst:
    -
    - /usr/share/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf -

    " - -[storage] -tab = "Über KVM" -label = "Über Storage in KVM" -storage_mgmt_title = "KVM Storage Management" -storage_mgmt_list = "
    • Erstellen Sie eine neue 'Storage' vom Typ 'KVM LVM Storage' oder 'KVM Blockfile Storage'
    • -
    • Erstellen Sie ein neues Volume auf der 'Storage' (entweder LVM oder Blockfile)
    • -
    • Aus dem erstellten Volume wird automatisch ein 'Image' mit dem Volume als 'root-device' erstellt
    " - -[vms] -tab = "Über KVM" -label = "Über Virtuelle Maschine in KVM" -vm_mgmt_title = "KVM VM Management" -vm_mgmt_list = "
    • Erstellen Sie eine neue 'Server' und setzen Sie 'Virtualization' auf 'KVM Host'
    • -
    • Erstellen Sie KVM Virtuelle Maschinen mittels dem KVM VM Manager
    • -
    • Aus der neuen Virtuelle Maschinen wird in openQRM automatisch eine neue Ressource erstellt, die mittels eines Server ausgebracht werden kann.
    " - -[usage] -tab = "About KVM" -label = "KVM Anwendungsfälle" diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/de.kvm-vm.ini b/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/de.kvm-vm.ini deleted file mode 100644 index 043d234..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/de.kvm-vm.ini +++ /dev/null @@ -1,198 +0,0 @@ -[select] -tab = "KVM Host auswählen" -label = "KVM Host Server auswählen" -action_edit = "bearbeiten" -table_name = "Name" -table_id = "Id" -table_recource = "Resource" -table_type = "Typ" -table_deployment = "Deployment" -error_no_host = "Keinen KVM Host Server angelegt!

    Bitte legen Sie erst einen KVM Host Server an!" -new = "Neuer Server" -please_wait = "Lade VMs. Bitte warten .." - -[edit] -tab = "KVM Host bearbeiten" -label = "KVM VMs auf KVM Host Server %s" -lang_id = "ID" -lang_name = "Name" -lang_resource = "Resource" -lang_state = "Status" -lang_vfree = "Frei" -lang_vsize = "Gesamt" -action_add_local_vm = "Lokale VM hinzufügen" -action_add_network_vm = "Netzwerk VM hinzufügen" -action_remove = "entfernen" -action_stop = "stop" -action_start = "start" -action_reboot = "reboot" -action_update = "bearbeiten" -action_console = "console" -action_migrate = "migrieren" -action_clone = "klonen" -action_migrate_in_progress = "Migration in Bearbeitung - Bitte warten" -action_migrate_finished = "Migration beendet!" -table_name = "Name" -table_mac = "Mac" -table_ram = "RAM" -table_cpu = "CPU" -table_nics = "NIC" -table_id = "ID" -table_ip = "IP" -table_vnc = "VNC" -table_state = "Status" -table_type = "Typ" -table_appliance = "Server" -table_kernel = "Kernel" -table_image = "Image" -table_storage = "Storage" -error_no_host = "Keinen KVM Host Server angelegt!

    Bitte legen Sie erst einen KVM Host Server an!" -please_wait = "Lade VMs. Bitte warten .." - -[add] -tab = "Neue VM" -label = "Neue VM anlegen" -lang_basic = "Basic" -lang_hardware = "Virtual Hardware" -lang_net = "Virtual Netzwerk" -lang_net_0 = "1. Netzwerkkarte" -lang_net_1 = "2. Netzwerkkarte" -lang_net_2 = "3. Netzwerkkarte" -lang_net_3 = "4. Netzwerkkarte" -lang_net_4 = "5. Netzwerkkarte" -lang_boot = "Starten von" -lang_virtual_disk = "Virtual Disk Image" -lang_vnc = "VNC Password" -lang_browse = "auswählen" -lang_browser = "Dateiauswahl" -lang_password_generate = "Passwort generieren" -lang_password_show = "Passwort anzeigen" -lang_password_hide = "Passwort verbergen" -form_name = "Name" -form_cpus = "CPU(s)" -form_disk = "Disk" -form_swap = "Swap" -form_mac = "Mac" -form_ipaddress = "IP Adresse" -form_memory = "Memory" -form_bridge = "Bridge" -form_boot_cd = "CD" -form_boot_iso = "Iso" -form_iso_path = "Path" -form_boot_net = "Net" -form_boot_local = "Local" -form_enable = "ein" -form_net_virtio = "Virtio" -form_net_e1000 = "E1000" -form_net_rtl8139 = "Rtl8139" -form_netdevice = "Networkcard" -form_disk_interface = "Disk Interface" -form_existing_disk = "Bestehende Disk" -form_vnc = "Passwort" -form_vnc_repeat = "Passwort (wiederholen)" -form_vnc_keymap = "VNC Tastatur" -form_swap = "Swap" -form_disk = "Disk" -msg_added = "VM %s angelegt" -action_add_vm_image = "Neues VM Image erstellen" -error_exists = "VM %s existiert bereits" -error_name = "Name darf nur %s beinhalten" -error_memory = "Memory darf nur %s beinhalten" -error_mac = "Mac ist invalid" -error_bridge = "Bridge ist invalid" -error_nic = "Nic ist invalid" -error_boot = "Bitte Boot-Device auswählen" -error_iso_path = "Pfad darf nicht leer sein" -error_vnc_password = "Eingegebene Passwörter sind nicht gleich!" -error_vnc_password_count = "Passwort muss mindestens 6 Zeichen enthalten" -please_wait = "Lade VMs. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - -[update] -tab = "Bearbeite VM" -label = "Bearbeite VM %s" -lang_basic = "Basic" -lang_hardware = "Hardware" -lang_net = "Netzwerk" -lang_net_0 = "1. Netzwerkkarte" -lang_net_1 = "2. Netzwerkkarte" -lang_net_2 = "3. Netzwerkkarte" -lang_net_3 = "4. Netzwerkkarte" -lang_net_4 = "5. Netzwerkkarte" -lang_boot = "Starten von" -lang_vnc = "VNC Password" -lang_browse = "auswählen" -lang_browser = "Dateiauswahl" -lang_password_generate = "Passwort generieren" -lang_password_show = "Passwort anzeigen" -lang_password_hide = "Passwort verbergen" -form_name = "Name" -form_cpus = "CPU(s)" -form_mac = "Mac" -form_memory = "Memory" -form_bridge = "Bridge" -form_boot_cd = "CD" -form_boot_iso = "Iso" -form_iso_path = "Path" -form_boot_net = "Net" -form_boot_local = "Local" -form_enable = "ein" -form_net_virtio = "Virtio" -form_net_e1000 = "E1000" -form_net_rtl8139 = "Rtl8139" -form_netdevice = "Networkcard" -form_disk_interface = "Disk Interface" -form_vnc = "Passwort" -form_vnc_repeat = "Passwort (wiederholen)" -form_vnc_keymap = "VNC Tastatur" -form_swap = "Swap" -form_disk = "Disk" -msg_updated = "Updated VM %s" -error_exists = "VM %s existiert bereits" -error_name = "Name darf nur %s beinhalten" -error_memory = "Memory darf nur %s beinhalten" -error_mac = "Mac ist invalid" -error_bridge = "Bridge ist invalid" -error_nic = "Nic ist invalid" -error_boot = "Bitte Boot-Device auswählen" -error_iso_path = "Pfad darf nicht leer sein" -error_vnc_password = "Eingegebene Passwörter sind nicht gleich!" -error_vnc_password_count = "Passwort muss mindestens 6 Zeichen enthalten" -please_wait = "Lade VMs. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - -[clone] -label = "Clone VM %s" -tab = "Clone VM" -msg_cloned = "VM %s als %s geklont" -form_name = "Name" -error_exists = "VM %s existiert bereits" -error_name = "Name darf nur %s beinhalten" -please_wait = "Lade VMs. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - -[migrate] -label = "Migrate VM %s" -tab = "Migrate VM" -msg_migrated = "Migrated %s nach %s" -error_no_hosts = "Keinen KVM Host Server gefunden um zu migrieren" -form_target = "Target Host Resource" -please_wait = "Lade VMs. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - -[start] -msg_started = "VM %s gestartet" - -[stop] -msg_stoped = "VM %s gestoppt" - -[reboot] -msg_rebooted = "VM %s neu gestartet" - -[remove] -label = "Entferne VM(s)" -msg_removed = "VM %s entfernt" -msg_vm_resource_still_in_use = "VM %s resource id %s is still in use by Server %s" -please_wait = "Lade VMs. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/de.kvm.ini b/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/de.kvm.ini deleted file mode 100644 index c987106..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/de.kvm.ini +++ /dev/null @@ -1,167 +0,0 @@ -[select] -tab = "KVM auswählen" -label = "KVM auswählen" -action_edit = "bearbeiten" -table_name = "Name" -table_id = "Id" -table_recource = "Resource" -table_type = "Typ" -table_deployment = "Deployment" -error_no_storage = "Keine Storage angelegt!

    Bitte legen Sie erst eine KVM Storage an!" -new_storage = "Neue Storage" -please_wait = "Lade Volume Groups. Bitte warten .." - -[edit] -tab = "Volume Group auswählen" -label = "Volume Group auf KVM %s auswählen" -lang_id = "ID" -lang_name = "Name" -lang_resource = "Resource" -lang_state = "Status" -lang_deployment = "Deployment" -action_edit = "select" -action_add ="Neue Volume Group erstellen" -action_remove ="entfernen" -table_name = "Name" -table_pv = "PV" -table_lv = "LV" -table_sn = "SN" -table_attr = "Attr" -table_vsize = "Vsize" -table_vfree = "VFree" -table_vused = "Benutzt" -table_vusedpercent = "%" -table_available = "Verfügbar" -table_objects = "Objekte" -table_vg = "Volume Group Details" -table_bricks = "Gluster Bricks" -table_type = "Typ" -table_status = "Status" -table_topology = "Topology" -table_transport = "Transport" -error_no_kvm = "Storage %s ist nicht vom Typ 'KVM'" -please_wait = "Lade Volume Groups. Bitte warten .." - -[addvg] -tab = "Volume Group erstellen" -label = "Volume Group auf storage %s erstellen" -partition = "Partition" -name = "Name" -extend = "Partition erweitern" -confirm_text = "Alle Daten auf %s werden gelöscht.
    Wirklich fortsetzen?" -msg_added = "Volume Group %s erfolgreich erstellt" -please_wait = "Lade Volume group. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - -[removevg] -tab = "Volume Group entfernen" -label = "Volume Group auf storage %s entfernen" -confirm_text = "Wollen Sie die Volume Group %s wirlich entfernen?" -msg_removed = "Volume Group %s erfolgreich entfernt" -please_wait = "Lade Volume group. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - -[volgroup] -tab = "Volume Group bearbeiten" -label = "Bearbeite Volume Group %s auf KVM %s" -lang_id = "ID" -lang_name = "Name" -lang_deployment = "Deployment" -lang_resource = "Resource" -lang_state = "Status" -lang_attr = "Attr" -lang_pv = "PV / LV / SN" -lang_size = "Vsize / Vfree" -lang_free = "Frei" -action_add = "Neues Logical Volume hinzufügen" -action_remove = "entfernen" -action_resize = "resize" -action_snap = "snap" -action_clone = "clone" -action_add_image = "Image hinzufügen" -action_remove_image = "Image entfernen" -action_sync_in_progress = "Ziel einer Synchronisation - Bitte warten" -action_clone_in_progress = "Synchronisation in Bearbeitung - Bitte warten" -action_clone_finished = "Syncronisation beendet!" -table_name = "Lvol" -table_deployment = "Deployment" -table_attr = "Attr" -table_path = "Pfad" -table_size = "Size" -table_source = "Source" -table_path_physical = "Physikalisch" -table_path_glusters = "Logisch" -error_no_kvm = "Storage %s ist nicht vom Typ 'KVM'" -please_wait = "Lade Volume Groups. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - -[add] -tab = "Logical Volume hinzufügen" -label = "Logical Volume zu Volume group %s hinzufügen" -form_name = "Name" -form_size = "Grösse (max: %s MB)" -form_type = "Volume Typ" -msg_added = "Logical Volume %s hinzugefügt" -msg_add_failed = "Fehler beim hinzufügen des Logical Volume %s" -lang_name_generate = "Erzeuge Namen" -error_exists = "Logical Volume %s existiert bereits" -error_name = "Name darf nur %s beinhalten" -error_size = "Grösse darf nur %s beinhalten" -error_size_exeeded = "Grösse übersteigt %s MB" -please_wait = "Lade Volume Groups. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - -[image] -label = "Image für Logical Volume %s hinzufügen/entfernen" -tab = "Image hinzufügen/entfernen" -error_exists = "Image %s existiert bereits" -error_image_still_in_use = "Image ID %s ist noch in benutztung von Server %s" -msg_added_image = "Image %s hinzugefügt" -msg_removed_image = "Image id %s entfernt" -please_wait = "Bitt warten .." -canceled = "Operation abgebrochen. Bitte warten .." - -[snap] -label = "Snap Logical Volume %s" -tab = "Snap Logical Volume" -msg_snaped = "Snaped %s zu %s" -msg_snap_failed = "Fehler beim Snapping von %s nach %s" -form_name = "Name" -form_size = "Grösse (max: %s MB)" -error_exists = "Logical Volume %s existiert bereits" -error_name = "Name darf nur %s beinhalten" -error_size = "Grösse darf nur %s beinhalten" -error_size_exeeded = "Grösse übersteigt %s MB" -please_wait = "Lade Volume Groups. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - -[clone] -label = "Clone Logical Volume %s" -tab = "Clone Logical Volume" -msg_cloned = "Cloned %s as %s" -msg_clone_failed = "Clone failed for %s as %s" -form_name = "Name" -error_exists = "Logical Volume %s existiert bereits" -error_name = "Name darf nur %s beinhalten" -please_wait = "Lade Volume Groups. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - -[remove] -label = "Entferne Logical Volume(s)" -msg_removed = "Logical Volume %s entfernt" -msg_vm_image_still_in_use = "Das Volume %s des Image ID %s ist noch in benutztung von Server %s" -please_wait = "Lade Volume Groups. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - -[resize] -label = "Resize Logical Volume %s" -tab = "Resize Logical Volume" -size = "min. %s MB, max. %s MB" -ceph_size = "Neue Volume Grösse in MB" -error_size = "Grösse darf nur %s beinhalten" -error_size_exeeded = "Grösse übersteigt %s MB" -error_size_undercut = "Grösse unterschreitet %s MB" -msg_resized = "Resized Logical Volume %s" -please_wait = "Lade Volume Groups. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/en.kvm-about.ini b/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/en.kvm-about.ini deleted file mode 100644 index df0b4ef..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/en.kvm-about.ini +++ /dev/null @@ -1,100 +0,0 @@ -[documentation] -tab = "About KVM" -label = "About KVM" -introduction_title = "Introduction" -introduction_content = "The 'KVM' plugin manages KVM Virtual Machines and their belonging virtual disk. - As common in openQRM the Virtual Machines and their virtual disk volumes are managed separately. - Therefore the 'KVM' plugin splits up into VM- and Volume-Management. - The VM part provides the Virtual Machines which are abstracted as 'Resources'. - The Storage part provides volumes which are abstracted as 'Images'. - Server deployment automatically combines 'Resource' and 'Image'." -requirements_title = "Requirements" -requirements_list = "
    • A resource for the KVM Host Server
      (this can be a remote system integrated into openQRM e.g. via the 'local-server' plugin or the openQRM server itself)
    • -
    • The server needs VT (Virtualization Technology) Support in its CPU (requirement for KVM)
    • -
    • The following packages must be installed: kvm (eventual kvm-pxe), socat, bridge-utils, lvm2
    • -
    • For KVM LVM Storage: One (or more) lvm volume group(s) with free space dedicated for the KVM VM storage
    • -
    • For KVM Blockfile Storage: free space dedicated for the KVM VM storage
    • -
    • For KVM Gluster Storage: One or more Gluster Storage Cluster
    • -
    • One or more bridges configured for the virtual machines
    " -tested_title = "Tested with" -tested_content = "This plugin is tested with KVM kvm-62 or better
    To benefit from the KVM 'virtio' feature at least kvm-84 is needed" - -provides_title = "Provides" -provides_list = "
    • Virtualization types: 'KVM Host', 'KVM VM (localboot)' and 'KVM VM (netboot)'
    • -
    • Storage types: 'KVM LVM Storage', 'KVM Blockfile Storage' and 'KVM Gluster Storage'
    • -
    • Deployment types: 'LVM deployment for KVM', 'Blockfile deployment for KVM' and 'Gluster deployment for KVM'
    " -type_title = "Plugin Type" -type_content = "Virtualization and Storage" - -deployment_title = "Deployment Type" -deployment_content = "Local and Network Deployment for Virtual Machines" - -migration_title = "Requirements for KVM live-migration" -migration_content = "Shared storage between the KVM Hosts for the location of the VM config files (/var/lib/kvm/openqrm) - and a shared LVM volume group between the KVM Hosts" -documentation_title = "Documentation" -use_case_title = "Use-Case" -network_deploymet = "Network-Deployment" -doc1 = "" - - -[bootservice] -tab = "Boot-Service" -label = "KVM Boot-Service" -boot_service_title = "KVM Host Boot-Service" -boot_service_content = "The KVM Plugin provides an openQRM Boot-Service. - This 'KVM Boot-Service' is automatically downloaded and executed by the openQRM-Client on all integrated Systems. - The Boot-Service is located at:
    -
    - /usr/share/openqrm/plugins/kvm/web/boot-service-kvm.tgz -
    -
    - The 'KVM Boot-Service' contains the Client files of the KVM Plugin.
    - Also a configuration file for the KVM Hosts is included in this Boot-Service.
    -
    - The Boot-Service configuration can be viewed and administrated by the 'openqrm' utility.
    - To view the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n kvm -a default -
    -
    - To view a Boot-Service configuration of a specific Server run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n kvm -a [Server-name] -
    -
    - To adapt a parameter in the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n kvm -a default -k [key] -v [value] -
    -
    - To adapt a paramter in the Boot-Service configuration of a specific Server run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n kvm -a [Server-name] -k [key] -v [value] -
    -
    - In case the openmQRM Server itself is used as the KVM Host please edit:
    -
    - /usr/share/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf -
    -
    - and set the configuration keys according to your bridge-configuration.
    -
    " -[storage] -tab = "About KVM" -label = "About Storage in KVM" -storage_mgmt_title = "KVM Storage Management" -storage_mgmt_list = "
    • Create a new storage from type 'KVM LVM Storage' or 'KVM Blockfile Storage'
    • -
    • Create a new Volume on this storage (either LVM or Blockfile)
    • -
    • Creating the Volume automatically creates a new Image using volume as root-device
    " - -[vms] -tab = "About KVM" -label = "About Virtual Machines in KVM" -vm_mgmt_title = "KVM VM Management" -vm_mgmt_list = "
    • Create a new Server and set 'Virtualization' to 'KVM Host'
    • -
    • Create and manage KVM virtual machines via the KVM VM Manager
    " - -[usage] -tab = "About KVM" -label = "KVM Use-Cases" diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/en.kvm-vm.ini b/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/en.kvm-vm.ini deleted file mode 100644 index 2f12480..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/en.kvm-vm.ini +++ /dev/null @@ -1,198 +0,0 @@ -[select] -tab = "Select KVM Host" -label = "Select KVM Host Server" -action_edit = "edit" -table_name = "Name" -table_id = "Id" -table_recource = "Resource" -table_type = "Type" -table_deployment = "Deployment" -error_no_host = "No KVM Host Server configured yet!

    Please create a KVM Host Server first!" -new = "New Server" -please_wait = "Loading VMs. Please wait .." - -[edit] -tab = "Select VM" -label = "KVM VMs on KVM Host Server %s" -lang_id = "ID" -lang_name = "Name" -lang_resource = "Resource" -lang_state = "State" -lang_vfree = "Free" -lang_vsize = "Total" -action_add_local_vm = "Add local VM" -action_add_network_vm = "Add network VM" -action_remove = "delete" -action_stop = "stop" -action_start = "start" -action_reboot = "reboot" -action_update = "update" -action_console = "console" -action_migrate = "migrate" -action_clone = "clone" -action_migrate_in_progress = "Migration in progress - Please wait" -action_migrate_finished = "Migration finished!" -table_name = "Name" -table_mac = "Mac" -table_ram = "RAM" -table_cpu = "CPU" -table_nics = "NIC" -table_id = "ID" -table_ip = "IP" -table_vnc = "VNC" -table_state = "State" -table_type = "Type" -table_appliance = "Server" -table_kernel = "Kernel" -table_image = "Image" -table_storage = "Storage" -error_no_host = "No KVM Host Server configured yet!

    Please create a KVM Host Server first!" -please_wait = "Loading VMs. Please wait .." - -[add] -tab = "Add VM" -label = "Add new VM" -lang_basic = "Basic" -lang_hardware = "Virtual Hardware" -lang_net = "Virtual Network" -lang_net_0 = "Network_0" -lang_net_1 = "Network_1" -lang_net_2 = "Network_2" -lang_net_3 = "Network_3" -lang_net_4 = "Network_4" -lang_boot = "Boot from" -lang_virtual_disk = "Virtual disk image" -lang_vnc = "VNC Password" -lang_browse = "browse" -lang_browser = "Filepicker" -lang_password_generate = "generate password" -lang_password_show = "show password" -lang_password_hide = "hide password" -form_name = "Name" -form_cpus = "CPU(s)" -form_disk = "Disk" -form_swap = "Swap" -form_mac = "Mac" -form_ipaddress = "IP Adress" -form_memory = "Memory" -form_bridge = "Bridge" -form_boot_cd = "CD" -form_boot_iso = "Iso" -form_iso_path = "Path" -form_boot_net = "Net" -form_boot_local = "Local" -form_existing_disk = "Existing disk" -form_enable = "enable" -form_net_virtio = "Virtio" -form_net_e1000 = "E1000" -form_net_rtl8139 = "Rtl8139" -form_netdevice = "Networkcard" -form_disk_interface = "Disk Interface" -form_vnc = "Password" -form_vnc_repeat = "Password (repeat)" -form_vnc_keymap = "VNC Keymap" -form_swap = "Swap" -form_disk = "Disk" -msg_added = "Added VM %s" -action_add_vm_image = "Add a new VM Image" -error_exists = "VM %s already exists" -error_name = "Name must be %s" -error_memory = "Memory must be %s" -error_mac = "Mac is not valid" -error_bridge = "Bridge is not valid" -error_nic = "Nic is not valid" -error_boot = "Please select a boot device" -error_iso_path = "Path must not be empty" -error_vnc_password = "Password (repeat) does not match Password" -error_vnc_password_count = "Password must have at least 6 chars" -please_wait = "Adding VM. Please wait .." -canceled = "Operation canceled. Please wait .." - -[update] -tab = "Update VM" -label = "Update VM %s" -lang_basic = "Basic" -lang_hardware = "Hardware" -lang_net = "Network" -lang_net_0 = "Network_0" -lang_net_1 = "Network_1" -lang_net_2 = "Network_2" -lang_net_3 = "Network_3" -lang_net_4 = "Network_4" -lang_boot = "Boot from" -lang_vnc = "VNC Password" -lang_browse = "browse" -lang_browser = "Filepicker" -lang_password_generate = "generate password" -lang_password_show = "show password" -lang_password_hide = "hide password" -form_name = "Name" -form_cpus = "CPU(s)" -form_mac = "Mac" -form_memory = "Memory" -form_bridge = "Bridge" -form_boot_cd = "CD" -form_boot_iso = "Iso" -form_iso_path = "Path" -form_boot_net = "Net" -form_boot_local = "Local" -form_enable = "enable" -form_net_virtio = "Virtio" -form_net_e1000 = "E1000" -form_net_rtl8139 = "Rtl8139" -form_netdevice = "Networkcard" -form_disk_interface = "Disk Interface" -form_vnc = "Password" -form_vnc_repeat = "Password (repeat)" -form_vnc_keymap = "VNC Keymap" -form_swap = "Swap" -form_disk = "Disk" -msg_updated = "Updated VM %s" -error_exists = "VM %s already exists" -error_name = "Name must be %s" -error_memory = "Memory must be %s" -error_mac = "Mac is not valid" -error_bridge = "Bridge is not valid" -error_nic = "Nic is not valid" -error_boot = "Please select a boot device" -error_iso_path = "Path must not be empty" -error_vnc_password = "Password (repeat) does not match Password" -error_vnc_password_count = "Password must have at least 6 chars" -please_wait = "Updating VM. Please wait .." -canceled = "Operation canceled. Please wait .." - -[clone] -label = "Clone VM %s" -tab = "Clone VM" -msg_cloned = "Cloned %s as %s" -form_name = "Name" -error_exists = "VM %s allready exists" -error_name = "Name must be %s" -please_wait = "Cloning VM. Please wait .." -canceled = "Operation canceled. Please wait .." - -[migrate] -label = "Migrate VM %s" -tab = "Migrate VM" -msg_migrated = "Migrated %s to %s" -error_no_hosts = "No KVM Host found to migrate to" -form_target = "Target Host Resource" -please_wait = "Migrating VM. Please wait .." -canceled = "Operation canceled. Please wait .." - -[start] -msg_started = "Started VM %s" - -[stop] -msg_stoped = "Stopped VM %s" - -[reboot] -msg_rebooted = "Rebooted VM %s" - -[remove] -label = "Delete VM(s)" -msg_removed = "Deleted VM %s" -msg_vm_resource_still_in_use = "VM %s resource id %s is still in use by Server %s" -please_wait = "Removing VM(s). Please wait .." -canceled = "Operation canceled. Please wait .." - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/en.kvm.ini b/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/en.kvm.ini deleted file mode 100644 index bf0968f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/lang/en.kvm.ini +++ /dev/null @@ -1,167 +0,0 @@ -[select] -tab = "Select KVM Host" -label = "Select KVM Host" -action_edit = "edit" -table_name = "Name" -table_id = "Id" -table_recource = "Resource" -table_type = "Type" -table_deployment = "Deployment" -error_no_storage = "No storage configured yet!

    Please create a KVM first!" -new_storage = "New Storage" -please_wait = "Loading Volume groups. Please wait .." - -[edit] -tab = "Select Volume group" -label = "Select Volume group on KVM %s" -lang_id = "ID" -lang_name = "Name" -lang_resource = "Resource" -lang_state = "State" -lang_deployment = "Deployment" -action_edit = "select" -action_add ="Add new Volume Group" -action_remove ="remove" -table_name = "Name" -table_pv = "PV" -table_lv = "LV" -table_sn = "SN" -table_attr = "Attributes" -table_vsize = "Size" -table_vfree = "Free" -table_vused = "Used" -table_vusedpercent = "%" -table_available = "Available" -table_objects = "Objects" -table_vg = "Volume Group Details" -table_bricks = "Gluster Bricks" -table_type = "Typ" -table_status = "Status" -table_topology = "Topology" -table_transport = "Transport" -error_no_kvm = "Storage %s is not of type kvm" -please_wait = "Loading Volume group. Please wait .." - -[addvg] -tab = "Add Volume Group" -label = "Add Volume Group to storage %s" -partition = "Partition" -name = "Name" -extend = "extend partition" -confirm_text = "All Data on %s will be erased.
    Are you sure to continue?" -msg_added = "Successfully added Volume Group %s" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." - -[removevg] -tab = "Remove Volume Group" -label = "Remove Volume Group on storage %s" -confirm_text = "Do you realy want to remove Volume Group %s?" -msg_removed = "Successfully removed Volume Group %s" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." - -[volgroup] -tab = "Edit Volume group" -label = "Edit Volume group %s on KVM %s" -lang_id = "ID" -lang_name = "Name" -lang_deployment = "Deployment" -lang_resource = "Resource" -lang_state = "State" -lang_attr = "Attributes" -lang_pv = "PV / LV / SN" -lang_size = "Size / Free" -lang_free = "Free" -action_add = "Add new logical volume" -action_remove = "delete" -action_resize = "resize" -action_snap = "snap" -action_clone = "clone" -action_add_image = "Add" -action_remove_image = "Remove" -action_sync_in_progress = "Source of synchronisation - Please wait" -action_clone_in_progress = "Synchronisation in progress - Please wait" -action_clone_finished = "Syncronisation finished!" -table_name = "Lvol" -table_deployment = "Deployment" -table_attr = "Attributes" -table_path = "Path" -table_size = "Size" -table_source = "Source" -table_path_physical = "Physical" -table_path_glusters = "Logical" -error_no_kvm = "Storage %s is not of type kvm-deployment" -please_wait = "Loading Volume group. Please wait .." -canceled = "Operation canceled. Please wait .." - -[add] -tab = "Add Logical Volume" -label = "Add Logical Volume to Volume group %s" -form_name = "Name" -form_size = "Size (max: %s MB)" -form_type = "Volume Type" -msg_added = "Added Logical Volume %s" -msg_add_failed = "Failed adding Logical Volume %s" -error_exists = "Logical Volume %s allready exists" -error_name = "Name must be %s" -error_size = "Size must be %s" -error_size_exeeded = "Size exeeds %s MB" -lang_name_generate = "generate name" -please_wait = "Adding Logical Volume. Please wait .." -canceled = "Operation canceled. Please wait .." - -[image] -label = "Add/Remove Image for Logical Volume %s" -tab = "Add/Remove Image" -error_exists = "Image %s allready exists" -error_image_still_in_use = "Image id %s is still in use by Server(s) %s" -msg_added_image = "Added Image %s" -msg_removed_image = "Removed Image id %s" -please_wait = "Please wait .." -canceled = "Operation canceled. Please wait .." - -[snap] -label = "Snap Logical Volume %s" -tab = "Snap Logical Volume" -msg_snaped = "Snaped %s to %s" -msg_snap_failed = "Snapping failed for %s to %s" -form_name = "Name" -form_size = "Size (max: %s MB)" -error_exists = "Volume %s allready exists" -error_name = "Name must be %s" -error_size = "Size must be %s" -error_size_exeeded = "Size exeeds %s MB" -please_wait = "Snaping Logical Volume. Please wait .." -canceled = "Operation canceled. Please wait .." - -[clone] -label = "Clone Logical Volume %s" -tab = "Clone Logical Volume" -msg_cloned = "Cloned %s as %s" -msg_clone_failed = "Clone failed for %s as %s" -form_name = "Name" -error_exists = "Volume %s allready exists" -error_name = "Name must be %s" -please_wait = "Cloning Logical Volume. Please wait .." -canceled = "Operation canceled. Please wait .." - -[remove] -label = "Delete Logical Volume(s)" -msg_removed = "Deleted Logical Volume %s" -msg_vm_image_still_in_use = "Volume %s of Image id %s is still in use by Server %s" -please_wait = "Deleting Logical Volume(s). Please wait .." -canceled = "Operation canceled. Please wait .." - -[resize] -label = "Resize Logical Volume %s" -tab = "Resize Logical Volume" -size = "min. %s MB, max. %s MB" -ceph_size = "New Volume size MB" -error_size = "Size must be %s" -error_size_exeeded = "Size exeeds %s MB" -error_size_undercut = "Size undercuts %s MB" -msg_resized = "Resized Logical Volume %s" -please_wait = "Resizing Logical Volume. Please wait .." -canceled = "Operation canceled. Please wait .." - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/kvm/web/menu.txt deleted file mode 100644 index f722e4a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/menu.txt +++ /dev/null @@ -1,27 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|KVM -...|Hosts|index.php?plugin=kvm&controller=kvm-vm|KVM Hosts -...|Help| -....|About|index.php?plugin=kvm&controller=kvm-about|How to use -....|Config|index.php?plugin=kvm&controller=kvm-about&kvm_about_action=bootservice|KVM Host Boot-Service -....|VMs|index.php?plugin=kvm&controller=kvm-about&kvm_about_action=vms|Virtual Machine Management -....|Storage|index.php?plugin=kvm&controller=kvm-about&kvm_about_action=storage|Storage Management -....|Usage|index.php?plugin=kvm&controller=kvm-about&kvm_about_action=usage|Use-cases diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-appliance-hook.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-appliance-hook.php deleted file mode 100644 index 723c5dd..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-appliance-hook.php +++ /dev/null @@ -1,216 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $OPENQRM_SERVER_IP_ADDRESS; -$event = new event(); -global $event; - - - -function openqrm_kvm_appliance($cmd, $appliance_fields) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $appliance_id=$appliance_fields["appliance_id"]; - $appliance_name=$appliance_fields["appliance_name"]; - $resource = new resource(); - $resource->get_instance_by_id($appliance_fields["appliance_resources"]); - $appliance_ip=$resource->ip; - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - // check appliance values, maybe we are in update and they are incomplete - if ($appliance->imageid == 1) { - return; - } - if (($resource->id == "-1") || ($resource->id == "") || (!isset($resource->vtype))) { - return; - } - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - $event->log("openqrm_kvm_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-appliance-hook.php", "Handling $cmd event $appliance_id/$appliance_name/$appliance_ip", "", "", 0, 0, $appliance_id); - - switch($cmd) { - case "start": - // send command to assign image and start vm - - // NOTICE : please enable this hook only if you are using the ip-mgmt plugin with vlans - // check if resource type -> kvm-vm-net -// $virtualization = new virtualization(); -// $virtualization->get_instance_by_type("kvm-vm-net"); -// $kvm_host_resource = new resource(); -// $kvm_host_resource->get_instance_by_id($resource->vhostid); -// if ($resource->vtype != $virtualization->id) { -// $kvm_command="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-vm reset_vlans_by_mac -b start -m $resource->mac"; -// $kvm_host_resource->send_command($kvm_host_resource->ip, $kvm_command); -// return; -// } - - - // check resource type -> kvm-vm-local - $virtualization = new virtualization(); - $virtualization->get_instance_by_type("kvm-vm-local"); - if ($resource->vtype != $virtualization->id) { - $event->log("openqrm_kvm_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-appliance-hook.php", "$appliance_id is not from type kvm-vm, skipping .. $appliance_name/$appliance_ip", "", "", 0, 0, $appliance_id); - return; - } - // check image is on the same storage server - // get the kvm host resource - $kvm_host_resource = new resource(); - $kvm_host_resource->get_instance_by_id($resource->vhostid); - // get the kvm resource - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $kvm_resource = new resource(); - $kvm_resource->get_instance_by_id($storage->resource_id); - if ($kvm_host_resource->id != $kvm_resource->id) { - $event->log("openqrm_kvm_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-appliance-hook.php", "Appliance $appliance_id image is not available on this kvm host. Assuming SAN-Backend", "", "", 0, 0, $appliance_id); - } - $kvm_command=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm-vm start_by_mac -m ".$resource->mac." -d ".$image->rootdevice." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password; - $kvm_host_resource->send_command($kvm_host_resource->ip, $kvm_command); - break; - case "stop": - // send command to stop the vm and deassign image - - // NOTICE : please enable this hook only if you are using the ip-mgmt plugin with vlans - // check if resource type -> kvm-vm-net -// $virtualization = new virtualization(); -// $virtualization->get_instance_by_type("kvm-vm-net"); -// $kvm_host_resource = new resource(); -// $kvm_host_resource->get_instance_by_id($resource->vhostid); -// if ($resource->vtype != $virtualization->id) { -// $kvm_command="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm reset_vlans_by_mac -b stop -m $resource->mac"; -// $kvm_host_resource->send_command($kvm_host_resource->ip, $kvm_command); -// return; -// } - - - // check resource type -> kvm-vm-local - $virtualization = new virtualization(); - $virtualization->get_instance_by_type("kvm-vm-local"); - if ($resource->vtype != $virtualization->id) { - $event->log("openqrm_kvm_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-appliance-hook.php", "$appliance_id is not from type kvm-vm, skipping .. $appliance_name/$appliance_ip", "", "", 0, 0, $appliance_id); - return; - } - // check image is on the same storage server - // get the kvm host resource - $kvm_host_resource = new resource(); - $kvm_host_resource->get_instance_by_id($resource->vhostid); - // get the kvm resource - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $kvm_resource = new resource(); - $kvm_resource->get_instance_by_id($storage->resource_id); - if ($kvm_host_resource->id != $kvm_resource->id) { - $event->log("openqrm_kvm_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-appliance-hook.php", "Appliance $appliance_id image is not available on this kvm host. Assuming SAN-Backend", "", "", 0, 0, $appliance_id); - } - $kvm_command=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm-vm restart_by_mac -m ".$resource->mac." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $kvm_host_resource->send_command($kvm_host_resource->ip, $kvm_command); - break; - - case "update": - // check if the appliance was set to a kvm Host, if yes, auto-create the storage objects - $virtualization = new virtualization(); - $virtualization->get_instance_by_type("kvm"); - if ($appliance->virtualization == $virtualization->id) { - // KVM LVM Storage - $deployment = new deployment(); - $deployment->get_instance_by_name('kvm-lvm-deployment'); - $storage = new storage(); - $kvm_id_list = $storage->get_ids_by_storage_type($deployment->id); - $found_kvm = false; - $found_kvm_id = -1; - foreach ($kvm_id_list as $list) { - foreach ($list as $kvm_id) { - $storage->get_instance_by_id($kvm_id); - if ($storage->resource_id == $appliance->resources) { - $found_kvm = true; - $found_kvm_id = $storage->id; - break; - } - } - } - if (!$found_kvm) { - $found_kvm_id=(int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $storage_fields['storage_id']=$found_kvm_id; - $storage_fields['storage_name']=$appliance->name."-lvm"; - $storage_fields['storage_type']=$deployment->id; - $storage_fields['storage_comment']='KVM LVM Storage Object for Appliance '.$appliance->name; - $storage_fields['storage_resource_id']=$appliance->resources; - $storage_fields['storage_capabilities'] = ''; - $storage->add($storage_fields); - $event->log("openqrm_kvm_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-appliance-hook.php", "Created KVM LVM Storage Object for Appliance ".$appliance_id."!", "", "", 0, 0, $appliance_id); - } else { - $event->log("openqrm_kvm_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-appliance-hook.php", "KVM LVM Storage Object for Appliance ".$appliance_id." already existing.", "", "", 0, 0, $appliance_id); - } - // KVM Blockfile Storage - $deployment = new deployment(); - $deployment->get_instance_by_name('kvm-bf-deployment'); - $storage = new storage(); - $kvm_id_list = $storage->get_ids_by_storage_type($deployment->id); - $found_kvm = false; - $found_kvm_id = -1; - foreach ($kvm_id_list as $list) { - foreach ($list as $kvm_id) { - $storage->get_instance_by_id($kvm_id); - if ($storage->resource_id == $appliance->resources) { - $found_kvm = true; - $found_kvm_id = $storage->id; - break; - } - } - } - if (!$found_kvm) { - $found_kvm_id=(int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $storage_fields['storage_id']=$found_kvm_id; - $storage_fields['storage_name']=$appliance->name."-bf"; - $storage_fields['storage_type']=$deployment->id; - $storage_fields['storage_comment']='KVM Blockfile Storage Object for Appliance '.$appliance->name; - $storage_fields['storage_resource_id']=$appliance->resources; - $storage_fields['storage_capabilities'] = ''; - $storage->add($storage_fields); - $event->log("openqrm_kvm_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-appliance-hook.php", "Created KVM Blockfile Storage Object for Appliance ".$appliance_id."!", "", "", 0, 0, $appliance_id); - } else { - $event->log("openqrm_kvm_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-appliance-hook.php", "KVM Blockfile Storage Object for Appliance ".$appliance_id." already existing.", "", "", 0, 0, $appliance_id); - } - - - } - break; - - - } -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-bf-deployment-auth-hook.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-bf-deployment-auth-hook.php deleted file mode 100644 index 0b3c5ce..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-bf-deployment-auth-hook.php +++ /dev/null @@ -1,199 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/image_authentication.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; - -/** - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - */ - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $IMAGE_AUTHENTICATION_TABLE; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - - - //-------------------------------------------------- - /** - * authenticates the storage volume for the appliance resource - * - * storage_auth_function("start", 2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_function($cmd, $appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $IMAGE_AUTHENTICATION_TABLE; - global $openqrm_server; - global $RootDir; - - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $resource_mac=$resource->mac; - $resource_ip=$resource->ip; - - // For kvm vms we assume that the image is located on the vm-host - // so we send the auth command to the vm-host instead of the image storage. - // This enables using a e.g. a NAS or Glustefs backend as shared VM location for all kvm hosts - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($resource->vhostid); - if ($vm_host_resource->id != $storage_resource->id) { - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-auth-hook.php", "Appliance ".$appliance_id." image IS NOT available on this kvm host, ".$storage_resource->id." not equal ".$vm_host_resource->id." !! Assuming NAS/Glusterfs Backend", "", "", 0, 0, $appliance_id); - } else { - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-auth-hook.php", "Appliance ".$appliance_id." image IS available on this kvm host, ".$storage_resource->id." equal ".$vm_host_resource->id.".", "", "", 0, 0, $appliance_id); - } - - switch($cmd) { - case "start": - // authenticate the rootfs / needs openqrm user + pass - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - // generate a password for the image - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-auth-hook.php", "Authenticating ".$image_name." / ".$image_rootdevice." to resource ".$resource_mac.".", "", "", 0, 0, $appliance_id); - $auth_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -n ".$image_name." -r ".$image_rootdevice." -i ".$image_name." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." -t ".$deployment->type." --openqrm-cmd-mode background"; - $resource->send_command($vm_host_resource->ip, $auth_start_cmd); - break; - } - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage volume for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage deployment volumes for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_deployment_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_deployment_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - - } - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-bf-deployment-cloud-hook.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-bf-deployment-cloud-hook.php deleted file mode 100644 index 6639e26..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-bf-deployment-cloud-hook.php +++ /dev/null @@ -1,393 +0,0 @@ - -*/ - - -// This file implements the cloud storage methods - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -// special cloud classes -require_once "$RootDir/plugins/cloud/class/cloudimage.class.php"; - -$event = new event(); -global $event; - -global $OPENQRM_SERVER_BASE_DIR; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $RESOURCE_INFO_TABLE; - - -// --------------------------------------------------------------------------------- -// general cloudstorage methods -// --------------------------------------------------------------------------------- - - -// clones the volume of an image -function create_clone_kvm_bf_deployment($cloud_image_id, $image_clone_name, $disk_size) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - // we got the cloudimage id here, get the image out of it - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("create_clone_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Creating clone ".$image_clone_name." of image ".$cloudimage->image_id." on the storage", "", "", 0, 0, 0); - // get image, this is already the new logical clone - // we just need to physical snapshot it and update the rootdevice - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // kvm-bf-deployment - $image->get_instance_by_id($image_id); - // parse the identifiers - // origin image volume name - $origin_volume_name=basename($image_rootdevice); - // location of the volume (path) - $image_location_name=dirname($image_rootdevice); - // set default snapshot size - if (!strlen($disk_size)) { - $disk_size=5000; - } - // update the image rootdevice parameter - $ar_image_update = array( - 'image_rootdevice' => $image_location_name."/".$image_clone_name, - ); - - // For kvm vms we assume that the image is located on the vm-host - // so we send the auth command to the vm-host instead of the image storage. - // This enables using a NAS/Glusterfs backend with all volumes accessible for all hosts - // get the vm resource - $vm_resource = new resource(); - $vm_resource->get_instance_by_id($cloudimage->resource_id); - // get the lxc host - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($vm_resource->vhostid); - // san backend ? - if ($vm_host_resource->id != $resource->id) { - $event->log("create_clone_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Image ".$image_id." IS NOT available on this kvm host, ".$resource->id." not equal ".$vm_host_resource->id." !! Assuming SAN Backend", "", "", 0, 0, 0); - - // update the image storage id with the vm-host-resource - $image_deployment = new deployment(); - $image_deployment->get_instance_by_type($image_type); - // loop over all storage id from type $image_type - $found_image=0; - $storage_list_by_type = new storage(); - $storage_id_list_by_type = $storage_list_by_type->get_ids_by_storage_type($image_deployment->id); - foreach($storage_id_list_by_type as $storage_id_list) { - $storage_id = $storage_id_list['storage_id']; - $tstorage = new storage(); - $tstorage->get_instance_by_id($storage_id); - if ($tstorage->resource_id == $vm_host_resource->id) { - // re-create update array + new storage id - $ar_image_update = array( - 'image_rootdevice' => $image_location_name."/".$image_clone_name, - 'image_storageid' => $tstorage->id, - ); - $event->log("create_clone_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Updating Image ".$image_id." / ".$image_name." with storage id ".$tstorage->id.".", "", "", 0, 0, 0); - $found_image=1; - break; - } - } - if ($found_image == 0) { - $event->log("create_clone_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 2, "openqrm-kvm-bf-deployment-cloud-hook.php", "SETUP ERROR: Could not find a storage server type ".$image_type." using resource ".$vm_host_resource->id.". Please create one!", "", "", 0, 0, 0); - $event->log("create_clone_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 2, "openqrm-kvm-bf-deployment-cloud-hook.php", "SETUP ERROR: Not cloning image ".$image_id.".", "", "", 0, 0, 0); - return; - } - - } else { - $event->log("create_clone_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Image ".$image_id." IS available on this kvm host, ".$resource->id." equal ".$vm_host_resource->id.".", "", "", 0, 0, 0); - } - - $event->log("create_clone_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Updating rootdevice of image ".$image_id." / ".$image_name." with ".$image_location_name."/".$image_clone_name, "", "", 0, 0, 0); - $image->update($image_id, $ar_image_update); - $image_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm snap -n ".$origin_volume_name." -v ".$image_location_name." -s ".$image_clone_name." -m ".$disk_size." -t ".$deployment->type." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $event->log("create_clone_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Running : ".$image_clone_cmd, "", "", 0, 0, 0); - $resource->send_command($vm_host_resource->ip, $image_clone_cmd); -} - - - -// removes the volume of an image -function remove_kvm_bf_deployment($cloud_image_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("remove_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Removing image ".$cloudimage->image_id." from storage.", "", "", 0, 0, 0); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // parse the identifiers - // origin image volume name - $origin_volume_name=basename($image_rootdevice); - // location of the volume (path) - $image_location_name=dirname($image_rootdevice); - - // For kvm vms we assume that the image is located on the vm-host - // so we send the auth command to the vm-host instead of the image storage. - // This enables using a NAS/Glusterfs backend with all volumes accessible for all hosts - // - // Still we need to send the remove command to the storage resource since the - // create-phase automatically adapted the image->storageid, we cannot use the vm-resource here - // because cloudimage->resource_id will be set to -1 when the cloudapp is in paused/resize/private state - // - if ($cloudimage->resource_id > 0) { - // try to get the vm resource - $vm_resource = new resource(); - $vm_resource->get_instance_by_id($cloudimage->resource_id); - // get the lxc host - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($vm_resource->vhostid); - // san backend ? - if ($vm_host_resource->id != $resource->id) { - $event->log("remove_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Image ".$image_id." IS NOT available on this kvm host, ".$resource->id." not equal ".$vm_host_resource->id." !! Assuming SAN Backend", "", "", 0, 0, 0); - } else { - $event->log("remove_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Image ".$image_id." IS available on this kvm host, ".$resource->id." equal ".$vm_host_resource->id.".", "", "", 0, 0, 0); - } - } - $image_remove_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm remove -n ".$origin_volume_name." -v ".$image_location_name." -t ".$deployment->type." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $event->log("remove_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Running : ".$image_remove_clone_cmd, "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_remove_clone_cmd); -} - - -// resizes the volume of an image -function resize_kvm_bf_deployment($cloud_image_id, $resize_value) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("resize_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Resize image ".$cloudimage->image_id." on storage.", "", "", 0, 0, 0); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // parse the identifiers - // origin image volume name - $origin_volume_name=basename($image_rootdevice); - // location of the volume (path) - $image_location_name=dirname($image_rootdevice); - - // For kvm vms we assume that the image is located on the vm-host - // so we send the auth command to the vm-host instead of the image storage. - // This enables using a NAS/Glusterfs backend with all volumes accessible for all hosts - // - // Still we need to send the remove command to the storage resource since the - // create-phase automatically adapted the image->storageid, we cannot use the vm-resource here - // because cloudimage->resource_id will be set to -1 when the cloudapp is in paused/resize/private state - // - if ($cloudimage->resource_id > 0) { - // try to get the vm resource - $vm_resource = new resource(); - $vm_resource->get_instance_by_id($cloudimage->resource_id); - // get the lxc host - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($vm_resource->vhostid); - // san backend ? - if ($vm_host_resource->id != $resource->id) { - $event->log("resize_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Image ".$image_id." IS NOT available on this kvm host, ".$resource->id." not equal ".$vm_host_resource->id." !! Assuming SAN Backend", "", "", 0, 0, 0); - } else { - $event->log("resize_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Image ".$image_id." IS available on this kvm host, ".$resource->id." equal ".$vm_host_resource->id, "", "", 0, 0, 0); - } - } - - $image_resize_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm resize -n ".$origin_volume_name." -v ".$image_location_name." -m ".$resize_value." -t ".$deployment->type." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $event->log("resize_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Running : ".$image_resize_cmd, "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_resize_cmd); -} - - - -// creates a private copy of the volume of an image -function create_private_kvm_bf_deployment($cloud_image_id, $private_disk, $private_image_name) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("create_private_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Creating private image ".$cloudimage->image_id." on storage.", "", "", 0, 0, 0); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // create an admin user to post when cloning has finished - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - // parse the identifiers - // origin image volume name - $origin_volume_name=basename($image_rootdevice); - // location of the volume (path) - $image_location_name=dirname($image_rootdevice); - - // For kvm vms we assume that the image is located on the vm-host - // so we send the auth command to the vm-host instead of the image storage. - // This enables using a NAS/Glusterfs backend with all volumes accessible for all hosts - // - // Still we need to send the remove command to the storage resource since the - // create-phase automatically adapted the image->storageid, we cannot use the vm-resource here - // because cloudimage->resource_id will be set to -1 when the cloudapp is in paused/resize/private state - // - if ($cloudimage->resource_id > 0) { - // try to get the vm resource - $vm_resource = new resource(); - $vm_resource->get_instance_by_id($cloudimage->resource_id); - // get the lxc host - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($vm_resource->vhostid); - // san backend ? - if ($vm_host_resource->id != $resource->id) { - $event->log("create_private_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Image ".$image_id." IS NOT available on this kvm host, ".$resource->id." not equal ".$vm_host_resource->id." !! Assuming SAN Backend", "", "", 0, 0, 0); - } else { - $event->log("create_private_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Image ".$image_id." IS available on this kvm host, ".$resource->id." equal ".$vm_host_resource->id.".", "", "", 0, 0, 0); - } - } - - $image_resize_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm clone -n ".$origin_volume_name." -s ".$private_image_name." -v ".$image_location_name." -m ".$private_disk." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." -t ".$deployment->type." --openqrm-cmd-mode background"; - $event->log("create_private_kvm_bf_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-bf-deployment-cloud-hook.php", "Running : $image_resize_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_resize_cmd); - // set the storage specific image root_device parameter - $new_rootdevice = str_replace($origin_volume_name, $private_image_name, $image->rootdevice); - return $new_rootdevice; -} - - - -// --------------------------------------------------------------------------------- - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-ceph-deployment-auth-hook b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-ceph-deployment-auth-hook deleted file mode 100644 index d8f064e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-ceph-deployment-auth-hook +++ /dev/null @@ -1,195 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/image_authentication.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; - -/** - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - */ - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $IMAGE_AUTHENTICATION_TABLE; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - - - //-------------------------------------------------- - /** - * authenticates the storage volume for the appliance resource - * - * storage_auth_function("start", 2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_function($cmd, $appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $IMAGE_AUTHENTICATION_TABLE; - global $openqrm_server; - global $RootDir; - - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $resource_mac=$resource->mac; - $resource_ip=$resource->ip; - - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($resource->vhostid); - - switch($cmd) { - case "start": - // authenticate the rootfs / needs openqrm user + pass - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - // generate a password for the image - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-auth-hook.php", "Authenticating ".$image_name." / ".$image_rootdevice." to resource ".$resource_mac.".", "", "", 0, 0, $appliance_id); - $auth_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -n ".$image_name." -r ".$image_rootdevice." -i ".$image_name." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." -t ".$deployment->type." --openqrm-cmd-mode background"; - $resource->send_command($storage_resource->ip, $auth_start_cmd); - break; - } - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage volume for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage deployment volumes for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_deployment_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_deployment_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - - } - - - - - - -?> - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-ceph-deployment-cloud-hook b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-ceph-deployment-cloud-hook deleted file mode 100644 index eddabd9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-ceph-deployment-cloud-hook +++ /dev/null @@ -1,278 +0,0 @@ - -*/ - - -// This file implements the cloud storage methods - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -// special cloud classes -require_once "$RootDir/plugins/cloud/class/cloudimage.class.php"; - -$event = new event(); -global $event; - -global $OPENQRM_SERVER_BASE_DIR; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $RESOURCE_INFO_TABLE; - - -// --------------------------------------------------------------------------------- -// general cloudstorage methods -// --------------------------------------------------------------------------------- - - -// clones the volume of an image -function create_clone_kvm_ceph_deployment($cloud_image_id, $image_clone_name, $disk_size) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - // we got the cloudimage id here, get the image out of it - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("create_clone_kvm_ceph_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-ceph-deployment-cloud-hook.php", "Creating clone ".$image_clone_name." of image ".$cloudimage->image_id." on the storage", "", "", 0, 0, 0); - // get image, this is already the new logical clone - // we just need to physical snapshot it and update the rootdevice - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // kvm-ceph-deployment - $image->get_instance_by_id($image_id); - $ceph_uri_arr = parse_url($image_rootdevice); - // origin image volume name - $origin_volume_name=basename($ceph_uri_arr['path']); - // location of the volume (path) - $image_location_name=str_replace('/', '', dirname($ceph_uri_arr['path'])); - // set default snapshot size - if (!strlen($disk_size)) { - $disk_size=5000; - } - // update the image rootdevice parameter - $ar_image_update = array( - 'image_rootdevice' => "rbd:".$image_location_name."/".$origin_volume_name."@".$image_clone_name, - ); - // get the vm resource - $vm_resource = new resource(); - $vm_resource->get_instance_by_id($cloudimage->resource_id); - // get the VM host - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($vm_resource->vhostid); - - $event->log("create_clone_kvm_ceph_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-ceph-deployment-cloud-hook.php", "Updating rootdevice of image ".$image_id." / ".$image_name." with ".$image_location_name."/".$image_clone_name, "", "", 0, 0, 0); - $image->update($image_id, $ar_image_update); - $image_clone_cmd="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm snap -n ".$origin_volume_name." -v ".$image_location_name." -s ".$image_clone_name." -m ".$disk_size." -t ".$deployment->type." --openqrm-cmd-mode background"; - $event->log("create_clone_kvm_ceph_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-ceph-deployment-cloud-hook.php", "Running : ".$image_clone_cmd, "", "", 0, 0, 0); - $resource->send_command($resource->ip, $image_clone_cmd); -} - - - -// removes the volume of an image -function remove_kvm_ceph_deployment($cloud_image_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("remove_kvm_ceph_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-ceph-deployment-cloud-hook.php", "Removing image ".$cloudimage->image_id." from storage.", "", "", 0, 0, 0); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - $ceph_uri_arr = parse_url($image_rootdevice); - // origin image volume name - $origin_volume_name=basename($ceph_uri_arr['path']); - // location of the volume (path) - $image_location_name=str_replace('/', '', dirname($ceph_uri_arr['path'])); - $image_remove_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm remove -n ".$origin_volume_name." -v ".$image_location_name." -t ".$deployment->type." --openqrm-cmd-mode background"; - $event->log("remove_kvm_ceph_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-ceph-deployment-cloud-hook.php", "Running : ".$image_remove_clone_cmd, "", "", 0, 0, 0); - $resource->send_command($resource->ip, $image_remove_clone_cmd); -} - - -// resizes the volume of an image -function resize_kvm_ceph_deployment($cloud_image_id, $resize_value) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("resize_kvm_ceph_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-ceph-deployment-cloud-hook.php", "Resize image ".$cloudimage->image_id." on storage.", "", "", 0, 0, 0); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - $ceph_uri_arr = parse_url($image_rootdevice); - // origin image volume name - $origin_volume_name=basename($ceph_uri_arr['path']); - // location of the volume (path) - $image_location_name=str_replace('/', '', dirname($ceph_uri_arr['path'])); - $image_resize_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm resize -n ".$origin_volume_name." -v ".$image_location_name." -m ".$resize_value." -t ".$deployment->type." --openqrm-cmd-mode background"; - $event->log("resize_kvm_ceph_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-ceph-deployment-cloud-hook.php", "Running : ".$image_resize_cmd, "", "", 0, 0, 0); - $resource->send_command($resource->ip, $image_resize_cmd); -} - - - -// creates a private copy of the volume of an image -function create_private_kvm_ceph_deployment($cloud_image_id, $private_disk, $private_image_name) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("create_private_kvm_ceph_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-ceph-deployment-cloud-hook.php", "Creating private image ".$cloudimage->image_id." on storage.", "", "", 0, 0, 0); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // create an admin user to post when cloning has finished - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - $ceph_uri_arr = parse_url($image_rootdevice); - // origin image volume name - $origin_volume_name=basename($ceph_uri_arr['path']); - // location of the volume (path) - $image_location_name=str_replace('/', '', dirname($ceph_uri_arr['path'])); - $image_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm clone -n ".$origin_volume_name." -s ".$private_image_name." -v ".$image_location_name." -m ".$private_disk." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." -t ".$deployment->type." --openqrm-cmd-mode background"; - $event->log("create_private_kvm_ceph_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-ceph-deployment-cloud-hook.php", "Running : $image_resize_cmd", "", "", 0, 0, 0); - $resource->send_command($resource->ip, $image_clone_cmd); - // set the storage specific image root_device parameter - $new_rootdevice = "ceph:".$resource->ip."//".$image_location_name."/".$private_image_name; - return $new_rootdevice; -} - - - -// --------------------------------------------------------------------------------- - - -?> diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-cloud-hook.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-cloud-hook.php deleted file mode 100644 index fb01429..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-cloud-hook.php +++ /dev/null @@ -1,451 +0,0 @@ - -*/ - - -// This file implements the virtual machine abstraction in the cloud of openQRM - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; - -// for ovs we need to get the request for the ips -require_once "$RootDir/plugins/cloud/class/cloudrequest.class.php"; -require_once "$RootDir/plugins/cloud/class/cloudconfig.class.php"; -require_once "$RootDir/plugins/cloud/class/clouduser.class.php"; - - -$event = new event(); -global $event; - -global $OPENQRM_SERVER_BASE_DIR; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $RESOURCE_INFO_TABLE; - -// --------------------------------------------------------------------------------- -// general kvm cloudvm methods -// --------------------------------------------------------------------------------- - - -// creates a vm -function create_kvm_vm($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, $vm_type, $vncpassword, $source_image_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - global $RootDir; - $event->log("create_kvm_vm_local", $_SERVER['REQUEST_TIME'], 5, "kvm-cloud-hook", "Creating KVM VM $name on Host resource $host_resource_id", "", "", 0, 0, 0); - // start the vm on the host - $host_resource = new resource(); - $host_resource->get_instance_by_id($host_resource_id); - // we need to have an openQRM server object too since some of the - // virtualization commands are sent from openQRM directly - $openqrm = new openqrm_server(); - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - $vncpassword_parameter = ""; - if ($vncpassword != '') { - $vncpassword_parameter = " -v ".$vncpassword; - } - - - // fill mac array from additional_network_str - $vm_ovs_additonal_nic_str = ''; - $vm_resource_mac_array[] = $mac; - $vm_resource_mac_tmp_array = explode(' ', trim($additional_nic_str)); - foreach($vm_resource_mac_tmp_array as $mac_param) { - if(strpos($mac_param, '-m') === false) { - $vm_resource_mac_array[] = $mac_param; - } - - } - - // if ovs enabled remove last mac address from addtional_nic_str - // and pop from array - // for ovs we send the bridges from ip_mgmt - $plugin = new plugin(); - if (in_array("openvswitch-manager", $plugin->enabled())) { - - array_pop($vm_resource_mac_array); - // rebuild add_nic_str - $vm_ovs_additonal_nic_array = $vm_resource_mac_array; - array_shift($vm_ovs_additonal_nic_array); - $add_nic_loop = 1; - foreach ($vm_ovs_additonal_nic_array as $vm_ovs_additonal_nic_mac) { - $vm_ovs_additonal_nic_str .= " -m".$add_nic_loop." ".$vm_ovs_additonal_nic_mac." "; - $add_nic_loop++; - } - - $additional_nic_str = $vm_ovs_additonal_nic_str; - - // if ovs enabled - get cr and add ip-mgmt ips to dhcpd - $vm_resource = new resource(); - $vm_resource->get_instance_by_mac($mac); - - // the resource name is set as the appliance_name in the cr we are looking for - $crl = new cloudrequest(); - $cr_list = $crl->get_all_new_and_approved_ids(); - $vm_cr_id = 0; - foreach($cr_list as $list) { - $cr_id = $list['cr_id']; - $cr = new cloudrequest(); - $cr->get_instance_by_id($cr_id); - if ($cr->appliance_hostname == $name) { - $vm_cr_id = $cr->id; - $event->log("create_kvm_vm_local", $_SERVER['REQUEST_TIME'], 5, "kvm-cloud-hook", "OVS: Found cloud request id $vm_cr_id", "", "", 0, 0, 0); - } - } - if ($vm_cr_id == 0) { - $event->log("create_kvm_vm_local", $_SERVER['REQUEST_TIME'], 2, "kvm-cloud-hook", "OVS: Could not find out cloud request id!", "", "", 0, 0, 0); - return; - } - - // here we have found the cr for this vm - $cr = new cloudrequest(); - $cr->get_instance_by_id($vm_cr_id); - - $cu = new clouduser(); - $cu->get_instance_by_id($cr->cu_id); - - $ovs_network_parameter = ''; - - // check ip-mgmt - $cc_conf = new cloudconfig(); - $show_ip_mgmt = $cc_conf->get_value(26); // ip-mgmt enabled ? - if (!strcmp($show_ip_mgmt, "true")) { - if (file_exists("$RootDir/plugins/ip-mgmt/.running")) { - require_once "$RootDir/plugins/ip-mgmt/class/ip-mgmt.class.php"; - $ip_mgmt_array = explode(",", $cr->ip_mgmt); - $ip_mgmt_assign_loop = 0; - foreach($ip_mgmt_array as $ip_mgmt_config_str) { - - $collon_pos = strpos($ip_mgmt_config_str, ":"); - $nic_id = substr($ip_mgmt_config_str, 0, $collon_pos); - $ip_mgmt_id = substr($ip_mgmt_config_str, $collon_pos+1); - if (!strlen($ip_mgmt_id)) { - continue; - } - $orginal_ip_mgmt_id = $ip_mgmt_id; - $ip_mgmt_assign = new ip_mgmt(); - $ip_mgmt_id_final = $ip_mgmt_id; - // we need to check if the ip is still free - $ip_mgmt_object_arr = $ip_mgmt_assign->get_instance('id', $ip_mgmt_id); - $ip_app_id = $ip_mgmt_object_arr['ip_mgmt_appliance_id']; - if ($ip_app_id > 0) { - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "cloud-monitor", "WARNING: ip-mgmt id ".$ip_mgmt_id." is already in use. Trying to find the next free ip..", "", "", 0, 0, 0); - $ip_mgmt_id = -2; - } else { - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "cloud-monitor", "SUCCESS: ip-mgmt id ".$ip_mgmt_id." is free.", "", "", 0, 0, 0); - } - - // if ip_mgmt_id == auto (-2) search the next free ip for the user - if ($ip_mgmt_id == -2) { - $ip_mgmt_list_per_user = $ip_mgmt_assign->get_list_by_user($cu->cg_id); - $next_free_ip_mgmt_id = 0; - foreach($ip_mgmt_list_per_user as $list) { - $possible_next_ip_mgmt_id = $list['ip_mgmt_id']; - $possible_next_ip_mgmt_object_arr = $ip_mgmt_assign->get_instance('id', $possible_next_ip_mgmt_id); - if ($possible_next_ip_mgmt_object_arr['ip_mgmt_appliance_id'] == NULL) { - // we have found the next free ip-mgmt id - $next_free_ip_mgmt_id = $possible_next_ip_mgmt_id; - $ip_mgmt_id_final = $possible_next_ip_mgmt_id; - break; - } - } - if ($next_free_ip_mgmt_id == 0) { - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "cloud-monitor", "WARNING: Could not find the next free ip-mgmt id for appliance ".$appliance_id.".", "", "", 0, 0, 0); - continue; - } else { - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "cloud-monitor", "SUCCESS: Found the next free ip-mgmt id ".$next_free_ip_mgmt_id." for appliance ".$appliance_id.".", "", "", 0, 0, 0); - $ip_mgmt_id = $next_free_ip_mgmt_id; - // here we have to update the cr with the new ip-mgmt-id - $new_cr_ip_mgmt_str = str_replace($nic_id.":".$orginal_ip_mgmt_id, $nic_id.":".$ip_mgmt_id, $cr->ip_mgmt); - $new_cr_ip_mgmt_fields=array(); - $new_cr_ip_mgmt_fields["cr_ip_mgmt"]=$new_cr_ip_mgmt_str; - $cr->update($cr->id, $new_cr_ip_mgmt_fields); - $cr->get_instance_by_id($cr->id); - } - } - - // here we have a valid ip-mgmt opbject to update - - - - $ip_mgmt_fields=array(); - - // get full network config - $ovs_ip_array = $ip_mgmt_assign->get_instance('id', $ip_mgmt_id); - $ovs_ip_mgmt_name = trim($ovs_ip_array['ip_mgmt_name']); - $ovs_ip_mgmt_address = trim($ovs_ip_array['ip_mgmt_address']); - $ovs_ip_mgmt_network = trim($ovs_ip_array['ip_mgmt_network']); - $ovs_ip_mgmt_subnet = trim($ovs_ip_array['ip_mgmt_subnet']); - $ovs_ip_mgmt_broadcast = trim($ovs_ip_array['ip_mgmt_broadcast']); - $ovs_ip_mgmt_dns1 = trim($ovs_ip_array['ip_mgmt_dns1']); - $ovs_ip_mgmt_dns2 = trim($ovs_ip_array['ip_mgmt_dns2']); - $ovs_ip_mgmt_domain = trim($ovs_ip_array['ip_mgmt_domain']); - $ovs_ip_mgmt_vlan_id = trim($ovs_ip_array['ip_mgmt_vlan_id']); - $ovs_ip_mgmt_bridge_name = trim($ovs_ip_array['ip_mgmt_bridge_name']); - $ovs_ip_mgmt_comment = trim($ovs_ip_array['ip_mgmt_comment']); - - // update ip-mgmt object with resource_id - $ip_mgmt_fields["ip_mgmt_resource_id"]=$vm_resource->id; - $ip_mgmt_fields["ip_mgmt_nic_id"]=$nic_id; - $ip_mgmt_assign->update_ip($ip_mgmt_id, $ip_mgmt_fields); - - // set resource_external_ip - if ($ip_mgmt_assign_loop == 0) { - $ip_mgmt_assign_arr = $ip_mgmt_assign->get_config_by_id($ip_mgmt_id_final); - $resource_external_ip = $ip_mgmt_assign_arr[0]['ip_mgmt_address']; - - $command = $OPENQRM_SERVER_BASE_DIR.'/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-manager remove_by_mac'; - $command .= ' -m '.$vm_resource_mac_array[$ip_mgmt_assign_loop]; - - $openqrm->send_command($command); - sleep(1); - // update vm resource objects main ip - $resource_fields['resource_ip'] = $ovs_ip_mgmt_address; - $resource_fields['resource_subnet'] = $ovs_ip_mgmt_subnet; - $resource_fields['resource_network'] = $ovs_ip_mgmt_network; - $resource_fields['resource_broadcast'] = $ovs_ip_mgmt_broadcast; - $vm_resource->update_info($vm_resource->id, $resource_fields); - - // build bridge param - first nic - $ovs_network_parameter .= " -z ".$ovs_ip_mgmt_bridge_name; - - } else { - // build bridge param - additional nics - $ovs_network_parameter .= " -z".$ip_mgmt_assign_loop." ".$ovs_ip_mgmt_bridge_name; - - - } - // assign to dhcpd - $command = $OPENQRM_SERVER_BASE_DIR.'/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-manager add'; - $command .= ' -d '.$vm_resource->id.$ip_mgmt_assign_loop; - $command .= ' -i '.$ovs_ip_mgmt_address; - $command .= ' -s '.$ovs_ip_mgmt_subnet; - $command .= ' -m '.$vm_resource_mac_array[$ip_mgmt_assign_loop]; - $openqrm->send_command($command); - - // assign to dns - $command = $OPENQRM_SERVER_BASE_DIR.'/openqrm/plugins/dns/bin/openqrm-dns-domain-manager add_host'; - $command .= ' -n '.$ovs_ip_mgmt_domain; - $command .= ' -i '.$ovs_ip_mgmt_address; - $command .= ' -q '.$name; - $openqrm->send_command($command); - - sleep(1); - $ip_mgmt_assign_loop++; - } - } - } - - } - // send command to create vm / regular bridges - $vm_create_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm-vm create"; - $vm_create_cmd .= " -n ".$name; - $vm_create_cmd .= " -y ".$vm_type; - $vm_create_cmd .= " -m ".$mac; - $vm_create_cmd .= " -r ".$memory; - $vm_create_cmd .= " -c ".$cpu; - $vm_create_cmd .= " -b local"; - $vm_create_cmd .= " ".$additional_nic_str; - $vm_create_cmd .= " ".$vncpassword_parameter; - $vm_create_cmd .= " -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password; - // for ovs we send the bridges from ip_mgmt - if (in_array("openvswitch-manager", $plugin->enabled())) { - $vm_create_cmd .= " ".$ovs_network_parameter; - } - - $event->log("create_kvm_vm_local", $_SERVER['REQUEST_TIME'], 5, "kvm-cloud-hook", "Running $vm_create_cmd", "", "", 0, 0, 0); - $host_resource->send_command($host_resource->ip, $vm_create_cmd); - - - - - -} - - - -// removes a vm -function remove_kvm_vm($host_resource_id, $name, $mac) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - global $RootDir; - - $host_resource = new resource(); - $host_resource->get_instance_by_id($host_resource_id); - // we need to have an openQRM server object too since some of the - // virtualization commands are sent from openQRM directly - $openqrm = new openqrm_server(); - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - - // be sure to remove first $mac from dhcpd - $dhcpd_remove_command = $OPENQRM_SERVER_BASE_DIR.'/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-manager remove_by_mac -m '.$mac; - $dhcpd_remove_command .= ' --openqrm-cmd-mode background'; - $openqrm->send_command($dhcpd_remove_command); - sleep(1); - - $plugin = new plugin(); - if (in_array("openvswitch-manager", $plugin->enabled())) { - - // OVS: check to remove all mac addresses from dhcpd - $command = $OPENQRM_SERVER_BASE_DIR.'/openqrm/plugins/kvm/bin/openqrm-kvm-vm post_vm_list'; - $command .= ' -u '.$openqrm_admin_user->name.' -p '.$openqrm_admin_user->password; - $command .= ' --openqrm-ui-user '.$openqrm_admin_user->name; - $command .= ' --openqrm-cmd-mode background'; - - $file = $OPENQRM_SERVER_BASE_DIR.'/openqrm/plugins/kvm/web/kvm-stat/'.$host_resource->id.'.vm_list'; - if(file_exists($file)) { - unlink($file); - } - $host_resource->send_command($host_resource->ip, $command); - while (!file_exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $lines = explode("\n", file_get_contents($file)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($name === $line[1]) { - // remove all nics by mac from dhcpd - if($line[7] !== '') { - $mac_str = $line[7]; - $all_mac_array = explode(',', $line[7]); - foreach ($all_mac_array as $addional_mac) { - if ($addional_mac == '') { - continue; - } - $dhcpd_remove_command = $OPENQRM_SERVER_BASE_DIR.'/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-manager remove_by_mac -m '.$addional_mac; - $dhcpd_remove_command .= ' --openqrm-cmd-mode background'; - $event->log("console", $_SERVER['REQUEST_TIME'], 5, "kvm-cloud-hook.php", 'Removing '.$addional_mac.' from dhcpd server.', "", "", 0, 0, 0); - $openqrm->send_command($dhcpd_remove_command); - sleep(1); - } - } - - } - } - } - } - - - // check ip-mgmt - $cc_conf = new cloudconfig(); - $show_ip_mgmt = $cc_conf->get_value(26); // ip-mgmt enabled ? - if (!strcmp($show_ip_mgmt, "true")) { - if (file_exists("$RootDir/plugins/ip-mgmt/.running")) { - require_once "$RootDir/plugins/ip-mgmt/class/ip-mgmt.class.php"; - - // remove all ips from dns - $ip_mgmt_deassign = new ip_mgmt(); - $vm_resource = new resource(); - $vm_resource->get_instance_by_mac($mac); - $kvm_ip_id_array = $ip_mgmt_deassign->get_ids_per_resource($vm_resource->id); - foreach($kvm_ip_id_array as $kvm_ip_id) { - - $ovs_ip_array = $ip_mgmt_deassign->get_instance('id', $kvm_ip_id); - $ovs_ip_mgmt_address = trim($ovs_ip_array['ip_mgmt_address']); - $ovs_ip_mgmt_domain = trim($ovs_ip_array['ip_mgmt_domain']); - - $dns_command = $OPENQRM_SERVER_BASE_DIR.'/openqrm/plugins/dns/bin/openqrm-dns-domain-manager remove_host'; - $dns_command .= ' -n '.$ovs_ip_mgmt_domain; - $dns_command .= ' -i '.$ovs_ip_mgmt_address; - $dns_command .= ' -q '.$vm_resource->vname; - $openqrm->send_command($dns_command); - - $ovs_update_array['ip_mgmt_resource_id'] = NULL; - $ip_mgmt_deassign->update_ip($kvm_ip_id, $ovs_update_array); - - } - } - } - sleep(1); - } - - // remove the vm from host - $event->log("remove_kvm_vm_local", $_SERVER['REQUEST_TIME'], 5, "kvm-cloud-hook", "Removing KVM VM $name/$mac from Host resource $host_resource_id", "", "", 0, 0, 0); - // we need to have an openQRM server object too since some of the - // virtualization commands are sent from openQRM directly - $openqrm = new openqrm_server(); - // send command to create the vm on the host - $vm_remove_cmd = "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-vm delete -n ".$name." --openqrm-cmd-mode background"; - $event->log("remove_kvm_vm_local", $_SERVER['REQUEST_TIME'], 5, "kvm-cloud-hook", "Running $vm_remove_cmd", "", "", 0, 0, 0); - $host_resource->send_command($host_resource->ip, $vm_remove_cmd); -} - - -// Cloud hook methods - -function create_kvm_vm_local($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, $vncpassword, $source_image_id, $size, $cu_id) { - global $event; - create_kvm_vm($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, "kvm-vm-local", $vncpassword, $source_image_id); -} - -function create_kvm_vm_net($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, $vncpassword, $source_image_id, $size, $cu_id) { - global $event; - create_kvm_vm($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, "kvm-vm-net", $vncpassword, $source_image_id); -} - -function remove_kvm_vm_local($host_resource_id, $name, $mac, $cu_id) { - global $event; - remove_kvm_vm($host_resource_id, $name, $mac); -} - -function remove_kvm_vm_net($host_resource_id, $name, $mac, $cu_id) { - global $event; - remove_kvm_vm($host_resource_id, $name, $mac); -} - - - - -// --------------------------------------------------------------------------------- - -/* -$host_resource_id = 0; -$name = "kvmovscloudtest"; -$mac="2c:76:8a:e5:a5:10"; -$memory=512; -$cpu=1; -$swap=0; -$additional_nic_str = " -m1 2c:76:8a:e5:a5:11 -m2 2c:76:8a:e5:a5:12 "; -$vm_type = "kvm-vm-local"; -$vncpassword = "openqrm"; -$source_image_id = "14998967150366"; - -echo "running create_kvm_vm
    "; - -create_kvm_vm($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, $vm_type, $vncpassword, $source_image_id); -*/ - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-cloud-product-hook.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-cloud-product-hook.php deleted file mode 100644 index 3033f1f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-cloud-product-hook.php +++ /dev/null @@ -1,132 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $IMAGE_AUTHENTICATION_TABLE; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - - -function openqrm_kvm_cloud_product($cmd, $cloud_hook_config) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RootDir; - - $openqrm_server = new openqrm_server(); - - $event->log("openqrm_kvm_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-cloud-product-hook.php", "Handling ".$cmd." event", "", "", 0, 0, 0); - switch($cmd) { - case "add": - $event->log("openqrm_kvm_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-cloud-product-hook.php", "Handling cloud-product ".$cmd." event", "", "", 0, 0, 0); - // create resource products - $db=openqrm_get_db_connection(); - $image = new image(); - $checked_virtualization_plugins = array(); - $virtualization = new virtualization(); - $virtualization_id_ar = $virtualization->get_list(); - unset($virtualization_id_ar[0]); - foreach ($virtualization_id_ar as $key => $value) { - $next_sort_id = 0; - $id = $value['value']; - $virtualization->get_instance_by_id($id); - $pos = strpos($virtualization->type, 'kvm-vm-'); - if ($pos !== false) { - $event->log("openqrm_kvm_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-cloud-product-hook.php", "Adding ".$virtualization->type." as cloud-product", "", "", 0, 0, 0); - $cloud_product_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $create_resource_cloudselector_config = "insert into cloud_selector (id, type, sort_id, quantity, price, name, description, state) VALUES (".$cloud_product_id.", 'resource', ".$next_sort_id.", '".$virtualization->id."', 1, '".$virtualization->type."', '".$virtualization->name."', 1);"; - $recordSet = $db->Execute($create_resource_cloudselector_config); - $next_sort_id++; - - // add all existing images for this virtualization type to private images - $virtualization_plugin_name = $virtualization->get_plugin_name(); - if (!in_array($virtualization_plugin_name, $checked_virtualization_plugins)) { - $checked_virtualization_plugins[] = $virtualization_plugin_name; - $deployment = new deployment(); - $deployment_id_ar = $deployment->get_id_by_storagetype($virtualization_plugin_name); - foreach ($deployment_id_ar as $key => $value) { - $did = $value['value']; - $deployment->get_instance_by_id($did); - $image_id_deployment_ar = $image->get_ids_by_type($deployment->type); - foreach ($image_id_deployment_ar as $iid_ar) { - // add to private images - $image_id = $iid_ar['image_id']; - $event->log("openqrm_kvm_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-cloud-product-hook.php", "Adding Image ".$image_id." as private image", "", "", 0, 0, 0); - $cloud_pr_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $create_private_image_config = "insert into cloud_private_image (co_id, co_image_id, co_cu_id, co_clone_on_deploy, co_state) VALUES (".$cloud_pr_id.", ".$image_id.", 0, 1, 1);"; - $recordSet = $db->Execute($create_private_image_config); - } - } - } - } - } - // add host to admin resource pool - $admin_project_id = $cloud_hook_config['cloud_admin_procect']; - $virtualization->get_instance_by_type('kvm'); - $appliance = new appliance(); - $appliance_id_ar = $appliance->get_ids_per_virtualization($virtualization->id); - foreach ($appliance_id_ar as $key => $value) { - $appliance_id = $value['appliance_id']; - $appliance->get_instance_by_id($appliance_id); - $cloud_respool_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $create_default_resource_pool_config = "insert into cloud_respool(rp_id, rp_resource_id, rp_cg_id) values (".$cloud_respool_id.", ".$appliance->resources.", ".$admin_project_id.");"; - $recordSet = $db->Execute($create_default_resource_pool_config); - } - - break; - case "remove": - $cloud_product_class = $RootDir."/plugins/cloud/class/cloudselector.class.php"; - if (file_exists($cloud_product_class)) { - require_once $cloud_product_class; - $cloud_selector = new cloudselector(); - $virtualization = new virtualization(); - - $virtualization->get_instance_by_type('kvm-vm-local'); - $event->log("openqrm_kvm_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-cloud-product-hook.php", "Removing resource type ".$virtualization->type." from cloud-products", "", "", 0, 0, 0); - $cloud_selector->remove_by_quantity($virtualization->id); - - $virtualization->get_instance_by_type('kvm-vm-net'); - $event->log("openqrm_kvm_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-cloud-product-hook.php", "Removing resource type ".$virtualization->type." from cloud-products", "", "", 0, 0, 0); - $cloud_selector->remove_by_quantity($virtualization->id); - - } - break; - } -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-gluster-deployment-auth-hook.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-gluster-deployment-auth-hook.php deleted file mode 100644 index 2b5e513..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-gluster-deployment-auth-hook.php +++ /dev/null @@ -1,191 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/image_authentication.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; - -/** - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - */ - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $IMAGE_AUTHENTICATION_TABLE; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - - - //-------------------------------------------------- - /** - * authenticates the storage volume for the appliance resource - * - * storage_auth_function("start", 2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_function($cmd, $appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $IMAGE_AUTHENTICATION_TABLE; - global $openqrm_server; - global $RootDir; - - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $resource_mac=$resource->mac; - $resource_ip=$resource->ip; - - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($resource->vhostid); - - switch($cmd) { - case "start": - // authenticate the rootfs / needs openqrm user + pass - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - // generate a password for the image - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-auth-hook.php", "Authenticating ".$image_name." / ".$image_rootdevice." to resource ".$resource_mac.".", "", "", 0, 0, $appliance_id); - $auth_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -n ".$image_name." -r ".$image_rootdevice." -i ".$image_name." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." -t ".$deployment->type." --openqrm-cmd-mode background"; - $resource->send_command($storage_resource->ip, $auth_start_cmd); - break; - } - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage volume for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage deployment volumes for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_deployment_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_deployment_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - - } - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-gluster-deployment-cloud-hook.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-gluster-deployment-cloud-hook.php deleted file mode 100644 index 7070b6a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-gluster-deployment-cloud-hook.php +++ /dev/null @@ -1,277 +0,0 @@ - -*/ - - -// This file implements the cloud storage methods - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -// special cloud classes -require_once "$RootDir/plugins/cloud/class/cloudimage.class.php"; - -$event = new event(); -global $event; - -global $OPENQRM_SERVER_BASE_DIR; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $RESOURCE_INFO_TABLE; - - -// --------------------------------------------------------------------------------- -// general cloudstorage methods -// --------------------------------------------------------------------------------- - - -// clones the volume of an image -function create_clone_kvm_gluster_deployment($cloud_image_id, $image_clone_name, $disk_size) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - // we got the cloudimage id here, get the image out of it - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("create_clone_kvm_gluster_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-gluster-deployment-cloud-hook.php", "Creating clone ".$image_clone_name." of image ".$cloudimage->image_id." on the storage", "", "", 0, 0, 0); - // get image, this is already the new logical clone - // we just need to physical snapshot it and update the rootdevice - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // kvm-gluster-deployment - $image->get_instance_by_id($image_id); - $gluster_uri_arr = parse_url($image_rootdevice); - // origin image volume name - $origin_volume_name=basename($gluster_uri_arr['path']); - // location of the volume (path) - $image_location_name=str_replace('/', '', dirname($gluster_uri_arr['path'])); - // set default snapshot size - if (!strlen($disk_size)) { - $disk_size=5000; - } - // update the image rootdevice parameter - $ar_image_update = array( - 'image_rootdevice' => "gluster:".$resource->ip."//".$image_location_name."/".$image_clone_name, - ); - // get the vm resource - $vm_resource = new resource(); - $vm_resource->get_instance_by_id($cloudimage->resource_id); - // get the VM host - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($vm_resource->vhostid); - - $event->log("create_clone_kvm_gluster_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-gluster-deployment-cloud-hook.php", "Updating rootdevice of image ".$image_id." / ".$image_name." with ".$image_location_name."/".$image_clone_name, "", "", 0, 0, 0); - $image->update($image_id, $ar_image_update); - $image_clone_cmd="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm snap -n ".$origin_volume_name." -v ".$image_location_name." -s ".$image_clone_name." -m ".$disk_size." -t ".$deployment->type." --openqrm-cmd-mode background"; - $event->log("create_clone_kvm_gluster_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-gluster-deployment-cloud-hook.php", "Running : ".$image_clone_cmd, "", "", 0, 0, 0); - $resource->send_command($resource->ip, $image_clone_cmd); -} - - - -// removes the volume of an image -function remove_kvm_gluster_deployment($cloud_image_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("remove_kvm_gluster_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-gluster-deployment-cloud-hook.php", "Removing image ".$cloudimage->image_id." from storage.", "", "", 0, 0, 0); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - $gluster_uri_arr = parse_url($image_rootdevice); - // origin image volume name - $origin_volume_name=basename($gluster_uri_arr['path']); - // location of the volume (path) - $image_location_name=str_replace('/', '', dirname($gluster_uri_arr['path'])); - $image_remove_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm remove -n ".$origin_volume_name." -v ".$image_location_name." -t ".$deployment->type." --openqrm-cmd-mode background"; - $event->log("remove_kvm_gluster_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-gluster-deployment-cloud-hook.php", "Running : ".$image_remove_clone_cmd, "", "", 0, 0, 0); - $resource->send_command($resource->ip, $image_remove_clone_cmd); -} - - -// resizes the volume of an image -function resize_kvm_gluster_deployment($cloud_image_id, $resize_value) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("resize_kvm_gluster_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-gluster-deployment-cloud-hook.php", "Resize image ".$cloudimage->image_id." on storage.", "", "", 0, 0, 0); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - $gluster_uri_arr = parse_url($image_rootdevice); - // origin image volume name - $origin_volume_name=basename($gluster_uri_arr['path']); - // location of the volume (path) - $image_location_name=str_replace('/', '', dirname($gluster_uri_arr['path'])); - $image_resize_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm resize -n ".$origin_volume_name." -v ".$image_location_name." -m ".$resize_value." -t ".$deployment->type." --openqrm-cmd-mode background"; - $event->log("resize_kvm_gluster_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-gluster-deployment-cloud-hook.php", "Running : ".$image_resize_cmd, "", "", 0, 0, 0); - $resource->send_command($resource->ip, $image_resize_cmd); -} - - - -// creates a private copy of the volume of an image -function create_private_kvm_gluster_deployment($cloud_image_id, $private_disk, $private_image_name) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("create_private_kvm_gluster_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-gluster-deployment-cloud-hook.php", "Creating private image ".$cloudimage->image_id." on storage.", "", "", 0, 0, 0); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // create an admin user to post when cloning has finished - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - $gluster_uri_arr = parse_url($image_rootdevice); - // origin image volume name - $origin_volume_name=basename($gluster_uri_arr['path']); - // location of the volume (path) - $image_location_name=str_replace('/', '', dirname($gluster_uri_arr['path'])); - $image_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm clone -n ".$origin_volume_name." -s ".$private_image_name." -v ".$image_location_name." -m ".$private_disk." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." -t ".$deployment->type." --openqrm-cmd-mode background"; - $event->log("create_private_kvm_gluster_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-gluster-deployment-cloud-hook.php", "Running : $image_resize_cmd", "", "", 0, 0, 0); - $resource->send_command($resource->ip, $image_clone_cmd); - // set the storage specific image root_device parameter - $new_rootdevice = "gluster:".$resource->ip."//".$image_location_name."/".$private_image_name; - return $new_rootdevice; -} - - - -// --------------------------------------------------------------------------------- - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-ha-cmd-hook.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-ha-cmd-hook.php deleted file mode 100644 index 4105467..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-ha-cmd-hook.php +++ /dev/null @@ -1,112 +0,0 @@ - -*/ - - -// This file implements the virtual machine abstraction in the cloud of openQRM - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; - -$event = new event(); -global $event; - -global $OPENQRM_SERVER_BASE_DIR; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $RESOURCE_INFO_TABLE; - -// --------------------------------------------------------------------------------- -// general kvm cloudvm methods -// --------------------------------------------------------------------------------- - - -// creates a vm -function create_ha_kvm_vm($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, $vm_type) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("create_kvm_vm", $_SERVER['REQUEST_TIME'], 5, "kvm-ha-hook", "Creating KVM VM $name on Host resource $host_resource_id", "", "", 0, 0, 0); - // start the vm on the host - $host_resource = new resource(); - $host_resource->get_instance_by_id($host_resource_id); - // we need to have an openQRM server object too since some of the - // virtualization commands are sent from openQRM directly - $openqrm = new openqrm_server(); - // send command to create vm - $vm_create_cmd = "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-vm create -n ".$name." -y ".$vm_type." -m ".$mac." -r ".$memory." -c ".$cpu." -b local ".$additional_nic_str; - $host_resource->send_command($host_resource->ip, $vm_create_cmd); - $event->log("create_kvm_vm", $_SERVER['REQUEST_TIME'], 5, "kvm-ha-hook", "Running $vm_create_cmd", "", "", 0, 0, 0); -} - - - -// fences a vm -function fence_ha_kvm_vm($host_resource_id, $mac) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - // fences the vm on its host - $host_resource = new resource(); - $host_resource->get_instance_by_id($host_resource_id); - $event->log("fence_kvm_vm", $_SERVER['REQUEST_TIME'], 5, "kvm-ha-hook", "Fencing KVM VM $mac from Host resource $host_resource_id", "", "", 0, 0, 0); - // we need to have an openQRM server object too since some of the - // virtualization commands are sent from openQRM directly - $openqrm = new openqrm_server(); - // send command to fence the vm on the host - $vm_fence_cmd = "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-vm fence -m ".$mac." --openqrm-cmd-mode background"; - $event->log("fence_kvm_vm", $_SERVER['REQUEST_TIME'], 5, "kvm-ha-hook", "Running $vm_fence_cmd", "", "", 0, 0, 0); - $host_resource->send_command($host_resource->ip, $vm_fence_cmd); -} - - -// HA hook methods - -function create_kvm_vm_local($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, $origin_resource_id) { - global $event; - create_ha_kvm_vm($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, "kvm-vm-local"); -} - -function create_kvm_vm_net($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, $origin_resource_id) { - global $event; - create_ha_kvm_vm($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, "kvm-vm-net"); -} - -function fence_kvm_vm_local($host_resource_id, $mac) { - global $event; - fence_ha_kvm_vm($host_resource_id, $mac); -} - -function fence_kvm_vm_net($host_resource_id, $mac) { - global $event; - fence_ha_kvm_vm($host_resource_id, $mac); -} - - -// --------------------------------------------------------------------------------- - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-lvm-deployment-auth-hook.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-lvm-deployment-auth-hook.php deleted file mode 100644 index 8259f51..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-lvm-deployment-auth-hook.php +++ /dev/null @@ -1,201 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/image_authentication.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; - -/** - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - */ - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $IMAGE_AUTHENTICATION_TABLE; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - - - //-------------------------------------------------- - /** - * authenticates the storage volume for the appliance resource - * - * storage_auth_function("start", 2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_function($cmd, $appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $IMAGE_AUTHENTICATION_TABLE; - global $openqrm_server; - global $RootDir; - - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $resource_mac=$resource->mac; - $resource_ip=$resource->ip; - - // For kvm vms we assume that the image is located on the vm-host - // so we send the auth command to the vm-host instead of the image storage. - // This enables using a SAN backend with dedicated volumes per vm-host which all - // contain all "golden-images" which are used for snapshotting. - // We do this to overcome the current lvm limitation of not supporting cluster-wide snapshots - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($resource->vhostid); - if ($vm_host_resource->id != $storage_resource->id) { - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-auth-hook.php", "Appliance ".$appliance_id." image IS NOT available on this kvm host, ".$storage_resource->id." not equal ".$vm_host_resource->id." !! Assuming SAN Backend", "", "", 0, 0, $appliance_id); - } else { - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-auth-hook.php", "Appliance ".$appliance_id." image IS available on this kvm host, ".$storage_resource->id." equal ".$vm_host_resource->id.".", "", "", 0, 0, $appliance_id); - } - - switch($cmd) { - case "start": - // authenticate the rootfs / needs openqrm user + pass - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - // generate a password for the image - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-auth-hook.php", "Authenticating ".$image_name." / ".$image_rootdevice." to resource ".$resource_mac.".", "", "", 0, 0, $appliance_id); - $auth_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -n ".$image_name." -r ".$image_rootdevice." -i ".$image_name." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." -t ".$deployment->type." --openqrm-cmd-mode background"; - $resource->send_command($vm_host_resource->ip, $auth_start_cmd); - break; - } - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage volume for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage deployment volumes for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_deployment_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_deployment_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - - } - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-lvm-deployment-cloud-hook.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-lvm-deployment-cloud-hook.php deleted file mode 100644 index aef198b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-lvm-deployment-cloud-hook.php +++ /dev/null @@ -1,417 +0,0 @@ - -*/ - - -// This file implements the cloud storage methods - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once $RootDir."/include/user.inc.php"; -require_once $RootDir."/include/openqrm-database-functions.php"; -require_once $RootDir."/class/resource.class.php"; -require_once $RootDir."/class/image.class.php"; -require_once $RootDir."/class/storage.class.php"; -require_once $RootDir."/class/deployment.class.php"; -require_once $RootDir."/class/appliance.class.php"; -require_once $RootDir."/class/openqrm_server.class.php"; -require_once $RootDir."/class/plugin.class.php"; -require_once $RootDir."/class/event.class.php"; -// special cloud classes -require_once "$RootDir/plugins/cloud/class/cloudimage.class.php"; - -$event = new event(); -global $event; - -global $OPENQRM_SERVER_BASE_DIR; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $RESOURCE_INFO_TABLE; - - -$kvm_plugin_config = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf"; -$store = openqrm_parse_conf($kvm_plugin_config); -$kvm_plugin_cloud_create_volume_action = "snap"; -if (isset($store['OPENQRM_PLUGIN_KVM_CLOUD_CREATE_VOLUME_ACTION'])) { - if ($store['OPENQRM_PLUGIN_KVM_CLOUD_CREATE_VOLUME_ACTION'] == 'clone') { - $kvm_plugin_cloud_create_volume_action = "clone"; - } -} - - -// --------------------------------------------------------------------------------- -// general cloudstorage methods -// --------------------------------------------------------------------------------- - - -// clones the volume of an image -function create_clone_kvm_lvm_deployment($cloud_image_id, $image_clone_name, $disk_size) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - // clone or snap cloud action - $kvm_plugin_config = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/etc/openqrm-plugin-kvm.conf"; - $store = openqrm_parse_conf($kvm_plugin_config); - $kvm_plugin_cloud_create_volume_action = "snap"; - if (isset($store['OPENQRM_PLUGIN_KVM_CLOUD_CREATE_VOLUME_ACTION'])) { - if ($store['OPENQRM_PLUGIN_KVM_CLOUD_CREATE_VOLUME_ACTION'] == 'clone') { - $kvm_plugin_cloud_create_volume_action = "clone"; - } - } - - // we got the cloudimage id here, get the image out of it - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("create_clone_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Creating clone ".$image_clone_name." of image ".$cloudimage->image_id." on the storage", "", "", 0, 0, 0); - // get image, this is already the new logical clone - // we just need to physical snapshot it and update the rootdevice - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // kvm-lvm-deployment - $image->get_instance_by_id($image_id); - // parse the volume group info in the identifier - $volume_group_location=dirname($image_rootdevice); - $volume_group=basename($volume_group_location); - $image_location_name=basename($image_rootdevice); - // set default snapshot size - if (!strlen($disk_size)) { - $disk_size=5000; - } - // update the image rootdevice parameter - $ar_image_update = array( - 'image_rootdevice' => "/dev/".$volume_group."/".$image_clone_name, - ); - - // For kvm vms we assume that the image is located on the vm-host - // so we send the auth command to the vm-host instead of the image storage. - // This enables using a SAN backend with dedicated volumes per vm-host which all - // contain all "golden-images" which are used for snapshotting. - // We do this to overcome the current lvm limitation of not supporting cluster-wide snapshots - // get the vm resource - $vm_resource = new resource(); - $vm_resource->get_instance_by_id($cloudimage->resource_id); - // get the lxc host - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($vm_resource->vhostid); - // san backend ? - if ($vm_host_resource->id != $resource->id) { - $event->log("create_clone_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Image ".$image_id." IS NOT available on this kvm host, ".$resource->id." not equal ".$vm_host_resource->id." !! Assuming SAN Backend", "", "", 0, 0, 0); - - // update the image storage id with the vm-host-resource - $image_deployment = new deployment(); - $image_deployment->get_instance_by_type($image_type); - // loop over all storage id from type $image_type - $found_image=0; - $storage_list_by_type = new storage(); - $storage_id_list_by_type = $storage_list_by_type->get_ids_by_storage_type($image_deployment->id); - foreach($storage_id_list_by_type as $storage_id_list) { - $storage_id = $storage_id_list['storage_id']; - $tstorage = new storage(); - $tstorage->get_instance_by_id($storage_id); - if ($tstorage->resource_id == $vm_host_resource->id) { - // re-create update array + new storage id - $ar_image_update = array( - 'image_rootdevice' => "/dev/".$volume_group."/".$image_clone_name, - 'image_storageid' => $tstorage->id, - ); - $event->log("create_clone_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Updating Image ".$image_id." / ".$image_name." with storage id ".$tstorage->id.".", "", "", 0, 0, 0); - $found_image=1; - break; - } - } - if ($found_image == 0) { - $event->log("create_clone_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 2, "openqrm-kvm-lvm-deployment-cloud-hook.php", "SETUP ERROR: Could not find a storage server type ".$image_type." using resource ".$vm_host_resource->id.". Please create one!", "", "", 0, 0, 0); - $event->log("create_clone_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 2, "openqrm-kvm-lvm-deployment-cloud-hook.php", "SETUP ERROR: Not cloning image ".$image_id.".", "", "", 0, 0, 0); - return; - } - - } else { - $event->log("create_clone_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Image ".$image_id." IS available on this kvm host, ".$resource->id." equal ".$vm_host_resource->id.".", "", "", 0, 0, 0); - } - - $event->log("create_clone_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Updating rootdevice of image ".$image_id." / ".$image_name." with /dev/".$volume_group."/".$image_clone_name, "", "", 0, 0, 0); - $image->update($image_id, $ar_image_update); - $image_clone_cmd="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm ".$kvm_plugin_cloud_create_volume_action." -n ".$image_location_name." -v ".$volume_group." -s ".$image_clone_name." -m ".$disk_size." -t ".$deployment->type." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $event->log("create_clone_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Running : ".$image_clone_cmd, "", "", 0, 0, 0); - $resource->send_command($vm_host_resource->ip, $image_clone_cmd); -} - - - -// removes the volume of an image -function remove_kvm_lvm_deployment($cloud_image_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("remove_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Removing image ".$cloudimage->image_id." from storage.", "", "", 0, 0, 0); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // parse the volume group info in the identifier - $volume_group_location=dirname($image_rootdevice); - $volume_group=basename($volume_group_location); - $image_location_name=basename($image_rootdevice); - - // For kvm vms we assume that the image is located on the vm-host - // so we send the auth command to the vm-host instead of the image storage. - // This enables using a SAN backend with dedicated volumes per vm-host which all - // contain all "golden-images" which are used for snapshotting. - // We do this to overcome the current lvm limitation of not supporting cluster-wide snapshots - // - // Still we need to send the remove command to the storage resource since the - // create-phase automatically adapted the image->storageid, we cannot use the vm-resource here - // because cloudimage->resource_id will be set to -1 when the cloudapp is in paused/resize/private state - // - if ($cloudimage->resource_id > 0) { - // try to get the vm resource - $vm_resource = new resource(); - $vm_resource->get_instance_by_id($cloudimage->resource_id); - // get the lxc host - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($vm_resource->vhostid); - // san backend ? - if ($vm_host_resource->id != $resource->id) { - $event->log("remove_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Image ".$image_id." IS NOT available on this kvm host, ".$resource->id." not equal ".$vm_host_resource->id." !! Assuming SAN Backend", "", "", 0, 0, 0); - } else { - $event->log("remove_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Image ".$image_id." IS available on this kvm host, ".$resource->id." equal ".$vm_host_resource->id.".", "", "", 0, 0, 0); - } - } - $image_remove_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm remove -n ".$image_location_name." -v ".$volume_group." -t ".$deployment->type." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $event->log("remove_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Running : ".$image_remove_clone_cmd, "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_remove_clone_cmd); -} - - -// resizes the volume of an image -function resize_kvm_lvm_deployment($cloud_image_id, $resize_value) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("resize_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Resize image ".$cloudimage->image_id." on storage.", "", "", 0, 0, 0); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // parse the volume group info in the identifier - $volume_group_location=dirname($image_rootdevice); - $volume_group=basename($volume_group_location); - $image_location_name=basename($image_rootdevice); - - // For kvm vms we assume that the image is located on the vm-host - // so we send the auth command to the vm-host instead of the image storage. - // This enables using a SAN backend with dedicated volumes per vm-host which all - // contain all "golden-images" which are used for snapshotting. - // We do this to overcome the current lvm limitation of not supporting cluster-wide snapshots - // - // Still we need to send the remove command to the storage resource since the - // create-phase automatically adapted the image->storageid, we cannot use the vm-resource here - // because cloudimage->resource_id will be set to -1 when the cloudapp is in paused/resize/private state - // - if ($cloudimage->resource_id > 0) { - // try to get the vm resource - $vm_resource = new resource(); - $vm_resource->get_instance_by_id($cloudimage->resource_id); - // get the lxc host - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($vm_resource->vhostid); - // san backend ? - if ($vm_host_resource->id != $resource->id) { - $event->log("resize_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Image ".$image_id." IS NOT available on this kvm host, ".$resource->id." not equal ".$vm_host_resource->id." !! Assuming SAN Backend", "", "", 0, 0, 0); - } else { - $event->log("resize_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Image ".$image_id." IS available on this kvm host, ".$resource->id." equal ".$vm_host_resource->id, "", "", 0, 0, 0); - } - } - - $image_resize_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm resize -n ".$image_location_name." -v ".$volume_group." -m ".$resize_value." -t ".$deployment->type." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $event->log("resize_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Running : ".$image_resize_cmd, "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_resize_cmd); -} - - - -// creates a private copy of the volume of an image -function create_private_kvm_lvm_deployment($cloud_image_id, $private_disk, $private_image_name) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - $event->log("create_private_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Creating private image ".$cloudimage->image_id." on storage.", "", "", 0, 0, 0); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $imageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($imageid); - $storage_resource_id = $storage->resource_id; - // get deployment type - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // create an admin user to post when cloning has finished - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - // parse the volume group info in the identifier - $volume_group_location=dirname($image_rootdevice); - $volume_group=basename($volume_group_location); - $image_location_name=basename($image_rootdevice); - - // For kvm vms we assume that the image is located on the vm-host - // so we send the auth command to the vm-host instead of the image storage. - // This enables using a SAN backend with dedicated volumes per vm-host which all - // contain all "golden-images" which are used for snapshotting. - // We do this to overcome the current lvm limitation of not supporting cluster-wide snapshots - // - // Still we need to send the remove command to the storage resource since the - // create-phase automatically adapted the image->storageid, we cannot use the vm-resource here - // because cloudimage->resource_id will be set to -1 when the cloudapp is in paused/resize/private state - // - if ($cloudimage->resource_id > 0) { - // try to get the vm resource - $vm_resource = new resource(); - $vm_resource->get_instance_by_id($cloudimage->resource_id); - // get the lxc host - $vm_host_resource = new resource(); - $vm_host_resource->get_instance_by_id($vm_resource->vhostid); - // san backend ? - if ($vm_host_resource->id != $resource->id) { - $event->log("create_private_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Image ".$image_id." IS NOT available on this kvm host, ".$resource->id." not equal ".$vm_host_resource->id." !! Assuming SAN Backend", "", "", 0, 0, 0); - } else { - $event->log("create_private_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Image ".$image_id." IS available on this kvm host, ".$resource->id." equal ".$vm_host_resource->id.".", "", "", 0, 0, 0); - } - } - - $image_resize_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/kvm/bin/openqrm-kvm clone -n ".$image_location_name." -s ".$private_image_name." -v ".$volume_group." -m ".$private_disk." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." -t ".$deployment->type." --openqrm-cmd-mode background"; - $event->log("create_private_kvm_lvm_deployment", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-lvm-deployment-cloud-hook.php", "Running : $image_resize_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_resize_cmd); - // set the storage specific image root_device parameter - $new_rootdevice = str_replace($image_location_name, $private_image_name, $image->rootdevice); - return $new_rootdevice; -} - - - -// --------------------------------------------------------------------------------- - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-resource-virtual-command-hook.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-resource-virtual-command-hook.php deleted file mode 100644 index 1d93b4d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/openqrm-kvm-resource-virtual-command-hook.php +++ /dev/null @@ -1,102 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $OPENQRM_SERVER_IP_ADDRESS; -$event = new event(); -global $event; - - - -function openqrm_kvm_resource_virtual_command($cmd, $resource_fields) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $resource_id = $resource_fields["resource_id"]; - $resource = new resource(); - $resource->get_instance_by_id($resource_id); - $host_resource = new resource(); - $host_resource->get_instance_by_id($resource->vhostid); - $virtualization = new virtualization(); - $virtualization->get_instance_by_id($resource->vtype); - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - switch($cmd) { - case "reboot": - $event->log("openqrm_kvm_resource_virtual_command", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-resource-virtual-command-hook.php", "Handling $cmd command", "", "", 0, 0, 0); - if ($virtualization->type == "kvm-vm-local") { - $virtual_command = "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-vm restart_by_mac -m ".$resource->mac." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." -d noop --openqrm-cmd-mode background"; - $host_resource->send_command($host_resource->ip, $virtual_command); - } - if($virtualization->type == "kvm-vm-net") { - // simply add to cmd queue. do not use resource->send_command(ip, reboot) since this will re-trigger this hook - $cmd_token = md5(uniqid(rand(), true)); - $resource_command = $OPENQRM_SERVER_BASE_DIR."/openqrm/sbin/openqrm-exec -i ".$resource->ip." -t ".$cmd_token." -c reboot"; - shell_exec($resource_command); - } - if($virtualization->type == "kvm") { - $cmd_token = md5(uniqid(rand(), true)); - $resource_command = $OPENQRM_SERVER_BASE_DIR."/openqrm/sbin/openqrm-exec -i ".$resource->ip." -t ".$cmd_token." -c reboot"; - shell_exec($resource_command); - } - $resource_reboot_fields=array(); - $resource_reboot_fields["resource_state"]="transition"; - $resource_reboot_fields["resource_event"]="reboot"; - $resource->update_info($resource->id, $resource_reboot_fields); - - break; - case "halt": - $event->log("openqrm_kvm_resource_virtual_command", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-resource-virtual-command-hook.php", "Handling $cmd command", "", "", 0, 0, 0); - if ($virtualization->type == "kvm-vm-local") { - $virtual_command = "$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/kvm/bin/openqrm-kvm-vm stop_by_mac -m ".$resource->mac." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $host_resource->send_command($host_resource->ip, $virtual_command); - } - if($virtualization->type == "kvm-vm-net") { - // simply add to cmd queue. do not use resource->send_command(ip, reboot) since this will re-trigger this hook - $cmd_token = md5(uniqid(rand(), true)); - $resource_command = $OPENQRM_SERVER_BASE_DIR."/openqrm/sbin/openqrm-exec -i ".$resource->ip." -t ".$cmd_token." -c halt"; - shell_exec($resource_command); - } - if($virtualization->type == "kvm") { - // simply add to cmd queue. do not use resource->send_command(ip, reboot) since this will re-trigger this hook - $cmd_token = md5(uniqid(rand(), true)); - $resource_command = $OPENQRM_SERVER_BASE_DIR."/openqrm/sbin/openqrm-exec -i ".$resource->ip." -t ".$cmd_token." -c halt"; - shell_exec($resource_command); - } - $resource_reboot_fields=array(); - $resource_reboot_fields["resource_state"]="off"; - $resource_reboot_fields["resource_event"]="reboot"; - $resource->update_info($resource->id, $resource_reboot_fields); - break; - } -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-bootservice.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-bootservice.tpl.php deleted file mode 100644 index ec1111b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-bootservice.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    - -
    -
    -

    {boot_service_title}

    - {boot_service_content} -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-documentation.tpl.php deleted file mode 100644 index 9ebab02..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-documentation.tpl.php +++ /dev/null @@ -1,47 +0,0 @@ - -

    {label}

    - -
    -
    -

    {introduction_title}

    - {introduction_content} - -

    {provides_title}

    - {provides_list} - -

    {requirements_title}

    - {requirements_list} - - -
    -
    -

    {type_title}

    - {type_content} - -

    {deployment_title}

    - {deployment_content} - -

    {tested_title}

    - {tested_content} - -
    -
    - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-storage.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-storage.tpl.php deleted file mode 100644 index adfa499..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-storage.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    - -
    -
    -

    {storage_mgmt_title}

    - {storage_mgmt_list} -
    -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-usage.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-usage.tpl.php deleted file mode 100644 index 443941c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-usage.tpl.php +++ /dev/null @@ -1,20 +0,0 @@ - -

    {label}

    - -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-vms.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-vms.tpl.php deleted file mode 100644 index fa18fbb..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-about-vms.tpl.php +++ /dev/null @@ -1,26 +0,0 @@ - -

    {label}

    - -
    -
    -

    {vm_mgmt_title}

    - {vm_mgmt_list} -
    -
    - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-add.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-add.tpl.php deleted file mode 100644 index 1eb0d04..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-add.tpl.php +++ /dev/null @@ -1,26 +0,0 @@ - -

    {label}

    -
    -
    - {form} - {name} - {type} - {size} -
    {submit} {cancel}
    -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-clone.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-clone.tpl.php deleted file mode 100644 index 760ecb2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-clone.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    -
    -
    - {form} - {name} - -
    {submit} {cancel}
    -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-edit.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-edit.tpl.php deleted file mode 100644 index 12e455a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-edit.tpl.php +++ /dev/null @@ -1,32 +0,0 @@ - -

    {label}

    - -
    -
    -
    {lang_id}: {id}
    -
    {lang_name}: {name}
    -
    {lang_resource}: {resource}
    -
    {lang_deployment}: {deployment}
    -
    {lang_state}: {state}
    -
    -
    -
    {add}
    -
    -
     
    - {table} -
    diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-remove.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-remove.tpl.php deleted file mode 100644 index e9a43c0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-remove.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    - -
    -
    - {form} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-resize.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-resize.tpl.php deleted file mode 100644 index c34a7cb..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-resize.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    - -
    -
    - {form} - {size} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-select.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-select.tpl.php deleted file mode 100644 index bd68de0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-select.tpl.php +++ /dev/null @@ -1,18 +0,0 @@ - -

    {label}

    -{table} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-snap.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-snap.tpl.php deleted file mode 100644 index 897ed78..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-snap.tpl.php +++ /dev/null @@ -1,27 +0,0 @@ - -

    {label}

    - -
    -
    - {form} - {name} - {size} -
    {submit} {cancel}
    -
    -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-add.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-add.tpl.php deleted file mode 100644 index 436d31a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-add.tpl.php +++ /dev/null @@ -1,275 +0,0 @@ - - - - - -

    {label}

    - -
    -
    - {form} - -
    - {lang_basic} -
    - {name} -
    -
    - -
    - {lang_hardware} -
    - {cpus} - {memory} -
    -
    - -
    - {lang_virtual_disk} -
    -
    - {localboot_image} - {netboot_image} - {disk_interface} -
    -
    - {add_vm_image} -
    -
     
    - {cdrom_iso_path} - {cdrom_button} -
     
    -
    -
    - - -
    - {lang_net} -
    -
    -
    {net0}
    -
    - {mac} - {bridge} - {nic} - {ovs_ip0} -
    -
    - -
    -
    {net1}
    -
    - {mac1} - {bridge1} - {nic1} - {ovs_ip1} -
    -
    - - -
    -
    {net2}
    -
    - {mac2} - {bridge2} - {nic2} - {ovs_ip2} -
    -
    - - -
    -
    {net3}
    -
    - {mac3} - {bridge3} - {nic3} - {ovs_ip3} -
    -
    - - -
    -
    {net4}
    -
    - {mac4} - {bridge4} - {nic4} - {ovs_ip4} -
    -
    - -
    -
    - -
    - {lang_boot} -
    - {boot_cd} -
    - {boot_iso} - {boot_iso_path} - {browse_button} -
     
    -
    - {boot_net} - {boot_local} -
    -
    - -
    - {lang_vnc} -
    -
    - {vnc} - {vnc_1} - {vnc_keymap} -
    -
    -
    - -
    -
     
    -
    -
    - -
    {submit} {cancel}
    - -
    -
    - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-clone.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-clone.tpl.php deleted file mode 100644 index 60f8a5d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-clone.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    -
    - {form} -
    - {name} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-edit.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-edit.tpl.php deleted file mode 100644 index 8ee0b79..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-edit.tpl.php +++ /dev/null @@ -1,61 +0,0 @@ - - - - - -

    {label}

    - -
    -
    -
    -
    {lang_id}: {id}
    -
    {lang_name}: {name}
    -
    {lang_resource}: {resource}
    -
    {lang_state}: {state}
    -
    -
    - {add_local_vm}
    - {add_network_vm} -
    -
    -
     
    - {table} -
    diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-migrate.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-migrate.tpl.php deleted file mode 100644 index a8f50ef..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-migrate.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    - -
    -
    - {form} - {target} -
    {submit} {cancel}
    -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-remove.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-remove.tpl.php deleted file mode 100644 index e9a43c0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-remove.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    - -
    -
    - {form} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-select.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-select.tpl.php deleted file mode 100644 index bd68de0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-select.tpl.php +++ /dev/null @@ -1,18 +0,0 @@ - -

    {label}

    -{table} diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-update.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-update.tpl.php deleted file mode 100644 index b2b0a77..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-vm-update.tpl.php +++ /dev/null @@ -1,264 +0,0 @@ - - - - - -

    {label}

    - -
    -
    - {form} - -
    - {lang_basic} -
    - {name} -
    -
    - -
    - {lang_hardware} -
    - {cpus} - {memory} -
    -
    - -
    - {lang_virtual_disk} -
    -
    - {disk_interface} -
    -
     
    - {cdrom_iso_path} - {cdrom_button} -
     
    -
    -
    - -
    - {lang_net} -
    -
    -
    {net0}
    -
    - {mac} - {bridge} - {nic} -
    -
    - -
    -
    {net1}
    -
    - {mac1} - {bridge1} - {nic1} -
    -
    - - -
    -
    {net2}
    -
    - {mac2} - {bridge2} - {nic2} -
    -
    - - -
    -
    {net3}
    -
    - {mac3} - {bridge3} - {nic3} -
    -
    - - -
    -
    {net4}
    -
    - {mac4} - {bridge4} - {nic4} -
    -
    - -
    -
    - -
    - {lang_boot} -
    - {boot_cd} -
    - {boot_iso} - {boot_iso_path} - {browse_button} -
     
    -
    - {boot_net} - {boot_local} -
    -
    - -
    - {lang_vnc} -
    -
    - {vnc} - {vnc_1} - {vnc_keymap} -
    -
    -
    - -
    -
     
    -
    -
    - -
    {submit} {cancel}
    - -
    -
    - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-volgroup-ceph.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-volgroup-ceph.tpl.php deleted file mode 100644 index 7df9467..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-volgroup-ceph.tpl.php +++ /dev/null @@ -1,41 +0,0 @@ - -

    {label}

    - -
    - -
    -
    {lang_id}: {id}
    -
    {lang_name}: {name}
    -
    {lang_resource}: {resource}
    -
    {lang_deployment}: {deployment}
    -
    {lang_state}: {state}
    -
    - -
    -
    {lang_name}: {volgroup_name}
    -
    {lang_free}: {volgroup_vfree}
    -
    - - -
    -
    {add}
    -
    - -
     
    - {table} -
    diff --git a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-volgroup.tpl.php b/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-volgroup.tpl.php deleted file mode 100644 index 82e314e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/kvm/web/tpl/kvm-volgroup.tpl.php +++ /dev/null @@ -1,43 +0,0 @@ - -

    {label}

    - -
    - -
    -
    {lang_id}: {id}
    -
    {lang_name}: {name}
    -
    {lang_resource}: {resource}
    -
    {lang_deployment}: {deployment}
    -
    {lang_state}: {state}
    -
    - -
    -
    {lang_name}: {volgroup_name}
    -
    {lang_attr}: {volgroup_attr}
    -
    {lang_pv}: {volgroup_pv} / {volgroup_lv} / {volgroup_sn}
    -
    {lang_size}: {volgroup_vsize} / {volgroup_vfree}
    -
    - - -
    -
    {add}
    -
    - -
     
    - {table} -
    diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/Makefile b/openQRM-5.3.50-CE/src/plugins/lcmc/Makefile deleted file mode 100644 index 63c6e33..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# this is the openQRM lcmc-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - ../../make-assistant openqrm_cache_or_download LCMC-applet etc/build.conf/lcmc.conf - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/lang/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/tpl/ - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/lcmc.conf && if ! cp $$OPENQRM_BUILD_TMP_DIR/openqrm-build/LCMC-applet/source/LCMC-applet-$$OPENQRM_SOURCE_VERSION.jar $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/ 2>/dev/null; then cp ../../$$OPENQRM_BUILD_TMP_DIR/openqrm-build/LCMC-applet/source/LCMC-applet-$$OPENQRM_SOURCE_VERSION.jar $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web; fi - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/lcmc - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/lcmc/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/etc/build.conf/lcmc.conf b/openQRM-5.3.50-CE/src/plugins/lcmc/etc/build.conf/lcmc.conf deleted file mode 100644 index 7d2c505..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/etc/build.conf/lcmc.conf +++ /dev/null @@ -1,21 +0,0 @@ -# Below the download locations for third-party components are defined -# openqrm-plugin-novnc-components.tgz provides a stripped ajaxterm and a -# static compiled pound as the reverse ssl-proxy -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="1.7.10" -#OPENQRM_SOURCE_DOWNLOAD="http://downloads.sourceforge.net/project/lcmc/all-releases/LCMC-applet-$OPENQRM_SOURCE_VERSION.jar" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/plugins/lcmc/LCMC-applet-$OPENQRM_SOURCE_VERSION.jar" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/etc/init.d/openqrm-plugin-lcmc b/openQRM-5.3.50-CE/src/plugins/lcmc/etc/init.d/openqrm-plugin-lcmc deleted file mode 100644 index 79e62ed..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/etc/init.d/openqrm-plugin-lcmc +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/bash -# init script for the openQRM lcmc plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/include/openqrm-plugin-lcmc-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/etc/openqrm-plugin-lcmc.conf - -LCMC_MC_VERSION="1.3.2" - -function openqrm_plugin_lcmc_start() { - echo "Starting the openQRM lcmc-plugin" - openqrm_plugin_lcmc_stop 1>/dev/null 2>&1 - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/lcmc/.running - return $RET -} - - -function openqrm_plugin_lcmc_stop() { - echo "Stopping the openQRM lcmc-plugin" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/lcmc/.running - return 0 -} - - -function openqrm_plugin_lcmc_init() { - echo "Initializing the openQRM lcmc-plugin" - # copy lcmc-applet to the cloud - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/user/lcmc/ - cd $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/user/lcmc/ - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/lcmc-gui.php . - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/LCMC-applet-"$LCMC_MC_VERSION".jar . - cd - 1>/dev/null - cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web/img/plugin.png $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/img/ha_console.png - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lcmc/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/lcmc - return 0 -} - - -function openqrm_plugin_lcmc_uninstall() { - echo "Uninstalling the openQRM lcmc-plugin" - openqrm_plugin_lcmc_stop - # remove from cloud - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/user/lcmc - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/img/ha_console.png - # unlinking the web dir - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/lcmc -} - - - -case "$1" in - start) - openqrm_plugin_lcmc_start - ;; - stop) - openqrm_plugin_lcmc_stop - ;; - restart) - openqrm_plugin_lcmc_stop - sleep 1 - openqrm_plugin_lcmc_start - ;; - init) - openqrm_plugin_lcmc_init - ;; - uninstall) - openqrm_plugin_lcmc_uninstall - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/etc/init.d/openqrm-plugin-lcmc.postinstall b/openQRM-5.3.50-CE/src/plugins/lcmc/etc/init.d/openqrm-plugin-lcmc.postinstall deleted file mode 100644 index 6600602..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/etc/init.d/openqrm-plugin-lcmc.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-lcmc postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/etc/init.d/openqrm-plugin-lcmc.preremove b/openQRM-5.3.50-CE/src/plugins/lcmc/etc/init.d/openqrm-plugin-lcmc.preremove deleted file mode 100644 index 41dee99..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/etc/init.d/openqrm-plugin-lcmc.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-lcmc preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-lcmc stop \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/etc/openqrm-plugin-lcmc.conf b/openQRM-5.3.50-CE/src/plugins/lcmc/etc/openqrm-plugin-lcmc.conf deleted file mode 100644 index 9bb62dc..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/etc/openqrm-plugin-lcmc.conf +++ /dev/null @@ -1,39 +0,0 @@ -# this is the openQRM-plugin-lcmc info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.1.3" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Integrates LCMC (Linux Cluster Management Console) to manage Service-Highavailability." -OPENQRM_PLUGIN_TYPE="HA" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="" -# dirs which should be taken to the state backup -OPENQRM_PLUGIN_STATE_DIRS="" diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/include/openqrm-plugin-lcmc-functions b/openQRM-5.3.50-CE/src/plugins/lcmc/include/openqrm-plugin-lcmc-functions deleted file mode 100644 index 8c4d2ea..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/include/openqrm-plugin-lcmc-functions +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the functions file for the lcmc-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/web/class/lcmc-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/lcmc/web/class/lcmc-about.controller.class.php deleted file mode 100644 index ea524c4..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/web/class/lcmc-about.controller.class.php +++ /dev/null @@ -1,277 +0,0 @@ - - */ - -class lcmc_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lcmc_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'lcmc_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lcmc_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lcmc_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About LCMC', - 'label' => 'About LCMC', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The lcmc plugin integrates the LCMC (Linux Cluster Management Console by Rasto Levrinc) into openQRM. - It provides a convenient way to configure Highavailability (pacemaker/heartbeat/corosync) for appliactions on Appliances via an intuitive GUI. - No manual configuration for this plugin is needed.', - - 'requirements_title' => 'Requirements', - 'requirements_list' => 'none', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - 'provides_title' => 'Provides', - 'provides_list' => 'Integrates LCMC (Linux Cluster Management Console)', - 'type_title' => 'Plugin Type', - 'type_content' => 'Highavailability', - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - ), - 'usage' => array ( - 'tab' => 'About LCMC', - 'label' => 'LCMC Use-Cases', - ), - -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/lcmc/lang", 'lcmc-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/lcmc/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "documentation"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - case 'bootservice': - $content[] = $this->bootservice(true); - break; - case 'vms': - $content[] = $this->vms(true); - break; - case 'usage': - $content[] = $this->usage(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About LCMC - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lcmc/class/lcmc-about.documentation.class.php'); - $controller = new lcmc_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Boot-Service - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function bootservice( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lcmc/class/lcmc-about.bootservice.class.php'); - $controller = new lcmc_about_bootservice($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['bootservice']; - $data = $controller->action(); - } - $content['label'] = $this->lang['bootservice']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'bootservice' ); - $content['onclick'] = false; - if($this->action === 'bootservice'){ - $content['active'] = true; - } - return $content; - } - - - - - //-------------------------------------------- - /** - * About LCMC VM management - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function vms( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lcmc/class/lcmc-about.vms.class.php'); - $controller = new lcmc_about_vms($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['vms']; - $data = $controller->action(); - } - $content['label'] = $this->lang['vms']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'vms' ); - $content['onclick'] = false; - if($this->action === 'vms'){ - $content['active'] = true; - } - return $content; - } - - - - //-------------------------------------------- - /** - * About LCMC Use-Cases - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function usage( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lcmc/class/lcmc-about.usage.class.php'); - $controller = new lcmc_about_usage($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['usage']; - $data = $controller->action(); - } - $content['label'] = $this->lang['usage']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'usage' ); - $content['onclick'] = false; - if($this->action === 'usage'){ - $content['active'] = true; - } - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/web/class/lcmc-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/lcmc/web/class/lcmc-about.documentation.class.php deleted file mode 100644 index cdc1fef..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/web/class/lcmc-about.documentation.class.php +++ /dev/null @@ -1,89 +0,0 @@ - - */ - -class lcmc_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lcmc_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lcmc_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/lcmc-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/web/css/lcmc.css b/openQRM-5.3.50-CE/src/plugins/lcmc/web/css/lcmc.css deleted file mode 100644 index c87cb02..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/web/css/lcmc.css +++ /dev/null @@ -1,16 +0,0 @@ -/*-Icon classes ----- */ -a.graphs { - padding: 0; - border: 0px none; - width: 32px; - height: 32px; - display:block; - text-align: center; - text-decoration: none; - line-height: 0px; - overflow: hidden; - color: transparent; -} -a.graphs { - background: url('/openqrm/base/plugins/lcmc/img/plugin.png') no-repeat center top; -} diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/lcmc/web/img/plugin.png deleted file mode 100644 index ea5a80d..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/lcmc/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/web/lang/de.lcmc-about.ini b/openQRM-5.3.50-CE/src/plugins/lcmc/web/lang/de.lcmc-about.ini deleted file mode 100644 index 026b4dd..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/web/lang/de.lcmc-about.ini +++ /dev/null @@ -1,26 +0,0 @@ -[documentation] -tab = "Über LCMC" -label = "Über LCMC" -introduction_title = "Einleitung" -introduction_content = "Das 'LCMC' Plugin integriert LCMC (Linux Cluster Management Console von Rasto Levrinc). - LCMC bietet einen benutzerfreundliche Methode Hochverfügbarkeit (pacemaker/heartbeat/corosync) für Dienste auf dem Server mittels einer intuitiven Benutzeroberfläche zu konfigurieren. - Manuelle Konfiguration des Plugins ist nicht nötig." - -requirements_title = "Anforderungen" -requirements_list = "keine" -tested_title = "Testet mit" -tested_content = "Diese Plugin ist getestet mit Debian, Ubuntu und CentOS Linux Distributionen" - -provides_title = "Bietet" -provides_list = "Integriert LCMC (Linux Cluster Management Console)" - -type_title = "Plugin Typ" -type_content = "Hochverfügbarkeit" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" - - -[usage] -tab = "About LCMC" -label = "LCMC Anwendungsfälle" diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/web/lang/en.lcmc-about.ini b/openQRM-5.3.50-CE/src/plugins/lcmc/web/lang/en.lcmc-about.ini deleted file mode 100644 index e20db54..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/web/lang/en.lcmc-about.ini +++ /dev/null @@ -1,23 +0,0 @@ -[documentation] -tab = "About LCMC" -label = "About LCMC" -introduction_title = "Introduction" -introduction_content = "The lcmc plugin integrates the LCMC (Linux Cluster Management Console by Rasto Levrinc) into openQRM. - It provides a convenient way to configure Highavailability (pacemaker/heartbeat/corosync) for appliactions on Server via an intuitive GUI. - No manual configuration for this plugin is needed." - -requirements_title = "Requirements" -requirements_list = "none" -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions." -provides_title = "Provides" -provides_list = "Integrates LCMC (Linux Cluster Management Console)" -type_title = "Plugin Type" -type_content = "Highavailability" -documentation_title = "Documentation" -use_case_title = "Use-Case" - - -[usage] -tab = "About LCMC" -label = "LCMC Use-Cases" diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/web/lcmc-action.php b/openQRM-5.3.50-CE/src/plugins/lcmc/web/lcmc-action.php deleted file mode 100644 index bb2fe15..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/web/lcmc-action.php +++ /dev/null @@ -1,68 +0,0 @@ - -*/ - - - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/authblocker.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -// filter inputs -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; - -global $IMAGE_INFO_TABLE; -global $DEPLOYMENT_INFO_TABLE; -global $OPENQRM_SERVER_BASE_DIR; - -// get params -$lcmc_command = $request->get('lcmc_command'); -$lcmc_resource_id = $request->get('resource_id'); -$lcmc_resource_ip = $request->get('resource_ip'); - -// get event + openQRM server -$event = new event(); -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $event; - -// user/role authentication -if ($OPENQRM_USER->role != "administrator") { - $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "lcmc-action", "Un-Authorized access to lcmc-actions from $OPENQRM_USER->name", "", "", 0, 0, 0); - exit(); -} - - -$event->log("$lcmc_command", $_SERVER['REQUEST_TIME'], 5, "lcmc-action", "Processing lcmc command $lcmc_command", "", "", 0, 0, 0); -switch ($lcmc_command) { - - default: - $event->log("$lcmc_command", $_SERVER['REQUEST_TIME'], 3, "lcmc-action", "No such lcmc command ($lcmc_command)", "", "", 0, 0, 0); - break; - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/web/lcmc-gui.php b/openQRM-5.3.50-CE/src/plugins/lcmc/web/lcmc-gui.php deleted file mode 100644 index 203a002..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/web/lcmc-gui.php +++ /dev/null @@ -1,56 +0,0 @@ - - - -openQRM - LCMC Console - - - - - - - - - - - - -*/ -?> - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/lcmc/web/menu.txt deleted file mode 100644 index cd964f6..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/web/menu.txt +++ /dev/null @@ -1,22 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|LCMC -...|LCMC|index.php?iframe=plugins/lcmc/lcmc-gui.php|Linux Cluster Management Console -...|About|index.php?plugin=lcmc&controller=lcmc-about|How to use diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/web/openqrm-lcmc-appliance-link-hook.php b/openQRM-5.3.50-CE/src/plugins/lcmc/web/openqrm-lcmc-appliance-link-hook.php deleted file mode 100644 index 79cd6d2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/web/openqrm-lcmc-appliance-link-hook.php +++ /dev/null @@ -1,69 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/htmlobjects/htmlobject.class.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $OPENQRM_SERVER_IP_ADDRESS; -$event = new event(); -global $event; - - - -function get_lcmc_appliance_link($appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $p_appliance = new appliance(); - $p_appliance->get_instance_by_id($appliance_id); - $p_resource = new resource(); - $p_resource->get_instance_by_id($p_appliance->resources); - $lcmc_gui="/openqrm/base/plugins/lcmc/lcmc-gui.php"; - $icon_size = "width='24' height='24'"; - $icon_title = "Configure appliaction highavailability"; - - $html = new htmlobject($OPENQRM_SERVER_BASE_DIR.'/openqrm/web/base/class/htmlobjects'); - $a = $html->a(); - $a->label = 'LCMC'; //''.$icon_title.''; - $a->css = 'badge'; - $a->href = '#'; - $a->handler = 'onclick="window.open(\''.$lcmc_gui.'\',\'\', \'location=0,status=0,scrollbars=1,width=1150,height=800,left=50,top=50,screenX=50,screenY=50\');return false;"'; - - $plugin_link = ''; - if (strstr($p_appliance->state, "active")) { - $plugin_link = $a; - } - if ($p_resource->id == 0) { - $plugin_link = $a; - } - if ($p_resource->id == '') { - $plugin_link = ""; - } - - return $plugin_link; -} - diff --git a/openQRM-5.3.50-CE/src/plugins/lcmc/web/tpl/lcmc-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/lcmc/web/tpl/lcmc-about-documentation.tpl.php deleted file mode 100644 index 8c06b78..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lcmc/web/tpl/lcmc-about-documentation.tpl.php +++ /dev/null @@ -1,45 +0,0 @@ - -

    {label}

    - -
    -
    -

    {introduction_title}

    - {introduction_content} - -

    {provides_title}

    - {provides_list} - -

    {requirements_title}

    - {requirements_list} - -
    -
    -

    {type_title}

    - {type_content} - -

    {tested_title}

    - {tested_content} - -
    -
    - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/ldap/Makefile b/openQRM-5.3.50-CE/src/plugins/ldap/Makefile deleted file mode 100644 index 0245fa3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ldap/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/ldap/etc - cp etc/openqrm-plugin-ldap.conf /usr/share/openqrm/plugins/ldap/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/ldap/etc/openqrm-plugin-ldap.conf b/openQRM-5.3.50-CE/src/plugins/ldap/etc/openqrm-plugin-ldap.conf deleted file mode 100644 index b2dda3b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/ldap/etc/openqrm-plugin-ldap.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Central user-management for openQRM, openQRM Cloud and openQRM Enterprise Cloud Zones via LDAP.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="network" diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/Makefile b/openQRM-5.3.50-CE/src/plugins/linuxcoe/Makefile deleted file mode 100644 index 846bd7f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/Makefile +++ /dev/null @@ -1,95 +0,0 @@ -# this is the openQRM linuxcoe-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - ../../make-assistant openqrm_cache_or_download linuxcoe-sd etc/build.conf/linuxcoe-sd.conf - ../../make-assistant openqrm_cache_or_download linuxcoe-sd-data-centos etc/build.conf/linuxcoe-sd-data-centos.conf - ../../make-assistant openqrm_cache_or_download linuxcoe-sd-data-debian etc/build.conf/linuxcoe-sd-data-debian.conf - ../../make-assistant openqrm_cache_or_download linuxcoe-sd-data-ubuntu etc/build.conf/linuxcoe-sd-data-ubuntu.conf - ../../make-assistant openqrm_cache_or_download linuxcoe-sd-iso-ubuntu64 etc/build.conf/linuxcoe-sd-iso-ubuntu64.conf - ../../make-assistant openqrm_cache_or_download linuxcoe-sd-iso-debian64 etc/build.conf/linuxcoe-sd-iso-debian64.conf - ../../make-assistant openqrm_cache_or_download linuxcoe-sd-iso-centos64 etc/build.conf/linuxcoe-sd-iso-centos64.conf - ../../make-assistant openqrm_cache_or_download linuxcoe-coe-bootimage etc/build.conf/linuxcoe-coe-bootimage.conf - - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/linuxcoe $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/init.d/linuxcoe - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/data - . $(OPENQRM_SERVER_CONF) && cp etc/templates/data/* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/data/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/osvend.d - . $(OPENQRM_SERVER_CONF) && cp etc/templates/osvend.d/* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/osvend.d/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/depots - . $(OPENQRM_SERVER_CONF) && cp etc/templates/depots/* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/depots/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/patches - . $(OPENQRM_SERVER_CONF) && cp etc/templates/patches/*.diff $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/patches/ - . $(OPENQRM_SERVER_CONF) && cp etc/templates/linuxcoe* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/tpl/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/lang/ - . $(OPENQRM_SERVER_CONF) && chmod 777 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/bin/openqrm* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/sbin - . $(OPENQRM_SERVER_CONF) && cp sbin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/sbin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/sbin/openqrm* - # copy linuxcoe packages, we cannot install here since DESTINATION_DIR won't fit - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/ - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/linuxcoe-sd.conf && if ! cp $$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd/source/linuxcoe-sd-$$OPENQRM_SOURCE_VERSION.tar.gz $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/ 2>/dev/null; then cp ../../$$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd/source/linuxcoe-sd-$$OPENQRM_SOURCE_VERSION.tar.gz $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/; fi - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/linuxcoe-sd-data-centos.conf && if ! cp $$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd-data-centos/source/linuxcoe-sd-data-centos-$$OPENQRM_SOURCE_VERSION.tar.gz $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/ 2>/dev/null; then cp ../../$$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd-data-centos/source/linuxcoe-sd-data-centos-$$OPENQRM_SOURCE_VERSION.tar.gz $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/; fi - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/linuxcoe-sd-data-debian.conf && if ! cp $$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd-data-debian/source/linuxcoe-sd-data-debian-$$OPENQRM_SOURCE_VERSION.tar.gz $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/ 2>/dev/null; then cp ../../$$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd-data-debian/source/linuxcoe-sd-data-debian-$$OPENQRM_SOURCE_VERSION.tar.gz $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/; fi - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/linuxcoe-sd-data-centos.conf && if ! cp $$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd-data-ubuntu/source/linuxcoe-sd-data-ubuntu-$$OPENQRM_SOURCE_VERSION.tar.gz $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/ 2>/dev/null; then cp ../../$$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd-data-ubuntu/source/linuxcoe-sd-data-ubuntu-$$OPENQRM_SOURCE_VERSION.tar.gz $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/; fi - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/linuxcoe-sd-iso-centos64.conf && if ! cp $$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd-iso-centos64/source/*.tar $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/ 2>/dev/null; then cp ../../$$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd-iso-centos64/source/*.tar $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/; fi - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/linuxcoe-sd-iso-debian64.conf && if ! cp $$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd-iso-debian64/source/*.tar $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/ 2>/dev/null; then cp ../../$$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd-iso-debian64/source/*.tar $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/; fi - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/linuxcoe-sd-iso-ubuntu64.conf && if ! cp $$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd-iso-ubuntu64/source/*.tar $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/ 2>/dev/null; then cp ../../$$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-sd-iso-ubuntu64/source/*.tar $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install/packages/; fi - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/linuxcoe-coe-bootimage.conf && if ! cp $$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-coe-bootimage/source/*.tgz $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/ 2>/dev/null; then cp ../../$$OPENQRM_BUILD_TMP_DIR/openqrm-build/linuxcoe-coe-bootimage/source/*.tgz $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/; fi - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/linuxcoe - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/linuxcoe/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe - /bin/rm -f /etc/apache2/conf.d/LinuxCOE-SystemDesigner.conf - /bin/rm -f /etc/httpd/conf.d/LinuxCOE-SystemDesigner.conf - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/bin/openqrm-linuxcoe b/openQRM-5.3.50-CE/src/plugins/linuxcoe/bin/openqrm-linuxcoe deleted file mode 100644 index 3315531..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/bin/openqrm-linuxcoe +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/bash -# this script provides a guided installation/uninstallation for linuxcoe -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# get the openQRM functions -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -OPENQRM_SOURCE_DIR=$OPENQRM_SERVER_BASE_DIR -export OPENQRM_SOURCE_DIR -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/include/openqrm-plugin-linuxcoe-functions - -LCOE_BASE_VERSION="4" -LCOE_SUB_VERSION="3" -LCOE_BASE="linuxcoe-sd-$LCOE_BASE_VERSION.$LCOE_SUB_VERSION.tar.gz" -LCOE_DISTRIBUTIONS="centos debian ubuntu" -LCOE_INSTALL_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/linuxcoe-sd" -LCOE_INSTALL_TMP="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/lcoe-install" -CURRENT_DIR=`pwd` - - - -function lcoe_install() { - - linuxcoe_log "> Installing LinuxCOE" - # unpack - rm -rf $LCOE_INSTALL_TMP/install - mkdir -p $LCOE_INSTALL_TMP/install - if [ ! -d $LCOE_INSTALL_TMP/install/linuxcoe-sd-$LCOE_BASE_VERSION.$LCOE_SUB_VERSION ]; then - tar -C $LCOE_INSTALL_TMP/install -xzf $LCOE_INSTALL_TMP/packages/$LCOE_BASE - fi - for DIST in $LCOE_DISTRIBUTIONS; do - if [ ! -d $LCOE_INSTALL_TMP/install/linuxcoe-sd-data-$DIST-$LCOE_BASE_VERSION.$LCOE_SUB_VERSION ]; then - tar -C $LCOE_INSTALL_TMP/install -xzf $LCOE_INSTALL_TMP/packages/linuxcoe-sd-data-$DIST-$LCOE_BASE_VERSION.$LCOE_SUB_VERSION.tar.gz - fi - done - # LinuxCOE installs well with the defaults on Debian/Ubuntu, for RH/Centos we have to set some configuration env - if [ -f /etc/debian_version ]; then - LCO_INSTALL_PARAMS="" - elif [ -f /etc/redhat-release ]; then - LCO_INSTALL_PARAMS="httpdcfgdir=/etc/httpd/conf.d httpd_user=apache httpd_group=apache" - elif [ -f /etc/SuSE-release ]; then - LCO_INSTALL_PARAMS="httpd_user=wwwrun httpd_group=www" - fi - cd $LCOE_INSTALL_TMP/install/linuxcoe-sd-$LCOE_BASE_VERSION.$LCOE_SUB_VERSION - if [ ! -f $LCOE_INSTALL_TMP/install/linuxcoe-sd-$LCOE_BASE_VERSION.$LCOE_SUB_VERSION/Makefile ]; then - ./autogen.sh 1>/dev/null - export CONFIG_SITE="./config.site" - if ! ./configure --prefix=$LCOE_INSTALL_DIR $LCO_INSTALL_PARAMS; then - linuxcoe_log "! Error during configure of LinuxCOE. Please check the requirements !" - exit 1 - fi - fi - make -s - make -s install - make -s integrate - for DIST in $LCOE_DISTRIBUTIONS; do - linuxcoe_log "> Installing linuxcoe-sd-data-$DIST" - cd $LCOE_INSTALL_TMP/install/linuxcoe-sd-data-$DIST-$LCOE_BASE_VERSION.$LCOE_SUB_VERSION - ./configure --prefix=$LCOE_INSTALL_DIR $LCO_INSTALL_PARAMS - make -s - make -s install - done - # cp all additional iso.tar images - /bin/cp -f $LCOE_INSTALL_TMP/packages/*iso.tar $LCOE_INSTALL_DIR/images/ - # post config - /bin/cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/data/* $LCOE_INSTALL_DIR/data/ - /bin/cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/osvend.d/* $LCOE_INSTALL_DIR/osvend.d/ - /bin/cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/depots/* $LCOE_INSTALL_DIR/depots/ - # patches - # Centos 6 does not like langsupport in ks - if ! grep CentOS $LCOE_INSTALL_DIR/cgi-bin/nph-coe_image 1>/dev/null; then - linuxcoe_log "> Patching $LCOE_INSTALL_DIR/cgi-bin/nph-coe_image for CentOS" - cd $LCOE_INSTALL_DIR/ - patch -p0 -i $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/patches/nph-coe_image.diff - cp -af $LCOE_INSTALL_DIR/cgi-bin/nph-coe_image $LCOE_INSTALL_DIR/cgi-bin/nonph-coe_image - cd $CURRENT_DIR - fi - cd $CURRENT_DIR - linuxcoe_log "> Installation of LinuxCOE finished successfully" -} - - -function lcoe_uninstall() { - linuxcoe_log "> Un-installing LinuxCOE" - rm -f /etc/apache2/conf.d/LinuxCOE-SystemDesigner.conf - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/linuxcoe-sd - rm -rf /etc/linuxcoe-sd - cd $CURRENT_DIR - linuxcoe_log "> Uninstallation of LinuxCOE finished successfully" -} - - - -case "$1" in - install) - LOCK_TIME=`openqrm_lock_queue aquire linuxcoe` - trap "openqrm_lock_queue release linuxcoe $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - lcoe_uninstall - lcoe_install - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - ;; - uninstall) - LOCK_TIME=`openqrm_lock_queue aquire linuxcoe` - trap "openqrm_lock_queue release linuxcoe $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - lcoe_uninstall - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - ;; - *) - echo $"Usage: $0 {install|uninstall}" - exit 1 - ;; -esac - - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/bin/openqrm-linuxcoe-autoinstall-client b/openQRM-5.3.50-CE/src/plugins/linuxcoe/bin/openqrm-linuxcoe-autoinstall-client deleted file mode 100644 index c938ddf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/bin/openqrm-linuxcoe-autoinstall-client +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash -# this script manages the linuxcoe profiles -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_IP=$1 -RESOURCE_ID=$2 -RESOURCE_MAC=$3 -RESOURCE_BASEDIR=$4 -OPENQRM_WEB_PROTOCOL=$5 - -if [ $# != 5 ]; then - echo "This tool automatically install the openQRM Client on a Linux system" - echo "Usage: $0 " - exit 1 -fi - -# some defines -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -# be sure cmd output is english -export LANGUAGE=C -export LANG=C -export LC_ALL=C -# define wget to use with https -if [ "$OPENQRM_WEB_PROTOCOL" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - - -# checks -if ! ip a s | grep -i $RESOURCE_MAC &>/dev/null; then - echo "ERROR: Mac address $RESOURCE_MAC not found on this system!" - exit 1 -fi - -# gather resource parameters -mkdir -p `dirname $OPENQRM_RESOURCE_PARAMETER_FILE` -if ! wget $WGET_NO_CERT_CHECK -O $OPENQRM_RESOURCE_PARAMETER_FILE "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_id=$RESOURCE_ID&resource_mac=$RESOURCE_MAC"; then - echo "ERROR: Could not get the resource parameters from openQRM Server at $OPENQRM_SERVER_IP!" - exit 1 -fi -. $OPENQRM_RESOURCE_PARAMETER_FILE - - -echo "Getting openqrm-client package" -# run default openqrm-client boot-service -KERNEL_ARCH=`uname -m` -if echo $KERNEL_ARCH | grep i.*86 1>/dev/null; then - # i386 - OPENQRM_CLIENT_ARCH=i386 -else - OPENQRM_CLIENT_ARCH=$KERNEL_ARCH -fi -# find out the short distri name -if [ -f /etc/debian_version ]; then - # debian or ubuntu, try to find out without lsb-release which may not be installed - if grep -i ubuntu /etc/apt/sources.list 1>/dev/null; then - OPENQRM_SHORT_DISTRI_NAME="ubuntu" - else - OPENQRM_SHORT_DISTRI_NAME="debian" - fi -elif [ -f /etc/redhat-release ]; then - OPENQRM_SHORT_DISTRI_NAME="centos" -fi - -cd / -echo "Getting openqrm-client package" -if ! wget $WGET_NO_CERT_CHECK -O openqrm-client.tgz "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/boot-service/openqrm-client.tgz"; then - rm -f openqrm-client.tgz - echo "ERROR: Could not download the openqrm-client package from openQRM Server $OPENQRM_SERVER_IP!" - exit 1 -fi - -tar -xzf openqrm-client.tgz -rm -f openqrm-client.tgz -ln -sf $resource_basedir/openqrm/etc/init.d/openqrm-client /etc/init.d/openqrm-client -export OPENQRM_SERVER_BASE_DIR=$resource_basedir -. $resource_basedir/openqrm/include/openqrm-functions -openqrm_chkconfig add openqrm-client - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/bin/openqrm-linuxcoe-manager b/openQRM-5.3.50-CE/src/plugins/linuxcoe/bin/openqrm-linuxcoe-manager deleted file mode 100644 index a8ad904..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/bin/openqrm-linuxcoe-manager +++ /dev/null @@ -1,466 +0,0 @@ -#!/bin/bash -# this script manages the linuxcoe profiles -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# get the openQRM functions -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -OPENQRM_SOURCE_DIR=$OPENQRM_SERVER_BASE_DIR -export OPENQRM_SOURCE_DIR -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -# unblock starting command queue early for non-blocking + ui commands -# only blocking commands -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/include/openqrm-plugin-linuxcoe-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/openqrm-plugin-linuxcoe.conf -CURRENT_DIR=`pwd` - -AUTO_INSTALL_PXE_TEMPLATE_PRESEED="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/linuxcoe-pxe.preseed" -AUTO_INSTALL_PXE_TEMPLATE_KICKSTART="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/linuxcoe-pxe.kickstart" -AUTO_INSTALL_PXE_TEMPLATE_AUTOYAST="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/linuxcoe-pxe.autoyast" -LINUXCOE_INSTALL_LANGUAGE="en" - - -# get the full openQRM-server config -openqrm_server_get_config - -# functions running on the linuxcoe-server -function linuxcoe_usage() { - echo "Usage : $0 transfer_to_linuxcoe -i -m -x -n " - echo " $0 take_over_from_linuxcoe -i -m -x -n " - echo " $0 set_linuxcoe_client_to_local_boot -m " - echo " $0 remove -n " - echo " $0 check" - echo "" - echo "Optional parameters:" - echo " [--openqrm-ui-user ]" - echo " [--openqrm-internal-cmd ]" - echo " [--openqrm-cmd-mode ]" - exit 1 -} - - - -FULL_COMMANDLINE="$0 $@" -LINUXCOE_COMMAND=$1 -shift - -while [ $# -ne 0 ]; do - case "$1" in - -i) - PARAM_RESOURCE_IP=$2 - shift - ;; - -x) - PARAM_RESOURCE_ID=$2 - shift - ;; - -m) - PARAM_RESOURCE_MAC=$2 - shift - ;; - -n) - PARAM_PROFILE_NAME=$2 - shift - ;; - --openqrm-ui-user) - OPENQRM_UI_USER=$2 - shift - ;; - --openqrm-internal-cmd) - OPENQRM_INTERNAL_CMD=$2 - shift - ;; - --openqrm-cmd-mode) - OPENQRM_CMD_MODE=$2 - shift - ;; - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - echo "ERROR: Free commandline arguments are not allowed" - linuxcoe_usage - ;; - esac - shift -done - -# checks -if [ "$LINUXCOE_COMMAND" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - linuxcoe_usage -fi -if [ "$OPENQRM_UI_USER" != "" ]; then - OPENQRM_UI_USER_PARAMETER=" --openqrm-ui-user $OPENQRM_UI_USER" -fi - -# main -case "$LINUXCOE_COMMAND" in - check) - LOCK_TIME=`openqrm_lock_queue aquire linuxcoe` - trap "openqrm_lock_queue release linuxcoe $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # first check that the nfs export is ready - if ! grep ^$LINUXCOE_ISO_DIRECTORY $NFSEXPORTS 1>/dev/null 2>&1; then - if [ ! -d "$LINUXCOE_ISO_DIRECTORY" ]; then - mkdir -p $LINUXCOE_ISO_DIRECTORY - fi - echo "$LINUXCOE_ISO_DIRECTORY *(rw,insecure,no_root_squash,async)" >> $NFSEXPORTS - if [ -x /etc/init.d/nfs ]; then - /etc/init.d/nfs reload - elif [ -x /etc/init.d/nfs-kernel-server ]; then - /etc/init.d/nfs-kernel-server reload - elif [ -x /etc/init.d/nfsserver ]; then - /etc/init.d/nfsserver reload - else - openqrm_post_event 0 "reload-nfs" 3 "linuxcoe" "Could not find nfs-server init script!" - fi - fi - linuxcoe_log "Checking for unpacked profiles ..." - - for FILE in `file $LINUXCOE_SYSTEMDESIGNER_DIR/* | grep ISO | cut -d':' -f1`; do - FILENAME=`basename $FILE` - if [ ! -d $LINUXCOE_PROFILE_DIR/$FILENAME ]; then - linuxcoe_log "Unpacking $FILE..." - MOUNTPOINT=`mktemp -d /tmp/$FILENAME.XXXXXXXXXX` || exit 1 - if ! mount -o loop $FILE $MOUNTPOINT; then - openqrm_post_event 0 "check" 3 "linuxcoe" "ERROR: Could not loop mount $FILE at $MOUNTPOINT!" - continue - fi - mkdir -p $LINUXCOE_PROFILE_DIR/$FILENAME - /bin/cp -aRv $MOUNTPOINT/* $LINUXCOE_PROFILE_DIR/$FILENAME/ - # create the info file for the comments - touch $LINUXCOE_PROFILE_DIR/$FILENAME/openqrm.info - chmod 777 $LINUXCOE_PROFILE_DIR/$FILENAME/openqrm.info - # create the custom post file - touch $LINUXCOE_PROFILE_DIR/$FILENAME/custom-post.info - chmod 777 $LINUXCOE_PROFILE_DIR/$FILENAME/custom-post.info - umount $MOUNTPOINT - # add to nfs-export - cp -f $LINUXCOE_SYSTEMDESIGNER_DIR/$FILENAME $LINUXCOE_ISO_DIRECTORY/ - else - if [ ! -f $LINUXCOE_PROFILE_DIR/$FILENAME/custom-post.info ]; then - touch $LINUXCOE_PROFILE_DIR/$FILENAME/custom-post.info - chmod 777 $LINUXCOE_PROFILE_DIR/$FILENAME/custom-post.info - fi - fi - done - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/stat/ - touch $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/stat/check - chmod -R 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/stat/ - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - ;; - - remove) - if [ "$PARAM_PROFILE_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - linuxcoe_usage - fi - - LOCK_TIME=`openqrm_lock_queue aquire linuxcoe` - trap "openqrm_lock_queue release linuxcoe $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - linuxcoe_log "Removing profile $PARAM_PROFILE_NAME" - if [ -d "$LINUXCOE_PROFILE_DIR/$PARAM_PROFILE_NAME" ]; then - rm -rf "$LINUXCOE_PROFILE_DIR/$PARAM_PROFILE_NAME" - fi - if [ -f "$LINUXCOE_SYSTEMDESIGNER_DIR/$PARAM_PROFILE_NAME" ]; then - rm -f "$LINUXCOE_SYSTEMDESIGNER_DIR/$PARAM_PROFILE_NAME" - fi - if [ -f "$LINUXCOE_ISO_DIRECTORY/$PARAM_PROFILE_NAME" ]; then - rm -f "$LINUXCOE_ISO_DIRECTORY/$PARAM_PROFILE_NAME" - fi - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - ;; - - transfer_to_linuxcoe) - if [ "$PARAM_PROFILE_NAME" == "" ] || [ "$PARAM_RESOURCE_ID" == "" ] || [ "$PARAM_RESOURCE_IP" == "" ] || [ "$PARAM_RESOURCE_MAC" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - linuxcoe_usage - fi - - LOCK_TIME=`openqrm_lock_queue aquire linuxcoe` - trap "openqrm_lock_queue release linuxcoe $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - linuxcoe_log "Applying profile $PARAM_PROFILE_NAME to resource $PARAM_RESOURCE_ID ($PARAM_RESOURCE_IP/$PARAM_RESOURCE_MAC)" - RESOURCE_PXELINUXCFG_FILE=`echo 01-$PARAM_RESOURCE_MAC | sed -e "s/:/-/g" | tr '[:upper:]' '[:lower:]'` - /bin/cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE.lcoe-$PARAM_PROFILE_NAME - - # check which auto-install method to use - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/profiles/$PARAM_PROFILE_NAME/preseed ]; then - AUTO_INSTALL_METHOD="preseed" - elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/profiles/$PARAM_PROFILE_NAME/ks.cfg ]; then - AUTO_INSTALL_METHOD="kickstart" - elif grep autoyast $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/profiles/$PARAM_PROFILE_NAME/isolinux.cfg 1>/dev/null; then - AUTO_INSTALL_METHOD="autoyast" - else - linuxcoe_log "ERROR: Could not find out which Auto-install method to use. Exiting." - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - case "$AUTO_INSTALL_METHOD" in - preseed) - linuxcoe_log "Using Automatic installation method $AUTO_INSTALL_METHOD." - DEBIAN_NETINSTALL_KERNEL="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/profiles/$PARAM_PROFILE_NAME/linux" - DEBIAN_NETINSTALL_INITRD="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/profiles/$PARAM_PROFILE_NAME/initrd.gz" - # prepare kernel + initrd for the aut-install - if [ ! -f $DEBIAN_NETINSTALL_KERNEL ]; then - linuxcoe_log "ERROR: Could not find Debian auto-install kernel $DEBIAN_NETINSTALL_KERNEL" - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - - exit 1 - fi - if [ ! -f $DEBIAN_NETINSTALL_INITRD ]; then - linuxcoe_log "ERROR: Could not find Debian auto-install initrd $DEBIAN_NETINSTALL_INITRD" - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - - exit 1 - fi - /bin/cp -f $DEBIAN_NETINSTALL_KERNEL $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/vmlinuz-$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME - /bin/cp -f $DEBIAN_NETINSTALL_INITRD $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.img - - # prepare the auto-install pxe boot - cat $AUTO_INSTALL_PXE_TEMPLATE_PRESEED | \ - sed -e "s#@@OPENQRM_BOOTIMAGE_KERNEL@@#vmlinuz-$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME#g" | \ - sed -e "s#@@OPENQRM_BOOTIMAGE_INITRD@@#initrd-$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.img#g" | \ - sed -e "s#@@LINUXCOE_INSTALL_LANGUAGE@@#$LINUXCOE_INSTALL_LANGUAGE#g" | \ - sed -e "s#@@OPENQRM_SERVER_IP_ADDRESS@@#$OPENQRM_SERVER_IP_ADDRESS#g" | \ - sed -e "s#@@LINUXCOE_PROFILE_NAME@@#$PARAM_PROFILE_NAME#g" | \ - sed -e "s#@@OPENQRM_RESOURCE_ID@@#$PARAM_RESOURCE_ID#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - - linuxcoe_log "Prepared resources pxe-configuration for the automatic installation ($OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE)" - # copy the preseed config to the boot-service dir - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe - /bin/cp -f $LINUXCOE_PROFILE_DIR/$PARAM_PROFILE_NAME/preseed $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe/preseed.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.cfg - - # add the custom post section - if [ -f $LINUXCOE_PROFILE_DIR/$PARAM_PROFILE_NAME/custom-post.info ]; then - /bin/cp -f $LINUXCOE_PROFILE_DIR/$PARAM_PROFILE_NAME/custom-post.info $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe/custom-post.info.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME - fi - - # add custom late_command for preseed to auto-install openQRM client - sed -i -e "s#.*late_command.*##g" $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe/preseed.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.cfg - echo "d-i preseed/late_command string wget http://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/lcoe/openqrm-linuxcoe-autoinstall-client && chmod +x ./openqrm-linuxcoe-autoinstall-client && mv -f openqrm-linuxcoe-autoinstall-client /target && if [ ! -e /target/proc/uptime ]; then mount -t proc proc /target/proc; touch /umount_proc; fi && chroot /target ./openqrm-linuxcoe-autoinstall-client $OPENQRM_SERVER_IP_ADDRESS $PARAM_RESOURCE_ID $PARAM_RESOURCE_MAC $OPENQRM_SERVER_BASE_DIR $OPENQRM_WEB_PROTOCOL && wget http://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/lcoe/custom-post.info.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME && chmod +x custom-post.info.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME && mv -f custom-post.info.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME /target && chroot /target ./custom-post.info.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME && if [ -e /umount_proc ]; then umount /target/proc; rm -f /umount_proc; fi" >> $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe/preseed.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.cfg - # allow to use weak passwords, linuxcoe does only allow 8 chars - echo "d-i user-setup/allow-password-weak boolean true" >> $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe/preseed.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.cfg - echo "d-i user-setup/encrypt-home boolean false" >> $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe/preseed.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.cfg - ;; - - - kickstart) - linuxcoe_log "Using Automatic installation method $AUTO_INSTALL_METHOD." - # copy the kickstart config to the boot-service dir early - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe - PKS="$OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe/ks.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.cfg" - /bin/cp -f $LINUXCOE_PROFILE_DIR/$PARAM_PROFILE_NAME/ks.cfg $PKS - - # adapt ks, remove motd msg + add post - cat $PKS | grep useradd > $PKS.useradd - sed -i -e "s#.*/etc/motd.*##g" $PKS - sed -i -e "s#.*useradd.*##g" $PKS - sed -i -e "s#^%post.*##g" $PKS - echo "%post" >> $PKS - echo "#!/bin/bash" >> $PKS - echo "wget http://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/lcoe/openqrm-linuxcoe-autoinstall-client" >> $PKS - echo "chmod +x ./openqrm-linuxcoe-autoinstall-client" >> $PKS - echo "mount -t proc proc /proc" >> $PKS - echo "./openqrm-linuxcoe-autoinstall-client $OPENQRM_SERVER_IP_ADDRESS $PARAM_RESOURCE_ID $PARAM_RESOURCE_MAC $OPENQRM_SERVER_BASE_DIR $OPENQRM_WEB_PROTOCOL" >> $PKS - echo "umount /proc" >> $PKS - # add the custom post section - if [ -f $LINUXCOE_PROFILE_DIR/$PARAM_PROFILE_NAME/custom-post.info ]; then - cat $LINUXCOE_PROFILE_DIR/$PARAM_PROFILE_NAME/custom-post.info >> $PKS - fi - cat $PKS.useradd >> $PKS - rm -f $PKS.useradd - # add to install section - grep ^%packages -B 1000 $PKS | grep -v ^%packages > $PKS.firstpart - grep ^%packages -A 1000 $PKS > $PKS.secondpart - echo "text" > $PKS.addtoinstall - echo "selinux --disabled" >> $PKS.addtoinstall - echo "firewall --disabled" >> $PKS.addtoinstall - echo "reboot" >> $PKS.addtoinstall - echo "" >> $PKS.addtoinstall - echo "" >> $PKS.addtoinstall - cat $PKS.firstpart $PKS.addtoinstall $PKS.secondpart > $PKS - rm -f $PKS.firstpart $PKS.addtoinstall $PKS.secondpart - - # prepare kernel + initrd for the auto-install - KICKSTART_KERNEL="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/profiles/$PARAM_PROFILE_NAME/isolinux/vmlinuz" - KICKSTART_INITRD="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/profiles/$PARAM_PROFILE_NAME/isolinux/initrd.img" - if [ ! -f $KICKSTART_KERNEL ]; then - linuxcoe_log "ERROR: Could not find kickstart auto-install kernel $KICKSTART_KERNEL" - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - - exit 1 - fi - if [ ! -f $KICKSTART_INITRD ]; then - linuxcoe_log "ERROR: Could not find kickstart auto-install initrd $KICKSTART_INITRD" - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - - exit 1 - fi - /bin/cp -f $KICKSTART_KERNEL $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/vmlinuz-$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME - /bin/cp -f $KICKSTART_INITRD $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.img - - # prepare the auto-install pxe boot - cat $AUTO_INSTALL_PXE_TEMPLATE_KICKSTART | \ - sed -e "s#@@OPENQRM_BOOTIMAGE_KERNEL@@#vmlinuz-$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME#g" | \ - sed -e "s#@@OPENQRM_BOOTIMAGE_INITRD@@#initrd-$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.img#g" | \ - sed -e "s#@@LINUXCOE_INSTALL_LANGUAGE@@#$LINUXCOE_INSTALL_LANGUAGE#g" | \ - sed -e "s#@@OPENQRM_SERVER_IP_ADDRESS@@#$OPENQRM_SERVER_IP_ADDRESS#g" | \ - sed -e "s#@@LINUXCOE_PROFILE_NAME@@#$PARAM_PROFILE_NAME#g" | \ - sed -e "s#@@PARAM_RESOURCE_MAC@@#$PARAM_RESOURCE_MAC#g" | \ - sed -e "s#@@OPENQRM_RESOURCE_ID@@#$PARAM_RESOURCE_ID#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - - linuxcoe_log "Prepared resources pxe-configuration for the automatic installation ($OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE)" - - - ;; - - autoyast) - - linuxcoe_log "Automatic installation method $AUTO_INSTALL_METHOD not supported yet." - - ;; - - *) - linuxcoe_log "Automatic installation method $AUTO_INSTALL_METHOD not supported yet." - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - - exit 1 - ;; - esac - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - - # wait for reboot of the resource - sleep $OPENQRM_PLUGIN_LINUXCOE_INSTALL_START_DELAY - # revert pxe config - $0 take_over_from_linuxcoe -n $PARAM_PROFILE_NAME -x $PARAM_RESOURCE_ID -i $PARAM_RESOURCE_IP -m $PARAM_RESOURCE_MAC --openqrm-internal-cmd true - # set the clients pxe config to local-boot - RESOURCE_PXELINUXCFG_FILE=`echo 01-$PARAM_RESOURCE_MAC | sed -e "s/:/-/g" | tr '[:upper:]' '[:lower:]'` - sed -i -e "s/^default.*/default local/g" $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - - # start the openqrm-linuxcoe-monitord to send transaction state to openQRM - $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/sbin/openqrm-linuxcoe-monitord $PARAM_RESOURCE_ID $PARAM_RESOURCE_MAC - ;; - - take_over_from_linuxcoe) - if [ "$PARAM_PROFILE_NAME" == "" ] || [ "$PARAM_RESOURCE_ID" == "" ] || [ "$PARAM_RESOURCE_IP" == "" ] || [ "$PARAM_RESOURCE_MAC" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - linuxcoe_usage - fi - - LOCK_TIME=`openqrm_lock_queue aquire linuxcoe` - trap "openqrm_lock_queue release linuxcoe $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - linuxcoe_log "Reverting profile $PARAM_PROFILE_NAME to resource $PARAM_RESOURCE_ID ($PARAM_RESOURCE_IP/$PARAM_RESOURCE_MAC)" - RESOURCE_PXELINUXCFG_FILE=`echo 01-$PARAM_RESOURCE_MAC | sed -e "s/:/-/g" | tr '[:upper:]' '[:lower:]'` - /bin/mv -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE.lcoe-$PARAM_PROFILE_NAME $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - # set the clients pxe config to net-boot, this is for appliance stop - sed -i -e "s/^default.*/default linux/g" $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - - # clean-up kernel + initrd - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/vmlinuz-$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/boot/initrd-$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.img - - # check which auto-install method was used - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/profiles/$PARAM_PROFILE_NAME/preseed ]; then - AUTO_INSTALL_METHOD="preseed" - elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/profiles/$PARAM_PROFILE_NAME/ks.cfg ]; then - AUTO_INSTALL_METHOD="kickstart" - elif grep autoyast $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/profiles/$PARAM_PROFILE_NAME/isolinux.cfg 1>/dev/null; then - AUTO_INSTALL_METHOD="autoyast" - else - linuxcoe_log "ERROR: Could not find out which Auto-install method to use. Exiting." - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - - exit 1 - fi - case "$AUTO_INSTALL_METHOD" in - preseed) - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe/preseed.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.cfg - ;; - kickstart) - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe/ks.$PARAM_RESOURCE_ID-$PARAM_PROFILE_NAME.cfg - ;; - autoyast) - linuxcoe_log "Automatic installation method $AUTO_INSTALL_METHOD not supported yet." - ;; - - *) - linuxcoe_log "Automatic installation method $AUTO_INSTALL_METHOD not supported yet." - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - - exit 1 - ;; - esac - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - ;; - - - set_linuxcoe_client_to_local_boot) - if [ "$PARAM_RESOURCE_MAC" == "" ]; then - linuxcoe_usage - fi - - LOCK_TIME=`openqrm_lock_queue aquire linuxcoe` - trap "openqrm_lock_queue release linuxcoe $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - echo "NOTICE: Setting resource $PARAM_RESOURCE_MAC to local-boot." - # set the clients pxe config to local-boot, this is for appliance start - RESOURCE_PXELINUXCFG_FILE=`echo 01-$PARAM_RESOURCE_MAC | sed -e "s/:/-/g" | tr '[:upper:]' '[:lower:]'` - sed -i -e "s/^default.*/default local/g" $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/tftpboot/pxelinux.cfg/$RESOURCE_PXELINUXCFG_FILE - - openqrm_lock_queue release linuxcoe $LOCK_TIME - trap '' EXIT - ;; - -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-coe-bootimage.conf b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-coe-bootimage.conf deleted file mode 100644 index d5067e0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-coe-bootimage.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="4.3" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/plugins/linuxcoe/coe_bootimage_$OPENQRM_SOURCE_VERSION.pachted.tgz" -OPENQRM_SOURCE_BINARY_RESULT="" - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-data-centos.conf b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-data-centos.conf deleted file mode 100644 index 4717b81..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-data-centos.conf +++ /dev/null @@ -1,20 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="4.3" -#OPENQRM_SOURCE_DOWNLOAD="http://www.instalinux.com/snapshots/linuxcoe-sd-data-centos-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/plugins/linuxcoe/linuxcoe-sd-data-centos-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_BINARY_RESULT="" - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-data-debian.conf b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-data-debian.conf deleted file mode 100644 index c70bda5..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-data-debian.conf +++ /dev/null @@ -1,20 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="4.3" -#OPENQRM_SOURCE_DOWNLOAD="http://www.instalinux.com/snapshots/linuxcoe-sd-data-debian-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/plugins/linuxcoe/linuxcoe-sd-data-debian-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_BINARY_RESULT="" - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-data-ubuntu.conf b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-data-ubuntu.conf deleted file mode 100644 index 63b8174..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-data-ubuntu.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="4.3" -#OPENQRM_SOURCE_DOWNLOAD="http://www.instalinux.com/snapshots/linuxcoe-sd-data-ubuntu-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/plugins/linuxcoe/linuxcoe-sd-data-ubuntu-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-iso-centos64.conf b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-iso-centos64.conf deleted file mode 100644 index 2e6d4a9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-iso-centos64.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="4.3" -#OPENQRM_SOURCE_DOWNLOAD="http://www.instalinux.com/snapshots/images/CentOS-6-x86_64-iso.tar" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/plugins/linuxcoe/update/CentOS-6-x86_64-iso.tar" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-iso-debian64.conf b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-iso-debian64.conf deleted file mode 100644 index 5314d27..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-iso-debian64.conf +++ /dev/null @@ -1,17 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="4.3" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/plugins/linuxcoe/update/Debian-Wheezy-x86_64-iso.tar" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-iso-ubuntu64.conf b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-iso-ubuntu64.conf deleted file mode 100644 index 9aa4d92..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd-iso-ubuntu64.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="4.3" -#OPENQRM_SOURCE_DOWNLOAD="http://www.instalinux.com/snapshots/images/Ubuntu-Precise-x86_64-iso.tar" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/plugins/linuxcoe/update/Ubuntu-Trusty-x86_64-iso.tar" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd.conf b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd.conf deleted file mode 100644 index 78aaeb2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/build.conf/linuxcoe-sd.conf +++ /dev/null @@ -1,20 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="4.3" -#OPENQRM_SOURCE_DOWNLOAD="http://www.instalinux.com/snapshots/linuxcoe-sd-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/plugins/linuxcoe/linuxcoe-sd-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_BINARY_RESULT="" - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/init.d/linuxcoe b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/init.d/linuxcoe deleted file mode 100644 index 001eb29..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/init.d/linuxcoe +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the linuxcoe resources -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -# for including the package functions -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_RESOURCE_PARAMETER_FILE -OPENQRM_SERVER_IP=$resource_openqrmserver -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi -# do not run on idle resources -if [ "$resource_image" == "idle" ]; then - exit 0 -fi - - -function linuxcoe_start() { - echo "Starting the openQRM linuxcoe-plugin" - linuxcoe_stop 1>/dev/null 2>&1 - return 0 -} - - -function linuxcoe_stop() { - echo "Stopping the openQRM linuxcoe-plugin" - return 0 -} - - - - - -case "$1" in - start) - linuxcoe_start - ;; - stop) - linuxcoe_stop - ;; - restart) - linuxcoe_stop - sleep 1 - linuxcoe_start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 - -esac -exit $? - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/init.d/openqrm-plugin-linuxcoe b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/init.d/openqrm-plugin-linuxcoe deleted file mode 100644 index de2617c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/init.d/openqrm-plugin-linuxcoe +++ /dev/null @@ -1,177 +0,0 @@ -#!/bin/bash -# init script for the openQRM linuxcoe-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/include/openqrm-plugin-linuxcoe-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/openqrm-plugin-linuxcoe.conf -# get the ip config -openqrm_server_get_config -export resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -export LANG=C -# define wget to use with https -if [ "$OPENQRM_WEB_PROTOCOL" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - -function openqrm_plugin_linuxcoe_start() { - echo "Starting the openQRM linuxcoe-plugin" - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/linuxcoe/.running -} - - -function openqrm_plugin_linuxcoe_stop() { - echo "Stopping the openQRM linuxcoe-plugin" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/linuxcoe/.running -} - -function openqrm_plugin_linuxcoe_uninstall() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "linuxcoe: Please give a username to uninstall the plugin : " - read USERNAME - echo - echo -n "linuxcoe: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Uninstalling the openQRM linuxcoe-plugin" - openqrm_plugin_linuxcoe_stop - openqrm_server_remove_deployment_type $USERNAME $PASSWORD linuxcoe-deployment - # removing the tables - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$USERNAME --http-password=$PASSWORD "$OPENQRM_WEB_PROTOCOL://localhost/openqrm/base/plugins/linuxcoe/linuxcoe-action.php?linuxcoe_command=uninstall"; then - linuxcoe_log init "ERROR: Could not remove the linuxcoe plugin tables in the database!" - fi - # uninstall linuxcoe - if ! $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/bin/openqrm-linuxcoe uninstall; then - linuxcoe_log init "ERROR: Could not uninstall LinuxCOE!" - fi - - - if [ -f /etc/debian_version ]; then - OPENQRM_WEBSERVER_CONFIG_DIR=/etc/apache2/conf.d - elif [ -f /etc/redhat-release ]; then - OPENQRM_WEBSERVER_CONFIG=/etc/httpd/conf.d - elif [ -f /etc/SuSE-release ]; then - OPENQRM_WEBSERVER_CONFIG_DIR=/etc/apache2/conf.d - fi - - if [ -e $OPENQRM_WEBSERVER_CONFIG_DIR/LinuxCOE-SystemDesigner.conf ]; then - rm -f $OPENQRM_WEBSERVER_CONFIG_DIR/LinuxCOE-SystemDesigner.conf - openqrm_webserver reload - fi - - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/lock/install-lock - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/linuxcoe - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.linuxcoe-deployment.php - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/template.linuxcoe-deployment.php - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-linuxcoe.tgz - -} - -function openqrm_plugin_linuxcoe_init() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "linuxcoe: Please give a username to init the plugin : " - read USERNAME - echo - echo -n "linuxcoe: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Initializing the openQRM linuxcoe-plugin" - openqrm_server_add_deployment_type $USERNAME $PASSWORD linuxcoe-deployment linuxcoe-deployment "Automatic Linux Installation (LinuxCOE)" linuxcoe "Physical local disk (LinuxCOE)" - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/linuxcoe - # creating the tables - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$USERNAME --http-password=$PASSWORD "$OPENQRM_WEB_PROTOCOL://localhost/openqrm/base/plugins/linuxcoe/linuxcoe-action.php?linuxcoe_command=init"; then - linuxcoe_log init "ERROR: Could not create the linuxcoe plugin tables in the database!" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/linuxcoe - exit 1 - fi - a2enmod cgi - openqrm_webserver reload - # install linuxcoe - if ! $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/bin/openqrm-linuxcoe install; then - linuxcoe_log init "ERROR: Could not install LinuxCOE!" - fi - - # fix 1 for >= Ubuntu 14.04 - apache options - sed -i -e "s/Options ExecCGI -MultiViews SymLinksIfOwnerMatch/Options ExecCGI SymLinksIfOwnerMatch/g" $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/linuxcoe-sd/etc/includes/LinuxCOE-SystemDesigner.conf - openqrm_webserver reload - - # fix 1 for >= Ubuntu 14.04 - coe_bootimage perl stricts errors - if ! $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/linuxcoe-sd/cgi-bin/coe_bootimage 2>/dev/null; then - if [ ! -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/linuxcoe-sd/cgi-bin/coe_bootimage.original ]; then - echo "- backing up $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/linuxcoe-sd/cgi-bin/coe_bootimage" - cp -af $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/linuxcoe-sd/cgi-bin/coe_bootimage $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/linuxcoe-sd/cgi-bin/coe_bootimage.original - fi - echo "- patching $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/linuxcoe-sd/cgi-bin/coe_bootimage" - tar -C $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/linuxcoe-sd/cgi-bin/ -xzvf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/templates/coe_bootimage_4.3.pachted.tgz - fi - - # link the image + template hooks - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/image.linuxcoe-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.linuxcoe-deployment.php - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/template.linuxcoe-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/template.linuxcoe-deployment.php - # creating place for autoinstall files - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/bin/openqrm-linuxcoe-autoinstall-client $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/lcoe/openqrm-linuxcoe-autoinstall-client - # creating the dir for the linuxcoe profiles - mkdir -p $LINUXCOE_PROFILE_DIR - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/stat/ - chmod -R 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/stat/ - echo "Order deny,allow" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/stat/.htaccess - echo "Deny from all" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/stat/.htaccess - -} - - -USER=$2 -PASS=$3 - -case "$1" in - start) - openqrm_plugin_linuxcoe_start - ;; - stop) - openqrm_plugin_linuxcoe_stop - ;; - restart) - openqrm_plugin_linuxcoe_stop - sleep 1 - openqrm_plugin_linuxcoe_start - ;; - init) - openqrm_plugin_linuxcoe_init $USER $PASS - ;; - uninstall) - openqrm_plugin_linuxcoe_uninstall $USER $PASS - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/init.d/openqrm-plugin-linuxcoe.postinstall b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/init.d/openqrm-plugin-linuxcoe.postinstall deleted file mode 100644 index 98e0979..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/init.d/openqrm-plugin-linuxcoe.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-linuxcoe postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/init.d/openqrm-plugin-linuxcoe.preremove b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/init.d/openqrm-plugin-linuxcoe.preremove deleted file mode 100644 index d4f99ca..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/init.d/openqrm-plugin-linuxcoe.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-linuxcoe preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-linuxcoe stop diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/openqrm-plugin-linuxcoe.conf b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/openqrm-plugin-linuxcoe.conf deleted file mode 100644 index b0fe4ed..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/openqrm-plugin-linuxcoe.conf +++ /dev/null @@ -1,40 +0,0 @@ -# this is the openQRM-plugin-linuxcoe info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.1.6" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, libapache2-mod-perl2, screen, make, autoconf, automake, genisoimage, sudo, nfs-kernel-server, nfs-common" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen, make, autoconf, automake, mkisofs, sudo, nfs-utils, perl-CGI" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen, make, autoconf, automake, cdrkit-cdrtools-compat, genisoimage, sudo, nfs-client" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Integrates LinuxCOE Install Server for automatic Linux deployments (local-deployment)." -OPENQRM_PLUGIN_TYPE="deployment" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="dhcpd, tftpd" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/etc/openqrm-plugin-linuxcoe.conf" - -# seconds to wait for the linuxcoe-auto-installation to start -OPENQRM_PLUGIN_LINUXCOE_INSTALL_START_DELAY=240 diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/data/bundles-CentOS-6 b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/data/bundles-CentOS-6 deleted file mode 100644 index fbc6c81..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/data/bundles-CentOS-6 +++ /dev/null @@ -1,45 +0,0 @@ -Administration Tools -Authoring and Publishing -Base -Clustering -Cluster Storage -Core -Development Libraries -Development Tools -Dialup Networking Support -DNS Name Server -Editors -Emacs -Engineering and Scientific -FTP Server -Games and Entertainment -GNOME Desktop Environment -GNOME Software Development -Graphical Internet -Graphics -Java -Java Development -KDE (K Desktop Environment) -KDE Software Development -Legacy Network Server -Legacy Software Development -Legacy Software Support -Mail Server -Miscellaneous Included Packages -MySQL Database -Network Servers -News Server -Office/Productivity -PostgreSQL Database -Printing Support -Ruby -Server Configuration Tools -Sound and Video -System Tools -Text-based Internet -Virtualization -Virtualization -Web Server -Windows File Server -X Software Development -X Window System diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/data/bundles-Debian-Wheezy b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/data/bundles-Debian-Wheezy deleted file mode 100644 index fcd8829..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/data/bundles-Debian-Wheezy +++ /dev/null @@ -1,8 +0,0 @@ -database-server -desktop -dns-server -file-server -laptop -mail-server -print-server -web-server diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/data/bundles-Ubuntu-Trusty b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/data/bundles-Ubuntu-Trusty deleted file mode 100644 index 238e653..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/data/bundles-Ubuntu-Trusty +++ /dev/null @@ -1,31 +0,0 @@ -dns-server -edubuntu-desktop -edubuntu-desktop-gnome -edubuntu-desktop-kde -edubuntu-server -eucalyptus-cloud -eucalyptus-cluster -eucalyptus-node -eucalyptus-storage -eucalyptus-walrus -kubuntu-desktop -kubuntu-netbook -lamp-server -mail-server -minimal -mythbuntu-backend-master -mythbuntu-backend-slave -mythbuntu-desktop -mythbuntu-frontend -openssh-server -postgresql-server -print-server -samba-server -server -standard -tomcat-server -ubuntu-desktop -ubuntu-netbook -uec -virt-host -xubuntu-desktop diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/data/disk_data b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/data/disk_data deleted file mode 100644 index bb08b22..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/data/disk_data +++ /dev/null @@ -1,18 +0,0 @@ -# disk_data - There are the choices in the disk pulldown -/dev/vda VIRTIO:0 - First Virtual Disk (vda) -/dev/vdb VIRTIO:1 - Second Virtual Disk (vdb) -/dev/hda IDE0:0 - First IDE Master (hda1) -/dev/hdb IDE0:1 - First IDE Slave (hdb) -/dev/hdc IDE1:0 - Second IDE Master (hdc) -/dev/hdd IDE1:1 - Second IDE Slave (hdd) -/dev/sda SCSI0:0 - First SATA or SCSI disk (sda) -/dev/sdb SCSI0:1 - Second SATA or SCSI disk (sdb) -/dev/ida/c0d0 First CPQ Integrated Smart Array LUN (ida/c0d0) -/dev/ida/c0d1 Second CPQ Integrated Smart Array LUN (ida/c0d1) -/dev/cciss/c0d0 CPQ array LUN (cciss/c0d0) -/dev/cciss/c0d1 CPQ array LUN (cciss/c0d1) -/dev/cciss/c0d2 CPQ array LUN (cciss/c0d2) -/dev/cciss/c0d3 CPQ array LUN (cciss/c0d3) -/dev/cciss/c0d4 CPQ array LUN (cciss/c0d4) -/dev/cciss/c0d5 CPQ array LUN (cciss/c0d5) -/dev/cciss/c0d6 CPQ array LUN (cciss/c0d6) diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/depots/apt-Debian-Wheezy b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/depots/apt-Debian-Wheezy deleted file mode 100644 index 0a4c978..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/depots/apt-Debian-Wheezy +++ /dev/null @@ -1,7 +0,0 @@ - -deb @METHOD@ftp.de.debian.org/debian wheezy main contrib non-free -#deb-src deb @METHOD@ftp.us.debian.org/debian wheezy main contrib non-free - -deb @METHOD@security.debian.org/ wheezy/updates main contrib non-free -#deb-src @METHOD@security.debian.org/ wheezy/updates main contrib non-free - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/depots/apt-Ubuntu-Trusty b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/depots/apt-Ubuntu-Trusty deleted file mode 100644 index 92ced4e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/depots/apt-Ubuntu-Trusty +++ /dev/null @@ -1,4 +0,0 @@ - -deb @METHOD@ftp.halifax.rwth-aachen.de/ubuntu trusty main -#deb-src deb @METHOD@archive.ubuntu.com/ubuntu trusty main - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/depots/yum-CentOS-6 b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/depots/yum-CentOS-6 deleted file mode 100644 index 6de97b1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/depots/yum-CentOS-6 +++ /dev/null @@ -1,61 +0,0 @@ -# CentOS-Base.repo -# -# This file uses a new mirrorlist system developed by Lance Davis for CentOS. -# The mirror system uses the connecting IP address of the client and the -# update status of each mirror to pick mirrors that are updated to and -# geographically close to the client. You should use this for CentOS updates -# unless you are manually picking other mirrors. -# -# If the mirrorlist= does not work for you, as a fall back you can try the -# remarked out baseurl= line instead. -# -# - -[base] -name=CentOS-$releasever - Base -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os -#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ -gpgcheck=1 -gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 - -#released updates -[update] -name=CentOS-$releasever - Updates -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates -#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ -gpgcheck=1 -gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 - -#packages used/produced in the build but not released -[addons] -name=CentOS-$releasever - Addons -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons -#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/ -gpgcheck=1 -gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 - -#additional packages that extend functionality of existing packages -[centosplus] -name=CentOS-$releasever - Plus -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus -#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ -gpgcheck=1 -enabled=0 -gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 - -#additional packages that may be useful -[extras] -name=CentOS-$releasever - Extras -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras -#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ -gpgcheck=1 -gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 - -#fasttrack -[fasttrack] -name=CentOS-$releasever - fasttrack -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=fasttrack -#baseurl=http://mirror.centos.org/centos/$releasever/fasttrack/$basearch/ -gpgcheck=1 -enabled=0 -gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/linuxcoe-pxe.autoyast b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/linuxcoe-pxe.autoyast deleted file mode 100644 index 3335734..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/linuxcoe-pxe.autoyast +++ /dev/null @@ -1,9 +0,0 @@ -default linux - -label linux -kernel boot/@@OPENQRM_BOOTIMAGE_KERNEL@@ -append ramdisk_size=65536 initrd=boot/@@OPENQRM_BOOTIMAGE_INITRD@@ acpi=off apm=off autoyast=http://@@OPENQRM_SERVER_IP_ADDRESS@@/openqrm/boot-service/lcoe/autoyast.@@OPENQRM_RESOURCE_ID@@-@@LINUXCOE_PROFILE_NAME@@.xml info=http://@@OPENQRM_SERVER_IP_ADDRESS@@/openqrm/boot-service/lcoe/info.@@OPENQRM_RESOURCE_ID@@-@@LINUXCOE_PROFILE_NAME@@ id=@@OPENQRM_RESOURCE_ID@@ openqrm=@@OPENQRM_SERVER_IPADDRESS@@ selinux=0 -ipappend 3 - -label local -LOCALBOOT 0 diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/linuxcoe-pxe.kickstart b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/linuxcoe-pxe.kickstart deleted file mode 100644 index 2afc0a4..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/linuxcoe-pxe.kickstart +++ /dev/null @@ -1,9 +0,0 @@ -default linux - -label linux -kernel boot/@@OPENQRM_BOOTIMAGE_KERNEL@@ -append ramdisk_size=131072 initrd=boot/@@OPENQRM_BOOTIMAGE_INITRD@@ ksdevice=@@PARAM_RESOURCE_MAC@@ ks=http://@@OPENQRM_SERVER_IP_ADDRESS@@/openqrm/boot-service/lcoe/ks.@@OPENQRM_RESOURCE_ID@@-@@LINUXCOE_PROFILE_NAME@@.cfg -ipappend 3 - -label local -LOCALBOOT 0 diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/linuxcoe-pxe.preseed b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/linuxcoe-pxe.preseed deleted file mode 100644 index 4da4d64..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/linuxcoe-pxe.preseed +++ /dev/null @@ -1,12 +0,0 @@ -default linux - -label linux -kernel boot/@@OPENQRM_BOOTIMAGE_KERNEL@@ -append ramdisk_size=131072 initrd=boot/@@OPENQRM_BOOTIMAGE_INITRD@@ locale=en_US console-setup/layoutcode=en_US languagechooser/language-name=@@LINUXCOE_INSTALL_LANGUAGE@@ interface=eth0 auto=true preseed/locale=en_US kbd-chooser/method=us preseed/url=http://@@OPENQRM_SERVER_IP_ADDRESS@@/openqrm/boot-service/lcoe/preseed.@@OPENQRM_RESOURCE_ID@@-@@LINUXCOE_PROFILE_NAME@@.cfg root=/dev/ram rw debconf/priority=critical debian-installer/framebuffer=false -ipappend 3 - - -label local -LOCALBOOT 0 - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/osvend.d/CentOS b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/osvend.d/CentOS deleted file mode 100644 index 7d9a116..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/osvend.d/CentOS +++ /dev/null @@ -1,10 +0,0 @@ - -# Examples (for supported versions of CentOS): -# other sites listed at -# http://www.centos.org/modules/tinycontent/index.php?id=13 -# the path (last component) must be the prefix -# (but not include) the "CentOS/base" directory - - -OSVEND ftp.halifax.rwth-aachen.de CentOS 6 x86_64 HTTP /centos/6/os/x86_64 - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/osvend.d/Debian b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/osvend.d/Debian deleted file mode 100644 index 8d06ede..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/osvend.d/Debian +++ /dev/null @@ -1,9 +0,0 @@ - -# Examples (for supported versions of Debian): -# other sites listed at -# http://www.debian.org/mirror/list -# the path (last component) must be the prefix -# (but not include) the "dists" directory - -OSVEND ftp.de.debian.org Debian Wheezy x86_64 HTTP /debian/ - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/osvend.d/Ubuntu b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/osvend.d/Ubuntu deleted file mode 100644 index 453803d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/osvend.d/Ubuntu +++ /dev/null @@ -1,9 +0,0 @@ - -# Examples (for supported versions of Ubuntu): -# other sites listed at -# https://wiki.ubuntu.com/Archive -# the path (last component) must be the prefix -# (but not include) the "dists" directory - -OSVEND ftp.halifax.rwth-aachen.de Ubuntu Trusty x86_64 HTTP /ubuntu/ - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/patches/nph-coe_image.diff b/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/patches/nph-coe_image.diff deleted file mode 100644 index a56d09d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/etc/templates/patches/nph-coe_image.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- cgi-bin/nph-coe_image.org 2012-06-19 19:03:38.130887467 +0200 -+++ cgi-bin/nph-coe_image 2012-06-19 19:30:05.530887457 +0200 -@@ -223,7 +223,7 @@ - print KS "# ks.cfg : Created by $BRAND at ".`date`; - print KS "# COE-Profile used: $profile\n"; - print KS "lang ".$qin->param('lang')."\n" unless ($version =~ /^ESX-4/); -- unless (( $os =~ /Fedora/ ) || ( $version =~ /^ESX-4/)) { -+ unless (( $os =~ /Fedora/ ) || ( $os =~ /CentOS/ ) || ( $version =~ /^ESX-4/)) { - print KS "langsupport --default ".$qin->param('lang')."\n"; - print KS "mouse ".$qin->param('mouse')."\n"; - } diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/include/openqrm-plugin-linuxcoe-functions b/openQRM-5.3.50-CE/src/plugins/linuxcoe/include/openqrm-plugin-linuxcoe-functions deleted file mode 100644 index 01ed43d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/include/openqrm-plugin-linuxcoe-functions +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# this is the functions file for the linuxcoe-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -LINUXCOE_PROFILE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/web/profiles" -LINUXCOE_SYSTEMDESIGNER_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/linuxcoe-sd/var/cache/linuxcoe-sd/scratchmonkey/systemdesigner" -LINUXCOE_ISO_DIRECTORY="/linuxcoe" -NFSEXPORTS="/etc/exports" -################ common linuxcoe functions - -# logs for linuxcoe -function linuxcoe_log() { - local COMPONENT=$1 - shift - local MESSAGE=$@ - echo "linuxcoe plug-in" "$COMPONENT : $MESSAGE" - logger -i -t "linuxcoe plug-in" "$COMPONENT : $MESSAGE" -} - - -################ linuxcoe functions - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/sbin/openqrm-linuxcoe-monitord b/openQRM-5.3.50-CE/src/plugins/linuxcoe/sbin/openqrm-linuxcoe-monitord deleted file mode 100644 index 37c1026..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/sbin/openqrm-linuxcoe-monitord +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -# this script automatically monitors kvm vms -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# this script automatically monitors linuxcoe auto-installations -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/linuxcoe/include/openqrm-plugin-linuxcoe-functions -OPENQRM_POSTENCODE="$OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-postencode" -openqrm_server_get_config -export resource_id=0 -export resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -export SERVER_PROTOCOL=$OPENQRM_WEB_PROTOCOL -export resource_senddelay=10 -export LANG=C -OPENQRM_EVENT="statistics" -OPENQRM_ACTIVE_STATE="transition" -OPENQRM_STARTING_STATE="starting" - -# define wget to use with https -if [ "$SERVER_PROTOCOL" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate --random-file=/dev/random" -fi - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - -# mac is the identifier -RESOURCE_ID=$1 -RESOURCE_MAC=$2 -if [ "$RESOURCE_ID" == "" ] || [ "$RESOURCE_MAC" == "" ]; then - echo "Usage: $0 " - exit 1 -fi - - -# local used functions -function send_info() { - current_state=$OPENQRM_ACTIVE_STATE - current_event=$OPENQRM_EVENT - MESSAGEDATA="resource_id=$RESOURCE_ID&resource_uptime=$current_uptime&resource_state=$current_state&resource_event=$current_event"; - OPENQRM_RESOURCE_INFO_URL="$SERVER_PROTOCOL://$resource_openqrmserver/openqrm/action/resource-monitor.php?resource_command=update_info&$MESSAGEDATA" - wget $WGET_NO_CERT_CHECK -q -O /dev/null "$OPENQRM_RESOURCE_INFO_URL" -} - - - -# uptime -function find_uptime() { - if [ -f /proc/uptime ]; then - current_uptime=`cat /proc/uptime | cut -d'.' -f 1` - fi - if [ -z "$current_uptime" ]; then - current_uptime=0 - fi -} - - - -# main loop -while (true); do - # we need to send transaction first, then check - # the resource may have rebooted slow and send active before reboot - # uptime - find_uptime - # sending statistics - send_info - # delay - sleep $resource_senddelay - # get install state - wget $WGET_NO_CERT_CHECK -q -O /tmp/openqrm-parameters.$RESOURCE_MAC.conf "$SERVER_PROTOCOL://$resource_openqrmserver/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_id=$RESOURCE_ID&resource_mac=$RESOURCE_MAC" - . /tmp/openqrm-parameters.$RESOURCE_MAC.conf - rm -f /tmp/openqrm-parameters.$RESOURCE_MAC.conf - if echo $resource_state | grep active 1>/dev/null; then - # ready installed, exit the montird - exit 0 - fi -done -# never reached -exit 0 - - - - - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-about.bootservice.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-about.bootservice.class.php deleted file mode 100644 index 78924d1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-about.bootservice.class.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ - -class linuxcoe_about_bootservice -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "linuxcoe_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/linuxcoe-about-bootservice.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['boot_service_title'], 'boot_service_title'); - $t->add($this->lang['boot_service_content'], 'boot_service_content'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-about.controller.class.php deleted file mode 100644 index 1a9db55..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-about.controller.class.php +++ /dev/null @@ -1,277 +0,0 @@ - - */ - - -class linuxcoe_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'linuxcoe_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'linuxcoe_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'linuxcoe_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About LinuxCOE', - 'label' => 'About LinuxCOE', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The "LinuxCOE" plugin integrates LinuxCOE Install Server for automatic Linux deployments. - LinuxCOE comes with a user-friendly UI to create automatic Linux installations for different distributions (Debian/Ubuntu/CentOS etc.) resulting in ISO files/images which can be used to - fully automatically install physical Server and also Virtual Machines.
    The integration of LinuxCOE in openQRM provides two different modes:

    - - Automatic Installations from ISO
    - After creating an Installation Template the resulting ISO image can be burned on an CD to automatically install a physical Server (the initial goal of the LinuxCOE Project).

    - In openQRM the LinuxCOE ISO Images are also automatically available on Virtualization Host from the type "local-deployment VMs" (e.g. "kvm-storage" and "xen-storage") in the /linuxcoe-iso directory. - Simply configure a Virtual Machine to boot from such a LinuxCOE ISO image for an fully automatic VM installation.

    - Please notice that after a successfull installation the VM will most likely try to boot from the ISO image again after the automatic install procedure finished! - Please stop the VMs Appliance after the initial automatic installation, then re-configure the Virtual Machine to boot from "local" and start the Appliance again.

    - - Automatic Network-Installations
    - The LinuxCOE integration in openQRM provides the capability to use the pre-configured automatic installations templates also for "network-deployment". - For "network-deployment" physical Server and Virtual Machines from the type "local-deployment for VMs" (e.g. "kvm-storage" and "xen-storage") are supported.
    - -> physical Server and VMs for "network-deployment" must be set to network-boot (PXE) either in the BIOS or VM configuration!

    - The deployment of the LinuxCOE templates works via openQRMs "install-from-template" mechanism which allows to attach those automatic installation templates to Images. - For Virtual Machines the templates can be directly attached to the Virtual Machines Image, for physical Server please create an Image pointing to a local disk with the LinuxCOE "Image Manager".

    - Starting an Appliance with an LinuxCOE automatic installation template attached to its Image automatically applies the specified configuration and automatically installs the systems.

    - Network-deploying LinuxCOE templates automatically installs the openQRM-Client and integrates the system into openQRM. - After the automatic installation the resource (physical Server or VM) is automatically set to local-boot.

    - - Cloud deployment
    - Images with an attached LinuxCOE Automatic Network-Installation template are fully supported for Cloud-deployment!

    ', - - 'requirements_title' => 'Requirements', - 'requirements_list' => '
    • A LinuxCOE Install Server Storage using the openQRM as the resource
    • -
    • The following packages must be installed: screen, make, autoconf, automake, genisoimage, sudo, nfs-kernel-server, nfs-common
    ', - - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - - 'provides_title' => 'Provides', - 'provides_list' => '
    • Storage type: "linuxcoe-deployment"
    • -
    • Deployment types: "Automatic Linux Installation (LinuxCOE)"
    ', - - 'howto_title' => 'How to use', - 'howto_list' => '
    • Create a new Storage from type "linuxcoe-deployment" using the openQRM Server as the resource
    • -
    • Create one or more LinuxCOE Installation Templates
    • -
    • Use the Template Manager to add a description to your Installation Templates
    • -
    • Choose either Automatic Installations from ISO or Automatic Network-Installations to deploy the Templates
    ', - - 'type_title' => 'Plugin Type', - 'type_content' => 'Deployment', - - 'deployment_title' => 'Deployment Type', - 'deployment_content' => 'Local-Deployment', - - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - 'network_deploymet' => 'Network-Deployment', - 'doc1' => '', - ), - 'bootservice' => array ( - 'tab' => 'Boot-Service', - 'label' => 'LinuxCOE Boot-Service', - 'boot_service_title' => 'LinuxCOE Boot-Service', - 'boot_service_content' => 'The LinuxCOE Plugin provides an openQRM Boot-Service. - This "LinuxCOE Boot-Service" is automatically downloaded and executed by the openQRM-Client on all integrated Systems. - The Boot-Service is located at:
    -
    - /usr/share/openqrm/plugins/linuxcoe/web/boot-service-linuxcoe.tgz -
    -
    - The "LinuxCOE Boot-Service contains the Client files of the LinuxCOE Plugin.
    - Also a configuration file for the LinuxCOE server is included in this Boot-Service.
    -
    - The Boot-Service configuration can be viewed and administrated by the "openqrm" utility.
    - To view the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n linuxcoe -a default -
    -
    - To view a Boot-Service configuration of a specific appliance run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n linuxcoe -a [appliance-name] -
    -
    - To adapt a parameter in the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n linuxcoe -a default -k [key] -v [value] -
    -
    - To adapt a paramter in the Boot-Service configuration of a specific appliance run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n linuxcoe -a [appliance-name] -k [key] -v [value] -
    -
    - ', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/linuxcoe/lang", 'linuxcoe-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/linuxcoe/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "documentation"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - case 'bootservice': - $content[] = $this->bootservice(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About LinuxCOE - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/linuxcoe/class/linuxcoe-about.documentation.class.php'); - $controller = new linuxcoe_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Boot-Service - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function bootservice( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/linuxcoe/class/linuxcoe-about.bootservice.class.php'); - $controller = new linuxcoe_about_bootservice($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['bootservice']; - $data = $controller->action(); - } - $content['label'] = $this->lang['bootservice']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'bootservice' ); - $content['onclick'] = false; - if($this->action === 'bootservice'){ - $content['active'] = true; - } - return $content; - } - - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-about.documentation.class.php deleted file mode 100644 index 978ea66..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-about.documentation.class.php +++ /dev/null @@ -1,91 +0,0 @@ - - */ - -class linuxcoe_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "linuxcoe_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/linuxcoe-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['deployment_title'], 'deployment_title'); - $t->add($this->lang['deployment_content'], 'deployment_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['howto_title'], 'howto_title'); - $t->add($this->lang['howto_list'], 'howto_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-template.controller.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-template.controller.class.php deleted file mode 100644 index 9671bbb..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-template.controller.class.php +++ /dev/null @@ -1,299 +0,0 @@ - -*/ - - -class linuxcoe_template_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'linuxcoe_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'linuxcoe_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'linuxcoe_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array ( - 'tab' => 'LinuxCOE Templates', - 'label' => 'LinuxCOE Automatic Installation Templates', - 'action_edit' => 'edit', - 'action_remove' => 'remove', - 'table_name' => 'Name', - 'table_id' => 'ID', - 'table_comment' => 'Description', - 'please_wait' => 'Loading LinuxCOE Templates. Please wait ..', - ), - 'edit' => array ( - 'tab' => 'Edit LinuxCOE Template', - 'label' => 'Edit LinuxCOE Template %s description', - 'form_comment' => 'Description', - 'form_post' => 'Custom POST-Install section', - 'msg_edit' => 'Updated LinuxCOE Template %s', - 'error_comment' => 'Comment must be %s', - 'please_wait' => 'Loading LinuxCOE Templates. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'remove' => array ( - 'tab' => 'Remove LinuxCOE Templates', - 'label' => 'Remove LinuxCOE Template(s)', - 'msg_removed' => 'Removed Volume %s', - 'please_wait' => 'Removing Volume(s). Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), -); - -var $openqrm_base_dir; -var $openqrm; -var $openqrm_ip; -var $event; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->basedir = $this->openqrm->get('basedir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/linuxcoe/lang", 'linuxcoe-template.ini'); - $this->tpldir = $this->rootdir.'/plugins/linuxcoe/tpl'; - require_once $this->rootdir."/class/folder.class.php"; - $this->folder = new folder(); - $this->openqrm_server = new openqrm_server(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "select"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'select': - $content[] = $this->select(true); - break; - case 'remove': - $content[] = $this->select(false); - $content[] = $this->remove(true); - break; - case 'edit': - $content[] = $this->select(false); - $content[] = $this->edit(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * Select template - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - if($this->reload()) { - require_once($this->rootdir.'/plugins/linuxcoe/class/linuxcoe-template.select.class.php'); - $controller = new linuxcoe_template_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->identifier_name = $this->identifier_name; - $controller->folder = $this->folder; - $controller->webdir = $this->rootdir; - $controller->basedir = $this->basedir; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - - - //-------------------------------------------- - /** - * Remove template - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function remove( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/linuxcoe/class/linuxcoe-template.remove.class.php'); - $controller = new linuxcoe_template_remove($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->identifier_name = $this->identifier_name; - $controller->folder = $this->folder; - $controller->webdir = $this->rootdir; - $controller->basedir = $this->basedir; - $controller->openqrm_server = $this->openqrm_server; - $controller->lang = $this->lang['remove']; - $data = $controller->action(); - } - $content['label'] = $this->lang['remove']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'remove' ); - $content['onclick'] = false; - if($this->action === 'remove'){ - $content['active'] = true; - } - return $content; - } - - - - //-------------------------------------------- - /** - * Edit template - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function edit( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/linuxcoe/class/linuxcoe-template.edit.class.php'); - $controller = new linuxcoe_template_edit($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->identifier_name = $this->identifier_name; - $controller->folder = $this->folder; - $controller->webdir = $this->rootdir; - $controller->basedir = $this->basedir; - $controller->openqrm_server = $this->openqrm_server; - $controller->lang = $this->lang['edit']; - $data = $controller->action(); - } - $content['label'] = $this->lang['edit']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'edit' ); - $content['onclick'] = false; - if($this->action === 'edit'){ - $content['active'] = true; - } - return $content; - } - - - - //-------------------------------------------- - /** - * Reload Profiles - * - * @access public - */ - //-------------------------------------------- - function reload() { - $command = $this->basedir.'/plugins/linuxcoe/bin/openqrm-linuxcoe-manager check'; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - $file = $this->basedir.'/plugins/linuxcoe/web/stat/check'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $this->openqrm_server->send_command($command, NULL, true); - while (!$this->file->exists($file)) - { - usleep(10000); - clearstatcache(); - } - return true; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-template.edit.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-template.edit.class.php deleted file mode 100644 index b0f8204..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-template.edit.class.php +++ /dev/null @@ -1,181 +0,0 @@ - - */ - - -class linuxcoe_template_edit -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'linuxcoe_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'linuxcoe_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'linuxcoe_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->template_name = $response->html->request()->get('linuxcoe_template'); - $this->response->add('linuxcoe_template', $this->template_name); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - - $response = $this->edit(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - - $t = $this->response->html->template($this->tpldir."/linuxcoe-template-edit.tpl.php"); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add(sprintf($this->lang['label'], $this->template_name), 'label'); - $t->add($response->form); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function edit() { - - $response = $this->get_response(); - $form = $response->form; - - if(!$form->get_errors() && $response->submit()) { - $template_comment = $this->response->html->request()->get('template_comment'); - $template_post = $this->response->html->request()->get('template_post'); - file_put_contents($this->webdir."/plugins/linuxcoe/profiles/".$this->template_name."/openqrm.info", $template_comment); - if (strlen($template_post)) { - file_put_contents($this->webdir."/plugins/linuxcoe/profiles/".$this->template_name."/custom-post.info", $template_post."\n"); - } - $response->msg = sprintf($this->lang['msg_edit'], $this->template_name); - } - return $response; - - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'edit'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $lcoe_profile_comment_str = ''; - if (file_exists($this->webdir."/plugins/linuxcoe/profiles/".$this->template_name."/openqrm.info")) { - $lcoe_profile_comment_str = trim(file_get_contents($this->webdir."/plugins/linuxcoe/profiles/".$this->template_name."/openqrm.info")); - } - - $lcoe_profile_post_str = ''; - if (file_exists($this->webdir."/plugins/linuxcoe/profiles/".$this->template_name."/custom-post.info")) { - $lcoe_profile_post_str = trim(file_get_contents($this->webdir."/plugins/linuxcoe/profiles/".$this->template_name."/custom-post.info")); - } - - $d['template_comment']['label'] = $this->lang['form_comment']; - $d['template_comment']['validate']['regex'] = '/^[a-z0-9._ -]+$/i'; - $d['template_comment']['validate']['errormsg'] = sprintf($this->lang['error_comment'], 'a-z0-9._ -'); - $d['template_comment']['object']['type'] = 'htmlobject_textarea'; - $d['template_comment']['object']['attrib']['name'] = 'template_comment'; - $d['template_comment']['object']['attrib']['value'] = $lcoe_profile_comment_str; - - $d['template_post']['label'] = $this->lang['form_post']; - $d['template_post']['validate']['regex'] = ''; - $d['template_post']['object']['type'] = 'htmlobject_textarea'; - $d['template_post']['object']['attrib']['name'] = 'template_post'; - $d['template_post']['object']['attrib']['value'] = $lcoe_profile_post_str; - - $form->add($d); - $response->form = $form; - return $response; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-template.remove.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-template.remove.class.php deleted file mode 100644 index 97b41c8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-template.remove.class.php +++ /dev/null @@ -1,179 +0,0 @@ - -*/ - - - -class linuxcoe_template_remove -{ - -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'linuxcoe_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'linuxcoe_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'linuxcoe_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Action New - * - * @access public - * @param enum $type [file|folder] - * @return htmlobject_response - */ - //-------------------------------------------- - function action() { - $response = $this->remove(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir."/linuxcoe-template-remove.tpl.php"); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($response->form); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Remove - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function remove() { - $response = $this->get_response(); - $template_names = $response->html->request()->get($this->identifier_name); - $form = $response->form; - if( $template_names !== '' ) { - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $i = 0; - foreach($template_names as $ex) { - $d['param_f'.$i]['label'] = $ex; - $d['param_f'.$i]['object']['type'] = 'htmlobject_input'; - $d['param_f'.$i]['object']['attrib']['type'] = 'checkbox'; - $d['param_f'.$i]['object']['attrib']['name'] = $this->identifier_name.'['.$i.']'; - $d['param_f'.$i]['object']['attrib']['value'] = $ex; - $d['param_f'.$i]['object']['attrib']['checked'] = true; - $i++; - } - $form->add($d); - if(!$form->get_errors() && $response->submit()) { - $errors = array(); - $message = array(); - foreach($template_names as $key => $template_name) { - $command = $this->basedir.'/plugins/linuxcoe/bin/openqrm-linuxcoe-manager remove -n '.$template_name; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - $this->openqrm_server->send_command($command, NULL, true); - $form->remove($this->identifier_name.'['.$key.']'); - $message[] = sprintf($this->lang['msg_removed'], $template_name); - } - if(count($errors) === 0) { - $response->msg = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response->error = join('
    ', $msg); - } - } - } else { - $response->msg = ''; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'remove'); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-template.select.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-template.select.class.php deleted file mode 100644 index 5fdd314..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-template.select.class.php +++ /dev/null @@ -1,182 +0,0 @@ - -*/ - - - -class linuxcoe_template_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'linuxcoe_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'linuxcoe_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'linuxcoe_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Action New - * - * @access public - * @param enum $type [file|folder] - * @return htmlobject_response - */ - //-------------------------------------------- - function action() { - $table = $this->select(); - $template = $this->response->html->template($this->tpldir."/linuxcoe-template-select.tpl.php"); - $template->add($this->response->html->thisfile, "thisfile"); - $template->add($this->lang['label'], "linuxcoe_title"); - $template->add($table, 'table'); - $template->add($this->openqrm->get('baseurl'), 'baseurl'); - return $template; - } - - //-------------------------------------------- - /** - * Select - * - * @access protected - * @return htmlobject_response - */ - //-------------------------------------------- - function select() { -// $this->__response->html->debug(); - - $arHead = array(); - - $arHead['lcoe_profile_icon'] = array(); - $arHead['lcoe_profile_icon']['title'] =' '; - $arHead['lcoe_profile_icon']['sortable'] = false; - - $arHead['lcoe_profile_id'] = array(); - $arHead['lcoe_profile_id']['title'] = $this->lang['table_id']; - - $arHead['lcoe_profile_name'] = array(); - $arHead['lcoe_profile_name']['title'] = $this->lang['table_name']; - - $arHead['lcoe_profile_comment'] = array(); - $arHead['lcoe_profile_comment']['title'] = $this->lang['table_comment']; - - $arHead['lcoe_profile_edit'] = array(); - $arHead['lcoe_profile_edit']['title'] =' '; - $arHead['lcoe_profile_edit']['sortable'] = false; - - $table = $this->response->html->tablebuilder( 'table_linuxcoe_template', $this->response->get_array($this->actions_name, 'select')); - $table->css = 'htmlobject_table'; - $table->border = 0; - $table->limit = 10; - $table->id = 'Tabelle'; - $table->head = $arHead; - $table->sort = 'lcoe_profile_id'; - $table->autosort = true; - $table->form_action = $this->response->html->thisfile; - - $lcoe_profile_count=1; - $plugin_icon=$this->openqrm->get('baseurl')."/plugins/linuxcoe/img/plugin.png"; - $lcoe_profile_array = array(); - if (is_dir($this->webdir."/plugins/linuxcoe/profiles/")) { - $this->folder->getFolders($this->webdir."/plugins/linuxcoe/profiles/"); - foreach ($this->folder->folders as $lcoe_profile) { - array_push($lcoe_profile_array, $lcoe_profile); - } - } - if(count($lcoe_profile_array) > 0) { - foreach ($lcoe_profile_array as $lcoe) { - // check if a comment exists - if (file_exists($this->webdir."/plugins/linuxcoe/profiles/".$lcoe."/openqrm.info")) { - $lcoe_profile_comment_str = file_get_contents($this->webdir."/plugins/linuxcoe/profiles/".$lcoe."/openqrm.info"); - } - // edit button - $a = $this->response->html->a(); - $a->title = $this->lang['action_edit']; - $a->label = $this->lang['action_edit']; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($this->actions_name, "edit").'&linuxcoe_template='.$lcoe; - $edit_action = $a->get_string(); - - - $arBody[] = array( - 'lcoe_profile_icon' => 'LinuxCOE Installation Profile', - 'lcoe_profile_id' => $lcoe_profile_count, - 'lcoe_profile_name' => $lcoe, - 'lcoe_profile_comment' => $lcoe_profile_comment_str, - 'lcoe_profile_edit' => $edit_action, - ); - $lcoe_profile_count++; - } - $table->body = $arBody; - } - $table->max = $lcoe_profile_count-1; - $table->actions_name = $this->actions_name; - $table->actions = array(array('remove' => $this->lang['action_remove'])); - $table->sort_link = false; - $table->identifier = 'lcoe_profile_name'; - $table->identifier_name = $this->identifier_name; - return $table; - } - - - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-volume.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-volume.class.php deleted file mode 100644 index a14d6a1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe-volume.class.php +++ /dev/null @@ -1,355 +0,0 @@ - -*/ - - - $RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; - require_once "$RootDir/include/openqrm-server-config.php"; - require_once "$RootDir/include/openqrm-database-functions.php"; - require_once "$RootDir/class/event.class.php"; - -/** - * This class represents an linuxcoe_volume object - * - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - */ - - -class linuxcoe_volume -{ - -/** -* linuxcoe_volume id -* @access protected -* @var int -*/ -var $id = ''; -/** -* linuxcoe_volume name -* @access protected -* @var string -*/ -var $name = ''; -/** -* linuxcoe_volume root -* @access protected -* @var string -*/ -var $root = ''; -/** -* linuxcoe_volume description -* @access protected -* @var string -*/ -var $description = ''; - - -/** -* name of database table -* @access protected -* @var string -*/ -var $_db_table; -/** -* path to openqrm basedir -* @access protected -* @var string -*/ -var $_base_dir; -/** -* event object -* @access protected -* @var object -*/ -var $_event; - - //-------------------------------------------------- - /** - * Constructor - */ - //-------------------------------------------------- - function linuxcoe_volume() { - $this->init(); - } - - //-------------------------------------------------- - /** - * init storage environment - * @access public - */ - //-------------------------------------------------- - function init() { - global $OPENQRM_SERVER_BASE_DIR; - $this->_event = new event(); - $this->_db_table = "linuxcoe_volumes"; - $this->_base_dir = $OPENQRM_SERVER_BASE_DIR; - } - - //-------------------------------------------------- - /** - * get an instance of an linuxcoe_volume object from db - * @access public - * @param int $id - * @param string $name - * @return object - */ - //-------------------------------------------------- - function get_instance($id, $name) { - $linuxcoe_volume_array = array(); - $db=openqrm_get_db_connection(); - if ("$id" != "") { - $linuxcoe_volume_array = $db->Execute("select * from ".$this->_db_table." where linuxcoe_volume_id=".$id); - } else if ("$name" != "") { - $linuxcoe_volume_array = $db->Execute("select * from ".$this->_db_table." where linuxcoe_volume_name='".$name."'"); - } - foreach ($linuxcoe_volume_array as $index => $linuxcoe_volume) { - $this->id = $linuxcoe_volume["linuxcoe_volume_id"]; - $this->name = $linuxcoe_volume["linuxcoe_volume_name"]; - $this->root = $linuxcoe_volume["linuxcoe_volume_root"]; - $this->description = $linuxcoe_volume["linuxcoe_volume_description"]; - } - return $this; - } - - //-------------------------------------------------- - /** - * get an instance of an linuxcoe_volume by id - * @access public - * @param int $id - * @return object - */ - //-------------------------------------------------- - function get_instance_by_id($id) { - $this->get_instance($id, ""); - return $this; - } - - //-------------------------------------------------- - /** - * get an instance of an linuxcoe_volume by name - * @access public - * @param int $name - * @return object - */ - //-------------------------------------------------- - function get_instance_by_name($name) { - $this->get_instance("", $name); - return $this; - } - - - - //-------------------------------------------------- - /** - * add a new linuxcoe_volume - * @access public - * @param array $linuxcoe_volume_fields - */ - //-------------------------------------------------- - function add($linuxcoe_volume_fields) { - if (!is_array($linuxcoe_volume_fields)) { - $this->_event->log("add", $_SERVER['REQUEST_TIME'], 2, "linuxcoe-volume.class.php", "Fields not well defined", "", "", 0, 0, 0); - return 1; - } - $db=openqrm_get_db_connection(); - $result = $db->AutoExecute($this->_db_table, $linuxcoe_volume_fields, 'INSERT'); - if (! $result) { - $this->_event->log("add", $_SERVER['REQUEST_TIME'], 2, "linuxcoe-volume.class.php", "Failed adding new linuxcoe_volume to database", "", "", 0, 0, 0); - } - } - - //-------------------------------------------------- - /** - * update an linuxcoe_volume - * - * $fields = array(); - * $fields['linuxcoe_volume_name'] = 'somename'; - * $fields['linuxcoe_volume_uri'] = 'some-uri'; - * $linuxcoe_volume = new linuxcoe_volume(); - * $linuxcoe_volume->update(1, $fields); - * - * @access public - * @param int $linuxcoe_volume_id - * @param array $linuxcoe_volume_fields - * @return bool - */ - //-------------------------------------------------- - function update($linuxcoe_volume_id, $linuxcoe_volume_fields) { - if ($linuxcoe_volume_id < 0 || ! is_array($linuxcoe_volume_fields)) { - $this->_event->log("update", $_SERVER['REQUEST_TIME'], 2, "linuxcoe-volume.class.php", "Unable to update linuxcoe_volume $linuxcoe_volume_id", "", "", 0, 0, 0); - return 1; - } - $db=openqrm_get_db_connection(); - unset($linuxcoe_volume_fields["linuxcoe_volume_id"]); - $result = $db->AutoExecute($this->_db_table, $linuxcoe_volume_fields, 'UPDATE', "linuxcoe_volume_id = $linuxcoe_volume_id"); - if (! $result) { - $this->_event->log("update", $_SERVER['REQUEST_TIME'], 2, "linuxcoe-volume.class.php", "Failed updating linuxcoe_volume $linuxcoe_volume_id", "", "", 0, 0, 0); - } - } - - //-------------------------------------------------- - /** - * remove an linuxcoe_volume by id - * @access public - * @param int $linuxcoe_volume_id - */ - //-------------------------------------------------- - function remove($linuxcoe_volume_id) { - // remove from db - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from ".$this->_db_table." where linuxcoe_volume_id=".$linuxcoe_volume_id); - } - - //-------------------------------------------------- - /** - * remove an linuxcoe_volume by name - * @access public - * @param string $linuxcoe_volume_name - */ - //-------------------------------------------------- - function remove_by_name($linuxcoe_volume_name) { - // remove from db - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from ".$this->_db_table." where linuxcoe_volume_name='".$linuxcoe_volume_name."'"); - - } - - - //-------------------------------------------------- - /** - * get linuxcoe_volume name by id - * @access public - * @param int $linuxcoe_volume_id - * @return string - */ - //-------------------------------------------------- - function get_name($linuxcoe_volume_id) { - $db=openqrm_get_db_connection(); - $linuxcoe_volume_set = $db->Execute("select linuxcoe_volume_name from ".$this->_db_table." where linuxcoe_volume_id=".$linuxcoe_volume_id); - if (!$linuxcoe_volume_set) { - $this->_event->log("get_name", $_SERVER['REQUEST_TIME'], 2, "linuxcoe-volume.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - if (!$linuxcoe_volume_set->EOF) { - return $linuxcoe_volume_set->fields["linuxcoe_volume_name"]; - } else { - return "not found"; - } - } - } - - - - //-------------------------------------------------- - /** - * get an array of all linuxcoe_volume names - * - * $linuxcoe_volume = new linuxcoe_volume(); - * $arr = $linuxcoe_volume->get_list(); - * // $arr[0]['value'] - * // $arr[0]['label'] - * - * @access public - * @return array - */ - //-------------------------------------------------- - function get_list() { - $query = "select linuxcoe_volume_id, linuxcoe_volume_name from ".$this->_db_table." order by linuxcoe_volume_id ASC"; - $linuxcoe_volume_name_array = array(); - $linuxcoe_volume_name_array = openqrm_db_get_result_double ($query); - return $linuxcoe_volume_name_array; - } - - - //-------------------------------------------------- - /** - * get an array of all linuxcoe_volume ids - * - * $linuxcoe_volume = new linuxcoe_volume(); - * $arr = $linuxcoe_volume->get_ids(); - * // $arr['value'] - * - * @access public - * @return array - */ - //-------------------------------------------------- - function get_ids() { - $linuxcoe_volume_array = array(); - $query = "select linuxcoe_volume_id from ".$this->_db_table; - $db=openqrm_get_db_connection(); - $rs = $db->Execute($query); - if (!$rs) - $event->log("get_list", $_SERVER['REQUEST_TIME'], 2, "linuxcoe-volume.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $linuxcoe_volume_array[] = $rs->fields; - $rs->MoveNext(); - } - return $linuxcoe_volume_array; - } - - //-------------------------------------------------- - /** - * get number of linuxcoe_volume accounts - * @access public - * @return int - */ - //-------------------------------------------------- - function get_count() { - $count=0; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select count(linuxcoe_volume_id) as num from ".$this->_db_table); - if (!$rs) { - $this->_event->log("get_count", $_SERVER['REQUEST_TIME'], 2, "linuxcoe-volume.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - $count = $rs->fields["num"]; - } - return $count; - } - - - //-------------------------------------------------- - /** - * get an array of linuxcoe_volumes - * @access public - * @param int $offset - * @param int $limit - * @param string $sort - * @param enum $order [ASC/DESC] - * @return array - */ - //-------------------------------------------------- - function display_overview($offset, $limit, $sort, $order) { - $db=openqrm_get_db_connection(); - $recordSet = $db->SelectLimit("select * from ".$this->_db_table." order by $sort $order", $limit, $offset); - $linuxcoe_volume_array = array(); - if (!$recordSet) { - $this->_event->log("display_overview", $_SERVER['REQUEST_TIME'], 2, "linuxcoe-volume.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($linuxcoe_volume_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $linuxcoe_volume_array; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.add.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.add.class.php deleted file mode 100644 index 0273fd1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.add.class.php +++ /dev/null @@ -1,247 +0,0 @@ - - */ - -class linuxcoe_add -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'linuxcoe_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'linuxcoe_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'linuxcoe_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - $this->controller = $controller; - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->user = $openqrm->user(); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = $this->openqrm->storage(); - $resource = $this->openqrm->resource(); - $deployment = $this->openqrm->deployment(); - $this->response->params['storage_id'] = $this->response->html->request()->get('storage_id'); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - require_once($this->openqrm->get('basedir').'/plugins/linuxcoe/web/class/linuxcoe-volume.class.php'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->add(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/linuxcoe-add.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Add - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function add() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - if(!$form->get_errors()) { - $name = $form->get_request('name'); - $root = $form->get_request('root'); - $description = $form->get_request('description'); - - // check if volume / image name is aleady existing - $image_check = new image(); - $image_check->get_instance_by_name($name); - if (isset($image_check->id) && $image_check->id > 0) { - $error = sprintf($this->lang['error_image_exists'], $name); - } - - $linuxcoe_volume = new linuxcoe_volume(); - $linuxcoe_volume->get_instance_by_name($name); - if (isset($linuxcoe_volume->id) && $linuxcoe_volume->id > 0) { - $error = sprintf($this->lang['error_exists'], $name); - } - - if(isset($error)) { - $response->error = $error; - } else { - // add volume - $volume_fields = array(); - $volume_fields["linuxcoe_volume_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $volume_fields['linuxcoe_volume_name'] = $name; - $volume_fields['linuxcoe_volume_root'] = $root; - $volume_fields['linuxcoe_volume_description'] = $description; - $linuxcoe_volume->add($volume_fields); - // add image - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $name; - $image_fields['image_type'] = $this->deployment->type; - $image_fields['image_rootfstype'] = 'local'; - $image_fields['image_storageid'] = $this->storage->id; - $image_fields['image_comment'] = "Image Object for volume $name"; - $image_fields['image_rootdevice'] = 'local'; - $image_fields['image_size']=0; - $image = new image(); - $image->add($image_fields); - $response->msg = sprintf($this->lang['msg_added'], $name); - // save image id in response for the wizard - $response->image_id = $image_fields["image_id"]; - } - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'add'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $volume_root_arr[] = array("/dev/sda", "/dev/sda"); - $volume_root_arr[] = array("/dev/sdb", "/dev/sdb"); - $volume_root_arr[] = array("/dev/sdc", "/dev/sdc"); - $volume_root_arr[] = array("/dev/sdd", "/dev/sdd"); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['value'] = ''; - $d['name']['object']['attrib']['css'] = 'namegen'; - $d['name']['object']['attrib']['customattribs'] = 'data-prefix="linuxcoe_" data-length="8"'; - $d['name']['object']['attrib']['maxlength'] = 50; - - $d['root']['label'] = $this->lang['form_root']; - $d['root']['object']['type'] = 'htmlobject_select'; - $d['root']['object']['attrib']['name'] = 'root'; - $d['root']['object']['attrib']['index'] = array(0,1); - $d['root']['object']['attrib']['options'] = $volume_root_arr; - - $d['description']['label'] = $this->lang['form_description']; - $d['description']['required'] = true; - $d['description']['validate']['regex'] = '/^[a-z 0-9._]+$/i'; - $d['description']['validate']['errormsg'] = sprintf($this->lang['error_description'], 'a-z 0-9._'); - $d['description']['object']['type'] = 'htmlobject_input'; - $d['description']['object']['attrib']['name'] = 'description'; - $d['description']['object']['attrib']['type'] = 'text'; - $d['description']['object']['attrib']['value'] = ''; - $d['description']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.clone.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.clone.class.php deleted file mode 100644 index 04e8dce..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.clone.class.php +++ /dev/null @@ -1,223 +0,0 @@ - - */ - -class linuxcoe_clone -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'linuxcoe_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'linuxcoe_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'linuxcoe_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->file = $this->openqrm->file(); - $this->volume = $this->response->html->request()->get('volume'); - $this->response->params['volume'] = $this->volume; - require_once($this->openqrm->get('basedir').'/plugins/linuxcoe/web/class/linuxcoe-volume.class.php'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->duplicate(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/linuxcoe-clone.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add(sprintf($this->lang['label'], $this->volume), 'label'); - $t->add($response->form); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Clone - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function duplicate() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - $name = $form->get_request('name'); - - // check if volume / image name is aleady existing - $image_check = new image(); - $image_check->get_instance_by_name($name); - if (isset($image_check->id) && $image_check->id > 0) { - $error = sprintf($this->lang['error_image_exists'], $name); - } - - $linuxcoe_volume = new linuxcoe_volume(); - $linuxcoe_volume->get_instance_by_name($name); - if (isset($linuxcoe_volume->id) && $linuxcoe_volume->id > 0) { - $error = sprintf($this->lang['error_exists'], $name); - } - - if(isset($error)) { - $response->error = $error; - } else { - // add volume - $linuxcoe_volume->get_instance_by_name($this->volume); - $volume_fields = array(); - $volume_fields["linuxcoe_volume_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $volume_fields['linuxcoe_volume_name'] = $name; - $volume_fields['linuxcoe_volume_root'] = $linuxcoe_volume->root; - $volume_fields['linuxcoe_volume_description'] = $linuxcoe_volume->description; - $linuxcoe_volume->add($volume_fields); - // add image - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $name; - $image_fields['image_type'] = $deployment->type; - $image_fields['image_rootfstype'] = 'local'; - $image_fields['image_storageid'] = $storage->id; - $image_fields['image_comment'] = "Image Object for volume $name"; - $image_fields['image_rootdevice'] = 'local'; - $image_fields['image_size']=0; - $image = new image(); - $image->add($image_fields); - - $response->msg = sprintf($this->lang['msg_cloned'], $this->volume, $name); - // save image id in response for the wizard - $response->image_id = $image_fields["image_id"]; - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'clone'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['css'] = 'namegen'; - $d['name']['object']['attrib']['customattribs'] = 'data-prefix="linuxcoe_" data-length="8"'; - $d['name']['object']['attrib']['value'] = $this->volume.'_clone'; - $d['name']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.controller.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.controller.class.php deleted file mode 100644 index d02a7ea..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.controller.class.php +++ /dev/null @@ -1,393 +0,0 @@ - - */ - -class linuxcoe_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'linuxcoe_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'linuxcoe_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'linuxcoe_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array ( - 'tab' => 'Select LinuxCOE-storage', - 'label' => 'Select LinuxCOE-storage', - 'action_edit' => 'edit', - 'table_name' => 'Name', - 'table_id' => 'Id', - 'table_recource' => 'Resource', - 'table_type' => 'Type', - 'table_deployment' => 'Deployment', - 'error_no_storage' => 'No storage configured yet!

    Please create a LinuxCOE Storage first!', - 'new_storage' => 'New Storage', - 'please_wait' => 'Loading Storage. Please wait ..', - ), - 'edit' => array ( - 'tab' => 'Edit LinuxCOE-storage', - 'label' => 'LinuxCOE Volumes on storage %s', - 'lang_id' => 'ID', - 'lang_name' => 'Name', - 'lang_resource' => 'Resource', - 'lang_state' => 'State', - 'lang_vfree' => 'Free', - 'lang_vsize' => 'Total', - 'action_add' => 'Add new Volume', - 'action_refresh' => 'Reload Page', - 'action_manual' => 'Manual Configuration', - 'action_clone' => 'clone', - 'action_remove' => 'remove', - 'action_auth' => 'auth', - 'action_edit' => 'Edit Image of this Volume', - 'action_clone_in_progress' => 'Synchronisation in progress - Please wait', - 'action_clone_finished' => 'Syncronisation finished!', - 'table_name' => 'Name', - 'table_id' => 'ID', - 'table_root' => 'Root device', - 'table_description' => 'Description', - 'error_no_local' => 'Storage %s is not of type local-deployment', - 'please_wait' => 'Loading Volumes. Please wait ..', - 'manual_configured' => 'Storage is manually configured and can not be be edited by openQRM', - ), - 'add' => array ( - 'tab' => 'Add LinuxCOE Volume', - 'label' => 'Add new Volume', - 'form_name' => 'Name', - 'form_root' => 'Device', - 'form_description' => 'Description', - 'msg_added' => 'Added Volume %s', - 'msg_add_failed' => 'Failed to add Volume %s', - 'error_exists' => 'Volume %s already exists', - 'error_image_exists' => 'Image with name %s already exists', - 'error_name' => 'Name must be %s', - 'error_description' => 'Description must be %s', - 'please_wait' => 'Adding Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'clone' => array ( - 'tab' => 'Clone LinuxCOE Volume', - 'label' => 'Clone Volume %s', - 'form_name' => 'Name', - 'msg_cloned' => 'Cloned %s as %s', - 'msg_clone_failed' => 'Failed to clone Volume %s', - 'error_exists' => 'Volume %s already exists', - 'error_name' => 'Name must be %s', - 'please_wait' => 'Cloning Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'remove' => array ( - 'label' => 'Remove Volume(s)', - 'msg_removed' => 'Removed Volume %s', - 'msg_image_still_in_use' => 'Volume %s of Image id %s is still in use by appliance(s) %s', - 'please_wait' => 'Removing Volume(s). Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/linuxcoe/lang", 'linuxcoe.ini'); - $this->tpldir = $this->rootdir.'/plugins/linuxcoe/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "edit"; - } - if($this->action !== 'select') { - $this->response->params['storage_id'] = $this->response->html->request()->get('storage_id'); - } - $content = array(); - switch( $this->action ) { - case '': - case 'select': - $content[] = $this->select(true); - break; - case 'edit': - $content[] = $this->select(false); - $content[] = $this->edit(true); - break; - case 'add': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->add(true); - break; - case 'remove': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->remove(true); - break; - case 'clone': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->duplicate(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * API - * - * @access public - */ - //-------------------------------------------- - function api() { - require_once($this->rootdir.'/plugins/linuxcoe/class/linuxcoe.api.class.php'); - $controller = new linuxcoe_api($this); - $controller->action(); - } - - - //-------------------------------------------- - /** - * Select LinuxCOE Install Server - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/linuxcoe/class/linuxcoe.select.class.php'); - $controller = new linuxcoe_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Edit LinuxCOE Server - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function edit( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/linuxcoe/class/linuxcoe.edit.class.php'); - $controller = new linuxcoe_edit($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['edit']; - $controller->rootdir = $this->rootdir; - $data = $controller->action(); - } - $content['label'] = $this->lang['edit']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'edit' ); - $content['onclick'] = false; - if($this->action === 'edit'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add new Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function add( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/linuxcoe/class/linuxcoe.add.class.php'); - $controller = new linuxcoe_add($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['add']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['add']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'add' ); - $content['onclick'] = false; - if($this->action === 'add'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Remove Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function remove( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/linuxcoe/class/linuxcoe.remove.class.php'); - $controller = new linuxcoe_remove($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['remove']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Remove'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'remove' ); - $content['onclick'] = false; - if($this->action === 'remove' || $this->action === $this->lang['edit']['action_remove']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Clone Volume - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function duplicate( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/linuxcoe/class/linuxcoe.clone.class.php'); - $controller = new linuxcoe_clone($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['clone']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['clone']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'clone' ); - $content['onclick'] = false; - if($this->action === 'clone' || $this->action === $this->lang['edit']['action_clone']){ - $content['active'] = true; - } - return $content; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.edit.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.edit.class.php deleted file mode 100644 index 3af3659..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.edit.class.php +++ /dev/null @@ -1,244 +0,0 @@ - - */ - -class linuxcoe_edit -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'linuxcoe_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'linuxcoe_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'linuxcoe_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - require_once($this->openqrm->get('basedir').'/plugins/linuxcoe/web/class/linuxcoe-volume.class.php'); - } - - //-------------------------------------------- - /** - * Init - * - * @access public - */ - //-------------------------------------------- - function init() { - $storage_id = $this->response->html->request()->get('storage_id'); - if($storage_id === '') { - return false; - } - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $this->resource = $resource; - $this->storage = $storage; - $this->deployment = $deployment; - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->init(); - $data = $this->edit(); - if($data !== false) { - $t = $this->response->html->template($this->tpldir.'/linuxcoe-edit.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($data); - $t->add($this->lang['lang_id'], 'lang_id'); - $t->add($this->lang['lang_name'], 'lang_name'); - $t->add($this->lang['lang_resource'], 'lang_resource'); - $t->add($this->lang['lang_state'], 'lang_state'); - $t->add($this->lang['lang_vfree'], 'lang_vfree'); - $t->add($this->lang['lang_vsize'], 'lang_vsize'); - $t->add(sprintf($this->lang['label'], $data['name']), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } else { - $msg = sprintf($this->lang['error_no_local'], $this->response->html->request()->get('storage_id')); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return array|false - */ - //-------------------------------------------- - function edit() { - if($this->deployment->type === 'linuxcoe-deployment') { - $resource_icon_default="/img/resource.png"; - $storage_icon="/plugins/linuxcoe/img/plugin.png"; - $state_icon = $this->openqrm->get('baseurl')."/img/".$this->resource->state.".png"; - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default=$storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - - $d['state'] = ''; - $d['icon'] = ''; - $d['resource'] = $this->resource->id.' / '.$this->resource->ip; - $d['name'] = $this->storage->name; - $d['id'] = $this->storage->id; - - $a = $this->response->html->a(); - $a->label = $this->lang['action_add']; - $a->css = 'add'; - $a->handler = 'onclick="wait();"'; - $a->href = $this->response->get_url($this->actions_name, "add"); - $d['add'] = $a->get_string(); - - $body = array(); - $identifier_disabled = array(); - - $table = $this->response->html->tablebuilder('linuxcoe_edit', $this->response->get_array($this->actions_name, 'edit')); - $table->sort = 'linuxcoe_volume_id'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->autosort = true; - $table->sort_link = false; - $table->init(); - - $linuxcoe_volume = new linuxcoe_volume(); - $linuxcoe_volume_arr = $linuxcoe_volume->display_overview(0, 10000, $table->sort, $table->order); - if(count($linuxcoe_volume_arr) >= 1) { - foreach($linuxcoe_volume_arr as $k => $v) { - - $c = $this->response->html->a(); - $c->title = $this->lang['action_clone']; - $c->label = $this->lang['action_clone']; - $c->handler = 'onclick="wait();"'; - $c->css = 'clone'; - $c->href = $this->response->get_url($this->actions_name, "clone").'&volume='.$v['linuxcoe_volume_name']; - - // edit image - $local_image = new image(); - $local_image->get_instance_by_name($v['linuxcoe_volume_name']); - $e = $this->response->html->a(); - $e->title = $this->lang['action_edit']; - $e->label = $this->lang['action_edit']; - $e->handler = 'onclick="wait();"'; - $e->css = 'edit'; - $e->href = '/openqrm/base/index.php?base=image&image_action=edit&image_id='.$local_image->id; - - $body[] = array( - 'icon' => $d['icon'], - 'linuxcoe_volume_id' => $v['linuxcoe_volume_id'], - 'linuxcoe_volume_name' => $v['linuxcoe_volume_name'], - 'linuxcoe_volume_root' => $v['linuxcoe_volume_root'], - 'description' => $v['linuxcoe_volume_description'], - 'clone' => $c, - 'edit' => $e, - ); - } - } - - $h['icon']['title'] = ' '; - $h['icon']['sortable'] = false; - $h['linuxcoe_volume_id']['title'] = $this->lang['table_id']; - $h['linuxcoe_volume_name']['title'] = $this->lang['table_name']; - $h['linuxcoe_volume_root']['title'] = $this->lang['table_root']; - $h['description']['title'] = $this->lang['table_description']; - $h['description']['sortable'] = false; - $h['clone']['title'] = ' '; - $h['clone']['sortable'] = false; - $h['edit']['title'] = ' '; - $h['edit']['sortable'] = false; - - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->max = count($linuxcoe_volume_arr); - $table->head = $h; - $table->body = $body; - $table->identifier = 'linuxcoe_volume_name'; - $table->identifier_name = $this->identifier_name; - $table->identifier_disabled = $identifier_disabled; - $table->actions_name = $this->actions_name; - $table->actions = array(array('remove' => $this->lang['action_remove'])); - - $d['table'] = $table->get_string(); - return $d; - } else { - return false; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.remove.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.remove.class.php deleted file mode 100644 index 864ea02..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.remove.class.php +++ /dev/null @@ -1,199 +0,0 @@ - - */ - -class linuxcoe_remove -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'linuxcoe_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'linuxcoe_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'linuxcoe_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - require_once($this->openqrm->get('basedir').'/plugins/linuxcoe/web/class/linuxcoe-volume.class.php'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->remove(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/linuxcoe-remove.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($response->form); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Remove - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function remove() { - $response = $this->get_response(); - $volume_names = $response->html->request()->get($this->identifier_name); - $form = $response->form; - if( $volume_names !== '' ) { - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $i = 0; - foreach($volume_names as $ex) { - $d['param_f'.$i]['label'] = $ex; - $d['param_f'.$i]['object']['type'] = 'htmlobject_input'; - $d['param_f'.$i]['object']['attrib']['type'] = 'checkbox'; - $d['param_f'.$i]['object']['attrib']['name'] = $this->identifier_name.'['.$i.']'; - $d['param_f'.$i]['object']['attrib']['value'] = $ex; - $d['param_f'.$i]['object']['attrib']['checked'] = true; - $i++; - } - $form->add($d); - if(!$form->get_errors() && $response->submit()) { - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $errors = array(); - $message = array(); - foreach($volume_names as $key => $volume_name) { - - // check if an appliance is still using the volume as an image - $image = new image(); - $image->get_instance_by_name($volume_name); - - // check if it is still in use - $appliance = new appliance(); - $appliances_using_resource = $appliance->get_ids_per_image($image->id); - if (count($appliances_using_resource) > 0) { - $appliances_using_resource_str = implode(",", $appliances_using_resource[0]); - $errors[] = sprintf($this->lang['msg_image_still_in_use'], $volume_name, $image->id, $appliances_using_resource_str); - } else { - // remove volume - $linuxcoe_volume = new linuxcoe_volume(); - $linuxcoe_volume->remove_by_name($volume_name); - // remove the image of the volume - $image->remove_by_name($volume_name); - - $form->remove($this->identifier_name.'['.$key.']'); - $message[] = sprintf($this->lang['msg_removed'], $volume_name); - - } - } - if(count($errors) === 0) { - $response->msg = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response->error = join('
    ', $msg); - } - } - } else { - $response->msg = ''; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'remove'); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.select.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.select.class.php deleted file mode 100644 index 277a484..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoe.select.class.php +++ /dev/null @@ -1,211 +0,0 @@ - - */ - -class linuxcoe_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'linuxcoe_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'linuxcoe_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'linuxcoe_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'linuxcoe_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $table = $this->select(); - $t = $this->response->html->template($this->tpldir.'/linuxcoe-select.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($table, 'table'); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return htmlobject_tablebulider | htmlobject_div - */ - //-------------------------------------------- - function select() { - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - - $deployment->get_instance_by_type("linuxcoe-deployment"); - $table = $this->response->html->tablebuilder('linuxcoe_select', $this->response->get_array($this->actions_name, 'select')); - $table->sort = 'storage_id'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = $storage->get_count_per_type($deployment->id); - $table->autosort = false; - $table->sort_link = false; - $table->init(); - $storages = $storage->display_overview_per_type($deployment->id, $table->offset, $table->limit, $table->sort, $table->order); - - if(count($storages) >= 1) { - foreach($storages as $k => $v) { - $storage->get_instance_by_id($v["storage_id"]); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - $resource_icon_default="/img/resource.png"; - $storage_icon="/plugins/linuxcoe/img/plugin.png"; - $state_icon = $this->openqrm->get('baseurl')."/img/".$resource->state.".png"; - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default=$storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - - $a = $this->response->html->a(); - $a->title = $this->lang['action_edit']; - $a->label = $this->lang['action_edit']; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($this->actions_name, "edit").'&storage_id='.$storage->id; - - $data = ''.$this->lang['table_recource'].': '.$resource->id.' / '.$resource->ip.'
    '; - $data .= ''.$this->lang['table_type'].': '.$deployment->type.'
    '; - $data .= ''.$this->lang['table_deployment'].': '.$deployment->storagedescription.'
    '; - - $b[] = array( - 'state' => 'State', - 'icon' => 'Icon', - 'storage_id' => $storage->id, - 'storage_name' => $storage->name, - 'storage_resource_id' => $storage->resource_id, - 'storage_data' => $data, - 'storage_comment' => '', - 'storage_edit' => $a->get_string(), - ); - } - - $h = array(); - $h['state'] = array(); - $h['state']['title'] =' '; - $h['state']['sortable'] = false; - $h['icon'] = array(); - $h['icon']['title'] =' '; - $h['icon']['sortable'] = false; - $h['storage_id'] = array(); - $h['storage_id']['title'] = $this->lang['table_id']; - $h['storage_name'] = array(); - $h['storage_name']['title'] = $this->lang['table_name']; - $h['storage_resource_id'] = array(); - $h['storage_resource_id']['title'] = $this->lang['table_recource']; - $h['storage_resource_id']['hidden'] = true; - $h['storage_data'] = array(); - $h['storage_data']['title'] = ' '; - $h['storage_data']['sortable'] = false; - $h['storage_comment'] = array(); - $h['storage_comment']['title'] =' '; - $h['storage_comment']['sortable'] = false; - $h['storage_edit'] = array(); - $h['storage_edit']['title'] = ' '; - $h['storage_edit']['sortable'] = false; - - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $b; - $table->limit_select = array( - array("value" => 10, "text" => 10), - array("value" => 20, "text" => 20), - array("value" => 30, "text" => 30), - array("value" => 40, "text" => 40), - array("value" => 50, "text" => 50), - ); - return $table->get_string(); - } else { - $a = $this->response->html->a(); - $a->title = $this->lang['new_storage']; - $a->label = $this->lang['new_storage']; - $a->handler = 'onclick="wait();"'; - $a->css = 'add'; - $a->href = $this->response->html->thisfile.'?base=storage&storage_action=add'; - - $box = $this->response->html->div(); - $box->id = 'Tabelle'; - $box->css = 'htmlobject_box'; - $content = $this->lang['error_no_storage'].'

    '; - $content .= $a->get_string(); - $box->add($content); - return $box->get_string(); - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoeresource.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoeresource.class.php deleted file mode 100644 index 5a950db..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoeresource.class.php +++ /dev/null @@ -1,119 +0,0 @@ - -*/ - - -// This class represents a linuxcoeresource object in openQRM - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/kernel.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -$event = new event(); -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $event; - - -class linuxcoeresource { - -var $id = ''; -var $resource_id = ''; - - -//-------------------------------------------------- -/** -* Constructor -*/ -//-------------------------------------------------- -function linuxcoeresource() { - $this->init(); -} - -//-------------------------------------------------- -/** -* init storage environment -* @access public -*/ -//-------------------------------------------------- -function init() { - global $OPENQRM_SERVER_BASE_DIR; - $this->_event = new event(); - $this->_base_dir = $OPENQRM_SERVER_BASE_DIR; -} - - -// --------------------------------------------------------------------------------- -// methods to set a resource boot-sequence -// This is especially needed for KVM VMs since the boot-sequence "nc" does -// not use the local disk for boot if set by pxe. -> bug in kvm -// --------------------------------------------------------------------------------- - -function set_boot($resource_id, $boot) { - global $event; - $event->log("set_boot", $_SERVER['REQUEST_TIME'], 5, "linuxcoeresource.class.php", "Setting boot-sequence of resource ".$resource_id." to ".$boot.".", "", "", 0, 0, 0); - $boot_sequence = "net"; - switch($boot) { - case '0': - // netboot - $boot_sequence = "net"; - break; - case '1': - // local boot - $boot_sequence = "local"; - break; - } - $linuxcoe_resource = new resource(); - $linuxcoe_resource->get_instance_by_id($resource_id); - // is it a vm ? - if ($linuxcoe_resource->vhostid == $resource_id) { - return; - } - $linuxcoe_resource_virtualization = new virtualization(); - $linuxcoe_resource_virtualization->get_instance_by_id($linuxcoe_resource->vtype); - switch($linuxcoe_resource_virtualization->type) { - case 'kvm-vm-net': - $linuxcoe_resource_vhost = new resource(); - $linuxcoe_resource_vhost->get_instance_by_id($linuxcoe_resource->vhostid); - $linuxcoe_resource_set_boot_commmand = $this->_base_dir."/openqrm/plugins/kvm/bin/openqrm-kvm-vm setboot -m ".$linuxcoe_resource->mac." -b ".$boot_sequence." --openqrm-cmd-mode background"; - $linuxcoe_resource_vhost->send_command($linuxcoe_resource_vhost->ip, $linuxcoe_resource_set_boot_commmand); - $event->log("set_boot", $_SERVER['REQUEST_TIME'], 5, "linuxcoeresource.class.php", "Resource ".$resource_id." is a KVM VM on Host ".$linuxcoe_resource_vhost->id.".", "", "", 0, 0, 0); - break; - case 'kvm-vm-local': - $linuxcoe_resource_vhost = new resource(); - $linuxcoe_resource_vhost->get_instance_by_id($linuxcoe_resource->vhostid); - $linuxcoe_resource_set_boot_commmand = $this->_base_dir."/openqrm/plugins/kvm/bin/openqrm-kvm-vm setboot -m ".$linuxcoe_resource->mac." -b ".$boot_sequence." --openqrm-cmd-mode background"; - $linuxcoe_resource_vhost->send_command($linuxcoe_resource_vhost->ip, $linuxcoe_resource_set_boot_commmand); - $event->log("set_boot", $_SERVER['REQUEST_TIME'], 5, "linuxcoeresource.class.php", "Resource ".$resource_id." is a KVM-Storage VM on Host ".$linuxcoe_resource_vhost->id.".", "", "", 0, 0, 0); - break; - } - -} - - - -// --------------------------------------------------------------------------------- - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoestate.class.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoestate.class.php deleted file mode 100644 index cf90350..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/class/linuxcoestate.class.php +++ /dev/null @@ -1,203 +0,0 @@ - -*/ - - -// This class represents a linuxcoestate object in openQRM - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/kernel.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -$event = new event(); -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $event; - - -class linuxcoestate { - -var $id = ''; -var $resource_id = ''; -var $install_start = ''; -var $timeout = ''; - -//-------------------------------------------------- -/** -* Constructor -*/ -//-------------------------------------------------- -function linuxcoestate() { - $this->init(); -} - -//-------------------------------------------------- -/** -* init storage environment -* @access public -*/ -//-------------------------------------------------- -function init() { - global $OPENQRM_SERVER_BASE_DIR; - $this->_event = new event(); - $this->_db_table = "linuxcoe_state"; - $this->_base_dir = $OPENQRM_SERVER_BASE_DIR; -} - - - - - -// --------------------------------------------------------------------------------- -// methods to create an instance of a linuxcoestate object filled from the db -// --------------------------------------------------------------------------------- - -// returns an appliance from the db selected by id or name -function get_instance($id, $resource_id) { - $db=openqrm_get_db_connection(); - if ("$id" != "") { - $linuxcoestate_array = $db->Execute("select * from ".$this->_db_table." where linuxcoe_id=".$id); - } else if ("$resource_id" != "") { - $linuxcoestate_array = $db->Execute("select * from ".$this->_db_table." where linuxcoe_resource_id=".$resource_id); - } else { - $this->_event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "linuxcoestate.class.php", "Could not create instance of event without data", "", "", 0, 0, 0); - return; - } - foreach ($linuxcoestate_array as $index => $linuxcoestate) { - $this->id = $linuxcoestate["linuxcoe_id"]; - $this->resource_id = $linuxcoestate["linuxcoe_resource_id"]; - $this->install_start = $linuxcoestate["linuxcoe_install_start"]; - $this->timeout = $linuxcoestate["linuxcoe_timeout"]; - } - return $this; -} - -// returns an linuxcoestate from the db selected by id -function get_instance_by_id($id) { - $this->get_instance($id, ""); - return $this; -} - -// returns an linuxcoestate from the db selected by the resource_id -function get_instance_by_resource_id($resource_id) { - $this->get_instance("", $resource_id); - return $this; -} - - -// --------------------------------------------------------------------------------- -// general linuxcoestate methods -// --------------------------------------------------------------------------------- - - - - -// checks if given linuxcoestate id is free in the db -function is_id_free($linuxcoestate_id) { - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select linuxcoe_id from ".$this->_db_table." where linuxcoe_id=".$linuxcoestate_id); - if (!$rs) - $this->_event->log("is_id_free", $_SERVER['REQUEST_TIME'], 2, "linuxcoestate.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - if ($rs->EOF) { - return true; - } else { - return false; - } -} - - -// adds linuxcoestate to the database -function add($linuxcoestate_fields) { - if (!is_array($linuxcoestate_fields)) { - $this->_event->log("add", $_SERVER['REQUEST_TIME'], 2, "linuxcoestate.class.php", "linuxcoestate_field not well defined", "", "", 0, 0, 0); - return 1; - } - // set stop time and status to now - $now=$_SERVER['REQUEST_TIME']; - $db=openqrm_get_db_connection(); - $result = $db->AutoExecute($this->_db_table, $linuxcoestate_fields, 'INSERT'); - if (! $result) { - $this->_event->log("add", $_SERVER['REQUEST_TIME'], 2, "linuxcoestate.class.php", "Failed adding new linuxcoestate to database", "", "", 0, 0, 0); - } -} - - - -// removes linuxcoestate from the database -function remove($linuxcoestate_id) { - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from ".$this->_db_table." where linuxcoe_id=".$linuxcoestate_id); -} - - -// removes linuxcoestate from the database by resource id -function remove_by_resource_id($linuxcoestate_resource_id) { - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from ".$this->_db_table." where linuxcoe_resource_id=".$linuxcoestate_resource_id); -} - - - -// returns the number of linuxcoestates for an linuxcoestate type -function get_count() { - $count=0; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select count(linuxcoe_id) as num from ".$this->_db_table); - if (!$rs) { - print $db->ErrorMsg(); - } else { - $count = $rs->fields["num"]; - } - return $count; -} - - - - -// returns a list of all linuxcoestate ids -function get_all_ids() { - $linuxcoestate_list = array(); - $query = "select linuxcoe_id from ".$this->_db_table; - $db=openqrm_get_db_connection(); - $rs = $db->Execute($query); - if (!$rs) - $this->_event->log("get_list", $_SERVER['REQUEST_TIME'], 2, "linuxcoestate.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $linuxcoestate_list[] = $rs->fields; - $rs->MoveNext(); - } - return $linuxcoestate_list; - -} - - - - - -// --------------------------------------------------------------------------------- - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/css/linuxcoe.css b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/css/linuxcoe.css deleted file mode 100644 index e69de29..0000000 diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/image.linuxcoe-deployment.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/image.linuxcoe-deployment.php deleted file mode 100644 index 92a02a0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/image.linuxcoe-deployment.php +++ /dev/null @@ -1,62 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - - -function get_linuxcoe_deployment_image_rootdevice_identifier($local_storage_storage_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - $rootdevice_identifier_array[] = array("value" => "sda", "label" => "Local SCSI Disk 1"); - return $rootdevice_identifier_array; -} - -function get_linuxcoe_deployment_image_default_rootfs() { - return "local fileystem"; -} - -function get_linuxcoe_deployment_rootfs_transfer_methods() { - return false; -} - -function get_linuxcoe_deployment_rootfs_set_password_method() { - return true; -} - -function get_linuxcoe_deployment_is_network_deployment() { - return true; -} - -function get_linuxcoe_deployment_local_deployment_enabled() { - return true; -} - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/img/plugin.png deleted file mode 100644 index 8b06f2a..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/de.linuxcoe-about.ini b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/de.linuxcoe-about.ini deleted file mode 100644 index 7f894ba..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/de.linuxcoe-about.ini +++ /dev/null @@ -1,96 +0,0 @@ -[documentation] -tab = "Über LinuxCOE" -label = "Über LinuxCOE" -introduction_title = "Einleitung" -introduction_content = "Das 'LinuxCOE' Plugin verwaltet LinuxCOE Install Server für voll automatische Linux Installationen. - - LinuxCOE bietet eine Benutzer-freundliche Oberfläche um automatische Linux Installationen für verschiedene Distribution (Debian/Ubuntu/CentOS etc.) zu erstellen. - Die resultierenden ISO Dateien werden dann benutzt um Physikalische Server und auch Virtuelle Maschinenen vollautomatisch mit einer Linux Installation zu provisionieren.
    - Die Integration von LinuxCOE in openQRM bietet zwei verschiedene Modi:

    - - Automatische Installation per ISO
    - Nach dem erstellen eines Installations Templates kann die resultierende ISO Datei auf eine CD transferiert werden die dann benutzt werden kann um Physikalische Systeme automatisch zu installieren. - (das eigentliche Ziel des LinuxCOE Projektes)

    - In openQRM sind die ISO Dateien der Installation Templates automatisch auf allen Virtualisations Hosts vom Typ 'local-deployment VMs' (z.B. 'kvm-storage' und 'xen-storage') im /linuxcoe-iso Verzeichnis verfügbar. - Eine Virtuelle Maschine lässt sich so einfach konfigurieren von einer der LinuxCOE ISO Dateien zu starten um die automatische Installation durchzuführen.

    - Beachten Sie das nach einer erfolgreichen automatischen Installation die VM immer noch konfiguriert ist von der ISO Datei zu starten! - Bitte stoppen Sie die Server der VM, dann re-konfigurieren Sie die VM von der lokalen Festplatte zu starten. Danach starten Sie die Server erneut.

    - - Automatische Netzwerk-Installation
    - Die LinuxCOE Integration in openQRM bietet zusätzlich die Möglichkeit die vor-konfigurierten Installation Templates per Netzwerk-Deployment ('network-deployment') zu benutzen. - Für Netzwerk-Deployment sind Physikalische Server sowie auch Virtuelle Maschinen vom Typ 'local-deployment VMs' (z.B. 'kvm-storage' und 'xen-storage') unterstützt.
    - -> Physikalische Server und VMs die mittles Netzwerk-Deployment provisioniert werden müssent per BIOS Einstellung oder VM Konfiguration auf 'netzwerk-boot' (PXE) eingestellt werden!

    - Die Provisionierung der LinuxCEO Templates wird in openQRM mittels des 'install-from-template' Mechanismus durchgeführt der erlaubt Templates für automatische Installationen an Images anzuhängen. - Für Virtuelle Maschinen können die Templates direkt an das Image der Virtuellen Maschine angehängt werden, für physikalische Server erstellen Sie bitte ein Image das auf eine der lokalen Festplatten zeigt mittels des LinuxCOE 'Image Manager'.

    - Starten eines Server mit einem LinuxCOE Template angehängt an dem Image der Server führt automatisch die spezifizierte automatische Installation des Systems durch.

    - Während des Netzwerk-Deployment Vorgang wird automatisch auch der openQRM-Client auf dem System installiert und das System wird in openQRM integriert. - Nach erfolgreicher automatischer Installation startet die Ressource automatisch von der lokalen Festplatte.

    - - Cloud Deployment
    - Images mit einem angehängten LinuxCOE Automatischen Netzwerk-Installations Template werden voll unterstützt für Cloud Deployment!

    -" - -requirements_title = "Anforderungen" -requirements_list = "
    • Die folgenden Paket werden benötigt: screen, make, autoconf, automake, genisoimage, sudo, nfs-kernel-server, nfs-common
    " - -tested_title = "Testet mit" -tested_content = "Diese Plugin ist getestet mit Debian, Ubuntu und CentOS Linux Distributionen" - -provides_title = "Bietet" -provides_list = "
    • Storage Typen: 'linuxcoe-deployment'
    • -
    • Deployment types: 'Automatic Linux Installation (LinuxCOE)'
    " - -howto_title = "Deployment mit LinuxCOE" -howto_list = "
    • Erstellen Sie aus der openQRM Ressource eine LinuxCOE Storage vom Typ 'linuxcoe-deployment'
    • -
    • Erstellen Sie ein oder mehrere LinuxCOE Automatische Installations Templates
    • -
    • Fügen Sie den Templates mittels des 'Template Managers' eine kurze Beschreibung hinzu
    • -
    • Wählen Sie entweder Automatische Installation per ISO oder Automatische Netzwerk-Installation um die Templates zu provisionieren.
    " - -type_title = "Plugin Typ" -type_content = "Deployment" - -deployment_title = "Deployment Typ" -deployment_content = "Local-Deployment" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" -network_deploymet = "Netzwerk-Deployment" -doc1 = "" - - -[bootservice] -tab = "Boot-Service" -label = "LinuxCOE Boot-Service" -boot_service_title = "LinuxCOE Boot-Service" -boot_service_content = "Das LinuxCOE Plugin beinhaltet einen openQRM Boot-Service. - Dieser 'LinuxCOE Boot-Service' wird automatisch von allen in openQRM integrierten Systeme heruntergeladen und ausgeführt. - Der Boot-Service befindet sich unter:
    -
    - /usr/share/openqrm/plugins/linuxcoe/web/boot-service-linuxcoe.tgz -
    -
    - Der 'LinuxCOE Boot-Service' beinhaltet die 'Client' Dateien des LinuxCOE Plugin.
    - Eine Konfigurationsdatei für den LinuxCOE Server ist ebenfalls enhalten.
    -
    - Die Boot-Service konfiguration wird mittels des 'openqrm' Kommandozeilenwerkzeugs verwaltet.
    - Der folgende Befehl zeigt die die momentane 'default' Boot-Service Konfiguration an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n linuxcoe -a default -
    -
    - Die Boot-Service Konfiguration eines speziellen Server zeigt der folgende Befehl an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n linuxcoe -a [Server-name] -
    -
    - Der folgende Befehl passt einen Konfigurationparameter des 'default' Boot-Service an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n linuxcoe -a default -k [key] -v [value] -
    -
    - Die Boot-Service Konfigurarationsparameter eines speziellen Server passt der folgende Befehl an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n linuxcoe -a [Server-name] -k [key] -v [value] -
    -
    " - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/de.linuxcoe-template.ini b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/de.linuxcoe-template.ini deleted file mode 100644 index 7b816af..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/de.linuxcoe-template.ini +++ /dev/null @@ -1,24 +0,0 @@ -[select] -tab = "LinuxCOE Templates" -label = "LinuxCOE Automatic Installation Templates" -action_edit = "edit" -action_remove = "remove" -table_name = "Name" -table_id = "ID" -table_comment = "Beschreibung" -please_wait = "Lade LinuxCOE Templates. Bitte warten .." -[edit] -tab = "Bearbeite LinuxCOE Template" -label = "Bearbeite LinuxCOE Template %s Beschreibung" -form_comment = "Description" -form_post = "Custom POST-Install Sektion" -msg_edit = "LinuxCOE Template %s bearbeietet" -error_comment = "Kommentar darf nur %s beinhalten" -please_wait = "Lade LinuxCOE Templates. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[remove] -tab = "Entferne LinuxCOE Templates" -label = "Entferne LinuxCOE Template(s)" -msg_removed = "LinuxCOE Template %s entfertn" -please_wait = "Lade LinuxCOE Templates. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/de.linuxcoe.ini b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/de.linuxcoe.ini deleted file mode 100644 index 76c60a1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/de.linuxcoe.ini +++ /dev/null @@ -1,69 +0,0 @@ -[select] -tab = "LinuxCOE Server auswählen" -label = "LinuxCOE Server auswählen" -action_edit = "bearbeiten" -table_name = "Name" -table_id = "Id" -table_recource = "Resource" -table_type = "Typ" -table_deployment = "Deployment" -error_no_storage = "Keine Storage angelegt!

    Bitte legen Sie erst eine LinuxCOE Storage an!" -new_storage = "Neue Storage" -please_wait = "Lade Storage. Bitte warten .." -[edit] -tab = "LinuxCOE Server bearbeiten" -label = "LinuxCOE Volumes auf Storage %s" -lang_id = "ID" -lang_name = "Name" -lang_resource = "Resource" -lang_state = "Status" -lang_vfree = "Frei" -lang_vsize = "Gesamt" -action_add = "Neues Volume anlegen" -action_refresh = "Reload Page" -action_clone = "klonen" -action_manual = "Manuelle Konfiguration" -action_remove = "löschen" -action_auth = "Berechtigung" -action_edit = "Image dieses Volumes bearbeiten" -action_clone_in_progress = "Syncronisation in Bearbeitung - Bitte warten" -action_clone_finished = "Syncronisation beendet!" -table_name = "Name" -table_id = "ID" -table_root = "Laufwerk" -table_description = "Beschreibung" -error_no_local = "Storage %s ist nicht vom Typ LinuxCOE" -please_wait = "Lade Volumes. Bitte warten .." -manual_configured = "Storage ist manuell konfiguriert und kann nicht von openQRM verwaltet werden!" -[add] -tab = "Neues LinuxCOE Volume" -label = "Neues LinuxCOE Volume anlegen" -form_name = "Name" -form_root = "Laufwerk" -form_description = "Beschreibung" -lang_name_generate = "Name generieren" -msg_added = "Volume %s angelegt" -msg_add_failed = "Fehler beim anlegen des Volumes %s" -error_exists = "Volume %s besteht bereits" -error_image_exists = "Image mit Namen %s besteht bereits" -error_name = "Name darf nur %s beinhalten" -error_description = "Beschreibung darf nur %s beinhalten" -please_wait = "Erstelle Volume. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[clone] -tab = "Volume klonen" -label = "Volume klonen" -form_name = "Name" -lang_name_generate = "Name generieren" -msg_cloned = "Klone %s als %s" -msg_clone_failed = "Fehler beim Klonen des Volumes %s" -error_exists = "Volume %s besteht bereits" -error_name = "Name darf nur %s beinhalten" -please_wait = "Klone Volume. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[remove] -label = "Volume(s) löschen" -msg_removed = "Volume %s gelöscht" -msg_image_still_in_use = "Das Volume %s des Image ID %s ist noch in benutztung von Server %s" -please_wait = "Lösche Volume(s). Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/en.linuxcoe-about.ini b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/en.linuxcoe-about.ini deleted file mode 100644 index 11b160a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/en.linuxcoe-about.ini +++ /dev/null @@ -1,93 +0,0 @@ -[documentation] -tab = "About LinuxCOE" -label = "About LinuxCOE" -introduction_title = "Introduction" -introduction_content = "The 'LinuxCOE' plugin integrates LinuxCOE Install Server for automatic Linux deployments. - LinuxCOE comes with a user-friendly UI to create automatic Linux installations for different distributions (Debian/Ubuntu/CentOS etc.) resulting in ISO files/images which can be used to - fully automatically install physical Server and also Virtual Machines.
    The integration of LinuxCOE in openQRM provides two different modes:

    - - Automatic Installations from ISO
    - After creating an Installation Template the resulting ISO image can be burned on an CD to automatically install a physical Server (the initial goal of the LinuxCOE Project).

    - In openQRM the LinuxCOE ISO Images are also automatically available on Virtualization Host from the type 'local-deployment VMs' (e.g. 'kvm-storage' and 'xen-storage') in the /linuxcoe-iso directory. - Simply configure a Virtual Machine to boot from such a LinuxCOE ISO image for an fully automatic VM installation.

    - Please notice that after a successfull installation the VM will most likely try to boot from the ISO image again after the automatic install procedure finished! - Please stop the VMs Server after the initial automatic installation, then re-configure the Virtual Machine to boot from 'local' and start the Server again.

    - - Automatic Network-Installations
    - The LinuxCOE integration in openQRM provides the capability to use the pre-configured automatic installations templates also for 'network-deployment'. - For 'network-deployment' physical Server and Virtual Machines from the type 'local-deployment for VMs' (e.g. 'kvm-storage' and 'xen-storage') are supported.
    - -> physical Server and VMs for 'network-deployment' must be set to network-boot (PXE) either in the BIOS or VM configuration!

    - The deployment of the LinuxCOE templates works via openQRMs 'install-from-template' mechanism which allows to attach those automatic installation templates to Images. - For Virtual Machines the templates can be directly attached to the Virtual Machines Image, for physical Server please create an Image pointing to a local disk with the LinuxCOE 'Image Manager'.

    - Starting an Server with an LinuxCOE automatic installation template attached to its Image automatically applies the specified configuration and automatically installs the systems.

    - Network-deploying LinuxCOE templates automatically installs the openQRM-Client and integrates the system into openQRM. - After the automatic installation the resource (physical Server or VM) is automatically set to local-boot.

    - - Cloud deployment
    - Images with an attached LinuxCOE Automatic Network-Installation template are fully supported for Cloud-deployment!

    " - -requirements_title = "Requirements" -requirements_list = "
    • A LinuxCOE Install Server Storage using the openQRM as the resource
    • -
    • The following packages must be installed: screen, make, autoconf, automake, genisoimage, sudo, nfs-kernel-server, nfs-common
    " - -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions." - -provides_title = "Provides" -provides_list = "
    • Storage type: 'linuxcoe-deployment'
    • -
    • Deployment types: 'Automatic Linux Installation (LinuxCOE)'
    " - -howto_title = "How to use" -howto_list = "
    • Create a new Storage from type 'linuxcoe-deployment' using the openQRM Server as the resource
    • -
    • Create one or more LinuxCOE Installation Templates
    • -
    • Use the Template Manager to add a description to your Installation Templates
    • -
    • Choose either Automatic Installations from ISO or Automatic Network-Installations to deploy the Templates
    " - -type_title = "Plugin Type" -type_content = "Deployment" - -deployment_title = "Deployment Type" -deployment_content = "Local-Deployment" - -documentation_title = "Documentation" -use_case_title = "Use-Case" -network_deploymet = "Network-Deployment" -doc1 = "" - - -[bootservice] -tab = "Boot-Service" -label = "LinuxCOE Boot-Service" -boot_service_title = "LinuxCOE Boot-Service" -boot_service_content = "The LinuxCOE Plugin provides an openQRM Boot-Service. - This 'LinuxCOE Boot-Service' is automatically downloaded and executed by the openQRM-Client on all integrated Systems. - The Boot-Service is located at:
    -
    - /usr/share/openqrm/plugins/linuxcoe/web/boot-service-linuxcoe.tgz -
    -
    - The 'LinuxCOE Boot-Service contains the Client files of the LinuxCOE Plugin.
    - Also a configuration file for the LinuxCOE server is included in this Boot-Service.
    -
    - The Boot-Service configuration can be viewed and administrated by the 'openqrm' utility.
    - To view the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n linuxcoe -a default -
    -
    - To view a Boot-Service configuration of a specific Server run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n linuxcoe -a [Server-name] -
    -
    - To adapt a parameter in the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n linuxcoe -a default -k [key] -v [value] -
    -
    - To adapt a paramter in the Boot-Service configuration of a specific Server run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n linuxcoe -a [Server-name] -k [key] -v [value] -
    -
    " - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/en.linuxcoe-template.ini b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/en.linuxcoe-template.ini deleted file mode 100644 index 8805e05..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/en.linuxcoe-template.ini +++ /dev/null @@ -1,24 +0,0 @@ -[select] -tab = "LinuxCOE Templates" -label = "LinuxCOE Automatic Installation Templates" -action_edit = "edit" -action_remove = "remove" -table_name = "Name" -table_id = "ID" -table_comment = "Description" -please_wait = "Loading LinuxCOE Templates. Please wait .." -[edit] -tab = "Edit LinuxCOE Template" -label = "Edit LinuxCOE Template %s description" -form_comment = "Description" -form_post = "Custom POST-Install section" -msg_edit = "Updated LinuxCOE Template %s" -error_comment = "Comment must be %s" -please_wait = "Loading LinuxCOE Templates. Please wait .." -canceled = "Operation canceled. Please wait .." -[remove] -tab = "Remove LinuxCOE Templates" -label = "Remove LinuxCOE Template(s)" -msg_removed = "Removed Volume %s" -please_wait = "Removing Volume(s). Please wait .." -canceled = "Operation canceled. Please wait .." diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/en.linuxcoe.ini b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/en.linuxcoe.ini deleted file mode 100644 index 8ccca2d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/lang/en.linuxcoe.ini +++ /dev/null @@ -1,69 +0,0 @@ -[select] -tab = "Select LinuxCOE-storage" -label = "Select LinuxCOE-storage" -action_edit = "edit" -table_name = "Name" -table_id = "Id" -table_recource = "Resource" -table_type = "Type" -table_deployment = "Deployment" -error_no_storage = "No storage configured yet!

    Please create a LinuxCOE Storage first!" -new_storage = "New Storage" -please_wait = "Loading Storage. Please wait .." -[edit] -tab = "Edit LinuxCOE-storage" -label = "LinuxCOE Volumes on storage %s" -lang_id = "ID" -lang_name = "Name" -lang_resource = "Resource" -lang_state = "State" -lang_vfree = "Free" -lang_vsize = "Total" -action_add = "Add new Volume" -action_refresh = "Reload Page" -action_manual = "Manual Configuration" -action_clone = "clone" -action_remove = "remove" -action_auth = "auth" -action_edit = "Edit Image of this Volume" -action_clone_in_progress = "Synchronisation in progress - Please wait" -action_clone_finished = "Syncronisation finished!" -table_name = "Name" -table_id = "ID" -table_root = "Root device" -table_description = "Description" -error_no_local = "Storage %s is not of type local-deployment" -please_wait = "Loading Volumes. Please wait .." -manual_configured = "Storage is manually configured and can not be be edited by openQRM" -[add] -tab = "Add LinuxCOE Volume" -label = "Add new Volume" -form_name = "Name" -form_root = "Device" -form_description = "Description" -lang_name_generate = "generate name" -msg_added = "Added Volume %s" -msg_add_failed = "Failed to add Volume %s" -error_exists = "Volume %s already exists" -error_image_exists = "Image with name %s already exists" -error_name = "Name must be %s" -error_description = "Description must be %s" -please_wait = "Adding Volume. Please wait .." -canceled = "Operation canceled. Please wait .." -[clone] -tab = "Clone LinuxCOE Volume" -label = "Clone Volume %s" -form_name = "Name" -lang_name_generate = "generate name" -msg_cloned = "Cloned %s as %s" -msg_clone_failed = "Failed to clone Volume %s" -error_exists = "Volume %s already exists" -error_name = "Name must be %s" -please_wait = "Cloning Volume. Please wait .." -canceled = "Operation canceled. Please wait .." -[remove] -label = "Remove Volume(s)" -msg_removed = "Removed Volume %s" -msg_image_still_in_use = "Volume %s of Image id %s is still in use by Server %s" -please_wait = "Removing Volume(s). Please wait .." -canceled = "Operation canceled. Please wait .." diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/linuxcoe-action.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/linuxcoe-action.php deleted file mode 100644 index c365be9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/linuxcoe-action.php +++ /dev/null @@ -1,99 +0,0 @@ - -*/ - -// error_reporting(E_ALL); -$thisfile = basename($_SERVER['PHP_SELF']); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -$BaseDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -// filter inputs -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; - -$event = new event(); -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $event; - -// user/role authentication -if ($OPENQRM_USER->role != "administrator") { - $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "linuxcoe-action", "Un-Authorized access to linuxcoe-actions from $OPENQRM_USER->name", "", "", 0, 0, 0); - exit(); -} - -$linuxcoe_command = $request->get('linuxcoe_command'); - -// main -$event->log("$linuxcoe_command", $_SERVER['REQUEST_TIME'], 5, "linuxcoe-action", "Processing linuxcoe command $linuxcoe_command", "", "", 0, 0, 0); - -switch ($linuxcoe_command) { - - case 'init': - // create linuxcoe_state - // -> linuxcoe_state - // linuxcoe_id BIGINT - // linuxcoe_resource_id BIGINT - // linuxcoe_install_start VARCHAR(20) - // linuxcoe_timeout BIGINT - $create_linuxcoe_state = "create table linuxcoe_state(linuxcoe_id BIGINT, linuxcoe_resource_id BIGINT, linuxcoe_install_start VARCHAR(20), linuxcoe_timeout BIGINT)"; - $db=openqrm_get_db_connection(); - $recordSet = $db->Execute($create_linuxcoe_state); - // -> linuxcoe_volumes - // linuxcoe_volume_id BIGINT - // linuxcoe_volume_name VARCHAR(50) - // linuxcoe_volume_size VARCHAR(50) - // linuxcoe_volume_description VARCHAR(255) - $create_linuxcoe_volume_table = "create table linuxcoe_volumes(linuxcoe_volume_id BIGINT, linuxcoe_volume_name VARCHAR(50), linuxcoe_volume_root VARCHAR(50), linuxcoe_volume_description VARCHAR(255))"; - $db=openqrm_get_db_connection(); - $recordSet = $db->Execute($create_linuxcoe_volume_table); - break; - - case 'uninstall': - // remove linuxcoe_resource - $remove_linuxcoe_state = "drop table linuxcoe_state;"; - $db=openqrm_get_db_connection(); - $recordSet = $db->Execute($remove_linuxcoe_state); - // remove volume table - $drop_linuxcoe_volume_table = "drop table linuxcoe_volumes"; - $db=openqrm_get_db_connection(); - $recordSet = $db->Execute($drop_linuxcoe_volume_table); - break; - - - - default: - $event->log("$linuxcoe_command", $_SERVER['REQUEST_TIME'], 3, "linuxcoe-action", "No such event command ($linuxcoe_command)", "", "", 0, 0, 0); - break; - - -} - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/menu.txt deleted file mode 100644 index 83359b1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/menu.txt +++ /dev/null @@ -1,25 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|LinuxCOE -...|Create Templates|index.php?iframe=/systemdesigner-cgi-bin/coe_bootimage|Create new LinuxCOE Automatic-Installation Templates -...|Image Manager|index.php?plugin=linuxcoe&controller=linuxcoe|Linuxcoe Image Manager -...|Template Manager|index.php?plugin=linuxcoe&controller=linuxcoe-template|Manage LinuxCOE Automatic-Installation Templates -...|About|index.php?plugin=linuxcoe&controller=linuxcoe-about|How to use -...|Config|index.php?plugin=linuxcoe&controller=linuxcoe-about&linuxcoe_about_action=bootservice|LinuxCOE Boot-Service diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/openqrm-linuxcoe-appliance-hook.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/openqrm-linuxcoe-appliance-hook.php deleted file mode 100644 index 96f99ee..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/openqrm-linuxcoe-appliance-hook.php +++ /dev/null @@ -1,150 +0,0 @@ - -*/ - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -// special linuxcoe classes -require_once "$RootDir/plugins/linuxcoe/class/linuxcoestate.class.php"; -require_once "$RootDir/plugins/linuxcoe/class/linuxcoeresource.class.php"; - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - -function openqrm_linuxcoe_appliance($cmd, $appliance_fields) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $openqrm_server = new openqrm_server(); - $appliance_id=$appliance_fields["appliance_id"]; - $appliance_name=$appliance_fields["appliance_name"]; - $resource = new resource(); - $resource->get_instance_by_id($appliance_fields["appliance_resources"]); - $resource_mac=$resource->mac; - $resource_ip=$resource->ip; - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - $linuxcoe_install_timeout = 240; - // check appliance values, maybe we are in update and they are incomplete - if ($appliance->imageid == 1) { - return; - } - if (($resource->id == "-1") || ($resource->id == "")) { - return; - } - - // check if image is type linuxcoe-deployment - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - // linuxcoe configured in image deployment parameters ? - $linuxcoe_auto_install_enabled = false; - $linuxcoe_deployment_parameters = trim($image->get_deployment_parameter("INSTALL_CONFIG")); - if (strlen($linuxcoe_deployment_parameters)) { - $linuxcoe_deployment_parameter_arr = explode(":", $linuxcoe_deployment_parameters); - $local_deployment_persistent = $linuxcoe_deployment_parameter_arr[0]; - $local_deployment_type = $linuxcoe_deployment_parameter_arr[1]; - if (strcmp($local_deployment_type, "linuxcoe-deployment")) { - $event->log("openqrm_linuxcoe_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-linuxcoe-appliance-hook.php", "Appliance ".$appliance_id."/".$appliance_name." image is not from type linuxcoe-deployment", "", "", 0, 0, $resource->id); - return; - } - $linuxcoe_server_storage_id = $linuxcoe_deployment_parameter_arr[2]; - $linuxcoe_install_profile = $linuxcoe_deployment_parameter_arr[3]; - $linuxcoe_auto_install_enabled = true; - } - - - $event->log("openqrm_linuxcoe_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-linuxcoe-appliance-hook.php", "Handling $cmd event $appliance_id/$appliance_name/$resource_ip/$resource_mac", "", "", 0, 0, $resource->id); - switch($cmd) { - case "start": - $event->log("openqrm_linuxcoe_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-linuxcoe-appliance-hook.php", "START event $appliance_id/$appliance_name/$resource_ip/$resource_mac", "", "", 0, 0, $resource->id); - - if ($linuxcoe_auto_install_enabled) { - // prepare automatic-installation / transfer client to linuxcoe server - $linuxcoe_command = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/linuxcoe/bin/openqrm-linuxcoe-manager transfer_to_linuxcoe -x ".$resource->id." -i ".$resource_ip." -m ".$resource_mac." -n ".$linuxcoe_install_profile." --openqrm-cmd-mode background"; - $event->log("openqrm_linuxcoe_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-linuxcoe-appliance-hook.php", "transfer_to_linuxcoe $resource_ip / $linuxcoe_install_profile", "", "", 0, 0, $resource->id); - $openqrm_server->send_command($linuxcoe_command, NULL, true); - // Remove image-deployment paramters, if auto-install is a single-shot actions - if (!strcmp($local_deployment_persistent, "0")) { - $image->set_deployment_parameters("INSTALL_CONFIG", ""); - } - - // create linuxcoestate-state object to allow to run a late setboot to local command on the vm host - $linuxcoe_state = new linuxcoestate(); - $linuxcoe_state->remove_by_resource_id($resource->id); - $linuxcoe_state_fields=array(); - $linuxcoe_state_fields["linuxcoe_id"]=(int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $linuxcoe_state_fields["linuxcoe_resource_id"]=$resource->id; - $linuxcoe_state_fields["linuxcoe_install_start"]=$_SERVER['REQUEST_TIME']; - $linuxcoe_state_fields["linuxcoe_timeout"]=$linuxcoe_install_timeout; - $linuxcoe_state->add($linuxcoe_state_fields); - - - } else { - - if (strcmp($image->type, "linuxcoe-deployment")) { - $event->log("openqrm_linuxcoe_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-linuxcoe-appliance-hook.php", "Appliance $appliance_id/$appliance_name image is not from type linuxcoe-deployment", "", "", 0, 0, $resource->id); - } else { - // we have auto-installed already, if it is VM the linuxcoeresource object will care to set the boot-sequence on the VM Host to local boot - $linuxcoeresource = new linuxcoeresource(); - $linuxcoeresource->set_boot($resource->id, 1); - // set pxe config to local-boot - $event->log("openqrm_linuxcoe_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-linuxcoe-appliance-hook.php", "Setting resource $resource_ip to local-boot", "", "", 0, 0, $resource->id); - $linuxcoe_command = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/linuxcoe/bin/openqrm-linuxcoe-manager set_linuxcoe_client_to_local_boot -m ".$resource_mac." --openqrm-cmd-mode background"; - $openqrm_server->send_command($linuxcoe_command, NULL, true); - } - } - break; - - - case "stop": - - if (strcmp($image->type, "linuxcoe-deployment")) { - $event->log("stop", $_SERVER['REQUEST_TIME'], 5, "openqrm-linuxcoe-appliance-hook.php", "Appliance $appliance_id/$appliance_name image is not from type linuxcoe-deployment", "", "", 0, 0, $resource->id); - } else { - $event->log("stop", $_SERVER['REQUEST_TIME'], 5, "openqrm-linuxcoe-appliance-hook.php", "Stop event for appliance ".$appliance_id."/".$appliance->name.".", "", "", 0, 0, $resource->id); - // remove linuxcoestate-state object if existing - $local_storage_state = new linuxcoestate(); - $local_storage_state->remove_by_resource_id($resource->id); - // if it is VM the linuxcoeresource object will care to set the boot-sequence on the VM Host to network boot - $linuxcoeresource = new linuxcoeresource(); - $linuxcoeresource->set_boot($resource->id, 0); - - } - break; - - - } - - -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/openqrm-linuxcoe-monitor-hook.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/openqrm-linuxcoe-monitor-hook.php deleted file mode 100644 index 5ccafdf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/openqrm-linuxcoe-monitor-hook.php +++ /dev/null @@ -1,73 +0,0 @@ - -*/ - -// error_reporting(E_ALL); -$thisfile = basename($_SERVER['PHP_SELF']); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -$BaseDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/image_authentication.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/event.class.php"; -// special linuxcoe classes -require_once "$RootDir/plugins/linuxcoe/class/linuxcoestate.class.php"; -require_once "$RootDir/plugins/linuxcoe/class/linuxcoeresource.class.php"; - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -$event = new event(); -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; - - - -// this function is going to manage the linuxcoe installation states -function openqrm_linuxcoe_monitor() { - global $event; - global $RootDir; - global $openqrm_server; - global $OPENQRM_SERVER_BASE_DIR; - - // $event->log("openqrm_linuxcoe_monitor", $_SERVER['REQUEST_TIME'], 5, "openqrm-linuxcoe-monitor-hook.php", "Checking the linuxcoe states .....", "", "", 0, 0, 0); - $now = $_SERVER['REQUEST_TIME']; - $linuxcoe_state_monitor = new linuxcoestate(); - $linuxcoe_state_id_arr = $linuxcoe_state_monitor->get_all_ids(); - foreach($linuxcoe_state_id_arr as $linuxcoe_state_id_db) { - $linuxcoe_state_id = $linuxcoe_state_id_db['linuxcoe_id']; - $linuxcoe_state = new linuxcoestate(); - $linuxcoe_state->get_instance_by_id($linuxcoe_state_id); - $linuxcoe_time_diff = $now - $linuxcoe_state->install_start; - if ($linuxcoe_time_diff >= $linuxcoe_state->timeout) { - $event->log("openqrm_linuxcoe_monitor", $_SERVER['REQUEST_TIME'], 5, "openqrm-linuxcoe-monitor-hook.php", "Linuxcoe states resource ".$linuxcoe_state->resource_id." timeout, setting to localboot.....", "", "", 0, 0, 0); - $linuxcoeresource = new linuxcoeresource(); - $linuxcoeresource->set_boot($linuxcoe_state->resource_id, 1); - // remove - $linuxcoe_state->remove($linuxcoe_state->id); - } else { - $event->log("openqrm_linuxcoe_monitor", $_SERVER['REQUEST_TIME'], 5, "openqrm-linuxcoe-monitor-hook.php", "Linuxcoe states still waiting for ".$linuxcoe_state->resource_id." timeout to appear .....", "", "", 0, 0, 0); - } - } -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/template.linuxcoe-deployment.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/template.linuxcoe-deployment.php deleted file mode 100644 index d6e34d3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/template.linuxcoe-deployment.php +++ /dev/null @@ -1,91 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - -function wait_for_linuxcoe_netboot_product_list($sfile) { - $refresh_delay=1; - $refresh_loop_max=20; - $refresh_loop=0; - while (!file_exists($sfile)) { - sleep($refresh_delay); - $refresh_loop++; - flush(); - if ($refresh_loop > $refresh_loop_max) { - return false; - } - } - return true; -} - -function get_linuxcoe_deployment_templates($local_storage_storage_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - $StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/linuxcoe/profiles'; - $local_deployment_tepmplates_identifier_array = array(); - if ($handle = opendir($StorageDir)) { - while (false !== ($file = readdir($handle))) { - if ($file != "." && $file != "..") { - $openqrm_profile_info = ""; - $openqrm_info_file = $StorageDir."/".$file."/openqrm.info"; - if (file_exists($openqrm_info_file)) { - $openqrm_profile_info = file_get_contents($openqrm_info_file); - } else { - $openqrm_profile_info = file_get_contents($file); - } - $openqrm_install_parameter = "linuxcoe-deployment:0:".$file; - $local_deployment_tepmplates_identifier_array[] = array("value" => $openqrm_install_parameter, "label" => $openqrm_profile_info); - } - } - closedir($handle); - } - return $local_deployment_tepmplates_identifier_array; -} - - -function get_linuxcoe_deployment_methods() { - // select template - $linuxcoe_deployment_methods_array = array("value" => "linuxcoe-deployment", "label" => "Automatic Linux Installation (LinuxCOE)"); - return $linuxcoe_deployment_methods_array; -} - - -function get_linuxcoe_deployment_additional_parameters() { - // possible 4 additional inputs for addtional parameters - $local_deployment_additional_parameters[] = ''; -// $local_deployment_additional_parameters[] = array("value" => "", "label" => 'Product-Key'); -// $local_deployment_additional_parameters[] = array("value" => "", "label" => 'Key2'); -// $local_deployment_additional_parameters[] = array("value" => "", "label" => 'Key3'); -// $local_deployment_additional_parameters[] = array("value" => "", "label" => 'Key4'); - return $local_deployment_additional_parameters; -} - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-about-bootservice.tpl.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-about-bootservice.tpl.php deleted file mode 100644 index 96fac92..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-about-bootservice.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    - -
    -
    -

    {boot_service_title}

    - {boot_service_content} -
    -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-about-documentation.tpl.php deleted file mode 100644 index dc09439..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-about-documentation.tpl.php +++ /dev/null @@ -1,47 +0,0 @@ - - - -

    {label}

    - -
    -
    -

    {introduction_title}

    - {introduction_content} - -

    {provides_title}

    - {provides_list} - -

    {requirements_title}

    - {requirements_list} - -

    {howto_title}

    - {howto_list} - -
    -
    -

    {type_title}

    - {type_content} - -

    {deployment_title}

    - {deployment_content} - -

    {tested_title}

    - {tested_content} - -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-add.tpl.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-add.tpl.php deleted file mode 100644 index 396d44c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-add.tpl.php +++ /dev/null @@ -1,26 +0,0 @@ - -

    {label}

    -
    -{form} -
    - {name} - {root} - {description} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-clone.tpl.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-clone.tpl.php deleted file mode 100644 index 329822d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-clone.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    -
    - {form} -
    - {name} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-edit.tpl.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-edit.tpl.php deleted file mode 100644 index d94e5c0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-edit.tpl.php +++ /dev/null @@ -1,32 +0,0 @@ - -

    {label}

    - -
    -
    -
    {lang_id}: {id}
    -
    {lang_name}: {name}
    -
    {lang_resource}: {resource}
    -
    {lang_state}: {state}
    -
    - -
    -
    {add}
    -
    -
     
    - {table} -
    diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-remove.tpl.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-remove.tpl.php deleted file mode 100644 index f86e797..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-remove.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ - -

    {label}

    -
    -
    - {form} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-select.tpl.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-select.tpl.php deleted file mode 100644 index 111f228..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-select.tpl.php +++ /dev/null @@ -1,18 +0,0 @@ - -

    {label}

    -{table} diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-template-edit.tpl.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-template-edit.tpl.php deleted file mode 100644 index c5ed75b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-template-edit.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    -
    -
    - {form} - {template_comment} - {template_post} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-template-remove.tpl.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-template-remove.tpl.php deleted file mode 100644 index f86e797..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-template-remove.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ - -

    {label}

    -
    -
    - {form} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-template-select.tpl.php b/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-template-select.tpl.php deleted file mode 100644 index a68bfff..0000000 --- a/openQRM-5.3.50-CE/src/plugins/linuxcoe/web/tpl/linuxcoe-template-select.tpl.php +++ /dev/null @@ -1,19 +0,0 @@ - - -

    {linuxcoe_title}

    -{table} diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/Makefile b/openQRM-5.3.50-CE/src/plugins/local-server/Makefile deleted file mode 100644 index 4e37e0e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# this is the openQRM local-server-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/etc/templates - . $(OPENQRM_SERVER_CONF) && cp etc/templates/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/etc/templates/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.local-server $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/bin/openqrm* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/lang/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/tpl/ - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/local-server - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/local-server/ - - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/bin/openqrm-local-server b/openQRM-5.3.50-CE/src/plugins/local-server/bin/openqrm-local-server deleted file mode 100644 index d6b3ccf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/bin/openqrm-local-server +++ /dev/null @@ -1,8 +0,0 @@ -clear -echo '#################### Please notice !! #################' -echo '# The distributed system management openQRM feature #' -echo '# local-server is available in the Enterprise Edtion! #' -echo '# #' -echo '# Please check http://www.openqrm-enterprise.com/ #' -echo '#######################################################' -echo '' diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/etc/init.d/openqrm-plugin-local-server b/openQRM-5.3.50-CE/src/plugins/local-server/etc/init.d/openqrm-plugin-local-server deleted file mode 100644 index 31dfacc..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/etc/init.d/openqrm-plugin-local-server +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash -# init script for the openQRM local-server-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/include/openqrm-plugin-local-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/etc/openqrm-plugin-local-server.conf -openqrm_server_get_config - - -function openqrm_plugin_local_server_start() { - echo "Starting the openQRM local-server-plugin" - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/local-server/.running -} - - -function openqrm_plugin_local_server_stop() { - echo "Stopping the openQRM local-server-plugin" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/local-server/.running -} - -function openqrm_plugin_local_server_uninstall() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "local-server: Please give a username to uninstall the plugin : " - read USERNAME - echo - echo -n "local-server: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Uninstalling the openQRM local-server-plugin" - openqrm_plugin_local_server_stop - openqrm_server_remove_deployment_type $USERNAME $PASSWORD local-server - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/local-server - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.local-server - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/openqrm-functions - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/openqrm-package-functions - -} - -function openqrm_plugin_local_server_init() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "local-server: Please give a username to init the plugin : " - read USERNAME - echo - echo -n "local-server: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Initializing the openQRM local-server-plugin" - openqrm_server_add_deployment_type $USERNAME $PASSWORD local-server local-server "Local-installed server" local-server "Local-installed server" - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/local-server - chmod +x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/root-mount.local-server - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/root-mount.local-server $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.local-server - # create openqrm-local-vm-client - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/local-vm - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/etc/templates/openqrm-local-vm-client | \ - sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" | \ - sed -e "s#@@OPENQRM_SERVER_IP_ADDRESS@@#$OPENQRM_SERVER_IP_ADDRESS#g" | \ - sed -e "s#@@OPENQRM_WEB_PROTOCOL@@#$OPENQRM_WEB_PROTOCOL#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/local-vm/openqrm-local-vm-client - chmod +x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/web/local-vm/openqrm-local-vm-client - # linking function files to enable downloading them - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/openqrm-functions - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/openqrm-package-functions - -} - -USER=$2 -PASS=$3 - -case "$1" in - start) - openqrm_plugin_local_server_start - ;; - stop) - openqrm_plugin_local_server_stop - ;; - restart) - openqrm_plugin_local_server_stop - sleep 1 - openqrm_plugin_local_server_start - ;; - init) - openqrm_plugin_local_server_init $USER $PASS - ;; - uninstall) - openqrm_plugin_local_server_uninstall $USER $PASS - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/etc/init.d/openqrm-plugin-local-server.postinstall b/openQRM-5.3.50-CE/src/plugins/local-server/etc/init.d/openqrm-plugin-local-server.postinstall deleted file mode 100644 index 29cd21b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/etc/init.d/openqrm-plugin-local-server.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-local-server postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/etc/init.d/openqrm-plugin-local-server.preremove b/openQRM-5.3.50-CE/src/plugins/local-server/etc/init.d/openqrm-plugin-local-server.preremove deleted file mode 100644 index 42e9f76..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/etc/init.d/openqrm-plugin-local-server.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-local-server preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-local-server stop diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/etc/openqrm-plugin-local-server.conf b/openQRM-5.3.50-CE/src/plugins/local-server/etc/openqrm-plugin-local-server.conf deleted file mode 100644 index f3cab68..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/etc/openqrm-plugin-local-server.conf +++ /dev/null @@ -1,38 +0,0 @@ -# this is the openQRM-plugin-local-server info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Integrates existing, local-installed Server into openQRM." -OPENQRM_PLUGIN_TYPE="misc" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/local-server/etc/openqrm-plugin-local-server.conf" - diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/etc/templates/openqrm-local-vm-client b/openQRM-5.3.50-CE/src/plugins/local-server/etc/templates/openqrm-local-vm-client deleted file mode 100644 index 401ccfe..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/etc/templates/openqrm-local-vm-client +++ /dev/null @@ -1,312 +0,0 @@ -#!/bin/bash -# openqrm-local-vm-client openQRM init script for local-VMs -# - kvm-storage, xen-storage, lxc-storage, openvz-storage, ... -# -# chkconfig: 2345 98 19 -# description: openQRM is the next generation Linux Data Center management - -# support for LSB init scripts -### BEGIN INIT INFO -# Provides: openqrm-local-vm-client -# Required-Start: $all -# Required-Stop: $all -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 2 6 -# Short-Description: openQRM init script for local-VMs -# Description: openQRM init script for local-VMs -### END INIT INFO - -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# some defines setup by the plugin init -########################################################### -OPENQRM_SERVER_BASE_DIR=@@OPENQRM_SERVER_BASE_DIR@@ -export OPENQRM_SERVER_BASE_DIR -OPENQRM_WEB_PROTOCOL=@@OPENQRM_WEB_PROTOCOL@@ -export OPENQRM_WEB_PROTOCOL -OPENQRM_SERVER_IP_ADDRESS=@@OPENQRM_SERVER_IP_ADDRESS@@ -export OPENQRM_SERVER_IP_ADDRESS -########################################################### - -export OPENQRM_SOURCE_DIR=$OPENQRM_SERVER_BASE_DIR/openqrm -export LANG=C -PATH=/usr/bin:/sbin:/bin:/usr/sbin -export PATH -LOCKFILE=/var/lock/subsys/openqrm -mkdir -p $(dirname $LOCKFILE) -mkdir -p /var/openqrm - -# define wget to use with https -if [ "$OPENQRM_WEB_PROTOCOL" == "https" ]; then - WGET="wget -q --no-check-certificate" -else - WGET="wget -q" -fi - -# do not run on the initrd phase -if [ -f /etc/initrd-devices.conf ]; then - exit 0 -fi - -if [ -f /var/openqrm/openqrm-resource.conf ]; then - . /var/openqrm/openqrm-resource.conf - # make sure to have a valid backup of the parameters, at least including the openQRM server ip - if [ ! -f /var/openqrm/openqrm-resource.conf.last ]; then - /bin/cp -f /var/openqrm/openqrm-resource.conf /var/openqrm/openqrm-resource.conf.last - fi - if [ "$resource_mac" == "" ]; then - /bin/cp -f /var/openqrm/openqrm-resource.conf.last /var/openqrm/openqrm-resource.conf - . /var/openqrm/openqrm-resource.conf - # if we still do not have a mac address here set it to xxxxxxxxxxxxxx which probes later - if [ "$resource_mac" == "" ]; then - resource_mac="xxxxxxxxxxxxxxxxxx" - fi - fi -fi -export resource_mac - -# install/uninstall -FILE_NAME=$(basename $0) -if [ "$1" == "" ]; then - # this should be a fresh installation, check to setup everyting in place - if [ ! -x $OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/$FILE_NAME ]; then - # check for udev persistant net-rules - if [ -f /etc/udev/rules.d/70-persistent-net.rules ]; then - rm -f /etc/udev/rules.d/70-persistent-net.rules - ln -sf /dev/null /etc/udev/rules.d/70-persistent-net.rules - fi - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/ - /bin/cp -f $0 $OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/ - chmod +x $OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/$FILE_NAME - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/$FILE_NAME /etc/init.d/$FILE_NAME - /etc/init.d/$FILE_NAME start - exit 0 - fi -elif [ "$1" == "uninstall" ]; then - if [ -x "$OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/$FILE_NAME" ]; then - $OPENQRM_SERVER_BASE_DIR/openqrm/etc/init.d/$FILE_NAME stop - fi - if [ -f "$OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions" ] && [ -f "$OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions" ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions - openqrm_chkconfig del openqrm-local-vm-client - fi - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm - rm -f /etc/init.d/$FILE_NAME - exit 0 -fi - - - -# gets/starts/stops enabled boot-services for the resources -function openqrm_boot_service() { - local BOOT_SERVICE=$1 - local BOOT_SERVICE_CMD=$2 - local CURRENT=`pwd` - - # get + install the package during start - if [ "$BOOT_SERVICE_CMD" == "start" ]; then - echo "Getting boot-service package $BOOT_SERVICE" - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$BOOT_SERVICE - cd $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$BOOT_SERVICE - if ! $WGET $OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/boot-service-$BOOT_SERVICE.tgz; then - echo "ERROR: Could not get boot-service package for boot-service $BOOT_SERVICE !" - return 1 - fi - tar -xzf boot-service-$BOOT_SERVICE.tgz - rm -f boot-service-$BOOT_SERVICE.tgz - # get optional custom appliance config - if [ "$appliance_name" != "" ]; then - if $WGET -O $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$BOOT_SERVICE/etc/openqrm-plugin-$BOOT_SERVICE.conf.$appliance_name.conf $OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/plugins/$BOOT_SERVICE/openqrm-plugin-$BOOT_SERVICE.$appliance_name.conf; then - echo "- applying custom $BOOT_SERVICE boot-service configuration for appliance $appliance_name" - /bin/cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$BOOT_SERVICE/etc/openqrm-plugin-$BOOT_SERVICE.conf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$BOOT_SERVICE/etc/openqrm-plugin-$BOOT_SERVICE.conf.default - /bin/cp -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$BOOT_SERVICE/etc/openqrm-plugin-$BOOT_SERVICE.conf.$appliance_name.conf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$BOOT_SERVICE/etc/openqrm-plugin-$BOOT_SERVICE.conf - fi - fi - - fi - # run the boot-service cmd - BOOT_SERVICE_INIT="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/$BOOT_SERVICE/etc/init.d/$BOOT_SERVICE" - if [ -x $BOOT_SERVICE_INIT ]; then - echo "Running $BOOT_SERVICE_CMD on boot-service $BOOT_SERVICE" - $BOOT_SERVICE_INIT $BOOT_SERVICE_CMD - fi - cd $CURRENT -} - - - - - -function openqrm_client_start() { - echo "Starting openQRM-local-vm-client" - openqrm_client_stop 1>/dev/null 2>&1 - START_RETRY=0 - LOOP_CONNECT=0 - MAX_CONNECT=5 - - # network up ? - echo "NOTICE: Checking connection to openQRM server at $OPENQRM_SERVER_IP_ADDRESS" - while ! $WGET -q -t 1 -T 4 -O /dev/null "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/resource-monitor.php"; do - echo -n "." - sleep 2 - LOOP_CONNECT=$(( LOOP_CONNECT + 1 )) - if [ "$LOOP_CONNECT" == "$MAX_CONNECT" ]; then - echo "NOTICE: Could not connect to openQRM server at $OPENQRM_SERVER_IP_ADDRESS!" - # exit good here without starting the boot-services since we cannot reach openQRM anyway - exit 0 - fi - done - - # download function files - if [ ! -f "$OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions" ]; then - mkdir $OPENQRM_SERVER_BASE_DIR/openqrm/include/ - if ! $WGET -q -t 1 -T 4 -O $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/openqrm-functions"; then - echo "NOTICE: Could not connect to openQRM server at $OPENQRM_SERVER_IP_ADDRESS!" - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - # exit good here without starting the boot-services since we cannot reach openQRM anyway - exit 0 - fi - fi - if [ ! -f "$OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions" ]; then - if ! $WGET -q -t 1 -T 4 -O $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/boot-service/openqrm-package-functions"; then - echo "NOTICE: Could not connect to openQRM server at $OPENQRM_SERVER_IP_ADDRESS!" - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions - # exit good here without starting the boot-services since we cannot reach openQRM anyway - exit 0 - fi - fi - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions - openqrm_chkconfig add openqrm-local-vm-client - - # check if we have resource_mac, if not try to find the right interface integrated in openQRM - if ifconfig -a | grep ^e | grep -i $resource_mac &>/dev/null; then - if ! $WGET -q -t 1 -T 4 -O /var/openqrm/openqrm-resource.conf "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_mac=$resource_mac"; then - # restore - /bin/cp -f /var/openqrm/openqrm-resource.conf.last /var/openqrm/openqrm-resource.conf - echo "NOTICE: Could not refresh resource-parameters. Using previous one." - else - . /var/openqrm/openqrm-resource.conf - fi - else - # here we do not found the resource_mac on one of the systems network cards - # assuming auto-install or clone to local-disk - if [ -f /var/openqrm/openqrm-resource.conf ]; then - /bin/cp -f /var/openqrm/openqrm-resource.conf /var/openqrm/openqrm-resource.conf.previous_res - fi - - # centos 7 is using a different ifconfig output - RESOURCE_MAC_LIST=`ifconfig -a | grep ^e | grep -v ":oq" | awk '{ print $5 }'` - if [ "$RESOURCE_MAC_LIST" == "" ]; then - RESOURCE_MAC_LIST=`ifconfig -a | grep -A3 ^e | grep -v :oq | grep ether | awk '{ print $2 }'` - fi - for RESOURCE_MAC in $RESOURCE_MAC_LIST; do - echo "NOTICE: Refreshing resource-parameters. Trying $RESOURCE_MAC." - rm -f /var/openqrm/openqrm-resource.conf - if $WGET -q -t 1 -T 4 -O /var/openqrm/openqrm-resource.conf "$OPENQRM_WEB_PROTOCOL://$OPENQRM_SERVER_IP_ADDRESS/openqrm/action/resource-monitor.php?resource_command=get_parameter&resource_mac=$RESOURCE_MAC"; then - if grep -i $RESOURCE_MAC /var/openqrm/openqrm-resource.conf &>/dev/null; then - . /var/openqrm/openqrm-resource.conf - break - fi - fi - done - fi - # start openqrm-monitord if existing -> vm plugin config dependent if monitoring is on the Host or VM - if [ -x $resource_basedir/openqrm/sbin/openqrm-monitord ]; then - if [ ! -d /tmp ]; then mkdir -p /tmp; fi - nohup $resource_basedir/openqrm/sbin/openqrm-monitord 1>/tmp/openqrm-monitord.out 2>&1 & - rm -f /tmp/openqrm-monitord.out - fi - openqrm_post_event $resource_id "openqrm-client" 5 openqrm_client_start "Resource $resource_id fully started" - # allow to overwrite the resource-configuration e.g. for cluster-resources - if [ -f /var/openqrm/openqrm-resource.conf.static ]; then - cat /var/openqrm/openqrm-resource.conf.static >> /var/openqrm/openqrm-resource.conf - fi - # set the image password if not idle - if [ "$resource_image" != "idle" ]; then - if $WGET -O /tmp/iauth.$image_id $openqrm_web_protocol://$resource_openqrmserver/openqrm/action/image-auth/iauth.$image_id.php 2>/tmp/iauth.log; then - cryptedpassword=`cat /tmp/iauth.$image_id` - rm -f /tmp/iauth.$image_id /tmp/iauth.log - if [ "$cryptedpassword" != "" ]; then - sed -i "s#^root:[^:]*#root:$cryptedpassword#" /etc/shadow - sed -i "s#^root:[^:]*#root:$cryptedpassword#" /etc/shadow- - fi - fi - # if not idle make sure acpid is installed - if [ -f /etc/debian_version ]; then - if ! openqrm_full_fill_os_dependency acpid acpid; then - echo "ERROR: Could not install acpid! Please install manually." - fi - elif [ -f /etc/redhat-release ]; then - if ! openqrm_full_fill_os_dependency acpid acpid; then - echo "ERROR: Could not install acpid! Please install manually." - fi - elif [ -f /etc/SuSE-release ]; then - if ! openqrm_full_fill_os_dependency acpid acpid; then - echo "ERROR: Could not install acpid! Please install manually." - fi - fi - fi - - # start boot-services from enabled plugins - for boot_service in $openqrm_boot_services; do - openqrm_boot_service $boot_service start - done - touch ${LOCKFILE} -} - - -function openqrm_client_stop() { - echo "Stopping openQRM-local-vm-client" - # stop boot-services from enabled plugins - for boot_service in $openqrm_boot_services; do - openqrm_boot_service $boot_service stop - done - /bin/rm -f ${LOCKFILE} -} - - -function openqrm_client_status() { - if [ -f ${LOCKFILE} ]; then - echo "openQRM-local-vm-client service is running" - else - echo "openQRM-local-vm-client service is not running" - fi -} - - - -case "$1" in - start) - openqrm_client_start - ;; - stop) - openqrm_client_stop - ;; - status) - openqrm_client_status - ;; - restart) - openqrm_client_stop - openqrm_client_start - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|uninstall}" - exit 1 - ;; -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/include/openqrm-plugin-local-server-assign-hook b/openQRM-5.3.50-CE/src/plugins/local-server/include/openqrm-plugin-local-server-assign-hook deleted file mode 100644 index 01eb59a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/include/openqrm-plugin-local-server-assign-hook +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# This function gets called after writing the resource pxe-config file -# It re-writes the config localboot -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - - -function local_server_assign_hook() { - - local OPENQRM_RESOURCE_ID=$1 - local OPENQRM_KERNEL_NAME=$2 - local OPENQRM_RESOURCE_PXELINUXCFG_FILE=$3 - local OPENQRM_RESOURCE_MAC=`echo $OPENQRM_RESOURCE_PXELINUXCFG_FILE | sed -e "s/01-//g" | sed -e "s/-/:/g"` - - if ! echo $OPENQRM_KERNEL_NAME | grep default 1>/dev/null; then - if [ "$OPENQRM_KERNEL_NAME" == "resource$OPENQRM_RESOURCE_ID" ]; then - echo "local-server-plugin: Running assign hook with $OPENQRM_RESOURCE_ID $OPENQRM_KERNEL_NAME $OPENQRM_RESOURCE_PXELINUXCFG_FILE" - echo "local-server-plugin: Running assign hook with $OPENQRM_RESOURCE_ID $OPENQRM_KERNEL_NAME $OPENQRM_RESOURCE_PXELINUXCFG_FILE" | logger - - # get more infos about the resource - openqrm_get_resource_parameter $OPENQRM_RESOURCE_MAC - if echo $resource_capabilities | grep TYPE | grep local-server 1>/dev/null; then - openqrm_server_set_boot local $resource_id $resource_mac $resource_ip - fi - else - echo "local-server-plugin: Resource $OPENQRM_RESOURCE_ID netbooting. Skipping local-assign" | logger - fi - fi - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/include/openqrm-plugin-local-server-functions b/openQRM-5.3.50-CE/src/plugins/local-server/include/openqrm-plugin-local-server-functions deleted file mode 100644 index 3fb60c2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/include/openqrm-plugin-local-server-functions +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# this is the functions file for the local-server-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - - diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/class/local-server-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/local-server/web/class/local-server-about.controller.class.php deleted file mode 100644 index 3f8cc4b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/web/class/local-server-about.controller.class.php +++ /dev/null @@ -1,288 +0,0 @@ - - */ - -class local_server_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'local_server_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'local_server_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'local_server_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'local_server_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About Local-Server', - 'label' => 'About Local-Server', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The local-server-plugin provides an integration for already existing, local-installed systems in openQRM. - After integrating an existing, local-installed server it can be used "grab" the systems root-fs and transform - it to an openQRM server-image. It also allows to dynamically deploy network-booted server images while - still being able to restore/restart the existing server-system located on the local-harddisk. - No manual configuration is needed.', - 'requirements_title' => 'Requirements', - 'requirements_list' => '
  • none
  • ', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - 'provides_title' => 'Provides', - 'provides_list' => '
  • Integrates existing, local installed Systems into openQRM
  • ', - 'type_title' => 'Plugin Type', - 'type_content' => 'Misc', - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - ), - 'usage' => array ( - 'tab' => 'About Local-Server', - 'label' => 'Local-Server Use-Cases', - 'usage_integrate_title' => 'Local-Server Integrate', - 'usage_integrate_content' => '
    • Copy (scp) the "openqrm-local-server" utility to an existing, local-installed server in your network

      - scp %s/plugins/local-server/bin/openqrm-local-server [ip-address-of-existing-server]:/tmp/ -

      -
    • - Execute the "openqrm-local-server" utility on the remote system via ssh e.g. : -

      - ssh [ip-address-of-existing-server] /tmp/openqrm-local-server integrate -u openqrm -p openqrm -q %s -i eth0 [-s http/https] -

      -
    • - The system now appears in the openQRM-server as new resource -

      - It should be now set to "network-boot" in its BIOS to allow dynamic assign- and deployment. -
      - The resource can now be used to e.g. create a new "storage-server" within openQRM. -
    • - After setting the system to "network-boot" in its BIOS it also can be used to deploy server-images from diffrent types. -
    ', - 'usage_remove_title' => 'Local-Server Remove', - 'usage_remove_content' => '
    • To remove a system from openQRM integrated via the local-server plugin run the "openqrm-local-server" utility again. e.g. :

      - ssh [ip-address-of-existing-server] /tmp/openqrm-local-server remove -u openqrm -p openqrm -q %s [-s http/https] -

      -
    ', - - ), - 'localvm' => array ( - 'tab' => 'About Local VMs', - 'label' => 'Local-Server for Local Virtual Machines', - 'usage_localvm_title' => 'How to use Local-Server for Local Virtual Machines', - 'usage_localvm' => 'For local-installed Virtual Machines (e.g. kvm-storage, xen-storage, lxc-storage, openvz-storage) - which have access to the openQRM network there is an "openqrm-local-vm-client" available. - This "openqrm-local-vm-client" just starts and stops the plugin-boot-services to allow further management functionality. - Monitoring and openQRM actions are still running on behalf of the VM Host.', - 'usage_integrate_localvm' => '
    • Download/Copy the "openqrm-local-vm-client" to a local installed VM

      - scp openqrm-local-vm-client [ip-address-of-existing-server]:/tmp/ -

      -
    • - Execute the "openqrm-local-vm-client" on the VM -

      - openqrm-local-vm-client -

      -
    • - The "openqrm-local-vm-client" fully automatically configures itself. -
    ', - ), - -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/local-server/lang", 'local-server-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/local-server/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "documentation"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - case 'localvm': - $content[] = $this->localvm(true); - break; - case 'usage': - $content[] = $this->usage(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About Local-Server - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/local-server/class/local-server-about.documentation.class.php'); - $controller = new local_server_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - - - - //-------------------------------------------- - /** - * About Local-Server VM management - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function localvm( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/local-server/class/local-server-about.localvm.class.php'); - $controller = new local_server_about_localvm($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['localvm']; - $data = $controller->action(); - } - $content['label'] = $this->lang['localvm']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'localvm' ); - $content['onclick'] = false; - if($this->action === 'localvm'){ - $content['active'] = true; - } - return $content; - } - - - - //-------------------------------------------- - /** - * About Local-Server Use-Cases - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function usage( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/local-server/class/local-server-about.usage.class.php'); - $controller = new local_server_about_usage($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['usage']; - $data = $controller->action(); - } - $content['label'] = $this->lang['usage']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'usage' ); - $content['onclick'] = false; - if($this->action === 'usage'){ - $content['active'] = true; - } - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/class/local-server-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/local-server/web/class/local-server-about.documentation.class.php deleted file mode 100644 index 7ad2e05..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/web/class/local-server-about.documentation.class.php +++ /dev/null @@ -1,89 +0,0 @@ - - */ - -class local_server_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'local_server_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "local_server_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/local-server-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/class/local-server-about.localvm.class.php b/openQRM-5.3.50-CE/src/plugins/local-server/web/class/local-server-about.localvm.class.php deleted file mode 100644 index cf4f0fc..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/web/class/local-server-about.localvm.class.php +++ /dev/null @@ -1,82 +0,0 @@ - - */ - -class local_server_about_localvm -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'local_server_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "local_server_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/local-server-about-localvm.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['usage_localvm'], 'usage_localvm'); - $t->add($this->lang['usage_localvm_title'], 'usage_localvm_title'); - $t->add($this->lang['usage_integrate_localvm'], 'usage_integrate_localvm'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/class/local-server-about.usage.class.php b/openQRM-5.3.50-CE/src/plugins/local-server/web/class/local-server-about.usage.class.php deleted file mode 100644 index 753ece7..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/web/class/local-server-about.usage.class.php +++ /dev/null @@ -1,85 +0,0 @@ - - */ - -class local_server_about_usage -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'local_server_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "local_server_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $resource = new resource(); - $resource->get_instance_by_id(0); - $t = $this->response->html->template($this->tpldir.'/local-server-about-usage.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['usage_integrate_title'], 'usage_integrate_title'); - $t->add($this->lang['usage_remove_title'], 'usage_remove_title'); - $t->add(sprintf($this->lang['usage_integrate_content'], $this->basedir, $resource->ip), 'usage_integrate_content'); - $t->add(sprintf($this->lang['usage_remove_content'], $resource->ip), 'usage_remove_content'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/css/local-server.css b/openQRM-5.3.50-CE/src/plugins/local-server/web/css/local-server.css deleted file mode 100644 index 68ff08e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/web/css/local-server.css +++ /dev/null @@ -1,16 +0,0 @@ -/*-Icon classes ----- */ -a.graphs { - padding: 0; - border: 0px none; - width: 32px; - height: 32px; - display:block; - text-align: center; - text-decoration: none; - line-height: 0px; - overflow: hidden; - color: transparent; -} -a.graphs { - background: url('/openqrm/base/plugins/local-server/img/plugin.png') no-repeat center top; -} diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/local-server/web/img/plugin.png deleted file mode 100644 index f9ff505..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/local-server/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/lang/de.local-server-about.ini b/openQRM-5.3.50-CE/src/plugins/local-server/web/lang/de.local-server-about.ini deleted file mode 100644 index a93d787..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/web/lang/de.local-server-about.ini +++ /dev/null @@ -1,51 +0,0 @@ -[documentation] -tab = "Über Local-Server" -label = "Über Local-Server" -introduction_title = "Einleitung" -introduction_content = "

    Das Local-Server-Plugin ermöglicht die Integration von bereits existierenden Systemen. Das auf der lokalen Festplatte dieser Server installierte System wird als Image erfasst und in openQRM, z.B. zur Provisionierung weiterer (virtueller) Maschinen, bereitgestellt.

    -

    Manuelle Konfiguration dieses Plugins ist nicht nötig.

    " - -requirements_title = "Anforderungen" -requirements_list = "keine" -tested_title = "Getestet mit" -tested_content = "

    Dieses Plugin ist getestet mit Debian, Ubuntu und CentOS

    " - -provides_title = "Bietet" -provides_list = "

    Integration von bereits bestehenden Systemen in openQRM

    " - -type_title = "Plugin-Typ" -type_content = "Misc" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" - - -[usage] -tab = "Über Local-Server" -label = "Anwendungsfälle für Local-Server" - -usage_integrate_title = "Local-Server einrichten" -usage_integrate_content = "

    Kopieren Sie das openqrm-local-server Utility auf ein bestehendes lokal installiertes System (z.B. per scp):

    -
    scp %s/plugins/local-server/bin/openqrm-local-server [ip-address-of-existing-server]:/tmp/
    - -

    Führen Sie openqrm-local-server auf dem System aus (z.B. per ssh):

    -
    ssh [ip-address-of-existing-server] /tmp/openqrm-local-server integrate -u openqrm -p openqrm -q %s -i eth0 [-s http/https]
    - -

    Das System erscheint nun in openQRM als neue Ressource. Der openQRM-Client wird auf dem System gestartet und ermöglicht, dieses vollständig über openQRM zu verwalten. Falls Netzwerk-Deployment mit PXE benötigt wird, muss das System nun im BIOS auf 'Netzwerk-Boot' (PXE) eingestellt werden. Die Ressource kann nun in openQRM benutzt werden, um z.B. als neuer Storage-Host in openQRM zu dienen.

    " -usage_remove_title = "Local-Server entfernen" -usage_remove_content = "

    Um ein mit diesem Plugin integriertes System aus openQRM zu entfernen führen Sie das openqrm-local-server Utility nochmals mit dem Parameter 'remove' aus:

    -
    ssh [ip-address-of-existing-server] /tmp/openqrm-local-server remove -u openqrm -p openqrm -q %s [-s http/https]
    " - -[localvm] -tab = "Über Lokale VMs" -label = "Local-Server für Lokale Virtuelle Maschinen" -usage_localvm_title = "Einrichten von Local-Server für lokale virtuelle Maschinen" -usage_localvm = "Für lokal installierte virtuelle Maschinen, die Zugang zum openQRM-Verwaltungsnetzwerk haben, bietet sich an den openqrm-local-vm-client einzusetzen. openqrm-local-vm-client aktiviert NUR die Plugin-Boot-Services und erlaubt erweiterte Administrationsfunktionen. Überwachung und Steuerung der lokalen virtuellen Maschinen wird über den VM-Host ausgeführt.

    " -usage_integrate_localvm = "

    Kopieren Sie den openqrm-local-vm-client auf eine lokal installierte VM:

    -
    scp openqrm-local-vm-client [ip-address-of-existing-server]:/tmp/
    - -

    Führen Sie den openqrm-local-vm-client auf der VM aus:

    -
    openqrm-local-vm-client
    - -

    openqrm-local-vm-client konfiguriert die VM nun automatisch und stellt sie in openQRM bereit.Misc" - -documentation_title = "Documentation" - -use_case_title = "Use case" - -[usage] -tab = "About Local-Server" -label = "Local-Server Use-Cases" - -usage_integrate_title = "Local-Server Integrate" -usage_integrate_content = "Copy (scp) the openqrm-local-server utility to an existing, local-installed server in your network

    -

    scp %s/plugins/local-server/bin/openqrm-local-server [ip-address-of-existing-server]:/tmp/
    - -

    Execute the openqrm-local-server utility on the remote system via ssh e.g.:

    -
    ssh [ip-address-of-existing-server] /tmp/openqrm-local-server integrate -u openqrm -p openqrm -q %s -i eth0 [-s http/https]
    - -

    The system now appears in the openQRM-server as new resource. It should be now set to 'network-boot' in its BIOS to allow dynamic assign- and deployment. The resource can now be used to e.g. create a new 'storage-server' within openQRM. After setting the system to 'network-boot' in its BIOS it also can be used to deploy server-images from diffrent types.

    " - -usage_remove_title = "Local-Server Remove" -usage_remove_content = "

    To remove a system from openQRM integrated via the local-server plugin run the openqrm-local-server utility again. e.g.:

    -
    ssh [ip-address-of-existing-server] /tmp/openqrm-local-server remove -u openqrm -p openqrm -q %s [-s http/https]
    " - -[localvm] -tab = "About Local VMs" -label = "Local-Server for Local Virtual Machines" - -usage_localvm_title = "How to use Local-Server for Local Virtual Machines" -usage_localvm = "

    For local-installed Virtual Machines (e.g. kvm-storage, xen-storage, lxc-storage, openvz-storage) which have access to the openQRM network there is an openqrm-local-vm-client available. This openqrm-local-vm-client just starts and stops the plugin-boot-services to allow further management functionality. Monitoring and openQRM actions are still running on behalf of the VM Host.

    " -usage_integrate_localvm = "

    Download/Copy the openqrm-local-vm-client to a local installed VM:

    -
    scp openqrm-local-vm-client [ip-address-of-existing-server]:/tmp/
    - -

    Execute openqrm-local-vm-client on the VM:

    -
    openqrm-local-vm-client
    - -

    openqrm-local-vm-client will automatically configure the local server and add it to openQRM management.

    " diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/local-server-action.php b/openQRM-5.3.50-CE/src/plugins/local-server/web/local-server-action.php deleted file mode 100644 index aceceb9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/web/local-server-action.php +++ /dev/null @@ -1,267 +0,0 @@ - -*/ - - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/kernel.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -// filter inputs -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; - -global $IMAGE_INFO_TABLE; -global $DEPLOYMENT_INFO_TABLE; -global $KERNEL_INFO_TABLE; -global $STORAGETYPE_INFO_TABLE; -global $OPENQRM_SERVER_BASE_DIR; - -// user/role authentication -if ($OPENQRM_USER->role != "administrator") { - $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "local-server-action", "Un-Authorized access to lvm-actions from $OPENQRM_USER->name", "", "", 0, 0, 0); - exit(); -} - - -$local_server_command = $request->get('local_server_command'); -$local_server_id = $request->get('local_server_id'); -$local_server_root_device = $request->get('local_server_root_device'); -$local_server_root_device_type = $request->get('local_server_root_device_type'); -$local_server_kernel_version = $request->get('local_server_kernel_version'); -$local_server_name = $request->get('local_server_name'); - -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; - - $event->log("$local_server_command", $_SERVER['REQUEST_TIME'], 5, "local-server-action", "Processing local-server command $local_server_command", "", "", 0, 0, 0); - switch ($local_server_command) { - - case 'integrate': - - // create storage server - $storage_fields["storage_name"] = "resource$local_server_id"; - $storage_fields["storage_resource_id"] = "$local_server_id"; - $deployment = new deployment(); - $deployment->get_instance_by_type('local-server'); - $storage_fields["storage_type"] = $deployment->id; - $storage_fields["storage_comment"] = "Local-server resource $local_server_id"; - $storage_fields["storage_capabilities"] = 'TYPE=local-server'; - $storage = new storage(); - $storage_fields["storage_id"]=(int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $storage->add($storage_fields); - - // create image - $image_fields["image_id"]=(int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields["image_name"] = "resource$local_server_id"; - $image_fields["image_type"] = $deployment->type; - $image_fields["image_rootdevice"] = $local_server_root_device; - $image_fields["image_rootfstype"] = $local_server_root_device_type; - $image_fields["image_storageid"] = $storage_fields["storage_id"]; - $image_fields["image_comment"] = "Local-server image resource $local_server_id"; - $image_fields["image_capabilities"] = 'TYPE=local-server'; - $image = new image(); - $image->add($image_fields); - - // create kernel - $kernel_fields["kernel_id"]=(int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $kernel_fields["kernel_name"]="resource$local_server_id"; - $kernel_fields["kernel_version"]="$local_server_kernel_version"; - $kernel_fields["kernel_capabilities"]='TYPE=local-server'; - $kernel = new kernel(); - $kernel->add($kernel_fields); - - // create appliance - $next_appliance_id=(int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $appliance_fields["appliance_id"]=$next_appliance_id; - $appliance_fields["appliance_name"]=$local_server_name; - $appliance_fields["appliance_kernelid"]=$kernel_fields["kernel_id"]; - $appliance_fields["appliance_imageid"]=$image_fields["image_id"]; - $appliance_fields["appliance_resources"]="$local_server_id"; - $appliance_fields["appliance_capabilities"]='TYPE=local-server'; - $appliance_fields["appliance_comment"]="Local-server appliance resource $local_server_id"; - $appliance = new appliance(); - $appliance->add($appliance_fields); - // set start time, reset stoptime, set state - $now=$_SERVER['REQUEST_TIME']; - $appliance_fields["appliance_starttime"]=$now; - $appliance_fields["appliance_stoptime"]=0; - $appliance_fields['appliance_state']='active'; - // set resource type to physical - $appliance_fields['appliance_virtualization']=1; - $appliance->update($next_appliance_id, $appliance_fields); - - // set resource to localboot - $resource = new resource(); - $resource->get_instance_by_id($local_server_id); - $openqrm_server->send_command("openqrm_server_set_boot local $local_server_id $resource->mac 0.0.0.0"); - $resource->set_localboot($local_server_id, 1); - - // update resource fields with kernel + image - $kernel->get_instance_by_id($kernel_fields["kernel_id"]); - $resource_fields["resource_kernel"]=$kernel->name; - $resource_fields["resource_kernelid"]=$kernel_fields["kernel_id"]; - $image->get_instance_by_id($image_fields["image_id"]); - $resource_fields["resource_image"]=$image->name; - $resource_fields["resource_imageid"]=$image_fields["image_id"]; - // set capabilites - $resource_fields["resource_capabilities"]='TYPE=local-server'; - $resource->update_info($local_server_id, $resource_fields); - - // add + start hook - $appliance->get_instance_by_id($next_appliance_id); - $now=$_SERVER['REQUEST_TIME']; - $appliance_fields = array(); - $appliance_fields['appliance_stoptime']=$now; - $appliance_fields['appliance_state']='stopped'; - // fill in the rest of the appliance info in the array for the plugin hook - $appliance_fields["appliance_id"]=$next_appliance_id; - $appliance_fields["appliance_name"]=$appliance->name; - $appliance_fields["appliance_kernelid"]=$appliance->kernelid; - $appliance_fields["appliance_imageid"]=$appliance->imageid; - $appliance_fields["appliance_cpunumber"]=$appliance->cpunumber; - $appliance_fields["appliance_cpuspeed"]=$appliance->cpuspeed; - $appliance_fields["appliance_cpumodel"]=$appliance->cpumodel; - $appliance_fields["appliance_memtotal"]=$appliance->memtotal; - $appliance_fields["appliance_swaptotal"]=$appliance->swaptotal; - $appliance_fields["appliance_nics"]=$appliance->nics; - $appliance_fields["appliance_capabilities"]=$appliance->capabilities; - $appliance_fields["appliance_cluster"]=$appliance->cluster; - $appliance_fields["appliance_ssi"]=$appliance->ssi; - $appliance_fields["appliance_resources"]=$appliance->resources; - $appliance_fields["appliance_highavailable"]=$appliance->highavailable; - $appliance_fields["appliance_virtual"]=$appliance->virtual; - $appliance_fields["appliance_virtualization"]=$appliance->virtualization; - $appliance_fields["appliance_virtualization_host"]=$appliance->virtualization_host; - $appliance_fields["appliance_comment"]=$appliance->comment; - $appliance_fields["appliance_event"]=$appliance->event; - - $plugin = new plugin(); - $enabled_plugins = $plugin->enabled(); - foreach ($enabled_plugins as $index => $plugin_name) { - $plugin_start_appliance_hook = "$RootDir/plugins/$plugin_name/openqrm-$plugin_name-appliance-hook.php"; - if (file_exists($plugin_start_appliance_hook)) { - $event->log("integrate", $_SERVER['REQUEST_TIME'], 5, "local-server-action", "Found plugin $plugin_name handling add-appliance event.", "", "", 0, 0, $appliance->resources); - require_once "$plugin_start_appliance_hook"; - $appliance_function="openqrm_"."$plugin_name"."_appliance"; - $appliance_function=str_replace("-", "_", $appliance_function); - // add - $appliance_function("add", $appliance_fields); - // start - $appliance_fields['appliance_stoptime']=''; - $appliance_fields['appliance_starttime']=$now; - $appliance_fields['appliance_state']='active'; - $appliance->update($next_appliance_id, $appliance_fields); - $appliance_function("start", $appliance_fields); - - } - } - - - break; - - case 'remove': - // remove all appliance with resource set to localserver id - $appliance = new appliance(); - $appliance_id_list = $appliance->get_all_ids(); - foreach($appliance_id_list as $appliance_list) { - $appliance_id = $appliance_list['appliance_id']; - $app_resource_remove_check = new appliance(); - $app_resource_remove_check->get_instance_by_id($appliance_id); - if ($app_resource_remove_check->resources == $local_server_id) { - - // stop + remove hooks - $now=$_SERVER['REQUEST_TIME']; - $appliance_fields = array(); - $appliance_fields['appliance_stoptime']=$now; - $appliance_fields['appliance_state']='stopped'; - // fill in the rest of the appliance info in the array for the plugin hook - $appliance_fields["appliance_id"]=$appliance_id; - $appliance_fields["appliance_name"]=$app_resource_remove_check->name; - $appliance_fields["appliance_kernelid"]=$app_resource_remove_check->kernelid; - $appliance_fields["appliance_imageid"]=$app_resource_remove_check->imageid; - $appliance_fields["appliance_cpunumber"]=$app_resource_remove_check->cpunumber; - $appliance_fields["appliance_cpuspeed"]=$app_resource_remove_check->cpuspeed; - $appliance_fields["appliance_cpumodel"]=$app_resource_remove_check->cpumodel; - $appliance_fields["appliance_memtotal"]=$app_resource_remove_check->memtotal; - $appliance_fields["appliance_swaptotal"]=$app_resource_remove_check->swaptotal; - $appliance_fields["appliance_nics"]=$app_resource_remove_check->nics; - $appliance_fields["appliance_capabilities"]=$app_resource_remove_check->capabilities; - $appliance_fields["appliance_cluster"]=$app_resource_remove_check->cluster; - $appliance_fields["appliance_ssi"]=$app_resource_remove_check->ssi; - $appliance_fields["appliance_resources"]=$app_resource_remove_check->resources; - $appliance_fields["appliance_highavailable"]=$app_resource_remove_check->highavailable; - $appliance_fields["appliance_virtual"]=$app_resource_remove_check->virtual; - $appliance_fields["appliance_virtualization"]=$app_resource_remove_check->virtualization; - $appliance_fields["appliance_virtualization_host"]=$app_resource_remove_check->virtualization_host; - $appliance_fields["appliance_comment"]=$app_resource_remove_check->comment; - $appliance_fields["appliance_event"]=$app_resource_remove_check->event; - - $plugin = new plugin(); - $enabled_plugins = $plugin->enabled(); - foreach ($enabled_plugins as $index => $plugin_name) { - $plugin_start_appliance_hook = "$RootDir/plugins/$plugin_name/openqrm-$plugin_name-appliance-hook.php"; - if (file_exists($plugin_start_appliance_hook)) { - $event->log("remove", $_SERVER['REQUEST_TIME'], 5, "local-server-action", "Found plugin $plugin_name handling add-appliance event.", "", "", 0, 0, $app_resource_remove_check->resources); - require_once "$plugin_start_appliance_hook"; - $appliance_function="openqrm_"."$plugin_name"."_appliance"; - $appliance_function=str_replace("-", "_", $appliance_function); - // stop - $appliance_function("stop", $appliance_fields); - // remove - $appliance_function("remove", $appliance_fields); - - } - } - // remove appliance - $appliance->remove($appliance_id); - } - } - - // remove kernel - $kernel = new kernel(); - $kernel->remove_by_name("resource$local_server_id"); - // remove image - $image = new image(); - $image->remove_by_name("resource$local_server_id"); - // remove storage serveer - $storage = new storage(); - $storage->remove_by_name("resource$local_server_id"); - - break; - - - default: - $event->log("$local_server_command", $_SERVER['REQUEST_TIME'], 3, "local-server-action", "No such local-server command ($local_server_command)", "", "", 0, 0, 0); - break; - - - } -?> - - diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/local-server/web/menu.txt deleted file mode 100644 index ba9948c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/web/menu.txt +++ /dev/null @@ -1,23 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|Local-server -...|About|index.php?plugin=local-server&controller=local-server-about|How to use -...|Local VMs|index.php?plugin=local-server&controller=local-server-about&local_server_about_action=localvm|How to use -...|Usage|index.php?plugin=local-server&controller=local-server-about&local_server_about_action=usage|How to use diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/root-mount.local-server b/openQRM-5.3.50-CE/src/plugins/local-server/web/root-mount.local-server deleted file mode 100644 index 4a01289..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/web/root-mount.local-server +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/bash -# this is the root-mount initrd-service -# which proivdes function to mount/remount the remote -# local-rootfs according to the image_deployment_parameters at /mnt -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# local-storage -# Required defines in the image_deploy_paramters -# -# -# Optional parameters -# -# IMAGE_INSTALL_FROM_NFS - can be set to an (nfs) location from -# which the image will be installed at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_TRANSFER_TO_NFS - can be set to an (nfs) location from -# which the image will be transfered to at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_INSTALL_FROM_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this -# option will install the local-storage image on -# boot-time from the local-device -# -# IMAGE_TRANSFER_TO_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this option will transfrom -# the local-storage image on boot-time to the local-device -# -# -# -# IMAGE_INSTALL_FROM_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_TRANSFER_TO_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_NFS_MOUNT_OPTIONS - can be e.g. set to proto=tcp for the install/transform phase -# - -# get the deployment parameters from openqrm.conf -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -. $OPENQRM_RESOURCE_PARAMETER_FILE -eval $image_deployment_parameter -export OPENQRM_SERVER_BASE_DIR=$resource_basedir -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - -# nfs-options for the install+transform phase -if [ "$IMAGE_NFS_MOUNT_OPTIONS" != "" ]; then - IMAGE_NFS_MOUNT_OPTIONS=",$IMAGE_NFS_MOUNT_OPTIONS" -fi -# default to ext3 -if [ "$IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" == "" ]; then - IMAGE_INSTALL_FROM_LOCAL_FS_TYPE="ext3" -fi -if [ "$IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" == "" ]; then - IMAGE_TRANSFER_TO_LOCAL_FS_TYPE="ext3" -fi - - -####################################################################### -# required functions ################################################## -####################################################################### - -function mount_rootfs() { - - # mount root - if ! mount -t $image_rootfstype $image_rootdevice /mnt; then - # in case we install from nfs we create a fs since this should be a new lun - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - echo "NOTICE: Found install-from-nfs enabled but failed mounting the rootdevice" - echo "NOTICE: Assuming a new (unformatted) Lun -> creating $image_rootfstype filesystem on $image_rootdevice" - mke2fs -F -j $image_rootdevice - if ! mount -t $image_rootfstype $image_rootdevice /mnt; then - echo "ERROR: Could not mount $image_rootdevice via local" - # give a shell for the admin - /bin/bash - else - echo "local-storage: Mounted $image_rootdevice rw" - fi - else - echo "ERROR: Could not mount $image_rootdevice via local" - # give a shell for the admin - /bin/bash - fi - else - echo "local-storage: Mounted $image_rootdevice rw" - fi - - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - install_rootfs_from_nfs - else - echo "local-storage: Skipping install phase" - fi - if [ "$IMAGE_TRANSFER_TO_NFS" != "" ]; then - transfer_rootfs_to_nfs - else - echo "local-storage: Skipping transfer-to-nfs phase" - fi - if [ "$IMAGE_INSTALL_FROM_LOCAL" != "" ]; then - install_rootfs_from_local - else - echo "local-storage: Skipping install-from-local phase" - fi - if [ "$IMAGE_TRANSFER_TO_LOCAL" != "" ]; then - transfer_rootfs_to_local - else - echo "local-storage: Skipping transfer-to-local phase" - fi -} - - -function remount_rootfs() { - - REMOUNT_LOOP=0 - # remont /mnt ro - while ! mount -t $image_rootfstype -o ro,remount $image_rootdevice /mnt; do - echo -n "." - sleep 1 - REMOUNT_LOOP=$[ REMOUNT_LOOP + 1 ] - if [ "$REMOUNT_LOOP" == "10" ]; then - echo "ERROR: local-storage could not remount /mnt " - /bin/bash - fi - done - echo "local-storage: Re-mounted $image_rootdevice ro" - -} - - -function create_fstab() { - rm -f $IMAGE_FSTAB - echo "$image_rootdevice / $image_rootfstype defaults 0 0" >> $IMAGE_FSTAB -} - - -####################################################################### -# optional functions ################################################## -####################################################################### - - -function install_rootfs_from_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f1` - IMAGE_INSTALL_FROM_NFS=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f2-` - echo "local-storage: Installing $resource_image from $IMAGE_INSTALL_FROM_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o ro$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_INSTALL_FROM_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "local-storage: Starting install-from-nfs phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "local-storage: Install-from-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function transfer_rootfs_to_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f1` - IMAGE_TRANSFER_TO_NFS=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f2-` - echo "local-storage: Transfering $resource_image to $IMAGE_TRANSFER_TO_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o rw$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_TRANSFER_TO_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "local-storage: Starting transfer-to-nfs phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "local-storage: Transfer-to-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function install_rootfs_from_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE -o ro $IMAGE_INSTALL_FROM_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_LOCAL / $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "local-storage: Starting install-to-local phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "local-storage: Install-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - -function transfer_rootfs_to_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE -o rw $IMAGE_TRANSFER_TO_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_LOCAL / $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "local-storage: Starting transfer-to-local phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "local-storage: Transfer-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/tpl/local-server-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/local-server/web/tpl/local-server-about-documentation.tpl.php deleted file mode 100644 index fa887c6..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/web/tpl/local-server-about-documentation.tpl.php +++ /dev/null @@ -1,37 +0,0 @@ - -

    {label}

    - -
    -
    -

    {introduction_title}

    - {introduction_content} - -

    {provides_title}

    - {provides_list} - -

    {requirements_title}

    - {requirements_list} -
    -
    -

    {type_title}

    - {type_content} - -

    {tested_title}

    - {tested_content} -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/tpl/local-server-about-localvm.tpl.php b/openQRM-5.3.50-CE/src/plugins/local-server/web/tpl/local-server-about-localvm.tpl.php deleted file mode 100644 index 49680fa..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/web/tpl/local-server-about-localvm.tpl.php +++ /dev/null @@ -1,26 +0,0 @@ - -

    {label}

    - -
    -
    -

    {usage_localvm_title}

    - {usage_localvm} - {usage_integrate_localvm} -
    -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/local-server/web/tpl/local-server-about-usage.tpl.php b/openQRM-5.3.50-CE/src/plugins/local-server/web/tpl/local-server-about-usage.tpl.php deleted file mode 100644 index 044eb7a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/local-server/web/tpl/local-server-about-usage.tpl.php +++ /dev/null @@ -1,29 +0,0 @@ - -

    {label}

    - -
    -
    -

    {usage_integrate_title}

    - {usage_integrate_content} - -

    {usage_remove_title}

    - {usage_remove_content} -
    -
    - - diff --git a/openQRM-5.3.50-CE/src/plugins/loom/Makefile b/openQRM-5.3.50-CE/src/plugins/loom/Makefile deleted file mode 100644 index 35383e9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/loom/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/loom/etc - cp etc/openqrm-plugin-loom.conf /usr/share/openqrm/plugins/loom/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/loom/etc/openqrm-plugin-loom.conf b/openQRM-5.3.50-CE/src/plugins/loom/etc/openqrm-plugin-loom.conf deleted file mode 100644 index e97e352..0000000 --- a/openQRM-5.3.50-CE/src/plugins/loom/etc/openqrm-plugin-loom.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Configure Event mails.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="management" diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/Makefile b/openQRM-5.3.50-CE/src/plugins/lvm-storage/Makefile deleted file mode 100644 index 78d4397..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# this is the openQRM lvm-storage-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/lvm-storage $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/ - . $(OPENQRM_SERVER_CONF) && cp web/root-mount* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/ - . $(OPENQRM_SERVER_CONF) && cp web/image* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/img/ - . $(OPENQRM_SERVER_CONF) && cp web/img/*.* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/class/ - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/css/ - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/lang/ - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/lang/ - . $(OPENQRM_SERVER_CONF) && chmod 777 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/tpl/ - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/tpl/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/bin/openqrm* - . $(OPENQRM_SERVER_CONF) && tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage -czvf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/boot-service-lvm-storage.tgz include/ bin/ etc/init.d/lvm-storage etc/openqrm-plugin-lvm-storage.conf - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/lvm-storage - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/lvm-storage/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/bin/openqrm-lvm-storage b/openQRM-5.3.50-CE/src/plugins/lvm-storage/bin/openqrm-lvm-storage deleted file mode 100644 index 3b0d549..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/bin/openqrm-lvm-storage +++ /dev/null @@ -1,1000 +0,0 @@ -#!/bin/bash -# this script automatically manages nfs and iscsi on lvm -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -# unblock starting command queue early for non-blocking + ui commands -LVM_COMMAND=$1 -if [ "$LVM_COMMAND" == "post_lv" ] || [ "$LVM_COMMAND" == "post_vg" ] || [ "$LVM_COMMAND" == "post_identifier" ] || [ "$LVM_COMMAND" == "list" ] || [ "$LVM_COMMAND" == "auth" ] || [ "$LVM_COMMAND" == "post_sync_progress" ] || [ "$LVM_COMMAND" == "post_sync_finished" ]; then - openqrm_unblock_starting_queue $@ - NON_BLOCKING=true -fi - -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/etc/openqrm-plugin-lvm-storage.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/include/openqrm-plugin-lvm-storage-functions -OPENQRM_POSTENCODE="$OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-postencode" -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - OPENQRM_SERVER_IP=$resource_openqrmserver - OPENQRM_EXEC_PORT=$resource_execdport -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS - resource_id=0 - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL -fi -export LANG=C -LINEBR=' -' -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - -# using the resource_id as the shelf-id -AOE_SHELF=$resource_id -export AOE_SHELF -# how long to wait for the volume authentication, each loop is 5 secs -MAX_VOLUME_AUTHENTICATION_LOOP=60 -export MAX_VOLUME_AUTHENTICATION_LOOP -# dir for progress stats -SYNC_PROGRESS_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/lock" -if [ ! -d "$SYNC_PROGRESS_DIR" ]; then - mkdir -p $SYNC_PROGRESS_DIR -fi - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - - -function lvm_storage_usage() { - echo "Usage : $0 add/remove/snap/list/resize/clone <-n image-name> <-v volume-group> <-t lvm-nfs-deployment/lvm-iscsi-deployment/lvm-aoe-deployment>" - echo " [-m size in MB]" - echo " [-s image-snapshot-name]" - echo " (for lvm-iscsi-deployment : <-i authidentifier>)" - echo " $0 auth <-r image-rootdevice> <-n image-name> <-i authidentifier> <-t lvm-nfs-deployment/lvm-iscsi-deployment/lvm-aoe-deployment>" - echo " $0 adapt <-n image-name> <-v volume-group> <-t lvm-nfs-deployment/lvm-iscsi-deployment/lvm-aoe-deployment> <-u username> <-p password> [-i image-password]" - echo " $0 post_vg <-u username> <-p password>" - echo " $0 post_lv <-u username> <-p password> <-v volume-group>" - echo " $0 post_identifier <-t lvm-nfs-deployment/lvm-iscsi-deployment/lvm-aoe-deployment> <-u username> <-p password>" - echo " $0 post_sync_progress <-n image-name> <-s image-snapshot-name> <-v volume-group> <-t lvm-nfs-deployment/lvm-iscsi-deployment/lvm-aoe-deployment> <-u username> <-p password>" - echo " $0 post_sync_finished <-n image-name> <-v volume-group> <-t lvm-nfs-deployment/lvm-iscsi-deployment/lvm-aoe-deployment> <-u username> <-p password>" - echo "" - echo "Optional parameters:" - echo " [--openqrm-ui-user ]" - echo " [--openqrm-internal-cmd ]" - echo " [--openqrm-cmd-mode ]" - exit 1 -} - - -function lvm_storage_resize_fs() { - local LVM_VOLUME=$1 - local VOLUME_SIZE=$2 - LVM_VOLUME_NAME=`basename $LVM_VOLUME` - openqrm_post_event 0 "$LVM_VOLUME" 5 "openqrm-lvm-storage" "Resizing Linux filesystem of volume $LVM_VOLUME to + $VOLUME_SIZE MB." - e2fsck -y $LVM_VOLUME - if resize2fs -f -p $LVM_VOLUME $VOLUME_SIZE""M; then - if ! e2fsck -fy $LVM_VOLUME; then - openqrm_post_event 0 "snap" 2 "openqrm-lvm-storage" "Errors during resizing volume $LVM_VOLUME." - fi - fi - openqrm_post_event 0 "snap" 5 "openqrm-lvm-storage" "Finished resizing volume $LVM_VOLUME to + $VOLUME_SIZE MB." -} - - -FULL_COMMANDLINE="$0 $@" -LVM_COMMAND=$1 -shift - -while [ $# -ne 0 ]; do - case "$1" in - -n) - LVM_IMAGE_NAME=$2 - shift - ;; - -m) - LVM_IMAGE_SIZE=$2 - shift - ;; - -s) - LVM_IMAGE_SNAPSHOT_NAME=$2 - shift - ;; - -t) - LVM_IMAGE_TYPE=$2 - shift - ;; - -i) - LVM_IMAGE_AUTH=$2 - shift - ;; - -r) - LVM_IMAGE_ROOTDEVICE=$2 - shift - ;; - -u) - LVM_OPENQRM_USERNAME=$2 - shift - ;; - -p) - LVM_OPENQRM_PASSWORD=$2 - shift - ;; - -v) - LVM_STORAGE_SERVER_VOLUME_GROUP=$2 - shift - ;; - --openqrm-ui-user) - OPENQRM_UI_USER=$2 - shift - ;; - --openqrm-internal-cmd) - OPENQRM_INTERNAL_CMD=$2 - shift - ;; - --openqrm-cmd-mode) - OPENQRM_CMD_MODE=$2 - shift - ;; - - *) - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - echo "ERROR: Free commandline arguments are not allowed" - lvm_storage_usage - exit 6 - ;; - esac - shift -done - - -# main -if [ "$LVM_COMMAND" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - lvm_storage_usage -fi - -if [ "$LVM_COMMAND" == "post_lv" ] || [ "$LVM_COMMAND" == "post_vg" ] || [ "$LVM_COMMAND" == "post_identifier" ]; then - if [ "$LVM_OPENQRM_USERNAME" == "" ]; then - lvm_storage_usage - fi - if [ "$LVM_OPENQRM_PASSWORD" == "" ]; then - lvm_storage_usage - fi - if [ "$LVM_COMMAND" == "post_lv" ]; then - if [ "$LVM_STORAGE_SERVER_VOLUME_GROUP" == "" ]; then - lvm_storage_usage - fi - fi - if [ "$LVM_COMMAND" == "post_identifier" ]; then - if [ "$LVM_IMAGE_TYPE" == "" ]; then - lvm_storage_usage - fi - fi - -else - - if [ "$LVM_COMMAND" != "list" ] && [ "$LVM_COMMAND" != "auth" ]; then - if [ "$LVM_IMAGE_NAME" == "" ]; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - lvm_storage_usage - fi - if [ "$LVM_STORAGE_SERVER_VOLUME_GROUP" == "" ]; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - lvm_storage_usage - fi - if [ "$LVM_IMAGE_TYPE" == "" ]; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - lvm_storage_usage - fi - fi -fi -# load required lvm modules if needed -if ! grep dm_mod /proc/modules 1>/dev/null; then - modprobe dm-mod 1>/dev/null 2>&1 - modprobe dm-snapshot 1>/dev/null 2>&1 -fi - -if [ "$LVM_COMMAND" != "list" ] && [ "$LVM_COMMAND" != "post_vg" ] && [ "$LVM_COMMAND" != "post_identifier" ] && [ "$LVM_COMMAND" != "auth" ]; then - # check if volume group exists - if ! vgs --unbuffered $LVM_STORAGE_SERVER_VOLUME_GROUP 1>/dev/null 2>&1; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - openqrm_post_event 0 "check-vg" 3 "lvm-storage" "Could not find volume-group $LVM_STORAGE_SERVER_VOLUME_GROUP on the storage-server" - exit 1 - fi -fi - -# check requirements -if [ "$LVM_IMAGE_TYPE" == "lvm-iscsi-deployment" ]; then - if ! check_lvm_iscsi_storage_deps; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 - fi -elif [ "$LVM_IMAGE_TYPE" == "lvm-nfs-deployment" ]; then - if ! check_lvm_nfs_storage_deps; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 - fi -elif [ "$LVM_IMAGE_TYPE" == "lvm-aoe-deployment" ]; then - if ! check_lvm_aoe_storage_deps; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 - fi - -fi -if [ "$OPENQRM_UI_USER" != "" ]; then - OPENQRM_UI_USER_PARAMETER=" --openqrm-ui-user $OPENQRM_UI_USER" -fi - - -case "$LVM_COMMAND" in - - add) - if [ "$LVM_IMAGE_SIZE" == "" ]; then - LVM_IMAGE_SIZE=$DEFAULT_IMAGE_SIZE - fi - export LVM_IMAGE_SIZE - # check if already exists - if [ -e /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME ]; then - openqrm_post_event 0 "add" 3 "lvm-storage" "Volume $LVM_IMAGE_NAME already exists" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - #echo -n "Creating logical volume $LVM_IMAGE_NAME size $LVM_IMAGE_SIZE MB using volume group $LVM_STORAGE_SERVER_VOLUME_GROUP" - LOCK_TIME=`openqrm_lock_queue aquire lvm-storage` - trap "openqrm_lock_queue release lvm-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - ### set size - if ! lvcreate -L$LVM_IMAGE_SIZE"M" -n$LVM_IMAGE_NAME $LVM_STORAGE_SERVER_VOLUME_GROUP; then - openqrm_post_event 0 "add" 3 "lvm-storage" "Error while adding $LVM_IMAGE_NAME to $LVM_STORAGE_SERVER_VOLUME_GROUP" - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - exit 1 - fi - if [ "$LVM_IMAGE_TYPE" == "lvm-iscsi-deployment" ]; then - echo "Detected Iscsi-image. Adding to $IETDCONF" - manage_iscsi add regular $LVM_IMAGE_AUTH - elif [ "$LVM_IMAGE_TYPE" == "lvm-nfs-deployment" ]; then - # we mount them and add to exports - echo "Detected NFS-image. Mounting and adding $LVM_IMAGE_NAME to /etc/fstab + /etc/exports" - manage_fstab add - manage_nfs add regular $OPENQRM_SERVER_IP - elif [ "$LVM_IMAGE_TYPE" == "lvm-aoe-deployment" ]; then - echo "Detected Aoe-image. Adding to $VBLADECONF" - manage_vblade add - fi - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - # in case we have a username + password post the updated list to the openQRM-server - if [ "$LVM_OPENQRM_USERNAME" != "" ] && [ "$LVM_OPENQRM_PASSWORD" != "" ]; then - # if we have an image name send size back to openQRM - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$LVM_OPENQRM_USERNAME --http-password=$LVM_OPENQRM_PASSWORD "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/lvm-storage/lvm-storage-action.php?lvm_storage_command=set_image_size&lvm_image_name=$LVM_IMAGE_NAME&lvm_image_size=$LVM_IMAGE_SIZE"; then - openqrm_post_event 0 "add" 2 "openqrm-lvm" "Could not post size of volume $LVM_IMAGE_NAME!" - fi - $0 post_lv -u $LVM_OPENQRM_USERNAME -p $LVM_OPENQRM_PASSWORD -v $LVM_STORAGE_SERVER_VOLUME_GROUP -t $LVM_IMAGE_TYPE --openqrm-internal-cmd true - fi - - ;; - - remove) - if [ ! -e /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME ]; then - openqrm_post_event 0 "remove" 3 "lvm-storage" "Could not find source volume /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - # check that no snapshots existing with this volume as the origin - if lvs | awk '{ print $5 }' | grep -w $LVM_IMAGE_NAME 1>/dev/null; then - openqrm_post_event 0 "remove" 3 "lvm-storage" "Snapshot exist from volume /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME. Not removing!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - - # check that it is not in use by a syncing action - if ls $SYNC_PROGRESS_DIR/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME.sync_in_progress.* 1>/dev/null 2>&1; then - openqrm_post_event 0 "remove" 3 "lvm-storage" "Volume /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME is currently in use by a sync action!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - if [ -f "$SYNC_PROGRESS_DIR/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME.clone_in_progress" ]; then - openqrm_post_event 0 "remove" 3 "lvm-storage" "Volume /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME is currently in use by a clone action!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire lvm-storage` - trap "openqrm_lock_queue release lvm-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - #echo -n "Removing logical volume $LVM_IMAGE_NAME on volume group $LVM_STORAGE_SERVER_VOLUME_GROUP" - if [ "$LVM_IMAGE_TYPE" == "lvm-iscsi-deployment" ]; then - echo "Detected Iscsi-image. Removing from $IETDCONF" - manage_iscsi remove - elif [ "$LVM_IMAGE_TYPE" == "lvm-nfs-deployment" ]; then - echo "Detected NFS-image. Removing from /etc/exports" - manage_nfs remove - manage_fstab remove - elif [ "$LVM_IMAGE_TYPE" == "lvm-aoe-deployment" ]; then - echo "Detected Aoe-image. Removing from $VBLADECONF" - manage_vblade remove - fi - # give time to settle - sync - sleep 2 - lvchange -a n -y /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME - lvremove -f /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - # in case we have a username + password post the updated list to the openQRM-server - if [ "$LVM_OPENQRM_USERNAME" != "" ] && [ "$LVM_OPENQRM_PASSWORD" != "" ]; then - $0 post_lv -u $LVM_OPENQRM_USERNAME -p $LVM_OPENQRM_PASSWORD -v $LVM_STORAGE_SERVER_VOLUME_GROUP -t $LVM_IMAGE_TYPE --openqrm-internal-cmd true - fi - - ;; - - snap) - if [ "$LVM_IMAGE_SNAPSHOT_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - lvm_storage_usage - fi - if [ "$LVM_IMAGE_SIZE" == "" ]; then - LVM_IMAGE_SIZE=$DEFAULT_IMAGE_SIZE - fi - export LVM_IMAGE_SIZE - # check that source fs-images exist - if [ ! -e /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME ]; then - openqrm_post_event 0 "snap" 3 "lvm-storage" "Source volume /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME does not exist." - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - if [ -e /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_SNAPSHOT_NAME ]; then - openqrm_post_event 0 "snap" 3 "lvm-storage" "Volume $LVM_IMAGE_SNAPSHOT_NAME already exists" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire lvm-storage` - trap "openqrm_lock_queue release lvm-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - touch $SYNC_PROGRESS_DIR/$LVM_IMAGE_SNAPSHOT_NAME - echo -n "Creating snapshot size $LVM_IMAGE_SIZE from logical volume $LVM_IMAGE_NAME -> $LVM_IMAGE_SNAPSHOT_NAME" - ### set size - if ! lvcreate --size $LVM_IMAGE_SIZE"M" --snapshot --name $LVM_IMAGE_SNAPSHOT_NAME /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME; then - rm -f $SYNC_PROGRESS_DIR/$LVM_IMAGE_SNAPSHOT_NAME - openqrm_post_event 0 "snap" 3 "lvm-storage" "Error while adding snapshot $LVM_IMAGE_SNAPSHOT_NAME to $LVM_STORAGE_SERVER_VOLUME_GROUP" - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - exit 1 - fi - if [ "$OPENQRM_PLUGIN_LVM_STORAGE_RESIZE_SNAPSHOTS_FILESYSTEM" == "true" ]; then - # find the rootfs and resize it - lvm_storage_resize_fs /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_SNAPSHOT_NAME $LVM_IMAGE_SIZE - fi - export LVM_IMAGE_NAME=$LVM_IMAGE_SNAPSHOT_NAME - - if [ "$LVM_IMAGE_TYPE" == "lvm-iscsi-deployment" ]; then - echo "Detected Iscsi-image. Adding to $IETDCONF" - manage_iscsi add snap $LVM_IMAGE_AUTH - elif [ "$LVM_IMAGE_TYPE" == "lvm-nfs-deployment" ]; then - echo "Detected NFS-image. Mounting and adding $IMAGE_NAME to /etc/fstab + /etc/exports" - manage_fstab add - manage_nfs add snap $OPENQRM_SERVER_IP - elif [ "$LVM_IMAGE_TYPE" == "lvm-aoe-deployment" ]; then - echo "Detected Aoe-image. Adding to $VBLADECONF" - manage_vblade add snap - fi - rm -f $SYNC_PROGRESS_DIR/$LVM_IMAGE_SNAPSHOT_NAME - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - # in case we have a username + password post the updated list to the openQRM-server - if [ "$LVM_OPENQRM_USERNAME" != "" ] && [ "$LVM_OPENQRM_PASSWORD" != "" ]; then - # if we have an image name send size back to openQRM - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$LVM_OPENQRM_USERNAME --http-password=$LVM_OPENQRM_PASSWORD "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/lvm-storage/lvm-storage-action.php?lvm_storage_command=set_image_size&lvm_image_name=$LVM_IMAGE_SNAPSHOT_NAME&lvm_image_size=$LVM_IMAGE_SIZE"; then - openqrm_post_event 0 "add" 2 "openqrm-lvm" "Could not post size of volume $LVM_IMAGE_SNAPSHOT_NAME!" - fi - $0 post_lv -u $LVM_OPENQRM_USERNAME -p $LVM_OPENQRM_PASSWORD -v $LVM_STORAGE_SERVER_VOLUME_GROUP -t $LVM_IMAGE_TYPE --openqrm-internal-cmd true - fi - ;; - - clone) - # cloning is similar to snapshots but since lvm cannot (yet) create snapshots - # from snapshots we have to rsync the origin (which may be a snapshot) to a - # new lvol. - # .... good to have no partitions on the luns :) so we can mount them easily - if [ "$LVM_IMAGE_SNAPSHOT_NAME" == "" ]; then - openqrm_post_event 0 "clone" 3 "lvm-storage" "No volume name for the clone given" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - lvm_storage_usage - fi - if [ "$LVM_IMAGE_SIZE" == "" ]; then - LVM_IMAGE_SIZE=$DEFAULT_IMAGE_SIZE - fi - export LVM_IMAGE_SIZE - # check that source fs-images exist - if [ ! -e /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME ]; then - openqrm_post_event 0 "clone" 3 "lvm-storage" "Source volume /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME does not exist." - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - if [ -e /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_SNAPSHOT_NAME ]; then - openqrm_post_event 0 "clone" 3 "lvm-storage" "Volume $LVM_IMAGE_SNAPSHOT_NAME already exists" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire lvm-storage` - trap "openqrm_lock_queue release lvm-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - touch $SYNC_PROGRESS_DIR/$LVM_IMAGE_SNAPSHOT_NAME - echo "Cloning logical volume $LVM_IMAGE_NAME to $LVM_IMAGE_SNAPSHOT_NAME size $LVM_IMAGE_SIZE MB volume group $LVM_STORAGE_SERVER_VOLUME_GROUP" - ORIGIN_SIZE="" - ORIGIN_VOLUME="/dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" - # if source volume is a snapshot find out the size of the origin - VOLUME_IS_SNAPSHOT=`lvs --noheadings -o origin $ORIGIN_VOLUME | awk '{ print $1 }'` - if [ "$VOLUME_IS_SNAPSHOT" != "" ]; then - ORIGIN_VOLUME="/dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$VOLUME_IS_SNAPSHOT" - fi - ORIGIN_SIZE=`lvs --noheadings -o lv_size --units m --nosuffix $ORIGIN_VOLUME | awk '{ print $1 }' | cut -d'.' -f1` - if [ "$ORIGIN_SIZE" != "" ]; then - LVM_IMAGE_SIZE=$ORIGIN_SIZE - fi - # capture the original image name early, we later will shift it for the add/remove functions - LVM_ORIGINAL_IMAGE_NAME=$LVM_IMAGE_NAME - # create mountpoints for origin and clone - MOUNTPOINT_ORIGIN=`mktemp -d /tmp/$LVM_IMAGE_NAME.origin.XXXXXXXXXX` || exit 1 - MOUNTPOINT_CLONE=`mktemp -d /tmp/$LVM_IMAGE_SNAPSHOT_NAME.clone.XXXXXXXXXX` || exit 1 - - # create new volume - ### set size - if ! lvcreate -L$LVM_IMAGE_SIZE"M" -n$LVM_IMAGE_SNAPSHOT_NAME $LVM_STORAGE_SERVER_VOLUME_GROUP; then - rm -f $SYNC_PROGRESS_DIR/$LVM_IMAGE_SNAPSHOT_NAME - openqrm_post_event 0 "clone" 3 "lvm-storage" "Could not create the new clone volume" - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - exit 1 - fi - # create fs - if ! mkfs.ext3 -F /dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_SNAPSHOT_NAME; then - rm -f $SYNC_PROGRESS_DIR/$LVM_IMAGE_SNAPSHOT_NAME - openqrm_post_event 0 "clone" 3 "lvm-storage" "Could not create the filesystem on /dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_SNAPSHOT_NAME" - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - exit 1 - fi - # mount clone - if ! mount /dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_SNAPSHOT_NAME $MOUNTPOINT_CLONE; then - rm -f $SYNC_PROGRESS_DIR/$LVM_IMAGE_SNAPSHOT_NAME - openqrm_post_event 0 "clone" 3 "lvm-storage" "Could not mount clone /dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_SNAPSHOT_NAME" - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - # remove origin from san/nas, for lvm aoe we do not remove since this may change shelf/slot of the origin - export LVM_IMAGE_NAME=$LVM_IMAGE_NAME - if [ "$LVM_IMAGE_TYPE" == "lvm-iscsi-deployment" ]; then - manage_iscsi remove - elif [ "$LVM_IMAGE_TYPE" == "lvm-nfs-deployment" ]; then - manage_nfs remove - elif [ "$LVM_IMAGE_TYPE" == "lvm-aoe-deployment" ]; then - # we add aoe volumes early to post back the root-device identifier - ORIGIN_LVM_IMAGE_NAME=$LVM_IMAGE_NAME - export LVM_IMAGE_NAME=$LVM_IMAGE_SNAPSHOT_NAME - manage_vblade add snap - export LVM_IMAGE_NAME=$ORIGIN_LVM_IMAGE_NAME - fi - - # mount origin - if ! mount /dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME $MOUNTPOINT_ORIGIN; then - rm -f $SYNC_PROGRESS_DIR/$LVM_IMAGE_SNAPSHOT_NAME - openqrm_post_event 0 "clone" 3 "lvm-storage" "Could not mount origin /dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME" - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - exit 1 - fi - - # create locks for origin + snapshot - touch "$SYNC_PROGRESS_DIR/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME.sync_in_progress.$LVM_IMAGE_SNAPSHOT_NAME" - touch "$SYNC_PROGRESS_DIR/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - - # create long-term-action start event - openqrm_post_event 0 "$LVM_IMAGE_SNAPSHOT_NAME" 9 "lvm-storage" "Started to clone $LVM_IMAGE_SNAPSHOT_NAME from $LVM_IMAGE_NAME" - # get a list of files to sync - rsync -a -vv --list-only --progress $MOUNTPOINT_ORIGIN/* $MOUNTPOINT_CLONE/ > $SYNC_PROGRESS_DIR/rsync_files.$LVM_IMAGE_SNAPSHOT_NAME.log - > $SYNC_PROGRESS_DIR/rsync_progress.$LVM_IMAGE_SNAPSHOT_NAME.log - # post exports early, we show the progress in the ui - if [ "$LVM_OPENQRM_USERNAME" != "" ] && [ "$LVM_OPENQRM_PASSWORD" != "" ]; then - $0 post_sync_progress -n $LVM_IMAGE_SNAPSHOT_NAME -v $LVM_STORAGE_SERVER_VOLUME_GROUP -t $LVM_IMAGE_TYPE -u $LVM_OPENQRM_USERNAME -p $LVM_OPENQRM_PASSWORD --openqrm-internal-cmd true & - fi - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - # rsync origin to clone, let other lvm commands run in this time - # delay start syncing - sleep 10 - if ! rsync -a --progress $MOUNTPOINT_ORIGIN/* $MOUNTPOINT_CLONE/ > $SYNC_PROGRESS_DIR/rsync_progress.$LVM_IMAGE_SNAPSHOT_NAME.log; then - rm -f $SYNC_PROGRESS_DIR/$LVM_IMAGE_SNAPSHOT_NAME - openqrm_post_event 0 "clone" 2 "openqrm-lvm-storage" "Could not copy target logical volume $LVM_IMAGE_NAME!" - rm -f "$SYNC_PROGRESS_DIR/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME.sync_in_progress.$LVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - openqrm_post_event 0 "$LVM_IMAGE_SNAPSHOT_NAME" 10 "lvm-storage" "Started to clone $LVM_IMAGE_SNAPSHOT_NAME from $LVM_IMAGE_NAME" - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire lvm-storage` - trap "openqrm_lock_queue release lvm-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # remove lock from the origin + snapshot - rm -f "$SYNC_PROGRESS_DIR/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME.sync_in_progress.$LVM_IMAGE_SNAPSHOT_NAME" - rm -f "$SYNC_PROGRESS_DIR/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_SNAPSHOT_NAME.clone_in_progress" - - # umount origin + clone - umount $MOUNTPOINT_ORIGIN - umount $MOUNTPOINT_CLONE - rmdir $MOUNTPOINT_ORIGIN $MOUNTPOINT_CLONE - - # add origin to san/nas - export LVM_IMAGE_NAME=$LVM_IMAGE_NAME - if [ "$LVM_IMAGE_TYPE" == "lvm-iscsi-deployment" ]; then - manage_iscsi add snap $LVM_IMAGE_AUTH - elif [ "$LVM_IMAGE_TYPE" == "lvm-nfs-deployment" ]; then - manage_nfs add snap $OPENQRM_SERVER_IP - fi - - # add clone to san/nas - export LVM_IMAGE_NAME=$LVM_IMAGE_SNAPSHOT_NAME - if [ "$LVM_IMAGE_TYPE" == "lvm-iscsi-deployment" ]; then - manage_iscsi add snap $LVM_IMAGE_AUTH - elif [ "$LVM_IMAGE_TYPE" == "lvm-nfs-deployment" ]; then - manage_fstab add - manage_nfs add snap $OPENQRM_SERVER_IP - fi - # stop sync-progress monitor and send sync-finished to openQRM - rm -f $SYNC_PROGRESS_DIR/rsync_progress.$LVM_IMAGE_SNAPSHOT_NAME.log $SYNC_PROGRESS_DIR/rsync_files.$LVM_IMAGE_SNAPSHOT_NAME.log - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - $0 post_sync_finished -n $LVM_IMAGE_SNAPSHOT_NAME -v $LVM_STORAGE_SERVER_VOLUME_GROUP -t $LVM_IMAGE_TYPE -u $LVM_OPENQRM_USERNAME -p $LVM_OPENQRM_PASSWORD --openqrm-internal-cmd true - # create long-term-action finished event - openqrm_post_event 0 "$LVM_IMAGE_SNAPSHOT_NAME" 10 "lvm-storage" "Started to clone $LVM_IMAGE_SNAPSHOT_NAME from $LVM_IMAGE_NAME" - rm -f $SYNC_PROGRESS_DIR/$LVM_IMAGE_SNAPSHOT_NAME - - # here we notify openQRM Cloud that cloning has finished - # in case we have a username + password post the updated list to the openQRM-server - # and notify openQRM that cloning has finished - if [ "$LVM_OPENQRM_USERNAME" != "" ] && [ "$LVM_OPENQRM_PASSWORD" != "" ]; then - CLONE_FINISHED="$LVM_IMAGE_SNAPSHOT_NAME.clone" - touch $CLONE_FINISHED - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$LVM_OPENQRM_USERNAME --http-password=$LVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $CLONE_FINISHED` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/lvm-storage/lvm-storage-action.php?lvm_storage_command=clone_finished; then - openqrm_post_event 0 "clone" 3 "lvm-storage" "Could not post clone-finished status to the openQRM-server at $OPENQRM_SERVER_IP" - fi - rm -f $CLONE_FINISHED - # if we have an image name send size back to openQRM - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$LVM_OPENQRM_USERNAME --http-password=$LVM_OPENQRM_PASSWORD "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/lvm-storage/lvm-storage-action.php?lvm_storage_command=set_image_size&lvm_image_name=$LVM_IMAGE_SNAPSHOT_NAME&lvm_image_size=$LVM_IMAGE_SIZE"; then - openqrm_post_event 0 "add" 2 "openqrm-lvm" "Could not post size of volume $LVM_IMAGE_SNAPSHOT_NAME!" - fi - fi - - ;; - - resize) - if [ "$LVM_IMAGE_SIZE" == "" ]; then - LVM_IMAGE_SIZE=$DEFAULT_IMAGE_SIZE - fi - - LOCK_TIME=`openqrm_lock_queue aquire lvm-storage` - trap "openqrm_lock_queue release lvm-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - export LVM_IMAGE_SIZE - # echo "Resizing logical volume $LVM_IMAGE_NAME + size $LVM_IMAGE_SIZE MB using volume group $LVM_STORAGE_SERVER_VOLUME_GROUP" - touch $SYNC_PROGRESS_DIR/$LVM_IMAGE_NAME - lvresize -L $LVM_IMAGE_SIZE /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME 2>&1 | logger - if [ "$OPENQRM_PLUGIN_LVM_STORAGE_RESIZE_SNAPSHOTS_FILESYSTEM" == "true" ]; then - if [ "$LVM_IMAGE_TYPE" == "lvm-iscsi-deployment" ]; then - #echo "Detected Iscsi-image. Running resize2fs on /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" - manage_iscsi remove - e2fsck -f -y /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME 2>&1 | logger - resize2fs -fp /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME 2>&1 | logger - manage_iscsi add snap $LVM_IMAGE_AUTH - elif [ "$LVM_IMAGE_TYPE" == "lvm-nfs-deployment" ]; then - # if it is lvm-nfs deployment we can resize the fs immediately - #echo "Detected NFS-image. Running resize2fs on /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" - manage_nfs remove - e2fsck -f -y /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME 2>&1 | logger - resize2fs -fp /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME 2>&1 | logger - manage_nfs add snap $OPENQRM_SERVER_IP - elif [ "$LVM_IMAGE_TYPE" == "lvm-aoe-deployment" ]; then - #echo "Detected Aoe-image. Running resize2fs on /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" - manage_vblade remove - e2fsck -f -y /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME 2>&1 | logger - resize2fs -fp /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME 2>&1 | logger - manage_vblade add snap - fi - fi - rm -f $SYNC_PROGRESS_DIR/$LVM_IMAGE_NAME - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - # in case we have a username + password post the updated list to the openQRM-server - if [ "$LVM_OPENQRM_USERNAME" != "" ] && [ "$LVM_OPENQRM_PASSWORD" != "" ]; then - $0 post_lv -u $LVM_OPENQRM_USERNAME -p $LVM_OPENQRM_PASSWORD -v $LVM_STORAGE_SERVER_VOLUME_GROUP -t $LVM_IMAGE_TYPE --openqrm-internal-cmd true - fi - ;; - - - auth) - echo "Authenticating $LVM_IMAGE_TYPE image $LVM_IMAGE_ROOTDEVICE to $LVM_IMAGE_AUTH" - # this is just for starting auth, make sure the device is there, otherwise wait - if [ "$LVM_IMAGE_TYPE" == "lvm-iscsi-deployment" ]; then - LVM_CHECK_ROOT_DEVICE="$LVM_IMAGE_ROOTDEVICE" - elif [ "$LVM_IMAGE_TYPE" == "lvm-nfs-deployment" ]; then - LVM_CHECK_ROOT_DEVICE="/dev$LVM_IMAGE_ROOTDEVICE" - elif [ "$LVM_IMAGE_TYPE" == "lvm-aoe-deployment" ]; then - LVM_CHECK_VOLUME_GROUP=`echo $LVM_IMAGE_ROOTDEVICE | cut -d':' -f1` - LVM_CHECK_VOLUME_NAME=`echo $LVM_IMAGE_ROOTDEVICE | cut -d':' -f2` - LVM_CHECK_AOE_DEVICE_NAME=`echo $LVM_IMAGE_ROOTDEVICE | cut -d':' -f3` - LVM_CHECK_ROOT_DEVICE="/dev/$LVM_CHECK_VOLUME_GROUP/$LVM_CHECK_VOLUME_NAME" - fi - if [ "$LVM_OPENQRM_USERNAME" != "" ] && [ "$LVM_OPENQRM_PASSWORD" != "" ] && [ "$LVM_IMAGE_NAME" != "" ]; then - MAX_AUTH_LOOP=0 - while (true); do - if [ -e "$LVM_CHECK_ROOT_DEVICE" ] && [ ! -f "$SYNC_PROGRESS_DIR/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME.clone_in_progress" ]; then - # fs resize active ? - if [ ! -f "$SYNC_PROGRESS_DIR/$LVM_IMAGE_NAME" ]; then - break - fi - fi - sleep 5 - if [ "$MAX_AUTH_LOOP" == "$MAX_VOLUME_AUTHENTICATION_LOOP" ]; then - openqrm_post_event 0 "auth" 3 "lvm-storage" "Volume $LVM_IMAGE_TYPE image $LVM_IMAGE_ROOTDEVICE does not exists. Cannot auth to $LVM_IMAGE_AUTH" - exit 1 - fi - MAX_AUTH_LOOP=$(( MAX_AUTH_LOOP + 1 )) - done - fi - - # run the auth command - LOCK_TIME=`openqrm_lock_queue aquire lvm-storage` - trap "openqrm_lock_queue release lvm-storage $LOCK_TIME" EXIT - - if [ "$LVM_IMAGE_TYPE" == "lvm-iscsi-deployment" ]; then - manage_iscsi auth $LVM_IMAGE_AUTH - elif [ "$LVM_IMAGE_TYPE" == "lvm-nfs-deployment" ]; then - manage_nfs auth $LVM_IMAGE_AUTH - elif [ "$LVM_IMAGE_TYPE" == "lvm-aoe-deployment" ]; then - manage_vblade auth $LVM_IMAGE_AUTH - fi - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - # if we have an image name send back to openQRM that storage auth finished to remvoe the storage-auth-blocker - if [ "$LVM_OPENQRM_USERNAME" != "" ] && [ "$LVM_OPENQRM_PASSWORD" != "" ] && [ "$LVM_IMAGE_NAME" != "" ]; then - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$LVM_OPENQRM_USERNAME --http-password=$LVM_OPENQRM_PASSWORD "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/lvm-storage/lvm-storage-action.php?lvm_storage_command=auth_finished&lvm_image_name=$LVM_IMAGE_NAME"; then - openqrm_post_event 0 "auth" 3 "lvm-storage" "Could not remove the storage-auth-blocker from the openQRM-server at $OPENQRM_SERVER_IP" - fi - fi - ;; - - adapt) - if [ ! -e /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - openqrm_post_event 0 "add" 3 "lvm-storage" "Volume $LVM_IMAGE_NAME does not exist" - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire lvm-storage` - trap "openqrm_lock_queue release lvm-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - STORAGE_STATUS_TMP=$resource_id.lvm.$LVM_IMAGE_NAME.adapt - > $STORAGE_STATUS_TMP - if [ "$LVM_IMAGE_TYPE" == "lvm-iscsi-deployment" ]; then - # make sure it is not still used by another storage type, check for aoe + nfs - if [ "$VBLADECONF" != "" ]; then - if grep -w "/dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME" $VBLADECONF | grep -v '^#'; then - if `which vblade 1>/dev/null`; then - manage_vblade remove - fi - fi - fi - if [ "$NFSEXPORTS" != "" ]; then - if grep -w "/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" $NFSEXPORTS | grep -v '^#'; then - if `which exportfs 1>/dev/null`; then - manage_fstab remove - manage_nfs remove - fi - fi - fi - manage_iscsi adapt $LVM_IMAGE_AUTH - LUN=`grep -w $LVM_IMAGE_NAME $IETDCONF | grep -v "#" | grep Lun | awk {'print $2 '}` - TARGET=`grep -w $LVM_IMAGE_NAME $IETDCONF | grep -v "#" | grep Target | awk {' print $2 '}` - echo "$LVM_IMAGE_NAME,$LVM_STORAGE_SERVER_VOLUME_GROUP:/dev/$TARGET/$LUN" >> $STORAGE_STATUS_TMP - elif [ "$LVM_IMAGE_TYPE" == "lvm-nfs-deployment" ]; then - # make sure it is not still used by another storage type, check for aoe + iscsi - if [ "$VBLADECONF" != "" ]; then - if grep -w "/dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME" $VBLADECONF | grep -v '^#'; then - if `which vblade 1>/dev/null`; then - manage_vblade remove - fi - fi - fi - if [ "$IETDCONF" != "" ]; then - if grep -w "/dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME" $IETDCONF | grep -v '^#'; then - if `which ietadm 1>/dev/null`; then - manage_iscsi remove - fi - fi - fi - manage_nfs adapt $OPENQRM_SERVER_IP - echo "$LVM_STORAGE_SERVER_VOLUME_GROUP,/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" >> $STORAGE_STATUS_TMP - elif [ "$LVM_IMAGE_TYPE" == "lvm-aoe-deployment" ]; then - # make sure it is not still used by another storage type, check for iscsi + nfs - if [ "$IETDCONF" != "" ]; then - if grep -w "/dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME" $IETDCONF | grep -v '^#'; then - if `which ietadm 1>/dev/null`; then - manage_iscsi remove - fi - fi - fi - if [ "$NFSEXPORTS" != "" ]; then - if grep -w "/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" $NFSEXPORTS | grep -v '^#'; then - if `which exportfs 1>/dev/null`; then - manage_fstab remove - manage_nfs remove - fi - fi - fi - manage_vblade adapt - V_SHELF=`grep -w $LVM_IMAGE_NAME $VBLADECONF | awk {' print $2 '}` - V_SLOT=`grep -w $LVM_IMAGE_NAME $VBLADECONF | awk {' print $3 '}` - echo "$LVM_IMAGE_NAME,$LVM_STORAGE_SERVER_VOLUME_GROUP:$LVM_IMAGE_NAME:/dev/etherd/e$V_SHELF.$V_SLOT" >> $STORAGE_STATUS_TMP - fi - - openqrm_lock_queue release lvm-storage $LOCK_TIME - trap '' EXIT - - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$LVM_OPENQRM_USERNAME --http-password=$LVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/lvm-storage/lvm-storage-action.php?lvm_storage_command=get_ident; then - openqrm_post_event 0 "adapt" 3 "lvm-storage" "Could not post the rootfs-identifier to the openQRM-server at $OPENQRM_SERVER_IP" - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - ;; - - list) - lvs - ;; - post_vg) - #echo "Posting current volume group status to the openQRM-server" - STORAGE_STATUS_TMP=$resource_id.vg.stat - ### set size - vgs --units m | grep -v VFree | sed -e "s/ \{1,\}//" > $STORAGE_STATUS_TMP - sed -i -e "s/ \{1,\}/@/g" $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$LVM_OPENQRM_USERNAME --http-password=$LVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/lvm-storage/lvm-storage-action.php?lvm_storage_command=get_storage; then - openqrm_post_event 0 "post_vg" 3 "lvm-storage" "Could not post the volume group status to the openQRM-server at $OPENQRM_SERVER_IP" - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - ;; - post_lv) - #echo "Posting current $LVM_IMAGE_TYPE logic volume status to the openQRM-server" - STORAGE_STATUS_TMP=$resource_id.$LVM_STORAGE_SERVER_VOLUME_GROUP.lv.stat - > $STORAGE_STATUS_TMP - lvs $LVM_STORAGE_SERVER_VOLUME_GROUP --noheadings --units m -o lv_name,vg_name,lv_attr,lv_size,origin | sed -e "s/ \{1,\}//" > $STORAGE_STATUS_TMP.tmp - for LVOL in `cat $STORAGE_STATUS_TMP.tmp | awk {' print $1 '}`; do - if grep -w $LVOL $NFSEXPORTS 1>/dev/null; then - # is this a clonezilla location ? - if [ ! -f /$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVOL/clonezilla ]; then - echo -n "lvm-nfs-deployment " >> $STORAGE_STATUS_TMP - else - echo -n " " >> $STORAGE_STATUS_TMP - fi - elif grep -w $LVOL $IETDCONF 1>/dev/null; then - echo -n "lvm-iscsi-deployment " >> $STORAGE_STATUS_TMP - elif grep -w $LVOL $VBLADECONF 1>/dev/null; then - echo -n "lvm-aoe-deployment " >> $STORAGE_STATUS_TMP - else - echo -n " " >> $STORAGE_STATUS_TMP - fi - grep -w ^$LVOL $STORAGE_STATUS_TMP.tmp >> $STORAGE_STATUS_TMP - done - # detect clone-in-progress - for CLONE in `find $SYNC_PROGRESS_DIR/$LVM_STORAGE_SERVER_VOLUME_GROUP-* -type f`; do - CLONE_IMAGE_NAME=`basename $CLONE | cut -d'-' -f2- | sed -e "s/\.clone_in_progress//g"` - SOURCE_IMAGE_NAME=`echo $CLONE_IMAGE_NAME | cut -d'.' -f1` - SYNC_IN_PROGRESS=`echo $CLONE_IMAGE_NAME | cut -d'.' -f2` - if [ "$SYNC_IN_PROGRESS" == "sync_in_progress" ]; then - grep -w -v $SOURCE_IMAGE_NAME $STORAGE_STATUS_TMP > $STORAGE_STATUS_TMP.clone - mv -f $STORAGE_STATUS_TMP.clone $STORAGE_STATUS_TMP - echo "- $SOURCE_IMAGE_NAME - - sync_in_progress - - " >> $STORAGE_STATUS_TMP - else - grep -w -v $CLONE_IMAGE_NAME $STORAGE_STATUS_TMP > $STORAGE_STATUS_TMP.clone - mv -f $STORAGE_STATUS_TMP.clone $STORAGE_STATUS_TMP - echo "- $CLONE_IMAGE_NAME - - clone_in_progress - - " >> $STORAGE_STATUS_TMP - fi - done - sed -i -e "s/ \{1,\}/@/g" $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$LVM_OPENQRM_USERNAME --http-password=$LVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/lvm-storage/lvm-storage-action.php?lvm_storage_command=get_storage; then - openqrm_post_event 0 "post_lv" 3 "lvm-storage" "Could not post the logical volume list to the openQRM-server at $OPENQRM_SERVER_IP" - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post $STORAGE_STATUS_TMP.tmp - ;; - post_identifier) - STORAGE_STATUS_TMP=$resource_id.lv.$LVM_IMAGE_TYPE.ident - > $STORAGE_STATUS_TMP - - for LVOL in `openqrm_get_lvm_volume_paths`; do - LVOL_SHORT=`basename $LVOL` - case $LVM_IMAGE_TYPE in - lvm-nfs-deployment) - exportfs -v | awk {' print $1 '} | grep -v "<.*>" > /tmp/$STORAGE_STATUS_TMP - if grep -w $LVOL_SHORT /tmp/$STORAGE_STATUS_TMP 1>/dev/null; then - EXPORT_PATH=`echo $LVOL | sed -e "s#^/dev##g"` - # is this a clonezilla location ? - if [ ! -f $EXPORT_PATH/clonezilla ]; then - echo "$LVOL,$EXPORT_PATH" - echo "$LVOL,$EXPORT_PATH" >> $STORAGE_STATUS_TMP - fi - fi - rm -f /tmp/$STORAGE_STATUS_TMP - ;; - - lvm-iscsi-deployment) - if grep $LVOL_SHORT $IETDCONF 1>/dev/null; then - LUN=`grep -w $LVOL_SHORT $IETDCONF | grep Lun | awk {'print $2 '}` - TARGET=`cat $IETDCONF | grep -v "#" | grep Target | grep -w $LVOL_SHORT | awk {' print $2 '}` - IMAGE_NAME=$LVOL_SHORT - VOLUME_GROUP=`echo $LVOL | cut -d'/' -f3` - echo "$IMAGE_NAME,$VOLUME_GROUP:/dev/$TARGET/$LUN" - echo "$IMAGE_NAME,$VOLUME_GROUP:/dev/$TARGET/$LUN" >> $STORAGE_STATUS_TMP - fi - ;; - - lvm-aoe-deployment) - if grep -w $LVOL_SHORT $VBLADECONF 1>/dev/null; then - INTERFACE=`grep -w $LVOL_SHORT $VBLADECONF | awk {'print $1 '}` - V_SHELF=`grep -w $LVOL_SHORT $VBLADECONF | awk {' print $2 '}` - V_SLOT=`grep -w $LVOL_SHORT $VBLADECONF | awk {' print $3 '}` - V_IMAGE=`grep -w $LVOL_SHORT $VBLADECONF | awk {' print $4 '}` - V_ALLOWED_MAC=`grep -w $LVOL_SHORT $VBLADECONF | awk {' print $5 '}` - VOLUME_GROUP=`echo $LVOL | cut -d'/' -f3` - echo "$V_IMAGE,$VOLUME_GROUP:$LVOL_SHORT:/dev/etherd/e$V_SHELF.$V_SLOT" - echo "$V_IMAGE,$VOLUME_GROUP:$LVOL_SHORT:/dev/etherd/e$V_SHELF.$V_SLOT" >> $STORAGE_STATUS_TMP - fi - ;; - esac - - done - - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$LVM_OPENQRM_USERNAME --http-password=$LVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/lvm-storage/lvm-storage-action.php?lvm_storage_command=get_ident; then - openqrm_post_event 0 "post_identifier" 3 "lvm-storage" "Could not post the rootfs-identifier to the openQRM-server at $OPENQRM_SERVER_IP" - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - ;; - - - post_sync_progress) - echo "Posting progress of the sync action for volume $LVM_IMAGE_NAME to the openQRM-server" - if [ ! -f "$SYNC_PROGRESS_DIR/rsync_files.$LVM_IMAGE_NAME.log" ] || [ ! -f "$SYNC_PROGRESS_DIR/rsync_progress.$LVM_IMAGE_NAME.log" ]; then - exit 0 - fi - STORAGE_STATUS_TMP=$resource_id.lvm.$LVM_IMAGE_NAME.sync_progress - while (true); do - # if this is a snapshot volume we have to wait until the sync is ready - if [ -e "/dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" ] && [ ! -f "$SYNC_PROGRESS_DIR/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME.clone_in_progress" ]; then - # sync is ready - break - else - if [ ! -f "$SYNC_PROGRESS_DIR/rsync_files.$LVM_IMAGE_NAME.log" ] || [ ! -f "$SYNC_PROGRESS_DIR/rsync_progress.$LVM_IMAGE_NAME.log" ]; then - # cloning not started yet, waiting for the snapshot to appear - echo "0" > $STORAGE_STATUS_TMP - else - # get the size of all changes - COMPLETE_CHANGE_SIZE=`cat $SYNC_PROGRESS_DIR/rsync_files.$LVM_IMAGE_NAME.log | wc -l` - # double up to get around 100 percent - COMPLETE_CHANGE_SIZE=$(( COMPLETE_CHANGE_SIZE * 2 )) - PARTITIAL_CHANGE_SIZE=`cat $SYNC_PROGRESS_DIR/rsync_progress.$LVM_IMAGE_NAME.log | wc -l` - if [ "$PARTITIAL_CHANGE_SIZE" == 0 ]; then - PARTITIAL_CHANGE_SIZE=1 - fi - CURRENT_SYNC_PROGRESS_IN_PERCENT=$(( COMPLETE_CHANGE_SIZE / PARTITIAL_CHANGE_SIZE )) - CURRENT_SYNC_PROGRESS_IN_PERCENT=$(( 100 / CURRENT_SYNC_PROGRESS_IN_PERCENT )) - # make sure to not send 100%, this is send by clone finished - CURRENT_SYNC_PROGRESS_IN_PERCENT=$(( CURRENT_SYNC_PROGRESS_IN_PERCENT - 1 )) - if (( $CURRENT_SYNC_PROGRESS_IN_PERCENT < 0 )); then - CURRENT_SYNC_PROGRESS_IN_PERCENT=0 - fi - echo "$CURRENT_SYNC_PROGRESS_IN_PERCENT" > $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$LVM_OPENQRM_USERNAME --http-password=$LVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/lvm-storage/lvm-storage-action.php?lvm_storage_command=get_sync_progress; then - lvm_storage_log "post_sync_progress" "Could not post the sync progress for volume $LVM_IMAGE_NAME to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - fi - fi - sleep 2 - done - ;; - - - post_sync_finished) - echo "Posting finished for volume $LVM_IMAGE_NAME to the openQRM-server" - STORAGE_STATUS_TMP=$resource_id.lvm.$LVM_IMAGE_NAME.sync_progress - echo "100" > $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$LVM_OPENQRM_USERNAME --http-password=$LVM_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/lvm-storage/lvm-storage-action.php?lvm_storage_command=get_sync_finished; then - lvm_storage_log "post_sync_finished" "Could not post the sync progress for volume $LVM_IMAGE_NAME to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - ;; - - - - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - lvm_storage_usage - ;; - - -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/init.d/lvm-storage b/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/init.d/lvm-storage deleted file mode 100644 index 4394920..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/init.d/lvm-storage +++ /dev/null @@ -1,205 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the LVM-Storage-hosts -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/include/openqrm-plugin-lvm-storage-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/etc/openqrm-plugin-lvm-storage.conf -LINE_IFS=' -' - -# do not start on the intitrd -if [ -f /etc/initrd-devices.conf ]; then - exit 0 -fi - -function lvm_storage_start() { - echo "Starting the openQRM lvm-storage-plugin" - if [ "$LVM_AOE_STORAGE_AUTO_START" == "yes" ]; then - # aoe - mkdir -p /var/run/vblade/ - if [ -x "/etc/init.d/vblade" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d vblade start - else - /etc/init.d/vblade start - fi - else - if [ -f $VBLADECONF ]; then - if which vbladed 1>/dev/null; then - echo "Starting vblades ..." - OLD_IFS=$IFS - IFS=$LINE_IFS - for VBLADE_L in `cat $VBLADECONF | grep -v '#' | sed '/^$/d'`; do - V_INTERFACE=`echo $VBLADE_L | awk {' print $1 '}` - V_SHELF=`echo $VBLADE_L | awk {' print $2 '}` - V_SLOT=`echo $VBLADE_L | awk {' print $3 '}` - V_IMAGE=`echo $VBLADE_L | awk {' print $4 '}` - V_ALLOWED_MAC=`echo $VBLADE_L | awk {' print $5 '}` - vbladed $V_SHELF $V_SLOT $V_INTERFACE $V_IMAGE - done - IFS=$OLD_IFS - fi - fi - fi - fi - if [ "$LVM_NFS_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/nfs-kernel-server" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs-kernel-server start - else - /etc/init.d/nfs-kernel-server start - fi - fi - if [ -x "/etc/init.d/nfs" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs start - else - /etc/init.d/nfs start - fi - fi - if [ -x "/etc/init.d/nfslock" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfslock start - else - /etc/init.d/nfslock start - fi - fi - # for Suse - if [ -x /etc/init.d/nfsserver ]; then - /etc/init.d/nfsserver start - fi - fi - if [ "$LVM_ISCSI_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/iscsi-target" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsi-target start - else - /etc/init.d/iscsi-target start - fi - elif [ -x /etc/init.d/iscsitarget ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsitarget start - else - /etc/init.d/iscsitarget start - fi - fi - fi -} - - -function lvm_storage_stop() { - echo "Stopping the openQRM lvm-storage-plugin" - if [ "$LVM_AOE_STORAGE_AUTO_START" == "yes" ]; then - # aoe - if [ -x "/etc/init.d/vblade" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d vblade stop - else - /etc/init.d/vblade stop - for VPID in `ps ax | grep vblade | grep -v grep | awk {' print $1 '}`; do - kill $VPID - done - fi - else - if [ -f $VBLADECONF ]; then - echo "Stopping vblades ..." - OLD_IFS=$IFS - IFS=$LINE_IFS - for VBLADE_L in `cat $VBLADECONF | grep -v '#' | sed '/^$/d'`; do - V_INTERFACE=`echo $VBLADE_L | awk {' print $1 '}` - V_SHELF=`echo $VBLADE_L | awk {' print $2 '}` - V_SLOT=`echo $VBLADE_L | awk {' print $3 '}` - V_IMAGE=`echo $VBLADE_L | awk {' print $4 '}` - V_ALLOWED_MAC=`echo $VBLADE_L | awk {' print $5 '}` - for VBLADE_PID in `ps ax | grep vblade | grep -w $V_IMAGE | awk {' print $1 '}`; do - kill $VBLADE_PID - done - done - IFS=$OLD_IFS - fi - killall vblade 1>/dev/null 2>&1 - fi - fi - if [ "$LVM_NFS_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/nfs-kernel-server" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs-kernel-server stop - else - /etc/init.d/nfs-kernel-server stop - fi - fi - if [ -x "/etc/init.d/nfs" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs stop - else - /etc/init.d/nfs stop - fi - fi - if [ -x "/etc/init.d/nfslock" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfslock stop - else - /etc/init.d/nfslock stop - fi - fi - # for Suse - if [ -x /etc/init.d/nfsserver ]; then - /etc/init.d/nfsserver stop - fi - fi - if [ "$LVM_ISCSI_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/iscsi-target" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsi-target stop - else - /etc/init.d/iscsi-target stop - fi - elif [ -x /etc/init.d/iscsitarget ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsitarget stop - else - /etc/init.d/iscsitarget stop - fi - fi - fi - -} - - - - - -case "$1" in - start) - lvm_storage_start - ;; - stop) - lvm_storage_stop - ;; - restart) - lvm_storage_stop - sleep 1 - lvm_storage_start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 - -esac -exit $? - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/init.d/openqrm-plugin-lvm-storage b/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/init.d/openqrm-plugin-lvm-storage deleted file mode 100644 index e444318..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/init.d/openqrm-plugin-lvm-storage +++ /dev/null @@ -1,350 +0,0 @@ -#!/bin/bash -# init script for the openQRM lvm-storage-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/include/openqrm-plugin-lvm-storage-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/etc/openqrm-plugin-lvm-storage.conf - - -LINE_IFS=' -' - -function openqrm_plugin_lvm-storage_start() { - echo "Starting the openQRM lvm-storage-plugin" - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/lvm-storage/.running - - if [ "$LVM_AOE_STORAGE_AUTO_START" == "yes" ]; then - # make sure vbladed is stopped, not using the init script here because this may exit 1 - for VPID in `ps ax | grep vblade | grep -v grep | awk {' print $1 '}`; do - kill $VPID - done - killall vblade 1>/dev/null 2>&1 - #openqrm_plugin_lvm-storage_stop 1>/dev/null 2>&1 - - # aoe - mkdir -p /var/run/vblade/ - if [ -x "/etc/init.d/vblade" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d vblade start - else - /etc/init.d/vblade start - fi - else - if [ -f $VBLADECONF ]; then - if which vbladed 1>/dev/null; then - echo "Starting vblades ..." - OLD_IFS=$IFS - IFS=$LINE_IFS - for VBLADE_L in `cat $VBLADECONF | grep -v '#' | sed '/^$/d'`; do - V_INTERFACE=`echo $VBLADE_L | awk {' print $1 '}` - V_SHELF=`echo $VBLADE_L | awk {' print $2 '}` - V_SLOT=`echo $VBLADE_L | awk {' print $3 '}` - V_IMAGE=`echo $VBLADE_L | awk {' print $4 '}` - V_ALLOWED_MAC=`echo $VBLADE_L | awk {' print $5 '}` - vbladed $V_SHELF $V_SLOT $V_INTERFACE $V_IMAGE - done - IFS=$OLD_IFS - fi - fi - fi - fi - if [ "$LVM_NFS_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/nfs-kernel-server" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs-kernel-server start - else - /etc/init.d/nfs-kernel-server start - fi - fi - if [ -x "/etc/init.d/nfs" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs start - else - /etc/init.d/nfs start - fi - fi - if [ -x "/etc/init.d/nfslock" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfslock start - else - /etc/init.d/nfslock start - fi - fi - # for Suse - if [ -x /etc/init.d/nfsserver ]; then - /etc/init.d/nfsserver start - fi - fi - if [ "$LVM_ISCSI_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/iscsi-target" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsi-target start - else - /etc/init.d/iscsi-target start - fi - elif [ -x /etc/init.d/iscsitarget ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsitarget start - else - /etc/init.d/iscsitarget start - fi - fi - fi - -} - - -function openqrm_plugin_lvm-storage_stop() { - echo "Stopping the openQRM lvm-storage-plugin" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/lvm-storage/.running - - if [ "$LVM_AOE_STORAGE_AUTO_START" == "yes" ]; then - # aoe - if [ -x "/etc/init.d/vblade" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d vblade stop - else - /etc/init.d/vblade stop - for VPID in `ps ax | grep vblade | grep -v grep | awk {' print $1 '}`; do - kill $VPID - done - fi - else - if [ -f $VBLADECONF ]; then - echo "Stopping vblades ..." - OLD_IFS=$IFS - IFS=$LINE_IFS - for VBLADE_L in `cat $VBLADECONF | grep -v '#' | sed '/^$/d'`; do - V_INTERFACE=`echo $VBLADE_L | awk {' print $1 '}` - V_SHELF=`echo $VBLADE_L | awk {' print $2 '}` - V_SLOT=`echo $VBLADE_L | awk {' print $3 '}` - V_IMAGE=`echo $VBLADE_L | awk {' print $4 '}` - V_ALLOWED_MAC=`echo $VBLADE_L | awk {' print $5 '}` - for VBLADE_PID in `ps ax | grep vblade | grep -w $V_IMAGE | awk {' print $1 '}`; do - kill $VBLADE_PID - done - done - IFS=$OLD_IFS - fi - killall vblade 1>/dev/null 2>&1 - fi - fi - - if [ "$LVM_NFS_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/nfs-kernel-server" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs-kernel-server stop - else - /etc/init.d/nfs-kernel-server stop - fi - fi - if [ -x "/etc/init.d/nfs" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs stop - else - /etc/init.d/nfs stop - fi - fi - if [ -x "/etc/init.d/nfslock" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfslock stop - else - /etc/init.d/nfslock stop - fi - fi - # for Suse - if [ -x /etc/init.d/nfsserver ]; then - /etc/init.d/nfsserver stop - fi - fi - if [ "$LVM_ISCSI_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/iscsi-target" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsi-target stop - else - /etc/init.d/iscsi-target stop - fi - elif [ -x /etc/init.d/iscsitarget ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d iscsitarget stop - else - /etc/init.d/iscsitarget stop - fi - fi - fi -} - - -function openqrm_plugin_lvm-storage_uninstall() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "lvm-storage: Please give a username to uninstall the plugin : " - read USERNAME - echo - echo -n "lvm-storage: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Uninstalling the openQRM lvm-storage-plugin" - openqrm_plugin_lvm-storage_stop - openqrm_server_remove_deployment_type $USERNAME $PASSWORD lvm-aoe-deployment - openqrm_server_remove_deployment_type $USERNAME $PASSWORD lvm-iscsi-deployment - openqrm_server_remove_deployment_type $USERNAME $PASSWORD lvm-nfs-deployment - openqrm_server_remove_deployment_type $USERNAME $PASSWORD custom-iscsi-deployment - openqrm_server_remove_deployment_type $USERNAME $PASSWORD custom-nfs-deployment - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/lvm-storage - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-lvm-storage.tgz - - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.lvm-aoe-deployment - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.lvm-iscsi-deployment - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.custom-iscsi-deployment - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.custom-nfs-deployment - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.lvm-nfs-deployment - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.lvm-aoe-deployment.php - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.lvm-iscsi-deployment.php - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.custom-iscsi-deployment.php - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.custom-nfs-deployment.php - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.lvm-nfs-deployment.php - - # remove only if nfs/iscsi/aoe is not enabled - if ! ls $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/plugins | grep iscsi-storage 1>/dev/null 2>&1; then - if ! ls $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/plugins | grep netapp-storage 1>/dev/null 2>&1; then - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/iscsid - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/iscsiadm - fi - fi - if ! ls $OPENQRM_SERVER_BASE_DIR/openqrm/web/base/plugins | grep aoe-storage 1>/dev/null 2>&1; then - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/aoe-interfaces - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/aoe-discover - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/aoe-stat - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/aoe-mkdevs - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/aoe-mkshelf - fi - -} - -function openqrm_plugin_lvm-storage_init() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "lvm-storage: Please give a username to init the plugin : " - read USERNAME - echo - echo -n "lvm-storage: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Initializing the openQRM lvm-storage-plugin" - openqrm_server_add_deployment_type $USERNAME $PASSWORD lvm-aoe-deployment lvm-aoe-deployment "Lvm Aoe-root deployment" lvm-storage "Lvm Storage Server (Aoe)" - openqrm_server_add_deployment_type $USERNAME $PASSWORD lvm-iscsi-deployment lvm-iscsi-deployment "Lvm Iscsi-root deployment" lvm-storage "Lvm Storage Server (Iscsi)" - openqrm_server_add_deployment_type $USERNAME $PASSWORD lvm-nfs-deployment lvm-nfs-deployment "Lvm Nfs-root deployment" lvm-storage "Lvm Storage Server (Nfs)" - openqrm_server_add_deployment_type $USERNAME $PASSWORD custom-iscsi-deployment custom-iscsi-deployment "Custom iSCSI-root deployment" lvm-storage "Custom Storage Server (iSCSI)" - openqrm_server_add_deployment_type $USERNAME $PASSWORD custom-nfs-deployment custom-nfs-deployment "Custom NFS-root deployment" lvm-storage "Custom Storage Server (NAS/NFS)" - - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/lvm-storage - # link the boot-service - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/boot-service-lvm-storage.tgz $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-lvm-storage.tgz - # linking the root mount hooks - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/root-mount.lvm-aoe-deployment $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.lvm-aoe-deployment - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/root-mount.lvm-iscsi-deployment $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.lvm-iscsi-deployment - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/root-mount.custom-iscsi-deployment $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.custom-iscsi-deployment - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/root-mount.custom-nfs-deployment $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.custom-nfs-deployment - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/root-mount.lvm-nfs-deployment $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.lvm-nfs-deployment - # linking the image deployment parameters menu - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/image.lvm-aoe-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.lvm-aoe-deployment.php - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/image.lvm-iscsi-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.lvm-iscsi-deployment.php - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/image.custom-iscsi-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.custom-iscsi-deployment.php - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/image.custom-nfs-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.custom-nfs-deployment.php - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/image.lvm-nfs-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.lvm-nfs-deployment.php - - # copying iscsid to boot-service dir - if [ ! -x $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/iscsid ]; then - cp -f `which iscsid` $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/ - fi - # copying iscsiadm to boot-service dir - if [ ! -x $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/iscsiadm ]; then - cp -f `which iscsiadm` $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/ - fi - - # copying aoe-interfaces to boot-service dir - if [ ! -x $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/aoe-interfaces ]; then - cp -f `which aoe-interfaces` $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/ - fi - # copying aoe-discover to boot-service dir - if [ ! -x $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/aoe-discover ]; then - cp -f `which aoe-discover` $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/ - fi - # copying aoe-stat to boot-service dir - if [ ! -x $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/aoe-stat ]; then - cp -f `which aoe-stat` $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/ - fi - # copying aoe-mkdevs to boot-service dir - if [ ! -x $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/aoe-mkdevs ]; then - cp -f `which aoe-mkdevs` $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/ - # remove the axwwww from the ps cmd in aoe-mkdevs - sed -i -e "s/axwwww//g" $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/aoe-mkdevs - fi - # copying aoe-mkshelf to boot-service dir - if [ ! -x $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/aoe-mkshelf ]; then - cp -f `which aoe-mkshelf` $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/ - # remove the axwwww from the ps cmd in aoe-mkshelf - sed -i -e "s/axwwww//g" $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/aoe-mkshelf - fi - # create storage dir for stat files - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/storage - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/storage - echo "Order deny,allow" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/storage/.htaccess - echo "Deny from all" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/web/storage/.htaccess - -} - -USER=$2 -PASS=$3 - -case "$1" in - start) - openqrm_plugin_lvm-storage_start - ;; - stop) - openqrm_plugin_lvm-storage_stop - ;; - restart) - openqrm_plugin_lvm-storage_stop - sleep 1 - openqrm_plugin_lvm-storage_start - ;; - init) - openqrm_plugin_lvm-storage_init $USER $PASS - ;; - uninstall) - openqrm_plugin_lvm-storage_uninstall $USER $PASS - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/init.d/openqrm-plugin-lvm-storage.postinstall b/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/init.d/openqrm-plugin-lvm-storage.postinstall deleted file mode 100644 index cf5ee9a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/init.d/openqrm-plugin-lvm-storage.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-lvm-storage postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/init.d/openqrm-plugin-lvm-storage.preremove b/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/init.d/openqrm-plugin-lvm-storage.preremove deleted file mode 100644 index cbe256c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/init.d/openqrm-plugin-lvm-storage.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-lvm-storage preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-lvm-storage stop diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/openqrm-plugin-lvm-storage.conf b/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/openqrm-plugin-lvm-storage.conf deleted file mode 100644 index e5a017a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/etc/openqrm-plugin-lvm-storage.conf +++ /dev/null @@ -1,52 +0,0 @@ -# this is the openQRM-plugin-lvm-storage info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, aoetools, open-iscsi" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - if [ -f /etc/centos-release ]; then - # no aoetools package for centos any more - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, iscsi-initiator-utils" - else - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, aoetools, iscsi-initiator-utils" - fi - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, open-iscsi" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Integrates LVM2 with NFS/iSCSI/AOE as Storage technology (network-deployment)." -OPENQRM_PLUGIN_TYPE="storage" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="device-manager" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/etc/openqrm-plugin-lvm-storage.conf" - -# if openQRM should start/stop the storage component (yes/no), default no -LVM_AOE_STORAGE_AUTO_START=no -LVM_ISCSI_STORAGE_AUTO_START=no -LVM_NFS_STORAGE_AUTO_START=no - -# for lvm-storage deployment: automatically resize the filesystem on LVM snapshots (true/false, default true) -OPENQRM_PLUGIN_LVM_STORAGE_RESIZE_SNAPSHOTS_FILESYSTEM="true" - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/include/openqrm-plugin-lvm-storage-functions b/openQRM-5.3.50-CE/src/plugins/lvm-storage/include/openqrm-plugin-lvm-storage-functions deleted file mode 100644 index 5f7119f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/include/openqrm-plugin-lvm-storage-functions +++ /dev/null @@ -1,512 +0,0 @@ -#!/bin/bash -# this is the functions file for the lvm-storage-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - - -# iscsi-target config file -IETDCONF=`find /etc/ -name ietd.conf -type f | head -n1` -if [ "$IETDCONF" == "" ]; then - IETDCONF="/etc/ietd.conf" -fi -# vblade config file -VBLADECONF=/etc/vblade.conf -# nfs config files -ETCFSTAB="/etc/fstab" -NFSEXPORTS="/etc/exports" -# some definitions -DEFAULT_IMAGE_SIZE=5000 -MAX_UMOUNT_LOOP=5 -LV_SIZE_DEFAULT=5000 -ISCSI_TARGET_URL=http://iscsitarget.sourceforge.net/ -AOE_AUTHENTICATED_MAC="00:00:00:00:00:00" -IMAGE_LUN=1 -# which screen binary to use -if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" -else - RUNSCREEN=`which screen` -fi - -################ common lvm-storage functions - -# logs for lvm_storage -function lvm_storage_log() { - local COMPONENT=$1 - shift - local MESSAGE=$@ - logger -i -t "lvm-storage plug-in" "$COMPONENT : $MESSAGE" -} - - -################ lvm-storage functions - - -# deps function -function check_lvm_iscsi_storage_deps() { - # check and fullfill dependencies - # lvm2 - if ! openqrm_full_fill_os_dependency lvm lvm2; then - return 1 - fi - # e2fsprogs - if ! openqrm_full_fill_os_dependency resize2fs e2fsprogs; then - return 1 - fi - # wget - if ! openqrm_full_fill_os_dependency wget wget; then - return 1 - fi - # procmail for lockfile - if ! openqrm_full_fill_os_dependency lockfile procmail; then - return 1 - fi - if [ -f /etc/debian_version ]; then - # open-iscsi - if ! openqrm_full_fill_os_dependency iscsid open-iscsi; then - return 1 - fi - # open-iscsi-utils - if ! openqrm_full_fill_os_dependency iscsiadm open-iscsi-utils; then - return 1 - fi - # ietd - needs dkms package on debian/ubuntu - if ! openqrm_full_fill_os_dependency ietd iscsitarget-dkms; then - return 1 - fi - if ! openqrm_full_fill_os_dependency ietd iscsitarget; then - return 1 - fi - elif [ -f /etc/redhat-release ]; then - # iscsi-initiator-utils - if ! openqrm_full_fill_os_dependency iscsid iscsi-initiator-utils; then - return 1 - fi - # ietd - if ! openqrm_full_fill_os_dependency ietd iscsitarget; then - return 1 - fi - elif [ -f /etc/SuSE-release ]; then - # open-iscsi - if ! openqrm_full_fill_os_dependency iscsid open-iscsi; then - return 1 - fi - # ietd - if ! openqrm_full_fill_os_dependency ietd iscsitarget; then - return 1 - fi - fi - -} - - -# deps function -function check_lvm_nfs_storage_deps() { - # check and fullfill dependencies - # lvm2 - if ! openqrm_full_fill_os_dependency lvm lvm2; then - return 1 - fi - # e2fsprogs - if ! openqrm_full_fill_os_dependency resize2fs e2fsprogs; then - return 1 - fi - # wget - if ! openqrm_full_fill_os_dependency wget wget; then - return 1 - fi - # rsync - if ! openqrm_full_fill_os_dependency rsync rsync; then - return 1 - fi - if [ -f /etc/debian_version ]; then - # nfs-kernel-server - if ! openqrm_full_fill_os_dependency exportfs nfs-kernel-server; then - return 1 - fi - # nfs-common - if ! openqrm_full_fill_os_dependency mount.nfs nfs-common; then - return 1 - fi - elif [ -f /etc/redhat-release ]; then - # nfs-utils - if ! openqrm_full_fill_os_dependency mount.nfs nfs-utils; then - return 1 - fi - elif [ -f /etc/SuSE-release ]; then - # nfs-client - if ! openqrm_full_fill_os_dependency mount.nfs nfs-client; then - return 1 - fi - # nfs-kernel-server - if ! openqrm_full_fill_os_dependency exportfs nfs-kernel-server; then - return 1 - fi - fi - -} - -# deps function -function check_lvm_aoe_storage_deps() { - # check and fullfill dependencies - # lvm2 - if ! openqrm_full_fill_os_dependency lvm lvm2; then - return 1 - fi - # e2fsprogs - if ! openqrm_full_fill_os_dependency resize2fs e2fsprogs; then - return 1 - fi - # wget - if ! openqrm_full_fill_os_dependency wget wget; then - return 1 - fi - if ! openqrm_full_fill_os_dependency vbladed vblade; then - return 1 - fi - if ! openqrm_full_fill_os_dependency aoe-discover aoetools; then - return 1 - fi -} - - - -################ lvm-nfs ################################### - - -function manage_fstab() { - case "$1" in - add) - if ! grep -w ^/dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME $ETCFSTAB; then - echo "/dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME /$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME ext3 defaults 1 1" >> $ETCFSTAB - fi - ;; - remove) - # tabs and spaces - sed -i -e "s#^/dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME .*##g" $ETCFSTAB - sed -i -e "s#^/dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME .*##g" $ETCFSTAB - ;; - esac -} - - -function restart_lvm_nfs() { - if [ -x /etc/init.d/nfs ]; then - /etc/init.d/nfs reload - elif [ -x /etc/init.d/nfs-kernel-server ]; then - /etc/init.d/nfs-kernel-server reload - elif [ -x /etc/init.d/nfsserver ]; then - /etc/init.d/nfsserver reload - else - exportfs -r - fi -} - - -function manage_nfs() { - case "$1" in - add) - OPENQRM_SERVER=$3 - if [ "$2" != "snap" ]; then - lvm_storage_log manage_nfs "NOTICE: creating ext3 filesytem on /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" - if ! mkfs.ext3 -F /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME; then - openqrm_post_event 0 "add" 3 "openqrm-lvm-manager" "Could not create filesytem on /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" - manage_fstab remove - return 1 - fi - fi - mkdir -p /$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME - if ! `mount /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME /$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME`; then - openqrm_post_event 0 "add" 3 "openqrm-lvm-manager" "Could not mount /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" - manage_fstab remove - return 1 - fi - echo "/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME $OPENQRM_SERVER(rw,insecure,no_root_squash,async)" >> $NFSEXPORTS - restart_lvm_nfs - ;; - remove) - # tabs and spaces - sed -i -e "s#^/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME .*##g" $NFSEXPORTS - sed -i -e "s#^/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME .*##g" $NFSEXPORTS - sed -i '/^$/d' $NFSEXPORTS - restart_lvm_nfs - while ! `umount /$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME`; do - if [ "$UMOUNT_LOOP" == "$MAX_UMOUNT_LOOP" ]; then - openqrm_post_event 0 "remove" 3 "openqrm-lvm-manager" "Could not umount /$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" - manage_fstab remove - return 20 - fi - UMOUNT_LOOP=$(( UMOUNT_LOOP + 1 )) - sleep 2 - done - rmdir /$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME - ;; - auth) - AUTH_IP=$2 - # tabs and spaces - sed -i -e "s#^$LVM_IMAGE_ROOTDEVICE .*#$LVM_IMAGE_ROOTDEVICE $AUTH_IP(rw,insecure,no_root_squash,async)#g" $NFSEXPORTS - sed -i -e "s#^$LVM_IMAGE_ROOTDEVICE .*#$LVM_IMAGE_ROOTDEVICE $AUTH_IP(rw,insecure,no_root_squash,async)#g" $NFSEXPORTS - sed -i '/^$/d' $NFSEXPORTS - restart_lvm_nfs - ;; - - adapt) - AUTH_IP=$3 - if ! grep -w "/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" $NFSEXPORTS 1>/dev/null; then - mkdir -p /$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME - if ! `mount /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME /$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME`; then - openqrm_post_event 0 "adapt" 3 "openqrm-lvm-manager" "Could not mount /dev/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME" - manage_fstab remove - return 1 - fi - manage_fstab add - echo "/$LVM_STORAGE_SERVER_VOLUME_GROUP/$LVM_IMAGE_NAME $AUTH_IP(rw,insecure,no_root_squash,async)" >> $NFSEXPORTS - restart_lvm_nfs - fi - ;; - - esac -} - - - -################ lvm-iscsi ################################### - - -function manage_iscsi() { - - case "$1" in - add) - IMAGE_PASS=$3 - if [ "$2" != "snap" ]; then - # create fs, currently static all ext3 - mkfs.ext3 -F /dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME - fi - echo "Target $LVM_IMAGE_NAME" >> $IETDCONF - echo " IncomingUser $LVM_IMAGE_NAME $IMAGE_PASS" >> $IETDCONF - echo " Lun $IMAGE_LUN Path=/dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME,Type=fileio" >> $IETDCONF - echo " MaxConnections 1 # $LVM_IMAGE_NAME" >> $IETDCONF - echo " MaxSessions 1 # $LVM_IMAGE_NAME" >> $IETDCONF - echo " NOPInterval 3 # $LVM_IMAGE_NAME" >> $IETDCONF - echo " NOPTimeout 3 # $LVM_IMAGE_NAME" >> $IETDCONF - LAST_TID=`grep tid: /proc/net/iet/volume | cut -d':' -f2 | awk {' print $1 '} | sort -g | tail -n1` - NEW_TID=$(( $LAST_TID + 1 )) - # dynamically add new target - if ! ietadm --op new --tid=$NEW_TID --params Name=$LVM_IMAGE_NAME; then - openqrm_post_event 0 "add" 3 "openqrm-lvm-manager" "Could not create new iSCSI target" - return 1 - fi - # set path to lvm device in the new target - if ! ietadm --op new --tid=$NEW_TID --lun=$IMAGE_LUN --params Path=/dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME; then - openqrm_post_event 0 "add" 3 "openqrm-lvm-manager" "Could not set Lun-path in new iSCSI target" - return 1 - fi - # auth target - if ! ietadm --op new --tid=$NEW_TID --user --params IncomingUser=$LVM_IMAGE_NAME,Password=$IMAGE_PASS; then - openqrm_post_event 0 "add" 3 "openqrm-lvm-manager" "Could not set username/password in new iSCSI target" - return 1 - fi - ;; - remove) - # remove from config file - cat $IETDCONF | grep -v -w $LVM_IMAGE_NAME > $IETDCONF.tmp - mv -f $IETDCONF.tmp $IETDCONF - sed -i '/^$/d' $IETDCONF - # remove from target - TID_TO_REMOVE=`cat /proc/net/iet/volume | grep "name:$LVM_IMAGE_NAME$" | cut -d':' -f2 | awk {' print $1 '}` - OPEN_SESSION=`cat /proc/net/iet/session | grep -w ^tid:$TID_TO_REMOVE -A1 | grep sid: | cut -d':' -f2 | awk {' print $1 '}` - if [ "$OPEN_SESSION" != "" ]; then - # first remove active session (does not support multiple sessions yet) - if ! ietadm --op delete --tid=$TID_TO_REMOVE --sid=$OPEN_SESSION --cid=0; then - openqrm_post_event 0 "remove" 3 "openqrm-lvm-manager" "Could not remove session $OPEN_SESSION for tid $TID_TO_REMOVE" - return 1 - fi - fi - # remove lun - if ! ietadm --op delete --tid=$TID_TO_REMOVE --lun=$IMAGE_LUN; then - openqrm_post_event 0 "remove" 3 "openqrm-lvm-manager" "Could not remove lun $IMAGE_LUN for tid $TID_TO_REMOVE" - return 1 - fi - # remove target dynamically - if ! ietadm --op delete --tid=$TID_TO_REMOVE; then - openqrm_post_event 0 "remove" 3 "openqrm-lvm-manager" "Could not remove target tid $TID_TO_REMOVE" - return 1 - fi - ;; - auth) - IMAGE_PASS=$2 - IMAGE_AUTHNAME=`basename $LVM_IMAGE_ROOTDEVICE` - sed -i -e "s#IncomingUser $IMAGE_AUTHNAME .*#IncomingUser $IMAGE_AUTHNAME $IMAGE_PASS#g" $IETDCONF - sed -i '/^$/d' $IETDCONF - TID_TO_AUTH=`cat /proc/net/iet/volume | grep "name:$IMAGE_AUTHNAME$" | cut -d':' -f2 | awk {' print $1 '}` - if [ "$TID_TO_AUTH" == "" ]; then - openqrm_post_event 0 "auth" 3 "openqrm-lvm-manager" "Could not find target $IMAGE_AUTHNAME to update the authentication" - return 1 - fi - if ! ietadm --op new --tid=$TID_TO_AUTH --user --params IncomingUser=$IMAGE_AUTHNAME,Password=$IMAGE_PASS; then - openqrm_post_event 0 "auth" 3 "openqrm-lvm-manager" "Could not find target $IMAGE_AUTHNAME to update the authentication" - return 1 - fi - ;; - - adapt) - IMAGE_PASS=$3 - if [ "$IMAGE_PASS" == "" ]; then - IMAGE_PASS=`cat /dev/urandom|tr -dc "a-zA-Z0-9-_\$\?"|fold -w 9|head -n1` - fi - if ! grep -w "/dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME" $IETDCONF | grep -v '^#' 1>/dev/null; then - echo "Target $LVM_IMAGE_NAME" >> $IETDCONF - echo " IncomingUser $LVM_IMAGE_NAME $IMAGE_PASS" >> $IETDCONF - echo " Lun $IMAGE_LUN Path=/dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME,Type=fileio" >> $IETDCONF - echo " MaxConnections 1 # $LVM_IMAGE_NAME" >> $IETDCONF - echo " MaxSessions 1 # $LVM_IMAGE_NAME" >> $IETDCONF - echo " NOPInterval 3 # $LVM_IMAGE_NAME" >> $IETDCONF - echo " NOPTimeout 3 # $LVM_IMAGE_NAME" >> $IETDCONF - LAST_TID=`grep tid: /proc/net/iet/volume | cut -d':' -f2 | awk {' print $1 '} | sort -g | tail -n1` - NEW_TID=$(( $LAST_TID + 1 )) - # dynamically add new target - if ! ietadm --op new --tid=$NEW_TID --params Name=$LVM_IMAGE_NAME; then - openqrm_post_event 0 "adapt" 3 "openqrm-lvm-manager" "Could not create new iSCSI target" - return 1 - fi - # set path to lvm device in the new target - if ! ietadm --op new --tid=$NEW_TID --lun=$IMAGE_LUN --params Path=/dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME; then - openqrm_post_event 0 "adapt" 3 "openqrm-lvm-manager" "Could not set Lun-path in new iSCSI target" - return 1 - fi - # auth target - if ! ietadm --op new --tid=$NEW_TID --user --params IncomingUser=$LVM_IMAGE_NAME,Password=$IMAGE_PASS; then - openqrm_post_event 0 "adapt" 3 "openqrm-lvm-manager" "Could not set username/password in new iSCSI target" - return 1 - fi - fi - ;; - - esac -} - - - - -################ lvm-aoe ################################### - - -function manage_vblade() { - - if [ ! -f $VBLADECONF ]; then - mkdir -p `dirname $VBLADECONF` - echo "# this is the vblade configuration file created by openQRM" > $VBLADECONF - echo "" >> $VBLADECONF - fi - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - AOE_INTERFACE=$OPENQRM_SERVER_INTERFACE - else - . /var/openqrm/openqrm-resource.conf - AOE_INTERFACE=`ip a s | grep -A1 ^[0-9] | grep -v lo | grep -i -B1 $resource_mac | grep ^[0-9] | head -n1 | awk {' print $2 '} | cut -d':' -f1` - fi - - case "$1" in - add) - if [ "$2" != "snap" ]; then - # create fs, currently static all ext3 - mkfs.ext3 -F /dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME - fi - FOUND=0 - for (( AOE_SHELF=0; $AOE_SHELF<15; AOE_SHELF = $AOE_SHELF + 1)) ; do - for (( AOE_SLOT=1; $AOE_SLOT<=15; AOE_SLOT = $AOE_SLOT + 1)) ; do - TEST=`cat $VBLADECONF | grep -v '^#' | awk {' print $2" "$3 '} | grep $AOE_SHELF" "$AOE_SLOT` - STATUS=$? - if [ $STATUS -eq 1 ]; then - FOUND=1 - break; - fi - done - if [ $STATUS -eq 1 ]; then - break; - fi - done - echo "$AOE_INTERFACE $AOE_SHELF $AOE_SLOT /dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME $AOE_AUTHENTICATED_MAC" >> $VBLADECONF - sed -i '/^$/d' $VBLADECONF - # start vbladed - SCREEN_NAME=`date +%T%x | sed -e "s/://g" | sed -e "s#/##g"` - $RUNSCREEN -dmS $SCREEN_NAME vblade -m $AOE_AUTHENTICATED_MAC $AOE_SHELF $AOE_SLOT $AOE_INTERFACE /dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME - ;; - auth) - AUTHENTICATED_MAC=$2 - AOE_VOLUME_GROUP=`echo $LVM_IMAGE_ROOTDEVICE | cut -d':' -f1` - AOE_INTERFACE=`grep -v ^# /etc/vblade.conf | grep -w "/dev/mapper/$AOE_VOLUME_GROUP-$LVM_IMAGE_NAME" | awk '{ print $1 }'` - AOE_SHELF=`grep -v ^# /etc/vblade.conf | grep -w "/dev/mapper/$AOE_VOLUME_GROUP-$LVM_IMAGE_NAME" | awk '{ print $2 }'` - AOE_SLOT=`grep -v ^# /etc/vblade.conf | grep -w "/dev/mapper/$AOE_VOLUME_GROUP-$LVM_IMAGE_NAME" | awk '{ print $3 }'` - # stop + remove - for VBLADE_PID in `ps ax | grep vblade | grep -w "/dev/mapper/$AOE_VOLUME_GROUP-$LVM_IMAGE_NAME" | awk {' print $1 '}`; do - kill $VBLADE_PID - done - grep -w -v "/dev/mapper/$AOE_VOLUME_GROUP-$LVM_IMAGE_NAME" $VBLADECONF > $VBLADECONF.new - mv -f $VBLADECONF.new $VBLADECONF - sed -i '/^$/d' $VBLADECONF - sync - # add with new auth - echo "$AOE_INTERFACE $AOE_SHELF $AOE_SLOT /dev/mapper/$AOE_VOLUME_GROUP-$LVM_IMAGE_NAME $AUTHENTICATED_MAC" >> $VBLADECONF - # start vbladed - SCREEN_NAME=`date +%T%x | sed -e "s/://g" | sed -e "s#/##g"` - $RUNSCREEN -dmS $SCREEN_NAME vblade -m $AUTHENTICATED_MAC $AOE_SHELF $AOE_SLOT $AOE_INTERFACE /dev/mapper/$AOE_VOLUME_GROUP-$LVM_IMAGE_NAME - ;; - remove) - for VBLADE_PID in `ps ax | grep vblade | grep -w $LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME | awk {' print $1 '}`; do - kill $VBLADE_PID - done - sync - grep -w -v "/dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME" $VBLADECONF > $VBLADECONF.new - mv -f $VBLADECONF.new $VBLADECONF - sed -i '/^$/d' $VBLADECONF - ;; - - adapt) - if ! grep -w "/dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME" $VBLADECONF | grep -v '^#'; then - FOUND=0 - for (( AOE_SHELF=0; $AOE_SHELF<15; AOE_SHELF = $AOE_SHELF + 1)) ; do - for (( AOE_SLOT=1; $AOE_SLOT<=15; AOE_SLOT = $AOE_SLOT + 1)) ; do - TEST=`cat $VBLADECONF | grep -v '^#' | awk {' print $2" "$3 '} | grep $AOE_SHELF" "$AOE_SLOT` - STATUS=$? - if [ $STATUS -eq 1 ]; then - FOUND=1 - break; - fi - done - if [ $STATUS -eq 1 ]; then - break; - fi - done - echo "$AOE_INTERFACE $AOE_SHELF $AOE_SLOT /dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME $AOE_AUTHENTICATED_MAC" >> $VBLADECONF - sed -i '/^$/d' $VBLADECONF - # start vbladed - SCREEN_NAME=`date +%T%x | sed -e "s/://g" | sed -e "s#/##g"` - $RUNSCREEN -dmS $SCREEN_NAME vblade -m $AOE_AUTHENTICATED_MAC $AOE_SHELF $AOE_SLOT $AOE_INTERFACE /dev/mapper/$LVM_STORAGE_SERVER_VOLUME_GROUP-$LVM_IMAGE_NAME - fi - ;; - - esac -} - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/include/openqrm-plugin-lvm-storage-kernel-hook b/openQRM-5.3.50-CE/src/plugins/lvm-storage/include/openqrm-plugin-lvm-storage-kernel-hook deleted file mode 100644 index 53c8be2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/include/openqrm-plugin-lvm-storage-kernel-hook +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# this is a hook function for the kernel-creation phase -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -function lvm_storage_kernel_hook() { - - local KERNEL_NAME=$1 - local KERNEL_VERSION=$2 - local KERNEL_LOCATION=$3 - local KERNEL_TYPE=$4 - - echo "lvm-storage-plugin: Running lvm_storage_kernel_hook $KERNEL_NAME $KERNEL_VERSION $KERNEL_LOCATION $KERNEL_TYPE" - echo "lvm-storage-plugin: Running lvm_storage_kernel_hook $KERNEL_NAME $KERNEL_VERSION $KERNEL_LOCATION $KERNEL_TYPE" | logger - - # try to find the iscsid + iscsiadm util fitting to the created kernel - if [ -x "$KERNEL_LOCATION/sbin/iscsid" ]; then - cp -a $KERNEL_LOCATION/sbin/iscsid $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsid.$KERNEL_NAME - echo "lvm-storage-plugin: Found iscsid at $KERNEL_LOCATION/sbin/iscsid. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsid.$KERNEL_NAME" - echo "lvm-storage-plugin: Found iscsid at $KERNEL_LOCATION/sbin/iscsid. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsid.$KERNEL_NAME" | logger - fi - if [ -x "$KERNEL_LOCATION/usr/sbin/iscsid" ]; then - cp -a $KERNEL_LOCATION/usr/sbin/iscsid $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsid.$KERNEL_NAME - echo "lvm-storage-plugin: Found iscsid at $KERNEL_LOCATION/usr/sbin/iscsid. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsid.$KERNEL_NAME" - echo "lvm-storage-plugin: Found iscsid at $KERNEL_LOCATION/usr/sbin/iscsid. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsid.$KERNEL_NAME" | logger - fi - if [ -x "$KERNEL_LOCATION/sbin/iscsiadm" ]; then - cp -a $KERNEL_LOCATION/sbin/iscsiadm $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsiadm.$KERNEL_NAME - echo "lvm-storage-plugin: Found iscsiadm at $KERNEL_LOCATION/sbin/iscsiadm. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsiadm.$KERNEL_NAME" - echo "lvm-storage-plugin: Found iscsiadm at $KERNEL_LOCATION/sbin/iscsiadm. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsiadm.$KERNEL_NAME" | logger - fi - if [ -x "$KERNEL_LOCATION/usr/bin/iscsiadm" ]; then - cp -a $KERNEL_LOCATION/usr/bin/iscsiadm $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsiadm.$KERNEL_NAME - echo "lvm-storage-plugin: Found iscsiadm at $KERNEL_LOCATION/usr/bin/iscsiadm. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsiadm.$KERNEL_NAME" - echo "lvm-storage-plugin: Found iscsiadm at $KERNEL_LOCATION/usr/bin/iscsiadm. Coping to $OPENQRM_SERVER_BASE_DIR/openqrm/web/boot-service/iscsiadm.$KERNEL_NAME" | logger - fi - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage-about.bootservice.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage-about.bootservice.class.php deleted file mode 100644 index 4633983..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage-about.bootservice.class.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ - -class lvm_storage_about_bootservice -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/lvm-storage-about-bootservice.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['boot_service_title'], 'boot_service_title'); - $t->add($this->lang['boot_service_content'], 'boot_service_content'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage-about.controller.class.php deleted file mode 100644 index 9d52de7..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage-about.controller.class.php +++ /dev/null @@ -1,260 +0,0 @@ - - */ - - -class lvm_storage_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'lvm_storage_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_storage_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_storage_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About LVM-Storage', - 'label' => 'About LVM-Storage', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The "LVM-Storage" plugin integrate standard Linux Systems as LVM Storage server - NFS/iSCSI/AOE. - The "LVM-Storage" plugin transforms a standard Linux-box into a rapid-fast-cloning storage-server - supporting snap-shotting for NFS-, Aoe-, and Iscsi-filesystem-images. - The snapshots (clones from a "golden server image") are immediatly available for deployment and - saving space on the storage-subsystem because just the delta of the server image is being stored. - ', - 'requirements_title' => 'Requirements', - 'requirements_list' => '
    • A resource for the LVM-Storage Storage (this can be a remote system integrated into openQRM e.g. via the "local-server" plugin or the openQRM server itself)
    • -
    • One (or more) lvm volume group(s) with free space dedicated for the LVM-Storage Volumes
    • -
    • The following packages must be installed: nfs-common, nfs-kernel-server, screen, rsync, vblade, aoetools, iscsitarget, open-iscsi
    ', - - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - - 'provides_title' => 'Provides', - 'provides_list' => '
    • Storage type: "Lvm Storage Server (Aoe/Nfs/Iscsi)"
    • -
    • Deployment types: "Lvm Aoe/Nfs/Iscsi-root deployment"
    ', - 'type_title' => 'Plugin Type', - 'type_content' => 'Storage', - - 'deployment_title' => 'Deployment Type', - 'deployment_content' => 'Network-Deployment', - - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - 'network_deploymet' => 'Network-Deployment', - 'doc1' => '', - ), - 'bootservice' => array ( - 'tab' => 'Boot-Service', - 'label' => 'LVM-Storage Boot-Service', - 'boot_service_title' => 'LVM-Storage Host Boot-Service', - 'boot_service_content' => 'The LVM-Storage Plugin provides an openQRM Boot-Service. - This "LVM-Storage Boot-Service" is automatically downloaded and executed by the openQRM-Client on all integrated Systems. - The Boot-Service is located at:
    -
    - /usr/share/openqrm/plugins/lvm-storage/web/boot-service-lvm-storage.tgz -
    -
    - The "LVM-Storage Boot-Service contains the Client files of the LVM-Storage Plugin.
    - Also a configuration file for the LVM-Storage server is included in this Boot-Service.
    -
    - The Boot-Service configuration can be viewed and administrated by the "openqrm" utility.
    - To view the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n lvm-storage -a default -
    -
    - To view a Boot-Service configuration of a specific appliance run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n lvm-storage -a [appliance-name] -
    -
    - To adapt a parameter in the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n lvm-storage -a default -k [key] -v [value] -
    -
    - To adapt a paramter in the Boot-Service configuration of a specific appliance run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n lvm-storage -a [appliance-name] -k [key] -v [value] -
    -
    - In case the openmQRM Server itself is used as the LVM-Storage Storage please edit:
    -
    - /usr/share/openqrm/plugins/lvm-storage/etc/openqrm-plugin-lvm-storage.conf -
    -
    - and set the configuration keys.
    -
    - ', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/lvm-storage/lang", 'lvm-storage-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/lvm-storage/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "documentation"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - case 'bootservice': - $content[] = $this->bootservice(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About LVM-Storage - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage-about.documentation.class.php'); - $controller = new lvm_storage_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Boot-Service - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function bootservice( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage-about.bootservice.class.php'); - $controller = new lvm_storage_about_bootservice($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['bootservice']; - $data = $controller->action(); - } - $content['label'] = $this->lang['bootservice']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'bootservice' ); - $content['onclick'] = false; - if($this->action === 'bootservice'){ - $content['active'] = true; - } - return $content; - } - - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage-about.documentation.class.php deleted file mode 100644 index 2132760..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage-about.documentation.class.php +++ /dev/null @@ -1,89 +0,0 @@ - - */ - -class lvm_storage_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/lvm-storage-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['deployment_title'], 'deployment_title'); - $t->add($this->lang['deployment_content'], 'deployment_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.add.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.add.class.php deleted file mode 100644 index 36a03e1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.add.class.php +++ /dev/null @@ -1,356 +0,0 @@ - - */ - -class lvm_storage_add -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - $this->controller = $controller; - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->user = $openqrm->user(); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->volgroup = $this->response->html->request()->get('volgroup'); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - - $this->response->add('storage_id', $storage_id); - $this->response->add('volgroup', $this->volgroup); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->set_max(); - $response = $this->add(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->controller->__reload('lv'); - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->params['reload'] = 'false'; - $this->response->redirect( - $this->response->get_url($this->actions_name, 'volgroup', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/lvm-storage-add.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add(sprintf($this->lang['label'], $this->volgroup), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Add - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function add() { - - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - if($form->get_request('size') > $this->max) { - $form->set_error('size', sprintf($this->lang['error_size_exeeded'], $this->max)); - } - if(!$form->get_errors()) { - $name = $form->get_request('name'); - $command = $this->openqrm->get('basedir').'/plugins/lvm-storage/bin/openqrm-lvm-storage add'; - $command .= ' -n '.$name.' -m '.$form->get_request('size'); - $command .= ' -t '.$this->deployment->type.' -v '.$this->volgroup; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - if($this->deployment->type === 'lvm-iscsi-deployment') { - $image = new image(); - $command .= ' -i '.$image->generatePassword(12); - } - $statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[1]; - if($name === $check) { - $error = sprintf($this->lang['error_exists'], $name); - } - } - } - } - } - if(isset($error)) { - $response->error = $error; - } else { - if(file_exists($statfile)) { - unlink($statfile); - } - $this->resource->send_command($this->resource->ip, $command); - while (!file_exists($statfile)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - // add check that volume $name is now in the statfile - $created = false; - $volume_path = ""; - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[1]; - if($name === $check) { - $created = true; - switch($this->deployment->type) { - case 'lvm-aoe-deployment': - // for lvm-aoe deployment we need to get the shelf + slot from get_root_identifiert - $ident_file = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.lv.lvm-aoe-deployment.ident'; - $get_ident_command = $this->openqrm->get('basedir').'/plugins/lvm-storage/bin/openqrm-lvm-storage post_identifier'; - $get_ident_command .= ' -t '.$this->deployment->type.' -v '.$this->volgroup; - $get_ident_command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $ident_file = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.lv.lvm-aoe-deployment.ident'; - if(file_exists($ident_file)) { - unlink($ident_file); - } - $this->resource->send_command($this->resource->ip, $get_ident_command); - while (!file_exists($ident_file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $ident_lines = explode("\n", file_get_contents($ident_file)); - if(count($ident_lines) >= 1) { - foreach($ident_lines as $ident_line) { - if($ident_line !== '') { - $ident_line = explode(',', $ident_line); - $ident_root_path = explode(':', $ident_line[1]); - $ident_check = $ident_root_path[1]; - if($name === $ident_check) { - $volume_path = $ident_line[1]; - $rootfstype = 'ext3'; - break; - } - } - } - } - break; - case 'lvm-nfs-deployment': - $volume_path = '/'.$line[2].'/'.$line[1]; - $rootfstype = 'nfs'; - break; - case 'lvm-iscsi-deployment': - $volume_path = $line[2].':/dev/'.$line[1].'/1'; - $rootfstype = 'ext3'; - break; - } - break; - } - } - } - } - - if ($created) { - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $name; - $image_fields['image_type'] = $this->deployment->type; - $image_fields['image_size'] = $form->get_request('size'); - $image_fields['image_rootfstype'] = $rootfstype; - $image_fields['image_storageid'] = $this->storage->id; - $image_fields['image_comment'] = "Image Object for volume $name"; - $image_fields['image_rootdevice'] = $volume_path; - $image = new image(); - $image->add($image_fields); - $response->msg = sprintf($this->lang['msg_added'], $name); - // save image id in response for the wizard - $response->image_id = $image_fields["image_id"]; - - } else { - $response->msg = sprintf($this->lang['msg_add_failed'], $name); - } - } - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'add'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['css'] = 'namegen'; - $d['name']['object']['attrib']['customattribs'] = 'data-prefix="lvm" data-length="6"'; - $d['name']['object']['attrib']['value'] = ''; - $d['name']['object']['attrib']['maxlength'] = 50; - - $d['size']['label'] = sprintf($this->lang['form_size'], number_format($this->max, 0, '', '')); - $d['size']['required'] = true; - $d['size']['validate']['regex'] = '/^[0-9]+$/i'; - $d['size']['validate']['errormsg'] = sprintf($this->lang['error_size'], '0-9'); - $d['size']['object']['type'] = 'htmlobject_input'; - $d['size']['object']['attrib']['name'] = 'size'; - $d['size']['object']['attrib']['type'] = 'text'; - $d['size']['object']['attrib']['value'] = ''; - $d['size']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - - //-------------------------------------------- - /** - * Set max - * - * @access protected - * @return bool - */ - //-------------------------------------------- - function set_max() { - $statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.vg.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[0] === $this->volgroup) { - $max = $line[6]; #str_replace('.', '', $line[6]); - if(strpos($max, 'g') !== false) { - $max = str_replace('g', '', $max); - //$max = floor($max * (1073741824 / 1048576)); - $max = floor(($max * 1000) * 1.0486); - $this->max = $max; - return true; - } else { - $max = str_replace('m', '', $max); - $max = (int)$max; - $this->max = $max; - return true; - } - } - } - } - } else { - return false; - } - } else { - return false; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.addvg.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.addvg.class.php deleted file mode 100644 index 6ab8fbf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.addvg.class.php +++ /dev/null @@ -1,19 +0,0 @@ - - */ -require_once($_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/device-manager/class/device-manager.addvg.class.php'); -class lvm_storage_addvg extends device_manager_addvg { } diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.api.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.api.class.php deleted file mode 100644 index 5501a98..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.api.class.php +++ /dev/null @@ -1,71 +0,0 @@ - - */ - -class lvm_storage_api -{ - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param object $iscsi_storage_controller - */ - //-------------------------------------------- - function __construct($controller) { - $this->controller = $controller; - $this->user = $this->controller->user; - $this->html = $this->controller->response->html; - $this->response = $this->html->response(); - $this->file = $this->controller->file; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - */ - //-------------------------------------------- - function action() { - $action = $this->html->request()->get($this->controller->actions_name); - switch( $action ) { - case 'progress': - $this->progress(); - break; - } - } - - //-------------------------------------------- - /** - * Get progress - * - * @access public - */ - //-------------------------------------------- - function progress() { - $name = basename($this->response->html->request()->get('name')); - $file = $this->controller->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$name; - if($this->file->exists($file)) { - echo $this->file->get_contents($file); - } else { - header("HTTP/1.0 404 Not Found"); - } - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.clone.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.clone.class.php deleted file mode 100644 index 0e0179f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.clone.class.php +++ /dev/null @@ -1,330 +0,0 @@ - - */ - -class lvm_storage_clone -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->user = $openqrm->user(); - $this->volgroup = $this->response->html->request()->get('volgroup'); - $this->lvol = $this->response->html->request()->get('lvol'); - - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - - $this->response->add('storage_id', $storage_id); - $this->response->add('volgroup', $this->volgroup); - $this->response->add('lvol', $this->lvol); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->duplicate(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'volgroup', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/lvm-storage-clone.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add(sprintf($this->lang['label'], $this->lvol), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * clone - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function duplicate() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $name = $form->get_request('name'); - $command = $this->openqrm->get('basedir').'/plugins/lvm-storage/bin/openqrm-lvm-storage clone'; - $command .= ' -t '.$this->deployment->type; - $command .= ' -v '.$this->volgroup; - $command .= ' -n '.$this->lvol; - $command .= ' -m '.$this->set_max(); - $command .= ' -s '.$name; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - if($this->deployment->type === 'lvm-iscsi-deployment') { - $image = new image(); - $command .= ' -i '.$image->generatePassword(12); - } - - $statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[1]; - if($name === $check) { - $error = sprintf($this->lang['error_exists'], $name); - } - } - } - } - } - if(isset($error)) { - $response->error = $error; - } else { - $file = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$resource->id.'.lvm.'.$name.'.sync_progress'; - if(file_exists($file)) { - unlink($file); - } - $this->resource->send_command($this->resource->ip, $command); - while (!file_exists($file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - - - switch($this->deployment->type) { - case 'lvm-aoe-deployment': - // for lvm-aoe deployment we need to get the shelf + slot from get_root_identifiert - $ident_file = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.lv.lvm-aoe-deployment.ident'; - $get_ident_command = $this->openqrm->get('basedir').'/plugins/lvm-storage/bin/openqrm-lvm-storage post_identifier'; - $get_ident_command .= ' -t '.$this->deployment->type.' -v '.$this->volgroup; - $get_ident_command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $ident_file = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.lv.lvm-aoe-deployment.ident'; - if(file_exists($ident_file)) { - unlink($ident_file); - } - $this->resource->send_command($this->resource->ip, $get_ident_command); - while (!file_exists($ident_file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $ident_lines = explode("\n", file_get_contents($ident_file)); - if(count($ident_lines) >= 1) { - foreach($ident_lines as $ident_line) { - if($ident_line !== '') { - $ident_line = explode(',', $ident_line); - $ident_root_path = explode(':', $ident_line[1]); - $ident_check = $ident_root_path[1]; - if($name === $ident_check) { - $volume_path = $ident_line[1]; - $rootfstype = 'ext3'; - break; - } - } - } - } - break; - case 'lvm-nfs-deployment': - $volume_path = '/'.$this->volgroup.'/'.$name; - $rootfstype = 'nfs'; - break; - case 'lvm-iscsi-deployment': - $volume_path = $this->volgroup.':/dev/'.$name.'/1'; - $rootfstype = 'ext3'; - break; - } - - // get origin image object - $origin_image = new image(); - $origin_image->get_instance_by_name($this->lvol); - - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $name; - $image_fields['image_type'] = $deployment->type; - $image_fields['image_version'] = $origin_image->version; - $image_fields['image_size'] = $origin_image->size; - $image_fields['image_rootfstype'] = $rootfstype; - $image_fields['image_storageid'] = $storage->id; - $image_fields['image_comment'] = "Image Object for volume $name"; - $image_fields['image_rootdevice'] = $volume_path; - $image = new image(); - $image->add($image_fields); - - $response->msg = sprintf($this->lang['msg_cloned'], $this->lvol, $name); - // save image id in response for the wizard - $response->image_id = $image_fields["image_id"]; - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'clone'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['css'] = 'namegen'; - $d['name']['object']['attrib']['customattribs'] = 'data-prefix="lvm" data-length="6"'; - $d['name']['object']['attrib']['value'] = $this->lvol.'c'; - $d['name']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - - - //-------------------------------------------- - /** - * Set max - * - * @access protected - * @return bool - */ - //-------------------------------------------- - function set_max() { - $vgmax = ''; - $lvmax = ''; - $statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[1] === $this->lvol) { - $lvmax = str_replace('.', '', $line[4]); - $lvmax = str_replace('m', '', $lvmax); - $lvmax = (int)$lvmax / 100; - } - } - } - } - } - return $lvmax; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.controller.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.controller.class.php deleted file mode 100644 index 205e9f9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.controller.class.php +++ /dev/null @@ -1,958 +0,0 @@ - - */ - -class lvm_storage_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array ( - 'tab' => 'Select lvm-storage', - 'label' => 'Select lvm-storage', - 'action_edit' => 'edit', - 'table_name' => 'Name', - 'table_id' => 'Id', - 'table_recource' => 'Resource', - 'table_type' => 'Type', - 'table_deployment' => 'Deployment', - 'error_no_storage' => 'No storage configured yet!

    Please create a lvm Storage first!', - 'new_storage' => 'New Storage', - 'please_wait' => 'Loading Volume groups. Please wait ..', - ), - 'edit' => array ( - 'tab' => 'Select LVM Volume group', - 'label' => 'Select LVM Volume group on storage %s', - 'lang_id' => 'ID', - 'lang_name' => 'Name', - 'lang_resource' => 'Resource', - 'lang_state' => 'State', - 'lang_deployment' => 'Deployment', - 'action_edit' => 'select', - 'action_add' => 'Add new Volume Group', - 'action_remove' => 'remove', - 'table_name' => 'Name', - 'table_pv' => 'PV', - 'table_lv' => 'LV', - 'table_sn' => 'SN', - 'table_attr' => 'Attr', - 'table_vsize' => 'Vsize', - 'table_vfree' => 'VFree', - 'error_no_lvm' => 'Storage %s is not of type lvm-storage', - 'please_wait' => 'Loading Volume group. Please wait ..', - ), - 'addvg' => array( - 'tab' => 'Add Volume Group', - 'label' => 'Add Volume Group to storage %s', - 'partition' => 'Partition', - 'name' => 'Name', - 'extend' => 'extend partition', - 'confirm_text' => 'All Data on %s will be erased.
    Are you sure to continue?', - 'msg_added' => 'Successfully added Volume Group %s', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'removevg' => array( - 'tab' => 'Remove Volume Group', - 'label' => 'Remove Volume Group on storage %s', - 'confirm_text' => 'Do you realy want to remove Volume Group %s?', - 'msg_removed' => 'Successfully removed Volume Group %s', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'volgroup' => array ( - 'tab' => 'Edit LVM Volume group', - 'label' => 'Edit LVM Volume group %s on storage %s', - 'lang_id' => 'ID', - 'lang_name' => 'Name', - 'lang_deployment' => 'Deployment', - 'lang_resource' => 'Resource', - 'lang_state' => 'State', - 'lang_attr' => 'Attr', - 'lang_pv' => 'PV / LV / SN', - 'lang_size' => 'Vsize / Vfree', - 'action_add' => 'Add new logical volume', - 'action_remove' => 'remove', - 'action_resize' => 'resize', - 'action_snap' => 'snap', - 'action_clone' => 'clone', - 'action_add_image' => 'Add Image', - 'action_remove_image' => 'Remove Image', - 'action_sync_in_progress' => 'Source of synchronisation - Please wait', - 'action_clone_in_progress' => 'Synchronisation in progress - Please wait', - 'action_clone_finished' => 'Syncronisation finished!', - 'table_name' => 'Lvol', - 'table_deployment' => 'Deployment', - 'table_attr' => 'Attr', - 'table_size' => 'Size', - 'table_source' => 'Source', - 'error_no_lvm' => 'Storage %s is not of type lvm-deployment', - 'please_wait' => 'Loading Volume group. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'add' => array ( - 'tab' => 'Add Logical Volume', - 'label' => 'Add Logical Volume to LVM Volume group %s', - 'form_name' => 'Name', - 'form_size' => 'Size (max: %s MB)', - 'msg_added' => 'Added Logical Volume %s', - 'msg_add_failed' => 'Failed to add Volume %s', - 'error_exists' => 'Logical Volume %s allready exists', - 'error_name' => 'Name must be %s', - 'error_size' => 'Size must be %s', - 'error_size_exeeded' => 'Size exeeds %s MB', - 'please_wait' => 'Adding Logical Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'image' => array ( - 'label' => 'Add/Remove Image for Logical Volume %s', - 'tab' => 'Add/Remove Image', - 'error_exists' => 'Image %s allready exists', - 'error_image_still_in_use' => 'Image id %s is still in use by Server(s) %s', - 'msg_added_image' => 'Added Image %s', - 'msg_removed_image' => 'Removed Image id %s', - 'msg_add_failed' => 'Failed to add Image id %s', - 'please_wait' => 'Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'snap' => array ( - 'label' => 'Snap Logical Volume %s', - 'tab' => 'Snap Logical Volume', - 'msg_snaped' => 'Snaped %s to %s', - 'msg_snap_failed' => 'Failed to clone Volume %s', - 'form_name' => 'Name', - 'form_size' => 'Size (max: %s MB)', - 'error_exists' => 'Volume %s allready exists', - 'error_name' => 'Name must be %s', - 'error_size' => 'Size must be %s', - 'error_size_exeeded' => 'Size exeeds %s MB', - 'please_wait' => 'Snaping Logical Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'clone' => array ( - 'label' => 'Clone Logical Volume %s', - 'tab' => 'Clone Logical Volume', - 'msg_cloned' => 'Cloned %s as %s', - 'msg_clone_failed' => 'Failed to clone Volume %s', - 'form_name' => 'Name', - 'error_exists' => 'Volume %s allready exists', - 'error_name' => 'Name must be %s', - 'please_wait' => 'Cloning Logical Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'remove' => array ( - 'label' => 'Remove Logical Volume(s)', - 'msg_removed' => 'Removed Logical Volume %s', - 'msg_image_still_in_use' => 'Volume %s of Image id %s is still in use by appliance(s) %s', - 'please_wait' => 'Removing Logical Volume(s). Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'resize' => array ( - 'label' => 'Resize Logical Volume %s', - 'tab' => 'Resize Logical Volume', - 'size' => 'min. %s MB, max. %s MB', - 'error_size' => 'Size must be %s', - 'error_size_exeeded' => 'Size exeeds %s MB', - 'error_size_undercut' => 'Size undercuts %s MB', - 'msg_resized' => 'Resized Logical Volume %s', - 'please_wait' => 'Resizing Logical Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'custom' => array ( - 'tab' => 'Custom Volumes', - 'label' => 'Custom Volumes', - 'lang_id' => 'ID', - 'lang_name' => 'Name', - 'lang_deployment' => 'Deployment', - 'lang_resource' => 'Resource', - 'lang_state' => 'State', - 'action_add' => 'Add new Custom Volume', - 'action_remove' => 'remove', - 'table_name' => 'Custom Images', - 'table_initiator' => 'Initiator Name', - 'table_target' => 'Target', - 'table_lun' => 'Lun', - 'table_username' => 'Username', - 'table_export' => 'NFS Export', - 'table_deployment' => 'Deployment', - 'table_source' => 'Source', - 'error_no_lvm' => 'Storage %s is not of type lvm-deployment', - 'please_wait' => 'Loading Custom Images. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'customadd' => array ( - 'tab' => 'Add Custom Volume', - 'label' => 'Add Custom Volume', - 'form_name' => 'Name', - 'form_target' => 'Target Name', - 'form_lun' => 'Lun Number', - 'form_initiator' => 'Initiator Name', - 'form_username' => 'Username', - 'form_password' => 'Password', - 'form_export' => 'NFS Export', - 'msg_added' => 'Added Custom Volume %s', - 'msg_add_failed' => 'Failed to add Volume %s', - 'error_exists' => 'Custom Volume %s allready exists', - 'error_name' => 'Name must be %s', - 'error_target' => 'Target Name must be %s', - 'error_lun' => 'Lun must be %s', - 'error_initiator' => 'Initiator Name must be %s', - 'error_username' => 'Username must be %s', - 'error_password' => 'Password must be %s', - 'error_export' => 'Export must be %s', - 'please_wait' => 'Adding Custom Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'customremove' => array ( - 'label' => 'Remove Custom Volume(s)', - 'msg_removed' => 'Removed Custom Volume %s', - 'msg_image_still_in_use' => 'Volume %s of Image id %s is still in use by appliance(s) %s', - 'please_wait' => 'Removing Logical Volume(s). Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/lvm-storage/lang", 'lvm-storage.ini'); - $this->tpldir = $this->rootdir.'/plugins/lvm-storage/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - if($this->action === 'addvg' || $this->action === 'removevg') { - $this->action = 'edit'; - } else { - $this->action = 'volgroup'; - } - } - if($this->action === '') { - $this->action = 'select'; - } - // Set response and reload statfile - if($this->action !== 'select') { - $this->response->params['storage_id'] = $this->response->html->request()->get('storage_id'); - if($this->action !== 'remove' && $this->action !== 'addvg' && $this->action !== 'removevg' && $this->action !== 'custom' && $this->action !== 'customremove' && $this->action !== 'customadd') { - $this->__reload('vg'); - } - if($this->action !== 'edit') { - $this->response->params['volgroup'] = $this->response->html->request()->get('volgroup'); - } - } - - // handle custom storage - if($this->action === 'edit') { - $storage = new storage(); - $storage->get_instance_by_id($this->response->html->request()->get('storage_id')); - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - if ($deployment->name == 'custom-iscsi-deployment') { - $this->action = 'custom'; - } - if ($deployment->name == 'custom-nfs-deployment') { - $this->action = 'custom'; - } - } - - $content = array(); - switch( $this->action ) { - case '': - case 'select': - $content[] = $this->select(true); - break; - case 'edit': - $content[] = $this->select(false); - $content[] = $this->edit(true); - break; - case 'addvg': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->addvg(true); - break; - case 'removevg': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->removevg(true); - break; - case 'volgroup': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(true); - break; - case 'add': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(false); - $content[] = $this->add(true); - break; - case 'image': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(false); - $content[] = $this->image(true); - break; - case 'resize': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(false); - $content[] = $this->resize(true); - break; - case 'snap': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(false); - $content[] = $this->snap(true); - break; - case 'clone': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(false); - $content[] = $this->duplicate(true); - break; - case 'remove': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->volgroup(false); - $content[] = $this->remove(true); - break; - case 'custom': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->custom(true); - break; - case 'customremove': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->customremove(true); - break; - case 'customadd': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->customadd(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * API - * - * @access public - */ - //-------------------------------------------- - function api() { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.api.class.php'); - $controller = new lvm_storage_api($this); - $controller->action(); - } - - //-------------------------------------------- - /** - * Select Storages of type lvm - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.select.class.php'); - $controller = new lvm_storage_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['select']; - - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Edit lvm-storage - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function edit( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.edit.class.php'); - $controller = new lvm_storage_edit($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['edit']; - $data = $controller->action(); - } - $content['label'] = $this->lang['edit']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'edit' ); - $content['onclick'] = false; - if($this->action === 'edit'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add lvm volume group - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function addvg( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.addvg.class.php'); - $controller = new lvm_storage_addvg($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->rootdir.'/plugins/device-manager/tpl/'; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['addvg']; - $data = $controller->action(); - } - $content['label'] = $this->lang['addvg']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'addvg' ); - $content['onclick'] = false; - if($this->action === 'addvg'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Remove lvm volume group - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function removevg( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.removevg.class.php'); - $controller = new lvm_storage_removevg($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->rootdir.'/plugins/device-manager/tpl/'; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['removevg']; - $data = $controller->action(); - } - $content['label'] = $this->lang['removevg']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'removevg' ); - $content['onclick'] = false; - if($this->action === 'removevg'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Edit lvm volgroup - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function volgroup( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - if($this->response->html->request()->get('reload') !== 'false') { - $this->__reload('lv'); - } - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.volgroup.class.php'); - $controller = new lvm_storage_volgroup($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['volgroup']; - $data = $controller->action(); - } - $content['label'] = $this->lang['volgroup']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'volgroup' ); - $content['onclick'] = false; - if($this->action === 'volgroup'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add new Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function add( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.add.class.php'); - $controller = new lvm_storage_add($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['add']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['add']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'add' ); - $content['onclick'] = false; - if($this->action === 'add'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add/Remvoe Image object - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function image( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.image.class.php'); - $controller = new lvm_storage_image($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['image']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['image']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'image' ); - $content['onclick'] = false; - if($this->action === 'image'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Remove Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function remove( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.remove.class.php'); - $controller = new lvm_storage_remove($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['remove']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Remove'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'remove' ); - $content['onclick'] = false; - if($this->action === 'remove' || $this->action === $this->lang['volgroup']['action_remove']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Snapshot Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function snap( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.snap.class.php'); - $controller = new lvm_storage_snap($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['snap']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['snap']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'snap' ); - $content['onclick'] = false; - if($this->action === 'snap' || $this->action === $this->lang['edit']['action_snap']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Clone Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function duplicate( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.clone.class.php'); - $controller = new lvm_storage_clone($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['clone']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['clone']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'clone' ); - $content['onclick'] = false; - if($this->action === 'clone' || $this->action === $this->lang['edit']['action_clone']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Resize Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function resize( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.resize.class.php'); - $controller = new lvm_storage_resize($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['resize']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['resize']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'resize' ); - $content['onclick'] = false; - if($this->action === 'resize'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Cusdtom lvm-storage - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function custom( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.custom.class.php'); - $controller = new lvm_storage_custom($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['custom']; - $data = $controller->action(); - } - $content['label'] = $this->lang['custom']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'custom' ); - $content['onclick'] = false; - if($this->action === 'custom'){ - $content['active'] = true; - } - return $content; - } - - - - //-------------------------------------------- - /** - * Custom Add - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function customadd( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.customadd.class.php'); - $controller = new lvm_storage_customadd($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['customadd']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['customadd']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'customadd' ); - $content['onclick'] = false; - if($this->action === 'customadd'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Custom Remove - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function customremove( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/lvm-storage/class/lvm-storage.customremove.class.php'); - $controller = new lvm_storage_customremove($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['customremove']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'customremove'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'customremove' ); - $content['onclick'] = false; - if($this->action === 'customremove' || $this->action === $this->lang['volgroup']['action_remove']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Reload Exports - * - * @access public - */ - //-------------------------------------------- - function __reload($mode) { - $OPENQRM_SERVER_BASE_DIR = $this->openqrm->get('basedir'); - $storage_id = $this->response->html->request()->get('storage_id'); - $volgroup = $this->response->html->request()->get('volgroup'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $command = ''; - $file = ''; - // reload volume group - if($mode === 'vg') { - $file = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$resource->id.'.vg.stat'; - $command .= $OPENQRM_SERVER_BASE_DIR.'/plugins/lvm-storage/bin/openqrm-lvm-storage post_vg'; - } - // reload logical volumes - if($mode === 'lv') { - $file = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$resource->id.'.'.$volgroup.'.lv.stat'; - $command .= $OPENQRM_SERVER_BASE_DIR.'/plugins/lvm-storage/bin/openqrm-lvm-storage post_lv'; - $command .= ' -v '.$volgroup.' -t '.$deployment->type; - } - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - if(file_exists($file)) { - unlink($file); - } - $resource->send_command($resource->ip, $command); - while (!file_exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - return true; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.custom.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.custom.class.php deleted file mode 100644 index 565f75f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.custom.class.php +++ /dev/null @@ -1,244 +0,0 @@ - - */ - -class lvm_storage_custom -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* identifier name -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Init - * - * @access public - */ - //-------------------------------------------- - function init() { - $storage_id = $this->response->html->request()->get('storage_id'); - if($storage_id === '') { - return false; - } - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $this->resource = $resource; - $this->storage = $storage; - $this->deployment = $deployment; - - $this->statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$resource->id.'.vg.stat'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->init(); - $data = $this->custom(); - if($data !== false) { - $t = $this->response->html->template($this->tpldir.'/lvm-storage-custom.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($data); - $t->add($this->lang['lang_id'], 'lang_id'); - $t->add($this->lang['lang_name'], 'lang_name'); - $t->add($this->lang['lang_resource'], 'lang_resource'); - $t->add($this->lang['lang_deployment'], 'lang_deployment'); - $t->add($this->lang['lang_state'], 'lang_state'); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } else { - $msg = sprintf($this->lang['error_no_lvm'], $this->response->html->request()->get('storage_id')); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - } - - //-------------------------------------------- - /** - * custom - * - * @access public - * @return array|false - */ - //-------------------------------------------- - function custom() { - if(strpos($this->deployment->type, 'custom-') !== false) { - // check device-manager - $devicemgm = false; - if($this->file->exists($this->openqrm->get('webdir').'/plugins/device-manager/class/device-manager.addvg.class.php')) { - $devicemgm = true; - } - $resource_icon_default="/img/resource.png"; - $storage_icon="/plugins/lvm-storage/img/plugin.png"; - $state_icon = ''.$this->resource->state.''; - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default=$storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - - $d['state'] = $state_icon; - // $d['icon'] = ''; - $d['resource'] = $this->resource->id.' / '.$this->resource->ip; - $d['deployment'] = $this->deployment->type; - $d['name'] = $this->storage->name; - $d['id'] = $this->storage->id; - - $i = 0; - $body = array(); - $image = new image(); - $images = $image->display_overview(0, $image->get_count(), 'image_id', 'ASC'); - if(count($images) >= 1) { - foreach($images as $k => $v) { - $image->get_instance_by_id($v["image_id"]); - if ($image->storageid == $this->storage->id) { - $name = $image->name; - $initiator = $image->get_deployment_parameter('INITIATOR'); - $username = $image->get_deployment_parameter('USER'); - if ($this->deployment->name == 'custom-iscsi-deployment') { - $root_device_arr = explode("/", $image->rootdevice); - $target = $root_device_arr[2]; - $lun = $root_device_arr[3]; - } - if ($this->deployment->name == 'custom-nfs-deployment') { - $target = $image->rootdevice; - $lun = 'nfs'; - } - - $body[$i] = array( - // 'icon' => $d['icon'], - 'name' => $name, - 'target' => $target, - 'lun' => $lun, - 'initiator' => $initiator, - 'username' => $username, - ); - $i++; - } - } - } - - $h['name']['title'] = $this->lang['table_name']; - $h['target']['title'] = $this->lang['table_target']." / ".$this->lang['table_export']; - $h['target']['sortable'] = true; - $h['lun']['title'] = $this->lang['table_lun']; - $h['lun']['sortable'] = true; - $h['initiator']['title'] = $this->lang['table_initiator']; - $h['initiator']['sortable'] = true; - $h['username']['title'] = $this->lang['table_username']; - $h['username']['sortable'] = true; - - $table = $this->response->html->tablebuilder('lvm_custom', $this->response->get_array($this->actions_name, 'custom')); - $table->sort = 'name'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = count($body); - $table->autosort = true; - $table->sort_link = false; - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $body; - - $table->identifier = 'name'; - $table->identifier_name = $this->identifier_name; - $table->actions_name = $this->actions_name; - $table->actions = array(array('customremove' => $this->lang['action_remove'])); - - - $a = $this->response->html->a(); - $a->title = $this->lang['action_add']; - $a->label = $this->lang['action_add']; - $a->handler = 'onclick="wait();"'; - $a->css = 'add'; - $a->href = $this->response->get_url($this->actions_name, "customadd"); - $d['add'] = $a->get_string(); - - $d['table'] = $table->get_string(); - return $d; - } else { - return false; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.customadd.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.customadd.class.php deleted file mode 100644 index fbd0163..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.customadd.class.php +++ /dev/null @@ -1,306 +0,0 @@ - - */ - -class lvm_storage_customadd -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - $this->controller = $controller; - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->user = $openqrm->user(); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - $this->response->add('storage_id', $storage_id); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->customadd(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'custom', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/lvm-storage-customadd.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Add - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function customadd() { - - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - - $name = $form->get_request('name'); - if ($this->deployment->name == 'custom-iscsi-deployment') { - $target = $form->get_request('target'); - $lun = $form->get_request('lun'); - $initiator = $form->get_request('initiator'); - $username = $form->get_request('username'); - $password = $form->get_request('password'); - $rootfstype = 'ext3'; - $volume_path = '/dev/'.$target.'/'.$lun; - } - if ($this->deployment->name == 'custom-nfs-deployment') { - $volume_path = $form->get_request('export'); - $rootfstype = 'nfs'; - } - // $error = sprintf($this->lang['error_exists'], $name); - - if(isset($error)) { - $response->error = $error; - } else { - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $new_image_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields["image_id"] = $new_image_id; - $image_fields['image_name'] = $name; - $image_fields['image_type'] = $this->deployment->type; - $image_fields['image_rootfstype'] = $rootfstype; - $image_fields['image_storageid'] = $this->storage->id; - $image_fields['image_comment'] = "Image Object for volume $name"; - $image_fields['image_rootdevice'] = $volume_path; - $image = new image(); - $image->add($image_fields); - $image->get_instance_by_id($new_image_id); - - if ($this->deployment->name == 'custom-iscsi-deployment') { - $image->set_deployment_parameters('INITIATOR', $initiator); - if (strlen($username)) { - $image->set_deployment_parameters('USER', $username); - } - if (strlen($password)) { - $image->set_deployment_parameters('PASSWORD', $password); - } - } - $response->msg = sprintf($this->lang['msg_added'], $name); - // save image id in response for the wizard - $response->image_id = $image_fields["image_id"]; - - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'customadd'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['css'] = 'namegen'; - $d['name']['object']['attrib']['customattribs'] = 'data-prefix="custom" data-length="6"'; - $d['name']['object']['attrib']['value'] = ''; - $d['name']['object']['attrib']['maxlength'] = 50; - - if ($this->deployment->name == 'custom-iscsi-deployment') { - $d['target']['label'] = $this->lang['form_target']; - $d['target']['required'] = true; - $d['target']['validate']['regex'] = ''; - $d['target']['validate']['errormsg'] = sprintf($this->lang['error_target'], 'a-z0-9._'); - $d['target']['object']['type'] = 'htmlobject_input'; - $d['target']['object']['attrib']['id'] = 'target'; - $d['target']['object']['attrib']['name'] = 'target'; - $d['target']['object']['attrib']['type'] = 'text'; - $d['target']['object']['attrib']['value'] = ''; - $d['target']['object']['attrib']['maxlength'] = 50; - - $d['lun']['label'] = $this->lang['form_lun']; - $d['lun']['required'] = true; - $d['lun']['validate']['regex'] = ''; - $d['lun']['validate']['errormsg'] = sprintf($this->lang['error_lun'], 'a-z0-9._'); - $d['lun']['object']['type'] = 'htmlobject_input'; - $d['lun']['object']['attrib']['id'] = 'lun'; - $d['lun']['object']['attrib']['name'] = 'lun'; - $d['lun']['object']['attrib']['type'] = 'text'; - $d['lun']['object']['attrib']['value'] = ''; - $d['lun']['object']['attrib']['maxlength'] = 5; - - $d['initiator']['label'] = $this->lang['form_initiator']; - $d['initiator']['required'] = true; - $d['initiator']['validate']['regex'] = ''; - $d['initiator']['validate']['errormsg'] = sprintf($this->lang['error_initiator'], 'a-z0-9._'); - $d['initiator']['object']['type'] = 'htmlobject_input'; - $d['initiator']['object']['attrib']['id'] = 'initiator'; - $d['initiator']['object']['attrib']['name'] = 'initiator'; - $d['initiator']['object']['attrib']['type'] = 'text'; - $d['initiator']['object']['attrib']['value'] = ''; - $d['initiator']['object']['attrib']['maxlength'] = 200; - - $d['username']['label'] = $this->lang['form_username']; - $d['username']['required'] = false; - $d['username']['validate']['regex'] = ''; - $d['username']['validate']['errormsg'] = sprintf($this->lang['error_username'], 'a-z0-9._'); - $d['username']['object']['type'] = 'htmlobject_input'; - $d['username']['object']['attrib']['id'] = 'username'; - $d['username']['object']['attrib']['name'] = 'username'; - $d['username']['object']['attrib']['type'] = 'text'; - $d['username']['object']['attrib']['value'] = ''; - $d['username']['object']['attrib']['maxlength'] = 50; - - $d['password']['label'] = $this->lang['form_password']; - $d['password']['required'] = false; - $d['password']['validate']['regex'] = ''; - $d['password']['validate']['errormsg'] = sprintf($this->lang['error_password'], 'a-z0-9._'); - $d['password']['object']['type'] = 'htmlobject_input'; - $d['password']['object']['attrib']['id'] = 'password'; - $d['password']['object']['attrib']['name'] = 'password'; - $d['password']['object']['attrib']['type'] = 'password'; - $d['password']['object']['attrib']['value'] = ''; - $d['password']['object']['attrib']['maxlength'] = 50; - - $d['export'] = ''; - - } - - if ($this->deployment->name == 'custom-nfs-deployment') { - $d['export']['label'] = $this->lang['form_export']; - $d['export']['required'] = true; - $d['export']['validate']['regex'] = ''; - $d['export']['validate']['errormsg'] = sprintf($this->lang['error_export'], 'a-z0-9._'); - $d['export']['object']['type'] = 'htmlobject_input'; - $d['export']['object']['attrib']['id'] = 'export'; - $d['export']['object']['attrib']['name'] = 'export'; - $d['export']['object']['attrib']['type'] = 'text'; - $d['export']['object']['attrib']['value'] = ''; - $d['export']['object']['attrib']['maxlength'] = 250; - - $d['target'] = ''; - $d['lun'] = ''; - $d['initiator'] = ''; - $d['username'] = ''; - $d['password'] = ''; - } - - $form->add($d); - $response->form = $form; - return $response; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.customremove.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.customremove.class.php deleted file mode 100644 index a965567..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.customremove.class.php +++ /dev/null @@ -1,202 +0,0 @@ - - */ - -class lvm_storage_customremove -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->file = $this->openqrm->file(); - - $this->response->add('storage_id', $this->response->html->request()->get('storage_id')); - $this->response->add($this->identifier_name.'[]', ''); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->customremove(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'custom', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/lvm-storage-customremove.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->add($response->form); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Remove - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function customremove() { - $response = $this->get_response(); - $lvols = $response->html->request()->get($this->identifier_name); - $form = $response->form; - if( $lvols !== '' ) { - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $i = 0; - foreach($lvols as $ex) { - $d['param_f'.$i]['label'] = $ex; - $d['param_f'.$i]['object']['type'] = 'htmlobject_input'; - $d['param_f'.$i]['object']['attrib']['type'] = 'checkbox'; - $d['param_f'.$i]['object']['attrib']['name'] = $this->identifier_name.'['.$i.']'; - $d['param_f'.$i]['object']['attrib']['value'] = $ex; - $d['param_f'.$i]['object']['attrib']['checked'] = true; - $i++; - } - $form->add($d); - if(!$form->get_errors() && $response->submit()) { - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - - $storage->get_instance_by_id($this->response->html->request()->get('storage_id')); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $errors = array(); - $message = array(); - foreach($lvols as $key => $lvol) { - - // check if an appliance is still using the volume as an image - $image = new image(); - $image->get_instance_by_name($lvol); - - // check if it is still in use - $appliance = new appliance(); - $appliances_using_resource = $appliance->get_ids_per_image($image->id); - if (count($appliances_using_resource) > 0) { - $appliances_using_resource_str = implode(",", $appliances_using_resource[0]); - $errors[] = sprintf($this->lang['msg_image_still_in_use'], $lvol, $image->id, $appliances_using_resource_str); - } else { - - $form->remove($this->identifier_name.'['.$key.']'); - $message[] = sprintf($this->lang['msg_removed'], $lvol); - $image->remove_by_name($lvol); - } - } - if(count($errors) === 0) { - $response->msg = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response->error = join('
    ', $msg); - } - } - } else { - $response->msg = ''; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'customremove'); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.edit.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.edit.class.php deleted file mode 100644 index 5a575b3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.edit.class.php +++ /dev/null @@ -1,267 +0,0 @@ - - */ - -class lvm_storage_edit -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* identifier name -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Init - * - * @access public - */ - //-------------------------------------------- - function init() { - $storage_id = $this->response->html->request()->get('storage_id'); - if($storage_id === '') { - return false; - } - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $this->resource = $resource; - $this->storage = $storage; - $this->deployment = $deployment; - - $this->statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$resource->id.'.vg.stat'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->init(); - $data = $this->edit(); - if($data !== false) { - $t = $this->response->html->template($this->tpldir.'/lvm-storage-edit.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($data); - $t->add($this->lang['lang_id'], 'lang_id'); - $t->add($this->lang['lang_name'], 'lang_name'); - $t->add($this->lang['lang_resource'], 'lang_resource'); - $t->add($this->lang['lang_deployment'], 'lang_deployment'); - $t->add($this->lang['lang_state'], 'lang_state'); - $t->add(sprintf($this->lang['label'], $data['name']), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } else { - $msg = sprintf($this->lang['error_no_lvm'], $this->response->html->request()->get('storage_id')); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return array|false - */ - //-------------------------------------------- - function edit() { - if(strpos($this->deployment->type, 'lvm') !== false) { - // check device-manager - $devicemgm = false; - if($this->file->exists($this->openqrm->get('webdir').'/plugins/device-manager/class/device-manager.addvg.class.php')) { - $devicemgm = true; - } - $resource_icon_default="/img/resource.png"; - $storage_icon="/plugins/lvm-storage/img/plugin.png"; - $state_icon = ''.$this->resource->state.''; - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default=$storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - - $d['state'] = $state_icon; - // $d['icon'] = ''; - $d['resource'] = $this->resource->id.' / '.$this->resource->ip; - $d['deployment'] = $this->deployment->type; - $d['name'] = $this->storage->name; - $d['id'] = $this->storage->id; - - $body = array(); - $file = $this->statfile; - if(file_exists($file)) { - $lines = explode("\n", file_get_contents($file)); - if(count($lines) >= 1) { - $i = 0; - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $name = substr($line[0], strripos($line[0], '/')); - $vsize = number_format(substr($line[5], 0, strpos($line[5], '.')), 0, '', '').' MB'; - $vfree = str_replace('m', '', $line[6]); - if($vfree !== '0') { - $vfree = number_format(substr($line[6], 0, strpos($line[6], '.')), 0, '', ''); - } - $a = $this->response->html->a(); - $a->title = $this->lang['action_edit']; - $a->label = $this->lang['action_edit']; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($this->actions_name, "volgroup").'&volgroup='.$name; - $body[$i] = array( - // 'icon' => $d['icon'], - 'name' => $name, - 'pv' => $line[1], - 'lv' => $line[2], - 'sn' => $line[3], - 'attr' => $line[4], - 'vsize' => $vsize, - 'vfree' => $vfree.' MB', - 'edit' => $a->get_string(), - ); - if($devicemgm === true) { - if($line[2] === '0' && $line[3] === '0') { - $a = $this->response->html->a(); - $a->title = $this->lang['action_remove']; - $a->label = $this->lang['action_remove']; - $a->handler = 'onclick="wait();"'; - $a->css = 'remove'; - $a->href = $this->response->get_url($this->actions_name, "removevg").'&volgroup='.$name; - $body[$i]['remove'] = $a->get_string(); - } else { - $body[$i]['remove'] = ' '; - } - } - $i++; - } - } - } - } - -/* - $h['icon']['title'] = ' '; - $h['icon']['sortable'] = false; -*/ - $h['name']['title'] = $this->lang['table_name']; - $h['pv']['title'] = $this->lang['table_pv']; - $h['lv']['title'] = $this->lang['table_lv']; - $h['sn']['title'] = $this->lang['table_sn']; - $h['attr']['title'] = $this->lang['table_attr']; - $h['vsize']['title'] = $this->lang['table_vsize']; - $h['vfree']['title'] = $this->lang['table_vfree']; - $h['edit']['title'] = ' '; - $h['edit']['sortable'] = false; - - if($devicemgm === true) { - $h['remove']['title'] = ' '; - $h['remove']['sortable'] = false; - } - - $table = $this->response->html->tablebuilder('lvm_edit', $this->response->get_array($this->actions_name, 'edit')); - $table->sort = 'name'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = count($body); - $table->autosort = true; - $table->sort_link = false; - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $body; - - $d['add'] = ''; - if($devicemgm === true) { - $a = $this->response->html->a(); - $a->title = $this->lang['action_add']; - $a->label = $this->lang['action_add']; - $a->handler = 'onclick="wait();"'; - $a->css = 'add'; - $a->href = $this->response->get_url($this->actions_name, "addvg"); - $d['add'] = $a->get_string(); - } - - $d['table'] = $table->get_string(); - return $d; - } else { - return false; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.image.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.image.class.php deleted file mode 100644 index 813495f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.image.class.php +++ /dev/null @@ -1,234 +0,0 @@ - - */ - -class lvm_storage_image -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - $this->response->add('storage_id', $storage_id); - $this->volgroup = $this->response->html->request()->get('volgroup'); - $this->response->add('volgroup', $this->volgroup); - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->image(); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'volgroup', $this->message_param, $response) - ); - } - - //-------------------------------------------- - /** - * Add/Remove image object - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function image() { - $response = ''; - $errors = array(); - $message = array(); - $image_command = $this->response->html->request()->get('image_command'); - - if( $image_command !== '' ) { - switch ($image_command) { - case 'add': - $root_device = $this->response->html->request()->get('root_device'); - $image_name = $this->response->html->request()->get('image_name'); - - // check if image name is not in use yet - $image = new image(); - $image->get_instance_by_name($image_name); - if (strlen($image->id)) { - $errors[] = sprintf($this->lang['error_exists'], $image_name); - } else { - - $image_rootfstype = ''; - // for lvm-aoe deployment we need to get the shelf + slot from get_root_identifiert - $ident_file = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.lvm.'.$image_name.'.adapt'; - $get_ident_command = $this->openqrm->get('basedir').'/plugins/lvm-storage/bin/openqrm-lvm-storage adapt'; - $get_ident_command .= ' -n '.$image_name; - $get_ident_command .= ' -t '.$this->deployment->type.' -v '.$this->volgroup; - $get_ident_command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $get_ident_command .= ' --openqrm-ui-user '.$this->user->name; - $get_ident_command .= ' --openqrm-cmd-mode background'; - if(file_exists($ident_file)) { - unlink($ident_file); - } - $this->resource->send_command($this->resource->ip, $get_ident_command); - while (!file_exists($ident_file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $found = false; - if ($this->deployment->type == 'lvm-aoe-deployment') { - $name = $root_device; - $root_device = ''; - $ident_lines = explode("\n", file_get_contents($ident_file)); - if(count($ident_lines) >= 1) { - foreach($ident_lines as $ident_line) { - if($ident_line !== '') { - $ident_line = explode(',', $ident_line); - $ident_root_path = explode(':', $ident_line[1]); - $ident_check = $ident_root_path[1]; - if($name === $ident_check) { - $root_device = $ident_line[1]; - $image_rootfstype = 'ext3'; - $found = true; - break; - } - } - } - } - } else if ($this->deployment->type == 'lvm-iscsi-deployment') { - $image_rootfstype = 'ext3'; - $found = true; - } else if ($this->deployment->type == 'lvm-nfs-deployment') { - $image_rootfstype = 'nfs'; - $found = true; - } - if ($found) { - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $image_name; - $image_fields['image_type'] = $this->deployment->type; - $image_fields['image_rootfstype'] = $image_rootfstype; - $image_fields['image_storageid'] = $this->storage->id; - $image_fields['image_comment'] = "Image Object for volume $image_name"; - $image_fields['image_rootdevice'] = $root_device; - $image = new image(); - $image->add($image_fields); - $message[] = sprintf($this->lang['msg_added_image'], $image_name); - } else { - $message[] = sprintf($this->lang['msg_add_failed'], $image_name); - } - } - break; - - case 'remove': - $image_id = $this->response->html->request()->get('image_id'); - // check if image is not in use any more before removing - $remove_error = 0; - $appliance = new appliance(); - $appliance_id_list = $appliance->get_all_ids(); - foreach($appliance_id_list as $appliance_list) { - $appliance_id = $appliance_list['appliance_id']; - $app_image_remove_check = new appliance(); - $app_image_remove_check->get_instance_by_id($appliance_id); - if ($app_image_remove_check->imageid == $image_id) { - $image_is_used_by_appliance .= $appliance_id." "; - $remove_error = 1; - } - } - if ($remove_error == 1) { - $errors[] = sprintf($this->lang['error_image_still_in_use'], $image_id, $image_is_used_by_appliance); - } else { - $image_remove = new image(); - $image_remove->remove($image_id); - $message[] = sprintf($this->lang['msg_removed_image'], $image_id); - } - break; - } - if(count($errors) === 0) { - $response = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response = join('
    ', $msg); - } - } else { - $response = ''; - } - return $response; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.remove.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.remove.class.php deleted file mode 100644 index 4f09b9f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.remove.class.php +++ /dev/null @@ -1,231 +0,0 @@ - - */ - -class lvm_storage_remove -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->file = $this->openqrm->file(); - $this->volgroup = $this->response->html->request()->get('volgroup'); - - $this->response->add('storage_id', $this->response->html->request()->get('storage_id')); - $this->response->add('volgroup', $this->volgroup); - $this->response->add($this->identifier_name.'[]', ''); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->remove(); - if(isset($response->msg)) { - $this->response->params['reload'] = 'false'; - $this->response->redirect( - $this->response->get_url($this->actions_name, 'volgroup', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/lvm-storage-remove.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->add($response->form); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Remove - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function remove() { - $response = $this->get_response(); - $lvols = $response->html->request()->get($this->identifier_name); - $form = $response->form; - if( $lvols !== '' ) { - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $i = 0; - foreach($lvols as $ex) { - $d['param_f'.$i]['label'] = $ex; - $d['param_f'.$i]['object']['type'] = 'htmlobject_input'; - $d['param_f'.$i]['object']['attrib']['type'] = 'checkbox'; - $d['param_f'.$i]['object']['attrib']['name'] = $this->identifier_name.'['.$i.']'; - $d['param_f'.$i]['object']['attrib']['value'] = $ex; - $d['param_f'.$i]['object']['attrib']['checked'] = true; - $i++; - } - $form->add($d); - if(!$form->get_errors() && $response->submit()) { - $name = $this->openqrm->admin()->name; - $pass = $this->openqrm->admin()->password; - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - - $storage->get_instance_by_id($this->response->html->request()->get('storage_id')); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $errors = array(); - $message = array(); - foreach($lvols as $key => $lvol) { - - // check if an appliance is still using the volume as an image - $image = new image(); - $image->get_instance_by_name($lvol); - - // check if it is still in use - $appliance = new appliance(); - $appliances_using_resource = $appliance->get_ids_per_image($image->id); - if (count($appliances_using_resource) > 0) { - $appliances_using_resource_str = implode(",", $appliances_using_resource[0]); - $errors[] = sprintf($this->lang['msg_image_still_in_use'], $lvol, $image->id, $appliances_using_resource_str); - } else { - - $command = $this->openqrm->get('basedir').'/plugins/lvm-storage/bin/openqrm-lvm-storage remove'; - $command .= ' -n '.$lvol; - $command .= ' -v '.$this->volgroup; - $command .= ' -t '.$deployment->type; - $command .= ' -u '.$name.' -p '.$pass; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $file = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$resource->id.'.'.$this->volgroup.'.lv.stat'; - if(file_exists($file)) { - unlink($file); - } - $resource->send_command($resource->ip, $command); - while (!file_exists($file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - - #$error = $resource->send_command($resource->ip, $command); - #if($error !== '' ) { - # $errors[] = $error; - #} else { - $form->remove($this->identifier_name.'['.$key.']'); - $message[] = sprintf($this->lang['msg_removed'], $lvol); - #} - // remove the image of the volume - $image->remove_by_name($lvol); - } - } - if(count($errors) === 0) { - $response->msg = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response->error = join('
    ', $msg); - } - } - } else { - $response->msg = ''; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'remove'); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.removevg.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.removevg.class.php deleted file mode 100644 index cf2f05b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.removevg.class.php +++ /dev/null @@ -1,19 +0,0 @@ - - */ -require_once($_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/device-manager/class/device-manager.removevg.class.php'); -class lvm_storage_removevg extends device_manager_removevg { } diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.resize.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.resize.class.php deleted file mode 100644 index 8a3b158..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.resize.class.php +++ /dev/null @@ -1,259 +0,0 @@ - - */ - -class lvm_storage_resize -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->file = $this->openqrm->file(); - $this->volgroup = $this->response->html->request()->get('volgroup'); - $this->lvol = $this->response->html->request()->get('lvol'); - - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - - $this->response->add('storage_id', $storage_id); - $this->response->add('volgroup', $this->volgroup); - $this->response->add('lvol', $this->lvol); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->resize(); - if(isset($response->msg)) { - $this->response->params['reload'] = 'false'; - $this->response->redirect( - $this->response->get_url($this->actions_name, 'volgroup', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/lvm-storage-resize.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add(sprintf($this->lang['label'], $this->lvol), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->add($response->form); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * resize - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function resize() { - $this->set_max(); - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - if($form->get_request('size') > $this->max) { - $form->set_error('size', sprintf($this->lang['error_size_exeeded'], number_format($this->max, 0, '', ''))); - } - if($form->get_request('size') < $this->min) { - $form->set_error('size', sprintf($this->lang['error_size_undercut'], number_format($this->min, 0, '', ''))); - } - if(!$form->get_errors()) { - $name = $form->get_request('name'); - $command = $this->openqrm->get('basedir').'/plugins/lvm-storage/bin/openqrm-lvm-storage resize'; - $command .= ' -t '.$this->deployment->type; - $command .= ' -v '.$this->volgroup; - $command .= ' -n '.$this->lvol; - $command .= ' -m '.($form->get_request('size') - $this->min); - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - if($this->deployment->type === 'lvm-iscsi-deployment') { - $image = new image(); - $command .= ' -i '.$image->generatePassword(12); - } - $statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if(file_exists($statfile)) { - unlink($statfile); - } - $this->resource->send_command($this->resource->ip, $command); - while (!file_exists($statfile)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - - // get origin image object - $origin_image = new image(); - $origin_image->get_instance_by_name($this->lvol); - // set image size - $image_fields = array(); - $image_fields['image_size'] = $form->get_request('size'); - $origin_image->update($origin_image->id, $image_fields); - $response->msg = sprintf($this->lang['msg_resized'], $this->lvol); - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'resize'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['size']['label'] = sprintf($this->lang['size'],number_format($this->min, 0, '', ''), number_format($this->max, 0, '', '')); - $d['size']['required'] = true; - $d['size']['validate']['regex'] = '/^[0-9]+$/i'; - $d['size']['validate']['errormsg'] = sprintf($this->lang['error_size'], '0-9'); - $d['size']['object']['type'] = 'htmlobject_input'; - $d['size']['object']['attrib']['name'] = 'size'; - $d['size']['object']['attrib']['type'] = 'text'; - $d['size']['object']['attrib']['value'] = ''; - $d['size']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - - //-------------------------------------------- - /** - * Set min and max - * - * @access protected - */ - //-------------------------------------------- - function set_max() { - $vgmax = ''; - $lvmax = ''; - $statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[1] === $this->lvol) { - $lvmax = str_replace('.', '', $line[4]); - $lvmax = str_replace('m', '', $lvmax); - $lvmax = (int)$lvmax / 100; - $this->min = $lvmax; - } - } - } - } - } - $statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.vg.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[0] === $this->volgroup) { - $vgmax = str_replace('.', '', $line[6]); - $vgmax = str_replace('m', '', $vgmax); - $vgmax = (int)$vgmax / 100; - $this->max = $vgmax + $lvmax; - } - } - } - } - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.select.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.select.class.php deleted file mode 100644 index 8c34c05..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.select.class.php +++ /dev/null @@ -1,234 +0,0 @@ - - */ - -class lvm_storage_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $table = $this->select(); - $t = $this->response->html->template($this->tpldir.'/lvm-storage-select.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($table, 'table'); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return htmlobject_tablebulider | htmlobject_div - */ - //-------------------------------------------- - function select() { - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - - $type = $this->response->html->request()->get('storage_type'); - if($type === '') { - $type = 'lvm-lvm-deployment'; - } - $deployment->get_instance_by_type($type); - $storages = $storage->display_overview(0, $storage->get_count(), 'storage_id', 'ASC'); - if(count($storages) >= 1) { - foreach($storages as $k => $v) { - $storage->get_instance_by_id($v["storage_id"]); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - if($deployment->storagetype === 'lvm-storage') { - $resource_icon_default="/img/resource.png"; - $storage_icon="/plugins/lvm-storage/img/plugin.png"; - $state_icon = ''.$resource->state.''; - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default=$storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - $a = $this->response->html->a(); - $a->title = $this->lang['action_edit']; - $a->label = $this->lang['action_edit']; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - if(($deployment->name === 'custom-iscsi-deployment') || ($deployment->name === 'custom-nfs-deployment')) { - $a->href = $this->response->get_url($this->actions_name, "custom").'&storage_id='.$storage->id; - } else { - $a->href = $this->response->get_url($this->actions_name, "edit").'&storage_id='.$storage->id; - } - - $data = ''.$this->lang['table_recource'].': '.$resource->id.' / '.$resource->ip.'
    '; - $data .= ''.$this->lang['table_type'].': '.$deployment->storagetype.'
    '; - $data .= ''.$this->lang['table_deployment'].': '.$deployment->storagedescription.'
    '; - - $b[] = array( - 'state' => $state_icon, - // 'icon' => 'Icon', - 'storage_id' => $storage->id, - 'name' => $storage->name, - 'storage_resource_id' => $storage->resource_id, - 'deployment' => $deployment->storagedescription, - 'storage_data' => $data, - 'storage_comment' => '', - 'edit' => $a->get_string(), - ); - } - } - - if(isset($b) && is_array($b) && count($b) >= 1) { - $h = array(); - $h['state'] = array(); - $h['state']['title'] =' '; - $h['state']['sortable'] = false; -/* - $h['icon'] = array(); - $h['icon']['title'] =' '; - $h['icon']['sortable'] = false; -*/ - $h['storage_id'] = array(); - $h['storage_id']['title'] = $this->lang['table_id']; - $h['name'] = array(); - $h['name']['title'] = $this->lang['table_name']; - $h['storage_resource_id'] = array(); - $h['storage_resource_id']['title'] = $this->lang['table_recource']; - $h['storage_resource_id']['hidden'] = true; - $h['storage_data'] = array(); - $h['storage_data']['title'] = ' '; - $h['storage_data']['sortable'] = false; - $h['deployment'] = array(); - $h['deployment']['title'] = $this->lang['table_deployment']; - $h['deployment']['hidden'] = true; - $h['storage_comment'] = array(); - $h['storage_comment']['title'] =' '; - $h['storage_comment']['sortable'] = false; - $h['edit'] = array(); - $h['edit']['title'] = ' '; - $h['edit']['sortable'] = false; - - $table = $this->response->html->tablebuilder('lvm', $this->response->get_array($this->actions_name, 'select')); - $table->sort = 'storage_id'; - $table->limit = 10; - $table->order = 'ASC'; - $table->max = count($b); - $table->autosort = false; - $table->sort_link = false; - $table->autosort = true; - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $b; - return $table->get_string(); - } else { - $a = $this->response->html->a(); - $a->title = $this->lang['new_storage']; - $a->label = $this->lang['new_storage']; - $a->handler = 'onclick="wait();"'; - $a->css = 'add'; - $a->href = $this->response->html->thisfile.'?base=storage&storage_action=add'; - - $box = $this->response->html->div(); - $box->id = 'Tabelle'; - $box->css = 'htmlobject_box'; - $content = $this->lang['error_no_storage'].'

    '; - $content .= $a->get_string(); - $box->add($content); - return $box->get_string(); - } - } else { - $a = $this->response->html->a(); - $a->title = $this->lang['new_storage']; - $a->label = $this->lang['new_storage']; - $a->handler = 'onclick="wait();"'; - $a->css = 'add'; - $a->href = $this->response->html->thisfile.'?base=storage&storage_action=add'; - - $box = $this->response->html->div(); - $box->id = 'Tabelle'; - $box->css = 'htmlobject_box'; - $content = $this->lang['error_no_storage'].'

    '; - $content .= $a->get_string(); - $box->add($content); - return $box->get_string(); - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.snap.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.snap.class.php deleted file mode 100644 index 8f6c9b9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.snap.class.php +++ /dev/null @@ -1,367 +0,0 @@ - - */ - -class lvm_storage_snap -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->user = $openqrm->user(); - $this->lvol = $this->response->html->request()->get('lvol'); - $this->volgroup = $this->response->html->request()->get('volgroup'); - - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - - $this->response->add('storage_id', $storage_id); - $this->response->add('volgroup', $this->volgroup); - $this->response->add('lvol', $this->lvol); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->set_max(); - $response = $this->snap(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->params['reload'] = 'false'; - $this->response->redirect( - $this->response->get_url($this->actions_name, 'volgroup', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/lvm-storage-snap.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add(sprintf($this->lang['label'], $this->lvol), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * snap - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function snap() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - if($form->get_request('size') > $this->max) { - $form->set_error('size', sprintf($this->lang['error_size_exeeded'], number_format($this->max, 0, '', ''))); - } - if(!$form->get_errors()) { - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $name = $form->get_request('name'); - $command = $this->openqrm->get('basedir').'/plugins/lvm-storage/bin/openqrm-lvm-storage snap'; - $command .= ' -t '.$this->deployment->type; - $command .= ' -v '.$this->volgroup; - $command .= ' -n '.$this->lvol; - $command .= ' -m '.$form->get_request('size'); - $command .= ' -s '.$name; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - if($this->deployment->type === 'lvm-iscsi-deployment') { - $image = new image(); - $command .= ' -i '.$image->generatePassword(12); - } - - $statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[1]; - if($name === $check) { - $error = sprintf($this->lang['error_exists'], $name); - } - } - } - } - } - if(isset($error)) { - $response->error = $error; - } else { - if(file_exists($statfile)) { - unlink($statfile); - } - $this->resource->send_command($this->resource->ip, $command); - while (!file_exists($statfile)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - - - switch($this->deployment->type) { - case 'lvm-aoe-deployment': - // for lvm-aoe deployment we need to get the shelf + slot from get_root_identifiert - $ident_file = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.lv.lvm-aoe-deployment.ident'; - $get_ident_command = $this->openqrm->get('basedir').'/plugins/lvm-storage/bin/openqrm-lvm-storage post_identifier'; - $get_ident_command .= ' -t '.$this->deployment->type.' -v '.$this->volgroup; - $get_ident_command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $ident_file = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.lv.lvm-aoe-deployment.ident'; - if(file_exists($ident_file)) { - unlink($ident_file); - } - $this->resource->send_command($this->resource->ip, $get_ident_command); - while (!file_exists($ident_file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $ident_lines = explode("\n", file_get_contents($ident_file)); - if(count($ident_lines) >= 1) { - foreach($ident_lines as $ident_line) { - if($ident_line !== '') { - $ident_line = explode(',', $ident_line); - $ident_root_path = explode(':', $ident_line[1]); - $ident_check = $ident_root_path[1]; - if($name === $ident_check) { - $volume_path = $ident_line[1]; - $rootfstype = 'ext3'; - break; - } - } - } - } - break; - case 'lvm-nfs-deployment': - $volume_path = '/'.$this->volgroup.'/'.$name; - $rootfstype = 'nfs'; - break; - case 'lvm-iscsi-deployment': - $volume_path = $this->volgroup.':/dev/'.$name.'/1'; - $rootfstype = 'ext3'; - break; - } - - // get origin image object - $origin_image = new image(); - $origin_image->get_instance_by_name($this->lvol); - - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $name; - $image_fields['image_type'] = $deployment->type; - $image_fields['image_version'] = $origin_image->version; - $image_fields['image_size'] = $form->get_request('size'); - $image_fields['image_rootfstype'] = $rootfstype; - $image_fields['image_storageid'] = $storage->id; - $image_fields['image_comment'] = "Image Object for volume $name"; - $image_fields['image_rootdevice'] = $volume_path; - $image = new image(); - $image->add($image_fields); - - $response->msg = sprintf($this->lang['msg_snaped'], $this->lvol, $name); - // save image id in response for the wizard - $response->image_id = $image_fields["image_id"]; - } - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'snap'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['css'] = 'namegen'; - $d['name']['object']['attrib']['customattribs'] = 'data-prefix="lvm" data-length="6"'; - $d['name']['object']['attrib']['value'] = $this->lvol.'s'; - $d['name']['object']['attrib']['maxlength'] = 50; - - $d['size']['label'] = sprintf($this->lang['form_size'], number_format($this->max, 0, '', '')); - $d['size']['required'] = true; - $d['size']['validate']['regex'] = '/^[0-9]+$/i'; - $d['size']['validate']['errormsg'] = sprintf($this->lang['error_size'], '0-9'); - $d['size']['object']['type'] = 'htmlobject_input'; - $d['size']['object']['attrib']['name'] = 'size'; - $d['size']['object']['attrib']['type'] = 'text'; - $d['size']['object']['attrib']['value'] = ''; - $d['size']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - - //-------------------------------------------- - /** - * Set max - * - * @access protected - * @return bool - */ - //-------------------------------------------- - function set_max() { - $vgmax = ''; - $lvmax = ''; - $statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.'.$this->volgroup.'.lv.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[1] === $this->lvol) { - $lvmax = str_replace('.', '', $line[4]); - $lvmax = str_replace('m', '', $lvmax); - $lvmax = (int)$lvmax / 100; - } - } - } - } - } - $statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.vg.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[0] === $this->volgroup) { - $vgmax = str_replace('.', '', $line[6]); - $vgmax = str_replace('m', '', $vgmax); - $vgmax = (int)$vgmax / 100; - } - } - } - } - } - - if( $vgmax < $lvmax ) { - $max = $vgmax; - } else { - $max = $lvmax; - } - $this->max = $max; - return true; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.volgroup.class.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.volgroup.class.php deleted file mode 100644 index 26e7f23..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/class/lvm-storage.volgroup.class.php +++ /dev/null @@ -1,362 +0,0 @@ - - */ - -class lvm_storage_volgroup -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'lvm_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "lvm_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'lvm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'lvm_identifier'; -/** -* identifier name -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->volgroup = $this->response->html->request()->get('volgroup'); - } - - //-------------------------------------------- - /** - * Init - * - * @access public - */ - //-------------------------------------------- - function init() { - $storage_id = $this->response->html->request()->get('storage_id'); - if($storage_id === '') { - return false; - } - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $this->resource = $resource; - $this->storage = $storage; - $this->deployment = $deployment; - $this->response->add('storage_id', $storage_id); - $this->response->add('volgroup', $this->volgroup); - - $this->statfile = $this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$resource->id.'.'.$this->volgroup.'.lv.stat'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->init(); - $data = $this->edit(); - if($data !== false) { - $t = $this->response->html->template($this->tpldir.'/lvm-storage-volgroup.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($data); - $t->add($this->lang['lang_id'], 'lang_id'); - $t->add($this->lang['lang_name'], 'lang_name'); - $t->add($this->lang['lang_resource'], 'lang_resource'); - $t->add($this->lang['lang_deployment'], 'lang_deployment'); - $t->add($this->lang['lang_state'], 'lang_state'); - $t->add($this->lang['lang_attr'], 'lang_attr'); - $t->add($this->lang['lang_pv'], 'lang_pv'); - $t->add($this->lang['lang_size'], 'lang_size'); - $t->add(sprintf($this->lang['label'], $this->volgroup, $data['name']), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } else { - $msg = sprintf($this->lang['error_no_lvm'], $this->response->html->request()->get('storage_id')); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return array|false - */ - //-------------------------------------------- - function edit() { - if(strpos($this->deployment->type, 'lvm') !== false) { - $resource_icon_default="/img/resource.png"; - $storage_icon="/plugins/lvm-storage/img/plugin.png"; - $state_icon = ''.$this->resource->state.''; - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default=$storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - - // Storage info - $d['state'] = $state_icon; - // $d['icon'] = ""; - $d['resource'] = $this->resource->id.' / '.$this->resource->ip; - $d['name'] = $this->storage->name; - $d['deployment'] = $this->deployment->type; - $d['id'] = $this->storage->id; - - // Volgroup info - $lines = explode("\n", file_get_contents($this->openqrm->get('basedir').'/plugins/lvm-storage/web/storage/'.$this->resource->id.'.vg.stat')); - foreach($lines as $line) { - $line = explode("@", $line); - if(isset($line[0]) && $line[0] === $this->volgroup) { - $vsize = number_format(substr($line[5], 0, strpos($line[5], '.')), 0, '', '').' MB'; - $vfree = str_replace('m', '', $line[6]); - if($vfree !== '0') { - $vfree = substr($line[6], 0, strpos($line[6], '.')); - } - $d['volgroup_name'] = $line[0]; - $d['volgroup_pv'] = $line[1]; - $d['volgroup_lv'] = $line[2]; - $d['volgroup_sn'] = $line[3]; - $d['volgroup_attr'] = $line[4]; - $d['volgroup_vsize'] = $vsize; - $d['volgroup_vfree'] = number_format($vfree, 0, '', '').' MB'; - } - } - - $a = ' '; - if($d['volgroup_vfree'] !== '0 MB') { - $a = $this->response->html->a(); - $a->label = $this->lang['action_add']; - $a->css = 'add'; - $a->href = $this->response->get_url($this->actions_name, "add"); - } - $d['add'] = $a; - - $body = array(); - - $file = $this->statfile; - if(file_exists($file)) { - $lines = explode("\n", file_get_contents($file)); - if(count($lines) >= 1) { - $disabled = array(); - $t = $this->response->html->template($this->openqrm->get('webdir').'/js/openqrm-progressbar.js'); - foreach($lines as $line) { - if($line !== '') { - $s = ' '; - $c = ' '; - $r = ' '; - $src = ' '; - $line = explode('@', $line); - $name = $line[1]; - $mode = substr($line[3], 0, 1); - if ($line[4] == "clone_in_progress") { - // add to disabled identifier - $disabled[] = $name; - // progressbar - $t->add(uniqid('b'), 'id'); - $t->add($this->openqrm->get('baseurl').'/api.php?action=plugin&plugin=lvm-storage&lvm_storage_action=progress&name='.$this->resource->id.'.lvm.'.$name.'.sync_progress', 'url'); - $t->add($this->lang['action_clone_in_progress'], 'lang_in_progress'); - $t->add($this->lang['action_clone_finished'], 'lang_finished'); - $volume_size = $t->get_string(); - } else if ($line[4] == "sync_in_progress") { - $volume_size = $this->lang['action_sync_in_progress']; - $disabled[] = $name; - } else { - $volume_size = number_format(substr($line[4], 0, strpos($line[4], '.')), 0, '', '').' MB'; - $image_add_remove = ''; - $deployment_type = ''; - $image = new image(); - $image->get_instance_by_name($name); - if (strlen($image->id)) { - if( $image->type == $this->deployment->type ) { - if( $line[0] === $this->deployment->type ) { - if($d['volgroup_vfree'] !== '0 MB' ) { - if($mode !== 's') { - $s = $this->response->html->a(); - $s->title = $this->lang['action_snap']; - $s->label = $this->lang['action_snap']; - $s->handler = 'onclick="wait();"'; - $s->css = 'snap'; - $s->href = $this->response->get_url($this->actions_name, "snap").'&lvol='.$line[1]; - } else { - $disabled[] = $line[5]; - $src = $line[5]; - } - if($vfree >= (int)substr($line[4], 0, strpos($line[4], '.'))) { - $c = $this->response->html->a(); - $c->title = $this->lang['action_clone']; - $c->label = $this->lang['action_clone']; - $c->handler = 'onclick="wait();"'; - $c->css = 'clone'; - $c->href = $this->response->get_url($this->actions_name, "clone").'&lvol='.$line[1]; - } - } - $r = $this->response->html->a(); - $r->title = $this->lang['action_resize']; - $r->label = $this->lang['action_resize']; - $r->handler = 'onclick="wait();"'; - $r->css = 'resize'; - $r->href = $this->response->get_url($this->actions_name, "resize").'&lvol='.$line[1]; - $deployment_type = $this->deployment->type; - } else { - $disabled[] = $name; - } - } - } - // create/remove image object, check if image exists - if (strlen($image->id)) { - if( $image->type != $this->deployment->type ) { - $deployment_type = $image->type; - $disabled[] = $name; - } else { - $i = $this->response->html->a(); - $i->title = $this->lang['action_remove_image']; - $i->label = $this->lang['action_remove_image']; - $i->handler = 'onclick="wait();"'; - $i->css = 'remove'; - $i->href = $this->response->get_url($this->actions_name, "image").'&image_id='.$image->id.'&image_command=remove'; - $image_add_remove = $i; - } - } else { - $i = $this->response->html->a(); - $i->title = $this->lang['action_add_image']; - $i->label = $this->lang['action_add_image']; - $i->handler = 'onclick="wait();"'; - $i->css = 'add'; - if($this->deployment->type === 'lvm-iscsi-deployment') { - $image_root_device = $this->volgroup.':/dev/'.$name.'/1'; - $i->href = $this->response->get_url($this->actions_name, "image").'&root_device='.$image_root_device.'&image_name='.$name.'&image_command=add'; - } else if($d['deployment'] === 'lvm-aoe-deployment') { - $i->href = $this->response->get_url($this->actions_name, "image").'&root_device='.$name.'&image_name='.$name.'&image_command=add'; - } else if($d['deployment'] === 'lvm-nfs-deployment') { - $image_root_device = '/'.$this->volgroup.'/'.$name; - $i->href = $this->response->get_url($this->actions_name, "image").'&root_device='.$image_root_device.'&image_name='.$name.'&image_command=add'; - } - $disabled[] = $name; - $image_add_remove = $i; - } - } - - $body[] = array( - //'icon' => $d['icon'], - 'deploy' => $deployment_type, - 'name' => $name, - 'attr' => $line[3], - 'source' => $src, - 'size' => $volume_size, - 'image' => $image_add_remove, - 'snap' => $s, - 'clone' => $c, - 'resize' => $r, - ); - } - } - } - } - -/* - $h['icon']['title'] = ' '; - $h['icon']['sortable'] = false; -*/ - $h['name']['title'] = $this->lang['table_name']; - $h['deploy']['title'] = $this->lang['table_deployment']; - $h['attr']['title'] = $this->lang['table_attr']; - $h['source']['title'] = $this->lang['table_source']; - $h['size']['title'] = $this->lang['table_size']; - $h['image']['title'] = ' '; - $h['image']['sortable'] = false; - $h['snap']['title'] = ' '; - $h['snap']['sortable'] = false; - $h['clone']['title'] = ' '; - $h['clone']['sortable'] = false; - $h['resize']['title'] = ' '; - $h['resize']['sortable'] = false; - - $table = $this->response->html->tablebuilder('lvm_lvols', $this->response->get_array($this->actions_name, 'volgroup')); - $table->sort = 'name'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = count($body); - $table->autosort = true; - $table->sort_link = false; - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $body; - $table->identifier = 'name'; - $table->identifier_name = $this->identifier_name; - $table->identifier_disabled = $disabled; - $table->actions_name = $this->actions_name; - $table->actions = array(array('remove' => $this->lang['action_remove'])); - - $d['table'] = $table->get_string(); - return $d; - } else { - return false; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/css/lvm-storage.css b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/css/lvm-storage.css deleted file mode 100644 index e69de29..0000000 diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.custom-iscsi-deployment.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.custom-iscsi-deployment.php deleted file mode 100644 index ef5ae93..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.custom-iscsi-deployment.php +++ /dev/null @@ -1,83 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - - -function custom_iscsi_deployment_wait_for_identfile($sfile) { - $refresh_delay=1; - $refresh_loop_max=20; - $refresh_loop=0; - while (!file_exists($sfile)) { - sleep($refresh_delay); - $refresh_loop++; - flush(); - if ($refresh_loop > $refresh_loop_max) { - return false; - } - } - return true; -} - - -function get_custom_iscsi_deployment_image_rootdevice_identifier($custom_iscsi_storage_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - - // place for the storage stat files - $StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/lvm-storage/storage'; - $rootdevice_identifier_array = array(); - return $rootdevice_identifier_array; -} - -function get_custom_iscsi_deployment_image_default_rootfs() { - return "ext3"; -} - - -function get_custom_iscsi_deployment_rootfs_transfer_methods() { - return true; -} - -function get_custom_iscsi_deployment_rootfs_set_password_method() { - return true; -} - -function get_custom_iscsi_deployment_is_network_deployment() { - return true; -} - -function get_custom_iscsi_deployment_local_deployment_enabled() { - return false; -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.custom-nfs-deployment.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.custom-nfs-deployment.php deleted file mode 100644 index 31a1321..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.custom-nfs-deployment.php +++ /dev/null @@ -1,85 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - -function custom_nfs_deployment_wait_for_identfile($sfile) { - $refresh_delay=1; - $refresh_loop_max=20; - $refresh_loop=0; - while (!file_exists($sfile)) { - sleep($refresh_delay); - $refresh_loop++; - flush(); - if ($refresh_loop > $refresh_loop_max) { - return false; - } - } - return true; -} - - -function get_custom_nfs_deployment_image_rootdevice_identifier($custom_nfs_storage_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - - // place for the storage stat files - $rootdevice_identifier_array = array(); - return $rootdevice_identifier_array; -} - -function get_custom_nfs_deployment_image_default_rootfs() { - return "nfs"; -} - - -function get_custom_nfs_deployment_rootfs_transfer_methods() { - return true; -} - -function get_custom_nfs_deployment_rootfs_set_password_method() { - return true; -} - -function get_custom_nfs_deployment_is_network_deployment() { - return true; -} - -function get_custom_nfs_deployment_local_deployment_enabled() { - return false; -} - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.lvm-aoe-deployment.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.lvm-aoe-deployment.php deleted file mode 100644 index 51c7410..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.lvm-aoe-deployment.php +++ /dev/null @@ -1,107 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - - -function lvm_aoe_deployment_wait_for_identfile($sfile) { - $refresh_delay=1; - $refresh_loop_max=20; - $refresh_loop=0; - while (!file_exists($sfile)) { - sleep($refresh_delay); - $refresh_loop++; - flush(); - if ($refresh_loop > $refresh_loop_max) { - return false; - } - } - return true; -} - - -function get_lvm_aoe_deployment_image_rootdevice_identifier($lvm_aoe_storage_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - - // place for the storage stat files - $StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/lvm-storage/storage'; - $rootdevice_identifier_array = array(); - $storage = new storage(); - $storage->get_instance_by_id($lvm_aoe_storage_id); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_resource_id = $storage_resource->id; - $ident_file = "$StorageDir/$storage_resource_id.lv.lvm-aoe-deployment.ident"; - if (file_exists($ident_file)) { - unlink($ident_file); - } - // send command - $resource_command="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage post_identifier -t lvm-aoe-deployment -u $OPENQRM_ADMIN->name -p $OPENQRM_ADMIN->password"; - $storage_resource->send_command($storage_resource->ip, $resource_command); - if (!lvm_aoe_deployment_wait_for_identfile($ident_file)) { - $event->log("get_image_rootdevice_identifier", $_SERVER['REQUEST_TIME'], 2, "image.lvm-aoe-deployment", "Timeout while requesting image identifier from storage id $storage->id", "", "", 0, 0, 0); - return; - } - $fcontent = file($ident_file); - foreach($fcontent as $lun_info) { - $tpos = strpos($lun_info, ","); - $timage_name = trim(substr($lun_info, 0, $tpos)); - $troot_device = trim(substr($lun_info, $tpos+1)); - $rootdevice_identifier_array[] = array("value" => "$troot_device", "label" => "$timage_name"); - } - return $rootdevice_identifier_array; -} - - -function get_lvm_aoe_deployment_image_default_rootfs() { - return "ext3"; -} - - -function get_lvm_aoe_deployment_rootfs_transfer_methods() { - return true; -} - -function get_lvm_aoe_deployment_rootfs_set_password_method() { - return true; -} - -function get_lvm_aoe_deployment_is_network_deployment() { - return true; -} - -function get_lvm_aoe_deployment_local_deployment_enabled() { - return false; -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.lvm-iscsi-deployment.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.lvm-iscsi-deployment.php deleted file mode 100644 index 511d824..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.lvm-iscsi-deployment.php +++ /dev/null @@ -1,110 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - - -function lvm_iscsi_deployment_wait_for_identfile($sfile) { - $refresh_delay=1; - $refresh_loop_max=20; - $refresh_loop=0; - while (!file_exists($sfile)) { - sleep($refresh_delay); - $refresh_loop++; - flush(); - if ($refresh_loop > $refresh_loop_max) { - return false; - } - } - return true; -} - - -function get_lvm_iscsi_deployment_image_rootdevice_identifier($lvm_iscsi_storage_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - - // place for the storage stat files - $StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/lvm-storage/storage'; - $rootdevice_identifier_array = array(); - $storage = new storage(); - $storage->get_instance_by_id($lvm_iscsi_storage_id); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_resource_id = $storage_resource->id; - $ident_file = "$StorageDir/$storage_resource_id.lv.lvm-iscsi-deployment.ident"; - if (file_exists($ident_file)) { - unlink($ident_file); - } - // send command - $resource_command="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage post_identifier -t lvm-iscsi-deployment -u $OPENQRM_ADMIN->name -p $OPENQRM_ADMIN->password"; - $storage_resource->send_command($storage_resource->ip, $resource_command); - if (!lvm_iscsi_deployment_wait_for_identfile($ident_file)) { - $event->log("get_image_rootdevice_identifier", $_SERVER['REQUEST_TIME'], 2, "image.lvm-iscsi-deployment", "Timeout while requesting image identifier from storage id $storage->id", "", "", 0, 0, 0); - return; - } - $fcontent = file($ident_file); - foreach($fcontent as $lun_info) { - $tpos = strpos($lun_info, ","); - $timage_name = trim(substr($lun_info, 0, $tpos)); - $troot_device = trim(substr($lun_info, $tpos+1)); - $rootdevice_identifier_array[] = array("value" => "$troot_device", "label" => "$timage_name"); - } - return $rootdevice_identifier_array; -} - -function get_lvm_iscsi_deployment_image_default_rootfs() { - return "ext3"; -} - - -function get_lvm_iscsi_deployment_rootfs_transfer_methods() { - return true; -} - -function get_lvm_iscsi_deployment_rootfs_set_password_method() { - return true; -} - -function get_lvm_iscsi_deployment_is_network_deployment() { - return true; -} - -function get_lvm_iscsi_deployment_local_deployment_enabled() { - return false; -} - -function get_lvm_iscsi_deployment_is_resizable() { - return true; -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.lvm-nfs-deployment.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.lvm-nfs-deployment.php deleted file mode 100644 index 1fcdffd..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/image.lvm-nfs-deployment.php +++ /dev/null @@ -1,110 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - -function lvm_nfs_deployment_wait_for_identfile($sfile) { - $refresh_delay=1; - $refresh_loop_max=20; - $refresh_loop=0; - while (!file_exists($sfile)) { - sleep($refresh_delay); - $refresh_loop++; - flush(); - if ($refresh_loop > $refresh_loop_max) { - return false; - } - } - return true; -} - - -function get_lvm_nfs_deployment_image_rootdevice_identifier($lvm_nfs_storage_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - - // place for the storage stat files - $StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/lvm-storage/storage'; - $rootdevice_identifier_array = array(); - $storage = new storage(); - $storage->get_instance_by_id($lvm_nfs_storage_id); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_resource_id = $storage_resource->id; - $ident_file = "$StorageDir/$storage_resource_id.lv.lvm-nfs-deployment.ident"; - if (file_exists($ident_file)) { - unlink($ident_file); - } - // send command - $resource_command="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage post_identifier -t lvm-nfs-deployment -u $OPENQRM_ADMIN->name -p $OPENQRM_ADMIN->password"; - $storage_resource->send_command($storage_resource->ip, $resource_command); - if (!lvm_nfs_deployment_wait_for_identfile($ident_file)) { - $event->log("get_image_rootdevice_identifier", $_SERVER['REQUEST_TIME'], 2, "image.lvm-nfs-deployment", "Timeout while requesting image identifier from storage id $storage->id", "", "", 0, 0, 0); - return; - } - $fcontent = file($ident_file); - foreach($fcontent as $lun_info) { - $tpos = strpos($lun_info, ","); - $timage_name = trim(substr($lun_info, 0, $tpos)); - $troot_device = trim(substr($lun_info, $tpos+1)); - $rootdevice_identifier_array[] = array("value" => "$troot_device", "label" => "$timage_name"); - } - return $rootdevice_identifier_array; -} - -function get_lvm_nfs_deployment_image_default_rootfs() { - return "nfs"; -} - - -function get_lvm_nfs_deployment_rootfs_transfer_methods() { - return true; -} - -function get_lvm_nfs_deployment_rootfs_set_password_method() { - return true; -} - -function get_lvm_nfs_deployment_is_network_deployment() { - return true; -} - -function get_lvm_nfs_deployment_local_deployment_enabled() { - return false; -} - -function get_lvm_nfs_deployment_is_resizable() { - return true; -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/img/plugin.png deleted file mode 100644 index 002a7e9..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lang/de.lvm-storage-about.ini b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lang/de.lvm-storage-about.ini deleted file mode 100644 index 2d1e835..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lang/de.lvm-storage-about.ini +++ /dev/null @@ -1,58 +0,0 @@ -[documentation] -tab = "Über LVM-Storage" -label = "Über LVM-Storage" -introduction_title = "Einleitung" -introduction_content = "Das "LVM-Storage" Plugin integriert Standard Linux Systeme als LVM Storage Server - NFS/iSCSI/AOE. - Das "LVM-Storage" Plugin transformiert eine Standard Linux-box in einen "rapid-fast-cloning" Storage Server - mit unterstützung für "snap-shotting" für NFS-, Aoe-, and iSCSI Volumes. - Die Snapshots (Klone von einem "golden server image") sind direkt verfügbar für weiteres Deployment - und sparen Speicherplatz da nur das "Delta" zu dem Original Volume gespeichert wird." -requirements_title = "Anforderungen" -requirements_list = "
    • Eine 'Resource' für die LVM-Storage Storage
      (dies kann ein System sein das mittels des "local-server" Plugin in openQRM eingebunden ist oder der openQRM Server selber)
    • -
    • Eine (oder mehere) LVM Volume Gruppen mit freiem Speicherplatz dediziert für die LVM Volumes
    • -
    • Die folgenden Paket werden benötigt: nfs-common, nfs-kernel-server, screen, rsync, vblade, aoetools, iscsitarget, open-iscsi
    " - -tested_title = "Getestet mit" -tested_content = "Diese Plugin ist getestet mit Debian, Ubuntu und CentOS" - -provides_title = "Bietet" -provides_list = "
    • Storage-Typen: 'Lvm Storage Server (Aoe/Nfs/Iscsi)'
    • -
    • Deployment-Typen: 'Lvm Aoe/Nfs/Iscsi-root deployment'
    " -type_title = "Plugin-Typ" -type_content = "Storage" - -deployment_title = "Deployment-Typ" -deployment_content = "Netzwerk-Deployment" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" -network_deploymet = "Netzwerk-Deployment" -doc1 = "" - - -[bootservice] -tab = "Boot-Service" -label = "LVM-Storage Boot-Service" -boot_service_title = "Information" -boot_service_content = "Das LVM-Storage Plugin beinhaltet einen openQRM Boot-Service. - Dieser 'LVM-Storage Boot-Service' wird automatisch von allen in openQRM integrierten Systeme heruntergeladen und ausgeführt. - Der Boot-Service befindet sich unter:
    -
    /usr/share/openqrm/plugins/lvm-storage/web/boot-service-lvm-storage.tgz
    -
    - Der 'LVM-Storage Boot-Service' beinhaltet die 'Client' Dateien des LVM-Storage Plugin. Eine Konfigurationsdatei für den LVM-Storage Server ist ebenfalls enhalten.
    -
    - Die Boot-Service konfiguration wird mittels des 'openqrm' Kommandozeilenwerkzeugs verwaltet. Der folgende Befehl zeigt die die momentane 'default' Boot-Service Konfiguration an:
    -
    /usr/share/openqrm/bin/openqrm boot-service view -n lvm-storage -a default
    -
    - Die Boot-Service Konfiguration eines speziellen Server zeigt der folgende Befehl an:
    -
    /usr/share/openqrm/bin/openqrm boot-service view -n lvm-storage -a [Server-name]
    -
    - Der folgende Befehl passt einen Konfigurationparameter des 'default' Boot-Service an:
    -
    /usr/share/openqrm/bin/openqrm boot-service configure -n lvm-storage -a default -k [key] -v [value]
    -
    - Die Boot-Service Konfigurarationsparameter eines speziellen Server passt der folgende Befehl an:
    -
    /usr/share/openqrm/bin/openqrm boot-service configure -n lvm-storage -a [Server-name] -k [key] -v [value]
    -
    - Im Falle das der openmQRM Server selber als LVM-Storage genutzt wird werden die Konfigurationsparameter in der folgenden Datei manuell angeepasst:
    -
    /usr/share/openqrm/plugins/lvm-storage/etc/openqrm-plugin-lvm-storage.conf
    " - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lang/de.lvm-storage.ini b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lang/de.lvm-storage.ini deleted file mode 100644 index a4f8cf6..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lang/de.lvm-storage.ini +++ /dev/null @@ -1,143 +0,0 @@ -[select] -tab = "Lvm-storage auswählen" -label = "Lvm-storage auswählen" -action_edit = "bearbeiten" -table_name = "Name" -table_id = "Id" -table_recource = "Resource" -table_type = "Type" -table_deployment = "Deployment" -error_no_storage = "Keine Storage angelegt!

    Bitte legen Sie erst eine lvm Storage an!" -new_storage = "Neue Storage" -please_wait = "Lade Volume groups. Bitte warten .." -[edit] -tab = "LVM Volume group auswählen" -label = "LVM Volume group auf storage %s auswählen" -lang_id = "ID" -lang_name = "Name" -lang_resource = "Resource" -lang_state = "Status" -lang_deployment = "Deployment" -action_edit = "bearbeiten" -action_add ="Neue Volume Group erstellen" -action_remove ="entfernen" -table_name = "Name" -table_pv = "PV" -table_lv = "LV" -table_sn = "SN" -table_attr = "Attr" -table_vsize = "Vsize" -table_vfree = "VFree" -error_no_lvm = "Die Storage %s ist nicht vom Typ lvm-storage" -please_wait = "Lade Volume group. Bitte warten .." -[addvg] -tab = "Volume Group erstellen" -label = "Volume Group auf storage %s erstellen" -partition = "Partition" -name = "Name" -extend = "Partition erweitern" -confirm_text = "Alle Daten auf %s werden gelöscht.
    Wirklich fortsetzen?" -msg_added = "Volume Group %s erfolgreich erstellt" -please_wait = "Lade Volume group. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[removevg] -tab = "Volume Group entfernen" -label = "Volume Group auf storage %s entfernen" -confirm_text = "Wollen Sie die Volume Group %s wirlich entfernen?" -msg_removed = "Volume Group %s erfolgreich entfernt" -please_wait = "Lade Volume group. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[volgroup] -tab = "LVM Volume group bearbeiten" -label = "LVM Volume group %s auf storage %s bearbeiten" -lang_id = "ID" -lang_name = "Name" -lang_deployment = "Deployment" -lang_resource = "Resource" -lang_state = "Status" -lang_attr = "Attr" -lang_pv = "PV / LV / SN" -lang_size = "Vsize / Vfree" -action_add = "Neues Logical Volume hinzufügen" -action_remove = "löschen" -action_resize = "Größe ändern" -action_snap = "snap" -action_clone = "klonen" -action_add_image = "Image hinzufügen" -action_remove_image = "Image entfernen" -action_sync_in_progress = "Synchronisation läuft - Bitte warten" -action_clone_in_progress = "Synchronisation läuft - Bitte warten" -action_clone_finished = "Syncronisation beendet" -table_name = "Lvol" -table_deployment = "Deployment" -table_attr = "Attr" -table_size = "Size" -table_source = "Source" -error_no_lvm = "Storage %s ist nicht vom Typ lvm-deployment" -please_wait = "Lade Volume group. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[add] -tab = "Logical Volume hinzufügen" -label = "Logical Volume zu LVM Volume group %s hinzufügen" -form_name = "Name" -form_size = "Größe (max: %s MB)" -msg_added = "Logical Volume %s hinzugefügt" -msg_add_failed = "Fehler beim anlegen des Volumes %s" -error_exists = "Logical Volume %s besteht bereits" -error_name = "Name darf nur %s beinhalten" -error_size = "Größe darf nur %s beinhalten" -error_size_exeeded = "Größe überschreitet %s MB" -please_wait = "Füge Logical Volume hinzu. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -lang_name_generate = "Name generieren" -[image] -label = "Image für Logical Volume %s hinzufügen/entfernen" -tab = "Image hinzufügen/entfernen" -error_exists = "Image %s existiert bereits" -error_image_still_in_use = "Image ID %s ist noch in benutztung von Server %s" -msg_added_image = "Image %s hinzugefügt" -msg_removed_image = "Image id %s entfernt" -msg_add_failed = "Fehler beim anlegen des Image %s" -please_wait = "Bitt warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[snap] -label = "Snap Logical Volume %s" -tab = "Snap Logical Volume" -msg_snaped = "Snaped %s to %s" -msg_snap_failed = "Fehler beim clonen des Volumes %s" -form_name = "Name" -lang_name_generate = "Name generieren" -form_size = "Größe (max: %s MB)" -error_exists = "Logical Volume %s besteht bereits" -error_name = "Name darf nur %s beinhalten" -error_size = "Größe darf nur %s beinhalten" -error_size_exeeded = "Größe überschreitet %s MB" -please_wait = "Snaping Logical Volume. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[clone] -label = "Logical Volume %s klonen" -tab = "Logical Volume klonen" -msg_cloned = "%s als %s geklont" -msg_clone_failed = "Fehler beim clonen des Volumes %s" -form_name = "Name" -lang_name_generate = "Name generieren" -error_exists = "Logical Volume %s besteht bereits" -error_name = "Name darf nur %s beinhalten" -please_wait = "Klone Logical Volume. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[remove] -label = "Logical Volume(s) löschen" -msg_removed = "Logical Volume %s wurde gelöscht" -msg_image_still_in_use = "Das Volume %s des Image ID %s ist noch in benutztung von Server %s" -please_wait = "Lösche Logical Volume(s). Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[resize] -label = "Logical Volume %s Größe ändern" -tab = "Logical Volume Größe ändern" -size = "min. %s MB, max. %s MB" -error_size = "Größe darf nur %s beinhalten" -error_size_exeeded = "Größe überschreitet %s MB" -error_size_undercut = "Größe unterschreitet %s MB" -msg_resized = "Logical Volume %s Größe geändert" -please_wait = "Logical Volume Größe ändern. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lang/en.lvm-storage-about.ini b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lang/en.lvm-storage-about.ini deleted file mode 100644 index b2ca065..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lang/en.lvm-storage-about.ini +++ /dev/null @@ -1,59 +0,0 @@ -[documentation] -tab = "About LVM-Storage" -label = "About LVM-Storage" -introduction_title = "Introduction" -introduction_content = "The 'LVM-Storage' plugin integrate standard Linux Systems as LVM Storage server - NFS/iSCSI/AOE. - The 'LVM-Storage' plugin transforms a standard Linux-box into a rapid-fast-cloning storage-server - supporting snap-shotting for NFS-, Aoe-, and Iscsi-filesystem-images. - The snapshots (clones from a 'golden server image') are immediatly available for deployment and - saving space on the storage-subsystem because just the delta of the server image is being stored. - " -requirements_title = "Requirements" -requirements_list = "
    • A resource for the LVM-Storage Storage (this can be a remote system integrated into openQRM e.g. via the 'local-server' plugin or the openQRM server itself)
    • -
    • One (or more) lvm volume group(s) with free space dedicated for the LVM-Storage Volumes
    • -
    • The following packages must be installed: nfs-common, nfs-kernel-server, screen, rsync, vblade, aoetools, iscsitarget, open-iscsi
    " - -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions." - -provides_title = "Provides" -provides_list = "
    • Storage type: 'Lvm Storage Server (Aoe/Nfs/Iscsi)'
    • -
    • Deployment types: 'Lvm Aoe/Nfs/Iscsi-root deployment'
    " -type_title = "Plugin type" -type_content = "Storage" - -deployment_title = "Deployment type" -deployment_content = "Network deployment" - -documentation_title = "Documentation" -use_case_title = "Use case" -network_deploymet = "Network deployment" -doc1 = "" - - -[bootservice] -tab = "Boot-Service" -label = "LVM-Storage Boot-Service" -boot_service_title = "Information" -boot_service_content = "The LVM-Storage Plugin provides an openQRM Boot-Service. - This 'LVM-Storage Boot-Service' is automatically downloaded and executed by the openQRM-Client on all integrated Systems. - The Boot-Service is located at:
    -
    /usr/share/openqrm/plugins/lvm-storage/web/boot-service-lvm-storage.tgz
    -
    - The 'LVM-Storage Boot-Service contains the Client files of the LVM-Storage Plugin. Also a configuration file for the LVM-Storage server is included in this Boot-Service.
    -
    - The Boot-Service configuration can be viewed and administrated by the 'openqrm' utility. To view the current default Boot-Service configuration run:
    -
    /usr/share/openqrm/bin/openqrm boot-service view -n lvm-storage -a default
    -
    - To view a Boot-Service configuration of a specific Server run:
    -
    /usr/share/openqrm/bin/openqrm boot-service view -n lvm-storage -a [Server-name]
    -
    - To adapt a parameter in the current default Boot-Service configuration run:
    -
    /usr/share/openqrm/bin/openqrm boot-service configure -n lvm-storage -a default -k [key] -v [value]
    -
    - To adapt a paramter in the Boot-Service configuration of a specific Server run:
    -
    /usr/share/openqrm/bin/openqrm boot-service configure -n lvm-storage -a [Server-name] -k [key] -v [value]
    -
    - In case the openmQRM Server itself is used as the LVM-Storage Storage please edit:
    -
    /usr/share/openqrm/plugins/lvm-storage/etc/openqrm-plugin-lvm-storage.conf
    - and set the configuration keys." diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lang/en.lvm-storage.ini b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lang/en.lvm-storage.ini deleted file mode 100644 index 5167325..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lang/en.lvm-storage.ini +++ /dev/null @@ -1,143 +0,0 @@ -[select] -tab = "Select lvm-storage" -label = "Select lvm-storage" -action_edit = "edit" -table_name = "Name" -table_id = "Id" -table_recource = "Resource" -table_type = "Type" -table_deployment = "Deployment" -error_no_storage = "No storage configured yet!

    Please create a lvm Storage first!" -new_storage = "New Storage" -please_wait = "Loading Volume groups. Please wait .." -[edit] -tab = "Select LVM Volume group" -label = "Select LVM Volume group on storage %s" -lang_id = "ID" -lang_name = "Name" -lang_resource = "Resource" -lang_state = "State" -lang_deployment = "Deployment" -action_edit = "select" -action_add ="Add new Volume Group" -action_remove ="remove" -table_name = "Name" -table_pv = "PV" -table_lv = "LV" -table_sn = "SN" -table_attr = "Attr" -table_vsize = "Vsize" -table_vfree = "VFree" -error_no_lvm = "Storage %s is not of type lvm-storage" -please_wait = "Loading Volume group. Please wait .." -[addvg] -tab = "Add Volume Group" -label = "Add Volume Group to storage %s" -partition = "Partition" -name = "Name" -extend = "extend partition" -confirm_text = "All Data on %s will be erased.
    Are you sure to continue?" -msg_added = "Successfully added Volume Group %s" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." -[removevg] -tab = "Remove Volume Group" -label = "Remove Volume Group on storage %s" -confirm_text = "Do you realy want to remove Volume Group %s?" -msg_removed = "Successfully removed Volume Group %s" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." -[volgroup] -tab = "Edit LVM Volume group" -label = "Edit LVM Volume group %s on storage %s" -lang_id = "ID" -lang_name = "Name" -lang_deployment = "Deployment" -lang_resource = "Resource" -lang_state = "State" -lang_attr = "Attr" -lang_pv = "PV / LV / SN" -lang_size = "Vsize / Vfree" -action_add = "Add new logical volume" -action_remove = "remove" -action_resize = "resize" -action_snap = "snap" -action_clone = "clone" -action_add_image = "Add Image" -action_remove_image = "Remove Image" -action_sync_in_progress = "Source of synchronisation - Please wait" -action_clone_in_progress = "Synchronisation in progress - Please wait" -action_clone_finished = "Syncronisation finished!" -table_name = "Lvol" -table_deployment = "Deployment" -table_attr = "Attr" -table_size = "Size" -table_source = "Source" -error_no_lvm = "Storage %s is not of type lvm-deployment" -please_wait = "Loading Volume group. Please wait .." -canceled = "Operation canceled. Please wait .." -[add] -tab = "Add Logical Volume" -label = "Add Logical Volume to LVM Volume group %s" -form_name = "Name" -form_size = "Size (max: %s MB)" -msg_added = "Added Logical Volume %s" -msg_add_failed = "Failed to add Volume %s" -error_exists = "Logical Volume %s allready exists" -error_name = "Name must be %s" -error_size = "Size must be %s" -error_size_exeeded = "Size exeeds %s MB" -please_wait = "Adding Logical Volume. Please wait .." -canceled = "Operation canceled. Please wait .." -lang_name_generate = "generate name" -[image] -label = "Add/Remove Image for Logical Volume %s" -tab = "Add/Remove Image" -error_exists = "Image %s allready exists" -error_image_still_in_use = "Image id %s is still in use by Server(s) %s" -msg_added_image = "Added Image %s" -msg_removed_image = "Removed Image id %s" -msg_add_failed = "Failed to add Image id %s" -please_wait = "Please wait .." -canceled = "Operation canceled. Please wait .." -[snap] -label = "Snap Logical Volume %s" -tab = "Snap Logical Volume" -msg_snaped = "Snaped %s to %s" -msg_snap_failed = "Failed to clone Volume %s" -form_name = "Name" -lang_name_generate = "generate name" -form_size = "Size (max: %s MB)" -error_exists = "Volume %s allready exists" -error_name = "Name must be %s" -error_size = "Size must be %s" -error_size_exeeded = "Size exeeds %s MB" -please_wait = "Snaping Logical Volume. Please wait .." -canceled = "Operation canceled. Please wait .." -[clone] -label = "Clone Logical Volume %s" -tab = "Clone Logical Volume" -msg_cloned = "Cloned %s as %s" -msg_clone_failed = "Failed to clone Volume %s" -form_name = "Name" -lang_name_generate = "generate name" -error_exists = "Volume %s allready exists" -error_name = "Name must be %s" -please_wait = "Cloning Logical Volume. Please wait .." -canceled = "Operation canceled. Please wait .." -[remove] -label = "Remove Logical Volume(s)" -msg_removed = "Removed Logical Volume %s" -msg_image_still_in_use = "Volume %s of Image id %s is still in use by Server %s" -please_wait = "Removing Logical Volume(s). Please wait .." -canceled = "Operation canceled. Please wait .." -[resize] -label = "Resize Logical Volume %s" -tab = "Resize Logical Volume" -size = "min. %s MB, max. %s MB" -error_size = "Size must be %s" -error_size_exeeded = "Size exeeds %s MB" -error_size_undercut = "Size undercuts %s MB" -msg_resized = "Resized Logical Volume %s" -please_wait = "Resizing Logical Volume. Please wait .." -canceled = "Operation canceled. Please wait .." diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lvm-storage-action.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lvm-storage-action.php deleted file mode 100644 index 080c07b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/lvm-storage-action.php +++ /dev/null @@ -1,149 +0,0 @@ - -*/ - - - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/authblocker.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -// filter inputs -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; - -global $IMAGE_INFO_TABLE; -global $DEPLOYMENT_INFO_TABLE; -global $OPENQRM_SERVER_BASE_DIR; - -$lvm_storage_command = $request->get('lvm_storage_command'); -$lvm_image_name = $request->get('lvm_image_name'); - -// place for the storage stat files -$StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/lvm-storage/storage'; -// global event for logging -$event = new event(); - -// user/role authentication -if ($OPENQRM_USER->role != "administrator") { - $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "lvm-action", "Un-Authorized access to lvm-actions from $OPENQRM_USER->name", "", "", 0, 0, 0); - exit(); -} - - -$event->log("$lvm_storage_command", $_SERVER['REQUEST_TIME'], 5, "lvm-storage-action", "Processing lvm-storage command $lvm_storage_command", "", "", 0, 0, 0); -switch ($lvm_storage_command) { - case 'get_storage': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'get_ident': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'clone_finished': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'get_sync_progress': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'get_sync_finished': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - sleep(5); - unlink($filename); - break; - - case 'auth_finished': - // remove storage-auth-blocker if existing - $authblocker = new authblocker(); - $authblocker->get_instance_by_image_name($lvm_image_name); - if (strlen($authblocker->id)) { - $event->log("$lvm_storage_command", $_SERVER['REQUEST_TIME'], 5, "lvm-storage-action", "Removing authblocker for image $lvm_image_name", "", "", 0, 0, 0); - $authblocker->remove($authblocker->id); - } - break; - - case 'set_image_size': - $lvm_image_name = $request->get('lvm_image_name'); - $lvm_image_size = $request->get('lvm_image_size'); - if($lvm_image_name !== '' && $lvm_image_size !== '') { - $lvm_image = new image(); - $lvm_image->get_instance_by_name($lvm_image_name); - if($lvm_image->id !== '') { - $lvm_image->update($lvm_image->id, array('image_size' => $lvm_image_size)); - $event->log("$lvm_storage_command", $_SERVER['REQUEST_TIME'], 5, "lvm-storage-action", "Set image size $lvm_image_size MB for image $lvm_image_name", "", "", 0, 0, 0); - } - } - break; - - default: - $event->log("$lvm_storage_command", $_SERVER['REQUEST_TIME'], 3, "lvm-storage-action", "No such lvm-storage command ($lvm_storage_command)", "", "", 0, 0, 0); - break; - - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/menu.txt deleted file mode 100644 index 8f7208e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/menu.txt +++ /dev/null @@ -1,23 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|Lvm-storage -...|Volume Admin|index.php?plugin=lvm-storage|Volume Admin -...|About|index.php?plugin=lvm-storage&controller=lvm-storage-about|How to use -...|Config|index.php?plugin=lvm-storage&controller=lvm-storage-about&lvm_storage_about_action=bootservice|LVM Storage Boot-Service diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-aoe-deployment-auth-hook.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-aoe-deployment-auth-hook.php deleted file mode 100644 index 74ae0f6..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-aoe-deployment-auth-hook.php +++ /dev/null @@ -1,336 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/image_authentication.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; - -/** - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - */ - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $IMAGE_AUTHENTICATION_TABLE; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - - - //-------------------------------------------------- - /** - * authenticates the storage volume for the appliance resource - * - * storage_auth_function("start", 2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_function($cmd, $appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $IMAGE_AUTHENTICATION_TABLE; - global $openqrm_server; - - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - // parse the rootdevice infos - $ident_separate=strpos($image_rootdevice, ":"); - $volume_group=substr($image_rootdevice, 0, $ident_separate); - $image_rootdevice_rest=substr($image_rootdevice, $ident_separate+1); - $ident_separate2=strpos($image_rootdevice_rest, ":"); - $image_location_name=substr($image_rootdevice_rest, 0, $ident_separate2); - $root_device=substr($image_rootdevice_rest, $ident_separate2+1); - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $resource_mac=$resource->mac; - $resource_ip=$resource->ip; - - switch($cmd) { - case "start": - // authenticate the rootfs / needs openqrm user + pass - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-aoe-deployment-auth-hook.php", "Authenticating $image_name / $image_rootdevice to resource $resource_mac", "", "", 0, 0, $appliance_id); - $auth_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -n ".$image_name." -r ".$image_rootdevice." -i ".$resource_mac." -t lvm-aoe-deployment -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $resource->send_command($storage_ip, $auth_start_cmd); - - // give time to settle restart of openqrm-exec daemon - sleep(3); - - // authenticate the install-from-nfs export - $run_disable_deployment_export=0; - $install_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_INSTALL_FROM_NFS")); - if (strlen($install_from_nfs_param)) { - - // storage -> resource -> auth - $ip_storage_id=$deployment->parse_deployment_parameter("id", $install_from_nfs_param); - $ip_storage_ip=$deployment->parse_deployment_parameter("ip", $install_from_nfs_param); - $ip_image_rootdevice=$deployment->parse_deployment_parameter("path", $install_from_nfs_param); - - $ip_storage = new storage(); - $ip_storage->get_instance_by_id($ip_storage_id); - $ip_storage_resource = new resource(); - $ip_storage_resource->get_instance_by_id($ip_storage->resource_id); - $op_storage_ip = $ip_storage_resource->ip; - - $ip_deployment = new deployment(); - $ip_deployment->get_instance_by_id($ip_storage->type); - $ip_deployment_type = $ip_deployment->type; - $ip_deployment_plugin_name = $ip_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-aoe-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $ip_storage_id:$ip_storage_ip:$ip_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$ip_deployment_plugin_name."/bin/openqrm-".$ip_deployment_plugin_name." auth -r ".$ip_image_rootdevice." -i ".$resource_ip." -t ".$ip_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($ip_storage_ip, $auth_install_from_nfs_start_cmd); - - $run_disable_deployment_export=1; - } - - // authenticate the transfer-to-nfs export - $transfer_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_TRANSFER_TO_NFS")); - if (strlen($transfer_from_nfs_param)) { - // storage -> resource -> auth - $tp_storage_id=$deployment->parse_deployment_parameter("id", $transfer_from_nfs_param); - $tp_storage_ip=$deployment->parse_deployment_parameter("ip", $transfer_from_nfs_param); - $tp_image_rootdevice=$deployment->parse_deployment_parameter("path", $transfer_from_nfs_param); - - $tp_storage = new storage(); - $tp_storage->get_instance_by_id($tp_storage_id); - $tp_storage_resource = new resource(); - $tp_storage_resource->get_instance_by_id($tp_storage->resource_id); - $op_storage_ip = $tp_storage_resource->ip; - - $tp_deployment = new deployment(); - $tp_deployment->get_instance_by_id($tp_storage->type); - $tp_deployment_type = $tp_deployment->type; - $tp_deployment_plugin_name = $tp_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-aoe-deployment-auth-hook.php", "Transfer-to-NFS: Authenticating $resource_ip on storage id $tp_storage_id:$tp_storage_ip:$tp_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$tp_deployment_plugin_name."/bin/openqrm-".$tp_deployment_plugin_name." auth -r ".$tp_image_rootdevice." -i ".$resource_ip." -t ".$tp_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($tp_storage_ip, $auth_install_from_nfs_start_cmd); - - $run_disable_deployment_export=1; - } - - // do we need to disable the install-from/transfer-to-nfs exports ? - if ($run_disable_deployment_export == 1) { - $image_authentication = new image_authentication(); - $ia_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_auth_ar = array( - 'ia_id' => $ia_id, - 'ia_image_id' => $appliance->imageid, - 'ia_resource_id' => $appliance->resources, - 'ia_auth_type' => 1, - ); - $image_authentication->add($image_auth_ar); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-aoe-deployment-auth-hook.php", "Registered image $appliance->imageid for de-authentication the deployment exports when resource $appliance->resources is fully up.", "", "", 0, 0, $appliance_id); - } - - break; - - case "stop": - $image_authentication = new image_authentication(); - $ia_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_auth_ar = array( - 'ia_id' => $ia_id, - 'ia_image_id' => $appliance->imageid, - 'ia_resource_id' => $appliance->resources, - 'ia_auth_type' => 0, - ); - $image_authentication->add($image_auth_ar); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-aoe-deployment-auth-hook.php", "Registered image $appliance->imageid for de-authentication the root-fs exports when resource $appliance->resources is idle again.", "", "", 0, 0, $appliance_id); - break; - - } - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage volume for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - // parse the rootdevice infos - $ident_separate=strpos($image_rootdevice, ":"); - $volume_group=substr($image_rootdevice, 0, $ident_separate); - $image_rootdevice_rest=substr($image_rootdevice, $ident_separate+1); - $ident_separate2=strpos($image_rootdevice_rest, ":"); - $image_location_name=substr($image_rootdevice_rest, 0, $ident_separate2); - $root_device=substr($image_rootdevice_rest, $ident_separate2+1); - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $auth_stop_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -r ".$image_rootdevice." -i 00:00:00:00:00:00 -t lvm-aoe-deployment --openqrm-cmd-mode background"; - $resource = new resource(); - $resource->send_command($storage_ip, $auth_stop_cmd); - - } - - - //-------------------------------------------------- - /** - * de-authenticates the storage deployment volumes for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_deployment_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_deployment_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - // just for sending the commands - $resource = new resource(); - - // get install deployment params - $install_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_INSTALL_FROM_NFS")); - if (strlen($install_from_nfs_param)) { - // storage -> resource -> auth - $ip_storage_id=$deployment->parse_deployment_parameter("id", $install_from_nfs_param); - $ip_storage_ip=$deployment->parse_deployment_parameter("ip", $install_from_nfs_param); - $ip_image_rootdevice=$deployment->parse_deployment_parameter("path", $install_from_nfs_param); - - $ip_storage = new storage(); - $ip_storage->get_instance_by_id($ip_storage_id); - $ip_storage_resource = new resource(); - $ip_storage_resource->get_instance_by_id($ip_storage->resource_id); - $op_storage_ip = $ip_storage_resource->ip; - - $ip_deployment = new deployment(); - $ip_deployment->get_instance_by_id($ip_storage->type); - $ip_deployment_type = $ip_deployment->type; - $ip_deployment_plugin_name = $ip_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-aoe-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $ip_storage_id:$ip_storage_ip:$ip_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$ip_deployment_plugin_name."/bin/openqrm-".$ip_deployment_plugin_name." auth -r ".$ip_image_rootdevice." -i ".$OPENQRM_SERVER_IP_ADDRESS." -t ".$ip_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($ip_storage_ip, $auth_install_from_nfs_start_cmd); - } - - // get transfer deployment params - $transfer_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_TRANSFER_TO_NFS")); - if (strlen($transfer_from_nfs_param)) { - // storage -> resource -> auth - $tp_storage_id=$deployment->parse_deployment_parameter("id", $transfer_from_nfs_param); - $tp_storage_ip=$deployment->parse_deployment_parameter("ip", $transfer_from_nfs_param); - $tp_image_rootdevice=$deployment->parse_deployment_parameter("path", $transfer_from_nfs_param); - - $tp_storage = new storage(); - $tp_storage->get_instance_by_id($tp_storage_id); - $tp_storage_resource = new resource(); - $tp_storage_resource->get_instance_by_id($tp_storage->resource_id); - $op_storage_ip = $tp_storage_resource->ip; - - $tp_deployment = new deployment(); - $tp_deployment->get_instance_by_id($tp_storage->type); - $tp_deployment_type = $tp_deployment->type; - $tp_deployment_plugin_name = $tp_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-aoe-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $tp_storage_id:$tp_storage_ip:$tp_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$tp_deployment_plugin_name."/bin/openqrm-".$tp_deployment_plugin_name." auth -r ".$tp_image_rootdevice." -i ".$OPENQRM_SERVER_IP_ADDRESS." -t ".$tp_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($tp_storage_ip, $auth_install_from_nfs_start_cmd); - } - - } - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-aoe-deployment-cloud-hook.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-aoe-deployment-cloud-hook.php deleted file mode 100644 index 205d903..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-aoe-deployment-cloud-hook.php +++ /dev/null @@ -1,283 +0,0 @@ - -*/ - - -// This file implements the cloud storage methods - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -// special cloud classes -require_once "$RootDir/plugins/cloud/class/cloudimage.class.php"; - -$event = new event(); -global $event; - -global $OPENQRM_SERVER_BASE_DIR; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $RESOURCE_INFO_TABLE; -$BaseDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/'; - -// --------------------------------------------------------------------------------- -// general cloudstorage methods -// --------------------------------------------------------------------------------- - - -// clones the volume of an image -function create_clone_lvm_aoe_deployment($cloud_image_id, $image_clone_name, $disk_size) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - global $BaseDir; - $event->log("create_clone", $_SERVER['REQUEST_TIME'], 5, "lvm-aoe-deployment-cloud-hook", "Creating clone of image on storage", "", "", 0, 0, 0); - - // we got the cloudimage id here, get the image out of it - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image, this is already the new logical clone - // we just need to physical snapshot it and update the rootdevice - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - - // parse the volume group info in the identifier - $ident_separate=strpos($image_rootdevice, ":"); - $volume_group=substr($image_rootdevice, 0, $ident_separate); - $image_rootdevice_rest=substr($image_rootdevice, $ident_separate+1); - $ident_separate2=strpos($image_rootdevice_rest, ":"); - $image_location_name=substr($image_rootdevice_rest, 0, $ident_separate2); - $root_device=substr($image_rootdevice_rest, $ident_separate2+1); - // set default snapshot size - if (!strlen($disk_size)) { - $disk_size=5000; - } - $image_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage snap -n ".$image_location_name." -v ".$volume_group." -t lvm-aoe-deployment -s ".$image_clone_name." -m ".$disk_size." --openqrm-cmd-mode background"; - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "lvm-aoe-deployment-cloud-hook", "Running : $image_clone_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_clone_cmd); - // wait for clone - sleep(4); - // find the new rootdevice of the snapshot, get it via the storage-ident hook - $rootdevice_identifier_hook = "$BaseDir/boot-service/image.lvm-aoe-deployment.php"; - // require once - require_once "$rootdevice_identifier_hook"; - $rootdevice_identifier_arr = array(); - $rootdevice_identifier_arr = get_lvm_aoe_deployment_image_rootdevice_identifier($image->storageid); - foreach($rootdevice_identifier_arr as $id) { - foreach($id as $aoe_identifier_string) { - if (strstr($aoe_identifier_string, $image_clone_name)) { - $aoe_clone_rootdevice_tmp=strrchr($aoe_identifier_string, ":"); - $aoe_clone_rootdevice=trim(str_replace(":", "", $aoe_clone_rootdevice_tmp)); - break; - } - } - } - // update the image rootdevice parameter - $ar_image_update = array( - 'image_rootdevice' => "$volume_group:$image_clone_name:$aoe_clone_rootdevice", - ); - $image->update($image_id, $ar_image_update); - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "lvm-aoe-deployment-cloud-hook", "Updating rootdevice of image $image_id / $image_name with $volume_group:$image_clone_name:$aoe_clone_rootdevice", "", "", 0, 0, 0); -} - - - -// removes the volume of an image -function remove_lvm_aoe_deployment($cloud_image_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("remove_lvm_aoe_deployment", $_SERVER['REQUEST_TIME'], 5, "lvm-aoe-deployment-cloud-hook", "Removing image on storage", "", "", 0, 0, 0); - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - - // parse the volume group info in the identifier - $ident_separate=strpos($image_rootdevice, ":"); - $volume_group=substr($image_rootdevice, 0, $ident_separate); - $image_rootdevice_rest=substr($image_rootdevice, $ident_separate+1); - $ident_separate2=strpos($image_rootdevice_rest, ":"); - $image_location_name=substr($image_rootdevice_rest, 0, $ident_separate2); - $root_device=substr($image_rootdevice_rest, $ident_separate2+1); - $image_remove_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage remove -n ".$image_location_name." -v ".$volume_group." -t lvm-aoe-deployment --openqrm-cmd-mode background"; - $event->log("remove_lvm_aoe_deployment", $_SERVER['REQUEST_TIME'], 5, "lvm-aoe-deployment-cloud-hook", "Running : $image_remove_clone_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_remove_clone_cmd); -} - - -// resizes the volume of an image -function resize_lvm_aoe_deployment($cloud_image_id, $resize_value) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("resize_lvm_aoe_deployment", $_SERVER['REQUEST_TIME'], 5, "lvm-aoe-deployment-cloud-hook", "Resize image on storage", "", "", 0, 0, 0); - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - - // parse the volume group info in the identifier - $ident_separate=strpos($image_rootdevice, ":"); - $volume_group=substr($image_rootdevice, 0, $ident_separate); - $image_rootdevice_rest=substr($image_rootdevice, $ident_separate+1); - $ident_separate2=strpos($image_rootdevice_rest, ":"); - $image_location_name=substr($image_rootdevice_rest, 0, $ident_separate2); - $root_device=substr($image_rootdevice_rest, $ident_separate2+1); - $image_resize_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage resize -n ".$image_location_name." -v ".$volume_group." -m ".$resize_value." -t lvm-aoe-deployment --openqrm-cmd-mode background"; - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "lvm-aoe-deployment-cloud-hook", "Running : $image_resize_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_resize_cmd); -} - - - -// creates a private copy of the volume of an image -function create_private_lvm_aoe_deployment($cloud_image_id, $private_disk, $private_image_name) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("create_private_lvm_aoe_deployment", $_SERVER['REQUEST_TIME'], 5, "lvm-aoe-deployment-cloud-hook", "Creating private image on storage", "", "", 0, 0, 0); - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // create an admin user to post when cloning has finished - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - // parse the volume group info in the identifier - $ident_separate=strpos($image_rootdevice, ":"); - $volume_group=substr($image_rootdevice, 0, $ident_separate); - $image_rootdevice_rest=substr($image_rootdevice, $ident_separate+1); - $ident_separate2=strpos($image_rootdevice_rest, ":"); - $image_location_name=substr($image_rootdevice_rest, 0, $ident_separate2); - $root_device=substr($image_rootdevice_rest, $ident_separate2+1); - $image_resize_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage clone -n ".$image_location_name." -s ".$private_image_name." -v ".$volume_group." -m ".$private_disk." -t lvm-aoe-deployment -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "lvm-aoe-deployment-cloud-hook", "Running : $image_resize_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_resize_cmd); - // set the storage specific image root_device parameter - $new_rootdevice = str_replace($image_location_name, $private_image_name, $image->rootdevice); - return $new_rootdevice; -} - - - -// --------------------------------------------------------------------------------- - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-iscsi-deployment-auth-hook.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-iscsi-deployment-auth-hook.php deleted file mode 100644 index 5a6b97c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-iscsi-deployment-auth-hook.php +++ /dev/null @@ -1,342 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/image_authentication.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; - -/** - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - */ - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $IMAGE_AUTHENTICATION_TABLE; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - - //-------------------------------------------------- - /** - * authenticates the storage volume for the appliance resource - * - * storage_auth_function("start", 2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_function($cmd, $appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $IMAGE_AUTHENTICATION_TABLE; - global $openqrm_server; - - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - // parse the volume group info in the identifier - $ident_separate=strpos($image_rootdevice, ":"); - $volume_group=substr($image_rootdevice, 0, $ident_separate); - $root_device=substr($image_rootdevice, $ident_separate); - $image_location=dirname($root_device); - $image_location_name=basename($image_location); - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $resource_mac=$resource->mac; - $resource_ip=$resource->ip; - - switch($cmd) { - case "start": - // authenticate the rootfs / needs openqrm user + pass - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - // generate a password for the image - $image_password = $image->generatePassword(12); - $image_deployment_parameter = $image->deployment_parameter; - $image->set_deployment_parameters("IMAGE_ISCSI_AUTH", $image_password); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-iscsi-deployment-auth-hook.php", "Authenticating $image_name / $image_location_name to resource $resource_mac", "", "", 0, 0, $appliance_id); - $auth_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -n ".$image_name." -r /dev/".$volume_group."/".$image_location_name." -i ".$image_password." -t lvm-iscsi-deployment -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $resource->send_command($storage_ip, $auth_start_cmd); - - // authenticate the install-from-nfs export - $run_disable_deployment_export=0; - $install_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_INSTALL_FROM_NFS")); - if (strlen($install_from_nfs_param)) { - - // storage -> resource -> auth - $ip_storage_id=$deployment->parse_deployment_parameter("id", $install_from_nfs_param); - $ip_storage_ip=$deployment->parse_deployment_parameter("ip", $install_from_nfs_param); - $ip_image_rootdevice=$deployment->parse_deployment_parameter("path", $install_from_nfs_param); - - $ip_storage = new storage(); - $ip_storage->get_instance_by_id($ip_storage_id); - $ip_storage_resource = new resource(); - $ip_storage_resource->get_instance_by_id($ip_storage->resource_id); - $op_storage_ip = $ip_storage_resource->ip; - - $ip_deployment = new deployment(); - $ip_deployment->get_instance_by_id($ip_storage->type); - $ip_deployment_type = $ip_deployment->type; - $ip_deployment_plugin_name = $ip_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-iscsi-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $ip_storage_id:$ip_storage_ip:$ip_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$ip_deployment_plugin_name."/bin/openqrm-".$ip_deployment_plugin_name." auth -r ".$ip_image_rootdevice." -i ".$resource_ip." -t ".$ip_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($ip_storage_ip, $auth_install_from_nfs_start_cmd); - - $run_disable_deployment_export=1; - } - - // authenticate the transfer-to-nfs export - $transfer_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_TRANSFER_TO_NFS")); - if (strlen($transfer_from_nfs_param)) { - // storage -> resource -> auth - $tp_storage_id=$deployment->parse_deployment_parameter("id", $transfer_from_nfs_param); - $tp_storage_ip=$deployment->parse_deployment_parameter("ip", $transfer_from_nfs_param); - $tp_image_rootdevice=$deployment->parse_deployment_parameter("path", $transfer_from_nfs_param); - - $tp_storage = new storage(); - $tp_storage->get_instance_by_id($tp_storage_id); - $tp_storage_resource = new resource(); - $tp_storage_resource->get_instance_by_id($tp_storage->resource_id); - $op_storage_ip = $tp_storage_resource->ip; - - $tp_deployment = new deployment(); - $tp_deployment->get_instance_by_id($tp_storage->type); - $tp_deployment_type = $tp_deployment->type; - $tp_deployment_plugin_name = $tp_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-iscsi-deployment-auth-hook.php", "Transfer-to-NFS: Authenticating $resource_ip on storage id $tp_storage_id:$tp_storage_ip:$tp_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$tp_deployment_plugin_name."/bin/openqrm-".$tp_deployment_plugin_name." auth -r ".$tp_image_rootdevice." -i ".$resource_ip." -t ".$tp_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($tp_storage_ip, $auth_install_from_nfs_start_cmd); - - $run_disable_deployment_export=1; - } - - // do we need to disable the install-from/transfer-to-nfs exports ? - if ($run_disable_deployment_export == 1) { - $image_authentication = new image_authentication(); - $ia_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_auth_ar = array( - 'ia_id' => $ia_id, - 'ia_image_id' => $appliance->imageid, - 'ia_resource_id' => $appliance->resources, - 'ia_auth_type' => 1, - ); - $image_authentication->add($image_auth_ar); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-iscsi-deployment-auth-hook.php", "Registered image $appliance->imageid for de-authentication the deployment exports when resource $appliance->resources is fully up.", "", "", 0, 0, $appliance_id); - } - - break; - - case "stop": - $image_authentication = new image_authentication(); - $ia_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_auth_ar = array( - 'ia_id' => $ia_id, - 'ia_image_id' => $appliance->imageid, - 'ia_resource_id' => $appliance->resources, - 'ia_auth_type' => 0, - ); - $image_authentication->add($image_auth_ar); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-iscsi-deployment-auth-hook.php", "Registered image $appliance->imageid for de-authentication the root-fs exports when resource $appliance->resources is idle again.", "", "", 0, 0, $appliance_id); - break; - - } - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage volume for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - // generate a password for the image - $image_password = $image->generatePassword(12); - $image_deployment_parameter = $image->deployment_parameter; - // parse the volume group info in the identifier - $ident_separate=strpos($image_rootdevice, ":"); - $volume_group=substr($image_rootdevice, 0, $ident_separate); - $root_device=substr($image_rootdevice, $ident_separate); - $image_location=dirname($root_device); - $image_location_name=basename($image_location); - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $auth_stop_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -r /dev/".$volume_group."/".$image_location_name." -i ".$image_password." -t lvm-iscsi-deployment --openqrm-cmd-mode background"; - $resource = new resource(); - $resource->send_command($storage_ip, $auth_stop_cmd); - // and update the image params - $image->set_deployment_parameters("IMAGE_ISCSI_AUTH", $image_password); - - } - - - - - - //-------------------------------------------------- - /** - * de-authenticates the storage deployment volumes for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_deployment_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_deployment_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - // just for sending the commands - $resource = new resource(); - - // get install deployment params - $install_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_INSTALL_FROM_NFS")); - if (strlen($install_from_nfs_param)) { - // storage -> resource -> auth - $ip_storage_id=$deployment->parse_deployment_parameter("id", $install_from_nfs_param); - $ip_storage_ip=$deployment->parse_deployment_parameter("ip", $install_from_nfs_param); - $ip_image_rootdevice=$deployment->parse_deployment_parameter("path", $install_from_nfs_param); - - $ip_storage = new storage(); - $ip_storage->get_instance_by_id($ip_storage_id); - $ip_storage_resource = new resource(); - $ip_storage_resource->get_instance_by_id($ip_storage->resource_id); - $op_storage_ip = $ip_storage_resource->ip; - - $ip_deployment = new deployment(); - $ip_deployment->get_instance_by_id($ip_storage->type); - $ip_deployment_type = $ip_deployment->type; - $ip_deployment_plugin_name = $ip_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-iscsi-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $ip_storage_id:$ip_storage_ip:$ip_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$ip_deployment_plugin_name."/bin/openqrm-".$ip_deployment_plugin_name." auth -r ".$ip_image_rootdevice." -i ".$OPENQRM_SERVER_IP_ADDRESS." -t ".$ip_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($ip_storage_ip, $auth_install_from_nfs_start_cmd); - } - - // get transfer deployment params - $transfer_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_TRANSFER_TO_NFS")); - if (strlen($transfer_from_nfs_param)) { - // storage -> resource -> auth - $tp_storage_id=$deployment->parse_deployment_parameter("id", $transfer_from_nfs_param); - $tp_storage_ip=$deployment->parse_deployment_parameter("ip", $transfer_from_nfs_param); - $tp_image_rootdevice=$deployment->parse_deployment_parameter("path", $transfer_from_nfs_param); - - $tp_storage = new storage(); - $tp_storage->get_instance_by_id($tp_storage_id); - $tp_storage_resource = new resource(); - $tp_storage_resource->get_instance_by_id($tp_storage->resource_id); - $op_storage_ip = $tp_storage_resource->ip; - - $tp_deployment = new deployment(); - $tp_deployment->get_instance_by_id($tp_storage->type); - $tp_deployment_type = $tp_deployment->type; - $tp_deployment_plugin_name = $tp_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-iscsi-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $tp_storage_id:$tp_storage_ip:$tp_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$tp_deployment_plugin_name."/bin/openqrm-".$tp_deployment_plugin_name." auth -r ".$tp_image_rootdevice." -i ".$OPENQRM_SERVER_IP_ADDRESS." -t ".$tp_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($tp_storage_ip, $auth_install_from_nfs_start_cmd); - } - - } - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-iscsi-deployment-cloud-hook.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-iscsi-deployment-cloud-hook.php deleted file mode 100644 index 484247d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-iscsi-deployment-cloud-hook.php +++ /dev/null @@ -1,265 +0,0 @@ - -*/ - - -// This file implements the cloud storage methods - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -// special cloud classes -require_once "$RootDir/plugins/cloud/class/cloudimage.class.php"; - -$event = new event(); -global $event; - -global $OPENQRM_SERVER_BASE_DIR; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $RESOURCE_INFO_TABLE; - - -// --------------------------------------------------------------------------------- -// general cloudstorage methods -// --------------------------------------------------------------------------------- - - -// clones the volume of an image -function create_clone_lvm_iscsi_deployment($cloud_image_id, $image_clone_name, $disk_size) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("create_clone", $_SERVER['REQUEST_TIME'], 5, "lvm-iscsi-deployment-cloud-hook", "Creating clone of image on storage", "", "", 0, 0, 0); - - // we got the cloudimage id here, get the image out of it - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image, this is already the new logical clone - // we just need to physical snapshot it and update the rootdevice - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - - // generate a new image password for the clone - $image_password = $image->generatePassword(12); - $image->set_deployment_parameters("IMAGE_ISCSI_AUTH", $image_password); - // parse the volume group info in the identifier - $ident_separate=strpos($image_rootdevice, ":"); - $volume_group=substr($image_rootdevice, 0, $ident_separate); - $root_device=substr($image_rootdevice, $ident_separate); - $image_location=dirname($root_device); - $image_location_name=basename($image_location); - // set default snapshot size - if (!strlen($disk_size)) { - $disk_size=5000; - } - - // update the image rootdevice parameter - $ar_image_update = array( - 'image_rootdevice' => "$volume_group:/dev/$image_clone_name/1", - ); - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "lvm-iscsi-deployment-cloud-hook", "Updating rootdevice of image $image_id / $image_name with $volume_group:/dev/$image_clone_name/1", "", "", 0, 0, 0); - $image->update($image_id, $ar_image_update); - // send command - $image_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage snap -n ".$image_location_name." -v ".$volume_group." -t lvm-iscsi-deployment -s ".$image_clone_name." -m ".$disk_size." -i ".$image_password." --openqrm-cmd-mode background"; - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "lvm-iscsi-deployment-cloud-hook", "Running : $image_clone_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_clone_cmd); -} - - - -// removes the volume of an image -function remove_lvm_iscsi_deployment($cloud_image_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("remove_lvm_iscsi_deployment", $_SERVER['REQUEST_TIME'], 5, "lvm-iscsi-deployment-cloud-hook", "Removing image on storage", "", "", 0, 0, 0); - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // parse the volume group info in the identifier - $ident_separate=strpos($image_rootdevice, ":"); - $volume_group=substr($image_rootdevice, 0, $ident_separate); - $root_device=substr($image_rootdevice, $ident_separate); - $image_location=dirname($root_device); - $image_location_name=basename($image_location); - $image_remove_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage remove -n ".$image_location_name." -v ".$volume_group." -t lvm-iscsi-deployment --openqrm-cmd-mode background"; - $event->log("remove_lvm_iscsi_deployment", $_SERVER['REQUEST_TIME'], 5, "lvm-iscsi-deployment-cloud-hook", "Running : $image_remove_clone_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_remove_clone_cmd); -} - - -// resizes the volume of an image -function resize_lvm_iscsi_deployment($cloud_image_id, $resize_value) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("resize_lvm_iscsi_deployment", $_SERVER['REQUEST_TIME'], 5, "lvm-iscsi-deployment-cloud-hook", "Resize image on storage", "", "", 0, 0, 0); - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // parse the volume group info in the identifier - $ident_separate=strpos($image_rootdevice, ":"); - $volume_group=substr($image_rootdevice, 0, $ident_separate); - $root_device=substr($image_rootdevice, $ident_separate); - $image_location=dirname($root_device); - $image_location_name=basename($image_location); - $image_resize_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage resize -n ".$image_location_name." -v ".$volume_group." -m ".$resize_value." -t lvm-iscsi-deployment --openqrm-cmd-mode background"; - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "lvm-iscsi-deployment-cloud-hook", "Running : $image_resize_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_resize_cmd); -} - - - -// creates a private copy of the volume of an image -function create_private_lvm_iscsi_deployment($cloud_image_id, $private_disk, $private_image_name) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("create_private_lvm_iscsi_deployment", $_SERVER['REQUEST_TIME'], 5, "lvm-iscsi-deployment-cloud-hook", "Creating private image on storage", "", "", 0, 0, 0); - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // create an admin user to post when cloning has finished - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - // parse the volume group info in the identifier - $ident_separate=strpos($image_rootdevice, ":"); - $volume_group=substr($image_rootdevice, 0, $ident_separate); - $root_device=substr($image_rootdevice, $ident_separate); - $image_location=dirname($root_device); - $image_location_name=basename($image_location); - $image_resize_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage clone -n ".$image_location_name." -s ".$private_image_name." -v ".$volume_group." -m ".$private_disk." -t lvm-iscsi-deployment -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "lvm-iscsi-deployment-cloud-hook", "Running : $image_resize_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_resize_cmd); - // set the storage specific image root_device parameter - $new_rootdevice = str_replace($image_location_name, $private_image_name, $image->rootdevice); - return $new_rootdevice; -} - - - -// --------------------------------------------------------------------------------- - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-nfs-deployment-auth-hook.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-nfs-deployment-auth-hook.php deleted file mode 100644 index 3499577..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-nfs-deployment-auth-hook.php +++ /dev/null @@ -1,350 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/image_authentication.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; - -/** - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - */ - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $IMAGE_AUTHENTICATION_TABLE; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - - - //-------------------------------------------------- - /** - * authenticates the storage volume for the appliance resource - * - * storage_auth_function("start", 2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_function($cmd, $appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $IMAGE_AUTHENTICATION_TABLE; - global $openqrm_server; - global $RootDir; - - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $resource_mac=$resource->mac; - $resource_ip=$resource->ip; - - // this is a hook for the cloud-plugin to be able - // to translate the internal to the external ip address - // for the nfs-mount authentication -/* if (file_exists("$RootDir/plugins/cloud/.running")) { - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-nfs-deployment-auth-hook.php", "Found Cloud enabled and running. Checking for CloudNAT", "", "", 0, 0, $appliance_id); - // special clouduser class - require_once "$RootDir/plugins/cloud/class/cloudconfig.class.php"; - require_once "$RootDir/plugins/cloud/class/cloudnat.class.php"; - // check if we have to cloudnat the ip address - $cn_conf = new cloudconfig(); - $cn_nat_enabled = $cn_conf->get_value(18); // 18 is cloud_nat - if (!strcmp($cn_nat_enabled, "true")) { - $cn = new cloudnat(); - $internal_resource_ip=$resource_ip; - $resource_ip = $cn->translate($resource_ip); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-nfs-deployment-auth-hook.php", "Found CloudNAT enabled, translated $internal_resource_ip to $resource_ip", "", "", 0, 0, $appliance_id); - } else { - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-nfs-deployment-auth-hook.php", "Cloudnat is disabled, keeping $resource_ip", "", "", 0, 0, $appliance_id); - } - } else { - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-nfs-deployment-auth-hook.php", "Cloud is not enabled/running. Not checking for CloudNAT", "", "", 0, 0, $appliance_id); - - } -*/ - - switch($cmd) { - case "start": - // authenticate the rootfs / needs openqrm user + pass - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-nfs-deployment-auth-hook.php", "Authenticating $image_name / $image_rootdevice to resource $resource_ip", "", "", 0, 0, $appliance_id); - $auth_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -n ".$image_name." -r ".$image_rootdevice." -i ".$resource_ip." -t lvm-nfs-deployment -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $resource->send_command($storage_ip, $auth_start_cmd); - - // authenticate the install-from-nfs export - $run_disable_deployment_export=0; - $install_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_INSTALL_FROM_NFS")); - if (strlen($install_from_nfs_param)) { - - // storage -> resource -> auth - $ip_storage_id=$deployment->parse_deployment_parameter("id", $install_from_nfs_param); - $ip_storage_ip=$deployment->parse_deployment_parameter("ip", $install_from_nfs_param); - $ip_image_rootdevice=$deployment->parse_deployment_parameter("path", $install_from_nfs_param); - - $ip_storage = new storage(); - $ip_storage->get_instance_by_id($ip_storage_id); - $ip_storage_resource = new resource(); - $ip_storage_resource->get_instance_by_id($ip_storage->resource_id); - $op_storage_ip = $ip_storage_resource->ip; - - $ip_deployment = new deployment(); - $ip_deployment->get_instance_by_id($ip_storage->type); - $ip_deployment_type = $ip_deployment->type; - $ip_deployment_plugin_name = $ip_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-nfs-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $ip_storage_id:$ip_storage_ip:$ip_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$ip_deployment_plugin_name."/bin/openqrm-".$ip_deployment_plugin_name." auth -r ".$ip_image_rootdevice." -i ".$resource_ip." -t ".$ip_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($ip_storage_ip, $auth_install_from_nfs_start_cmd); - - $run_disable_deployment_export=1; - } - - // authenticate the transfer-to-nfs export - $transfer_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_TRANSFER_TO_NFS")); - if (strlen($transfer_from_nfs_param)) { - // storage -> resource -> auth - $tp_storage_id=$deployment->parse_deployment_parameter("id", $transfer_from_nfs_param); - $tp_storage_ip=$deployment->parse_deployment_parameter("ip", $transfer_from_nfs_param); - $tp_image_rootdevice=$deployment->parse_deployment_parameter("path", $transfer_from_nfs_param); - - $tp_storage = new storage(); - $tp_storage->get_instance_by_id($tp_storage_id); - $tp_storage_resource = new resource(); - $tp_storage_resource->get_instance_by_id($tp_storage->resource_id); - $op_storage_ip = $tp_storage_resource->ip; - - $tp_deployment = new deployment(); - $tp_deployment->get_instance_by_id($tp_storage->type); - $tp_deployment_type = $tp_deployment->type; - $tp_deployment_plugin_name = $tp_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-nfs-deployment-auth-hook.php", "Transfer-to-NFS: Authenticating $resource_ip on storage id $tp_storage_id:$tp_storage_ip:$tp_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$tp_deployment_plugin_name."/bin/openqrm-".$tp_deployment_plugin_name." auth -r ".$tp_image_rootdevice." -i ".$resource_ip." -t ".$tp_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($tp_storage_ip, $auth_install_from_nfs_start_cmd); - - $run_disable_deployment_export=1; - } - - // do we need to disable the install-from/transfer-to-nfs exports ? - if ($run_disable_deployment_export == 1) { - $image_authentication = new image_authentication(); - $ia_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_auth_ar = array( - 'ia_id' => $ia_id, - 'ia_image_id' => $appliance->imageid, - 'ia_resource_id' => $appliance->resources, - 'ia_auth_type' => 1, - ); - $image_authentication->add($image_auth_ar); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-nfs-deployment-auth-hook.php", "Registered image $appliance->imageid for de-authentication the deployment exports when resource $appliance->resources is fully up.", "", "", 0, 0, $appliance_id); - } - - - - break; - case "stop": - $image_authentication = new image_authentication(); - $ia_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_auth_ar = array( - 'ia_id' => $ia_id, - 'ia_image_id' => $appliance->imageid, - 'ia_resource_id' => $appliance->resources, - 'ia_auth_type' => 0, - ); - $image_authentication->add($image_auth_ar); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-nfs-deployment-auth-hook.php", "Registered image $appliance->imageid for de-authentication the root-fs exports when resource $appliance->resources is idle again.", "", "", 0, 0, $appliance_id); - break; - - } - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage volume for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $auth_stop_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -r ".$image_rootdevice." -i ".$OPENQRM_SERVER_IP_ADDRESS." -t lvm-nfs-deployment --openqrm-cmd-mode background"; - $resource = new resource(); - $resource->send_command($storage_ip, $auth_stop_cmd); - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage deployment volumes for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_deployment_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_deployment_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - // just for sending the commands - $resource = new resource(); - - // get install deployment params - $install_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_INSTALL_FROM_NFS")); - if (strlen($install_from_nfs_param)) { - // storage -> resource -> auth - $ip_storage_id=$deployment->parse_deployment_parameter("id", $install_from_nfs_param); - $ip_storage_ip=$deployment->parse_deployment_parameter("ip", $install_from_nfs_param); - $ip_image_rootdevice=$deployment->parse_deployment_parameter("path", $install_from_nfs_param); - - $ip_storage = new storage(); - $ip_storage->get_instance_by_id($ip_storage_id); - $ip_storage_resource = new resource(); - $ip_storage_resource->get_instance_by_id($ip_storage->resource_id); - $op_storage_ip = $ip_storage_resource->ip; - - $ip_deployment = new deployment(); - $ip_deployment->get_instance_by_id($ip_storage->type); - $ip_deployment_type = $ip_deployment->type; - $ip_deployment_plugin_name = $ip_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-nfs-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $ip_storage_id:$ip_storage_ip:$ip_image_rootdevice", "", "", 0, 0, $resource_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$ip_deployment_plugin_name."/bin/openqrm-".$ip_deployment_plugin_name." auth -r ".$ip_image_rootdevice." -i ".$OPENQRM_SERVER_IP_ADDRESS." -t ".$ip_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($ip_storage_ip, $auth_install_from_nfs_start_cmd); - } - - // get transfer deployment params - $transfer_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_TRANSFER_TO_NFS")); - if (strlen($transfer_from_nfs_param)) { - // storage -> resource -> auth - $tp_storage_id=$deployment->parse_deployment_parameter("id", $transfer_from_nfs_param); - $tp_storage_ip=$deployment->parse_deployment_parameter("ip", $transfer_from_nfs_param); - $tp_image_rootdevice=$deployment->parse_deployment_parameter("path", $transfer_from_nfs_param); - - $tp_storage = new storage(); - $tp_storage->get_instance_by_id($tp_storage_id); - $tp_storage_resource = new resource(); - $tp_storage_resource->get_instance_by_id($tp_storage->resource_id); - $op_storage_ip = $tp_storage_resource->ip; - - $tp_deployment = new deployment(); - $tp_deployment->get_instance_by_id($tp_storage->type); - $tp_deployment_type = $tp_deployment->type; - $tp_deployment_plugin_name = $tp_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-lvm-nfs-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $tp_storage_id:$tp_storage_ip:$tp_image_rootdevice", "", "", 0, 0, $resource_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$tp_deployment_plugin_name."/bin/openqrm-".$tp_deployment_plugin_name." auth -r ".$tp_image_rootdevice." -i ".$OPENQRM_SERVER_IP_ADDRESS." -t ".$tp_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($tp_storage_ip, $auth_install_from_nfs_start_cmd); - } - - } - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-nfs-deployment-cloud-hook.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-nfs-deployment-cloud-hook.php deleted file mode 100644 index 9206d3e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/openqrm-lvm-nfs-deployment-cloud-hook.php +++ /dev/null @@ -1,259 +0,0 @@ - -*/ - - -// This file implements the cloud storage methods - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -// special cloud classes -require_once "$RootDir/plugins/cloud/class/cloudimage.class.php"; - -$event = new event(); -global $event; - -global $OPENQRM_SERVER_BASE_DIR; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $RESOURCE_INFO_TABLE; - - -// --------------------------------------------------------------------------------- -// general cloudstorage methods -// --------------------------------------------------------------------------------- - - -// clones the volume of an image -function create_clone_lvm_nfs_deployment($cloud_image_id, $image_clone_name, $disk_size) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("create_clone", $_SERVER['REQUEST_TIME'], 5, "lvm-nfs-deployment-cloud-hook", "Creating clone of image on storage", "", "", 0, 0, 0); - - // we got the cloudimage id here, get the image out of it - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image, this is already the new logical clone - // we just need to physical snapshot it and update the rootdevice - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - - $full_vol_name=$image_rootdevice; - $vol_dir=dirname($full_vol_name); - $vol=str_replace("/", "", $vol_dir); - $image_location_name=basename($full_vol_name); - // set default snapshot size - if (!strlen($disk_size)) { - $disk_size=5000; - } - // update the image rootdevice parameter - $image->get_instance_by_id($image_id); - $ar_image_update = array( - 'image_rootdevice' => "/$vol/$image_clone_name", - ); - $image->update($image_id, $ar_image_update); - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "lvm-nfs-deployment-cloud-hook", "Updating rootdevice of image $image_id / $image_name with /$vol/$image_clone_name", "", "", 0, 0, 0); - $image_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage snap -n ".$image_location_name." -v ".$vol." -t lvm-nfs-deployment -s ".$image_clone_name." -m ".$disk_size." --openqrm-cmd-mode background"; - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "lvm-nfs-deployment-cloud-hook", "Running : $image_clone_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_clone_cmd); - -} - - - -// removes the volume of an image -function remove_lvm_nfs_deployment($cloud_image_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("remove_lvm_nfs_deployment", $_SERVER['REQUEST_TIME'], 5, "lvm-nfs-deployment-cloud-hook", "Removing image on storage", "", "", 0, 0, 0); - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - - $full_vol_name=$image_rootdevice; - $vol_dir=dirname($full_vol_name); - $vol=str_replace("/", "", $vol_dir); - $image_location_name=basename($full_vol_name); - $image_remove_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage remove -n ".$image_location_name." -v ".$vol." -t lvm-nfs-deployment --openqrm-cmd-mode background"; - $event->log("remove_lvm_nfs_deployment", $_SERVER['REQUEST_TIME'], 5, "lvm-nfs-deployment-cloud-hook", "Running : $image_remove_clone_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_remove_clone_cmd); - -} - - -// resizes the volume of an image -function resize_lvm_nfs_deployment($cloud_image_id, $resize_value) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("resize_lvm_nfs_deployment", $_SERVER['REQUEST_TIME'], 5, "lvm-nfs-deployment-cloud-hook", "Resize image on storage", "", "", 0, 0, 0); - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - - $full_vol_name=$image_rootdevice; - $vol_dir=dirname($full_vol_name); - $vol=str_replace("/", "", $vol_dir); - $image_location_name=basename($full_vol_name); - $image_resize_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage resize -n ".$image_location_name." -v ".$vol." -m ".$resize_value." -t lvm-nfs-deployment --openqrm-cmd-mode background"; - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "lvm-nfs-deployment-cloud-hook", "Running : $image_resize_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_resize_cmd); - -} - - - -// creates a private copy of the volume of an image -function create_private_lvm_nfs_deployment($cloud_image_id, $private_disk, $private_image_name) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("create_private_lvm_nfs_deployment", $_SERVER['REQUEST_TIME'], 5, "lvm-nfs-deployment-cloud-hook", "Creating private image on storage", "", "", 0, 0, 0); - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // create an admin user to post when cloning has finished - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - $full_vol_name=$image_rootdevice; - $vol_dir=dirname($full_vol_name); - $vol=str_replace("/", "", $vol_dir); - $image_location_name=basename($full_vol_name); - $image_resize_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage clone -n ".$image_location_name." -s ".$private_image_name." -v ".$vol." -m ".$private_disk." -t lvm-nfs-deployment -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "lvm-nfs-deployment-cloud-hook", "Running : $image_resize_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_resize_cmd); - // set the storage specific image root_device parameter - $new_rootdevice = "/".$vol."/".$private_image_name; - return $new_rootdevice; - -} - - - -// --------------------------------------------------------------------------------- - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.custom-iscsi-deployment b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.custom-iscsi-deployment deleted file mode 100644 index 3c16d58..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.custom-iscsi-deployment +++ /dev/null @@ -1,357 +0,0 @@ -#!/bin/bash -# this is the root-mount initrd-service -# which proivdes function to mount/remount the remote -# custom-iscsi-rootfs according to the image_deployment_parameters at /mnt -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# custom-iscsi-storage -# Required defines in the image_deploy_paramters -# -# -# Optional parameters -# -# IMAGE_INSTALL_FROM_NFS - can be set to an (nfs) location from -# which the image will be installed at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_TRANSFER_TO_NFS - can be set to an (nfs) location from -# which the image will be transfered to at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_INSTALL_FROM_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this -# option will install the custom-iscsi-storage image on -# boot-time from the local-device -# -# IMAGE_TRANSFER_TO_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this option will transfrom -# the custom-iscsi-storage image on boot-time to the local-device -# -# -# -# IMAGE_INSTALL_FROM_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_TRANSFER_TO_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_NFS_MOUNT_OPTIONS - can be e.g. set to proto=tcp for the install/transform phase -# -# -# get the deployment parameters from openqrm.conf -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -. $OPENQRM_RESOURCE_PARAMETER_FILE -eval $image_deployment_parameter -export OPENQRM_SERVER_BASE_DIR=$resource_basedir -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - -# nfs-options for the install+transform phase -if [ "$IMAGE_NFS_MOUNT_OPTIONS" != "" ]; then - IMAGE_NFS_MOUNT_OPTIONS=",$IMAGE_NFS_MOUNT_OPTIONS" -fi -# default to ext3 -if [ "$IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" == "" ]; then - IMAGE_INSTALL_FROM_LOCAL_FS_TYPE="ext3" -fi -if [ "$IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" == "" ]; then - IMAGE_TRANSFER_TO_LOCAL_FS_TYPE="ext3" -fi - -# here we gather the target name + lun from the image_rootdevice -IMAGE_TARGET=`echo $image_rootdevice | cut -d'/' -f3` -IMAGE_LUN=`echo $image_rootdevice | cut -d'/' -f4` - -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - export WGET="wget --no-check-certificate -q" -else - export WGET="wget -q" -fi - -####################################################################### -# required functions ################################################## -####################################################################### - -function mount_rootfs() { - - # check to find the right binaries fitting to kernel + rootfs - if [ "$kernel_name" == "default" ]; then - # we get the default binaries - # get iscsid via wget from the openQRM-servers boot-service dir - $WGET -O /sbin/iscsid $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsid - $WGET -O /sbin/iscsiadm $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsiadm - else - # we try to get the binaries fitting to the kernel name - # -> if a special version is not available we go with the default - if ! $WGET -O /sbin/iscsid $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsid.$kernel_name; then - $WGET -O /sbin/iscsid $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsid - fi - if ! $WGET -O /sbin/iscsiadm $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsiadm.$kernel_name; then - $WGET -O /sbin/iscsiadm $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsiadm - fi - - fi - chmod +x /sbin/iscsi* - mkdir -p /tmp - - # load iscsi related modules - modprobe iscsi_tcp - modprobe libiscsi - modprobe scsi_transport_iscsi - modprobe scsi_mod - modprobe sg - modprobe sd_mod - modprobe ib_iser - - # create config /etc/iscsi/iscsid.conf - mkdir -p /etc/iscsi/ - cat >> /etc/iscsi/iscsid.conf << EOF -node.startup = manual -node.session.timeo.replacement_timeout = 120 -node.conn[0].timeo.login_timeout = 15 -node.conn[0].timeo.logout_timeout = 15 -node.conn[0].timeo.noop_out_interval = 10 -node.conn[0].timeo.noop_out_timeout = 15 -node.session.iscsi.InitialR2T = No -node.session.iscsi.ImmediateData = Yes -node.session.iscsi.FirstBurstLength = 262144 -node.session.iscsi.MaxBurstLength = 16776192 -node.conn[0].iscsi.MaxRecvDataSegmentLength = 65536 -EOF - -# add CHAP authentication if configured -if [ "$USER" != "" ] && [ "$PASSWORD" != "" ]; then - echo "node.session.auth.authmethod = CHAP" >> /etc/iscsi/iscsid.conf - echo "node.session.auth.username = $USER" >> /etc/iscsi/iscsid.conf - echo "node.session.auth.password = $PASSWORD" >> /etc/iscsi/iscsid.conf -fi - - # create /etc/iscsi/initiatorname.iscsi - cat >> /etc/iscsi/initiatorname.iscsi << EOF -InitiatorName=$INITIATOR -EOF - # also create /etc/initiatorname.iscsi, some open-iscsi version looking for that - cp /etc/iscsi/initiatorname.iscsi /etc/initiatorname.iscsi - - # start syslog + klogd - syslogd & - klogd& - - # start iscsid - /sbin/iscsid & - sleep 2 - - # discover - echo "custom-iscsi-storage: Discoverying Iscsi-target $image_storage_server_ip:3260" - iscsiadm -m discovery -t sendtargets -p $image_storage_server_ip:3260 - - # login - iscsiadm -m node -T $IMAGE_TARGET -p $image_storage_server_ip:3260 --login - - # let udev settle - sleep 4 - - # check that udev found the new device - FIND_ISCSI_BLOCK_DEVICE=`find /sys/class/iscsi_session/session*/device/target*/*/ -name block | head -n1` - if [ "$FIND_ISCSI_BLOCK_DEVICE" == "" ]; then - FIND_ISCSI_BLOCK_DEVICE=`find /sys/class/iscsi_session/session*/device/target*/*/ -name block:s* | head -n1` - if [ "$FIND_ISCSI_BLOCK_DEVICE" == "" ]; then - echo "ERROR: Udev did not detect the new device" - echo "ERROR: Could not look-up the Iscsi device in the sys-fs dir" - # give a shell for the admin - /bin/bash - fi - fi - # check for different sysfs styles - if [ -h $FIND_ISCSI_BLOCK_DEVICE ]; then - ISCSI_BLOCK_DEVICE_NAME=`readlink $FIND_ISCSI_BLOCK_DEVICE` - ISCSI_BLOCK_DEVICE_NAME=`basename $ISCSI_BLOCK_DEVICE_NAME` - echo "SUCCESS: Found $ISCSI_BLOCK_DEVICE_NAME in sys-fs (as symlink)" - elif [ -d $FIND_ISCSI_BLOCK_DEVICE ]; then - ISCSI_BLOCK_DEVICE_NAME=`ls $FIND_ISCSI_BLOCK_DEVICE` - echo "SUCCESS: Found $ISCSI_BLOCK_DEVICE_NAME in sys-fs (as dir)" - else - echo "ERROR: Udev did not detect the new device" - echo "ERROR: Could not look-up the Iscsi device in the sys-fs dir" - # give a shell for the admin - /bin/bash - fi - # export the blockdevice name for the further functions - export ISCSI_BLOCK_DEVICE="/dev/$ISCSI_BLOCK_DEVICE_NAME" - - # finallly mount - if ! mount -t $image_rootfstype $ISCSI_BLOCK_DEVICE /mnt; then - # in case we install from nfs we create a fs since this should be a new lun - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - echo "NOTICE: Found install-from-nfs enabled but failed mounting the rootdevice" - echo "NOTICE: Assuming a new (unformatted) Lun -> creating $image_rootfstype filesystem on $ISCSI_BLOCK_DEVICE" - mke2fs -F -j $ISCSI_BLOCK_DEVICE - if ! mount -t $image_rootfstype $ISCSI_BLOCK_DEVICE /mnt; then - echo "ERROR: Could not mount $ISCSI_BLOCK_DEVICE via iscsi" - # give a shell for the admin - /bin/bash - else - echo "custom-iscsi-storage: Mounted $ISCSI_BLOCK_DEVICE rw" - fi - else - echo "ERROR: Could not mount $ISCSI_BLOCK_DEVICE via iscsi" - # give a shell for the admin - /bin/bash - fi - else - echo "custom-iscsi-storage: Mounted $ISCSI_BLOCK_DEVICE rw" - fi - - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - install_rootfs_from_nfs - else - echo "custom-iscsi-storage: Skipping install phase" - fi - if [ "$IMAGE_TRANSFER_TO_NFS" != "" ]; then - transfer_rootfs_to_nfs - else - echo "custom-iscsi-storage: Skipping transfer-to-nfs phase" - fi - if [ "$IMAGE_INSTALL_FROM_LOCAL" != "" ]; then - install_rootfs_from_local - else - echo "custom-iscsi-storage: Skipping install-from-local phase" - fi - if [ "$IMAGE_TRANSFER_TO_LOCAL" != "" ]; then - transfer_rootfs_to_local - else - echo "custom-iscsi-storage: Skipping transfer-to-local phase" - fi - -} - - -function remount_rootfs() { - # Debian/Ubuntu Systems want their nfs-rootfs in rw mode - if [ -f /mnt/etc/apt/sources.list ]; then - if grep ubuntu /mnt/etc/apt/sources.list >/remountlog; then - echo "custom-iscsi-storage: Skipping Re-mount $ISCSI_BLOCK_DEVICE ro" - rm -f /remountlog - return - fi - fi - REMOUNT_LOOP=0 - # remont /mnt ro - while ! mount -t $image_rootfstype -o ro,remount $ISCSI_BLOCK_DEVICE /mnt; do - echo -n "." - sleep 1 - REMOUNT_LOOP=$[ REMOUNT_LOOP + 1 ] - if [ "$REMOUNT_LOOP" == "10" ]; then - echo "ERROR: custom-iscsi-storage could not remount /mnt " - /bin/bash - fi - done - echo "custom-iscsi-storage: Re-mounted $ISCSI_BLOCK_DEVICE ro" - -} - - -function create_fstab() { - rm -f $IMAGE_FSTAB - echo "$ISCSI_BLOCK_DEVICE / $image_rootfstype defaults 0 0" >> $IMAGE_FSTAB -} - - -####################################################################### -# optional functions ################################################## -####################################################################### - -function install_rootfs_from_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f1` - IMAGE_INSTALL_FROM_NFS=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f2-` - echo "custom-iscsi-storage: Installing $resource_image from $IMAGE_INSTALL_FROM_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o ro$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_INSTALL_FROM_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "custom-iscsi-storage: Starting install-from-nfs phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "custom-iscsi-storage: Install-from-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function transfer_rootfs_to_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f1` - IMAGE_TRANSFER_TO_NFS=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f2-` - echo "custom-iscsi-storage: Transfering $resource_image to $IMAGE_TRANSFER_TO_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o rw$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_TRANSFER_TO_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "custom-iscsi-storage: Starting transfer-to-nfs phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "custom-iscsi-storage: Transfer-to-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function install_rootfs_from_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE -o ro $IMAGE_INSTALL_FROM_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_LOCAL / $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "custom-iscsi-storage: Starting install-to-local phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "custom-iscsi-storage: Install-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - -function transfer_rootfs_to_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE -o rw $IMAGE_TRANSFER_TO_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_LOCAL / $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "custom-iscsi-storage: Starting transfer-to-local phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "custom-iscsi-storage: Transfer-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.custom-nfs-deployment b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.custom-nfs-deployment deleted file mode 100644 index b542fc7..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.custom-nfs-deployment +++ /dev/null @@ -1,233 +0,0 @@ -#!/bin/bash -# this is the root-mount initrd-service -# which proivdes function to mount/remount the remote -# nfs-rootfs according to the image_deployment_parameters at /mnt -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# custom-nfs-storage -# Required defines in the image_deploy_paramters -# -# -# Optional parameters -# -# IMAGE_INSTALL_FROM_NFS - can be set to an (nfs) location from -# which the image will be installed at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_TRANSFER_TO_NFS - can be set to an (nfs) location from -# which the image will be transfered to at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_INSTALL_FROM_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this -# option will install the custom-nfs-storage image on -# boot-time from the local-device -# -# IMAGE_TRANSFER_TO_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this option will transfrom -# the custom-nfs-storage image on boot-time to the local-device -# -# -# -# IMAGE_INSTALL_FROM_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_TRANSFER_TO_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_NFS_MOUNT_OPTIONS - can be e.g. set to proto=tcp for the install/transform phase -# -# get the deployment parameters from openqrm.conf -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -. $OPENQRM_RESOURCE_PARAMETER_FILE -eval $image_deployment_parameter -export OPENQRM_SERVER_BASE_DIR=$resource_basedir -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - -if [ "$IMAGE_NFS_MOUNT_OPTIONS" != "" ]; then - IMAGE_NFS_MOUNT_OPTIONS=",$IMAGE_NFS_MOUNT_OPTIONS" -fi -# default to ext3 -if [ "$IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" == "" ]; then - IMAGE_INSTALL_FROM_LOCAL_FS_TYPE="ext3" -fi -if [ "$IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" == "" ]; then - IMAGE_TRANSFER_TO_LOCAL_FS_TYPE="ext3" -fi - -# adapt the rootdevice parameters -IMAGE_ROOT_DIR=$image_rootdevice - -####################################################################### -# required functions ################################################## -####################################################################### - -function mount_rootfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - - if ! mount -t nfs -o rw,nolock$IMAGE_NFS_MOUNT_OPTIONS $image_storage_server_ip:$IMAGE_ROOT_DIR /mnt; then - echo "ERROR: Could not mount $image_storage_server_ip:$IMAGE_ROOT_DIR by nfs" - # give a shell for the admin - /bin/bash - else - echo "custom-nfs-storage: Mounted $image_storage_server_ip:$IMAGE_ROOT_DIR rw" - fi - - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - install_rootfs_from_nfs - else - echo "custom-nfs-storage: Skipping install phase" - fi - if [ "$IMAGE_TRANSFER_TO_NFS" != "" ]; then - transfer_rootfs_to_nfs - else - echo "custom-nfs-storage: Skipping transfer-to-nfs phase" - fi - if [ "$IMAGE_INSTALL_FROM_LOCAL" != "" ]; then - install_rootfs_from_local - else - echo "custom-nfs-storage: Skipping install-from-local phase" - fi - if [ "$IMAGE_TRANSFER_TO_LOCAL" != "" ]; then - transfer_rootfs_to_local - else - echo "custom-nfs-storage: Skipping transfer-to-local phase" - fi -} - - -function remount_rootfs() { - - # Debian/Ubuntu Systems want their nfs-rootfs in rw mode - if [ -f /mnt/etc/apt/sources.list ]; then - if grep ubuntu /mnt/etc/apt/sources.list >/remountlog; then - echo "custom-nfs-storage: Skipping Re-mount $image_storage_server_ip:$IMAGE_ROOT_DIR ro" - rm -f /remountlog - return - fi - fi - # remont /mnt ro - while ! mount -t nfs -o ro,remount,nolock$IMAGE_NFS_MOUNT_OPTIONS $image_storage_server_ip:$IMAGE_ROOT_DIR /mnt; do - echo -n "." - sleep 1 - REMOUNT_LOOP=$[ REMOUNT_LOOP + 1 ] - if [ "$REMOUNT_LOOP" == "10" ]; then - echo "ERROR: nfs-storage could not remount /mnt " - /bin/bash - fi - done - echo "nfs-storage: Re-mounted $image_storage_server_ip:$IMAGE_ROOT_DIR ro" - openqrm_portmap_stop - -} - - -function create_fstab() { - rm -f $IMAGE_FSTAB - echo "$image_storage_server_ip:$IMAGE_ROOT_DIR / nfs defaults 0 0" >> $IMAGE_FSTAB -} - - -####################################################################### -# optional functions ################################################## -####################################################################### - -function install_rootfs_from_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f1` - IMAGE_INSTALL_FROM_NFS=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f2-` - echo "custom-nfs-storage: Installing $resource_image from $IMAGE_INSTALL_FROM_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o ro$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_INSTALL_FROM_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "custom-nfs-storage: Starting install-from-nfs phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "custom-nfs-storage: Install-from-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function transfer_rootfs_to_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f1` - IMAGE_TRANSFER_TO_NFS=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f2-` - echo "custom-nfs-storage: Transfering $resource_image to $IMAGE_TRANSFER_TO_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o rw$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_TRANSFER_TO_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "custom-nfs-storage: Starting transfer-to-nfs phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "custom-nfs-storage: Transfer-to-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function install_rootfs_from_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE -o ro $IMAGE_INSTALL_FROM_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_LOCAL / $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "custom-nfs-storage: Starting install-to-local phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "custom-nfs-storage: Install-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - -function transfer_rootfs_to_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE -o rw $IMAGE_TRANSFER_TO_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_LOCAL / $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "custom-nfs-storage: Starting transfer-to-local phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "custom-nfs-storage: Transfer-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.lvm-aoe-deployment b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.lvm-aoe-deployment deleted file mode 100644 index 8697fd0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.lvm-aoe-deployment +++ /dev/null @@ -1,308 +0,0 @@ -#!/bin/bash -# this is the root-mount initrd-service -# which proivdes function to mount/remount the remote -# lvm-aoe-rootfs according to the image_deployment_parameters at /mnt -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# lvm-aoe-storage -# Required defines in the image_deploy_paramters -# -# -# Optional parameters -# -# IMAGE_INSTALL_FROM_NFS - can be set to an (nfs) location from -# which the image will be installed at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_TRANSFER_TO_NFS - can be set to an (nfs) location from -# which the image will be transfered to at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_INSTALL_FROM_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this -# option will install the lvm-aoe-storage image on -# boot-time from the local-device -# -# IMAGE_TRANSFER_TO_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this option will transfrom -# the lvm-aoe-storage image on boot-time to the local-device -# -# -# -# IMAGE_INSTALL_FROM_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_TRANSFER_TO_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_NFS_MOUNT_OPTIONS - can be e.g. set to proto=tcp for the install/transform phase -# - - -# get the deployment parameters from openqrm.conf -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -. $OPENQRM_RESOURCE_PARAMETER_FILE -eval $image_deployment_parameter -export OPENQRM_SERVER_BASE_DIR=$resource_basedir -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - -# nfs-options for the install+transform phase -if [ "$IMAGE_NFS_MOUNT_OPTIONS" != "" ]; then - IMAGE_NFS_MOUNT_OPTIONS=",$IMAGE_NFS_MOUNT_OPTIONS" -fi -# default to ext3 -if [ "$IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" == "" ]; then - IMAGE_INSTALL_FROM_LOCAL_FS_TYPE="ext3" -fi -if [ "$IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" == "" ]; then - IMAGE_TRANSFER_TO_LOCAL_FS_TYPE="ext3" -fi - -VOLUME_GROUP=`echo $image_rootdevice | cut -d':' -f1` -IMAGE_NAME=`echo $image_rootdevice | cut -d':' -f2` -IMAGE_ROOT_DEVICE=`echo $image_rootdevice | cut -d':' -f3` - -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - export WGET="wget --no-check-certificate -q" -else - export WGET="wget -q" -fi - -####################################################################### -# required functions ################################################## -####################################################################### - -function mount_rootfs() { - - # get aoe-interfaces via wget from the openQRM-servers boot-service dir - $WGET -O /sbin/aoe-interfaces $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/aoe-interfaces - # get the aoe-discover via wget from the openQRM-servers boot-service dir - $WGET -O /sbin/aoe-discover $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/aoe-discover - # get the aoe-stat via wget from the openQRM-servers boot-service dir - $WGET -O /sbin/aoe-stat $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/aoe-stat - # get the aoe-mkdevs via wget from the openQRM-servers boot-service dir - $WGET -O /sbin/aoe-mkdevs $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/aoe-mkdevs - # get the aoe-mkshelf via wget from the openQRM-servers boot-service dir - $WGET -O /sbin/aoe-mkshelf $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/aoe-mkshelf - chmod +x /sbin/aoe* - - # insert udev rule - mkdir -p /etc/udev - cat >> /etc/udev/rules.d/60-aoe.rules << EOF -# aoe char devices -SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k", GROUP="disk", -MODE="0220" -SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k", GROUP="disk", MODE="0440" -SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k", GROUP="disk", -MODE="0220" -SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k", GROUP="disk", -MODE="0220" -# aoe block devices -KERNEL=="etherd*", NAME="%k", GROUP="disk" - -EOF - - # load aoe related modules - mkdir /dev/etherd - modprobe aoe - - # discover - RESOURCE_INTERFACE=`ip a s | grep ^[0-9] | cut -d':' -f2 | awk '{ print $1 }' | grep ":oq"` - echo "lvm-aoe-storage: Discoverying Aoe-target $image_storage_server_ip on $RESOURCE_INTERFACE" - aoe-interfaces $RESOURCE_INTERFACE - aoe-discover - aoe-stat - - # let udev settle - sleep 4 - # let udev settle - sleep 4 - while (true); do - if [ -e "$IMAGE_ROOT_DEVICE" ]; then - echo "Udev created $IMAGE_ROOT_DEVICE" - break - else - echo -n "." - fi - sleep 1 - done - - # finallly mount - if ! mount -t $image_rootfstype $IMAGE_ROOT_DEVICE /mnt; then - # in case we install from nfs we create a fs since this should be a new lun - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - echo "NOTICE: Found install-from-nfs enabled but failed mounting the rootdevice" - echo "NOTICE: Assuming a new (unformatted) Lun -> creating $image_rootfstype filesystem on $IMAGE_ROOT_DEVICE" - mke2fs -F -j $IMAGE_ROOT_DEVICE - if ! mount -t $image_rootfstype $IMAGE_ROOT_DEVICE /mnt; then - echo "ERROR: Could not mount $IMAGE_ROOT_DEVICE via iscsi" - # give a shell for the admin - /bin/bash - else - echo "lvm-aoe-storage: Mounted $IMAGE_ROOT_DEVICE rw" - fi - else - echo "ERROR: Could not mount $IMAGE_ROOT_DEVICE via aoe" - # give a shell for the admin - /bin/bash - fi - else - echo "lvm-aoe-storage: Mounted $IMAGE_ROOT_DEVICE rw" - fi - - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - install_rootfs_from_nfs - else - echo "lvm-aoe-storage: Skipping install-to-nfs phase" - fi - if [ "$IMAGE_TRANSFER_TO_NFS" != "" ]; then - transfer_rootfs_to_nfs - else - echo "lvm-aoe-storage: Skipping transfer-to-nfs phase" - fi - if [ "$IMAGE_INSTALL_FROM_LOCAL" != "" ]; then - install_rootfs_from_local - else - echo "lvm-aoe-storage: Skipping install-from-local phase" - fi - if [ "$IMAGE_TRANSFER_TO_LOCAL" != "" ]; then - transfer_rootfs_to_local - else - echo "lvm-aoe-storage: Skipping transfer-to-local phase" - fi - -} - - -function remount_rootfs() { - # Debian/Ubuntu Systems want their nfs-rootfs in rw mode - if [ -f /mnt/etc/apt/sources.list ]; then - if grep ubuntu /mnt/etc/apt/sources.list >/remountlog; then - echo "lvm-aoe-storage: Skipping Re-mount $IMAGE_ROOT_DEVICE ro" - rm -f /remountlog - return - fi - fi - REMOUNT_LOOP=0 - # remont /mnt ro - while ! mount -t $image_rootfstype -o ro,remount $IMAGE_ROOT_DEVICE /mnt; do - echo -n "." - sleep 1 - REMOUNT_LOOP=$[ REMOUNT_LOOP + 1 ] - if [ "$REMOUNT_LOOP" == "10" ]; then - echo "ERROR: lvm-aoe-storage could not remount /mnt " - /bin/bash - fi - done - echo "lvm-aoe-storage: Re-mounted $IMAGE_ROOT_DEVICE ro" - -} - - -function create_fstab() { - rm -f $IMAGE_FSTAB - echo "$IMAGE_ROOT_DEVICE / $image_rootfstype defaults 0 0" >> $IMAGE_FSTAB -} - - -####################################################################### -# optional functions ################################################## -####################################################################### - -function install_rootfs_from_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f1` - IMAGE_INSTALL_FROM_NFS=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f2-` - echo "lvm-aoe-storage: Installing $resource_image from $IMAGE_INSTALL_FROM_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o ro$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_INSTALL_FROM_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "lvm-aoe-storage: Starting install-from-nfs phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "lvm-aoe-storage: Install-from-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function transfer_rootfs_to_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f1` - IMAGE_TRANSFER_TO_NFS=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f2-` - echo "lvm-aoe-storage: Transfering $resource_image to $IMAGE_TRANSFER_TO_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o rw$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_TRANSFER_TO_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "lvm-aoe-storage: Starting transfer-to-nfs phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "lvm-aoe-storage: Transfer-to-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - - - -function install_rootfs_from_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE -o ro $IMAGE_INSTALL_FROM_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_LOCAL / $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "lvm-aoe-storage: Starting install-from-local phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "lvm-aoe-storage: Install-from-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - -function transfer_rootfs_to_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE -o rw $IMAGE_TRANSFER_TO_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_LOCAL / $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "lvm-aoe-storage: Starting transfer-to-local phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "lvm-aoe-storage: Transfer-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.lvm-iscsi-deployment b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.lvm-iscsi-deployment deleted file mode 100644 index 30daa3a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.lvm-iscsi-deployment +++ /dev/null @@ -1,357 +0,0 @@ -#!/bin/bash -# this is the root-mount initrd-service -# which proivdes function to mount/remount the remote -# lvm-iscsi-rootfs according to the image_deployment_parameters at /mnt -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# lvm-iscsi-storage -# Required defines in the image_deploy_paramters -# -# -# Optional parameters -# -# IMAGE_INSTALL_FROM_NFS - can be set to an (nfs) location from -# which the image will be installed at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_TRANSFER_TO_NFS - can be set to an (nfs) location from -# which the image will be transfered to at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_INSTALL_FROM_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this -# option will install the lvm-iscsi-storage image on -# boot-time from the local-device -# -# IMAGE_TRANSFER_TO_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this option will transfrom -# the lvm-iscsi-storage image on boot-time to the local-device -# -# -# -# IMAGE_INSTALL_FROM_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_TRANSFER_TO_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_NFS_MOUNT_OPTIONS - can be e.g. set to proto=tcp for the install/transform phase -# -# -# get the deployment parameters from openqrm.conf -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -. $OPENQRM_RESOURCE_PARAMETER_FILE -eval $image_deployment_parameter -export OPENQRM_SERVER_BASE_DIR=$resource_basedir -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - -# nfs-options for the install+transform phase -if [ "$IMAGE_NFS_MOUNT_OPTIONS" != "" ]; then - IMAGE_NFS_MOUNT_OPTIONS=",$IMAGE_NFS_MOUNT_OPTIONS" -fi -# default to ext3 -if [ "$IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" == "" ]; then - IMAGE_INSTALL_FROM_LOCAL_FS_TYPE="ext3" -fi -if [ "$IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" == "" ]; then - IMAGE_TRANSFER_TO_LOCAL_FS_TYPE="ext3" -fi - -# here we gather the target name + lun from the image_rootdevice -VOLUME_GROUP=`echo $image_rootdevice | cut -d':' -f1` -IMAGE_ROOTDEVICE=`echo $image_rootdevice | cut -d':' -f2` -IMAGE_TARGET=`echo $IMAGE_ROOTDEVICE | cut -d'/' -f3` -IMAGE_LUN=`echo $IMAGE_ROOTDEVICE | cut -d'/' -f4` - -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - export WGET="wget --no-check-certificate -q" -else - export WGET="wget -q" -fi - -####################################################################### -# required functions ################################################## -####################################################################### - -function mount_rootfs() { - - # check to find the right binaries fitting to kernel + rootfs - if [ "$kernel_name" == "default" ]; then - # we get the default binaries - # get iscsid via wget from the openQRM-servers boot-service dir - $WGET -O /sbin/iscsid $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsid - $WGET -O /sbin/iscsiadm $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsiadm - else - # we try to get the binaries fitting to the kernel name - # -> if a special version is not available we go with the default - if ! $WGET -O /sbin/iscsid $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsid.$kernel_name; then - $WGET -O /sbin/iscsid $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsid - fi - if ! $WGET -O /sbin/iscsiadm $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsiadm.$kernel_name; then - $WGET -O /sbin/iscsiadm $openqrm_web_protocol://$resource_openqrmserver/openqrm/boot-service/iscsiadm - fi - - fi - chmod +x /sbin/iscsi* - mkdir -p /tmp - - # load iscsi related modules - modprobe iscsi_tcp - modprobe libiscsi - modprobe scsi_transport_iscsi - modprobe scsi_mod - modprobe sg - modprobe sd_mod - modprobe ib_iser - - # create config /etc/iscsi/iscsid.conf - mkdir -p /etc/iscsi/ - cat >> /etc/iscsi/iscsid.conf << EOF -node.startup = manual -node.session.timeo.replacement_timeout = 120 -node.conn[0].timeo.login_timeout = 15 -node.conn[0].timeo.logout_timeout = 15 -node.conn[0].timeo.noop_out_interval = 10 -node.conn[0].timeo.noop_out_timeout = 15 -node.session.iscsi.InitialR2T = No -node.session.iscsi.ImmediateData = Yes -node.session.iscsi.FirstBurstLength = 262144 -node.session.iscsi.MaxBurstLength = 16776192 -node.conn[0].iscsi.MaxRecvDataSegmentLength = 65536 - -node.session.auth.authmethod = CHAP -node.session.auth.username = $IMAGE_TARGET -node.session.auth.password = $IMAGE_ISCSI_AUTH - -EOF - - # create /etc/iscsi/initiatorname.iscsi - cat >> /etc/iscsi/initiatorname.iscsi << EOF -InitiatorName=iqn.1993-08.org.debian:01:31721e7e6b8f -EOF - # also create /etc/initiatorname.iscsi, some open-iscsi version looking for that - cp /etc/iscsi/initiatorname.iscsi /etc/initiatorname.iscsi - - # start syslog + klogd - syslogd & - klogd& - - # start iscsid - /sbin/iscsid & - sleep 2 - - # discover - echo "lvm-iscsi-storage: Discoverying Iscsi-target $image_storage_server_ip:3260" - iscsiadm -m discovery -t sendtargets -p $image_storage_server_ip:3260 - - # login - iscsiadm -m node -T $IMAGE_TARGET -p $image_storage_server_ip:3260 --login - - # let udev settle - sleep 4 - - # check that udev found the new device - FIND_ISCSI_BLOCK_DEVICE=`find /sys/class/iscsi_session/session*/device/target*/*/ -name block | head -n1` - if [ "$FIND_ISCSI_BLOCK_DEVICE" == "" ]; then - FIND_ISCSI_BLOCK_DEVICE=`find /sys/class/iscsi_session/session*/device/target*/*/ -name block:s* | head -n1` - if [ "$FIND_ISCSI_BLOCK_DEVICE" == "" ]; then - echo "ERROR: Udev did not detect the new device" - echo "ERROR: Could not look-up the Iscsi device in the sys-fs dir" - # give a shell for the admin - /bin/bash - fi - fi - # check for different sysfs styles - if [ -h $FIND_ISCSI_BLOCK_DEVICE ]; then - ISCSI_BLOCK_DEVICE_NAME=`readlink $FIND_ISCSI_BLOCK_DEVICE` - ISCSI_BLOCK_DEVICE_NAME=`basename $ISCSI_BLOCK_DEVICE_NAME` - echo "SUCCESS: Found $ISCSI_BLOCK_DEVICE_NAME in sys-fs (as symlink)" - elif [ -d $FIND_ISCSI_BLOCK_DEVICE ]; then - ISCSI_BLOCK_DEVICE_NAME=`ls $FIND_ISCSI_BLOCK_DEVICE` - echo "SUCCESS: Found $ISCSI_BLOCK_DEVICE_NAME in sys-fs (as dir)" - else - echo "ERROR: Udev did not detect the new device" - echo "ERROR: Could not look-up the Iscsi device in the sys-fs dir" - # give a shell for the admin - /bin/bash - fi - # export the blockdevice name for the further functions - export ISCSI_BLOCK_DEVICE="/dev/$ISCSI_BLOCK_DEVICE_NAME" - - # finallly mount - if ! mount -t $image_rootfstype $ISCSI_BLOCK_DEVICE /mnt; then - # in case we install from nfs we create a fs since this should be a new lun - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - echo "NOTICE: Found install-from-nfs enabled but failed mounting the rootdevice" - echo "NOTICE: Assuming a new (unformatted) Lun -> creating $image_rootfstype filesystem on $ISCSI_BLOCK_DEVICE" - mke2fs -F -j $ISCSI_BLOCK_DEVICE - if ! mount -t $image_rootfstype $ISCSI_BLOCK_DEVICE /mnt; then - echo "ERROR: Could not mount $ISCSI_BLOCK_DEVICE via iscsi" - # give a shell for the admin - /bin/bash - else - echo "lvm-iscsi-storage: Mounted $ISCSI_BLOCK_DEVICE rw" - fi - else - echo "ERROR: Could not mount $ISCSI_BLOCK_DEVICE via iscsi" - # give a shell for the admin - /bin/bash - fi - else - echo "lvm-iscsi-storage: Mounted $ISCSI_BLOCK_DEVICE rw" - fi - - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - install_rootfs_from_nfs - else - echo "lvm-iscsi-storage: Skipping install phase" - fi - if [ "$IMAGE_TRANSFER_TO_NFS" != "" ]; then - transfer_rootfs_to_nfs - else - echo "lvm-iscsi-storage: Skipping transfer-to-nfs phase" - fi - if [ "$IMAGE_INSTALL_FROM_LOCAL" != "" ]; then - install_rootfs_from_local - else - echo "lvm-iscsi-storage: Skipping install-from-local phase" - fi - if [ "$IMAGE_TRANSFER_TO_LOCAL" != "" ]; then - transfer_rootfs_to_local - else - echo "lvm-iscsi-storage: Skipping transfer-to-local phase" - fi - -} - - -function remount_rootfs() { - # Debian/Ubuntu Systems want their nfs-rootfs in rw mode - if [ -f /mnt/etc/apt/sources.list ]; then - if grep ubuntu /mnt/etc/apt/sources.list >/remountlog; then - echo "lvm-iscsi-storage: Skipping Re-mount $ISCSI_BLOCK_DEVICE ro" - rm -f /remountlog - return - fi - fi - REMOUNT_LOOP=0 - # remont /mnt ro - while ! mount -t $image_rootfstype -o ro,remount $ISCSI_BLOCK_DEVICE /mnt; do - echo -n "." - sleep 1 - REMOUNT_LOOP=$[ REMOUNT_LOOP + 1 ] - if [ "$REMOUNT_LOOP" == "10" ]; then - echo "ERROR: lvm-iscsi-storage could not remount /mnt " - /bin/bash - fi - done - echo "lvm-iscsi-storage: Re-mounted $ISCSI_BLOCK_DEVICE ro" - -} - - -function create_fstab() { - rm -f $IMAGE_FSTAB - echo "$ISCSI_BLOCK_DEVICE / $image_rootfstype defaults 0 0" >> $IMAGE_FSTAB -} - - -####################################################################### -# optional functions ################################################## -####################################################################### - -function install_rootfs_from_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f1` - IMAGE_INSTALL_FROM_NFS=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f2-` - echo "lvm-iscsi-storage: Installing $resource_image from $IMAGE_INSTALL_FROM_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o ro$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_INSTALL_FROM_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "lvm-iscsi-storage: Starting install-from-nfs phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "lvm-iscsi-storage: Install-from-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function transfer_rootfs_to_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f1` - IMAGE_TRANSFER_TO_NFS=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f2-` - echo "lvm-iscsi-storage: Transfering $resource_image to $IMAGE_TRANSFER_TO_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o rw$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_TRANSFER_TO_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "lvm-iscsi-storage: Starting transfer-to-nfs phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "lvm-iscsi-storage: Transfer-to-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function install_rootfs_from_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE -o ro $IMAGE_INSTALL_FROM_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_LOCAL / $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "lvm-iscsi-storage: Starting install-to-local phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "lvm-iscsi-storage: Install-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - -function transfer_rootfs_to_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE -o rw $IMAGE_TRANSFER_TO_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_LOCAL / $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "lvm-iscsi-storage: Starting transfer-to-local phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "lvm-iscsi-storage: Transfer-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.lvm-nfs-deployment b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.lvm-nfs-deployment deleted file mode 100644 index 547a934..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/root-mount.lvm-nfs-deployment +++ /dev/null @@ -1,233 +0,0 @@ -#!/bin/bash -# this is the root-mount initrd-service -# which proivdes function to mount/remount the remote -# nfs-rootfs according to the image_deployment_parameters at /mnt -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# lvm-nfs-storage -# Required defines in the image_deploy_paramters -# -# -# Optional parameters -# -# IMAGE_INSTALL_FROM_NFS - can be set to an (nfs) location from -# which the image will be installed at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_TRANSFER_TO_NFS - can be set to an (nfs) location from -# which the image will be transfered to at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_INSTALL_FROM_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this -# option will install the lvm-nfs-storage image on -# boot-time from the local-device -# -# IMAGE_TRANSFER_TO_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this option will transfrom -# the lvm-nfs-storage image on boot-time to the local-device -# -# -# -# IMAGE_INSTALL_FROM_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_TRANSFER_TO_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_NFS_MOUNT_OPTIONS - can be e.g. set to proto=tcp for the install/transform phase -# -# get the deployment parameters from openqrm.conf -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -. $OPENQRM_RESOURCE_PARAMETER_FILE -eval $image_deployment_parameter -export OPENQRM_SERVER_BASE_DIR=$resource_basedir -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - -if [ "$IMAGE_NFS_MOUNT_OPTIONS" != "" ]; then - IMAGE_NFS_MOUNT_OPTIONS=",$IMAGE_NFS_MOUNT_OPTIONS" -fi -# default to ext3 -if [ "$IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" == "" ]; then - IMAGE_INSTALL_FROM_LOCAL_FS_TYPE="ext3" -fi -if [ "$IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" == "" ]; then - IMAGE_TRANSFER_TO_LOCAL_FS_TYPE="ext3" -fi - -# adapt the rootdevice parameters -IMAGE_ROOT_DIR=$image_rootdevice - -####################################################################### -# required functions ################################################## -####################################################################### - -function mount_rootfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - - if ! mount -t nfs -o rw,nolock$IMAGE_NFS_MOUNT_OPTIONS $image_storage_server_ip:$IMAGE_ROOT_DIR /mnt; then - echo "ERROR: Could not mount $image_storage_server_ip:$IMAGE_ROOT_DIR by nfs" - # give a shell for the admin - /bin/bash - else - echo "nfs-storage: Mounted $image_storage_server_ip:$IMAGE_ROOT_DIR rw" - fi - - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - install_rootfs_from_nfs - else - echo "lvm-nfs-storage: Skipping install phase" - fi - if [ "$IMAGE_TRANSFER_TO_NFS" != "" ]; then - transfer_rootfs_to_nfs - else - echo "lvm-nfs-storage: Skipping transfer-to-nfs phase" - fi - if [ "$IMAGE_INSTALL_FROM_LOCAL" != "" ]; then - install_rootfs_from_local - else - echo "lvm-nfs-storage: Skipping install-from-local phase" - fi - if [ "$IMAGE_TRANSFER_TO_LOCAL" != "" ]; then - transfer_rootfs_to_local - else - echo "lvm-nfs-storage: Skipping transfer-to-local phase" - fi -} - - -function remount_rootfs() { - - # Debian/Ubuntu Systems want their nfs-rootfs in rw mode - if [ -f /mnt/etc/apt/sources.list ]; then - if grep ubuntu /mnt/etc/apt/sources.list >/remountlog; then - echo "lvm-nfs-storage: Skipping Re-mount $image_storage_server_ip:$IMAGE_ROOT_DIR ro" - rm -f /remountlog - return - fi - fi - # remont /mnt ro - while ! mount -t nfs -o ro,remount,nolock$IMAGE_NFS_MOUNT_OPTIONS $image_storage_server_ip:$IMAGE_ROOT_DIR /mnt; do - echo -n "." - sleep 1 - REMOUNT_LOOP=$[ REMOUNT_LOOP + 1 ] - if [ "$REMOUNT_LOOP" == "10" ]; then - echo "ERROR: nfs-storage could not remount /mnt " - /bin/bash - fi - done - echo "nfs-storage: Re-mounted $image_storage_server_ip:$IMAGE_ROOT_DIR ro" - openqrm_portmap_stop - -} - - -function create_fstab() { - rm -f $IMAGE_FSTAB - echo "$image_storage_server_ip:$IMAGE_ROOT_DIR / nfs defaults 0 0" >> $IMAGE_FSTAB -} - - -####################################################################### -# optional functions ################################################## -####################################################################### - -function install_rootfs_from_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f1` - IMAGE_INSTALL_FROM_NFS=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f2-` - echo "lvm-nfs-storage: Installing $resource_image from $IMAGE_INSTALL_FROM_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o ro$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_INSTALL_FROM_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "lvm-nfs-storage: Starting install-from-nfs phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "lvm-nfs-storage: Install-from-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function transfer_rootfs_to_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f1` - IMAGE_TRANSFER_TO_NFS=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f2-` - echo "lvm-nfs-storage: Transfering $resource_image to $IMAGE_TRANSFER_TO_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o rw$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_TRANSFER_TO_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "lvm-nfs-storage: Starting transfer-to-nfs phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "lvm-nfs-storage: Transfer-to-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function install_rootfs_from_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE -o ro $IMAGE_INSTALL_FROM_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_LOCAL / $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "lvm-nfs-storage: Starting install-to-local phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "lvm-nfs-storage: Install-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - -function transfer_rootfs_to_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE -o rw $IMAGE_TRANSFER_TO_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_LOCAL / $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "lvm-nfs-storage: Starting transfer-to-local phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "lvm-nfs-storage: Transfer-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-about-bootservice.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-about-bootservice.tpl.php deleted file mode 100644 index ec1111b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-about-bootservice.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    - -
    -
    -

    {boot_service_title}

    - {boot_service_content} -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-about-documentation.tpl.php deleted file mode 100644 index 820bb5a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-about-documentation.tpl.php +++ /dev/null @@ -1,47 +0,0 @@ - -

    {label}

    - -
    -
    -

    {introduction_title}

    - {introduction_content} - -

    {provides_title}

    - {provides_list} - -

    {requirements_title}

    - {requirements_list} - - -
    -
    -

    {type_title}

    - {type_content} - -

    {deployment_title}

    - {deployment_content} - -

    {tested_title}

    - {tested_content} - -
    -
    - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-add.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-add.tpl.php deleted file mode 100644 index a4f5098..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-add.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    -
    -
    - {form} - {name} - {size} -
    {submit} {cancel}
    -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-clone.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-clone.tpl.php deleted file mode 100644 index 44a8a00..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-clone.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    - -
    -{form} -
    - {name} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-custom.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-custom.tpl.php deleted file mode 100644 index 71fc7fc..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-custom.tpl.php +++ /dev/null @@ -1,31 +0,0 @@ - -

    {label}

    -
    -
    -
    {lang_id}: {id}
    -
    {lang_name}: {name}
    -
    {lang_resource}: {resource}
    -
    {lang_deployment}: {deployment}
    -
    {lang_state}: {state}
    -
    -
    -
    {add}
    -
    -
     
    - {table} -
    diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-customadd.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-customadd.tpl.php deleted file mode 100644 index 5af9cdb..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-customadd.tpl.php +++ /dev/null @@ -1,30 +0,0 @@ - -

    {label}

    -
    -
    - {form} - {name} - {target} - {lun} - {initiator} - {username} - {password} - {export} -
    {submit} {cancel}
    -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-customremove.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-customremove.tpl.php deleted file mode 100644 index b11c36e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-customremove.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ - -

    {label}

    -
    -
    - {form} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-edit.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-edit.tpl.php deleted file mode 100644 index 71fc7fc..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-edit.tpl.php +++ /dev/null @@ -1,31 +0,0 @@ - -

    {label}

    -
    -
    -
    {lang_id}: {id}
    -
    {lang_name}: {name}
    -
    {lang_resource}: {resource}
    -
    {lang_deployment}: {deployment}
    -
    {lang_state}: {state}
    -
    -
    -
    {add}
    -
    -
     
    - {table} -
    diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-remove.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-remove.tpl.php deleted file mode 100644 index b11c36e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-remove.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ - -

    {label}

    -
    -
    - {form} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-resize.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-resize.tpl.php deleted file mode 100644 index 4276209..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-resize.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    -
    -
    - {form} - {size} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-select.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-select.tpl.php deleted file mode 100644 index bd68de0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-select.tpl.php +++ /dev/null @@ -1,18 +0,0 @@ - -

    {label}

    -{table} diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-snap.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-snap.tpl.php deleted file mode 100644 index 4744c8b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-snap.tpl.php +++ /dev/null @@ -1,26 +0,0 @@ - -

    {label}

    - -
    -{form} -
    - {name} - {size} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-volgroup.tpl.php b/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-volgroup.tpl.php deleted file mode 100644 index 545ee79..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lvm-storage/web/tpl/lvm-storage-volgroup.tpl.php +++ /dev/null @@ -1,40 +0,0 @@ - -

    {label}

    - -
    -
    -
    {lang_id}: {id}
    -
    {lang_name}: {name}
    -
    {lang_resource}: {resource}
    -
    {lang_deployment}: {deployment}
    -
    {lang_state}: {state}
    -
    - -
    -
    {lang_name}: {volgroup_name}
    -
    {lang_attr}: {volgroup_attr}
    -
    {lang_pv}: {volgroup_pv} / {volgroup_lv} / {volgroup_sn}
    -
    {lang_size}: {volgroup_vsize} / {volgroup_vfree}
    -
    - -
    -
    {add}
    -
    -
     
    - {table} -
    diff --git a/openQRM-5.3.50-CE/src/plugins/lxc/Makefile b/openQRM-5.3.50-CE/src/plugins/lxc/Makefile deleted file mode 100644 index 6572d55..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lxc/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/lxc/etc - cp etc/openqrm-plugin-lxc.conf /usr/share/openqrm/plugins/lxc/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/lxc/etc/openqrm-plugin-lxc.conf b/openQRM-5.3.50-CE/src/plugins/lxc/etc/openqrm-plugin-lxc.conf deleted file mode 100644 index d5b084b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/lxc/etc/openqrm-plugin-lxc.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Integrates LXC Linux Containers as a lightweight container based Virtualization technology.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="virtualization" diff --git a/openQRM-5.3.50-CE/src/plugins/magento/Makefile b/openQRM-5.3.50-CE/src/plugins/magento/Makefile deleted file mode 100644 index 8ea5d05..0000000 --- a/openQRM-5.3.50-CE/src/plugins/magento/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/magento/etc - cp etc/openqrm-plugin-magento.conf /usr/share/openqrm/plugins/magento/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/magento/etc/openqrm-plugin-magento.conf b/openQRM-5.3.50-CE/src/plugins/magento/etc/openqrm-plugin-magento.conf deleted file mode 100644 index c9118c4..0000000 --- a/openQRM-5.3.50-CE/src/plugins/magento/etc/openqrm-plugin-magento.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Connect openQRM Cloud to a Magento E-Commerce systems (Magento).
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="cloud" diff --git a/openQRM-5.3.50-CE/src/plugins/mantis/Makefile b/openQRM-5.3.50-CE/src/plugins/mantis/Makefile deleted file mode 100644 index faf30b9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/mantis/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/mantis/etc - cp etc/openqrm-plugin-mantis.conf /usr/share/openqrm/plugins/mantis/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/mantis/etc/openqrm-plugin-mantis.conf b/openQRM-5.3.50-CE/src/plugins/mantis/etc/openqrm-plugin-mantis.conf deleted file mode 100644 index eee956f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/mantis/etc/openqrm-plugin-mantis.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Connect openQRM Cloud to a Mantis BugTracker systems (Mantis).
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="cloud" diff --git a/openQRM-5.3.50-CE/src/plugins/marketplace/Makefile b/openQRM-5.3.50-CE/src/plugins/marketplace/Makefile deleted file mode 100644 index b6f0680..0000000 --- a/openQRM-5.3.50-CE/src/plugins/marketplace/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/marketplace/etc - cp etc/openqrm-plugin-marketplace.conf /usr/share/openqrm/plugins/marketplace/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/marketplace/etc/openqrm-plugin-marketplace.conf b/openQRM-5.3.50-CE/src/plugins/marketplace/etc/openqrm-plugin-marketplace.conf deleted file mode 100644 index 5adb90f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/marketplace/etc/openqrm-plugin-marketplace.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="SaaS Marketplace for the openQRM Cloud.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="cloud" diff --git a/openQRM-5.3.50-CE/src/plugins/nagios4/Makefile b/openQRM-5.3.50-CE/src/plugins/nagios4/Makefile deleted file mode 100644 index fed967f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nagios4/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/nagios4/etc - cp etc/openqrm-plugin-nagios4.conf /usr/share/openqrm/plugins/nagios4/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/nagios4/etc/openqrm-plugin-nagios4.conf b/openQRM-5.3.50-CE/src/plugins/nagios4/etc/openqrm-plugin-nagios4.conf deleted file mode 100644 index 438dd05..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nagios4/etc/openqrm-plugin-nagios4.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Monitor Systems and Services with Nagios.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="monitoring" diff --git a/openQRM-5.3.50-CE/src/plugins/netbond/Makefile b/openQRM-5.3.50-CE/src/plugins/netbond/Makefile deleted file mode 100644 index 6832d9d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/netbond/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/netbond/etc - cp etc/openqrm-plugin-netbond.conf /usr/share/openqrm/plugins/netbond/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/netbond/etc/openqrm-plugin-netbond.conf b/openQRM-5.3.50-CE/src/plugins/netbond/etc/openqrm-plugin-netbond.conf deleted file mode 100644 index 032cdb2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/netbond/etc/openqrm-plugin-netbond.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Consolidate (bond) network interfaces (network-deployment).
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="network" diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/Makefile b/openQRM-5.3.50-CE/src/plugins/network-manager/Makefile deleted file mode 100644 index 65337c2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# this is the openQRM network-manager-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/network-manager* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/tpl/ - . $(OPENQRM_SERVER_CONF) && chmod 777 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/lang/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/bin/openqrm* - . $(OPENQRM_SERVER_CONF) && tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager -czvf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/boot-service-network-manager.tgz include/ bin/ etc/init.d/network-manager - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/network-manager - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/network-manager/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/bin/openqrm-network-manager b/openQRM-5.3.50-CE/src/plugins/network-manager/bin/openqrm-network-manager deleted file mode 100644 index ffdaeaf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/bin/openqrm-network-manager +++ /dev/null @@ -1,511 +0,0 @@ -#!/bin/bash -# this script automatically manages network devices -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/include/openqrm-plugin-network-manager-functions -OPENQRM_POSTENCODE="$OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-postencode" -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - OPENQRM_SERVER_IP=$resource_openqrmserver - OPENQRM_EXEC_PORT=$resource_execdport -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS - resource_id=0 - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL -fi -export LANG=C -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - -# deps installed ? -# screen -if ! openqrm_full_fill_os_dependency screen screen; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi -# wget -if ! openqrm_full_fill_os_dependency wget wget; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi -# procmail for lockfile -if ! openqrm_full_fill_os_dependency lockfile procmail; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi -# bridge-utils -if ! openqrm_full_fill_os_dependency brctl bridge-utils; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi -# iptables -if ! openqrm_full_fill_os_dependency iptables iptables; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi -# dnsmasq -if ! openqrm_full_fill_os_dependency dnsmasq dnsmasq; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi -if [ -f /etc/debian_version ]; then - # vlan - if ! openqrm_full_fill_os_dependency vconfig vlan; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 - fi -elif [ -f /etc/redhat-release ]; then - # vlan - if ! openqrm_full_fill_os_dependency vconfig vconfig; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 - fi -elif [ -f /etc/SuSE-release ]; then - # vlan - if ! openqrm_full_fill_os_dependency vconfig vlan; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 - fi -fi -# load vlan kernel module -modprobe 8021q - - -function network_manager_usage() { - echo "Usage : $0 post_config <-u username> <-p password>" - echo " $0 add_br <-b bridge-name> <-n network-card> <-i brige_ip> <-s brige_subnet> <-u username> <-p password> [-f bridge-fd ] [-h brige_hello] [-a brige_maxage] [-t brige_stp] [-m brige_mac] [-g brige_gateway] [-df dnsmasq_first_ip ] [-dl dnsmasq_last_ip ] [-v VLAN ID]" - echo " $0 remove_br <-b bridge-name> <-u username> <-p password>" - echo "" - echo "Optional parameters:" - echo " [--openqrm-ui-user ]" - echo " [--openqrm-internal-cmd ]" - echo " [--openqrm-cmd-mode ]" - exit 1 -} - -FULL_COMMANDLINE="$0 $@" -NETWORK_MANAGER_MANAGER_COMMAND=$1 -shift - -while [ $# -ne 0 ]; do - case "$1" in - -n) - NETWORK_CARD=$2 - shift - ;; - -b) - NETWORK_BRIDGE_NAME=$2 - shift - ;; - -f) - NETWORK_BRIDGE_FD=$2 - shift - ;; - -h) - NETWORK_BRIDGE_HELLO=$2 - shift - ;; - -a) - NETWORK_BRIDGE_MAXAGE=$2 - shift - ;; - -t) - NETWORK_BRIDGE_STP=$2 - shift - ;; - -m) - NETWORK_BRIDGE_MAC=$2 - shift - ;; - -i) - NETWORK_BRIDGE_IP_ADDRESS=$2 - shift - ;; - -s) - NETWORK_BRIDGE_SUBNETMASK=$2 - shift - ;; - -g) - NETWORK_BRIDGE_GATEWAY=$2 - shift - ;; - -v) - NETWORK_BRIDGE_VLAN=$2 - shift - ;; - -df) - NETWORK_BRIDGE_DNSMASQ_IP_FIRST=$2 - shift - ;; - -dl) - NETWORK_BRIDGE_DNSMASQ_IP_LAST=$2 - shift - ;; - -u) - NETWORK_MANAGER_OPENQRM_USERNAME=$2 - shift - ;; - -p) - NETWORK_MANAGER_OPENQRM_PASSWORD=$2 - shift - ;; - --openqrm-ui-user) - OPENQRM_UI_USER=$2 - shift - ;; - --openqrm-internal-cmd) - OPENQRM_INTERNAL_CMD=$2 - shift - ;; - --openqrm-cmd-mode) - OPENQRM_CMD_MODE=$2 - shift - ;; - *) - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - echo "ERROR: Free commandline arguments are not allowed" - network_manager_manager_usage - exit 6 - ;; - esac - shift -done - -if [ "$OPENQRM_UI_USER" != "" ]; then - OPENQRM_UI_USER_PARAMETER=" --openqrm-ui-user $OPENQRM_UI_USER" -fi - -# main -case "$NETWORK_MANAGER_MANAGER_COMMAND" in - - post_config) - LOCK_TIME=`openqrm_lock_queue aquire network-manager` - trap "openqrm_lock_queue release network-manager $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - TMP_CONFIG=`mktemp /tmp/network-manager.XXXXXX` - SYSTEM_STATUS_TMP=$resource_id.network_config - > $SYSTEM_STATUS_TMP - ALL_NET_DEV_LIST="" - for NET_DEV in `ip a s | grep ^[0-9] | cut -d':' -f2 | awk '{ print $1 }' | grep -v lo`; do - ALL_NET_DEV_LIST="$ALL_NET_DEV_LIST $NET_DEV" - if brctl show | tail -n+2 | awk '{ print $1 }' | grep -w $NET_DEV 1>/dev/null; then - ATTACHED_TO=`brctl show | tail -n+2 | grep -w $NET_DEV | awk '{ print $4 }'` - BRIDGE_MAC=`ip a s $NET_DEV | grep -w $NET_DEV$ | grep "link/ether" | awk '{ print $2 }' | tr "[:upper:]" "[:lower:]"` - BRIDGE_IP_LIST=`get_ip_list_for_dev $NET_DEV` - echo "b@$NET_DEV@$BRIDGE_MAC@$BRIDGE_IP_LIST@$ATTACHED_TO" >> $SYSTEM_STATUS_TMP - else - NET_DEV_MAC=`ip a s $NET_DEV | grep -w $NET_DEV$ | grep "link/ether" | awk '{ print $2 }' | tr "[:upper:]" "[:lower:]"` - NET_DEV_IP_LIST=`get_ip_list_for_dev $NET_DEV` - echo "n@$NET_DEV@$NET_DEV_MAC@$NET_DEV_IP_LIST" >> $SYSTEM_STATUS_TMP - fi - done - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$NETWORK_MANAGER_OPENQRM_USERNAME --http-password=$NETWORK_MANAGER_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $SYSTEM_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/network-manager/network-manager-action.php?network_manager_command=get_network_config; then - openqrm_post_event 0 "post_vg" 2 "openqrm-network-manager" "Could not post the device list to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $SYSTEM_STATUS_TMP $SYSTEM_STATUS_TMP.post - - openqrm_lock_queue release network-manager $LOCK_TIME - trap '' EXIT - ;; - - add_br) - RETURN_CODE=0 - RETURN_MSG="" - if [ "$NETWORK_BRIDGE_NAME" == "" ] || [ "$NETWORK_CARD" == "" ] || [ "$NETWORK_BRIDGE_IP_ADDRESS" == "" ] || [ "$NETWORK_BRIDGE_SUBNETMASK" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - network_manager_usage - fi - if `brctl show | tail -n+2 | grep -w $NETWORK_BRIDGE_NAME 1>/dev/null`; then - RETURN_CODE=1 - RETURN_MSG="Network bridge $NETWORK_BRIDGE_NAME already exists on resource $resource_id." - openqrm_post_event 0 "add_br" 3 "openqrm-network-manager" "$RETURN_MSG" - fi - # if the bridge-ports nic has already the same ip as the new vlan nic - if [ "$NETWORK_BRIDGE_VLAN" != "" ] && [ "$NETWORK_BRIDGE_VLAN" != "0" ]; then - NETWORK_CARD_CONFIG=`get_ip_list_for_dev $NETWORK_CARD` - NETWORK_CARD_IP_ADDRESS=`echo $NETWORK_CARD_CONFIG | cut -d'/' -f1` - if [ "$NETWORK_CARD_IP_ADDRESS" == "$NETWORK_BRIDGE_IP_ADDRESS" ]; then - openqrm_post_event 0 "add_br" 2 "openqrm-network-manager" "IP Address $NETWORK_BRIDGE_IP_ADDRESS already in use by $NETWORK_CARD on resource $resource_id." - RETURN_CODE=1 - RETURN_MSG="IP Address $NETWORK_BRIDGE_IP_ADDRESS already in use by $NETWORK_CARD on resource $resource_id." - fi - fi - - LOCK_TIME=`openqrm_lock_queue aquire network-manager` - trap "openqrm_lock_queue release network-manager $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - openqrm_save_network_config - if [ "$RETURN_CODE" == 0 ]; then - if [ "$NETWORK_CARD" != "" ]; then - ifdown $NETWORK_CARD - fi - openqrm_add_interface bridge"@"$NETWORK_BRIDGE_NAME"@"$NETWORK_CARD"@"$NETWORK_BRIDGE_FD"@"$NETWORK_BRIDGE_HELLO"@"$NETWORK_BRIDGE_MAXAGE"@"$NETWORK_BRIDGE_STP"@"$NETWORK_BRIDGE_MAC"@"$NETWORK_BRIDGE_IP_ADDRESS"@"$NETWORK_BRIDGE_SUBNETMASK"@"$NETWORK_BRIDGE_GATEWAY"@"$NETWORK_BRIDGE_VLAN"@" - ifdown $NETWORK_BRIDGE_NAME 2>/dev/null - if [ "$NETWORK_CARD" != "" ]; then - ifup $NETWORK_CARD - fi - # bring up the new bridge - if ! ifup $NETWORK_BRIDGE_NAME; then - openqrm_rollback_network_config - ifconfig $NETWORK_BRIDGE_NAME down - brctl delbr $NETWORK_BRIDGE_NAME - if [ "$NETWORK_CARD" != "" ]; then - ifup $NETWORK_CARD - fi - openqrm_post_event 0 "add_br" 2 "openqrm-network-manager" "Error activating bridge $NETWORK_BRIDGE_NAME. Rolling back network-configuration on resource $resource_id." - RETURN_CODE=1 - RETURN_MSG="Error activating bridge $NETWORK_BRIDGE_NAME on resource $resource_id." - fi - fi - - # check if the openQRM still can be reached, if not roll back - if [ "$RETURN_CODE" == 0 ]; then - if ! ping -c 1 $OPENQRM_SERVER_IP -w 5 -W 5 2>/dev/null 1>/dev/null; then - openqrm_rollback_network_config - ifconfig $NETWORK_BRIDGE_NAME down - brctl delbr $NETWORK_BRIDGE_NAME - if [ "$NETWORK_CARD" != "" ]; then - ifup $NETWORK_CARD - fi - openqrm_post_event 0 "add_br" 2 "openqrm-network-manager" "Error reaching openQRM Server at $OPENQRM_SERVER_IP. Rolling back network-configuration on resource $resource_id." - RETURN_CODE=1 - RETURN_MSG="Error reaching openQRM Server at $OPENQRM_SERVER_IP on resource $resource_id." - fi - fi - - # in case this is the openQRM Server itself and the openQRM Interface changed we need to adapt the openqrm-server.conf - if [ "$RETURN_CODE" == 0 ]; then - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - if [ "$NETWORK_CARD" != "" ]; then - if [ "$OPENQRM_SERVER_INTERFACE" == "$NETWORK_CARD" ]; then - sed -i -e "s/^OPENQRM_SERVER_INTERFACE=.*/OPENQRM_SERVER_INTERFACE=\"$NETWORK_BRIDGE_NAME\"/g" $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - fi - fi - fi - fi - - -# # dnsmasq - take the subnet from the bridge -# if [ "$RETURN_CODE" == 0 ]; then -# if [ "$NETWORK_BRIDGE_SUBNETMASK" != "" ] && [ "$NETWORK_BRIDGE_IP_ADDRESS" != "" ] && [ "$NETWORK_BRIDGE_DNSMASQ_IP_FIRST" != "" ] && [ "$NETWORK_BRIDGE_DNSMASQ_IP_LAST" != "" ]; then -# NETWORK_BRIDGE_DNSMASQ_NETWORK=`get_network_address $NETWORK_BRIDGE_IP_ADDRESS $NETWORK_BRIDGE_SUBNETMASK` -# # iptables masq -# if ! iptables -t nat -A POSTROUTING -s $NETWORK_BRIDGE_DNSMASQ_NETWORK ! -d $NETWORK_BRIDGE_DNSMASQ_NETWORK -j MASQUERADE; then -# RETURN_CODE=1 -# RETURN_MSG="Error masquarading dsnmasq network $NETWORK_BRIDGE_DNSMASQ_NETWORK for $NETWORK_BRIDGE_GATEWAY for $NETWORK_BRIDGE_NAME on resource $resource_id." -# openqrm_post_event 0 "add_br" 3 "openqrm-network-manager" "$RETURN_MSG" -# fi -# # dnsmasq -# if [ "$RETURN_CODE" == 0 ]; then -# if ! dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/dnsmasq.$NETWORK_BRIDGE_NAME.pid --listen-address $NETWORK_BRIDGE_IP_ADDRESS --dhcp-range $NETWORK_BRIDGE_DNSMASQ_IP_FIRST,$NETWORK_BRIDGE_DNSMASQ_IP_LAST --dhcp-no-override --except-interface=lo --interface=$NETWORK_BRIDGE_NAME; then -# RETURN_CODE=1 -# RETURN_MSG="Error starting dsnmasq network $NETWORK_BRIDGE_DNSMASQ_NETWORK for $NETWORK_BRIDGE_GATEWAY for $NETWORK_BRIDGE_NAME on resource $resource_id." -# openqrm_post_event 0 "add_br" 3 "openqrm-network-manager" "$RETURN_MSG" -# fi -# echo 1 > /proc/sys/net/ipv4/ip_forward -# fi -# DNSMASQ_PID=`cat /var/run/dnsmasq.$NETWORK_BRIDGE_NAME.pid` -# fi -# fi - - - - - if [ "$RETURN_CODE" == 0 ]; then - RETURN_MSG="ok" - fi - # Send message - SYSTEM_STATUS_TMP=$resource_id.network_stat - > $SYSTEM_STATUS_TMP - echo $RETURN_MSG > $SYSTEM_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$NETWORK_MANAGER_OPENQRM_USERNAME --http-password=$NETWORK_MANAGER_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $SYSTEM_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/network-manager/network-manager-action.php?network_manager_command=get_network_config; then - openqrm_post_event 0 "add_br" 2 "openqrm-network-manager" "Could not post the device list to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $SYSTEM_STATUS_TMP - - openqrm_lock_queue release network-manager $LOCK_TIME - trap '' EXIT - - exit $RETURN_CODE - ;; - - - remove_br) - RETURN_CODE=0 - RETURN_MSG="" - if [ "$NETWORK_BRIDGE_NAME" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - network_manager_usage - fi - if `! brctl show | tail -n+2 | grep -w $NETWORK_BRIDGE_NAME 1>/dev/null`; then - RETURN_CODE=1 - RETURN_MSG="Network bridge $NETWORK_BRIDGE_NAME does not exists on resource $resource_id." - openqrm_post_event 0 "add_br" 3 "openqrm-network-manager" "$RETURN_MSG" - fi - NETWORK_CARD=`brctl show | tail -n+2 | grep -w $NETWORK_BRIDGE_NAME | awk '{ print $4 }'` - # if this is openQRM itself - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - if [ "$OPENQRM_SERVER_INTERFACE" == "$NETWORK_BRIDGE_NAME" ]; then - if [ "$NETWORK_CARD" == "" ]; then - RETURN_CODE=1 - RETURN_MSG="$NETWORK_BRIDGE_NAME is the openQRM Management Network Interface! Not remove bridge $NETWORK_BRIDGE_NAME which does not have any Interfaces attached." - openqrm_post_event 0 "add_br" 3 "openqrm-network-manager" "$RETURN_MSG" - fi - fi - fi - - LOCK_TIME=`openqrm_lock_queue aquire network-manager` - trap "openqrm_lock_queue release network-manager $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - openqrm_post_event 0 "remove_br" 5 "openqrm-network-manager" "Removing network bridge $NETWORK_BRIDGE_NAME on resource $resource_id." - openqrm_save_network_config - - -# # clean up iptables + dnsmasq -# if [ "$NETWORK_CARD_IP_ADDRESS" != "" ] && [ "$NETWORK_CARD_SUBNET_MASK" != "" ]; then -# NETWORK_BRIDGE_DNSMASQ_NETWORK=`get_network_address $NETWORK_CARD_IP_ADDRESS $NETWORK_CARD_SUBNET_MASK` -# iptables -t nat -D POSTROUTING -s $NETWORK_BRIDGE_DNSMASQ_NETWORK -j MASQUERADE -# DNSMASQ_PID=`cat /var/run/dnsmasq.$NETWORK_BRIDGE_NAME.pid 2>/dev/null` && kill -9 $DNSMASQ_PID -# fi - - # if network-card = attached_to apply previous ip config of the removed bridge - if [ "$NETWORK_CARD" != "" ]; then - # if it is a real phys. interface and not a VLAN nic - if ! echo $NETWORK_CARD | grep .[0-9]\.[0-9] 1>/dev/null; then - # get ip config of attached_to to apply to physical device later - NETWORK_CARD_CONFIG=`get_ip_list_for_dev $NETWORK_BRIDGE_NAME` - NETWORK_CARD_IP_ADDRESS=`echo $NETWORK_CARD_CONFIG | cut -d'/' -f1` - NETWORK_CARD_BROADCAST=`echo $NETWORK_CARD_CONFIG | cut -d'/' -f2` - NETWORK_CARD_SUBNET_MASK=`echo $NETWORK_CARD_CONFIG | cut -d'/' -f3` - NETWORK_CARD_GATEWAY=`route -n | grep -w ^0.0.0.0 | grep -w $NETWORK_BRIDGE_NAME | awk '{ print $2 }'` - fi - fi - - # bring down the bridge and remove from config - ifconfig $NETWORK_BRIDGE_NAME down - brctl delbr $NETWORK_BRIDGE_NAME - openqrm_remove_interface bridge"@"$NETWORK_BRIDGE_NAME"@"$NETWORK_CARD - if [ "$NETWORK_CARD_IP_ADDRESS" != "" ] && [ "$NETWORK_CARD_SUBNET_MASK" != "" ]; then - # re-write config for nic - openqrm_add_interface nic"@"$NETWORK_CARD"@@@@@@@"$NETWORK_CARD_IP_ADDRESS"@"$NETWORK_CARD_SUBNET_MASK"@"$NETWORK_CARD_GATEWAY"@@" - fi - if [ "$NETWORK_CARD" != "" ]; then - if ! echo $NETWORK_CARD | grep .[0-9]\.[0-9] 1>/dev/null; then - ifdown $NETWORK_CARD - ifup $NETWORK_CARD - else - # remove VLAN Interface - ifconfig $NETWORK_CARD down - vconfig rem $NETWORK_CARD - fi - fi - - # check if the openQRM still can be reached, if not roll back - if [ "$RETURN_CODE" == 0 ]; then - if ! ping -c 1 $OPENQRM_SERVER_IP -w 5 -W 5 2>/dev/null 1>/dev/null; then - if [ "$NETWORK_CARD" != "" ]; then - ifdown $NETWORK_CARD - fi - openqrm_rollback_network_config - ifup $NETWORK_BRIDGE_NAME - openqrm_post_event 0 "add_br" 2 "openqrm-network-manager" "Error reaching openQRM Server at $OPENQRM_SERVER_IP. Rolling back network-configuration on resource $resource_id." - RETURN_CODE=1 - RETURN_MSG="Error reaching openQRM Server at $OPENQRM_SERVER_IP on resource $resource_id." - fi - fi - - # in case this is the openQRM Server itself and the openQRM Interface changed we need to adapt the openqrm-server.conf - if [ "$RETURN_CODE" == 0 ]; then - if [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - if [ "$OPENQRM_SERVER_INTERFACE" == "$NETWORK_BRIDGE_NAME" ]; then - if [ "$NETWORK_CARD" != "" ]; then - sed -i -e "s/^OPENQRM_SERVER_INTERFACE=.*/OPENQRM_SERVER_INTERFACE=\"$NETWORK_CARD\"/g" $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - fi - fi - fi - fi - - if [ "$RETURN_CODE" == 0 ]; then - RETURN_MSG="ok" - openqrm_post_event 0 "remove_br" 5 "openqrm-network-manager" "Removed network bridge $NETWORK_BRIDGE_NAME on resource $resource_id." - fi - # Send message - SYSTEM_STATUS_TMP=$resource_id.network_stat - > $SYSTEM_STATUS_TMP - echo $RETURN_MSG > $SYSTEM_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$NETWORK_MANAGER_OPENQRM_USERNAME --http-password=$NETWORK_MANAGER_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $SYSTEM_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/network-manager/network-manager-action.php?network_manager_command=get_network_config; then - openqrm_post_event 0 "remove_br" 2 "openqrm-network-manager" "Could not post the device list to the openQRM-server at $OPENQRM_SERVER_IP!" - fi - rm -f $SYSTEM_STATUS_TMP - - openqrm_lock_queue release network-manager $LOCK_TIME - trap '' EXIT - - exit $RETURN_CODE - ;; - - - - - - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - echo "ERROR: Free commandline arguments are not allowed!" - network_manager_usage - exit 6 - ;; -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/etc/init.d/network-manager b/openQRM-5.3.50-CE/src/plugins/network-manager/etc/init.d/network-manager deleted file mode 100644 index 6fbd509..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/etc/init.d/network-manager +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the network-manager resources -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -# for including the package functions -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/include/openqrm-plugin-network-manager-functions -. $OPENQRM_RESOURCE_PARAMETER_FILE -OPENQRM_SERVER_IP=$resource_openqrmserver - -# do not run on idle resources -if [ "$resource_image" == "idle" ]; then - exit 0 -fi - -# also do not run before the real init of the rootfs -# if we have this file /etc/initrd-devices.conf we are still in the initrd -if [ -f /etc/initrd-devices.conf ]; then - - # TODO: add your commands to run in the initrd-stage on a managed system (network-deployment only) - - exit 0 -fi - - -function device_manager_start() { - echo "Starting the openQRM network-manager-plugin" - device_manager_stop 1>/dev/null 2>&1 -} - - -function device_manager_stop() { - echo "Stopping the openQRM network-manager-plugin" -} - - - - - -case "$1" in - start) - device_manager_start - ;; - stop) - device_manager_stop - ;; - restart) - device_manager_stop - sleep 1 - device_manager_start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 - -esac -exit $? - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/etc/init.d/openqrm-plugin-network-manager b/openQRM-5.3.50-CE/src/plugins/network-manager/etc/init.d/openqrm-plugin-network-manager deleted file mode 100644 index 0fc3ec1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/etc/init.d/openqrm-plugin-network-manager +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -# init script for the openQRM network-manager-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/include/openqrm-plugin-network-manager-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/etc/openqrm-plugin-network-manager.conf -openqrm_server_get_config -export LANG=C -# define wget to use with https -if [ "$OPENQRM_WEB_PROTOCOL" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - - -function openqrm_plugin_device_manager_start() { - echo "Starting the openQRM network-manager-plugin" - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/network-manager/.running -} - - -function openqrm_plugin_device_manager_stop() { - echo "Stopping the openQRM network-manager-plugin" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/network-manager/.running -} - -function openqrm_plugin_device_manager_uninstall() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "network-manager: Please give a username to uninstall the plugin : " - read USERNAME - echo - echo -n "network-manager: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Uninstalling the openQRM network-manager-plugin" - openqrm_plugin_device_manager_stop - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-network-manager.tgz - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/network-manager -} - -function openqrm_plugin_device_manager_init() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "network-manager: Please give a username to init the plugin : " - read USERNAME - echo - echo -n "network-manager: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - - echo "Initializing the openQRM network-manager-plugin" - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/network-manager - # link the boot-service - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/boot-service-network-manager.tgz $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-network-manager.tgz - # create storage dir for stat files - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/storage - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/storage - echo "Order deny,allow" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/storage/.htaccess - echo "Deny from all" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/network-manager/web/storage/.htaccess - -} - - - - - - - -USER=$2 -PASS=$3 - -case "$1" in - start) - openqrm_plugin_device_manager_start - ;; - stop) - openqrm_plugin_device_manager_stop - ;; - restart) - openqrm_plugin_device_manager_stop - sleep 1 - openqrm_plugin_device_manager_start - ;; - init) - openqrm_plugin_device_manager_init $USER $PASS - ;; - uninstall) - openqrm_plugin_device_manager_uninstall $USER $PASS - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/etc/init.d/openqrm-plugin-network-manager.postinstall b/openQRM-5.3.50-CE/src/plugins/network-manager/etc/init.d/openqrm-plugin-network-manager.postinstall deleted file mode 100644 index e9f6dcf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/etc/init.d/openqrm-plugin-network-manager.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-network-manager postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/etc/init.d/openqrm-plugin-network-manager.preremove b/openQRM-5.3.50-CE/src/plugins/network-manager/etc/init.d/openqrm-plugin-network-manager.preremove deleted file mode 100644 index 8b4a7b5..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/etc/init.d/openqrm-plugin-network-manager.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-network-manager preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-network-manager stop diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/etc/openqrm-plugin-network-manager.conf b/openQRM-5.3.50-CE/src/plugins/network-manager/etc/openqrm-plugin-network-manager.conf deleted file mode 100644 index 053a968..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/etc/openqrm-plugin-network-manager.conf +++ /dev/null @@ -1,43 +0,0 @@ -# this is the openQRM-plugin-network-manager info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="A Network-manager to preconfigure network-bridges." -OPENQRM_PLUGIN_TYPE="network" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# list of storage types supported by this plugin -OPENQRM_DEVICE_MANAGER_STORAGE_TYPES="kvm-lvm-deployment, lvm-aoe-deployment, lvm-iscsi-deployment, lvm-nfs-deployment, aoe-san-deployment, iscsi-san-deployment, xen-lvm-deployment, clonezilla-deployment, openvz-deployment, lxc-lvm-deployment" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="" -# dirs which should be taken to the state backup -OPENQRM_PLUGIN_STATE_DIRS="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/web/network-manager/ $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/etc/" - diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/include/openqrm-plugin-network-manager-functions b/openQRM-5.3.50-CE/src/plugins/network-manager/include/openqrm-plugin-network-manager-functions deleted file mode 100644 index 10aa50f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/include/openqrm-plugin-network-manager-functions +++ /dev/null @@ -1,448 +0,0 @@ -#!/bin/bash -# this is the functions file for the network-manager-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -INTERFACES="/etc/network/interfaces" -NETWORK_CONFIG_DIR_RH="/etc/sysconfig/network-scripts/" -NETWORK_CONFIG_DIR_SUSE="/etc/sysconfig/network/" - - -################ common network-manager functions - -# logs for network-manager -function network_manager_log() { - local COMPONENT=$1 - shift - local MESSAGE=$@ - logger -i -t "network-manager plug-in" "$COMPONENT : $MESSAGE" -} - - -################ network-manager functions - -# translates cidr to subnet mask -function cidrtosub () { - set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0 - [ $1 -gt 1 ] && shift $1 || shift - echo ${1-0}.${2-0}.${3-0}.${4-0} -} - -function get_ip_list_for_dev() { - NW_DEV=$1 - NET_DEV_IP_LIST="" - DEV_LOOP=0 - for NET_DEV_IP in `ip addr show $NW_DEV | grep -w inet | awk '{ print $2 }'`; do - NET_DEV_IP=`echo $NET_DEV_IP | cut -d'/' -f1` - NET_DEV_IP_CONFIG="" - if [ "$NET_DEV_IP" != "" ]; then - NET_DEV_BROADCAST=`ip a s | grep -w $NET_DEV_IP | grep -w inet | awk '{ print $4 }'` - NET_DEV_CIDR=`ip a s | grep -w $NET_DEV_IP | grep -w inet | awk '{ print $2 }' | cut -d'/' -f2` - NET_DEV_SUBNETMASK=`cidrtosub $NET_DEV_CIDR` - NET_DEV_IP_CONFIG="$NET_DEV_IP/$NET_DEV_BROADCAST/$NET_DEV_SUBNETMASK" - fi - if [ "$DEV_LOOP" == "0" ]; then - NET_DEV_IP_LIST="$NET_DEV_IP_CONFIG" - else - NET_DEV_IP_LIST="$NET_DEV_IP_LIST:$NET_DEV_IP_CONFIG" - fi - DEV_LOOP=$(( $DEV_LOOP + 1 )) - done - echo $NET_DEV_IP_LIST -} - - -function get_network_address() { - local NIP=$1 - local NSUB=$2 - IFS=. read -r i1 i2 i3 i4 <<< "$NIP" - IFS=. read -r m1 m2 m3 m4 <<< "$NSUB" - printf "%d.%d.%d.%d\n" "$((i1 & m1))" "$(($i2 & m2))" "$((i3 & m3))" "$((i4 & m4))" -} - - - -function openqrm_remove_network_interface_debian() { - local INTERFACE_NAME=$1 - INTERFACE_NAME_SEQ="" - echo "# generated by the openQRM network-manager plugin" > $INTERFACES.new1 - echo >> $INTERFACES.new1 - while read line; do - if echo $line | grep ^# >/dev/null; then - continue - fi - if echo $line | grep -w ^auto >/dev/null; then - continue - fi - if echo $line | grep -w ^iface >/dev/null; then - INTERFACE_NAME_SEQ=`echo $line | grep ^iface | awk '{ print $2 }'` - if [ "$INTERFACE_NAME_SEQ" != "$INTERFACE_NAME" ]; then - if grep -w $INTERFACE_NAME_SEQ $INTERFACES | grep -w ^auto >/dev/null; then - echo "auto $INTERFACE_NAME_SEQ" >> $INTERFACES.new1 - fi - echo "$line" >> $INTERFACES.new1 - fi - else - if [ "$INTERFACE_NAME_SEQ" != "" ] && [ "$INTERFACE_NAME_SEQ" != "$INTERFACE_NAME" ]; then - echo " $line" >> $INTERFACES.new1 - fi - fi - if [ "$line" == "" ] && [ "$INTERFACE_NAME_SEQ" != "" ]; then - # config for IFACE ends here, write it - INTERFACE_NAME_SEQ="" - echo "" >> $INTERFACES.new1 - fi - done < $INTERFACES - echo "" >> $INTERFACES.new1 - mv -f $INTERFACES.new1 $INTERFACES - -} - - -function openqrm_remove_network_interface_rh() { - local INTERFACE_NAME=$1 - rm -f $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME -} - - - - -# add a interface -function openqrm_add_interface() { - local NETWORKCONFIG=$1 - if [ -f /etc/debian_version ]; then - openqrm_add_interface_debian $NETWORKCONFIG - elif [ -f /etc/redhat-release ]; then - export NETWORK_CONFIG_DIR=$NETWORK_CONFIG_DIR_RH - openqrm_add_interface_rh $NETWORKCONFIG - elif [ -f /etc/SuSE-release ]; then - export NETWORK_CONFIG_DIR=$NETWORK_CONFIG_DIR_SUSE - openqrm_add_interface_rh $NETWORKCONFIG - fi -} - - -# removes a bridge -function openqrm_remove_interface() { - local NETWORKCONFIG=$1 - if [ -f /etc/debian_version ]; then - openqrm_remove_interface_debian $NETWORKCONFIG - elif [ -f /etc/redhat-release ]; then - export NETWORK_CONFIG_DIR=$NETWORK_CONFIG_DIR_RH - openqrm_remove_interface_rh $NETWORKCONFIG - elif [ -f /etc/SuSE-release ]; then - export NETWORK_CONFIG_DIR=$NETWORK_CONFIG_DIR_SUSE - openqrm_remove_interface_rh $NETWORKCONFIG - fi -} - - - -# saves the lastgood network configuration -function openqrm_save_network_config() { - if [ -f /etc/debian_version ]; then - cp -f $INTERFACES $INTERFACES.rollback - return - fi - if [ -f /etc/redhat-release ]; then - export NETWORK_CONFIG_DIR=$NETWORK_CONFIG_DIR_RH - elif [ -f /etc/SuSE-release ]; then - export NETWORK_CONFIG_DIR=$NETWORK_CONFIG_DIR_SUSE - fi - mkdir -p $NETWORK_CONFIG_DIR/rollback - rm -f $NETWORK_CONFIG_DIR/rollback/* - cp -af $NETWORK_CONFIG_DIR/ifcfg* $NETWORK_CONFIG_DIR/rollback/ -} - - - -# rolls back the lastgood network configuration -function openqrm_rollback_network_config() { - if [ -f /etc/debian_version ]; then - cp -f $INTERFACES.rollback $INTERFACES - return - fi - if [ -f /etc/redhat-release ]; then - export NETWORK_CONFIG_DIR=$NETWORK_CONFIG_DIR_RH - elif [ -f /etc/SuSE-release ]; then - export NETWORK_CONFIG_DIR=$NETWORK_CONFIG_DIR_SUSE - fi - cp -f $NETWORK_CONFIG_DIR/rollback/ifcfg* $NETWORK_CONFIG_DIR/ -} - - - - - - -function openqrm_remove_interface_debian() { - local NETWORKCONFIG=$1 - local INTERFACE_TYPE=`echo $NETWORKCONFIG | cut -d'@' -f1` - local INTERFACE_NAME=`echo $NETWORKCONFIG | cut -d'@' -f2` - local BRIDGE_NETWORK=`echo $NETWORKCONFIG | cut -d'@' -f3` - # backup + rollback - NOW=`date +%T%x | sed -e "s/://g" | sed -e "s#/##g"` - cp -f $INTERFACES $INTERFACES.$NOW - - if [ "$INTERFACE_TYPE" == "bridge" ]; then - if [ "$BRIDGE_NETWORK" == "" ]; then - BRIDGE_NETWORK=`brctl show | tail -n+2 | grep -w $INTERFACE_NAME | awk '{ print $4 }'` - fi - if [ "$BRIDGE_NETWORK" != "" ]; then - openqrm_remove_network_interface_debian $BRIDGE_NETWORK - fi - fi - openqrm_remove_network_interface_debian $INTERFACE_NAME - -} - - - - -function openqrm_remove_interface_rh() { - local NETWORKCONFIG=$1 - local INTERFACE_TYPE=`echo $NETWORKCONFIG | cut -d'@' -f1` - local INTERFACE_NAME=`echo $NETWORKCONFIG | cut -d'@' -f2` - local BRIDGE_NETWORK=`echo $NETWORKCONFIG | cut -d'@' -f3` - # backup - NOW=`date +%T%x | sed -e "s/://g" | sed -e "s#/##g"` - mkdir -p $NETWORK_CONFIG_DIR/backup/$NOW - cp -af $NETWORK_CONFIG_DIR/ifcfg* $NETWORK_CONFIG_DIR/backup/$NOW/ - - if [ "$INTERFACE_TYPE" == "bridge" ]; then - if [ "$BRIDGE_NETWORK" == "" ]; then - BRIDGE_NETWORK=`brctl show | tail -n+2 | grep -w $INTERFACE_NAME | awk '{ print $4 }'` - fi - if [ "$BRIDGE_NETWORK" != "" ]; then - openqrm_remove_network_interface_rh $BRIDGE_NETWORK - fi - fi - openqrm_remove_network_interface_rh $INTERFACE_NAME - -} - - - -function openqrm_add_interface_debian() { - local NETWORKCONFIG=$1 - local INTERFACE_TYPE=`echo $NETWORKCONFIG | cut -d'@' -f1` - local INTERFACE_NAME=`echo $NETWORKCONFIG | cut -d'@' -f2` - local BRIDGE_NETWORK=`echo $NETWORKCONFIG | cut -d'@' -f3` - local BRIDGE_FD=`echo $NETWORKCONFIG | cut -d'@' -f4` - local BRIDGE_HELLO=`echo $NETWORKCONFIG | cut -d'@' -f5` - local BRIDGE_MAXAGE=`echo $NETWORKCONFIG | cut -d'@' -f6` - local BRIDGE_STP=`echo $NETWORKCONFIG | cut -d'@' -f7` - local BRIDGE_MAC=`echo $NETWORKCONFIG | cut -d'@' -f8` - local INTERFACE_IP_ADDRESS=`echo $NETWORKCONFIG | cut -d'@' -f9` - local INTERFACE_SUBNETMASK=`echo $NETWORKCONFIG | cut -d'@' -f10` - local INTERFACE_GATEWAY=`echo $NETWORKCONFIG | cut -d'@' -f11` - local BRIDGE_VLAN=`echo $NETWORKCONFIG | cut -d'@' -f12` - # backup - NOW=`date +%T%x | sed -e "s/://g" | sed -e "s#/##g"` - cp -f $INTERFACES $INTERFACES.$NOW - - if [ "$INTERFACE_TYPE" == "bridge" ]; then - if [ "$BRIDGE_NETWORK" == "" ]; then - BRIDGE_NETWORK=`brctl show | tail -n+2 | grep -w $INTERFACE_NAME | awk '{ print $4 }'` - fi - if [ "$BRIDGE_NETWORK" != "" ]; then - openqrm_remove_network_interface_debian $BRIDGE_NETWORK - fi - openqrm_remove_network_interface_debian $INTERFACE_NAME - - # add new config - if [ "$BRIDGE_NETWORK" != "" ]; then - if [ "$BRIDGE_VLAN" != "" ]; then - echo "iface $BRIDGE_NETWORK.$BRIDGE_VLAN inet manual" >> $INTERFACES - echo " vlan-raw-device $BRIDGE_NETWORK" >> $INTERFACES - else - echo "iface $BRIDGE_NETWORK inet manual" >> $INTERFACES - fi - echo "" >> $INTERFACES - NETWORK_CARD_MAC=`ip a s $BRIDGE_NETWORK | grep -w $BRIDGE_NETWORK$ | grep "link/ether" | awk '{ print $2 }' | tr "[:upper:]" "[:lower:]"` - fi - # bridge settings - echo "auto $INTERFACE_NAME" >> $INTERFACES - echo "iface $INTERFACE_NAME inet static" >> $INTERFACES - if [ "$INTERFACE_IP_ADDRESS" != "" ]; then - echo " address $INTERFACE_IP_ADDRESS" >> $INTERFACES - fi - if [ "$INTERFACE_SUBNETMASK" != "" ]; then - echo " netmask $INTERFACE_SUBNETMASK" >> $INTERFACES - fi - if [ "$INTERFACE_GATEWAY" != "" ]; then - echo " gateway $INTERFACE_GATEWAY" >> $INTERFACES - fi - if [ "$BRIDGE_FD" != "" ]; then - echo " bridge_fd $BRIDGE_FD" >> $INTERFACES - fi - if [ "$BRIDGE_HELLO" != "" ]; then - echo " bridge_hello $BRIDGE_HELLO" >> $INTERFACES - fi - if [ "$BRIDGE_MAXAGE" != "" ]; then - echo " bridge_maxage $BRIDGE_MAXAGE" >> $INTERFACES - fi - if [ "$BRIDGE_STP" != "" ]; then - if [ "$BRIDGE_STP" == "0" ]; then - STP="off" - else - STP="on" - fi - echo " bridge_stp $STP" >> $INTERFACES - fi - # attach nic - if [ "$BRIDGE_NETWORK" != "" ]; then - if [ "$BRIDGE_VLAN" != "" ]; then - echo " bridge_ports $BRIDGE_NETWORK.$BRIDGE_VLAN" >> $INTERFACES - else - echo " bridge_ports $BRIDGE_NETWORK" >> $INTERFACES - fi - fi - if [ "$BRIDGE_MAC" != "" ]; then - if [ "$BRIDGE_MAC" == "1" ] && [ "$NETWORK_CARD_MAC" != "" ]; then - echo " post-up ip link set $INTERFACE_NAME address $NETWORK_CARD_MAC" >> $INTERFACES - fi - fi - - else - echo "auto $INTERFACE_NAME" >> $INTERFACES - echo "iface $INTERFACE_NAME inet static" >> $INTERFACES - if [ "$INTERFACE_IP_ADDRESS" != "" ]; then - echo " address $INTERFACE_IP_ADDRESS" >> $INTERFACES - fi - if [ "$INTERFACE_SUBNETMASK" != "" ]; then - echo " netmask $INTERFACE_SUBNETMASK" >> $INTERFACES - fi - if [ "$INTERFACE_GATEWAY" != "" ]; then - echo " gateway $INTERFACE_GATEWAY" >> $INTERFACES - fi - fi - echo "" >> $INTERFACES - - -} - - - - -function openqrm_add_interface_rh() { - local NETWORKCONFIG=$1 - local INTERFACE_TYPE=`echo $NETWORKCONFIG | cut -d'@' -f1` - local INTERFACE_NAME=`echo $NETWORKCONFIG | cut -d'@' -f2` - local BRIDGE_NETWORK=`echo $NETWORKCONFIG | cut -d'@' -f3` - local BRIDGE_FD=`echo $NETWORKCONFIG | cut -d'@' -f4` - local BRIDGE_HELLO=`echo $NETWORKCONFIG | cut -d'@' -f5` - local BRIDGE_MAXAGE=`echo $NETWORKCONFIG | cut -d'@' -f6` - local BRIDGE_STP=`echo $NETWORKCONFIG | cut -d'@' -f7` - local BRIDGE_MAC=`echo $NETWORKCONFIG | cut -d'@' -f8` - local INTERFACE_IP_ADDRESS=`echo $NETWORKCONFIG | cut -d'@' -f9` - local INTERFACE_SUBNETMASK=`echo $NETWORKCONFIG | cut -d'@' -f10` - local INTERFACE_GATEWAY=`echo $NETWORKCONFIG | cut -d'@' -f11` - local BRIDGE_VLAN=`echo $NETWORKCONFIG | cut -d'@' -f12` - - # backup - NOW=`date +%T%x | sed -e "s/://g" | sed -e "s#/##g"` - mkdir -p $NETWORK_CONFIG_DIR/backup/$NOW - cp -af $NETWORK_CONFIG_DIR/ifcfg* $NETWORK_CONFIG_DIR/backup/$NOW/ - - if [ "$INTERFACE_TYPE" == "bridge" ]; then - # bridge with nic attached1 - if [ "$BRIDGE_NETWORK" != "" ]; then - NETWORK_CARD_MAC=`ip a s $NETWORK_CARD | grep -w $NETWORK_CARD$ | grep "link/ether" | awk '{ print $2 }' | tr "[:upper:]" "[:lower:]"` - if [ "$BRIDGE_VLAN" != "" ]; then - echo "# VLAN Interface for bridge $INTERFACE_NAME" > $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - echo "DEVICE=$BRIDGE_NETWORK.$BRIDGE_VLAN" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - if [ "$NETWORK_CARD_MAC" != "" ]; then - echo "HWADDR=$NETWORK_CARD_MAC" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - fi - echo "ONBOOT=yes" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - echo "HOTPLUG=no" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - echo "BOOTPROTO=none" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - echo "TYPE=Ethernet" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - echo "VLAN=yes" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - echo "BRIDGE=$INTERFACE_NAME" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - else - echo "# Interface for bridge $INTERFACE_NAME" > $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - echo "DEVICE=$BRIDGE_NETWORK" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - if [ "$NETWORK_CARD_MAC" != "" ]; then - echo "HWADDR=$NETWORK_CARD_MAC" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - fi - echo "ONBOOT=yes" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - echo "TYPE=Ethernet" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - echo "IPV6INIT=no" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - echo "USERCTL=no" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - echo "BRIDGE=$INTERFACE_NAME" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - fi - echo "" >> $NETWORK_CONFIG_DIR/ifcfg-$BRIDGE_NETWORK - fi - # bridge settings - echo "DEVICE=$INTERFACE_NAME" > $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - echo "BOOTPROTO=static" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - echo "ONBOOT=yes" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - echo "TYPE=Bridge" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - if [ "$INTERFACE_IP_ADDRESS" != "" ]; then - echo "IPADDR=$INTERFACE_IP_ADDRESS" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - fi - if [ "$INTERFACE_SUBNETMASK" != "" ]; then - echo "NETMASK=$INTERFACE_SUBNETMASK" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - fi - if [ "$INTERFACE_GATEWAY" != "" ]; then - echo "GATEWAY=$INTERFACE_GATEWAY" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - fi - # if [ "$BRIDGE_MAC" != "" ]; then - # if [ "$BRIDGE_MAC" == "1" ] && [ "$NETWORK_CARD_MAC" != "" ]; then - # echo "" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - # fi - # fi - if [ "$BRIDGE_FD" != "" ]; then - echo "DELAY=$BRIDGE_FD" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - fi - if [ "$BRIDGE_HELLO" != "" ]; then - echo "HELLO=$BRIDGE_HELLO" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - fi - if [ "$BRIDGE_MAXAGE" != "" ]; then - echo "MAXAGE=$BRIDGE_MAXAGE" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - fi - if [ "$BRIDGE_STP" != "" ]; then - if [ "$BRIDGE_STP" == "0" ]; then - STP="no" - else - STP="yes" - fi - echo "STP=$STP" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - fi - else - # regular nic - echo "DEVICE=$INTERFACE_NAME" > $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - echo "BOOTPROTO=static" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - echo "ONBOOT=yes" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - if [ "$INTERFACE_IP_ADDRESS" != "" ]; then - echo "IPADDR=$INTERFACE_IP_ADDRESS" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - fi - if [ "$INTERFACE_SUBNETMASK" != "" ]; then - echo "NETMASK=$INTERFACE_SUBNETMASK" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - fi - if [ "$INTERFACE_GATEWAY" != "" ]; then - echo "GATEWAY=$INTERFACE_GATEWAY" >> $NETWORK_CONFIG_DIR/ifcfg-$INTERFACE_NAME - fi - fi -} - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager-about.controller.class.php deleted file mode 100644 index eeb6ecf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager-about.controller.class.php +++ /dev/null @@ -1,159 +0,0 @@ - - */ - - -class network_manager_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'network_manager_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'network_manager_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'network_manager_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'network_manager_about_identifier'; -/** -* path to network-managers -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About Network-manager', - 'label' => 'About Network-manager', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The Network-manager plugin provides an easy way to configure Network Bridges. If the the plugin is enabled, functions are available when editing Servers. ', - 'requirements_title' => 'Requirements', - 'requirements_list' => 'none', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - 'type_title' => 'Plugin Type', - 'type_content' => 'Network', - 'documentation_title' => 'Documentation', - ), -); - - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/network-manager/lang", 'network-manager-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/network-manager/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About Network-manager - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/network-manager/class/network-manager-about.documentation.class.php'); - $controller = new network_manager_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager-about.documentation.class.php deleted file mode 100644 index 810f270..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager-about.documentation.class.php +++ /dev/null @@ -1,97 +0,0 @@ - - */ - -class network_manager_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'network_manager_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'network_manager_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'network_manager_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'network_manager_about_identifier'; -/** -* path to network-managers -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_network-manager - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/network-manager-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager.add.class.php b/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager.add.class.php deleted file mode 100644 index 3c29019..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager.add.class.php +++ /dev/null @@ -1,552 +0,0 @@ - - */ - -class network_manager_add -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'network_manager_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "network_manager_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'network_manager_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'network_manager_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - $this->controller = $controller; - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->user = $openqrm->user(); - - $id = $this->response->html->request()->get('appliance_id'); - $this->response->add('appliance_id', $id); - - $appliance = new appliance(); - $this->appliance = $appliance->get_instance_by_id($id); - - $resource = new resource(); - $this->resource = $resource->get_instance_by_id($this->appliance->resources); - - $this->statfile = $this->openqrm->get('basedir').'/plugins/network-manager/web/storage/'.$this->resource->id.'.network_config'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->add(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/network-manager-add.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - - $t->add($this->lang['legend_bridge'], 'legend_bridge'); - $t->add($this->lang['legend_ip'], 'legend_ip'); - $t->add($this->lang['legend_vlan'], 'legend_vlan'); - $t->add($this->lang['legend_dnsmasq'], 'legend_dnsmasq'); - $t->add($response->form); - $t->add(sprintf($this->lang['label'], $this->appliance->name), 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Add - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function add() { - - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - - $device = $form->get_request('device'); - $vlan = $form->get_request('vlan'); - $ip = $form->get_request('ip'); - $gateway = $form->get_request('gateway'); - $mask = $form->get_request('subnet'); - $bridge_mac = $form->get_request('bridge_mac'); - $first_ip = $form->get_request('first_ip'); - $last_ip = $form->get_request('last_ip'); - - if((isset($ip) && $ip !== '') && (!isset($mask) || $mask === '')) { - $form->set_error("subnet", $this->lang['error_empty']); - } - if((isset($mask) && $mask !== '') && (!isset($ip) || $ip === '')) { - $form->set_error("ip", $this->lang['error_empty']); - } - if( - (isset($gateway) && $gateway !== '') && - (!isset($mask) || $mask === '') && - (!isset($ip) || $ip === '') - ) { - $form->set_error("subnet", $this->lang['error_empty']); - $form->set_error("ip", $this->lang['error_empty']); - } - if(!$form->get_errors()) { - // check ip is valid - $check = array('ip', 'gateway', 'first_ip', 'last_ip'); - foreach($check as $ipp) { - if(isset($ipp) && $ipp !== '') { - $ch = explode('.', $ipp); - if(count($ch) === 4) { - foreach($ch as $k => $v) { - $v = intval($v); - if($v > 255) { - $form->set_error($ip, $this->lang['error_ip'].'>255'); - break; - } - if($k === 3) { - if($v === 0) { - $form->set_error($ip, $this->lang['error_ip'].'<1'); - break; - } - } - } - } else { - $form->set_error($ip, $this->lang['error_ip'].'<4'); - } - } - } - if(isset($mask) && $mask !== '') { - // check subnet - // possible values for subnetmask - // 0, 128, 192, 224, 240, 248, 252, 254, 255 - // first octet not 0 - $subnet_values = array(0,128,192,224,240,248,252,254,255); - $subnet = explode('.', $mask); - if(count($subnet) === 4) { - foreach($subnet as $k => $v) { - $v = intval($v); - if($k === 0) { - if(!in_array($v, $subnet_values) || $v === 0) { - $form->set_error("subnet", $this->lang['error_subnet']); - } - } - if($k === 1) { - if(!in_array($v, $subnet_values) || (intval($subnet[0]) !== 255 && $v !== 0)) { - $form->set_error("subnet", $this->lang['error_subnet']); - break; - } - } - if($k === 2) { - if(!in_array($v, $subnet_values) || (intval($subnet[1]) !== 255 && $v !== 0)) { - $form->set_error("subnet", $this->lang['error_subnet']); - break; - } - } - if($k === 3) { - if(!in_array($v, $subnet_values) || (intval($subnet[2]) !== 255 && $v !== 0)) { - $form->set_error("subnet", $this->lang['error_subnet']); - } - } - } - } else { - $form->set_error("subnet", $this->lang['error_subnet']); - } - } - if(isset($bridge_mac) && $bridge_mac === '1' && (!isset($device) || $device === '')) { - $form->set_error("device", $this->lang['error_empty']); - } - if(isset($vlan) && $vlan !== '' && (!isset($device) || $device === '')) { - $form->set_error("device", $this->lang['error_empty']); - } - if(isset($first_ip) && $first_ip !== '') { - if(!isset($last_ip) || $last_ip === '') { - $form->set_error("last_ip", $this->lang['error_empty']); - } - if(!isset($ip) || $ip === '') { - $form->set_error("ip", $this->lang['error_empty']); - } - if(!isset($subnet) || $subnet === '') { - $form->set_error("subnet", $this->lang['error_empty']); - } - if(isset($last_ip) && bindec($this->__ip2bin($last_ip)) < bindec($this->__ip2bin($first_ip))) { - $form->set_error("last_ip", $this->lang['error_ip']); - } - } - if(isset($last_ip) && $last_ip !== '') { - if(!isset($first_ip) || $first_ip === '') { - $form->set_error("first_ip", $this->lang['error_empty']); - } - } - } - - if(!$form->get_errors()) { - $command = $this->openqrm->get('basedir').'/plugins/network-manager/bin/openqrm-network-manager add_br'; - $command .= ' -u '.$this->openqrm->admin()->name; - $command .= ' -p '.$this->openqrm->admin()->password; - $command .= ' -b '.$form->get_request('name'); - $command .= ' -f '.$form->get_request('bridge_fd'); - $command .= ' -h '.$form->get_request('bridge_hello'); - $command .= ' -a '.$form->get_request('bridge_maxage'); - $command .= ' -t '.$form->get_request('bridge_stp'); - $command .= ' -m '.$bridge_mac; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - if(isset($device) && $device !== '') { - $command .= ' -n '.$device; - } - if(isset($ip) && $ip !== '') { - $command .= ' -i '.$ip; - } - if(isset($mask) && $mask !== '') { - $command .= ' -s '.$mask; - } - if(isset($vlan) && $vlan !== '') { - $command .= ' -v '.$vlan; - } - if(isset($gateway) && $gateway !== '') { - $command .= ' -g '.$gateway; - } - if(isset($first_ip) && $first_ip !== '') { - $command .= ' -df '.$first_ip; - } - if(isset($last_ip) && $last_ip !== '') { - $command .= ' -dl '.$last_ip; - } - $this->controller->__reload( $this->statfile, $this->resource ); - if ($this->file->exists($this->statfile)) { - $lines = explode("\n", $this->file->get_contents($this->statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = $line[1]; - if($form->get_request('name') === $check) { - $error = sprintf($this->lang['error_exists'], $form->get_request('name')); - } - } - } - } - } - if(isset($error)) { - $response->error = $error; - } else { - $this->resource->send_command($this->resource->ip, $command); - $file = $this->openqrm->get('basedir').'/plugins/network-manager/web/storage/'.$this->resource->id.'.network_stat'; - while (!$this->file->exists($file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $result = trim($this->file->get_contents($file)); - if($result === 'ok') { - $response->msg = sprintf($this->lang['msg_added'], $form->get_request('name')); - } - else { - $response->error = $result; - } - } - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'add'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9.]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9.'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['title'] = $this->lang['title_name']; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['value'] = ''; - $d['name']['object']['attrib']['maxlength'] = 8; - - $d['ip']['label'] = $this->lang['form_ip']; - $d['ip']['required'] = true; - $d['ip']['validate']['regex'] = '/^[0-9.]+$/i'; - $d['ip']['validate']['errormsg'] = $this->lang['error_ip']; - $d['ip']['object']['type'] = 'htmlobject_input'; - $d['ip']['object']['attrib']['title'] = $this->lang['title_ip']; - $d['ip']['object']['attrib']['id'] = 'ip'; - $d['ip']['object']['attrib']['name'] = 'ip'; - $d['ip']['object']['attrib']['type'] = 'text'; - $d['ip']['object']['attrib']['value'] = ''; - $d['ip']['object']['attrib']['maxlength'] = 15; - - $d['subnet']['label'] = $this->lang['form_subnet']; - $d['subnet']['required'] = true; - $d['subnet']['validate']['regex'] = '/^[0-9.]+$/i'; - $d['subnet']['validate']['errormsg'] = $this->lang['error_subnet']; - $d['subnet']['object']['type'] = 'htmlobject_input'; - $d['subnet']['object']['attrib']['title'] = $this->lang['title_subnet']; - $d['subnet']['object']['attrib']['id'] = 'subnet'; - $d['subnet']['object']['attrib']['name'] = 'subnet'; - $d['subnet']['object']['attrib']['type'] = 'text'; - $d['subnet']['object']['attrib']['value'] = ''; - $d['subnet']['object']['attrib']['maxlength'] = 15; - - $d['gateway']['label'] = $this->lang['form_gateway']; - $d['gateway']['validate']['regex'] = '/^[0-9.]+$/i'; - $d['gateway']['validate']['errormsg'] = $this->lang['error_ip']; - $d['gateway']['object']['type'] = 'htmlobject_input'; - $d['gateway']['object']['attrib']['title'] = $this->lang['title_gateway']; - $d['gateway']['object']['attrib']['id'] = 'gateway'; - $d['gateway']['object']['attrib']['name'] = 'gateway'; - $d['gateway']['object']['attrib']['type'] = 'text'; - $d['gateway']['object']['attrib']['value'] = ''; - $d['gateway']['object']['attrib']['maxlength'] = 15; - - $vlan[] = array(''); - for($i=0; $i<=100; $i++) { - $vlan[] = array($i); - } - $d['vlan']['label'] = $this->lang['form_vlan']; - $d['vlan']['validate']['regex'] = '/^[0-9]+$/i'; - $d['vlan']['validate']['errormsg'] = sprintf($this->lang['error_vlan'], '0-9'); - $d['vlan']['object']['type'] = 'htmlobject_select'; - $d['vlan']['object']['attrib']['title'] = $this->lang['title_vlan']; - $d['vlan']['object']['attrib']['id'] = 'vlan'; - $d['vlan']['object']['attrib']['name'] = 'vlan'; - $d['vlan']['object']['attrib']['index'] = array(0,0); - $d['vlan']['object']['attrib']['options'] = $vlan; - $d['vlan']['object']['attrib']['maxlength'] = 4; - - for($i=0; $i<=20; $i++) { - $range[] = array($i); - } - $d['bridge_fd']['label'] = $this->lang['form_bridge_fd']; - $d['bridge_fd']['validate']['regex'] = '/^[0-9]+$/i'; - $d['bridge_fd']['validate']['errormsg'] = sprintf($this->lang['error_vlan'], '0-9'); - $d['bridge_fd']['object']['type'] = 'htmlobject_select'; - $d['bridge_fd']['object']['attrib']['title'] = $this->lang['title_bridge_fd']; - $d['bridge_fd']['object']['attrib']['id'] = 'bridge_fd'; - $d['bridge_fd']['object']['attrib']['name'] = 'bridge_fd'; - $d['bridge_fd']['object']['attrib']['index'] = array(0,0); - $d['bridge_fd']['object']['attrib']['options'] = $range; - $d['bridge_fd']['object']['attrib']['selected'] = array(0); - $d['bridge_fd']['object']['attrib']['maxlength'] = 4; - - $d['bridge_hello']['label'] = $this->lang['form_bridge_hello']; - $d['bridge_hello']['validate']['regex'] = '/^[0-9]+$/i'; - $d['bridge_hello']['validate']['errormsg'] = sprintf($this->lang['error_vlan'], '0-9'); - $d['bridge_hello']['object']['type'] = 'htmlobject_select'; - $d['bridge_hello']['object']['attrib']['title'] = $this->lang['title_bridge_hello']; - $d['bridge_hello']['object']['attrib']['id'] = 'bridge_hello'; - $d['bridge_hello']['object']['attrib']['name'] = 'bridge_hello'; - $d['bridge_hello']['object']['attrib']['index'] = array(0,0); - $d['bridge_hello']['object']['attrib']['options'] = $range; - $d['bridge_hello']['object']['attrib']['selected'] = array(2); - $d['bridge_hello']['object']['attrib']['maxlength'] = 4; - - $d['bridge_maxage']['label'] = $this->lang['form_bridge_maxage']; - $d['bridge_maxage']['validate']['regex'] = '/^[0-9]+$/i'; - $d['bridge_maxage']['validate']['errormsg'] = sprintf($this->lang['error_vlan'], '0-9'); - $d['bridge_maxage']['object']['attrib']['title'] = $this->lang['title_bridge_maxage']; - $d['bridge_maxage']['object']['type'] = 'htmlobject_select'; - $d['bridge_maxage']['object']['attrib']['id'] = 'bridge_maxage'; - $d['bridge_maxage']['object']['attrib']['name'] = 'bridge_maxage'; - $d['bridge_maxage']['object']['attrib']['index'] = array(0,0); - $d['bridge_maxage']['object']['attrib']['options'] = $range; - $d['bridge_maxage']['object']['attrib']['selected'] = array(12); - $d['bridge_maxage']['object']['attrib']['maxlength'] = 4; - - - $bool = array(array(1,'on'),array(0,'off')); - $d['bridge_stp']['label'] = $this->lang['form_bridge_stp']; - $d['bridge_stp']['validate']['regex'] = '/^[0-9]+$/i'; - $d['bridge_stp']['validate']['errormsg'] = sprintf($this->lang['error_vlan'], '0-9'); - $d['bridge_stp']['object']['type'] = 'htmlobject_select'; - $d['bridge_stp']['object']['attrib']['title'] = $this->lang['title_bridge_stp']; - $d['bridge_stp']['object']['attrib']['id'] = 'bridge_stp'; - $d['bridge_stp']['object']['attrib']['name'] = 'bridge_stp'; - $d['bridge_stp']['object']['attrib']['index'] = array(0,1); - $d['bridge_stp']['object']['attrib']['options'] = $bool; - $d['bridge_stp']['object']['attrib']['selected'] = array(0); - $d['bridge_stp']['object']['attrib']['maxlength'] = 4; - - $d['bridge_mac']['label'] = $this->lang['form_bridge_mac']; - $d['bridge_mac']['validate']['regex'] = '/^[0-9]+$/i'; - $d['bridge_mac']['validate']['errormsg'] = sprintf($this->lang['error_vlan'], '0-9'); - $d['bridge_mac']['object']['type'] = 'htmlobject_select'; - $d['bridge_mac']['object']['attrib']['title'] = $this->lang['title_bridge_mac']; - $d['bridge_mac']['object']['attrib']['id'] = 'bridge_mac'; - $d['bridge_mac']['object']['attrib']['name'] = 'bridge_mac'; - $d['bridge_mac']['object']['attrib']['index'] = array(0,1); - $d['bridge_mac']['object']['attrib']['options'] = $bool; - $d['bridge_mac']['object']['attrib']['selected'] = array(0); - $d['bridge_mac']['object']['attrib']['maxlength'] = 4; - - $d['first_ip']['label'] = $this->lang['form_first_ip']; - $d['first_ip']['validate']['regex'] = '/^[0-9.]+$/i'; - $d['first_ip']['validate']['errormsg'] = $this->lang['error_ip']; - $d['first_ip']['object']['type'] = 'htmlobject_input'; - $d['first_ip']['object']['attrib']['title'] = $this->lang['title_first_ip']; - $d['first_ip']['object']['attrib']['id'] = 'first_ip'; - $d['first_ip']['object']['attrib']['name'] = 'first_ip'; - $d['first_ip']['object']['attrib']['type'] = 'text'; - $d['first_ip']['object']['attrib']['value'] = ''; - $d['first_ip']['object']['attrib']['maxlength'] = 15; - - $d['last_ip']['label'] = $this->lang['form_last_ip']; - $d['last_ip']['validate']['regex'] = '/^[0-9.]+$/i'; - $d['last_ip']['validate']['errormsg'] = $this->lang['error_ip']; - $d['last_ip']['object']['type'] = 'htmlobject_input'; - $d['last_ip']['object']['attrib']['title'] = $this->lang['title_last_ip']; - $d['last_ip']['object']['attrib']['id'] = 'last_ip'; - $d['last_ip']['object']['attrib']['name'] = 'last_ip'; - $d['last_ip']['object']['attrib']['type'] = 'text'; - $d['last_ip']['object']['attrib']['value'] = ''; - $d['last_ip']['object']['attrib']['maxlength'] = 15; - - $this->controller->__reload( $this->statfile, $this->resource ); - $nics[] = array('', ''); - if ($this->file->exists($this->statfile)) { - $lines = explode("\n", $this->file->get_contents($this->statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[0] === 'n') { - $nics[$line[1]] = array($line[1], $line[1]); - } - elseif($line[0] === 'b') { - if(isset($line[4]) && $line[4] !== '') { - $up[] = $line[4]; - } - } - } - } - } - } - // remove nics in use - if(isset($up) && is_array($up)) { - foreach($up as $u) { - unset($nics[$u]); - } - } - $d['device']['label'] = $this->lang['form_device']; - $d['device']['required'] = true; - $d['device']['object']['type'] = 'htmlobject_select'; - $d['device']['object']['attrib']['title'] = $this->lang['title_device']; - $d['device']['object']['attrib']['id'] = 'device'; - $d['device']['object']['attrib']['name'] = 'device'; - $d['device']['object']['attrib']['index'] = array(0,1); - $d['device']['object']['attrib']['options'] = $nics; - $d['device']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - - - - //-------------------------------------------------- - /** - * Ip Adress to binary - * @access public - * @param string $ip - * @return string - */ - //-------------------------------------------------- - function __ip2bin($ip) - { - $return = ''; - if(!preg_match("/^\d+\.\d+\.\d+\.\d+$/", $ip)) return -1; - $ar = explode(".", $ip); - foreach($ar as $a) - { - $return .= str_pad(decbin($a), 8, 0, STR_PAD_LEFT); - } - return $return; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager.controller.class.php b/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager.controller.class.php deleted file mode 100644 index 58c85c9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager.controller.class.php +++ /dev/null @@ -1,336 +0,0 @@ - - */ - - - - -class network_manager_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'network_manager_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "network_manager_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'network_manager_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'network_manager_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array ( - 'tab' => 'Network Manager', - 'label' => 'Network Devices on Server %s', - 'action_remove' => 'remove', - 'action_add' => 'Add new Network Bridge', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'add' => array ( - 'tab' => 'Add Network Bridge', - 'label' => 'Add Network Bridge on Server %s', - 'legend_bridge' => 'Bridge', - 'legend_ip' => 'Ip', - 'legend_vlan' => 'Vlan', - 'legend_dnsmasq' => 'Dnsmasq', - 'form_name' => 'Name', - 'form_device' => 'Device', - 'form_ip' => 'IP', - 'form_subnet' => 'Subnet', - 'form_vlan' => 'Vlan', - 'form_gateway' => 'Gateway', - 'form_bridge_fd' => 'FD', - 'form_bridge_hello' => 'Hello', - 'form_bridge_maxage' => 'Maxage', - 'form_bridge_stp' => 'Stp', - 'form_bridge_mac' => 'Mac', - 'form_first_ip' => 'First Ip', - 'form_last_ip' => 'Last Ip', - 'title_name' => 'Name', - 'title_vlan' => 'Vlan', - 'title_device' => 'Network Device', - 'title_ip' => 'Ip', - 'title_subnet' => 'Subnet', - 'title_gateway' => 'Gateway', - 'title_bridge_fd' => 'FD', - 'title_bridge_hello' => 'Hello', - 'title_bridge_maxage' => 'Maxage', - 'title_bridge_stp' => 'Stp', - 'title_bridge_mac' => 'Mac', - 'title_first_ip' => 'First Ip', - 'title_last_ip' => 'Last Ip', - 'error_name' => 'Name must be %s only', - 'error_exists' => 'Name %s is already in use.', - 'error_ip' => 'IP is invalid', - 'error_subnet' => 'Subnet is invalid', - 'error_vlan' => 'Vlan must be %s only', - 'error_empty' => 'Must not be empty', - 'msg_added' => 'Successfully added bridge %s.', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'remove' => array ( - 'label' => 'Remove Network Bridge(s) on Server %s', - 'msg_removed' => 'Successfully removed bridge %s.', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/network-manager/lang", 'network-manager.ini'); - $this->tpldir = $this->rootdir.'/plugins/network-manager/tpl'; - $this->response->add('appliance_id', $this->response->html->request()->get('appliance_id')); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "select"; - } - - if($this->action === '') { - $this->action = "select"; - } - - $content = array(); - switch( $this->action ) { - case '': - case 'select': - $content[] = $this->select(true); - break; - case 'add': - $content[] = $this->select(false); - $content[] = $this->add(true); - break; - case 'remove': - $content[] = $this->select(false); - $content[] = $this->remove(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * API - * - * @access public - */ - //-------------------------------------------- - function api() { - require_once($this->openqrm->get('basedir').'/plugins/network-manager/web/class/network-manager.api.class.php'); - $controller = new network_manager_api($this); - $controller->action(); - } - - - //-------------------------------------------- - /** - * Select Network Devices - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->openqrm->get('basedir').'/plugins/network-manager/web/class/network-manager.select.class.php'); - $controller = new network_manager_select($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->identifier_name = $this->identifier_name; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add new Bridge - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function add( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->openqrm->get('basedir').'/plugins/network-manager/web/class/network-manager.add.class.php'); - $controller = new network_manager_add($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['add']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['add']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'add' ); - $content['onclick'] = false; - if($this->action === 'add'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Remove Bridge - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function remove( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->openqrm->get('basedir').'/plugins/network-manager/web/class/network-manager.remove.class.php'); - $controller = new network_manager_remove($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['remove']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Remove'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'remove' ); - $content['onclick'] = false; - if($this->action === 'remove'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Reload statfile - * - * @access protected - * @return null - */ - //-------------------------------------------- - function __reload( $statfile, $resource ) { - if(isset($resource) && isset($resource->state) && $resource->state === 'active') { - sleep(2); - $command = $this->openqrm->get('basedir').'/plugins/network-manager/bin/openqrm-network-manager post_config'; - $command .= ' -u '.$this->openqrm->admin()->name; - $command .= ' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - if($this->file->exists($statfile)) { - $this->file->remove($statfile); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($statfile)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - } - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager.remove.class.php b/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager.remove.class.php deleted file mode 100644 index efdba32..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager.remove.class.php +++ /dev/null @@ -1,212 +0,0 @@ - - */ - -class network_manager_remove -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'network_manager_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "network_manager_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'network_manager_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'network_manager_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $openqrm->file(); - $this->user = $openqrm->user(); - - $id = $this->response->html->request()->get('appliance_id'); - $this->response->add('appliance_id', $id); - $this->response->add($this->identifier_name.'[]', ''); - - $appliance = new appliance(); - $this->appliance = $appliance->get_instance_by_id($id); - - $resource = new resource(); - $this->resource = $resource->get_instance_by_id($this->appliance->resources); - - $this->statfile = $this->openqrm->get('basedir').'/plugins/network-manager/web/storage/'.$this->resource->id.'.network_stat'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->remove(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/network-manager-remove.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add(sprintf($this->lang['label'], $this->appliance->name), 'label'); - $t->add($response->form); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Remove - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function remove() { - $response = $this->get_response(); - $bridges = $response->html->request()->get($this->identifier_name); - $form = $response->form; - if( $bridges !== '' ) { - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $i = 0; - foreach($bridges as $ex) { - $d['param_f'.$i]['label'] = $ex; - $d['param_f'.$i]['object']['type'] = 'htmlobject_input'; - $d['param_f'.$i]['object']['attrib']['type'] = 'checkbox'; - $d['param_f'.$i]['object']['attrib']['name'] = $this->identifier_name.'['.$i.']'; - $d['param_f'.$i]['object']['attrib']['value'] = $ex; - $d['param_f'.$i]['object']['attrib']['checked'] = true; - $i++; - } - $form->add($d); - if(!$form->get_errors() && $response->submit()) { - $errors = array(); - $message = array(); - foreach($bridges as $key => $bridge) { - $command = $this->openqrm->get('basedir').'/plugins/network-manager/bin/openqrm-network-manager remove_br'; - $command .= ' -b '.$bridge; - $command .= ' -u '.$this->openqrm->admin()->name; - $command .= ' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - -#echo $command.'
    '; - - $file = $this->statfile; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $this->resource->send_command($this->resource->ip, $command); - while (!$this->file->exists($file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $result = trim($this->file->get_contents($file)); - if($result === 'ok') { - $form->remove($this->identifier_name.'['.$key.']'); - $message[] = sprintf($this->lang['msg_removed'], $bridge); - } - else { - $errors[] = $result; - } - } - if(count($errors) === 0) { - $response->msg = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response->error = join('
    ', $msg); - } - } - } else { - $response->msg = ''; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'remove'); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager.select.class.php b/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager.select.class.php deleted file mode 100644 index 9833ef4..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/class/network-manager.select.class.php +++ /dev/null @@ -1,231 +0,0 @@ - - */ - -class network_manager_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name; -/** -* message param -* @access public -* @var string -*/ -var $message_param; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name; -/** -* path to tpldir -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->controller = $controller; - $this->file = $this->openqrm->file(); - $this->tpldir = $this->rootdir.'/plugins/network-manager/tpl'; - - $id = $this->response->html->request()->get('appliance_id'); - $this->response->add('appliance_id', $id); - - $appliance = $this->openqrm->appliance(); - $this->appliance = $appliance->get_instance_by_id($id); - - $resource = $this->openqrm->resource(); - $this->resource = $resource->get_instance_by_id($this->appliance->resources); - - $this->statfile = $this->openqrm->get('basedir').'/plugins/network-manager/web/storage/'.$this->resource->id.'.network_config'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action() { - $response = $this->select(); - - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - $data['add'] = $response->add; - $data['table'] = $response->table; - $data['label'] = sprintf($this->lang['label'], $this->appliance->name); - $data['baseurl'] = $this->openqrm->get('baseurl'); - $t = $response->html->template($this->tpldir.'/network-manager-select.tpl.php'); - $t->add($data); - return $t; - } - - //-------------------------------------------- - /** - * Ad Volume Group - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function select() { - $response = $this->get_response(); - - $b = array(); - $identifier_disabled = array(); - $this->controller->__reload( $this->statfile, $this->resource ); - if ($this->file->exists($this->statfile)) { - $result = trim($this->file->get_contents($this->statfile)); - $result = explode("\n", $result); - if(is_array($result)) { - $res = array(); - foreach($result as $v) { - $res[] = explode('@', $v); - } - foreach ($res as $line) { - $up = ''; - if($line[0] === 'n') { - $identifier_disabled[] = $line[1]; - $type = 'Physical'; - } - elseif($line[0] === 'b') { - $type = 'Bridge'; - if(isset($line[4]) && $line[4] !== '') { - $up = $line[4]; - } - } - - $ip = ''; - if($line[3] !== '') { - $tmp = explode('/', $line[3]); - $ip = $tmp[0]; - } - - $b[] = array( - 'device' => $line[1], - 'type' => $type, - 'mac' => $line[2], - 'ip' => $ip, - 'up' => $up, - ); - } - } - } - - $h['type']['title'] ='Type'; - $h['type']['sortable'] = true; - $h['device']['title'] ='Device'; - $h['device']['sortable'] = true; - $h['mac']['title'] ='Mac'; - $h['mac']['sortable'] = true; - $h['ip']['title'] ='IP'; - $h['ip']['sortable'] = true; - $h['up']['title'] ='Interface'; - $h['up']['sortable'] = true; - - $table = $this->response->html->tablebuilder('network', $this->response->get_array($this->actions_name, 'select')); - $table->sort = 'type'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = count($b); - $table->autosort = true; - $table->sort_link = false; - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $b; - $table->identifier = 'device'; - $table->identifier_name = $this->identifier_name; - $table->identifier_disabled = $identifier_disabled; - $table->actions_name = $this->actions_name; - $table->actions = array(array('remove' => $this->lang['action_remove'])); - - $response->table = $table; - $response->add = ''; - if(count($b) > 0) { - $a = $response->html->a(); - $a->label = $this->lang['action_add']; - $a->css = 'add'; - $a->href = $response->get_url($this->actions_name, 'add') ; - $a->handler = 'onclick="wait();"'; - $response->add = $a; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param enum $mode [confirm] - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response($mode = '') { - $response = $this->response; - #$form = $response->get_form($this->actions_name, 'select'); - #$response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/css/network-manager.css b/openQRM-5.3.50-CE/src/plugins/network-manager/web/css/network-manager.css deleted file mode 100644 index e69de29..0000000 diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/network-manager/web/img/plugin.png deleted file mode 100644 index e952cbc..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/network-manager/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/lang/de.network-manager-about.ini b/openQRM-5.3.50-CE/src/plugins/network-manager/web/lang/de.network-manager-about.ini deleted file mode 100644 index 70fa516..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/lang/de.network-manager-about.ini +++ /dev/null @@ -1,18 +0,0 @@ -[documentation] -tab = "Über Network-Manager" -label = "Über Network-Manager" - -introduction_title = "Einleitung" -introduction_content = "

    Das Network-Manager-Plugin bietet einen einfachen Weg Netzwerk-Bridges zu verwalten. Wenn das Plugin aktiviert ist, stehen alle Funktionen beim Editieren eines Servers zur Verfügung.

    " - -requirements_title = "Anforderungen" -requirements_list = "keine" - -tested_title = "Getestet mit" -tested_content = "

    Dieses Plugin ist getestet mit Debian, Ubuntu und CentOS.

    " - -type_title = "Plugin-Typ" -type_content = "Netzwerk" - -documentation_title = "Dokumentation" - diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/lang/de.network-manager.ini b/openQRM-5.3.50-CE/src/plugins/network-manager/web/lang/de.network-manager.ini deleted file mode 100644 index 430fe0d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/lang/de.network-manager.ini +++ /dev/null @@ -1,54 +0,0 @@ -[select] -tab = "Netzwerk Manager" -label = "Netzwerk Karten auf Server %s" -action_remove = "entfernen" -action_add = "Netzwerk Bridge hinzufügen" -please_wait = "Lade. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[add] -tab = "Netzwerk Bridge hinzufügen" -label = "Netzwerk Bridge auf Server %s hinzufügen" -legend_bridge = "Bridge" -legend_ip = "Ip" -legend_vlan = "Vlan" -legend_dnsmasq = "Dnsmasq" -form_name = "Name" -form_device = "Device" -form_ip = "IP" -form_subnet = "Subnet" -form_vlan = "Vlan" -form_gateway = "Gateway" -form_bridge_fd = "FD" -form_bridge_hello = "Hello" -form_bridge_maxage = "Maxage" -form_bridge_stp = "Stp" -form_bridge_mac = "Mac" -form_first_ip = "Erste Ip" -form_last_ip = "Letzte Ip" -title_name = "Name" -title_vlan = "Vlan" -title_device = "Netzwerk Karte" -title_ip = "Ip" -title_subnet = "Subnet" -title_gateway = "Gateway" -title_bridge_fd = "FD" -title_bridge_hello = "Hello" -title_bridge_maxage = "Maxage" -title_bridge_stp = "Stp" -title_bridge_mac = "Mac" -title_first_ip = "Erste Ip" -title_last_ip = "Letzte Ip" -error_name = "Name darf nur %s beinhalten" -error_exists = "Name %s wird bereits verwendet." -error_ip = "IP ist ungültig" -error_subnet = "Subnet ist ungültig" -error_vlan = "Vlan darf nur %s beinhalt" -error_empty = "Darf nicht leer sein" -msg_added = "Bridge %s erfolgreich hinzugefügt." -please_wait = "Lade. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[remove] -label = "Netzwerk Bridge(s) auf Server %s entfernen" -msg_removed = "Bridge %s erfolgreich entfernt." -please_wait = "Lade. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/lang/en.network-manager-about.ini b/openQRM-5.3.50-CE/src/plugins/network-manager/web/lang/en.network-manager-about.ini deleted file mode 100644 index be4671b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/lang/en.network-manager-about.ini +++ /dev/null @@ -1,12 +0,0 @@ -[documentation] -tab = "About network manager" -label = "About network manager" -introduction_title = "Introduction" -introduction_content = "

    The network manager plugin provides an easy way to configure network bridges. If the the plugin is enabled, functions are available when editing servers.

    " -requirements_title = "Requirements" -requirements_list = "none" -tested_title = "Tested with" -tested_content = "

    This plugin is tested with Debian, Ubuntu and CentOS.

    " -type_title = "Plugin type" -type_content = "Network" -documentation_title = "Documentation" diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/lang/en.network-manager.ini b/openQRM-5.3.50-CE/src/plugins/network-manager/web/lang/en.network-manager.ini deleted file mode 100644 index 548a459..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/lang/en.network-manager.ini +++ /dev/null @@ -1,54 +0,0 @@ -[select] -tab = "Network Manager" -label = "Network Devices on Server %s" -action_remove = "remove" -action_add = "Add new Network Bridge" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." -[add] -tab = "Add Network Bridge" -label = "Add Network Bridge on Server %s" -legend_bridge = "Bridge" -legend_ip = "Ip" -legend_vlan = "Vlan" -legend_dnsmasq = "Dnsmasq" -form_name = "Name" -form_device = "Device" -form_ip = "IP" -form_subnet = "Subnet" -form_vlan = "Vlan" -form_gateway = "Gateway" -form_bridge_fd = "FD" -form_bridge_hello = "Hello" -form_bridge_maxage = "Maxage" -form_bridge_stp = "Stp" -form_bridge_mac = "Mac" -form_first_ip = "First Ip" -form_last_ip = "Last Ip" -title_name = "Name" -title_vlan = "Vlan" -title_device = "Network Device" -title_ip = "Ip" -title_subnet = "Subnet" -title_gateway = "Gateway" -title_bridge_fd = "FD" -title_bridge_hello = "Hello" -title_bridge_maxage = "Maxage" -title_bridge_stp = "Stp" -title_bridge_mac = "Mac" -title_first_ip = "First Ip" -title_last_ip = "Last Ip" -error_name = "Name must be %s only" -error_exists = "Name %s is already in use." -error_ip = "IP is invalid" -error_subnet = "Subnet is invalid" -error_vlan = "Vlan must be %s only" -error_empty = "Must not be empty" -msg_added = "Successfully added bridge %s." -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." -[remove] -label = "Remove Network Bridge(s) on Server %s" -msg_removed = "Successfully removed bridge %s." -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/network-manager/web/menu.txt deleted file mode 100644 index 2766ecd..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/menu.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|Network-manager|index.php?plugin=network-manager&controller=network-manager-about|How to use diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/network-manager-action.php b/openQRM-5.3.50-CE/src/plugins/network-manager/web/network-manager-action.php deleted file mode 100644 index cf8ba4c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/network-manager-action.php +++ /dev/null @@ -1,82 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$thisfile = basename($_SERVER['PHP_SELF']); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -$BaseDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -// filter inputs -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; - -$network_manager_command = $request->get('network_manager_command'); - -global $OPENQRM_SERVER_BASE_DIR; - -$event = new event(); -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $event; - -// place for the storage stat files -$device_statdir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/network-manager/storage'; - - -// user/role authentication -if ($OPENQRM_USER->role != "administrator") { - $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "network-manager-action", "Un-Authorized access to network-manager-actions from $OPENQRM_USER->name", "", "", 0, 0, 0); - exit(); -} - - -// main -$event->log("$network_manager_command", $_SERVER['REQUEST_TIME'], 5, "network-manager-action", "Processing network-manager command $network_manager_command", "", "", 0, 0, 0); - - switch ($network_manager_command) { - - case 'get_network_config': - if (!file_exists($device_statdir)) { - mkdir($device_statdir); - } - $filename = $device_statdir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - - default: - $event->log("$network_manager_command", $_SERVER['REQUEST_TIME'], 3, "network-manager-action", "No such event command ($network_manager_command)", "", "", 0, 0, 0); - break; - - - } - - diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/openqrm-network-manager-appliance-edit-hook.php b/openQRM-5.3.50-CE/src/plugins/network-manager/web/openqrm-network-manager-appliance-edit-hook.php deleted file mode 100644 index 5a41362..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/openqrm-network-manager-appliance-edit-hook.php +++ /dev/null @@ -1,30 +0,0 @@ - -*/ - -function get_network_manager_appliance_edit($appliance_id, $openqrm, $response) { - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - $virtualization = new virtualization(); - $virtualization->get_instance_by_id($appliance->virtualization); - // choose only not vm - if(stripos($virtualization->type, '-vm-') === false) { - $plugin_title = "Network Manager on ".$appliance->name; - $a = $response->html->a(); - $a->label = ''.$plugin_title.''; - $a->href = $openqrm->get('baseurl').'/index.php?base=appliance&appliance_action=load_edit&aplugin=network-manager&appliance_id='.$appliance_id; - return $a; - } -} diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/tpl/network-manager-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/network-manager/web/tpl/network-manager-about-documentation.tpl.php deleted file mode 100644 index db74f20..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/tpl/network-manager-about-documentation.tpl.php +++ /dev/null @@ -1,41 +0,0 @@ - -

    {label}

    - -
    - -
    -

    {introduction_title}

    - {introduction_content} - -

    {requirements_title}

    - {requirements_list} -
    - -
    - -

    {type_title}

    - {type_content} - -

    {tested_title}

    - {tested_content} -
    - - -
    - - diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/tpl/network-manager-add.tpl.php b/openQRM-5.3.50-CE/src/plugins/network-manager/web/tpl/network-manager-add.tpl.php deleted file mode 100644 index c4cfda0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/tpl/network-manager-add.tpl.php +++ /dev/null @@ -1,59 +0,0 @@ - -

    {label}

    -
    -
    - {form} - -
    -
    - {legend_bridge} - {name} - {bridge_fd} - {bridge_hello} - {bridge_maxage} - {bridge_stp} - {bridge_mac} - {device} -
    -
    - {legend_ip} - {ip} - {subnet} - {gateway} -
    -
    -
    -
    - {legend_vlan} - {vlan} -
    - - - -
    - -
    {submit} {cancel}
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/tpl/network-manager-remove.tpl.php b/openQRM-5.3.50-CE/src/plugins/network-manager/web/tpl/network-manager-remove.tpl.php deleted file mode 100644 index 5c14fa5..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/tpl/network-manager-remove.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    -
    - - {form} -
    {submit} {cancel}
    - -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/network-manager/web/tpl/network-manager-select.tpl.php b/openQRM-5.3.50-CE/src/plugins/network-manager/web/tpl/network-manager-select.tpl.php deleted file mode 100644 index 18eed61..0000000 --- a/openQRM-5.3.50-CE/src/plugins/network-manager/web/tpl/network-manager-select.tpl.php +++ /dev/null @@ -1,22 +0,0 @@ - -

    {label}

    -
    -
    {add}
    -
     
    -{table} -
    diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/Makefile b/openQRM-5.3.50-CE/src/plugins/nfs-storage/Makefile deleted file mode 100644 index 72abcd9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -# this is the openQRM nfs-storage-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/etc/ - - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/nfs-storage $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/etc/init.d/* - - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/include/ - - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/etc/init.d/* - - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.nfs-deployment $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/ - - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/img/ - - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/class/ - - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/lang/ - - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/css/ - - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/tpl/ - . $(OPENQRM_SERVER_CONF) && chmod 777 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web - - . $(OPENQRM_SERVER_CONF) && tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage -czvf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/boot-service-nfs-storage.tgz include/ bin/ etc/init.d/nfs-storage etc/openqrm-plugin-nfs-storage.conf - - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/nfs-storage - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/nfs-storage/ - - - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/bin/openqrm-nfs-storage b/openQRM-5.3.50-CE/src/plugins/nfs-storage/bin/openqrm-nfs-storage deleted file mode 100644 index 27605ba..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/bin/openqrm-nfs-storage +++ /dev/null @@ -1,483 +0,0 @@ -#!/bin/bash -# this script automatically manages nfs -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -# unblock starting command queue early for non-blocking + ui commands -NFS_COMMAND=$1 -if [ "$NFS_COMMAND" == "post_exports" ] || [ "$NFS_COMMAND" == "post_identifier" ] || [ "$NFS_COMMAND" == "list" ] || [ "$NFS_COMMAND" == "auth" ] || [ "$NFS_COMMAND" == "post_sync_progress" ] || [ "$NFS_COMMAND" == "post_sync_finished" ]; then - openqrm_unblock_starting_queue $@ - NON_BLOCKING=true -fi - -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/include/openqrm-plugin-nfs-storage-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/etc/openqrm-plugin-nfs-storage.conf -OPENQRM_POSTENCODE="$OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-postencode" -if [ -f $OPENQRM_RESOURCE_PARAMETER_FILE ]; then - . $OPENQRM_RESOURCE_PARAMETER_FILE - OPENQRM_SERVER_IP=$resource_openqrmserver - OPENQRM_EXEC_PORT=$resource_execdport -elif [ -f $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf ]; then - . $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf - . $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions - openqrm_server_get_config - OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS - resource_id=0 - resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS - openqrm_web_protocol=$OPENQRM_WEB_PROTOCOL -fi -export LANG=C -# how long to wait for the volume authentication, each loop is 5 secs -MAX_VOLUME_AUTHENTICATION_LOOP=300 -export MAX_VOLUME_AUTHENTICATION_LOOP -# dir for progress stats -SYNC_PROGRESS_DIR="/tmp" - -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - -if [ ! -d "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY" ]; then - mkdir -p $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY -fi - -# make sure required deps are installed -if ! check_nfs_storage_deps; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $@ - fi - exit 1 -fi - -function nfs_storage_usage() { - echo "Usage : $0 add/remove/clone|snap/list <-n image-name>" - echo " [-s image-snapshot-name]" - echo " $0 auth <-r image-rootdevice> <-i ip-address>" - echo " $0 adapt <-n image-name> <-u username> <-p password>" - echo " $0 post_exports <-u username> <-p password>" - echo " $0 post_identifier <-u username> <-p password>" - echo " $0 post_sync_progress <-n image-name> <-u username> <-p password>" - echo " $0 post_sync_finished <-n image-name> <-u username> <-p password>" - echo "" - echo "Optional parameters:" - echo " [--openqrm-ui-user ]" - echo " [--openqrm-internal-cmd ]" - echo " [--openqrm-cmd-mode ]" - exit 1 -} - - -FULL_COMMANDLINE="$0 $@" -NFS_COMMAND=$1 -shift - -while [ $# -ne 0 ]; do - case "$1" in - -n) - NFS_IMAGE_NAME=$2 - shift - ;; - -s) - NFS_IMAGE_SNAPSHOT_NAME=$2 - shift - ;; - -i) - NFS_IMAGE_AUTH_IP=$2 - shift - ;; - -r) - NFS_IMAGE_ROOTDEVICE=$2 - shift - ;; - -t) - NFS_IMAGE_TYPE=$2 - shift - ;; - -u) - NFS_OPENQRM_USERNAME=$2 - shift - ;; - -p) - NFS_OPENQRM_PASSWORD=$2 - shift - ;; - --openqrm-ui-user) - OPENQRM_UI_USER=$2 - shift - ;; - --openqrm-internal-cmd) - OPENQRM_INTERNAL_CMD=$2 - shift - ;; - --openqrm-cmd-mode) - OPENQRM_CMD_MODE=$2 - shift - ;; - - *) - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - echo "ERROR: Free commandline arguments are not allowed" - nfs_storage_usage - exit 6 - ;; - esac - shift -done - - - - -# main -if [ "$NFS_COMMAND" == "" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - nfs_storage_usage -fi - -if [ "$NFS_COMMAND" == "post_exports" ] || [ "$NFS_COMMAND" == "post_identifier" ]; then - if [ "$NFS_OPENQRM_USERNAME" == "" ]; then - nfs_storage_usage - fi - if [ "$NFS_OPENQRM_PASSWORD" == "" ]; then - nfs_storage_usage - fi -else - if [ "$NFS_COMMAND" != "list" ] && [ "$NFS_COMMAND" != "auth" ]; then - if [ "$NFS_IMAGE_NAME" == "" ]; then - if [ "$NON_BLOCKING" != "true" ]; then - openqrm_unblock_starting_queue $FULL_COMMANDLINE - fi - nfs_storage_usage - fi - fi -fi -if [ "$OPENQRM_UI_USER" != "" ]; then - OPENQRM_UI_USER_PARAMETER=" --openqrm-ui-user $OPENQRM_UI_USER" -fi - -case "$NFS_COMMAND" in - - add) - if [ -d "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME" ]; then - openqrm_post_event 0 "add" 3 "nfs-storage" "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME already exists." - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire nfs-storage` - trap "openqrm_lock_queue release nfs-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - openqrm_post_event 0 "add" 5 "nfs-storage" "Creating NFS export for image $NFS_IMAGE_NAME." - - # add to exports - manage_nfs add $OPENQRM_SERVER_IP - - openqrm_lock_queue release nfs-storage $LOCK_TIME - trap '' EXIT - - # in case we have a username + password post the updated list to the openQRM-server - if [ "$NFS_OPENQRM_USERNAME" != "" ] && [ "$NFS_OPENQRM_PASSWORD" != "" ]; then - $0 post_exports -u $NFS_OPENQRM_USERNAME -p $NFS_OPENQRM_PASSWORD --openqrm-internal-cmd true - fi - ;; - - remove) - # check that source fs-images exist - if [ ! -d "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME" ]; then - openqrm_post_event 0 "remove" 3 "nfs-storage" "Volume $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME does not exists!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - # check that it is not in use by a syncing action - if ls $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME/.sync_in_progress.* 1>/dev/null 2>&1; then - openqrm_post_event 0 "remove" 3 "nfs-storage" "Volume $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME is currently in use by a sync action!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - if [ -f "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME/.clone_in_progress" ]; then - openqrm_post_event 0 "remove" 3 "nfs-storage" "Volume $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME is currently in use by a clone action!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire nfs-storage` - trap "openqrm_lock_queue release nfs-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - openqrm_post_event 0 "add" 5 "nfs-storage" "Removing NFS export for image $NFS_IMAGE_NAME." - - manage_nfs remove - - openqrm_lock_queue release nfs-storage $LOCK_TIME - trap '' EXIT - - if [ "$NFS_OPENQRM_USERNAME" != "" ] && [ "$NFS_OPENQRM_PASSWORD" != "" ]; then - $0 post_exports -u $NFS_OPENQRM_USERNAME -p $NFS_OPENQRM_PASSWORD --openqrm-internal-cmd true - fi - ;; - - clone|snap) - if [ "$NFS_IMAGE_SNAPSHOT_NAME" == "" ]; then - openqrm_post_event 0 "clone" 3 "nfs-storage" "No snapshot name given. Please use the -s cmdline parameter." - nfs_storage_usage - fi - # check that source fs-images exist - if [ ! -d "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME" ]; then - openqrm_post_event 0 "clone" 3 "nfs-storage" "Source volume $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME does not exists!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - if [ -f "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_SNAPSHOT_NAME/.clone_in_progress" ]; then - openqrm_post_event 0 "clone" 3 "nfs-storage" "There is already an active cloning action running for snapshot $NFS_IMAGE_SNAPSHOT_NAME!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - if [ -d "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_SNAPSHOT_NAME" ]; then - openqrm_post_event 0 "clone" 3 "nfs-storage" "Snapshot $NFS_IMAGE_SNAPSHOT_NAME already exists!" - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire nfs-storage` - trap "openqrm_lock_queue release nfs-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - openqrm_post_event 0 "add" 5 "nfs-storage" "Creating snapshot from image $NFS_IMAGE_NAME -> $NFS_IMAGE_SNAPSHOT_NAME." - mkdir -p "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_SNAPSHOT_NAME" - # create lock in the origin for clone so remove is not able to remove the origin while syncing - touch "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME/.sync_in_progress.$NFS_IMAGE_SNAPSHOT_NAME" - # create long-term-action start event - openqrm_post_event 0 "$NFS_IMAGE_SNAPSHOT_NAME" 9 "nfs-storage" "Started to clone $NFS_IMAGE_SNAPSHOT_NAME from $NFS_IMAGE_NAME" - - export ORG_IMAGE_NAME=$NFS_IMAGE_NAME - export NFS_IMAGE_NAME=$NFS_IMAGE_SNAPSHOT_NAME - manage_nfs add $OPENQRM_SERVER_IP - # create a lock in the new created dir for post_exports + identifier - touch "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME/.clone_in_progress" - - openqrm_lock_queue release nfs-storage $LOCK_TIME - trap '' EXIT - - # get a list of files to sync - rsync -a -vv --list-only --progress --exclude="/.sync_in_progress.*" $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$ORG_IMAGE_NAME/* $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME/ > $SYNC_PROGRESS_DIR/rsync_files.$NFS_IMAGE_NAME.log - > $SYNC_PROGRESS_DIR/rsync_progress.$NFS_IMAGE_NAME.log - # post exports early, we show the progress in the ui - if [ "$NFS_OPENQRM_USERNAME" != "" ] && [ "$NFS_OPENQRM_PASSWORD" != "" ]; then - $0 post_sync_progress -n $NFS_IMAGE_NAME -u $NFS_OPENQRM_USERNAME -p $NFS_OPENQRM_PASSWORD --openqrm-internal-cmd true & - fi - # delay start syncing - sleep 10 - rsync -a --progress --exclude="/.sync_in_progress.*" $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$ORG_IMAGE_NAME/* $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME/ > $SYNC_PROGRESS_DIR/rsync_progress.$NFS_IMAGE_NAME.log - - # remove lock from the origin + snapshot - rm -f "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$ORG_IMAGE_NAME/.sync_in_progress.$NFS_IMAGE_NAME" - rm -f "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME/.clone_in_progress" - - # stop sync-progress monitor and send sync-finished to openQRM - rm -f $SYNC_PROGRESS_DIR/rsync_progress.$NFS_IMAGE_NAME.log $SYNC_PROGRESS_DIR/rsync_files.$NFS_IMAGE_NAME.log - $0 post_sync_finished -n $NFS_IMAGE_NAME -u $NFS_OPENQRM_USERNAME -p $NFS_OPENQRM_PASSWORD --openqrm-internal-cmd true - # create long-term-action finished event - openqrm_post_event 0 "$NFS_IMAGE_SNAPSHOT_NAME" 10 "nfs-storage" "Finished to clone $NFS_IMAGE_SNAPSHOT_NAME" - ;; - - auth) - if [ "$NFS_IMAGE_ROOTDEVICE" == "" ]; then - NFS_IMAGE_ROOTDEVICE="$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME" - fi - echo -n "Authenticating NFS export $NFS_IMAGE_ROOTDEVICE to $NFS_IMAGE_AUTH_IP" - if [ "$NFS_OPENQRM_USERNAME" != "" ] && [ "$NFS_OPENQRM_PASSWORD" != "" ] && [ "$NFS_IMAGE_NAME" != "" ]; then - MAX_AUTH_LOOP=0 - while (true); do - # if this is a snapshot volume we have to wait until the sync is ready - if [ -d "$NFS_IMAGE_ROOTDEVICE" ] && [ ! -f "$NFS_IMAGE_ROOTDEVICE/.clone_in_progress" ]; then - # sync is ready - break - fi - sleep 5 - if [ "$MAX_AUTH_LOOP" == "$MAX_VOLUME_AUTHENTICATION_LOOP" ]; then - openqrm_post_event 0 "auth" 3 "nfs-storage" "Volume $NFS_IMAGE_ROOTDEVICE does not exists, Cannot auth to $NFS_IMAGE_AUTH_IP." - exit 1 - fi - MAX_AUTH_LOOP=$(( MAX_AUTH_LOOP + 1 )) - done - fi - # auth in exports - LOCK_TIME=`openqrm_lock_queue aquire nfs-storage` - trap "openqrm_lock_queue release nfs-storage $LOCK_TIME" EXIT - - manage_nfs auth $NFS_IMAGE_AUTH_IP - - openqrm_lock_queue release nfs-storage $LOCK_TIME - trap '' EXIT - # if we have an image name send back to openQRM that storage auth finished to remvoe the storage-auth-blocker - if [ "$NFS_OPENQRM_USERNAME" != "" ] && [ "$NFS_OPENQRM_PASSWORD" != "" ] && [ "$NFS_IMAGE_NAME" != "" ]; then - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$NFS_OPENQRM_USERNAME --http-password=$NFS_OPENQRM_PASSWORD "$openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/nfs-storage/nfs-storage-action.php?nfs_storage_command=auth_finished&nfs_image_name=$NFS_IMAGE_NAME"; then - openqrm_post_event 0 "auth" 3 "nfs-storage" "Could not remove the storage-auth-blocker from openQRM at $OPENQRM_SERVER_IP." - fi - # post exports again - $0 post_exports -u $NFS_OPENQRM_USERNAME -p $NFS_OPENQRM_PASSWORD --openqrm-internal-cmd true - fi - ;; - - adapt) - if [ ! -d "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME" ]; then - openqrm_post_event 0 "adapt" 3 "nfs-storage" "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME does not exist." - openqrm_unblock_starting_queue $FULL_COMMANDLINE - exit 1 - fi - - LOCK_TIME=`openqrm_lock_queue aquire nfs-storage` - trap "openqrm_lock_queue release nfs-storage $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - # add to exports - manage_nfs adapt $OPENQRM_SERVER_IP - - openqrm_lock_queue release nfs-storage $LOCK_TIME - trap '' EXIT - - STORAGE_STATUS_TMP=$resource_id.nfs.$NFS_IMAGE_NAME.adapt - > $STORAGE_STATUS_TMP - echo "$IMAGE_NAME,$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME" >> $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$NFS_OPENQRM_USERNAME --http-password=$NFS_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/nfs-storage/nfs-storage-action.php?nfs_storage_command=get_ident; then - openqrm_post_event 0 "adapt" 3 "nfs-storage" "Could not post the nfs-export identifier to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP - rm -f $STORAGE_STATUS_TMP.post - - ;; - - list) - ls $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY - ;; - post_exports) - BACKEND_DIR_AVAIL_SPACE=`df --block-size MB $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY | grep -v Used | awk '{ print $2 }' | sed -e "s/MB//g"` - BACKEND_DIR_FREE_SPACE=`df --block-size MB $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY | grep -v Used | awk '{ print $4 }' | sed -e "s/MB//g"` - STORAGE_STATUS_TMP=$resource_id.nfs.stat - # send avail + free as first line, all next lines are luns - echo "$BACKEND_DIR_AVAIL_SPACE""@""$BACKEND_DIR_FREE_SPACE" > $STORAGE_STATUS_TMP - for VOLUME in `ls $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY`; do - if grep -w ^$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$VOLUME /var/lib/nfs/etab 1>/dev/null; then - AUTHENTICATED=`grep -w ^$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$VOLUME /var/lib/nfs/etab | awk '{ print $2 }' | cut -d'(' -f1` - if [ -f "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$VOLUME/.clone_in_progress" ]; then - echo "nfs-deployment""@""$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$VOLUME""@""$AUTHENTICATED""@""clone_in_progress" >> $STORAGE_STATUS_TMP - else - echo "nfs-deployment""@""$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$VOLUME""@""$AUTHENTICATED""@" >> $STORAGE_STATUS_TMP - fi - else - echo "@""$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$VOLUME""@@" >> $STORAGE_STATUS_TMP - fi - done - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$NFS_OPENQRM_USERNAME --http-password=$NFS_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/nfs-storage/nfs-storage-action.php?nfs_storage_command=get_storage; then - openqrm_post_event 0 "post_exports" 3 "nfs-storage" "Could not post the nfs-export status to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP - rm -f $STORAGE_STATUS_TMP.post - ;; - post_identifier) - echo "Posting current nfs-identifier to the openQRM-server" - STORAGE_STATUS_TMP=$resource_id.nfs.ident - > $STORAGE_STATUS_TMP - for IMAGE_NAME_EXPORT in `cat /var/lib/nfs/etab | grep ^$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY | awk {' print $1 '} | sed -e "s/<.*>//g" | sed -e "s/(.*)//g"`; do - if [ ! -f "$IMAGE_NAME_EXPORT/.clone_in_progress" ]; then - IMAGE_NAME=`basename $IMAGE_NAME_EXPORT` - echo "$IMAGE_NAME,$IMAGE_NAME_EXPORT" >> $STORAGE_STATUS_TMP - fi - done - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$NFS_OPENQRM_USERNAME --http-password=$NFS_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/nfs-storage/nfs-storage-action.php?nfs_storage_command=get_ident; then - openqrm_post_event 0 "post_identifier" 3 "nfs-storage" "Could not post the nfs-export identifier to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP - rm -f $STORAGE_STATUS_TMP.post - ;; - - post_sync_progress) - echo "Posting progress of the sync action for volume $NFS_IMAGE_NAME to the openQRM-server" - if [ ! -f "$SYNC_PROGRESS_DIR/rsync_files.$NFS_IMAGE_NAME.log" ] || [ ! -f "$SYNC_PROGRESS_DIR/rsync_progress.$NFS_IMAGE_NAME.log" ]; then - openqrm_post_event 0 "clone" 3 "nfs-storage" "No sync action active for volume $NFS_IMAGE_NAME!" - exit 1 - fi - STORAGE_STATUS_TMP=$resource_id.nfs.$NFS_IMAGE_NAME.sync_progress - - while (true); do - # if this is a snapshot volume we have to wait until the sync is ready - if [ -d "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME/" ] && [ ! -f "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME/.clone_in_progress" ]; then - # sync is ready - break - else - if [ ! -f "$SYNC_PROGRESS_DIR/rsync_files.$NFS_IMAGE_NAME.log" ] || [ ! -f "$SYNC_PROGRESS_DIR/rsync_progress.$NFS_IMAGE_NAME.log" ]; then - # cloning not started yet, waiting for the snapshot to appear - echo "0" > $STORAGE_STATUS_TMP - else - # get the size of all changes - COMPLETE_CHANGE_SIZE=`cat $SYNC_PROGRESS_DIR/rsync_files.$NFS_IMAGE_NAME.log | wc -l` - # double up to get around 100 percent - COMPLETE_CHANGE_SIZE=$(( COMPLETE_CHANGE_SIZE * 2 )) - PARTITIAL_CHANGE_SIZE=`cat $SYNC_PROGRESS_DIR/rsync_progress.$NFS_IMAGE_NAME.log | wc -l` - if [ "$PARTITIAL_CHANGE_SIZE" == 0 ]; then - PARTITIAL_CHANGE_SIZE=1 - fi - CURRENT_SYNC_PROGRESS_IN_PERCENT=$(( COMPLETE_CHANGE_SIZE / PARTITIAL_CHANGE_SIZE )) - CURRENT_SYNC_PROGRESS_IN_PERCENT=$(( 100 / CURRENT_SYNC_PROGRESS_IN_PERCENT )) - # make sure to not send 100%, this is send by clone finished - CURRENT_SYNC_PROGRESS_IN_PERCENT=$(( CURRENT_SYNC_PROGRESS_IN_PERCENT - 1 )) - if (( $CURRENT_SYNC_PROGRESS_IN_PERCENT < 0 )); then - CURRENT_SYNC_PROGRESS_IN_PERCENT=0 - fi - echo "$CURRENT_SYNC_PROGRESS_IN_PERCENT" > $STORAGE_STATUS_TMP - fi - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$NFS_OPENQRM_USERNAME --http-password=$NFS_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/nfs-storage/nfs-storage-action.php?nfs_storage_command=get_sync_progress; then - nfs_storage_log "post_sync_progress" "Could not post the sync progress for volume $NFS_IMAGE_NAME to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - fi - sleep 2 - done - ;; - - - post_sync_finished) - echo "Posting finished for volume $NFS_IMAGE_NAME to the openQRM-server" - STORAGE_STATUS_TMP=$resource_id.nfs.$NFS_IMAGE_NAME.sync_progress - echo "100" > $STORAGE_STATUS_TMP - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$NFS_OPENQRM_USERNAME --http-password=$NFS_OPENQRM_PASSWORD --post-file=`$OPENQRM_POSTENCODE $STORAGE_STATUS_TMP` $openqrm_web_protocol://$OPENQRM_SERVER_IP/openqrm/base/plugins/nfs-storage/nfs-storage-action.php?nfs_storage_command=get_sync_finished; then - nfs_storage_log "post_sync_finished" "Could not post the sync progress for volume $NFS_IMAGE_NAME to openQRM at $OPENQRM_SERVER_IP." - fi - rm -f $STORAGE_STATUS_TMP $STORAGE_STATUS_TMP.post - ;; - - - - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - nfs_storage_usage - ;; - - -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/init.d/nfs-storage b/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/init.d/nfs-storage deleted file mode 100644 index 3b8c338..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/init.d/nfs-storage +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the NFS-Storage-hosts -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/include/openqrm-plugin-nfs-storage-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/etc/openqrm-plugin-nfs-storage.conf - -# do not start on the intitrd -if [ -f /etc/initrd-devices.conf ]; then - exit 0 -fi - -function nfs_storage_start() { - echo "Starting the openQRM nfs-storage-plugin" - if [ "$NFS_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/nfs-kernel-server" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs-kernel-server start - else - /etc/init.d/nfs-kernel-server start - fi - fi - if [ -x "/etc/init.d/nfs" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs start - else - /etc/init.d/nfs start - fi - fi - if [ -x "/etc/init.d/nfslock" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfslock start - else - /etc/init.d/nfslock start - fi - fi - # for Suse - if [ -x /etc/init.d/nfsserver ]; then - /etc/init.d/nfsserver start - fi - fi -} - - -function nfs_storage_stop() { - echo "Stopping the openQRM nfs-storage-plugin" - if [ "$NFS_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/nfs-kernel-server" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs-kernel-server stop - else - /etc/init.d/nfs-kernel-server stop - fi - fi - if [ -x "/etc/init.d/nfs" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs stop - else - /etc/init.d/nfs stop - fi - fi - if [ -x "/etc/init.d/nfslock" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfslock stop - else - /etc/init.d/nfslock stop - fi - fi - # for Suse - if [ -x /etc/init.d/nfsserver ]; then - /etc/init.d/nfsserver stop - fi - fi -} - - - - - -case "$1" in - start) - nfs_storage_start - ;; - stop) - nfs_storage_stop - ;; - restart) - nfs_storage_stop - sleep 1 - nfs_storage_start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 - -esac -exit $? - diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/init.d/openqrm-plugin-nfs-storage b/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/init.d/openqrm-plugin-nfs-storage deleted file mode 100644 index 62bd7c8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/init.d/openqrm-plugin-nfs-storage +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# init script for the openQRM nfs-storage-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/include/openqrm-plugin-nfs-storage-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/etc/openqrm-plugin-nfs-storage.conf - - - -function openqrm_plugin_nfs_storage_start() { - echo "Starting the openQRM nfs-storage-plugin" - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/nfs-storage/.running - - [[ "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY" ]] || mkdir -p $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY - - if [ "$NFS_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/portmap" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d portmap start - else - /etc/init.d/portmap start - fi - fi - if [ -x "/etc/init.d/nfs-kernel-server" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs-kernel-server start - else - /etc/init.d/nfs-kernel-server start - fi - fi - - - if [ -x "/etc/init.d/nfs" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs start - else - /etc/init.d/nfs start - fi - fi - if [ -x "/etc/init.d/nfslock" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfslock start - else - /etc/init.d/nfslock start - fi - fi - # for Suse - if [ -x /etc/init.d/nfsserver ]; then - /etc/init.d/nfsserver start - fi - fi -} - - -function openqrm_plugin_nfs_storage_stop() { - echo "Stopping the openQRM nfs-storage-plugin" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/nfs-storage/.running - if [ "$NFS_STORAGE_AUTO_START" == "yes" ]; then - if [ -x "/etc/init.d/nfs-kernel-server" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs-kernel-server stop - else - /etc/init.d/nfs-kernel-server stop - fi - fi - if [ -x "/etc/init.d/portmap" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d portmap stop - else - /etc/init.d/portmap stop - fi - fi - - if [ -x "/etc/init.d/nfs" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfs stop - else - /etc/init.d/nfs stop - fi - fi - if [ -x "/etc/init.d/nfslock" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d nfslock stop - else - /etc/init.d/nfslock stop - fi - fi - # for Suse - if [ -x /etc/init.d/nfsserver ]; then - /etc/init.d/nfsserver stop - fi - fi -} - - -function openqrm_plugin_nfs_storage_uninstall() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "nfs-storage: Please give a username to uninstall the plugin : " - read USERNAME - echo - echo -n "nfs-storage: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Uninstalling the openQRM nfs-storage-plugin" - openqrm_plugin_nfs_storage_stop - openqrm_server_remove_deployment_type $USERNAME $PASSWORD nfs-deployment - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/nfs-storage - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.nfs-deployment - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.nfs-deployment.php - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-nfs-storage.tgz -} - -function openqrm_plugin_nfs_storage_init() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "nfs-storage: Please give a username to init the plugin : " - read USERNAME - echo - echo -n "nfs-storage: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Initializing the openQRM nfs-storage-plugin" - openqrm_server_add_deployment_type $USERNAME $PASSWORD nfs-deployment nfs-deployment "Nfs-root deployment" nfs-storage "NFS Storage" - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/nfs-storage - # linking the boot-service - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/boot-service-nfs-storage.tgz $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-nfs-storage.tgz - # linking the root mount hook - chmod +x $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/root-mount.nfs-deployment - ln -s $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/root-mount.nfs-deployment $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/root-mount.nfs-deployment - # linking the image-menu - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/image.nfs-deployment.php $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/image.nfs-deployment.php - # create storage dir for stat files - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/storage - chmod 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/storage - echo "Order deny,allow" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/storage/.htaccess - echo "Deny from all" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/web/storage/.htaccess - -} - -USER=$2 -PASS=$3 - -case "$1" in - start) - openqrm_plugin_nfs_storage_start - ;; - stop) - openqrm_plugin_nfs_storage_stop - ;; - restart) - openqrm_plugin_nfs_storage_stop - sleep 1 - openqrm_plugin_nfs_storage_start - ;; - init) - openqrm_plugin_nfs_storage_init $USER $PASS - ;; - uninstall) - openqrm_plugin_nfs_storage_uninstall $USER $PASS - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/init.d/openqrm-plugin-nfs-storage.postinstall b/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/init.d/openqrm-plugin-nfs-storage.postinstall deleted file mode 100644 index 55967fb..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/init.d/openqrm-plugin-nfs-storage.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-nfs-storage postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/init.d/openqrm-plugin-nfs-storage.preremove b/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/init.d/openqrm-plugin-nfs-storage.preremove deleted file mode 100644 index f1fd71e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/init.d/openqrm-plugin-nfs-storage.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-nfs-storage preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-nfs-storage stop \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/openqrm-plugin-nfs-storage.conf b/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/openqrm-plugin-nfs-storage.conf deleted file mode 100644 index fff0719..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/etc/openqrm-plugin-nfs-storage.conf +++ /dev/null @@ -1,44 +0,0 @@ -# this is the openQRM-plugin-nfs-storage info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - - -OPENQRM_PLUGIN_DESCRIPTION="Integrates NFS as Storage technology (network-deployment)." -OPENQRM_PLUGIN_TYPE="storage" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# The directory for the NFS exports -OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY="/exports" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/nfs-storage/etc/openqrm-plugin-nfs-storage.conf" - -# if openQRM should start/stop the storage component (yes/no), default no -NFS_STORAGE_AUTO_START="yes" diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/include/openqrm-plugin-nfs-storage-functions b/openQRM-5.3.50-CE/src/plugins/nfs-storage/include/openqrm-plugin-nfs-storage-functions deleted file mode 100644 index f1680db..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/include/openqrm-plugin-nfs-storage-functions +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/bash -# this is the functions file for the nfs-storage-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# some definitions -DEFAULT_IMAGE_SIZE=5000 -NFSEXPORTS="/etc/exports" - -################ common nfs-storage functions - -# logs for nfs_storage -function nfs_storage_log() { - local COMPONENT=$1 - shift - local MESSAGE=$@ - logger -i -t "nfs-storage plug-in" "$COMPONENT : $MESSAGE" -} - -################ nfs-storage functions - - -# deps function -function check_nfs_storage_deps() { - # check and fullfill dependencies - # screen - if ! openqrm_full_fill_os_dependency screen screen; then - return 1 - fi - if [ -x /usr/bin/screen.real ]; then - export RUNSCREEN="/usr/bin/screen.real" - else - export RUNSCREEN=`which screen` - fi - # wget - if ! openqrm_full_fill_os_dependency wget wget; then - return 1 - fi - # procmail for lockfile - if ! openqrm_full_fill_os_dependency lockfile procmail; then - return 1 - fi - # rsync - if ! openqrm_full_fill_os_dependency rsync rsync; then - return 1 - fi - if [ -f /etc/debian_version ]; then - # nfs-kernel-server - if ! openqrm_full_fill_os_dependency exportfs nfs-kernel-server; then - return 1 - fi - # nfs-common - if ! openqrm_full_fill_os_dependency mount.nfs nfs-common; then - return 1 - fi - elif [ -f /etc/redhat-release ]; then - # nfs-utils - if ! openqrm_full_fill_os_dependency mount.nfs nfs-utils; then - return 1 - fi - elif [ -f /etc/SuSE-release ]; then - # nfs-client - if ! openqrm_full_fill_os_dependency mount.nfs nfs-client; then - return 1 - fi - # nfs-kernel-server - if ! openqrm_full_fill_os_dependency exportfs nfs-kernel-server; then - return 1 - fi - fi - -} - - -function restart_nfs() { - if [ -x /etc/init.d/nfs ]; then - /etc/init.d/nfs reload - elif [ -x /etc/init.d/nfs-kernel-server ]; then - /etc/init.d/nfs-kernel-server reload - elif [ -x /etc/init.d/nfsserver ]; then - /etc/init.d/nfsserver reload - else - exportfs -r - fi -} - - - -function manage_nfs() { - case "$1" in - add) - OPENQRM_SERVER=$2 - mkdir -p $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME - echo "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME $OPENQRM_SERVER(rw,insecure,no_root_squash,async,no_subtree_check)" >> $NFSEXPORTS - sed -i '/^$/d' $NFSEXPORTS - restart_nfs - ;; - remove) - # tabs and spaces - sed -i -e "s#^$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME .*##g" $NFSEXPORTS - sed -i -e "s#^$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME .*##g" $NFSEXPORTS - sed -i '/^$/d' $NFSEXPORTS - restart_nfs - rm -rf $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME/* - rmdir $OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME - ;; - - auth) - AUTH_IP=$2 - # tabs and spaces - sed -i -e "s#^$NFS_IMAGE_ROOTDEVICE .*#$NFS_IMAGE_ROOTDEVICE $AUTH_IP(rw,insecure,no_root_squash,async,no_subtree_check)#g" $NFSEXPORTS - sed -i -e "s#^$NFS_IMAGE_ROOTDEVICE .*#$NFS_IMAGE_ROOTDEVICE $AUTH_IP(rw,insecure,no_root_squash,async)#g" $NFSEXPORTS - sed -i '/^$/d' $NFSEXPORTS - restart_nfs - ;; - - adapt) - AUTH_IP=$2 - if ! grep -w ^$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME $NFSEXPORTS 1>/dev/null; then - echo "$OPENQRM_NFS_STORAGE_SERVER_IMAGE_DIRECTORY/$NFS_IMAGE_NAME $AUTH_IP(rw,insecure,no_root_squash,async,no_subtree_check)" >> $NFSEXPORTS - sed -i '/^$/d' $NFSEXPORTS - restart_nfs - fi - ;; - - esac -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage-about.bootservice.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage-about.bootservice.class.php deleted file mode 100644 index fd85f0e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage-about.bootservice.class.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ - -class nfs_storage_about_bootservice -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'nfs_storage_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "nfs_storage_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/nfs-storage-about-bootservice.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['boot_service_title'], 'boot_service_title'); - $t->add($this->lang['boot_service_content'], 'boot_service_content'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage-about.controller.class.php deleted file mode 100644 index 15b4515..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage-about.controller.class.php +++ /dev/null @@ -1,255 +0,0 @@ - - */ - - -class nfs_storage_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'nfs_storage_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'nfs_storage_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'nfs_storage_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'nfs_storage_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About NFS-Storage', - 'label' => 'About NFS-Storage', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The "NFS-Storage" plugin manages NFS-Server in openQRM. - ', - 'requirements_title' => 'Requirements', - 'requirements_list' => '
  • A resource for the NFS-Storage Storage (this can be a remote system integrated into openQRM e.g. via the "local-server" plugin or the openQRM server itself)
  • -
  • The following packages must be installed: nfs-common, nfs-kernel-server, screen, rsync
  • ', - - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - - 'provides_title' => 'Provides', - 'provides_list' => '
  • Storage type: "NFS Storage"
  • -
  • Deployment types: "Nfs-root deployment"
  • ', - 'type_title' => 'Plugin Type', - 'type_content' => 'Storage', - - 'deployment_title' => 'Deployment Type', - 'deployment_content' => 'Network-Deployment', - - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - 'network_deploymet' => 'Network-Deployment', - 'doc1' => '', - ), - 'bootservice' => array ( - 'tab' => 'Boot-Service', - 'label' => 'NFS-Storage Boot-Service', - 'boot_service_title' => 'NFS-Storage Host Boot-Service', - 'boot_service_content' => 'The NFS-Storage Plugin provides an openQRM Boot-Service. - This "NFS-Storage Boot-Service" is automatically downloaded and executed by the openQRM-Client on all integrated Systems. - The Boot-Service is located at:
    -
    - /usr/share/openqrm/plugins/nfs-storage/web/boot-service-nfs-storage.tgz -
    -
    - The "NFS-Storage Boot-Service contains the Client files of the NFS-Storage Plugin.
    - Also a configuration file for the NFS-Storage server is included in this Boot-Service.
    -
    - The Boot-Service configuration can be viewed and administrated by the "openqrm" utility.
    - To view the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n nfs-storage -a default -
    -
    - To view a Boot-Service configuration of a specific appliance run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n nfs-storage -a [appliance-name] -
    -
    - To adapt a parameter in the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n nfs-storage -a default -k [key] -v [value] -
    -
    - To adapt a paramter in the Boot-Service configuration of a specific appliance run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n nfs-storage -a [appliance-name] -k [key] -v [value] -
    -
    - In case the openmQRM Server itself is used as the NFS-Storage Storage please edit:
    -
    - /usr/share/openqrm/plugins/nfs-storage/etc/openqrm-plugin-nfs-storage.conf -
    -
    - and set the configuration keys.
    -
    - ', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/nfs-storage/lang", 'nfs-storage-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/nfs-storage/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "documentation"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - case 'bootservice': - $content[] = $this->bootservice(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About NFS-Storage - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/nfs-storage/class/nfs-storage-about.documentation.class.php'); - $controller = new nfs_storage_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Boot-Service - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function bootservice( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/nfs-storage/class/nfs-storage-about.bootservice.class.php'); - $controller = new nfs_storage_about_bootservice($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['bootservice']; - $data = $controller->action(); - } - $content['label'] = $this->lang['bootservice']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'bootservice' ); - $content['onclick'] = false; - if($this->action === 'bootservice'){ - $content['active'] = true; - } - return $content; - } - - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage-about.documentation.class.php deleted file mode 100644 index c931bb8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage-about.documentation.class.php +++ /dev/null @@ -1,89 +0,0 @@ - - */ - -class nfs_storage_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'nfs_storage_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "nfs_storage_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/nfs-storage-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['deployment_title'], 'deployment_title'); - $t->add($this->lang['deployment_content'], 'deployment_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.add.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.add.class.php deleted file mode 100644 index 1854193..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.add.class.php +++ /dev/null @@ -1,293 +0,0 @@ - - */ - -class nfs_storage_add -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'nfs_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "nfs_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'nfs_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'nfs_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response, $controller) { - $this->controller = $controller; - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->user = $openqrm->user(); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = $this->openqrm->storage(); - $resource = $this->openqrm->resource(); - $deployment = $this->openqrm->deployment(); - $this->response->params['storage_id'] = $this->response->html->request()->get('storage_id'); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->set_max(); - $response = $this->add(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->controller->reload(); - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/nfs-storage-add.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Add - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function add() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - if($form->get_request('size') > $this->max) { - $form->set_error('size', sprintf($this->lang['error_size_exeeded'], number_format($this->max, 0, '', '').' MB')); - } - if(!$form->get_errors()) { - $name = $form->get_request('name'); - $command = $this->openqrm->get('basedir')."/plugins/nfs-storage/bin/openqrm-nfs-storage add -n $name"; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = $this->storage; - $resource = $this->resource; - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - - $statfile = $this->openqrm->get('basedir').'/plugins/nfs-storage/web/storage/'.$storage->resource_id.'.nfs.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = basename($line[1]); - if($name === $check) { - $error = sprintf($this->lang['error_exists'], $name); - } - } - } - } - } - if(isset($error)) { - $response->error = $error; - } else { - if($this->file->exists($statfile)) { - $this->file->remove($statfile); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($statfile)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - - // add check that volume $name is now in the statfile - $created = false; - $volume_path = ""; - $lines = explode("\n", $this->file->get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = basename($line[1]); - if($name === $check) { - $created = true; - $volume_path = $line[1]; - break; - } - } - } - } - - if ($created) { - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $name; - $image_fields['image_type'] = $this->deployment->type; - $image_fields['image_rootfstype'] = 'nfs'; - $image_fields['image_storageid'] = $this->storage->id; - $image_fields['image_comment'] = "Image Object for volume $name"; - $image_fields['image_rootdevice'] = $volume_path; - $image_fields['image_size']=0; - $image = new image(); - $image->add($image_fields); - $response->msg = sprintf($this->lang['msg_added'], $name); - // save image id in response for the wizard - $response->image_id = $image_fields["image_id"]; - - } else { - $response->msg = sprintf($this->lang['msg_add_failed'], $name); - } - } - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'add'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['id'] = 'name'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['css'] = 'namegen'; - $d['name']['object']['attrib']['customattribs'] = 'data-prefix="nfs_" data-length="8"'; - $d['name']['object']['attrib']['value'] = ''; - $d['name']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - - //-------------------------------------------- - /** - * Set max - * - * @access protected - * @return bool - */ - //-------------------------------------------- - function set_max() { - $statfile = $this->openqrm->get('basedir').'/plugins/nfs-storage/web/storage/'.$this->resource->id.'.nfs.stat'; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $max = $line[1]; - $max = (int)$max; - $this->max = $max; - return true; - break; - } - } - } else { - return false; - } - } else { - return false; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.api.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.api.class.php deleted file mode 100644 index b9143cf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.api.class.php +++ /dev/null @@ -1,95 +0,0 @@ - - */ - -class nfs_storage_api -{ - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param object $nfs_storage_controller - */ - //-------------------------------------------- - function __construct($nfs_storage_controller) { - $this->controller = $nfs_storage_controller; - $this->user = $this->controller->user; - $this->html = $this->controller->response->html; - $this->response = $this->html->response(); - $this->file = $this->controller->file; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - */ - //-------------------------------------------- - function action() { - $action = $this->html->request()->get($this->controller->actions_name); - switch( $action ) { - case 'monitor': - $this->monitor(); - break; - case 'progress': - $this->progress(); - break; - } - } - - //-------------------------------------------- - /** - * Monitor - * - * @access public - */ - //-------------------------------------------- - function monitor() { - $filename = '/etc/exports'; - $lastmodif = isset($_GET['timestamp']) ? $_GET['timestamp'] : 0; - $currentmodif = filemtime($filename); - while ($currentmodif <= $lastmodif) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - $currentmodif = filemtime($filename); - } - echo 'changed'; - - } - - //-------------------------------------------- - /** - * Get progress - * - * @access public - */ - //-------------------------------------------- - function progress() { - $name = basename($this->response->html->request()->get('name')); - $file = $this->controller->openqrm->get('basedir').'/plugins/nfs-storage/web/storage/'.$name; - if($this->file->exists($file)) { - echo $this->file->get_contents($file); - } else { - header("HTTP/1.0 404 Not Found"); - } - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.auth.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.auth.class.php deleted file mode 100644 index 02c385a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.auth.class.php +++ /dev/null @@ -1,208 +0,0 @@ - - */ - -class nfs_storage_auth -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'nfs_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "nfs_storage_msg"; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'nfs_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'nfs_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->file = $this->openqrm->file(); - $this->volume = $this->response->html->request()->get('volume'); - $this->response->params['volume'] = $this->volume; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->auth(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/nfs-storage-auth.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add(sprintf($this->lang['label'], $this->volume), 'label'); - // explanation for auth - $t->add($this->lang['auth_explanation'], 'auth_explanation'); - $t->add($response->form); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Auth - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function auth() { - $response = $this->get_response(); - $export = $response->html->request()->get('volume'); - $form = $response->form; - if( $export !== '' ) { - if(!$form->get_errors() && $response->submit()) { - // set ENV - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - - $errors = array(); - $message = array(); - $auths = $form->get_request('ip'); - $statfile = $this->openqrm->get('basedir').'/plugins/nfs-storage/web/storage/'.$resource->id.'.nfs.stat'; - - $error = ''; - $command = $this->openqrm->get('basedir').'/plugins/nfs-storage/bin/openqrm-nfs-storage auth'; - $command .= ' -n '.$export.' -i '.$auths; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - if($this->file->exists($statfile)) { - $this->file->remove($statfile); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($statfile)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $message[] = sprintf($this->lang['msg_authd'], $export); - if(count($errors) === 0) { - $response->msg = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response->error = join('
    ', $msg); - } - } - } else { - $response->msg = ''; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'auth'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $regex_ip = '~^([1-9]|[0-9][0-9]|[1][0-9][0-9]|[2][0-5][0-4])'; - $regex_ip .= '\\.([0-9]|[0-9][0-9]|[1][0-9][0-9]|[2][0-5][0-5])'; - $regex_ip .= '\\.([0-9]|[0-9][0-9]|[1][0-9][0-9]|[2][0-5][0-5])'; - $regex_ip .= '\\.([1-9]|[0-9][0-9]|[1][0-9][0-9]|[2][0-5][0-4])+$~i'; - - $d['ip']['label'] = $this->lang['form_ip']; - $d['ip']['required'] = true; - $d['ip']['validate']['regex'] = '/^[a-z0-9. *_-]+$/i'; - $d['ip']['validate']['errormsg'] = $this->lang['error_ip']; - $d['ip']['object']['type'] = 'htmlobject_input'; - $d['ip']['object']['attrib']['name'] = 'ip'; - $d['ip']['object']['attrib']['type'] = 'text'; - $d['ip']['object']['attrib']['value'] = ''; - $d['ip']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.clone.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.clone.class.php deleted file mode 100644 index b8cf1e8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.clone.class.php +++ /dev/null @@ -1,241 +0,0 @@ - - */ - -class nfs_storage_clone -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'nfs_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "nfs_storage_msg"; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'nfs_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'nfs_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->file = $this->openqrm->file(); - $this->volume = $this->response->html->request()->get('volume'); - $this->response->params['volume'] = $this->volume; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->duplicate(); - if(isset($response->msg)) { - // wizard - if(isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 3) { - $this->response->redirect( - $this->response->html->thisfile.'?base=appliance&appliance_action=step'.$this->user->wizard_step.'&appliance_id='.$this->user->wizard_id.'&image_id='.$response->image_id - ); - } else { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/nfs-storage-clone.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add(sprintf($this->lang['label'], $this->volume), 'label'); - $t->add($response->form); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Clone - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function duplicate() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $name = $form->get_request('name'); - $command = $this->openqrm->get('basedir').'/plugins/nfs-storage/bin/openqrm-nfs-storage clone'; - $command .= ' -n '.$this->volume; - $command .= ' -s '.$name; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $statfile = $this->openqrm->get('basedir').'/plugins/nfs-storage/web/storage/'.$storage->resource_id.'.nfs.stat'; - $origin_volume_path = ''; - $volume_path = ""; - if (file_exists($statfile)) { - $lines = explode("\n", file_get_contents($statfile)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - $check = basename($line[1]); - if($name === $check) { - $error = sprintf($this->lang['error_exists'], $name); - } - if ($this->volume === $check) { - $origin_volume_path = $line[1]; - } - } - } - } - } - if (!strlen($origin_volume_path)) { - $error = sprintf($this->lang['msg_clone_failed'], $name); - } else { - $export_path = dirname($origin_volume_path); - $volume_path = $export_path.'/'.$name; - } - - if(isset($error)) { - $response->error = $error; - } else { - $file = $this->openqrm->get('basedir').'/plugins/nfs-storage/web/storage/'.$resource->id.'.nfs.'.$name.'.sync_progress'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $name; - $image_fields['image_type'] = $deployment->type; - $image_fields['image_rootfstype'] = 'nfs'; - $image_fields['image_storageid'] = $storage->id; - $image_fields['image_comment'] = "Image Object for volume $name"; - $image_fields['image_rootdevice'] = $volume_path; - $image_fields['image_size']=0; - $image = new image(); - $image->add($image_fields); - - $response->msg = sprintf($this->lang['msg_cloned'], $this->volume, $name); - // save image id in response for the wizard - $response->image_id = $image_fields["image_id"]; - } - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'clone'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['name']['label'] = $this->lang['form_name']; - $d['name']['required'] = true; - $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; - $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); - $d['name']['object']['type'] = 'htmlobject_input'; - $d['name']['object']['attrib']['name'] = 'name'; - $d['name']['object']['attrib']['type'] = 'text'; - $d['name']['object']['attrib']['value'] = $this->volume.'_clone'; - $d['name']['object']['attrib']['maxlength'] = 50; - - $form->add($d); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.controller.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.controller.class.php deleted file mode 100644 index 5c7900c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.controller.class.php +++ /dev/null @@ -1,578 +0,0 @@ - - */ - -class nfs_storage_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'nfs_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "nfs_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'nfs_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'nfs_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array ( - 'tab' => 'Select NFS-storage', - 'label' => 'Select NFS-storage', - 'action_edit' => 'edit', - 'table_name' => 'Name', - 'table_id' => 'Id', - 'table_recource' => 'Resource', - 'table_type' => 'Type', - 'table_deployment' => 'Deployment', - 'error_no_storage' => 'No storage configured yet!

    Please create a NFS Storage first!', - 'new_storage' => 'New Storage', - 'please_wait' => 'Loading Storage. Please wait ..', - ), - 'edit' => array ( - 'tab' => 'Edit NFS-storage', - 'label' => 'NFS Volumes on storage %s', - 'lang_id' => 'ID', - 'lang_name' => 'Name', - 'lang_resource' => 'Resource', - 'lang_state' => 'State', - 'lang_vfree' => 'Free', - 'lang_vsize' => 'Total', - 'lang_authenticated_to' => 'exported to', - 'action_add' => 'Add new Volume', - 'action_refresh' => 'Reload Page', - 'action_manual' => 'Manual Configuration', - 'action_clone' => 'clone', - 'action_remove' => 'remove', - 'action_auth' => 'auth', - 'action_add_image' => 'Add Image', - 'action_remove_image' => 'Remove Image', - 'action_clone_in_progress' => 'Synchronisation in progress - Please wait', - 'action_clone_finished' => 'Syncronisation finished!', - 'table_name' => 'Name', - 'table_export' => 'Export', - 'error_no_nfs' => 'Storage %s is not of type nfs-deployment', - 'please_wait' => 'Loading Volumes. Please wait ..', - 'manual_configured' => 'Storage is manually configured and will not be administrated by openQRM', - ), - 'add' => array ( - 'tab' => 'Add NFS Volume', - 'label' => 'Add new Volume', - 'form_name' => 'Name', - 'msg_added' => 'Added Volume %s', - 'msg_add_failed' => 'Failed to add Volume %s', - 'error_exists' => 'Volume %s already exists', - 'error_name' => 'Name must be %s', - 'please_wait' => 'Adding Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'image' => array ( - 'label' => 'Add/Remove Image for Volume %s', - 'tab' => 'Add/Remove Image', - 'error_exists' => 'Image %s already exists', - 'error_image_still_in_use' => 'Image id %s is still in use by Server(s) %s', - 'msg_added_image' => 'Added Image %s', - 'msg_removed_image' => 'Removed Image id %s', - 'please_wait' => 'Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'manual' => array ( - 'tab' => 'Manual NFS Configuration', - 'label' => 'Manual Configuration', - 'explanation_1' => 'In case the NFS Storage server is not managed by openQRM please use this form to manually create the list of exported paths to server-images on the NFS Storage server.', - 'explanation_2' => 'Please notice that in case a manual configuration exist openQRM will not send any automated Storage-authentication commands to this NFS Storage-server!', - 'please_wait' => 'Saving Manual Configuration. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - 'saved' => 'Manual Configuration has been saved', - 'error_config' => 'Error: Please use only %s for Exports', - 'error_image_in_use' => 'Error: Image name %s for %s is already in use!', - 'error_name_empty' => 'Error: Name is empty or a path ends with a /', - ), - 'clone' => array ( - 'tab' => 'Clone NFS Volume', - 'label' => 'Clone Volume %s', - 'form_name' => 'Name', - 'msg_cloned' => 'Cloned %s as %s', - 'msg_clone_failed' => 'Failed to clone Volume %s', - 'error_exists' => 'Volume %s already exists', - 'error_name' => 'Name must be %s', - 'please_wait' => 'Cloning Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'auth' => array ( - 'tab' => 'Authenticate NFS Volume', - 'label' => 'Authenticate Volume %s', - 'form_ip' => 'IP', - 'msg_authd' => 'Authenticated volume %s', - 'auth_explanation' => 'Please notice: Volumes which are deployed as an Image via a Server are authenticated automatically!', - 'error_ip' => 'IP Adress is not valid', - 'please_wait' => 'Authenticating Volume. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'remove' => array ( - 'label' => 'Remove Volume(s)', - 'msg_removed' => 'Removed Volume %s', - 'msg_image_still_in_use' => 'Volume %s of Image id %s is still in use by appliance(s) %s', - 'please_wait' => 'Removing Volume(s). Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/nfs-storage/lang", 'nfs-storage.ini'); - $this->tpldir = $this->rootdir.'/plugins/nfs-storage/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "edit"; - } - if($this->action !== 'select') { - $this->response->params['storage_id'] = $this->response->html->request()->get('storage_id'); - } - $content = array(); - switch( $this->action ) { - case '': - case 'select': - $content[] = $this->select(true); - break; - case 'edit': - $content[] = $this->select(false); - $content[] = $this->edit(true); - break; - case 'reload': - $this->action = 'edit'; - $content[] = $this->select(false); - $content[] = $this->edit(true); - $this->reload(); - break; - case 'add': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->add(true); - break; - case 'image': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->image(true); - break; - case 'remove': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->remove(true); - break; - case 'clone': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->duplicate(true); - break; - case 'auth': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->auth(true); - break; - case 'manual': - $content[] = $this->select(false); - $content[] = $this->edit(false); - $content[] = $this->manual(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * API - * - * @access public - */ - //-------------------------------------------- - function api() { - require_once($this->rootdir.'/plugins/nfs-storage/class/nfs-storage.api.class.php'); - $controller = new nfs_storage_api($this); - $controller->action(); - } - - - //-------------------------------------------- - /** - * Select Storages of type NFS - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/nfs-storage/class/nfs-storage.select.class.php'); - $controller = new nfs_storage_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Edit NFS-Storage - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function edit( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - if($this->reload()) { - require_once($this->rootdir.'/plugins/nfs-storage/class/nfs-storage.edit.class.php'); - $controller = new nfs_storage_edit($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['edit']; - $data = $controller->action(); - } - } - $content['label'] = $this->lang['edit']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'edit' ); - $content['onclick'] = false; - if($this->action === 'edit'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add new Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function add( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/nfs-storage/class/nfs-storage.add.class.php'); - $controller = new nfs_storage_add($this->openqrm, $this->response, $this); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['add']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['add']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'add' ); - $content['onclick'] = false; - if($this->action === 'add'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Add/Remvoe Image object - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function image( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/nfs-storage/class/nfs-storage.image.class.php'); - $controller = new nfs_storage_image($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['image']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['image']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'image' ); - $content['onclick'] = false; - if($this->action === 'image'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Remove Export - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function remove( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/nfs-storage/class/nfs-storage.remove.class.php'); - $controller = new nfs_storage_remove($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['remove']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Remove'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'remove' ); - $content['onclick'] = false; - if($this->action === 'remove' || $this->action === $this->lang['edit']['action_remove']){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Clone Volume - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function duplicate( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/nfs-storage/class/nfs-storage.clone.class.php'); - $controller = new nfs_storage_clone($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['clone']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['clone']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'clone' ); - $content['onclick'] = false; - if($this->action === 'clone' || $this->action === $this->lang['edit']['action_clone']){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Auth Volume - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function auth( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/nfs-storage/class/nfs-storage.auth.class.php'); - $controller = new nfs_storage_auth($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['auth']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['auth']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'auth' ); - $content['onclick'] = false; - if($this->action === 'auth' || $this->action === $this->lang['edit']['action_auth']){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Manual Exports - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function manual( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/nfs-storage/class/nfs-storage.manual.class.php'); - $controller = new nfs_storage_manual($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['manual']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['manual']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'manual' ); - $content['onclick'] = false; - if($this->action === 'manual'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Reload Exports - * - * @access public - */ - //-------------------------------------------- - function reload() { - $OPENQRM_SERVER_BASE_DIR = $this->openqrm->get('basedir'); - $command = $OPENQRM_SERVER_BASE_DIR."/plugins/nfs-storage/bin/openqrm-nfs-storage post_exports"; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $storage->get_instance_by_id($storage_id); - $resource = new resource(); - $resource->get_instance_by_id($storage->resource_id); - $file = $this->openqrm->get('basedir').'/plugins/nfs-storage/web/storage/'.$resource->id.'.nfs.stat'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - return true; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.edit.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.edit.class.php deleted file mode 100644 index ee00920..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.edit.class.php +++ /dev/null @@ -1,332 +0,0 @@ - - */ - -class nfs_storage_edit -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'nfs_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "nfs_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'nfs_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'nfs_identifier'; -/** -* identifier name -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Init - * - * @access public - */ - //-------------------------------------------- - function init() { - $storage_id = $this->response->html->request()->get('storage_id'); - if($storage_id === '') { - return false; - } - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - - $this->resource = $resource; - $this->storage = $storage; - $this->deployment = $deployment; - - if (!$this->file->exists($this->openqrm->get('basedir').'/plugins/nfs-storage/web/storage/'.$resource->id.'.nfs.stat.manual')) { - $this->statfile = $this->openqrm->get('basedir').'/plugins/nfs-storage/web/storage/'.$resource->id.'.nfs.stat'; - } else { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'manual', $this->message_param, $this->lang['manual_configured']) - ); - } - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->init(); - $data = $this->edit(); - if($data !== false) { - $t = $this->response->html->template($this->tpldir.'/nfs-storage-edit.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($data); - $t->add($this->lang['lang_id'], 'lang_id'); - $t->add($this->lang['lang_name'], 'lang_name'); - $t->add($this->lang['lang_resource'], 'lang_resource'); - $t->add($this->lang['lang_state'], 'lang_state'); - $t->add($this->lang['lang_vfree'], 'lang_vfree'); - $t->add($this->lang['lang_vsize'], 'lang_vsize'); - $t->add(sprintf($this->lang['label'], $data['name']), 'label'); - return $t; - } else { - $msg = sprintf($this->lang['error_no_nfs'], $this->response->html->request()->get('storage_id')); - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - } - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return array|false - */ - //-------------------------------------------- - function edit() { - - if($this->deployment->type === 'nfs-deployment') { - $resource_icon_default="/img/resource.png"; - $storage_icon="/plugins/nfs-storage/img/plugin.png"; - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default=$storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - - $d['state'] = ''.$this->resource->state.''; - $d['icon'] = ''; - $d['resource'] = $this->resource->id.' / '.$this->resource->ip; - $d['name'] = $this->storage->name; - $d['id'] = $this->storage->id; - - $a = $this->response->html->a(); - $a->label = $this->lang['action_manual']; - $a->css = 'add'; - $a->href = $this->response->get_url($this->actions_name, "manual"); - $d['manual'] = $a->get_string(); - - $a = $this->response->html->a(); - $a->label = $this->lang['action_add']; - $a->css = 'add'; - $a->href = $this->response->get_url($this->actions_name, "add"); - $d['add'] = $a->get_string(); - - $body = array(); - $identifier_disabled = array(); - $file = $this->statfile; - if(file_exists($file)) { - $lines = explode("\n", file_get_contents($file)); - if(count($lines) >= 1) { - $i = 0; - $t = $this->response->html->template($this->openqrm->get('webdir').'/js/openqrm-progressbar.js'); - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($i === 0) { - $d['vsize'] = number_format($line[0], 0, '', '').' MB'; - $d['vfree'] = number_format($line[1], 0, '', '').' MB'; - } else { - $name = basename($line[1]); - $export = $line[1]; - $authenticated = @$line[2]; - $clone_status = @$line[3]; - $auth_link = ' '; - $clone_link = ' '; - $image_add_remove = ''; - $deployment_type = ''; - $image = new image($this->deployment->type); - $image->get_instance_by_name($name); - if (strlen($image->id)) { - if( $image->type == $this->deployment->type ) { - if( $line[0] === $this->deployment->type ) { - if($d['vfree'] !== '0 MB' ) { - $a = $this->response->html->a(); - $a->title = $this->lang['action_clone']; - $a->label = $this->lang['action_clone']; - $a->handler = 'onclick="wait();"'; - $a->css = 'clone'; - $a->href = $this->response->get_url($this->actions_name, "clone").'&volume='.$name; - $clone_link = $a->get_string(); - } - $a = $this->response->html->a(); - $a->title = $this->lang['action_auth']; - $a->label = $this->lang['action_auth']; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($this->actions_name, "auth").'&volume='.$name; - $auth_link = $a->get_string(); - } else { - $identifier_disabled[] = $name; - } - } - } - // create/remove image object, check if image exists - $deployment_type = $this->deployment->type; - $image = new image($this->deployment->type); - $image->get_instance_by_name($name); - if (strlen($image->id)) { - if( $image->type != $this->deployment->type ) { - $deployment_type = $image->type; - $identifier_disabled[] = $name; - error_log("nfs storage type: disabled: ".$image->type." != ".$this->deployment->type); - } else { - $i = $this->response->html->a(); - $i->title = $this->lang['action_remove_image']; - $i->label = $this->lang['action_remove_image']; - $i->handler = 'onclick="wait();"'; - $i->css = 'edit'; - $i->href = $this->response->get_url($this->actions_name, "image").'&image_id='.$image->id.'&image_command=remove'; - $image_add_remove = $i; - } - } else { - $i = $this->response->html->a(); - $i->title = $this->lang['action_add_image']; - $i->label = $this->lang['action_add_image']; - $i->handler = 'onclick="wait();"'; - $i->css = 'edit'; - if($this->deployment->type === 'nfs-deployment') { - $i->href = $this->response->get_url($this->actions_name, "image").'&root_device='.$export.'&image_name='.$name.'&image_command=add'; - } - $identifier_disabled[] = $name; - $image_add_remove = $i; - } - - $export = ''; - if ($authenticated != '') { - $export = $this->lang['lang_authenticated_to']." ".$authenticated; - } - - if ($clone_status == "clone_in_progress") { - // add to disabled identifier - $identifier_disabled[] = $name; - $auth_link = " "; - $clone_link = " "; - $image_add_remove = ' '; - // progressbar - $t->add(uniqid('b'), 'id'); - $t->add($this->openqrm->get('baseurl').'/api.php?action=plugin&plugin=nfs-storage&nfs_storage_action=progress&name='.$this->resource->id.'.nfs.'.$name.'.sync_progress', 'url'); - $t->add($this->lang['action_clone_in_progress'], 'lang_in_progress'); - $t->add($this->lang['action_clone_finished'], 'lang_finished'); - $export = $t->get_string(); - } - - $body[] = array( - 'icon' => $d['icon'], - 'name' => $name, - 'export' => $export, - 'image' => $image_add_remove, - 'auth' => $auth_link, - 'clone' => $clone_link, - ); - } - } - $i++; - } - } - } - - $h['icon'] = array(); - $h['icon']['title'] = ' '; - $h['icon']['sortable'] = false; - $h['name'] = array(); - $h['name']['title'] = $this->lang['table_name']; - $h['export'] = array(); - $h['export']['title'] = $this->lang['table_export']; - $h['image'] = array(); - $h['image']['title'] = ' '; - $h['image']['sortable'] = false; - $h['auth']['title'] = ' '; - $h['auth']['sortable'] = false; - $h['clone']['title'] = ' '; - $h['clone']['sortable'] = false; - - $table = $this->response->html->tablebuilder('nfs_edit', $this->response->get_array($this->actions_name, 'edit')); - $table->sort = 'name'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = count($body); - $table->autosort = true; - $table->sort_link = false; - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $body; - $table->identifier = 'name'; - $table->identifier_name = $this->identifier_name; - $table->identifier_disabled = $identifier_disabled; - $table->actions_name = $this->actions_name; - $table->actions = array(array('remove' => $this->lang['action_remove'])); - - $d['table'] = $table->get_string(); - return $d; - } else { - return false; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.image.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.image.class.php deleted file mode 100644 index d5ed294..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.image.class.php +++ /dev/null @@ -1,198 +0,0 @@ - - */ - -class nfs_storage_image -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'nfs_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "nfs_storage_msg"; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'nfs_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'nfs_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $deployment = new deployment(); - $this->storage = $storage->get_instance_by_id($storage_id); - $this->resource = $resource->get_instance_by_id($storage->resource_id); - $this->deployment = $deployment->get_instance_by_id($storage->type); - $this->response->add('storage_id', $storage_id); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->image(); - $this->response->params['reload'] = 'false'; - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response) - ); - } - - //-------------------------------------------- - /** - * Add/Remove image object - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function image() { - $response = ''; - $errors = array(); - $message = array(); - $image_command = $this->response->html->request()->get('image_command'); - - if( $image_command !== '' ) { - switch ($image_command) { - case 'add': - $root_device = $this->response->html->request()->get('root_device'); - $image_name = $this->response->html->request()->get('image_name'); - - // check if image name is not in use yet - $image = new image($this->deployment->type); - $image->get_instance_by_name($image_name); - if (strlen($image->id)) { - $errors[] = sprintf($this->lang['error_exists'], $image_name); - } else { - $ident_file = $this->openqrm->get('basedir').'/plugins/nfs-storage/web/storage/'.$this->resource->id.'.nfs.'.$image_name.'.adapt'; - $get_ident_command = $this->openqrm->get('basedir').'/plugins/nfs-storage/bin/openqrm-nfs-storage adapt'; - $get_ident_command .= ' -n '.$image_name; - $get_ident_command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $get_ident_command .= ' --openqrm-ui-user '.$this->user->name; - $get_ident_command .= ' --openqrm-cmd-mode background'; - if(file_exists($ident_file)) { - unlink($ident_file); - } - $this->resource->send_command($this->resource->ip, $get_ident_command); - while (!file_exists($ident_file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - unlink($ident_file); - $tables = $this->openqrm->get('table'); - $image_fields = array(); - $image_fields["image_id"] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_fields['image_name'] = $image_name; - $image_fields['image_type'] = $this->deployment->type; - $image_fields['image_rootfstype'] = 'nfs'; - $image_fields['image_storageid'] = $this->storage->id; - $image_fields['image_comment'] = "Image Object for volume $image_name"; - $image_fields['image_rootdevice'] = $root_device; - $image = new image(); - $image->add($image_fields); - $message[] = sprintf($this->lang['msg_added_image'], $image_name); - } - break; - - case 'remove': - $image_id = $this->response->html->request()->get('image_id'); - // check if image is not in use any more before removing - $remove_error = 0; - $appliance = new appliance(); - $appliance_id_list = $appliance->get_all_ids(); - foreach($appliance_id_list as $appliance_list) { - $appliance_id = $appliance_list['appliance_id']; - $app_image_remove_check = new appliance(); - $app_image_remove_check->get_instance_by_id($appliance_id); - if ($app_image_remove_check->imageid == $image_id) { - $image_is_used_by_appliance .= $appliance_id." "; - $remove_error = 1; - } - } - if ($remove_error == 1) { - $errors[] = sprintf($this->lang['error_image_still_in_use'], $image_id, $image_is_used_by_appliance); - } else { - $image_remove = new image(); - $image_remove->remove($image_id); - $message[] = sprintf($this->lang['msg_removed_image'], $image_id); - } - break; - } - if(count($errors) === 0) { - $response = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response = join('
    ', $msg); - } - } else { - $response = ''; - } - return $response; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.manual.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.manual.class.php deleted file mode 100644 index a5027c0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.manual.class.php +++ /dev/null @@ -1,273 +0,0 @@ - - */ - -class nfs_storage_manual -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'nfs_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "nfs_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'nfs_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'nfs_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->file = $this->openqrm->file(); - $this->storage = $this->response->html->request()->get('storage_id'); - $this->response->params['storage_id'] = $this->storage; - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->add(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'manual', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/nfs-storage-manual.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->form); - $t->add($this->lang); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Add - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function add() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - $config = $form->get_request('config'); - $storage_id = $this->response->html->request()->get('storage_id'); - $storage = new storage(); - $resource = new resource(); - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $file = $this->openqrm->get('basedir')."/plugins/nfs-storage/web/storage/".$resource->id.".nfs.stat.manual"; - $image = new image(); - $error = ''; - // get old data - $old = array(); - if($this->file->exists($file)) { - $old = $this->file->get_contents($file); - $old = str_replace("\r\n", "\n", $old); - $old = explode("\n", $old); - } - if(isset($config) && $config !== '') { - $new = str_replace("\r\n", "\n", $config); - $new = explode("\n", $new); - $new = array_unique($new); - // sync old and new values - foreach($old as $v) { - if(!in_array($v, $new)) { - $name = substr($v, strrpos($v, '/')+1); - if(isset($name) && $name !== '' && $name !== false) { - $current = $image->get_instance_by_name($name); - if(isset($current) && $current->name === $name) { - $image->remove($current->id); - } - } - } - else if(in_array($v, $new)) { - unset($new[array_search($v, $new)]); - } - } - // add new values to images - foreach($new as $v) { - $name = substr($v, strrpos($v, '/')+1); - if(isset($name) && $name !== '' && $name !== false) { - $current = $image->get_instance_by_name($name); - if(isset($current) && $current->name === $name) { - $error[] = sprintf($this->lang['error_image_in_use'], $name, $v); - } - else if($v !== '') { - $tables = $this->openqrm->get('table'); - $f['image_id'] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $f['image_name'] = $name; - $f['image_type'] = 'nfs-deployment'; - $f['image_rootfstype'] = 'nfs'; - $f['image_rootdevice'] = $v; - $f['image_storageid'] = $this->storage; - $f['image_comment'] = 'Manually added nfs export'; - $image->add($f); - } - } - else if ((!isset($name) || $name === '' || $name === false) && $v !== '') { - $error[] = $this->lang['error_name_empty']; - } - } - // handle config file - if($error === '') { - if (!$handle = fopen($file, 'w+')) { - $error = "Cannot open file ($file)"; - } - if (fwrite($handle, $config) === FALSE) { - $error = "Cannot write to file ($file)"; - } - if($error !== '') { - $response->error = $error; - } else { - $response->msg = $this->lang['saved']; - } - } else { - if(is_array($error)) { - $response->error = implode('
    ', $error); - } - else if(is_string($error)) { - $response->error = $error; - } - } - } else { - // remove old values from image table - foreach($old as $v) { - if(!in_array($v, $new)) { - $name = substr($v, strrpos($v, '/')+1); - if(isset($name) && $name !== '' && $name !== false) { - $current = $image->get_instance_by_name($name); - if(isset($current) && $current->name === $name) { - $image->remove($current->id); - } - } - } - } - if($this->file->exists($file)) { - $error = $this->file->remove($file); - } - if(count($old) > 1) { - $response->msg = $this->lang['saved']; - } else { - $response->msg = ''; - } - } - } - else if($form->get_errors()) { - $response->error = implode('
    ', $form->get_errors()); - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'manual'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $storage_id = $this->storage; - $storage = new storage(); - $resource = new resource(); - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $file = $this->openqrm->get('basedir')."/plugins/nfs-storage/web/storage/".$resource->id.".nfs.stat.manual"; - - $d['config']['label'] = 'Exports'; - $d['config']['validate']['regex'] = '~^[\r\na-z0-9/._-]+$~i'; - $d['config']['validate']['errormsg'] = sprintf($this->lang['error_config'], 'a-z0-9/._-'); - $d['config']['object']['type'] = 'htmlobject_textarea'; - $d['config']['object']['attrib']['name'] = 'config'; - if($this->file->exists($file)) { - $d['config']['object']['attrib']['value'] = $this->file->get_contents($file); - } - - $form->add($d); - $form->display_errors = false; - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.remove.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.remove.class.php deleted file mode 100644 index 80e6911..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.remove.class.php +++ /dev/null @@ -1,219 +0,0 @@ - - */ - -class nfs_storage_remove -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'nfs_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "nfs_storage_msg"; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'nfs_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'nfs_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->remove(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'edit', $this->message_param, $response->msg) - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/nfs-storage-remove.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($response->form); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Remove - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function remove() { - $response = $this->get_response(); - $exports = $response->html->request()->get($this->identifier_name); - $form = $response->form; - if( $exports !== '' ) { - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $i = 0; - foreach($exports as $ex) { - $d['param_f'.$i]['label'] = $ex; - $d['param_f'.$i]['object']['type'] = 'htmlobject_input'; - $d['param_f'.$i]['object']['attrib']['type'] = 'checkbox'; - $d['param_f'.$i]['object']['attrib']['name'] = $this->identifier_name.'['.$i.']'; - $d['param_f'.$i]['object']['attrib']['value'] = $ex; - $d['param_f'.$i]['object']['attrib']['checked'] = true; - $i++; - } - $form->add($d); - if(!$form->get_errors() && $response->submit()) { - $storage_id = $this->response->html->request()->get('storage_id'); - $name = $this->openqrm->admin()->name; - $pass = $this->openqrm->admin()->password; - $storage = new storage(); - $resource = new resource(); - $errors = array(); - $message = array(); - foreach($exports as $key => $export) { - - // check if an appliance is still using the volume as an image - $image = new image(); - $image->get_instance_by_name($export); - - // check if it is still in use - $appliance = new appliance(); - $appliances_using_resource = $appliance->get_ids_per_image($image->id); - if (count($appliances_using_resource) > 0) { - $appliances_using_resource_str = implode(",", $appliances_using_resource[0]); - $errors[] = sprintf($this->lang['msg_image_still_in_use'], $export, $image->id, $appliances_using_resource_str); - } else { - $storage->get_instance_by_id($storage_id); - $resource->get_instance_by_id($storage->resource_id); - $command = $this->openqrm->get('basedir').'/plugins/nfs-storage/bin/openqrm-nfs-storage remove -n '.$export; - $command .= ' -u '.$name.' -p '.$pass; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - - $file = $this->openqrm->get('basedir').'/plugins/nfs-storage/web/storage/'.$resource->id.'.nfs.stat'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - - #$error = $resource->send_command($resource->ip, $command); - #if($error !== '' ) { - # $errors[] = $error; - #} else { - $form->remove($this->identifier_name.'['.$key.']'); - $message[] = sprintf($this->lang['msg_removed'], $export); - // remove the image of the volume - $image->remove_by_name($export); - - #} - } - } - if(count($errors) === 0) { - $response->msg = join('
    ', $message); - } else { - $msg = array_merge($errors, $message); - $response->error = join('
    ', $msg); - } - } - } else { - $response->msg = ''; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'remove'); - $response->form = $form; - return $response; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.select.class.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.select.class.php deleted file mode 100644 index 5a08798..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/class/nfs-storage.select.class.php +++ /dev/null @@ -1,214 +0,0 @@ - - */ - -class nfs_storage_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'nfs_storage_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "nfs_storage_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'nfs_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'nfs_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $table = $this->select(); - $t = $this->response->html->template($this->tpldir.'/nfs-storage-select.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($table, 'table'); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return htmlobject_tablebulider | htmlobject_div - */ - //-------------------------------------------- - function select() { - // set ENV - $deployment = new deployment(); - $storage = new storage(); - $resource = new resource(); - - $deployment->get_instance_by_type("nfs-deployment"); - $table = $this->response->html->tablebuilder('nfs', $this->response->get_array($this->actions_name, 'select')); - $table->sort = 'storage_id'; - $table->limit = 10; - $table->offset = 0; - $table->order = 'ASC'; - $table->max = $storage->get_count_per_type($deployment->id); - $table->autosort = false; - $table->sort_link = false; - $table->init(); - $storages = $storage->display_overview_per_type($deployment->id, $table->offset, $table->limit, $table->sort, $table->order); - - if(count($storages) >= 1) { - foreach($storages as $k => $v) { - $storage->get_instance_by_id($v["storage_id"]); - $resource->get_instance_by_id($storage->resource_id); - $deployment->get_instance_by_id($storage->type); - $resource_icon_default="/img/resource.png"; - $storage_icon="/plugins/nfs-storage/img/plugin.png"; - $state_icon = ''.$resource->state.''; - if ($this->file->exists($this->openqrm->get('webdir').$storage_icon)) { - $resource_icon_default=$storage_icon; - } - $resource_icon_default = $this->openqrm->get('baseurl').$resource_icon_default; - - $a = $this->response->html->a(); - $a->title = $this->lang['action_edit']; - $a->label = $this->lang['action_edit']; - $a->handler = 'onclick="wait();"'; - $a->css = 'edit'; - $a->href = $this->response->get_url($this->actions_name, "edit").'&storage_id='.$storage->id; - - $data = ''.$this->lang['table_recource'].': '.$resource->id.' / '.$resource->ip.'
    '; - $data .= ''.$this->lang['table_type'].': '.$deployment->type.'
    '; - $data .= ''.$this->lang['table_deployment'].': '.$deployment->storagedescription.'
    '; - - $b[] = array( - 'state' => $state_icon, - // 'icon' => 'Icon', - 'storage_id' => $storage->id, - 'storage_name' => $storage->name, - 'storage_resource_id' => $storage->resource_id, - 'storage_data' => $data, - 'storage_comment' => '', - 'storage_edit' => $a->get_string(), - ); - } - - $h = array(); - $h['state'] = array(); - $h['state']['title'] =' '; - $h['state']['sortable'] = false; - /* - $h['icon'] = array(); - $h['icon']['title'] =' '; - */ - - $h['icon']['sortable'] = false; - $h['storage_id'] = array(); - $h['storage_id']['title'] = $this->lang['table_id']; - $h['storage_name'] = array(); - $h['storage_name']['title'] = $this->lang['table_name']; - $h['storage_resource_id'] = array(); - $h['storage_resource_id']['title'] = $this->lang['table_recource']; - $h['storage_resource_id']['hidden'] = true; - $h['storage_data'] = array(); - $h['storage_data']['title'] = ' '; - $h['storage_data']['sortable'] = false; - $h['storage_comment'] = array(); - $h['storage_comment']['title'] =' '; - $h['storage_comment']['sortable'] = false; - $h['storage_edit'] = array(); - $h['storage_edit']['title'] = ' '; - $h['storage_edit']['sortable'] = false; - - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $b; - $table->limit_select = array( - array("value" => 10, "text" => 10), - array("value" => 20, "text" => 20), - array("value" => 30, "text" => 30), - array("value" => 40, "text" => 40), - array("value" => 50, "text" => 50), - ); - return $table->get_string(); - } else { - $a = $this->response->html->a(); - $a->title = $this->lang['new_storage']; - $a->label = $this->lang['new_storage']; - $a->handler = 'onclick="wait();"'; - $a->css = 'add'; - $a->href = $this->response->html->thisfile.'?base=storage&storage_action=add'; - - $box = $this->response->html->div(); - $box->id = 'Tabelle'; - $box->css = 'htmlobject_box'; - $content = $this->lang['error_no_storage'].'

    '; - $content .= $a->get_string(); - $box->add($content); - return $box->get_string(); - } - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/css/nfs-storage.css b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/css/nfs-storage.css deleted file mode 100644 index 87106d6..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/css/nfs-storage.css +++ /dev/null @@ -1,4 +0,0 @@ -/* Manual Config */ -#form.manualconfig .htmlobject_box .left { - display: none; -} diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/image.nfs-deployment.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/image.nfs-deployment.php deleted file mode 100644 index daf75c5..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/image.nfs-deployment.php +++ /dev/null @@ -1,117 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -global $OPENQRM_SERVER_BASE_DIR; - -// global event for logging -$event = new event(); -global $event; - - -function nfs_deployment_wait_for_identfile($sfile) { - $refresh_delay=1; - $refresh_loop_max=20; - $refresh_loop=0; - while (!file_exists($sfile)) { - sleep($refresh_delay); - $refresh_loop++; - flush(); - if ($refresh_loop > $refresh_loop_max) { - return false; - } - } - return true; -} - - -function get_nfs_deployment_image_rootdevice_identifier($nfs_storage_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_ADMIN; - global $event; - - // place for the storage stat files - $StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/nfs-storage/storage'; - $rootdevice_identifier_array = array(); - $storage = new storage(); - $storage->get_instance_by_id($nfs_storage_id); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_resource_id = $storage_resource->id; - $ident_file = "$StorageDir/$storage_resource_id.nfs.ident"; - $statfile_manual="$StorageDir/".$storage_resource_id.".nfs.stat.manual"; - // manual configured ? - if (file_exists($statfile_manual)) { - $fcontent = file($statfile_manual); - foreach($fcontent as $lun_info) { - $troot_device = trim($lun_info); - $rootdevice_identifier_array[] = array("value" => "$troot_device", "label" => "$troot_device"); - } - } else { - if (file_exists($ident_file)) { - unlink($ident_file); - } - // send command - $resource_command=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/nfs-storage/bin/openqrm-nfs-storage post_identifier -u ".$OPENQRM_ADMIN->name." -p ".$OPENQRM_ADMIN->password." --openqrm-cmd-mode background"; - $storage_resource->send_command($storage_resource->ip, $resource_command); - if (!nfs_deployment_wait_for_identfile($ident_file)) { - $event->log("get_image_rootdevice_identifier", $_SERVER['REQUEST_TIME'], 2, "image.nfs-deployment", "Timeout while requesting image identifier from storage id $storage->id", "", "", 0, 0, 0); - return; - } - $fcontent = file($ident_file); - foreach($fcontent as $lun_info) { - $tpos = strpos($lun_info, ","); - $timage_name = trim(substr($lun_info, 0, $tpos)); - $troot_device = trim(substr($lun_info, $tpos+1)); - $rootdevice_identifier_array[] = array("value" => "$troot_device", "label" => "$timage_name"); - } - } - return $rootdevice_identifier_array; -} - - - -function get_nfs_deployment_image_default_rootfs() { - return "nfs"; -} - -function get_nfs_deployment_rootfs_transfer_methods() { - return true; -} - -function get_nfs_deployment_rootfs_set_password_method() { - return true; -} - -function get_nfs_deployment_is_network_deployment() { - return true; -} - -function get_nfs_deployment_local_deployment_enabled() { - return false; -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/img/plugin.png deleted file mode 100644 index 1f3663e..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/lang/de.nfs-storage-about.ini b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/lang/de.nfs-storage-about.ini deleted file mode 100644 index 067c158..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/lang/de.nfs-storage-about.ini +++ /dev/null @@ -1,67 +0,0 @@ -[documentation] -tab = "Über NFS-Storage" -label = "Über NFS-Storage" -introduction_title = "Einleitung" -introduction_content = "Das 'NFS-Storage' Plugin verwaltet NFS Server." -requirements_title = "Anforderungen" -requirements_list = "
    • Eine 'Resource' für die NFS-Storage Storage
      (dies kann ein System sein das mittels des "local-server" Plugin in openQRM eingebunden ist oder der openQRM Server selber)
    • -
    • Die folgenden Paket werden benötigt: nfs-common, nfs-kernel-server, screen, rsync
    " - -provides_title = "Bietet" -provides_list = "
    • Storage Typen: 'NFS Storage'
    • -
    • Deployment types: 'Nfs-root deployment'
    " -type_title = "Plugin Typ" -type_content = "Storage" - -tested_title = "Testet mit" -tested_content = "Diese Plugin ist getestet mit Debian, Ubuntu und CentOS Linux Distributionen" - -deployment_title = "Deployment Typ" -deployment_content = "Netzwerk-Deployment" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" -network_deploymet = "Netzwerk-Deployment" -doc1 = "" - - -[bootservice] -tab = "Boot-Service" -label = "NFS-Storage Boot-Service" -boot_service_title = "NFS-Storage Boot-Service" -boot_service_content = "Das NFS-Storage Plugin beinhaltet einen openQRM Boot-Service. - Dieser 'NFS-Storage Boot-Service' wird automatisch von allen in openQRM integrierten Systeme heruntergeladen und ausgeführt. - Der Boot-Service befindet sich unter:
    -
    - /usr/share/openqrm/plugins/nfs-storage/web/boot-service-nfs-storage.tgz -
    -
    - Der 'NFS-Storage Boot-Service' beinhaltet die 'Client' Dateien des NFS-Storage Plugin.
    - Eine Konfigurationsdatei für den NFS-Storage Server ist ebenfalls enhalten.
    -
    - Die Boot-Service konfiguration wird mittels des 'openqrm' Kommandozeilenwerkzeugs verwaltet.
    - Der folgende Befehl zeigt die die momentane 'default' Boot-Service Konfiguration an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n nfs-storage -a default -
    -
    - Die Boot-Service Konfiguration eines speziellen Server zeigt der folgende Befehl an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n nfs-storage -a [Server-name] -
    -
    - Der folgende Befehl passt einen Konfigurationparameter des 'default' Boot-Service an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n nfs-storage -a default -k [key] -v [value] -
    -
    - Die Boot-Service Konfigurarationsparameter eines speziellen Server passt der folgende Befehl an:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n nfs-storage -a [Server-name] -k [key] -v [value] -
    -
    - Im Falle das der openmQRM Server selber als NFS-Storage genutzt wird werden die Konfigurationsparameter in der folgenden Datei manuell angeepasst:
    -
    - /usr/share/openqrm/plugins/nfs-storage/etc/openqrm-plugin-nfs-storage.conf -

    " - diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/lang/de.nfs-storage.ini b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/lang/de.nfs-storage.ini deleted file mode 100644 index 5ba0f07..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/lang/de.nfs-storage.ini +++ /dev/null @@ -1,93 +0,0 @@ -[select] -tab = "NFS-storage auswählen" -label = "NFS-storage auswählen" -action_edit = "bearbeiten" -table_name = "Name" -table_id = "Id" -table_recource = "Resource" -table_type = "Typ" -table_deployment = "Deployment" -error_no_storage = "Keine Storage angelegt!

    Bitte legen Sie erst eine NFS Storage an!" -new_storage = "Neue Storage" -please_wait = "Lade Storage. Bitte warten .." -[edit] -tab = "NFS-storage bearbeiten" -label = "NFS Volumes auf Storage %s" -lang_id = "ID" -lang_name = "Name" -lang_resource = "Resource" -lang_state = "Status" -lang_vfree = "Frei" -lang_vsize = "Gesamt" -lang_authenticated_to = "freigegeben für" -action_add = "Neues Volume anlegen" -action_refresh = "Reload Page" -action_manual = "Manuelle Konfiguration" -action_remove = "löschen" -action_auth = "Berechtigung" -action_clone = "klonen" -action_add_image = "Image hinzufügen" -action_remove_image = "Image entfernen" -action_clone_in_progress = "Syncronisation in Bearbeitung - Bitte warten" -action_clone_finished = "Syncronisation beendet!" -table_name = "Name" -table_export = "Export" -error_no_nfs = "Storage %s ist nicht vom nfs-deployment" -please_wait = "Lade Volumes. Bitte warten .." -manual_configured = "Storage ist manuell konfiguriert und wird nicht von openQRM verwaltet!" -[add] -tab = "Neues NFS Volume" -label = "Neues NFS Volume anlegen" -form_name = "Name" -msg_added = "Volume %s angelegt" -msg_add_failed = "Fehler beim anlegen des Volumes %s" -error_exists = "Volume %s besteht bereits" -error_name = "Name darf nur %s beinhalten" -please_wait = "Erstelle Volume. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -lang_name_generate = "Name generieren" -[image] -label = "Image für Volume %s hinzufügen/entfernen" -tab = "Image hinzufügen/entfernen" -error_exists = "Image %s existiert bereits" -error_image_still_in_use = "Image ID %s ist noch in benutztung von Server %s" -msg_added_image = "Image %s hinzugefügt" -msg_removed_image = "Image id %s entfernt" -please_wait = "Bitt warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[manual] -tab = "Manuelle NFS Konfiguration" -label = "Manuelle NFS Konfiguration" -explanation_1 = "Wenn der NFS Storage Server nicht von openQRM verwaltet wird, verwenden Sie bitte dieses Formular um die Liste der manuell angelegten Export Pfade zu den Server Images der NFS Storage ein zu tragen." -explanation_2 = "Bitte beachten Sie, dass im Falle einer manuellen Konfiguration openQRM keine automatisierten Storage-authentication Kommandos an diesen NFS Storage Server sendet!" -please_wait = "Speichere manuelle NFS Konfiguration. Please wait .." -canceled = "Operation abgebrochen. Bitte warten .." -saved = "Manuelle NFS Konfiguration wurde gespeichert" -error_config = "Fehler: Bitte verwenden Sie nur %s für Exports" -error_image_in_use = "Fehler: Image Name %s für %s wird bereits verwendet!" -error_name_empty = "Fehler: Name ist leer oder ein Pfad endet mit einem /" -[clone] -tab = "Volume(s) klonen" -label = "Volume(s) klonen" -form_name = "Name" -msg_cloned = "Klone %s als %s" -msg_clone_failed = "Fehler beim klonen des Volumes %s" -error_exists = "Volume %s besteht bereits" -error_name = "Name darf nur %s beinhalten" -please_wait = "Klone Volume(s). Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[auth] -tab = "Volume(s) Berechtigung" -label = "Volume(s) Berechtigung" -form_ip = "IP" -msg_authd = "Setze Berechtigung für Volume %s auf %s" -auth_explanation = "Bitte beachten Sie das Volumes, die als Images eines Server gestartet werden, automatisch authentifiziert werden!" -error_ip = "IP Adresse ist ungültig" -please_wait = "Setzte Berechtigung für Volume(s). Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[remove] -label = "Volume(s) löschen" -msg_removed = "Volume %s gelöscht" -msg_image_still_in_use = "Das Volume %s des Image ID %s ist noch in benutztung von Server %s" -please_wait = "Lösche Volume(s). Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/lang/en.nfs-storage-about.ini b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/lang/en.nfs-storage-about.ini deleted file mode 100644 index ce1f800..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/lang/en.nfs-storage-about.ini +++ /dev/null @@ -1,70 +0,0 @@ -[documentation] -tab = "About NFS-Storage" -label = "About NFS-Storage" -introduction_title = "Introduction" -introduction_content = "The 'NFS-Storage' plugin manages NFS-Server in openQRM. - " -requirements_title = "Requirements" -requirements_list = "
    • A resource for the NFS-Storage Storage (this can be a remote system integrated into openQRM e.g. via the 'local-server' plugin or the openQRM server itself)
    • -
    • The following packages must be installed: nfs-common, nfs-kernel-server, screen, rsync
    " - -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions." - -provides_title = "Provides" -provides_list = "
    • Storage type: 'NFS Storage'
    • -
    • Deployment types: 'Nfs-root deployment'
    " -type_title = "Plugin Type" -type_content = "Storage" - -deployment_title = "Deployment Type" -deployment_content = "Network-Deployment" - -documentation_title = "Documentation" -use_case_title = "Use-Case" -network_deploymet = "Network-Deployment" -doc1 = "" - - -[bootservice] -tab = "Boot-Service" -label = "NFS-Storage Boot-Service" -boot_service_title = "NFS-Storage Host Boot-Service" -boot_service_content = "The NFS-Storage Plugin provides an openQRM Boot-Service. - This 'NFS-Storage Boot-Service' is automatically downloaded and executed by the openQRM-Client on all integrated Systems. - The Boot-Service is located at:
    -
    - /usr/share/openqrm/plugins/nfs-storage/web/boot-service-nfs-storage.tgz -
    -
    - The 'NFS-Storage Boot-Service contains the Client files of the NFS-Storage Plugin.
    - Also a configuration file for the NFS-Storage server is included in this Boot-Service.
    -
    - The Boot-Service configuration can be viewed and administrated by the 'openqrm' utility.
    - To view the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n nfs-storage -a default -
    -
    - To view a Boot-Service configuration of a specific Server run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service view -n nfs-storage -a [Server-name] -
    -
    - To adapt a parameter in the current default Boot-Service configuration run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n nfs-storage -a default -k [key] -v [value] -
    -
    - To adapt a paramter in the Boot-Service configuration of a specific Server run:
    -
    - /usr/share/openqrm/bin/openqrm boot-service configure -n nfs-storage -a [Server-name] -k [key] -v [value] -
    -
    - In case the openmQRM Server itself is used as the NFS-Storage Storage please edit:
    -
    - /usr/share/openqrm/plugins/nfs-storage/etc/openqrm-plugin-nfs-storage.conf -
    -
    - and set the configuration keys.
    -
    " diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/lang/en.nfs-storage.ini b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/lang/en.nfs-storage.ini deleted file mode 100644 index 08a9ebb..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/lang/en.nfs-storage.ini +++ /dev/null @@ -1,93 +0,0 @@ -[select] -tab = "Select NFS-storage" -label = "Select NFS-storage" -action_edit = "edit" -table_name = "Name" -table_id = "Id" -table_recource = "Resource" -table_type = "Type" -table_deployment = "Deployment" -error_no_storage = "No storage configured yet!

    Please create a NFS Storage first!" -new_storage = "New Storage" -please_wait = "Loading Storage. Please wait .." -[edit] -tab = "Edit NFS-storage" -label = "NFS Volumes on storage %s" -lang_id = "ID" -lang_name = "Name" -lang_resource = "Resource" -lang_state = "State" -lang_vfree = "Free" -lang_vsize = "Total" -lang_authenticated_to = "exported to" -action_add = "Add new Volume" -action_refresh = "Reload Page" -action_manual = "Manual Configuration" -action_clone = "clone" -action_remove = "remove" -action_auth = "auth" -action_add_image = "Add Image" -action_remove_image = "Remove Image" -action_clone_in_progress = "Synchronisation in progress - Please wait" -action_clone_finished = "Syncronisation finished!" -table_name = "Name" -table_export = "Export" -error_no_nfs = "Storage %s is not of type nfs-deployment" -please_wait = "Loading Volumes. Please wait .." -manual_configured = "Storage is manually configured and will not be administrated by openQRM" -[add] -tab = "Add NFS Volume" -label = "Add new Volume" -form_name = "Name" -msg_added = "Added Volume %s" -msg_add_failed = "Failed to add Volume %s" -error_exists = "Volume %s already exists" -error_name = "Name must be %s" -please_wait = "Adding Volume. Please wait .." -canceled = "Operation canceled. Please wait .." -lang_name_generate = "generate name" -[image] -label = "Add/Remove Image for Volume %s" -tab = "Add/Remove Image" -error_exists = "Image %s already exists" -error_image_still_in_use = "Image id %s is still in use by Server(s) %s" -msg_added_image = "Added Image %s" -msg_removed_image = "Removed Image id %s" -please_wait = "Please wait .." -canceled = "Operation canceled. Please wait .." -[manual] -tab = "Manual NFS Configuration" -label = "Manual Configuration" -explanation_1 = "In case the NFS Storage server is not managed by openQRM please use this form to manually create the list of exported paths to server-images on the NFS Storage server." -explanation_2 = "Please notice that in case a manual configuration exist openQRM will not send any automated Storage-authentication commands to this NFS Storage-server!" -please_wait = "Saving Manual Configuration. Please wait .." -canceled = "Operation canceled. Please wait .." -saved = "Manual Configuration has been saved" -error_config = "Error: Please use only %s for Exports" -error_image_in_use = "Error: Image name %s for %s is allready in use!" -error_name_empty = "Error: Name is empty or a path ends with a /" -[clone] -tab = "Clone NFS Volume" -label = "Clone Volume %s" -form_name = "Name" -msg_cloned = "Cloned %s as %s" -msg_clone_failed = "Failed to clone Volume %s" -error_exists = "Volume %s already exists" -error_name = "Name must be %s" -please_wait = "Cloning Volume. Please wait .." -canceled = "Operation canceled. Please wait .." -[auth] -tab = "Authenticate NFS Volume" -label = "Authenticate Volume %s" -form_ip = "IP" -msg_authd = "Authenticated volume %s" -auth_explanation = "Please notice: Volumes which are deployed as an Image via a Server are authenticated automatically!" -error_ip = "IP Adress is not valid" -please_wait = "Authenticating Volume. Please wait .." -canceled = "Operation canceled. Please wait .." -[remove] -label = "Remove Volume(s)" -msg_removed = "Removed Volume %s" -msg_image_still_in_use = "Volume %s of Image id %s is still in use by Server %s" -please_wait = "Removing Volume(s). Please wait .." -canceled = "Operation canceled. Please wait .." diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/menu.txt deleted file mode 100644 index 562868b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/menu.txt +++ /dev/null @@ -1,23 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|Nfs-Storage -...|Volume Admin|index.php?plugin=nfs-storage|NFS Storage Manager -...|About|index.php?plugin=nfs-storage&controller=nfs-storage-about|How to use -...|Config|index.php?plugin=nfs-storage&controller=nfs-storage-about&nfs_storage_about_action=bootservice|NFS Storage Boot-Service diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/nfs-storage-action.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/nfs-storage-action.php deleted file mode 100644 index fee5cda..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/nfs-storage-action.php +++ /dev/null @@ -1,122 +0,0 @@ - -*/ - - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/authblocker.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -// filter inputs -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; - -global $IMAGE_INFO_TABLE; -global $DEPLOYMENT_INFO_TABLE; -global $OPENQRM_SERVER_BASE_DIR; - -$nfs_storage_command = $request->get('nfs_storage_command'); -$nfs_image_name = $request->get('nfs_image_name'); - -// place for the storage stat files -$StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/nfs-storage/storage'; -// global event for logging -$event = new event(); - -// user/role authentication -if ($OPENQRM_USER->role != "administrator") { - $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "nfs-action", "Un-Authorized access to nfs-actions from $OPENQRM_USER->name", "", "", 0, 0, 0); - exit(); -} - -$event->log("$nfs_storage_command", $_SERVER['REQUEST_TIME'], 5, "nfs-storage-action", "Processing nfs-storage command $nfs_storage_command", "", "", 0, 0, 0); -switch ($nfs_storage_command) { - case 'get_storage': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'get_ident': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'get_sync_progress': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - break; - - case 'get_sync_finished': - if (!file_exists($StorageDir)) { - mkdir($StorageDir); - } - $filename = $StorageDir."/".$_POST['filename']; - $filedata = base64_decode($_POST['filedata']); - echo "

    $filename

    "; - $fout = fopen($filename,"wb"); - fwrite($fout, $filedata); - fclose($fout); - sleep(5); - unlink($filename); - break; - - case 'auth_finished': - // remove storage-auth-blocker if existing - $authblocker = new authblocker(); - $authblocker->get_instance_by_image_name($nfs_image_name); - if (strlen($authblocker->id)) { - $event->log('auth_finished', $_SERVER['REQUEST_TIME'], 5, "nfs-storage-action", "Removing authblocker for image $nfs_image_name", "", "", 0, 0, 0); - $authblocker->remove($authblocker->id); - } - break; - - default: - $event->log("$nfs_storage_command", $_SERVER['REQUEST_TIME'], 3, "nfs-storage-action", "No such nfs-storage command ($nfs_storage_command)", "", "", 0, 0, 0); - break; - - -} -?> - - diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/openqrm-nfs-deployment-auth-hook.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/openqrm-nfs-deployment-auth-hook.php deleted file mode 100644 index cc1669d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/openqrm-nfs-deployment-auth-hook.php +++ /dev/null @@ -1,365 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/image_authentication.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/authblocker.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; - -/** - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - */ - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $IMAGE_AUTHENTICATION_TABLE; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - - - //-------------------------------------------------- - /** - * authenticates the storage volume for the appliance resource - * - * storage_auth_function("start", 2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_function($cmd, $appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $IMAGE_AUTHENTICATION_TABLE; - global $openqrm_server; - global $RootDir; - - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - - $image = new image(); - $image->get_instance_by_id($appliance->imageid); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - $resource_ip=$resource->ip; - - // this is a hook for the cloud-plugin to be able - // to translate the internal to the external ip address - // for the nfs-mount authentication - /* if (file_exists("$RootDir/plugins/cloud/.running")) { - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "Found Cloud enabled and running. Checking for CloudNAT", "", "", 0, 0, $appliance_id); - // special clouduser class - require_once "$RootDir/plugins/cloud/class/cloudconfig.class.php"; - require_once "$RootDir/plugins/cloud/class/cloudnat.class.php"; - // check if we have to cloudnat the ip address - $cn_conf = new cloudconfig(); - $cn_nat_enabled = $cn_conf->get_value(18); // 18 is cloud_nat - if (!strcmp($cn_nat_enabled, "true")) { - $cn = new cloudnat(); - $internal_resource_ip=$resource_ip; - $resource_ip = $cn->translate($resource_ip); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "Found CloudNAT enabled, translated $internal_resource_ip to $resource_ip", "", "", 0, 0, $appliance_id); - } else { - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "Cloudnat is disabled, keeping $resource_ip", "", "", 0, 0, $appliance_id); - } - - } else { - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "Cloud is not enabled/running. Not checking for CloudNAT", "", "", 0, 0, $appliance_id); - - } -*/ - - // manual configured ? - $StorageDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/plugins/nfs-storage/storage'; - $statfile_manual="$StorageDir/".$storage_resource->id.".nfs.stat.manual"; - if (file_exists($statfile_manual)) { - // remove storage-auth-blocker if existing - $authblocker = new authblocker(); - $authblocker->get_instance_by_image_name($image_name); - if (strlen($authblocker->id)) { - $event->log('storage_auth_function', $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "Removing authblocker for image $image_name", "", "", 0, 0, 0); - $authblocker->remove($authblocker->id); - } - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "NFS Storage $storage->id is manually configured. Skipping automatic authentication hook ...", "", "", 0, 0, $appliance_id); - return; - } - - - switch($cmd) { - case "start": - // authenticate the rootfs / needs openqrm user + pass - $openqrm_admin_user = new user("openqrm"); - $openqrm_admin_user->set_user(); - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "Authenticating $image_name to resource $resource_ip", "", "", 0, 0, $appliance_id); - $auth_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -n ".$image_name." -r ".$image_rootdevice." -i ".$resource_ip." -u ".$openqrm_admin_user->name." -p ".$openqrm_admin_user->password." --openqrm-cmd-mode background"; - $resource->send_command($storage_ip, $auth_start_cmd); - - // authenticate the install-from-nfs export - $run_disable_deployment_export=0; - $install_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_INSTALL_FROM_NFS")); - if (strlen($install_from_nfs_param)) { - - // storage -> resource -> auth - $ip_storage_id=$deployment->parse_deployment_parameter("id", $install_from_nfs_param); - $ip_storage_ip=$deployment->parse_deployment_parameter("ip", $install_from_nfs_param); - $ip_image_rootdevice=$deployment->parse_deployment_parameter("path", $install_from_nfs_param); - - $ip_storage = new storage(); - $ip_storage->get_instance_by_id($ip_storage_id); - $ip_storage_resource = new resource(); - $ip_storage_resource->get_instance_by_id($ip_storage->resource_id); - $op_storage_ip = $ip_storage_resource->ip; - - $ip_deployment = new deployment(); - $ip_deployment->get_instance_by_id($ip_storage->type); - $ip_deployment_type = $ip_deployment->type; - $ip_deployment_plugin_name = $ip_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $ip_storage_id:$ip_storage_ip:$ip_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$ip_deployment_plugin_name."/bin/openqrm-".$ip_deployment_plugin_name." auth -r ".$ip_image_rootdevice." -i ".$resource_ip." -t ".$ip_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($ip_storage_ip, $auth_install_from_nfs_start_cmd); - - $run_disable_deployment_export=1; - } - - // authenticate the transfer-to-nfs export - $transfer_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_TRANSFER_TO_NFS")); - if (strlen($transfer_from_nfs_param)) { - // storage -> resource -> auth - $tp_storage_id=$deployment->parse_deployment_parameter("id", $transfer_from_nfs_param); - $tp_storage_ip=$deployment->parse_deployment_parameter("ip", $transfer_from_nfs_param); - $tp_image_rootdevice=$deployment->parse_deployment_parameter("path", $transfer_from_nfs_param); - - $tp_storage = new storage(); - $tp_storage->get_instance_by_id($tp_storage_id); - $tp_storage_resource = new resource(); - $tp_storage_resource->get_instance_by_id($tp_storage->resource_id); - $op_storage_ip = $tp_storage_resource->ip; - - $tp_deployment = new deployment(); - $tp_deployment->get_instance_by_id($tp_storage->type); - $tp_deployment_type = $tp_deployment->type; - $tp_deployment_plugin_name = $tp_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "Transfer-to-NFS: Authenticating $resource_ip on storage id $tp_storage_id:$tp_storage_ip:$tp_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$tp_deployment_plugin_name."/bin/openqrm-".$tp_deployment_plugin_name." auth -r ".$tp_image_rootdevice." -i ".$resource_ip." -t ".$tp_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($tp_storage_ip, $auth_install_from_nfs_start_cmd); - - $run_disable_deployment_export=1; - } - - // do we need to disable the install-from/transfer-to-nfs exports ? - if ($run_disable_deployment_export == 1) { - $image_authentication = new image_authentication(); - $ia_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_auth_ar = array( - 'ia_id' => $ia_id, - 'ia_image_id' => $appliance->imageid, - 'ia_resource_id' => $appliance->resources, - 'ia_auth_type' => 1, - ); - $image_authentication->add($image_auth_ar); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "Registered image $appliance->imageid for de-authentication the deployment exports when resource $appliance->resources is fully up.", "", "", 0, 0, $appliance_id); - } - - - break; - - case "stop": - $image_authentication = new image_authentication(); - $ia_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $image_auth_ar = array( - 'ia_id' => $ia_id, - 'ia_image_id' => $appliance->imageid, - 'ia_resource_id' => $appliance->resources, - 'ia_auth_type' => 0, - ); - $image_authentication->add($image_auth_ar); - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "Registered image $appliance->imageid for de-authentication the root-fs exports when resource $appliance->resources is idle again.", "", "", 0, 0, $appliance_id); - break; - - } - - } - - - - //-------------------------------------------------- - /** - * de-authenticates the storage volume for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - $auth_stop_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$deployment_plugin_name."/bin/openqrm-".$deployment_plugin_name." auth -r ".$image_rootdevice." -i ".$OPENQRM_SERVER_IP_ADDRESS." --openqrm-cmd-mode background"; - $resource = new resource(); - $resource->send_command($storage_ip, $auth_stop_cmd); - - } - - - //-------------------------------------------------- - /** - * de-authenticates the storage deployment volumes for the appliance resource - * (runs via the image_authentication class) - * - * storage_auth_deployment_stop(2); - * - * @access public - */ - //-------------------------------------------------- - function storage_auth_deployment_stop($image_id) { - - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $image = new image(); - $image->get_instance_by_id($image_id); - $image_name=$image->name; - $image_rootdevice=$image->rootdevice; - - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $storage_resource = new resource(); - $storage_resource->get_instance_by_id($storage->resource_id); - $storage_ip = $storage_resource->ip; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - - // just for sending the commands - $resource = new resource(); - - // get install deployment params - $install_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_INSTALL_FROM_NFS")); - if (strlen($install_from_nfs_param)) { - // storage -> resource -> auth - $ip_storage_id=$deployment->parse_deployment_parameter("id", $install_from_nfs_param); - $ip_storage_ip=$deployment->parse_deployment_parameter("ip", $install_from_nfs_param); - $ip_image_rootdevice=$deployment->parse_deployment_parameter("path", $install_from_nfs_param); - - $ip_storage = new storage(); - $ip_storage->get_instance_by_id($ip_storage_id); - $ip_storage_resource = new resource(); - $ip_storage_resource->get_instance_by_id($ip_storage->resource_id); - $op_storage_ip = $ip_storage_resource->ip; - - $ip_deployment = new deployment(); - $ip_deployment->get_instance_by_id($ip_storage->type); - $ip_deployment_type = $ip_deployment->type; - $ip_deployment_plugin_name = $ip_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $ip_storage_id:$ip_storage_ip:$ip_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$ip_deployment_plugin_name."/bin/openqrm-".$ip_deployment_plugin_name." auth -r ".$ip_image_rootdevice." -i ".$OPENQRM_SERVER_IP_ADDRESS." -t ".$ip_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($ip_storage_ip, $auth_install_from_nfs_start_cmd); - } - - // get transfer deployment params - $transfer_from_nfs_param = trim($image->get_deployment_parameter("IMAGE_TRANSFER_TO_NFS")); - if (strlen($transfer_from_nfs_param)) { - // storage -> resource -> auth - $tp_storage_id=$deployment->parse_deployment_parameter("id", $transfer_from_nfs_param); - $tp_storage_ip=$deployment->parse_deployment_parameter("ip", $transfer_from_nfs_param); - $tp_image_rootdevice=$deployment->parse_deployment_parameter("path", $transfer_from_nfs_param); - - $tp_storage = new storage(); - $tp_storage->get_instance_by_id($tp_storage_id); - $tp_storage_resource = new resource(); - $tp_storage_resource->get_instance_by_id($tp_storage->resource_id); - $op_storage_ip = $tp_storage_resource->ip; - - $tp_deployment = new deployment(); - $tp_deployment->get_instance_by_id($tp_storage->type); - $tp_deployment_type = $tp_deployment->type; - $tp_deployment_plugin_name = $tp_deployment->storagetype; - - $event->log("storage_auth_function", $_SERVER['REQUEST_TIME'], 5, "openqrm-nfs-deployment-auth-hook.php", "Install-from-NFS: Authenticating $resource_ip on storage id $tp_storage_id:$tp_storage_ip:$tp_image_rootdevice", "", "", 0, 0, $appliance_id); - $auth_install_from_nfs_start_cmd = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/".$tp_deployment_plugin_name."/bin/openqrm-".$tp_deployment_plugin_name." auth -r ".$tp_image_rootdevice." -i ".$OPENQRM_SERVER_IP_ADDRESS." -t ".$tp_deployment_type." --openqrm-cmd-mode background"; - $resource->send_command($tp_storage_ip, $auth_install_from_nfs_start_cmd); - } - - } - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/openqrm-nfs-deployment-cloud-hook.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/openqrm-nfs-deployment-cloud-hook.php deleted file mode 100644 index 564e4bf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/openqrm-nfs-deployment-cloud-hook.php +++ /dev/null @@ -1,171 +0,0 @@ - -*/ - - -// This file implements the cloud storage methods - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -// special cloud classes -require_once "$RootDir/plugins/cloud/class/cloudimage.class.php"; - -$event = new event(); -global $event; - -global $OPENQRM_SERVER_BASE_DIR; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $RESOURCE_INFO_TABLE; - - -// --------------------------------------------------------------------------------- -// general cloudstorage methods -// --------------------------------------------------------------------------------- - - -// clones the volume of an image -function create_clone_nfs_deployment($cloud_image_id, $image_clone_name, $disk_size) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("create_clone", $_SERVER['REQUEST_TIME'], 5, "nfs-deployment-cloud-hook", "Creating clone of image on storage", "", "", 0, 0, 0); - - // we got the cloudimage id here, get the image out of it - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image, this is already the new logical clone - // we just need to physical snapshot it and update the rootdevice - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // nfs-storage - $export_dir=dirname($image_rootdevice); - $image_location_name=basename($image_rootdevice); - // update the image rootdevice parameter - $image->get_instance_by_id($image_id); - $ar_image_update = array( - 'image_rootdevice' => "$export_dir/$image_clone_name", - ); - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "nfs-deployment-cloud-hook", "Updating rootdevice of image $image_id / $image_name with $export_dir/$image_clone_name", "", "", 0, 0, 0); - $image->update($image_id, $ar_image_update); - // send command - $image_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/nfs-storage/bin/openqrm-nfs-storage snap -n ".$image_location_name." -s ".$image_clone_name." --openqrm-cmd-mode background"; - $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "nfs-deployment-cloud-hook", "Running : $image_clone_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_clone_cmd); -} - - - -// removes the volume of an image -function remove_nfs_deployment($cloud_image_id) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("remove_nfs_deployment", $_SERVER['REQUEST_TIME'], 5, "nfs-deployment-cloud-hook", "Removing image on storage", "", "", 0, 0, 0); - - $cloudimage = new cloudimage(); - $cloudimage->get_instance_by_id($cloud_image_id); - // get image - $image = new image(); - $image->get_instance_by_id($cloudimage->image_id); - $image_id = $image->id; - $image_name = $image->name; - $image_type = $image->type; - $image_version = $image->version; - $image_rootdevice = $image->rootdevice; - $image_rootfstype = $image->rootfstype; - $image_storageid = $image->storageid; - $image_isshared = $image->isshared; - $image_comment = $image->comment; - $image_capabilities = $image->capabilities; - $image_deployment_parameter = $image->deployment_parameter; - - // get image storage - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - // get storage resource - $resource = new resource(); - $resource->get_instance_by_id($storage_resource_id); - $resource_id = $resource->id; - $resource_ip = $resource->ip; - // nfs-storage - $image_location_name=basename($image_rootdevice); - $image_remove_clone_cmd=$OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/nfs-storage/bin/openqrm-nfs-storage remove -n ".$image_location_name." --openqrm-cmd-mode background"; - $event->log("remove_nfs_deployment", $_SERVER['REQUEST_TIME'], 5, "nfs-deployment-cloud-hook", "Running : $image_remove_clone_cmd", "", "", 0, 0, 0); - $resource->send_command($resource_ip, $image_remove_clone_cmd); -} - - -// resizes the volume of an image -function resize_nfs_deployment($cloud_image_id, $resize_value) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("resize_nfs_deployment", $_SERVER['REQUEST_TIME'], 2, "nfs-deployment-cloud-hook", "Resize image is not supported for nfs-storage!", "", "", 0, 0, 0); -} - - - -// creates a private copy of the volume of an image -function create_private_nfs_deployment($cloud_image_id, $private_disk, $private_image_name) { - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $event; - $event->log("create_private_nfs_deployment", $_SERVER['REQUEST_TIME'], 2, "nfs-deployment-cloud-hook", "Creating private image is not supported for nfs-storage!", "", "", 0, 0, 0); -} - - - -// --------------------------------------------------------------------------------- - - diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/root-mount.nfs-deployment b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/root-mount.nfs-deployment deleted file mode 100644 index dc3447d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/root-mount.nfs-deployment +++ /dev/null @@ -1,235 +0,0 @@ -#!/bin/bash -# this is the root-mount initrd-service -# which proivdes function to mount/remount the remote -# nfs-rootfs according to the image_deployment_parameters at /mnt -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -# nfs-storage -# Required defines in the image_deploy_paramters -# -# -# Optional parameters -# -# IMAGE_INSTALL_FROM_NFS - can be set to an (nfs) location from -# which the image will be installed at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_TRANSFER_TO_NFS - can be set to an (nfs) location from -# which the image will be transfered to at -# deployment time -# syntax is : storage_id:ip_of_nfs-server:path_to_target_image -# -# IMAGE_INSTALL_FROM_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this -# option will install the nfs-storage image on -# boot-time from the local-device -# -# IMAGE_TRANSFER_TO_LOCAL - set to a local harddisk device (e.g. /dev/hda1) this option will transfrom -# the nfs-storage image on boot-time to the local-device -# -# -# -# IMAGE_INSTALL_FROM_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_TRANSFER_TO_LOCAL_FS_TYPE - set to a local harddisk device fs-type (e.g. ext3) -# -# IMAGE_NFS_MOUNT_OPTIONS - can be e.g. set to proto=tcp for the install/transform phase -# - -# get the deployment parameters from openqrm.conf -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -. $OPENQRM_RESOURCE_PARAMETER_FILE -eval $image_deployment_parameter -export OPENQRM_SERVER_BASE_DIR=$resource_basedir -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions - -if [ "$IMAGE_NFS_MOUNT_OPTIONS" != "" ]; then - IMAGE_NFS_MOUNT_OPTIONS=",$IMAGE_NFS_MOUNT_OPTIONS" -fi -# default to ext3 -if [ "$IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" == "" ]; then - IMAGE_INSTALL_FROM_LOCAL_FS_TYPE="ext3" -fi -if [ "$IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" == "" ]; then - IMAGE_TRANSFER_TO_LOCAL_FS_TYPE="ext3" -fi - -# adapt the rootdevice parameters -IMAGE_ROOT_DIR=$image_rootdevice - -####################################################################### -# required functions ################################################## -####################################################################### - -function mount_rootfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - - if ! mount -t nfs -o rw,nolock$IMAGE_NFS_MOUNT_OPTIONS $image_storage_server_ip:$IMAGE_ROOT_DIR /mnt; then - echo "ERROR: Could not mount $image_storage_server_ip:$IMAGE_ROOT_DIR by nfs" - # give a shell for the admin - /bin/bash - else - echo "nfs-storage: Mounted $image_storage_server_ip:$IMAGE_ROOT_DIR rw" - fi - - if [ "$IMAGE_INSTALL_FROM_NFS" != "" ]; then - install_rootfs_from_nfs - else - echo "nfs-storage: Skipping install phase" - fi - if [ "$IMAGE_TRANSFER_TO_NFS" != "" ]; then - transfer_rootfs_to_nfs - else - echo "nfs-storage: Skipping transfer-to-nfs phase" - fi - if [ "$IMAGE_INSTALL_FROM_LOCAL" != "" ]; then - install_rootfs_from_local - else - echo "nfs-storage: Skipping install-from-local phase" - fi - if [ "$IMAGE_TRANSFER_TO_LOCAL" != "" ]; then - transfer_rootfs_to_local - else - echo "nfs-storage: Skipping transfer-to-local phase" - fi -} - - -function remount_rootfs() { - - # Debian/Ubuntu Systems want their nfs-rootfs in rw mode - if [ -f /mnt/etc/apt/sources.list ]; then - if grep ubuntu /mnt/etc/apt/sources.list >/remountlog; then - echo "nfs-storage: Skipping Re-mount $image_storage_server_ip:$IMAGE_ROOT_DIR ro" - rm -f /remountlog - return - fi - fi - - # remont /mnt ro - while ! mount -t nfs -o ro,remount,nolock$IMAGE_NFS_MOUNT_OPTIONS $image_storage_server_ip:$IMAGE_ROOT_DIR /mnt; do - echo -n "." - sleep 1 - REMOUNT_LOOP=$[ REMOUNT_LOOP + 1 ] - if [ "$REMOUNT_LOOP" == "10" ]; then - echo "ERROR: nfs-storage could not remount /mnt " - /bin/bash - fi - done - echo "nfs-storage: Re-mounted $image_storage_server_ip:$IMAGE_ROOT_DIR ro" - openqrm_portmap_stop - -} - - -function create_fstab() { - rm -f $IMAGE_FSTAB - echo "$image_storage_server_ip:$IMAGE_ROOT_DIR / nfs defaults 0 0" >> $IMAGE_FSTAB -} - - -####################################################################### -# optional functions ################################################## -####################################################################### - -function install_rootfs_from_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f1` - IMAGE_INSTALL_FROM_NFS=`echo $IMAGE_INSTALL_FROM_NFS | cut -d':' -f2-` - echo "nfs-storage: Installing $resource_image from $IMAGE_INSTALL_FROM_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o ro$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_INSTALL_FROM_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "nfs-storage: Starting install-from-nfs phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "nfs-storage: Install-from-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function transfer_rootfs_to_nfs() { - modprobe sunrpc 1>/dev/null 2>&1 - modprobe lockd 1>/dev/null 2>&1 - modprobe nfs 1>/dev/null 2>&1 - rm -rf /dev/null - mknod -m 666 /dev/null c 1 3 - openqrm_portmap_start - STORAGE_ID=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f1` - IMAGE_TRANSFER_TO_NFS=`echo $IMAGE_TRANSFER_TO_NFS | cut -d':' -f2-` - echo "nfs-storage: Transfering $resource_image to $IMAGE_TRANSFER_TO_NFS ($STORAGE_ID)" - mkdir -p /mnt2 - if ! mount -t nfs -o rw$IMAGE_NFS_MOUNT_OPTIONS $IMAGE_TRANSFER_TO_NFS /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_NFS by nfs" - # give a shell for the admin - /bin/bash - fi - echo "nfs-storage: Starting transfer-to-nfs phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "nfs-storage: Transfer-to-nfs phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 - openqrm_portmap_stop -} - - -function install_rootfs_from_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE -o ro $IMAGE_INSTALL_FROM_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_INSTALL_FROM_LOCAL / $IMAGE_INSTALL_FROM_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "nfs-storage: Starting install-to-local phase. This can take a while ...." - rsync -aq /mnt2/* /mnt/ - echo "nfs-storage: Install-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - -function transfer_rootfs_to_local() { - modprobe ext3 1>/dev/null 2>&1 - mkdir -p /mnt2 - if ! mount -t $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE -o rw $IMAGE_TRANSFER_TO_LOCAL /mnt2; then - echo "ERROR: Could not mount $IMAGE_TRANSFER_TO_LOCAL / $IMAGE_TRANSFER_TO_LOCAL_FS_TYPE" - # give a shell for the admin - /bin/bash - fi - echo "nfs-storage: Starting transfer-to-local phase. This can take a while ...." - rsync -aq /mnt/* /mnt2/ - echo "nfs-storage: Transfer-to-local phase finished. Continuing boot-up" - umount /mnt2 - rmdir /mnt2 -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-about-bootservice.tpl.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-about-bootservice.tpl.php deleted file mode 100644 index be1595a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-about-bootservice.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - - -

    {label}

    -
    -
    -

    {boot_service_title}

    - {boot_service_content} -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-about-documentation.tpl.php deleted file mode 100644 index ccf3483..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-about-documentation.tpl.php +++ /dev/null @@ -1,42 +0,0 @@ - - -

    {label}

    -
    -
    -

    {introduction_title}

    - {introduction_content} - -

    {provides_title}

    - {provides_list} - -

    {requirements_title}

    - {requirements_list} - -
    -
    -

    {type_title}

    - {type_content} - -

    {deployment_title}

    - {deployment_content} - -

    {tested_title}

    - {tested_content} - -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-add.tpl.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-add.tpl.php deleted file mode 100644 index 3378427..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-add.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    -
    -{form} -
    - {name} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-auth.tpl.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-auth.tpl.php deleted file mode 100644 index ec9ba32..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-auth.tpl.php +++ /dev/null @@ -1,27 +0,0 @@ - -

    {label}

    -
    - -
    - {auth_explanation} -

    - {form} - {ip} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-clone.tpl.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-clone.tpl.php deleted file mode 100644 index 850e7ce..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-clone.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ - -

    {label}

    -
    -
    - {form} - {name} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-edit.tpl.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-edit.tpl.php deleted file mode 100644 index 79f6f43..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-edit.tpl.php +++ /dev/null @@ -1,42 +0,0 @@ - -

    {label}

    -
    -
    - {lang_id}: {id}
    - {lang_name}: {name}
    - {lang_resource}: {resource}
    - {lang_state}: {state}
    - -
    -
    - {lang_vsize} / {lang_vfree}: {vsize} / {vfree} -
    -
    - - {add}
    - {manual} -
    -
    -
    -
    -
    -
    - {table} -
    -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-manual.tpl.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-manual.tpl.php deleted file mode 100644 index d824cb1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-manual.tpl.php +++ /dev/null @@ -1,26 +0,0 @@ - -

    {label}

    -
    -
    -

    {explanation_1}

    -

    {explanation_2}

    - {form} - {config} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-remove.tpl.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-remove.tpl.php deleted file mode 100644 index 957ed31..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-remove.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ - -

    {label}

    -
    -
    - {form} -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-select.tpl.php b/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-select.tpl.php deleted file mode 100644 index c7c3dc9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/nfs-storage/web/tpl/nfs-storage-select.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ - -

    {label}

    -
    -
    - {table} -
    -
    - diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/Makefile b/openQRM-5.3.50-CE/src/plugins/novnc/Makefile deleted file mode 100644 index d799416..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# this is the openQRM novnc-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf -export NOVNC_SOURCE_CONF=$(shell pwd)/etc/openqrm-plugin-novnc.conf - - -configure: - -compile: - ../../make-assistant openqrm_cache_or_download kanaka-noVNC etc/build.conf/novnc.conf - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/bin/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/novnc $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/httpdocs - . $(OPENQRM_SERVER_CONF) && cp httpdocs/*.html $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/httpdocs/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/httpdocs/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/tpl/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/lang/ - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/novnc.conf && if ! tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/ -xzf $$OPENQRM_BUILD_TMP_DIR/openqrm-build/kanaka-noVNC/source/kanaka-noVNC-$$OPENQRM_SOURCE_VERSION.tar.gz 2>/dev/null; then tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/ -xzf ../../$$OPENQRM_BUILD_TMP_DIR/openqrm-build/kanaka-noVNC/source/kanaka-noVNC-$$OPENQRM_SOURCE_VERSION.tar.gz; fi - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/novnc.conf && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient && mv $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/kanaka-noVNC-$$OPENQRM_SOURCE_SUB_VERSION $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/novnc.conf && cp -f $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient/include/black.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient/include/plain.css - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/novnc.conf && tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc -czf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/boot-service-novnc.tgz include/ etc/init.d/novnc etc/openqrm-plugin-novnc.conf - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/novnc - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/novnc/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/bin/openqrm-novnc-manager b/openQRM-5.3.50-CE/src/plugins/novnc/bin/openqrm-novnc-manager deleted file mode 100644 index 177a9a9..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/bin/openqrm-novnc-manager +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/bash -# this script automatically manages novnc -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/include/openqrm-plugin-novnc-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/etc/openqrm-plugin-novnc.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -openqrm_server_get_config -export resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -export LANG=C - -# unblock starting command queue early for non-blocking + ui commands -openqrm_unblock_starting_queue $@ - -# novnc defines -NOVNC_WEBSERVER_PORT_RANGE_START=6000 -NOVNC_WEBSOCKET_PORT_RANGE_START=6800 - -if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" -else - RUNSCREEN=`which screen` -fi - - -# debug -echo "!!!! running: $0 $@" | logger - - -function novnc_manager_usage() { - echo "Usage : $0 remoteconsole" - exit 1 -} - -FULL_COMMANDLINE="$0 $@" -NOVNC_MANAGER_COMMAND=$1 -shift - -while [ $# -ne 0 ]; do - case "$1" in - -n) - VM_NAME=$2 - shift - ;; - -d) - NOVNC_PROXY_PORT=$2 - shift - ;; - -m) - VM_MAC=$2 - shift - ;; - -v) - VM_VNC_PORT_NUMBER=$2 - shift - ;; - -i) - VM_HOST_IP=$2 - shift - ;; - --openqrm-ui-user) - OPENQRM_UI_USER=$2 - shift - ;; - --openqrm-internal-cmd) - OPENQRM_INTERNAL_CMD=$2 - shift - ;; - --openqrm-cmd-mode) - OPENQRM_CMD_MODE=$2 - shift - ;; - *) - echo "ERROR: Free commandline arguments are not allowed" - novnc_manager_usage - exit 6 - ;; - esac - shift -done - - -# main -case "$NOVNC_MANAGER_COMMAND" in - remoteconsole) - # remove all not active zombies - kill -9 `ps ax | grep python | grep defunct | grep 'Z+' | awk '{ print $1 }'` 1>/dev/null 2>&1 - # calculate the web + proxy port - NOVNC_WEBSERVER_PORT=$(( NOVNC_WEBSERVER_PORT_RANGE_START + NOVNC_PROXY_PORT )) - NOVNC_WEBSOCKET_PORT=$(( NOVNC_WEBSOCKET_PORT_RANGE_START + NOVNC_PROXY_PORT )) - VM_VNC_PORT=$(( VM_VNC_PORT_NUMBER + 5900 )) - - for NOVNC_WSPROXYPID in `ps ax | grep wsproxy.py | grep -i -v screen | grep -w "$VM_HOST_IP:$VM_VNC_PORT" | grep -v grep | awk {' print $1 '}`; do - kill $NOVNC_WSPROXYPID - kill -9 $NOVNC_WSPROXYPID 2>/dev/null - done - for NOVNC_WSPROXYPID in `ps ax | grep wsproxy.py | grep -i screen | grep -w "$VM_HOST_IP:$VM_VNC_PORT" | grep -v grep | awk {' print $1 '}`; do - kill $NOVNC_WSPROXYPID - kill -9 $NOVNC_WSPROXYPID 2>/dev/null - done - $RUNSCREEN -wipe 1>/dev/null 2>&1 - - # start new screen session - SCREEN_NAME="NOVNC.$VM_NAME.$VM_HOST_IP.$VM_VNC_PORT_NUMBER" - cd $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient - - NOVNC_KEY=/usr/share/openqrm/etc/ssl/private/openqrm-private.key - NOVNC_CERT=/usr/share/openqrm/etc/ssl/cert/openqrm.crt - NOVNC_DOCS=$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/httpdocs - if [ -f $NOVNC_KEY -a -f $NOVNC_CERT ]; then - $RUNSCREEN -dmS $SCREEN_NAME python utils/wsproxy.py --web $NOVNC_DOCS --idle-timeout=90 --cert=$NOVNC_CERT --key=$NOVNC_KEY $NOVNC_WEBSERVER_PORT $VM_HOST_IP:$VM_VNC_PORT - else - $RUNSCREEN -dmS $SCREEN_NAME python utils/wsproxy.py --web $NOVNC_DOCS --idle-timeout=90 $NOVNC_WEBSERVER_PORT $VM_HOST_IP:$VM_VNC_PORT - fi - cd - 1>/dev/null - ;; - - disable-remoteconsole) - # remove all not active zombies - kill -9 `ps ax | grep python | grep defunct | grep 'Z+' | awk '{ print $1 }'` 1>/dev/null 2>&1 - # calculate the web + proxy port - #NOVNC_WEBSERVER_PORT=$(( NOVNC_WEBSERVER_PORT_RANGE_START + NOVNC_PROXY_PORT )) - #NOVNC_WEBSOCKET_PORT=$(( NOVNC_WEBSOCKET_PORT_RANGE_START + NOVNC_PROXY_PORT )) - VM_VNC_PORT=$(( VM_VNC_PORT_NUMBER + 5900 )) - - for NOVNC_WSPROXYPID in `ps ax | grep wsproxy.py | grep -i -v screen | grep -w "$VM_HOST_IP:$VM_VNC_PORT" | grep -v grep | awk {' print $1 '}`; do - kill $NOVNC_WSPROXYPID - kill -9 $NOVNC_WSPROXYPID 2>/dev/null - done - for NOVNC_WSPROXYPID in `ps ax | grep wsproxy.py | grep -i screen | grep -w "$VM_HOST_IP:$VM_VNC_PORT" | grep -v grep | awk {' print $1 '}`; do - kill $NOVNC_WSPROXYPID - kill -9 $NOVNC_WSPROXYPID 2>/dev/null - done - $RUNSCREEN -wipe 1>/dev/null 2>&1 - exit 0 - ;; - - *) - echo "ERROR: Free commandline arguments are not allowed" - novnc_manager_usage - exit 6 - ;; -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/etc/build.conf/novnc.conf b/openQRM-5.3.50-CE/src/plugins/novnc/etc/build.conf/novnc.conf deleted file mode 100644 index 78828fe..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/etc/build.conf/novnc.conf +++ /dev/null @@ -1,21 +0,0 @@ -# Below the download locations for third-party components are defined -# openqrm-plugin-novnc-components.tgz provides a stripped ajaxterm and a -# static compiled pound as the reverse ssl-proxy -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="v0.4-137-g85e8991" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/plugins/novnc/kanaka-noVNC-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_BINARY_RESULT="" -OPENQRM_SOURCE_SUB_VERSION="85e8991" diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/etc/init.d/novnc b/openQRM-5.3.50-CE/src/plugins/novnc/etc/init.d/novnc deleted file mode 100644 index 7f8ef33..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/etc/init.d/novnc +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the novnc resources -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -# for including the package functions -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/include/openqrm-plugin-novnc-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/etc/openqrm-plugin-novnc.conf -. $OPENQRM_RESOURCE_PARAMETER_FILE -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - -# do not run on idle resources -if [ "$resource_image" == "idle" ]; then - exit 0 -fi -# also do not run before the real init of the rootfs -# if we have this file /etc/initrd-devices.conf we are still in the initrd -if [ -f /etc/initrd-devices.conf ]; then - exit 0 -fi - - -function novnc_start() { - echo "Starting the openQRM novnc-plugin" - novnc_stop 1>/dev/null 2>&1 - return 0 -} - - -function novnc_stop() { - echo "Stopping the openQRM novnc-plugin" - return 0 -} - - - -case "$1" in - start) - novnc_start - ;; - stop) - novnc_stop - ;; - restart) - novnc_stop - sleep 1 - novnc_start - ;; - *) - echo "Usage: $0 {start|stop|restart|createcert}" - exit 1 - -esac -exit $? - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/etc/init.d/openqrm-plugin-novnc b/openQRM-5.3.50-CE/src/plugins/novnc/etc/init.d/openqrm-plugin-novnc deleted file mode 100644 index 959774c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/etc/init.d/openqrm-plugin-novnc +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash -# init script for the openQRM novnc plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/include/openqrm-plugin-novnc-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/etc/openqrm-plugin-novnc.conf -# for the post-event to work -openqrm_server_get_config -OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS -resource_id=0 -resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -# which screen binary to use -if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" -else - RUNSCREEN=`which screen` -fi - - -function openqrm_plugin_novnc_start() { - echo "Starting the openQRM novnc-plugin" - local CURRENTDIR=`pwd` - openqrm_plugin_novnc_stop 1>/dev/null 2>&1 - - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/novnc/.running - return 0 -} - -function openqrm_plugin_novnc_stop() { - echo "Stopping the openQRM novnc-plugin" - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/novnc/.running - return 0 -} - - -function openqrm_plugin_novnc_init() { - echo "Initializing the openQRM novnc-plugin" - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/novnc - # link the boot-service - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/web/boot-service-novnc.tgz $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-novnc.tgz - # link novnc client js files - mkdir -p $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/novnc/novncjs - for j in $(ls $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient/include | grep "[.|-]js"); do - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient/include/$j $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/novnc/novncjs/$j - done - # link novnc client font files - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient/include/Orbitron700.ttf $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/novnc/novncjs/Orbitron700.ttf - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient/include/Orbitron700.woff $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/novnc/novncjs/Orbitron700.woff - # link novnc client image files - for i in $(ls $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient/images); do - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient/images/$i $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/novnc/img/$i - done - ##### cloud - if [ -d $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web ]; then - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/novncjs - for j in $(ls $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient/include | grep "[.|-]js"); do - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient/include/$j $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/novncjs/$j - done - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient/include/Orbitron700.ttf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/novncjs/Orbitron700.ttf - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/vncclient/include/Orbitron700.woff $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/novncjs/Orbitron700.woff - fi - return 0 -} - - -function openqrm_plugin_novnc_uninstall() { - echo "Uninstalling the openQRM novnc-plugin" - openqrm_plugin_novnc_stop - # remove bootservice - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-novnc.tgz - # unlinking the web dir - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/novnc - ##### cloud - if [ -d $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/novncjs ]; then - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/cloud/cloud-portal/web/novncjs - fi -} - - -case "$1" in - start) - openqrm_plugin_novnc_start - ;; - stop) - openqrm_plugin_novnc_stop - ;; - restart) - openqrm_plugin_novnc_stop - sleep 1 - openqrm_plugin_novnc_start - ;; - init) - openqrm_plugin_novnc_init - ;; - uninstall) - openqrm_plugin_novnc_uninstall - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall|createcert}" - exit 1 - -esac -exit $? - - diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/etc/init.d/openqrm-plugin-novnc.postinstall b/openQRM-5.3.50-CE/src/plugins/novnc/etc/init.d/openqrm-plugin-novnc.postinstall deleted file mode 100644 index 6c8d923..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/etc/init.d/openqrm-plugin-novnc.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-novnc postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/etc/init.d/openqrm-plugin-novnc.preremove b/openQRM-5.3.50-CE/src/plugins/novnc/etc/init.d/openqrm-plugin-novnc.preremove deleted file mode 100644 index 60e2100..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/etc/init.d/openqrm-plugin-novnc.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-novnc preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-novnc stop diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/etc/openqrm-plugin-novnc.conf b/openQRM-5.3.50-CE/src/plugins/novnc/etc/openqrm-plugin-novnc.conf deleted file mode 100644 index e2a6a15..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/etc/openqrm-plugin-novnc.conf +++ /dev/null @@ -1,38 +0,0 @@ -# this is the openQRM-plugin-novnc info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openssl, screen, python3-openssl, openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openssl, screen, pyOpenSSL, openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openssl, screen, python-pyOpenSSL, openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Integrates NoVNC providing a remote web-console for Virtual Machines and Physical Systems." -OPENQRM_PLUGIN_TYPE="management" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/etc/openqrm-plugin-novnc.conf" - diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/httpdocs/novncsslcheck.html b/openQRM-5.3.50-CE/src/plugins/novnc/httpdocs/novncsslcheck.html deleted file mode 100644 index 2316b46..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/httpdocs/novncsslcheck.html +++ /dev/null @@ -1,24 +0,0 @@ - - -noVNC SSL check ... - - -SSL certificate check ok - - diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/include/openqrm-plugin-novnc-functions b/openQRM-5.3.50-CE/src/plugins/novnc/include/openqrm-plugin-novnc-functions deleted file mode 100644 index 8825032..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/include/openqrm-plugin-novnc-functions +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# this is the functions file for the novnc-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SERVER_BASE_DIR before sourcing $0" - exit 1 -fi -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/novnc/etc/openqrm-plugin-novnc.conf - - diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc-about.controller.class.php deleted file mode 100644 index 49d5d62..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc-about.controller.class.php +++ /dev/null @@ -1,277 +0,0 @@ - - */ - -class novnc_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'novnc_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'novnc_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'novnc_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'novnc_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About NoVNC', - 'label' => 'About NoVNC', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The NoVNC Plugin integrates NoVNC into openQRM. - It provides a remote console login to the openQRM Server and the managed Systems through the Web Interface. - No manual configuration is needed.', - - 'requirements_title' => 'Requirements', - 'requirements_list' => '
  • none
  • ', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - 'provides_title' => 'Provides', - 'provides_list' => '
  • NoVNC Login through the openQRM Web Interface
  • ', - 'type_title' => 'Plugin Type', - 'type_content' => 'Management', - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - ), - 'usage' => array ( - 'tab' => 'About NoVNC', - 'label' => 'NoVNC Use-Cases', - ), - -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/novnc/lang", 'novnc-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/novnc/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "documentation"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - case 'bootservice': - $content[] = $this->bootservice(true); - break; - case 'vms': - $content[] = $this->vms(true); - break; - case 'usage': - $content[] = $this->usage(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About NoVNC - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/novnc/class/novnc-about.documentation.class.php'); - $controller = new novnc_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Boot-Service - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function bootservice( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/novnc/class/novnc-about.bootservice.class.php'); - $controller = new novnc_about_bootservice($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['bootservice']; - $data = $controller->action(); - } - $content['label'] = $this->lang['bootservice']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'bootservice' ); - $content['onclick'] = false; - if($this->action === 'bootservice'){ - $content['active'] = true; - } - return $content; - } - - - - - //-------------------------------------------- - /** - * About NoVNC VM management - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function vms( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/novnc/class/novnc-about.vms.class.php'); - $controller = new novnc_about_vms($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['vms']; - $data = $controller->action(); - } - $content['label'] = $this->lang['vms']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'vms' ); - $content['onclick'] = false; - if($this->action === 'vms'){ - $content['active'] = true; - } - return $content; - } - - - - //-------------------------------------------- - /** - * About NoVNC Use-Cases - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function usage( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/novnc/class/novnc-about.usage.class.php'); - $controller = new novnc_about_usage($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['usage']; - $data = $controller->action(); - } - $content['label'] = $this->lang['usage']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'usage' ); - $content['onclick'] = false; - if($this->action === 'usage'){ - $content['active'] = true; - } - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc-about.documentation.class.php deleted file mode 100644 index e53d688..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc-about.documentation.class.php +++ /dev/null @@ -1,88 +0,0 @@ - - */ - -class novnc_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'novnc_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "novnc_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/novnc-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc.api.class.php b/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc.api.class.php deleted file mode 100644 index 11a80a4..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc.api.class.php +++ /dev/null @@ -1,92 +0,0 @@ - -*/ - -class novnc_api -{ - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param object $controller - */ - //-------------------------------------------- - function __construct($controller) { - $this->controller = $controller; - $this->user = $this->controller->user; - $this->html = $this->controller->response->html; - $this->response = $this->html->response(); - $this->file = $this->controller->file; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - */ - //-------------------------------------------- - function action() { - $action = $this->response->html->request()->get($this->controller->actions_name); - switch( $action ) { - case 'console': - $this->console(); - break; - } - } - - //-------------------------------------------- - /** - * Console - * - * @access public - */ - //-------------------------------------------- - function console() { - $_REQUEST[$this->controller->actions_name] = 'console'; - $role = $this->controller->openqrm->role($this->response); - $controller = $role->check_permission($this->controller); - - if(is_object($controller)) { - $data = $controller->get_string(); - } else { - $data = $controller; - } - - $css = $this->file->get_contents($this->controller->openqrm->get('basedir').'/plugins/novnc/web/css/novnc.css'); - $css = str_replace('../novncjs/Orbitron700.woff', $this->controller->jsurl.'Orbitron700.woff', $css); - $css = str_replace('../novncjs/Orbitron700.ttf', $this->controller->jsurl.'Orbitron700.ttf', $css); - echo ''; - echo ''; - echo ''; - echo 'openQRM Server'; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo $data; - echo ''; - echo ''; - } -} diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc.console.class.php b/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc.console.class.php deleted file mode 100644 index 0e11f31..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc.console.class.php +++ /dev/null @@ -1,477 +0,0 @@ - - */ - - - -class novnc_console -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'novnc_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'novnc_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'novnc_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'novnc_identifier'; -/** -* openqrm rootdir -* @access public -* @var string -*/ -var $rootdir; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); -/** -* url for images -* @access public -* @var string -*/ -var $imgurl = '/openqrm/base/plugins/novnc/img/'; -/** -* url for js -* @access public -* @var string -*/ -var $jsurl = '/openqrm/base/plugins/novnc/novncjs/'; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - if($this->response->html->request()->get('appliance_id') !== '') { - $this->appliance_id = $this->response->html->request()->get('appliance_id'); - } - else if($this->response->html->request()->get('resource_id') !== '') { - $this->resource_id = $this->response->html->request()->get('resource_id'); - } - if($this->response->html->request()->get('vncport') !== '') { - $this->vncport = $this->response->html->request()->get('vncport'); - } - if($this->response->html->request()->get('vnchost') !== '') { - $this->vnchost = $this->response->html->request()->get('vnchost'); - } - $this->response->add('appliance_id', $this->response->html->request()->get('appliance_id')); - $this->response->add('resource_id', $this->response->html->request()->get('resource_id')); - $this->response->add('vncport', $this->response->html->request()->get('vncport')); - $this->response->add('vnchost', $this->response->html->request()->get('vnchost')); - - $this->event = $this->openqrm->event(); - $this->openqrm_server = $this->openqrm->server(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->console(); - return $response; - } - - //-------------------------------------------- - /** - * Console - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function console() { - $response = ''; - if(isset($this->appliance_id)) { - $appliance = $this->openqrm->appliance(); - $appliance->get_instance_by_id($this->appliance_id); - $resource = $this->openqrm->resource(); - $resource->get_instance_by_id($appliance->resources); - } - else if(isset($this->resource_id)) { - $resource = $this->openqrm->resource(); - $resource->get_instance_by_id($this->resource_id); - } - - // handle missing resource - if($resource->id !== '') { - $virtualization = $this->openqrm->virtualization(); - $virtualization->get_instance_by_id($resource->vtype); - $vtype = $virtualization->get_plugin_name(); - if ($resource->vname == '') { - $vm_name = $resource->hostname; - } else { - $vm_name = $resource->vname; - } - // vnc port set via request? - if(isset($this->vncport)) { - $vncport = $this->vncport; - } else { - $vncport = $this->__vmlist($resource->id, $vm_name, $vtype); - } - // host as parameter ? - if(isset($this->vnchost)) { - $vncserverip = $this->vnchost; - } else { - $vncserver = $this->openqrm->resource(); - $vncserver->get_instance_by_id($resource->vhostid); - $vncserverip = $vncserver->ip; - } - // check if vncport is an array, if yes it contains server:port infos - if (is_array($vncport)) { - $vncserverip = $vncport['vncserverip']; - $vncport = $vncport['vncport']; - } - // check if vncport already contains server:port infos - $colon = strpos($vncport, ':'); - if ($colon !== false) { - $vnc_info_arr = explode(":", $vncport); - $vncserverip = $vnc_info_arr[0]; - $vncport = $vnc_info_arr[1]; - } - if(($vncport !== '') && ($vncserverip != '')) { - // get array position of $resource->id as webproxy port - $list = $resource->get_list(); - $proxyport = ''; - foreach($list as $key => $value) { - if(isset($value['resource_id']) && $value['resource_id'] == $resource->id) { - // set the port, avoid zero - $proxyport = $key+1; - break; - } - } - $vnc = $this->__proxy($vncserverip, $vncport, $proxyport, $resource->mac, $vm_name); - $tpl = $this->openqrm->get('basedir').'/plugins/novnc/web/tpl/novnc-console.tpl.php'; - $t = $this->response->html->template($tpl); - if(isset($this->appliance_id)) { - $t->add('api.php?action=plugin&plugin=novnc&controller=novnc&novnc_action=console&appliance_id='.$this->appliance_id , 'url'); - } - else if(isset($this->resource_id)) { - $t->add('api.php?action=plugin&plugin=novnc&controller=novnc&novnc_action=console&resource_id='.$this->resource_id , 'url'); - } - $t->add($this->imgurl,'imgurl'); - $t->add($this->jsurl,'jsurl'); - $t->add($this->lang['lang_detach'],'lang_detach'); - $t->add($vnc['host'],'host'); - $t->add($vnc['port'],'port'); - $resourceinfo = $resource->hostname.' / '.$resource->ip; - if(isset($this->vncport)) { - $vp = $this->vncport + 5900; - $resourceinfo .= ':'.$vp; - } - $t->add('Resource: '.$resourceinfo,'resource'); - $t->add($this->lang); - } else { - $t = $this->response->html->div(); - $t->style = 'margin: 25px 0 0 15px;'; - $t->add(sprintf($this->lang['error_no_port'], $resource->hostname)); - } - } else { - $t = $this->response->html->box(); - $t->style = 'margin: 25px 0 0 15px;'; - $t->label = sprintf($this->lang['error_no_port'], ''); - $t->add(''); - } - return $t; - } - - //-------------------------------------------- - /** - * Get VM list - * - * @access private - * @param string $id host id - * @param string $vm vm name - * @param string $vtype - * @return string - */ - //-------------------------------------------- - function __vmlist($id, $vm, $vtype) { - $port = ''; - $basedir = $this->openqrm->get('basedir'); - $vm_resource = $this->openqrm->resource(); - $vm_resource->get_instance_by_id($id); - $resource = $this->openqrm->resource(); - $resource->get_instance_by_id($vm_resource->vhostid); - - switch ($vtype) { - - case 'kvm': - if ($vm_resource->vnc != '') { - return $vm_resource->vnc; - } - $file = $basedir.'/plugins/'.$vtype.'/web/'.$vtype.'-stat/'.$resource->id.'.vm_list'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $command = $basedir.'/plugins/'.$vtype.'/bin/openqrm-'.$vtype.'-vm post_vm_list'; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - if($this->file->exists($file)) { - $lines = explode("\n", $this->file->get_contents($file)); - foreach($lines as $line) { - if($line !== '') { - $line = explode('@', $line); - if($line[1] === $vm) { - $tmp = explode(':',$line[5]); - $port = $tmp[1]; - // update vnc in resource - if ($vm_resource->vnc == '') { - $resource_fields["resource_vnc"] = $port; - $resource_fields["resource_vname"] = $vm; - $vm_resource->update_info($id, $resource_fields); - } - break; - } - } - } - } - return $port; - break; - - case 'vmware-esx': - - // make sure vnc is enabled in the Hosts firewall - $command = $this->openqrm->get('basedir')."/plugins/vmware-esx/bin/openqrm-vmware-esx-vm enable_vnc -i ".$resource->ip; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - $this->openqrm_server->send_command($command, NULL, true); - sleep(5); - - if ($vm_resource->vnc != '') { - return $vm_resource->vnc; - } - $file = $basedir.'/plugins/'.$vtype.'/web/'.$vtype.'-stat/'.$resource->ip.'.'.$vm.'.vm_config'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $command = $basedir.'/plugins/'.$vtype.'/bin/openqrm-'.$vtype.'-vm post_vm_config'; - $command .= ' -i '.$resource->ip.' -n '.$vm; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - $this->openqrm_server->send_command($command, NULL, true); - while (!$this->file->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - if($this->file->exists($file)) { - $data = openqrm_parse_conf($file); - if (!isset($data['OPENQRM_VMWARE_ESX_VM_VNC_PORT'])) { - return; - } - $tport = $data['OPENQRM_VMWARE_ESX_VM_VNC_PORT']; - if ($tport > 0) { - $tport = $tport - 5900; - // $this->event->log("console", $_SERVER['REQUEST_TIME'], 2, "novnc.console.class.php", "NoVNC FILE $file EXISTS port $tport !", "", "", 0, 0, 0); - // update vnc in resource - if ($vm_resource->vnc == '') { - $resource_fields["resource_vnc"] = $tport; - $resource_fields["resource_vname"] = $vm; - $vm_resource->update_info($id, $resource_fields); - } - return $tport; - } else { - return; - } - } - return; - break; - - - case 'xen': - if ($vm_resource->vnc != '') { - return $vm_resource->vnc; - } - $file = $basedir.'/plugins/'.$vtype.'/web/'.$vtype.'-stat/'.$resource->id.'.'.$vm.'.vm_config'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - - $command = $basedir.'/plugins/'.$vtype.'/bin/openqrm-'.$vtype.'-vm post_vm_config'; - $command .= ' -n '.$vm; - $command .= ' -u '.$this->openqrm->admin()->name.' -p '.$this->openqrm->admin()->password; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - $resource->send_command($resource->ip, $command); - while (!$this->file->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - if($this->file->exists($file)) { - $data = openqrm_parse_conf($file); - if (!isset($data['OPENQRM_XEN_VM_VNC'])) { - return; - } - $tport = $data['OPENQRM_XEN_VM_VNC']; - if ($tport > 0) { - // $this->event->log("console", $_SERVER['REQUEST_TIME'], 2, "novnc.console.class.php", "NoVNC FILE $file EXISTS port $tport !", "", "", 0, 0, 0); - // update vnc in resource - if ($vm_resource->vnc == '') { - $resource_fields["resource_vnc"] = $tport; - $resource_fields["resource_vname"] = $vm; - $vm_resource->update_info($id, $resource_fields); - } - return $tport; - } else { - return; - } - } - break; - - case 'vmware-vsphere': - if ($vm_resource->vnc != '') { - return $vm_resource->vnc; - } - - $file = $basedir.'/plugins/'.$vtype.'/web/'.$vtype.'-stat/'.$resource->ip.'.'.$vm.'.vm_config'; - if($this->file->exists($file)) { - $this->file->remove($file); - } - $command = $basedir.'/plugins/'.$vtype.'/bin/openqrm-'.$vtype.'-vm post_vm_config'; - $command .= ' -i '.$resource->ip.' -n '.$vm; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - $this->openqrm_server->send_command($command, NULL, true); - while (!$this->file->exists($file)) // check if the data file has been modified - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - $vm_configuration = array(); - if($this->file->exists($file)) { - $lines = explode("\n", file_get_contents($file)); - if(count($lines) >= 1) { - foreach($lines as $line) { - if($line !== '') { - $vm_configuration = $this->openqrm->string_to_array($line, '|', '='); - $vnc_arr = array(); - $vncport = $vm_configuration['vncport'] - 5900; - $vnc_arr['vncport'] = $vncport; - $vnc_arr['vncserverip'] = $vm_configuration['hostip']; - // update vnc in resource - if ($vm_resource->vnc == '') { - $resource_fields["resource_vnc"] = $vm_configuration['hostip'].":".$vncport; - $vm_resource->update_info($id, $resource_fields); - } - return $vnc_arr; - } - } - } - } - return; - break; - - case 'amazon': - if ($vm_resource->vnc != '') { - return $vm_resource->vnc; - } else { - $resource_fields["resource_vnc"] = $vm_resource->ip.":5900"; - $vm_resource->update_info($id, $resource_fields); - return $vm_resource->ip.":5900"; - } - break; - - - default: - $this->event->log("console", $_SERVER['REQUEST_TIME'], 2, "novnc.console.class.php", "NoVNC console for VM type ".$vtype." is not yet supported!", "", "", 0, 0, 0); - break; - - } - - } - - //-------------------------------------------- - /** - * Start the proxy - * - * @access private - * @param string $vnchostip - * @param string $vncport - * @param string $proxy_port - * @param string $vm_mac - * @param string $resource_name - * @return array - */ - //-------------------------------------------- - function __proxy($vnchostip, $vncport, $proxy_port, $vm_mac, $resource_name) { - //$OPENQRM_SERVER_IP_ADDRESS = $this->openqrm_server->get_ip_address(); - $OPENQRM_SERVER_IP_ADDRESS = $_SERVER["SERVER_NAME"]; - $novnc_web_port_range_start = 6000; - $novnc_proxy_port_range_start = 6800; - // start the novnc proxy - $command = $this->openqrm->get('basedir')."/plugins/novnc/bin/openqrm-novnc-manager remoteconsole"; - $command .= " -n ".$resource_name; - $command .= " -d ".$proxy_port; - $command .= " -m ".$vm_mac; - $command .= " -i ".$vnchostip; - $command .= " -v ".$vncport; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode regular'; - - $this->openqrm_server->send_command($command, NULL, true); - // calcualte the web + proxy port - $novnc_web_port = $novnc_web_port_range_start + $proxy_port; - $novnc_proxy_port = $novnc_proxy_port_range_start + $proxy_port; - return array('port' => $novnc_web_port, 'host' => $OPENQRM_SERVER_IP_ADDRESS); - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc.controller.class.php b/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc.controller.class.php deleted file mode 100644 index 41079bb..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc.controller.class.php +++ /dev/null @@ -1,250 +0,0 @@ - - */ - -class novnc_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'novnc_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "novnc_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'novnc_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'novnc_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'login' => array ( - 'tab' => 'NoVNC Login', - 'label' => 'NoVNC Login to %s', - 'login_msg' => 'Login to appliance %s', - 'form_port' => 'VNC Port', - 'info' => 'openQRM could not determine the VNC port to set up the proxy. Please type in the 2 last bits of the port e.g. 01, 10 or 45 and submit the form.', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - 'console' => array ( - 'lang_Ctrl-Alt-Del' => 'Send Ctrl-Alt-Del', - 'lang_clipboard' => 'Clipboard', - 'lang_settings' => 'Settings', - 'lang_connect' => 'Connect', - 'lang_disconnect' => 'Disconnect', - 'lang_host' => 'Host', - 'lang_port' => 'Port', - 'lang_password' => 'Password', - 'lang_encrypt' => 'Encrypt', - 'lang_true_color' => 'True Color', - 'lang_local_cursor' => 'Local Cursor', - 'lang_clip' => 'Clip to Window', - 'lang_shared_mode' => 'Shared Mode', - 'lang_view_only' => 'View Only', - 'lang_timeout' => 'Connect Timeout (s)', - 'lang_apply' => 'Apply', - 'lang_clear' => 'Clear', - 'lang_error_js_disabled' => 'Error: Javascript is disabled', - 'lang_ssl_check' => 'Checking SSL certificate ..', - 'lang_detach' => 'Detach window', - 'error_no_port' => 'Error: Could not determain vnc port for Resource %s', - 'please_wait' => 'Loading' - ), - -); -/** -* url for images -* @access public -* @var string -*/ -var $imgurl = '/openqrm/base/plugins/novnc/img/'; -/** -* url for js -* @access public -* @var string -*/ -var $jsurl = '/openqrm/base/plugins/novnc/novncjs/'; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->basedir = $this->openqrm->get('basedir'); - $this->tpldir = $this->rootdir.'/plugins/novnc/tpl'; - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/novnc/lang", 'novnc.ini'); - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "login"; - } - - $content = array(); - switch( $this->action ) { - case '': - case 'login': - $content[] = $this->login(true); - break; - case 'console': - $content[] = $this->console(true); - break; - } - - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * API - * - * @access public - */ - //-------------------------------------------- - function api() { - require_once($this->basedir.'/plugins/novnc/web/class/novnc.api.class.php'); - $controller = new novnc_api($this); - $controller->action(); - } - - //-------------------------------------------- - /** - * Login appliance (resource) - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function login( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->basedir.'/plugins/novnc/web/class/novnc.login.class.php'); - $controller = new novnc_login($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['login']; - $data = $controller->action(); - } - $content['label'] = $this->lang['login']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'login' ); - $content['onclick'] = false; - if($this->action === 'login'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Open Console - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function console( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->basedir.'/plugins/novnc/web/class/novnc.console.class.php'); - $controller = new novnc_console($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->imgurl = $this->imgurl; - $controller->jsurl = $this->jsurl; - $controller->lang = $this->lang['console']; - $data = $controller->action(); - } - $content['label'] = 'noVNC'; - $content['value'] = $data; - if($data instanceof htmlobject_template || $data instanceof htmlobject_box) { - $content['hidden'] = true; - } - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'console' ); - $content['onclick'] = false; - if($this->action === 'console'){ - $content['active'] = true; - } - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc.login.class.php b/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc.login.class.php deleted file mode 100644 index 87e6af3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/class/novnc.login.class.php +++ /dev/null @@ -1,169 +0,0 @@ - - */ - -class novnc_login -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'novnc_action'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'novnc_identifier'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "novnc_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'novnc_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->basedir = $this->openqrm->get('basedir'); - $this->webdir = $this->openqrm->get('webdir'); - $this->appliance_id = $this->response->html->request()->get('appliance_id'); - $this->response->add('appliance_id', $this->appliance_id); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $response = $this->login(); - if(isset($response->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'console', $this->message_param, $response->msg).$response->parameters - ); - } - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - $t = $this->response->html->template($this->tpldir.'/novnc-login.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['info'], "info"); - $t->add($response->form); - $t->add(sprintf($this->lang['label'], $response->appliance->name), 'label'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return array - */ - //-------------------------------------------- - function login() { - - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $this->response->submit()) { - if(!$form->get_errors()) { - $port = $form->get_request('port'); - $appliance = new appliance(); - $resource = new resource(); - $appliance->get_instance_by_id($this->appliance_id); - $resource->get_instance_by_id($appliance->resources); - $response->msg = sprintf($this->lang['login_msg'], $appliance->name); - $response->parameters = '&resource_id='.$resource->id.'&vncport='.$port; - } - } - return $response; - } - - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'login'); - $appliance = $this->openqrm->appliance(); - $appliance->get_instance_by_id($this->appliance_id); - $response->appliance = $appliance; - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['port']['label'] = $this->lang['form_port']; - $d['port']['required'] = true; - $d['port']['object']['type'] = 'htmlobject_input'; - $d['port']['object']['attrib']['name'] = 'port'; - $d['port']['object']['attrib']['size'] = 5; - $d['port']['object']['attrib']['maxlength'] = 2; - $d['port']['object']['attrib']['minlength'] = 2; - - $form->add($d); - $response->form = $form; - return $response; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/css/novnc.css b/openQRM-5.3.50-CE/src/plugins/novnc/web/css/novnc.css deleted file mode 100644 index f5a5400..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/css/novnc.css +++ /dev/null @@ -1,426 +0,0 @@ -.novncpage { - margin: 0 0 0 -14px; -} -.novncpage .noscript { - width: 250px; - position: absolute; - top: 40px; - left: 0; - background: #FFFFDF; - text-align: center; -} -.novncpage input[type=image] { - width: 16px; - height: 16px; -} - -#noVNC_login .htmlobject_box .left { - width: 80px; -} -#noVNC_login .htmlobject_box .right input { - width: 40px; -} - -#resourceInfo { - position: absolute; - top: 10px; - left: 5px; - background: transparent; -} -#noVNC_controls td { - margin: 0px; - padding: 2px 0px 0px 0px; - vertical-align: top; -} -#noVNC_controls td input { - margin: 0px 0px 0px 15px; - padding: 2px; -} -#noVNC_controls td #noVNC_connect_button { - margin: 15px 2px 0px 0px; -} -#noVNC_controls td #noVNC_password { - vertical-align: middle; - height: auto; -} -#noVNC_settings input { - vertical-align: middle; - margin: 0 5px 0 0; -} -#noVNC_settings label { - margin: 0 0 0 0; -} -#noVNC_settings #noVNC_apply { - margin: 15px 2px 0px 0px; -} - -#noVNC_host { - width:150px; -} -#noVNC_port { - width: 80px; -} -#noVNC_password { - width: 150px; -} -#noVNC_encrypt { -} -#noVNC_connectTimeout { - width: 30px; -} -#noVNC_path { - width: 100px; -} -#noVNC_connect_button { - width: 110px; - float:right; -} -#noVNC_view_drag_button { - display: none; -} -#sendCtrlAltDelButton { - display: none; -} -#noVNC_mobile_buttons { - display: none; -} - -.noVNC-buttons-left { - float: left; - padding-left:10px; - padding-top:4px; -} - -.noVNC-buttons-right { - position: absolute; - top: 0; - right: 10px; - padding-right:10px; - padding-top:4px; -} - -#noVNC_status_bar { - display: block; - margin-top: 0px; - padding: 0px; -} - -#noVNC_status_bar div { - font-size: 12px; - padding-top: 4px; - width:100%; -} - -#noVNC_status { - height:20px; - text-align: center; - margin: 10px 0 0 0; -} -#noVNC_settings_menu { - margin: 3px; - text-align: left; -} -#noVNC_settings_menu ul { - list-style: none; - margin: 0px; - padding: 0px; -} - -#noVNC_apply { - float:right; -} - -.noVNC_status_normal { - background: #eee; -} -.noVNC_status_error { - background: #f44; -} -.noVNC_status_warn { - background: #ff4; -} - -/* Do not set width/height for VNC_screen or VNC_canvas or incorrect - * scaling will occur. Canvas resizes to remote VNC settings */ -#noVNC_screen_pad { - margin: 0px; - padding: 0px; - height: 33px; -} -#noVNC_screen { - text-align: center; - display: table; - width:100%; - height:100%; - background-color:#313131; - border-bottom-right-radius: 800px 600px; - /*border-top-left-radius: 800px 600px;*/ -} -#noVNC_container { - margin: 0px; - padding: 0px; -} -#noVNC_canvas { - margin: 0px; - padding: 10px; - left: 0px; - background: black; -} - -#VNC_clipboard_clear_button { - float:right; -} -#VNC_clipboard_text { - font-size: 11px; -} - -#noVNC_clipboard_clear_button { - float:right; -} - -/*Bubble contents divs*/ -#noVNC_settings { - display:none; - margin-top:42px; - right:10px; - position:absolute; -} - -#noVNC_controls { - display:none; - margin-top:42px; - right:12px; - position:absolute; -} -#noVNC_controls.top:after { - right:15px; -} - -#noVNC_description { - display:none; - position:absolute; - - margin-top:42px; - right:20px; - left:20px; - padding:15px; - color:#000; - background:#eee; /* default background for browsers without gradient support */ - - border:2px solid #E0E0E0; - -webkit-border-radius:10px; - -moz-border-radius:10px; - border-radius:10px; -} - -#noVNC_clipboard { - display:none; - margin-top:42px; - right:30px; - position:absolute; -} -#noVNC_clipboard.top:after { - right:55px; -} - -#keyboardinput { - width:1px; - height:1px; - background-color:#fff; - color:#fff; - border:0; - position: relative; - left: -40px; - z-index: -1; -} - -.noVNC_status_warn { - background-color:yellow; -} - -/* - * Advanced Styling - */ - -/* Control bar */ -#noVNC-control-bar { - position:absolute; - background: #ddd; /* Old browsers */ - display:block; - height:33px; - left:0 !important; - top:0 !important; - width:100%; - z-index:200; -} - -.noVNC_status_button { - padding: 4px 4px; - vertical-align: middle; - border:1px solid #869dbc; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - border-radius: 6px; - background: #b2bdcd; /* Old browsers */ - background: -moz-linear-gradient(top, #b2bdcd 0%, #899cb3 49%, #7e93af 51%, #6e84a3 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b2bdcd), color-stop(49%,#899cb3), color-stop(51%,#7e93af), color-stop(100%,#6e84a3)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Opera11.10+ */ - background: -ms-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* IE10+ */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b2bdcd', endColorstr='#6e84a3',GradientType=0 ); /* IE6-9 */ - background: linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* W3C */ - /*box-shadow:inset 0.4px 0.4px 0.4px #000000;*/ -} - -.noVNC_status_button_selected { - padding: 4px 4px; - vertical-align: middle; - border:1px solid #4366a9; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - background: #779ced; /* Old browsers */ - background: -moz-linear-gradient(top, #779ced 0%, #3970e0 49%, #2160dd 51%, #2463df 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#779ced), color-stop(49%,#3970e0), color-stop(51%,#2160dd), color-stop(100%,#2463df)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #779ced 0%,#3970e0 49%,#2160dd 51%,#2463df 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #779ced 0%,#3970e0 49%,#2160dd 51%,#2463df 100%); /* Opera11.10+ */ - background: -ms-linear-gradient(top, #779ced 0%,#3970e0 49%,#2160dd 51%,#2463df 100%); /* IE10+ */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#779ced', endColorstr='#2463df',GradientType=0 ); /* IE6-9 */ - background: linear-gradient(top, #779ced 0%,#3970e0 49%,#2160dd 51%,#2463df 100%); /* W3C */ - /*box-shadow:inset 0.4px 0.4px 0.4px #000000;*/ -} - - -/*Settings Bubble*/ -.triangle-right { - position:relative; - padding:15px; - margin:1em 0 3em; - color:#fff; - background:#fff; /* default background for browsers without gradient support */ - /* css3 */ - /*background:-webkit-gradient(linear, 0 0, 0 100%, from(#2e88c4), to(#075698)); - background:-moz-linear-gradient(#2e88c4, #075698); - background:-o-linear-gradient(#2e88c4, #075698); - background:linear-gradient(#2e88c4, #075698);*/ - -webkit-border-radius:10px; - -moz-border-radius:10px; - border-radius:10px; - color:#000; - border:2px solid #E0E0E0; -} - -.triangle-right.top:after { - border-color: transparent #E0E0E0; - border-width: 20px 20px 0 0; - bottom: auto; - left: auto; - right: 50px; - top: -20px; -} - -.triangle-right:after { - content:""; - position:absolute; - bottom:-20px; /* value = - border-top-width - border-bottom-width */ - left:50px; /* controls horizontal position */ - border-width:20px 0 0 20px; /* vary these values to change the angle of the vertex */ - border-style:solid; - border-color:#E0E0E0 transparent; - /* reduce the damage in FF3.0 */ - display:block; - width:0; -} - -.triangle-right.top:after { - top:-42px; /* value = - border-top-width - border-bottom-width */ - right:50px; /* controls horizontal position */ - bottom:auto; - left:auto; - border-width:40px 40px 0 0; /* vary these values to change the angle of the vertex */ - border-color:transparent #E0E0E0; -} - -/*Default noVNC logo.*/ -/* From: http://fonts.googleapis.com/css?family=Orbitron:700 */ -@font-face { - font-family: 'Orbitron'; - font-style: normal; - font-weight: 700; - src: local('?'), url('../novncjs/Orbitron700.woff') format('woff'), - url('../novncjs/Orbitron700.ttf') format('truetype'); -} - -#noVNC_logo { - margin-top: 80px; - margin-bottom: 90px; - margin-left: 20px; - color:yellow; - text-align:left; - font-family: 'Orbitron', 'OrbitronTTF', sans-serif; - line-height:90%; - text-shadow: - 5px 5px 0 #000, - -1px -1px 0 #000, - 1px -1px 0 #000, - -1px 1px 0 #000, - 1px 1px 0 #000; -} - - -#noVNC_logo span{ - color:green; -} - -/* ---------------------------------------- - * Media sizing - * ---------------------------------------- - */ - - -.noVNC_status_button { - font-size: 12px; -} - -#noVNC_clipboard_text { - width: 500px; -} - -#noVNC_logo { - font-size: 180px; -} - -@media screen and (min-width: 481px) and (max-width: 640px) { - .noVNC_status_button { - font-size: 10px; - } - #noVNC_clipboard_text { - width: 410px; - } - #noVNC_logo { - font-size: 150px; - } -} - -@media screen and (min-width: 321px) and (max-width: 480px) { - .noVNC_status_button { - font-size: 10px; - } - #noVNC_clipboard_text { - width: 250px; - } - #noVNC_logo { - font-size: 110px; - } -} - -@media screen and (max-width: 320px) { - .noVNC_status_button { - font-size: 9px; - } - #noVNC_clipboard_text { - width: 220px; - } - #noVNC_logo { - font-size: 90px; - } -} diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/img/glyphicons_349_fullscreen.png b/openQRM-5.3.50-CE/src/plugins/novnc/web/img/glyphicons_349_fullscreen.png deleted file mode 100644 index 4cedb02..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/novnc/web/img/glyphicons_349_fullscreen.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/novnc/web/img/plugin.png deleted file mode 100644 index 40f8920..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/novnc/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/lang/de.novnc-about.ini b/openQRM-5.3.50-CE/src/plugins/novnc/web/lang/de.novnc-about.ini deleted file mode 100644 index 969492f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/lang/de.novnc-about.ini +++ /dev/null @@ -1,24 +0,0 @@ -[documentation] -tab = "Über NoVNC" -label = "Über NoVNC" -introduction_title = "Einleitung" -introduction_content = "Das NoVNC-Plugin integriert NoVNC und bietet einen 'remote Console' VNC-Zugang zu den von openQRM verwalteten Systemen über die Benutzeroberfläche. Manuelle Konfiguration ist nicht nötig." - -requirements_title = "Anforderungen" -requirements_list = "keine" -tested_title = "Getestet" -tested_content = "Dieses Plugin ist getestet mit Debian, Ubuntu und CentOS." - -provides_title = "Bietet" -provides_list = "VNC-Zugang eingebettet in die openQRM Web Benutzeroberfläche" - -type_title = "Plugin Typ" -type_content = "Management" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" - - -[usage] -tab = "About NoVNC" -label = "NoVNC-Anwendungsfälle" diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/lang/de.novnc.ini b/openQRM-5.3.50-CE/src/plugins/novnc/web/lang/de.novnc.ini deleted file mode 100644 index 7a8867d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/lang/de.novnc.ini +++ /dev/null @@ -1,31 +0,0 @@ -[login] -tab = "NoVNC Login" -label = "NoVNC Login auf %s" -form_port = "Port" -info = "openQRM konnte den VNV Port zur Einstellung des Proxies nicht ermitteln. Bitte geben Sie die letzten 2 bit des Ports z.B. 01, 10 oder 45 ein, und senden Sie das Formular ab." -login_msg = "Einloggen auf den Server %s" -please_wait = "Lade. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[console] -lang_Ctrl-Alt-Del = "Sende Strg-Alt-Entf" -lang_clipboard = "Zwischenablage" -lang_settings = "Einstellungen" -lang_connect = "Verbinden" -lang_disconnect = "Trennen" -lang_host = "Host" -lang_port = "Port" -lang_password = "Passwort" -lang_encrypt = "Verschlüsseln" -lang_true_color = "True Color" -lang_local_cursor = "Lokaler Cursor" -lang_clip = "An Fenster anpassen" -lang_shared_mode = "Geteilte Verbindung" -lang_view_only = "Nur Anzeigen" -lang_timeout = "Verbindungs Timeout (s)" -lang_apply = "Anwenden" -lang_clear = "Clear" -lang_error_js_disabled = "Fehler: Javascript ist abgestellt" -lang_ssl_check = "Prüfe SSL Zertifikat .." -lang_detach = "Neues Fenster" -error_no_port = "Fehler: Vnc Port für Ressource %s konnte nicht ermittelt werden." -please_wait = "Lade" diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/lang/en.novnc-about.ini b/openQRM-5.3.50-CE/src/plugins/novnc/web/lang/en.novnc-about.ini deleted file mode 100644 index 4c706d3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/lang/en.novnc-about.ini +++ /dev/null @@ -1,25 +0,0 @@ -[documentation] -tab = "About NoVNC" -label = "About NoVNC" -introduction_title = "Introduction" -introduction_content = "The NoVNC plugin integrates NoVNC into openQRM. It provides a remote console login to the openQRM Server and the managed Systems through the Web Interface. No manual configuration is needed." - -requirements_title = "Requirements" -requirements_list = "none" - -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS distribution." - -provides_title = "Provides" -provides_list = "NoVNC login through the openQRM web interface" - -type_title = "Plugin Type" -type_content = "Management" - -documentation_title = "Documentation" - -use_case_title = "Use case" - -[usage] -tab = "About NoVNC" -label = "NoVNC use cases" diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/lang/en.novnc.ini b/openQRM-5.3.50-CE/src/plugins/novnc/web/lang/en.novnc.ini deleted file mode 100644 index 20ebbbf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/lang/en.novnc.ini +++ /dev/null @@ -1,31 +0,0 @@ -[login] -tab = "NoVNC Login" -label = "NoVNC Login to %s" -login_msg = "Login to Server %s" -form_port = "VNC Port" -info = "openQRM could not determine the VNC port to set up the proxy. Please type in the 2 last bits of the port e.g. 01, 10 or 45 and submit the form." -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." -[console] -lang_Ctrl-Alt-Del = "Send Ctrl-Alt-Del" -lang_clipboard = "Clipboard" -lang_settings = "Settings" -lang_connect = "Connect" -lang_disconnect = "Disconnect" -lang_host = "Host" -lang_port = "Port" -lang_password = "Password" -lang_encrypt = "Encrypt" -lang_true_color = "True Color" -lang_local_cursor = "Local Cursor" -lang_clip = "Clip to Window" -lang_shared_mode = "Shared Mode" -lang_view_only = "View Only" -lang_timeout = "Connect Timeout (s)" -lang_apply = "Apply" -lang_clear = "Clear" -lang_error_js_disabled = "Error: Javascript is disabled" -lang_ssl_check = "Checking SSL certificate .." -lang_detach = "Detach window" -error_no_port = "Error: Could not determain vnc port for Resource %s" -please_wait = "Loading" diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/novnc/web/menu.txt deleted file mode 100644 index 09361e8..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/menu.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|NoVNC|index.php?plugin=novnc&controller=novnc-about|How to use diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/openqrm-novnc-appliance-link-hook.php b/openQRM-5.3.50-CE/src/plugins/novnc/web/openqrm-novnc-appliance-link-hook.php deleted file mode 100644 index 995b04e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/openqrm-novnc-appliance-link-hook.php +++ /dev/null @@ -1,63 +0,0 @@ - -*/ -// error_reporting(E_ALL); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/htmlobjects/htmlobject.class.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $OPENQRM_SERVER_IP_ADDRESS; -$event = new event(); -global $event; - -function get_novnc_appliance_link($appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $p_appliance = new appliance(); - $p_appliance->get_instance_by_id($appliance_id); - $p_resource = new resource(); - $p_resource->get_instance_by_id($p_appliance->resources); - $virtualization = new virtualization(); - $virtualization->get_instance_by_id($p_appliance->virtualization); - - $html = new htmlobject($OPENQRM_SERVER_BASE_DIR.'/openqrm/web/base/class/htmlobjects'); - $a = $html->a(); - $a->label = 'noVNC'; - $a->css = 'badge'; - $a->handler = 'onclick="wait();"'; - - $plugin_link = ''; - if (strstr($p_appliance->state, "active")) { - if(strstr($virtualization->type, '-vm-')) { - $a->href = '/openqrm/base/index.php?plugin=novnc&controller=novnc&novnc_action=console&appliance_id='.$p_appliance->id; - } else { - $a->href = '/openqrm/base/index.php?plugin=novnc&controller=novnc&novnc_action=login&appliance_id='.$p_appliance->id; - } - $plugin_link = $a; - } - else if ($p_resource->id === '0') { - $a->href = '/openqrm/base/index.php?plugin=novnc&controller=novnc&novnc_action=login&appliance_id='.$p_appliance->id; - $plugin_link = $a; - } - return $plugin_link; -} diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/openqrm-novnc-remote-console-hook.php b/openQRM-5.3.50-CE/src/plugins/novnc/web/openqrm-novnc-remote-console-hook.php deleted file mode 100644 index 77b4ecf..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/openqrm-novnc-remote-console-hook.php +++ /dev/null @@ -1,67 +0,0 @@ - -*/ - -// error_reporting(E_ALL); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/htmlobjects/htmlobject.class.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -$event = new event(); -global $event; - -function openqrm_novnc_remote_console($resource_id, $vncport = NULL, $vnchost = NULL) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $add_param = ''; - if (isset($vncport)) { - $add_param .= "&vncport=$vncport"; - - } - if (isset($vnchost)) { - $add_param .= "&vnchost=$vnchost"; - } - - $html = new htmlobject($OPENQRM_SERVER_BASE_DIR.'/openqrm/web/base/class/htmlobjects'); - $a = $html->a(); - $a->label = 'noVNC'; - $a->css = 'badge'; - $a->href = '/openqrm/base/index.php?plugin=novnc&controller=novnc&novnc_action=console&resource_id='.$resource_id.$add_param; - $a->handler = 'onclick="wait();"'; - - return $a; -} - - - -// this functions implements the stop action for the vnc remote console -// deprecated - stop implemented via timeout -function openqrm_novnc_disable_remote_console($vncserver, $vncport, $vm_res_id, $vm_mac, $resource_name) { - #global $event; - #global $OPENQRM_SERVER_BASE_DIR; - #// stop the novnc proxy - #$novnc_stop_command = $OPENQRM_SERVER_BASE_DIR."/openqrm/plugins/novnc/bin/openqrm-novnc-manager disable-remoteconsole -n ".$resource_name." -d ".$vm_res_id." -m ".$vm_mac." -i ".$vncserver." -v ".$vncport; - #$output = shell_exec($novnc_stop_command); -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/tpl/novnc-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/novnc/web/tpl/novnc-about-documentation.tpl.php deleted file mode 100644 index 9179dd7..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/tpl/novnc-about-documentation.tpl.php +++ /dev/null @@ -1,45 +0,0 @@ - -

    {label}

    - -
    - -
    - -

    {introduction_title}

    - {introduction_content} - -

    {provides_title}

    - {provides_list} - -

    {requirements_title}

    - {requirements_list} -
    - - -
    -

    {type_title}

    - {type_content} - -

    {tested_title}

    - {tested_content} -
    -
    - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/tpl/novnc-console.tpl.php b/openQRM-5.3.50-CE/src/plugins/novnc/web/tpl/novnc-console.tpl.php deleted file mode 100644 index 58fc170..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/tpl/novnc-console.tpl.php +++ /dev/null @@ -1,211 +0,0 @@ - - -
    - - -
    - - -
    - -
    - - - - - - -
    - - - - - -
    -
    -
    - -
    {resource}
    -
    {please_wait}
    - - -
    - - - - - - -
    - - - - - - -
    - -
    - -
    - - -
    -
    - - - - - - - - - - - - - - -
    -
    - - -
    - - - - - -
     
    -
    - -
    - - - - - - -
    -
    -

    no
    VNC

    - -
    - - Canvas not supported. - -
    -
    - -
    - - - - - - - - -
    diff --git a/openQRM-5.3.50-CE/src/plugins/novnc/web/tpl/novnc-login.tpl.php b/openQRM-5.3.50-CE/src/plugins/novnc/web/tpl/novnc-login.tpl.php deleted file mode 100644 index d8668ef..0000000 --- a/openQRM-5.3.50-CE/src/plugins/novnc/web/tpl/novnc-login.tpl.php +++ /dev/null @@ -1,28 +0,0 @@ - - -

    {label}

    -
    -
    - {form} -
    {info}
    -
     
    -
    {port}
    -
     
    -
    {submit}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/openstack/Makefile b/openQRM-5.3.50-CE/src/plugins/openstack/Makefile deleted file mode 100644 index 50d2d97..0000000 --- a/openQRM-5.3.50-CE/src/plugins/openstack/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/openstack/etc - cp etc/openqrm-plugin-openstack.conf /usr/share/openqrm/plugins/openstack/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/openstack/etc/openqrm-plugin-openstack.conf b/openQRM-5.3.50-CE/src/plugins/openstack/etc/openqrm-plugin-openstack.conf deleted file mode 100644 index ab4b5e1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/openstack/etc/openqrm-plugin-openstack.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="OpenStack Cloud Integratiom - OpenStack Private Cloud.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="cloud" diff --git a/openQRM-5.3.50-CE/src/plugins/openvswitch-manager/Makefile b/openQRM-5.3.50-CE/src/plugins/openvswitch-manager/Makefile deleted file mode 100644 index 657a56d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/openvswitch-manager/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/openvswitch-manager/etc - cp etc/openqrm-plugin-openvswitch-manager.conf /usr/share/openqrm/plugins/openvswitch-manager/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/openvswitch-manager/etc/openqrm-plugin-openvswitch-manager.conf b/openQRM-5.3.50-CE/src/plugins/openvswitch-manager/etc/openqrm-plugin-openvswitch-manager.conf deleted file mode 100644 index 6b8291d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/openvswitch-manager/etc/openqrm-plugin-openvswitch-manager.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="An Openvswitch-manager to create and configure virtual network switches.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="network" diff --git a/openQRM-5.3.50-CE/src/plugins/opsi/Makefile b/openQRM-5.3.50-CE/src/plugins/opsi/Makefile deleted file mode 100644 index fce972b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/opsi/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/opsi/etc - cp etc/openqrm-plugin-opsi.conf /usr/share/openqrm/plugins/opsi/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/opsi/etc/openqrm-plugin-opsi.conf b/openQRM-5.3.50-CE/src/plugins/opsi/etc/openqrm-plugin-opsi.conf deleted file mode 100644 index 5f3e6c7..0000000 --- a/openQRM-5.3.50-CE/src/plugins/opsi/etc/openqrm-plugin-opsi.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Integrates Opsi Install Server for automatic Windows deployments (local-deployment).
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="deployment" diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/Makefile b/openQRM-5.3.50-CE/src/plugins/puppet/Makefile deleted file mode 100644 index 9b6eac2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# this is the openQRM puppet-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/puppet* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/default - . $(OPENQRM_SERVER_CONF) && cp -aR etc/default/* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/default/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/svn-hook - . $(OPENQRM_SERVER_CONF) && cp -aR etc/svn-hook/*.tmpl $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/svn-hook/ - . $(OPENQRM_SERVER_CONF) && rm -rf `find $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/default/ -name .svn` - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/cron.d - . $(OPENQRM_SERVER_CONF) && cp -aR etc/cron.d/*.cron $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/cron.d/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/install/openstack - . $(OPENQRM_SERVER_CONF) && cp -aR etc/install/openstack/openstack* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/install/openstack/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/tpl/ - . $(OPENQRM_SERVER_CONF) && chmod 777 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/lang/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/css/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/bin - . $(OPENQRM_SERVER_CONF) && cp bin/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/bin/ - . $(OPENQRM_SERVER_CONF) && chmod +x $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/bin/openqrm* - . $(OPENQRM_SERVER_CONF) && tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet -czvf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/boot-service-puppet.tgz include/ bin/ etc/init.d/puppet - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/puppet - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/puppet/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/bin/openqrm-puppet-manager b/openQRM-5.3.50-CE/src/plugins/puppet/bin/openqrm-puppet-manager deleted file mode 100644 index db54bb3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/bin/openqrm-puppet-manager +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# this script automatically manages puppet -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/include/openqrm-plugin-puppet-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/openqrm-plugin-puppet.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -openqrm_server_get_config -export resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -export LANG=C - -# let only root run this script -WHOAMI=`whoami` -if [ "$WHOAMI" != "root" ]; then - echo "ERROR: Please run this script as root!" - exit 6 -fi - -# the puppet plugin depends on dns working so it needs the dns plugin available+enabled -# puppet autosigning needs a domain name. This we get from the dns-plugin config -if [ ! -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf ]; then - openqrm_unblock_starting_queue $@ - echo "ERROR: The openQRM puppet-plugin depends on the dns-plugin. Please enable the dns-plugin first!" - openqrm_post_event 0 "puppet-plugin" 3 "puppet-plugin" "The openQRM puppet-plugin depends on the dns-plugin. Please enable the dns-plugin first!" - exit 1 -fi -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf - -function puppet_manager_usage() { - echo "Usage : $0" - exit 1 -} - -PUPPETCA=`which puppetca` -if [ "$PUPPETCA" == "" ]; then - PUPPETCA_CLEAN_CMD="puppet cert clean" -else - PUPPETCA_CLEAN_CMD="$PUPPETCA --clean" -fi - - -FULL_COMMANDLINE="$0 $@" -PUPPET_MANAGER_COMMAND=$1 -# main -case "$PUPPET_MANAGER_COMMAND" in - start) - APPLIANCE_ID=$2 - APPLIANCE_NAME=$3 - APPLIANCE_IP=$4 - openqrm_post_event 0 "start" 5 "openqrm-puppet-manager" "Appliance $APPLIANCE_NAME id $APPLIANCE_ID starting with ip-address $APPLIANCE_IP." - - LOCK_TIME=`openqrm_lock_queue aquire puppet` - trap "openqrm_lock_queue release puppet $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - $PUPPETCA_CLEAN_CMD $APPLIANCE_NAME.$OPENQRM_SERVER_DOMAIN 2>&1 | logger - - openqrm_lock_queue release puppet $LOCK_TIME - trap '' EXIT - ;; - stop) - APPLIANCE_ID=$2 - APPLIANCE_NAME=$3 - APPLIANCE_IP=$4 - openqrm_post_event 0 "stop" 5 "openqrm-puppet-manager" "Appliance $APPLIANCE_NAME id $APPLIANCE_ID stopping with ip-address $APPLIANCE_IP." - - LOCK_TIME=`openqrm_lock_queue aquire puppet` - trap "openqrm_lock_queue release puppet $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - $PUPPETCA_CLEAN_CMD $APPLIANCE_NAME.$OPENQRM_SERVER_DOMAIN 2>&1 | logger - - openqrm_lock_queue release puppet $LOCK_TIME - trap '' EXIT - ;; - auto_sign_false) - openqrm_post_event 0 "auto_sign_false" 5 "openqrm-puppet-manager" "Stopping automatic signing of puppet-ca's." - - LOCK_TIME=`openqrm_lock_queue aquire puppet` - trap "openqrm_lock_queue release puppet $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - rm -f /etc/puppet/autosign.conf - - openqrm_lock_queue release puppet $LOCK_TIME - trap '' EXIT - ;; - auto_sign_true) - openqrm_post_event 0 "auto_sign_false" 5 "openqrm-puppet-manager" "Started automatic signing of puppet-ca's." - - LOCK_TIME=`openqrm_lock_queue aquire puppet` - trap "openqrm_lock_queue release puppet $LOCK_TIME" EXIT - openqrm_unblock_starting_queue $FULL_COMMANDLINE - - echo "*.$OPENQRM_SERVER_DOMAIN" > /etc/puppet/autosign.conf - - openqrm_lock_queue release puppet $LOCK_TIME - trap '' EXIT - ;; - *) - openqrm_unblock_starting_queue $FULL_COMMANDLINE - echo "ERROR: Free commandline arguments are not allowed!" - puppet_manager_usage - exit 6 - ;; -esac - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/bin/openqrm-puppetm-config b/openQRM-5.3.50-CE/src/plugins/puppet/bin/openqrm-puppetm-config deleted file mode 100644 index a5e2a0f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/bin/openqrm-puppetm-config +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# this script gets activated via cron to sequentially check -# if there are new config updates in the svn repo -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(dirname $0)/../../../.. -OPENQRM_SERVER_BASE_DIR=$(pushd $OPENQRM_SERVER_BASE_DIR > /dev/null && echo $PWD && popd > /dev/null) -SVN_COMMIT_MESSAGE="Automatically updated through openQRM puppet plugin" -CUR=`pwd` -export LANGUAGE=C -export LANG=C -export LC_ALL=C - -PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -export PATH - -# here it commits any changes made through the web-interface -cd $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/puppet/ -# remove deleted files -for pfile in `find /etc/puppet/ | grep -v svn | grep -v autosign.conf | sed -e "s#/etc/puppet/##g"`; do - if [ ! -f $pfile ] && [ ! -d $pfile ]; then - svn del $pfile | logger - fi - -done -# add new files -svn add `find | grep -v svn` | logger -# commit -svn commit -m "$SVN_COMMIT_MESSAGE" . | logger -# update eventual changes from external -svn update . | logger - -# here it updates the puppet configuration from the svn repo -cd /etc/puppet -CURRENT_REVISION=`svn up . | grep revision | awk {' print $3 '}` -cd $CUR - -# check if we need to reload the puppetmaster -if [ ! -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet-svn-version ]; then - LAST_REVISION=0 -else - LAST_REVISION=`cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet-svn-version` -fi - -if [ "$CURRENT_REVISION" == "$LAST_REVISION" ]; then - echo "No changes in puppet-config repo" | logger -else - # restart the puppetmasterd, we experienced that it is not robust refreshing its config - if [ -x "/etc/init.d/puppetmaster" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d puppetmaster stop 1>/dev/null 2>&1 - else - /etc/init.d/puppetmaster stop 1>/dev/null 2>&1 - fi - sleep 2 - fi - kill `ps ax | grep puppetmaster | grep -v grep | awk {' print $1 '}` 2>/dev/null - kill `ps ax | grep "puppet master" | grep -v grep | awk {' print $1 '}` 2>/dev/null - sleep 2 - kill -9 `ps ax | grep puppetmaster | grep -v grep | awk {' print $1 '}` 2>/dev/null - kill -9 `ps ax | grep "puppet master" | grep -v grep | awk {' print $1 '}` 2>/dev/null - if which puppetmasterd 1>/dev/null 2>&1; then - rm -f /var/run/puppet/puppetmasterd.pid - screen -dmS puppetmasterd puppetmasterd -v -d -l syslog - elif puppet help | grep master 1>/dev/null 2>&1; then - puppet master - else - echo "ERROR: Could not start Puppet master" | logger - fi - # update the revision file - echo "$CURRENT_REVISION" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet-svn-version -fi diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/cron.d/openqrm-puppetm-config.cron b/openQRM-5.3.50-CE/src/plugins/puppet/etc/cron.d/openqrm-puppetm-config.cron deleted file mode 100644 index acb4a20..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/cron.d/openqrm-puppetm-config.cron +++ /dev/null @@ -1,16 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -MAILTO="" -* * * * * root @@OPENQRM_SERVER_BASE_DIR@@/openqrm/plugins/puppet/bin/openqrm-puppetm-config diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/fileserver.conf b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/fileserver.conf deleted file mode 100644 index 19cccda..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/fileserver.conf +++ /dev/null @@ -1,17 +0,0 @@ -# This file consists of arbitrarily named sections/modules -# defining where files are served from and to whom - -# Define a section 'files' -# Adapt the allow/deny settings to your needs. Order -# for allow/deny does not matter, allow always takes precedence -# over deny -[files] - path /etc/puppet/files -# allow *.example.com -# deny *.evil.example.com -# allow 192.168.0.0/24 - -[plugins] -# allow *.example.com -# deny *.evil.example.com -# allow 192.168.0.0/24 diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/appliances/default.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/appliances/default.pp deleted file mode 100644 index 261a92b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/appliances/default.pp +++ /dev/null @@ -1,7 +0,0 @@ -# to make puppetmaster happy to include the appliance dir - -class appliance-default { - exec { "echo": - refreshonly => true, - } -} \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/apache-server.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/apache-server.pp deleted file mode 100644 index 74ba66f..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/apache-server.pp +++ /dev/null @@ -1,85 +0,0 @@ - -class apache-server { - - case "$lsbdistid" { - Debian: { - package { "apache2": ensure => installed } - exec { "reload-apache2": - command => "/etc/init.d/apache2 reload", - refreshonly => true, - } - exec { "force-reload-apache2": - command => "/etc/init.d/apache2 force-reload", - refreshonly => true, - } - # We want to make sure that Apache2 is running. - service { "apache2": - ensure => running, - hasstatus => true, - hasrestart => true, - require => Package["apache2"], - } - } - Ubuntu: { - package { "apache2": ensure => installed } - exec { "reload-apache2": - command => "/etc/init.d/apache2 reload", - refreshonly => true, - } - exec { "force-reload-apache2": - command => "/etc/init.d/apache2 force-reload", - refreshonly => true, - } - # We want to make sure that Apache2 is running. - service { "apache2": - ensure => running, - hasstatus => true, - hasrestart => true, - require => Package["apache2"], - } - } - CentOS: { - package { "httpd": ensure => installed } - exec { "reload-httpd": - command => "/etc/init.d/httpd reload", - refreshonly => true, - } - exec { "force-reload-httpd": - command => "/etc/init.d/httpd force-reload", - refreshonly => true, - } - # We want to make sure that httpd is running. - service { "httpd": - ensure => running, - hasstatus => true, - hasrestart => true, - require => Package["httpd"], - } - } - - Fedora: { - package { "httpd": ensure => installed } - exec { "reload-httpd": - command => "/etc/init.d/httpd reload", - refreshonly => true, - } - exec { "force-reload-httpd": - command => "/etc/init.d/httpd force-reload", - refreshonly => true, - } - # We want to make sure that httpd is running. - service { "httpd": - ensure => running, - hasstatus => true, - hasrestart => true, - require => Package["httpd"], - } - } - - - - - - } -} - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/docker-container.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/docker-container.pp deleted file mode 100644 index b60c6fe..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/docker-container.pp +++ /dev/null @@ -1,66 +0,0 @@ - -class docker-container { - - case "$lsbdistid" { - Debian: { - package { "docker.io": ensure => installed } - service { "docker.io": - ensure => running, - hasstatus => true, - hasrestart => true, - require => Package["docker.io"], - } - exec { "reload-dockerui": - command => "/usr/share/openqrm/plugins/docker/etc/init.d/docker restart", - refreshonly => true, - } - - } - Ubuntu: { - package { "docker.io": ensure => installed } - service { "docker.io": - ensure => running, - hasstatus => true, - hasrestart => true, - require => Package["docker.io"], - } - exec { "reload-dockerui": - command => "/usr/share/openqrm/plugins/docker/etc/init.d/docker restart", - refreshonly => true, - } - } - CentOS: { - package { "docker": ensure => installed } - service { "docker": - ensure => running, - hasstatus => true, - hasrestart => true, - require => Package["docker"], - } - exec { "reload-dockerui": - command => "/usr/share/openqrm/plugins/docker/etc/init.d/docker restart", - refreshonly => true, - } - } - - Fedora: { - package { "docker": ensure => installed } - service { "docker": - ensure => running, - hasstatus => true, - hasrestart => true, - require => Package["docker"], - } - exec { "reload-dockerui": - command => "/usr/share/openqrm/plugins/docker/etc/init.d/docker restart", - refreshonly => true, - } - } - - - - - - } -} - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/mysql-client.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/mysql-client.pp deleted file mode 100644 index 9fa3717..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/mysql-client.pp +++ /dev/null @@ -1,17 +0,0 @@ - -class mysql-client { - case "$lsbdistid" { - Debian: { - package { "mysql-client": ensure => installed } - } - Ubuntu: { - package { "mysql-client": ensure => installed } - } - CentOS: { - package { "mysql": ensure => installed } - } - Fedora: { - package { "mysql": ensure => installed } - } - } -} diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/mysql-server.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/mysql-server.pp deleted file mode 100644 index 57132dc..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/mysql-server.pp +++ /dev/null @@ -1,41 +0,0 @@ - -class mysql-server { - - case "$lsbdistid" { - Debian: { - package { "mysql-server": ensure => installed } - package { "mysql-common": ensure => installed } - package { "mysql-client": ensure => installed } - service { mysql: - ensure => running, - subscribe => [Package[mysql-server]], - } - } - Ubuntu: { - package { "mysql-server": ensure => installed } - package { "mysql-common": ensure => installed } - package { "mysql-client": ensure => installed } - service { mysql: - ensure => running, - subscribe => [Package[mysql-server]], - } - } - CentOS: { - package { "mysql-server": ensure => installed } - package { "mysql": ensure => installed } - service { mysqld: - ensure => running, - subscribe => [Package[mysql-server]], - } - } - Fedora: { - package { "mysql-server": ensure => installed } - package { "mysql": ensure => installed } - service { mysqld: - ensure => running, - subscribe => [Package[mysql-server]], - } - } - - } -} \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/openstack-all-in-one.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/openstack-all-in-one.pp deleted file mode 100644 index 45eb831..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/openstack-all-in-one.pp +++ /dev/null @@ -1,24 +0,0 @@ -# This is the OpenStack all-in-one recipe -# It installs all OpenStack compontents on a single system -# The following install configuration can be set through the -# server capabilities field as space separated key=value pairs -# HOST_IP -# FLOATING_RANGE -# FIXED_RANGE -# FIXED_NETWORK_SIZE -# FLAT_INTERFACE -# ADMIN_PASSWORD -# MYSQL_PASSWORD -# RABBIT_PASSWORD -# SERVICE_PASSWORD -# SERVICE_TOKEN -# e.g. -# HOST_IP=192.168.88.135 FLOATING_RANGE=192.168.88.0/27 FIXED_RANGE=10.20.10.0/24 FLAT_INTERFACE=eth0 ADMIN_PASSWORD=openqrm MYSQL_PASSWORD=openqrm RABBIT_PASSWORD=openqrm SERVICE_PASSWORD=openqrm SERVICE_TOKEN=openqrm - -class openstack-all-in-one { - exec { "/usr/bin/wget -O /tmp/openstack-install http://openqrm/openqrm/boot-service/puppet/openstack-all-in-one && chmod +x /tmp/openstack-install && /tmp/openstack-install": - creates => "/opt/stack", - } -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/osupdate.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/osupdate.pp deleted file mode 100644 index 00d5a45..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/osupdate.pp +++ /dev/null @@ -1,31 +0,0 @@ - -class osupdate { - case "$lsbdistid" { - Debian: { - exec { "/usr/bin/apt-get -y update": - refreshonly => true, - } - } - Ubuntu: { - exec { "/usr/bin/apt-get -y update": - refreshonly => true, - } - } - CentOS: { - exec { "/usr/bin/yum -y update": - refreshonly => true, - } - } - Fedora: { - exec { "/usr/bin/yum -y update": - refreshonly => true, - } - } - - - - - } -} - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/php.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/php.pp deleted file mode 100644 index 903a1d1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/php.pp +++ /dev/null @@ -1,21 +0,0 @@ - -class php { - case "$lsbdistid" { - Debian: { - package { [ "php5", "php5-cli", "libapache2-mod-php5", "php5-mysql" ]: ensure => installed } - } - Ubuntu: { - package { [ "php5", "php5-cli", "libapache2-mod-php5", "php5-mysql" ]: ensure => installed } - } - CentOS: { - package { [ "php", "php-common", "mod_php", "php-cli", "php-mysql" ]: ensure => installed } - } - Fedora: { - package { [ "php", "php-common", "php-cli", "php-mysql" ]: ensure => installed } - } - - - - } -} - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/server.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/server.pp deleted file mode 100644 index f05854b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/server.pp +++ /dev/null @@ -1,5 +0,0 @@ - -class server { - include ssh-server - include osupdate -} diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/ssh-server.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/ssh-server.pp deleted file mode 100644 index ef128a4..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/ssh-server.pp +++ /dev/null @@ -1,38 +0,0 @@ - -class ssh-server { - case "$lsbdistid" { - Debian: { - package { ssh: ensure => installed } - service { ssh: - ensure => running, - subscribe => [Package[ssh]], - } - } - Ubuntu: { - package { ssh: ensure => installed } - service { ssh: - ensure => running, - subscribe => [Package[ssh]], - } - } - CentOS: { - package { openssh-server: ensure => installed } - service { sshd: - ensure => running, - subscribe => [Package[openssh-server]], - } - } - Fedora: { - package { openssh-server: ensure => installed } - service { sshd: - ensure => running, - subscribe => [Package[openssh-server]], - } - } - - - - - } -} - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/webmin-server.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/webmin-server.pp deleted file mode 100644 index 9a6d674..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/classes/webmin-server.pp +++ /dev/null @@ -1,43 +0,0 @@ - -class webmin-server { - - case "$lsbdistid" { - Debian: { - package { "webmin": ensure => installed } - # We want to make sure that webmin is running. - service { "webmin": - ensure => running, - hasstatus => true, - hasrestart => true, - require => Package["webmin"], - } - } - Ubuntu: { - package { "webmin": ensure => installed } - # We want to make sure that webmin is running. - service { "webmin": - ensure => running, - hasstatus => true, - hasrestart => true, - require => Package["webmin"], - } - } - CentOS: { - exec { "/usr/bin/wget -O /tmp/webmin.rpm http://downloads.sourceforge.net/webadmin/webmin-1.450-1.noarch.rpm && /bin/rpm --import http://www.webmin.com/jcameron-key.asc && /usr/bin/yum -y localinstall /tmp/webmin.rpm && /bin/rm -f /tmp/webmin.rpm": - unless => "/bin/touch /etc/init.d/webmin && /etc/init.d/webmin status", - } - } - - Fedora: { - exec { "/usr/bin/wget -O /tmp/webmin.rpm http://downloads.sourceforge.net/webadmin/webmin-1.450-1.noarch.rpm && /bin/rpm --import http://www.webmin.com/jcameron-key.asc && /usr/bin/yum -y localinstall /tmp/webmin.rpm && /bin/rm -f /tmp/webmin.rpm": - unless => "/bin/touch /etc/init.d/webmin && /etc/init.d/webmin status", - } - } - - - - - - } -} - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/basic-server.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/basic-server.pp deleted file mode 100644 index abfd361..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/basic-server.pp +++ /dev/null @@ -1,6 +0,0 @@ -# A basic server profile - -class basic-server { - include server -} - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/database-server.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/database-server.pp deleted file mode 100644 index d131fbb..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/database-server.pp +++ /dev/null @@ -1,14 +0,0 @@ -# A data-base server configuration (Mysql) - -class database-server { - include server - include mysql-server -} - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/docker.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/docker.pp deleted file mode 100644 index 164c638..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/docker.pp +++ /dev/null @@ -1,6 +0,0 @@ -# Docker Container - -class docker { - include docker-container -} - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/lamp.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/lamp.pp deleted file mode 100644 index 7b99368..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/lamp.pp +++ /dev/null @@ -1,13 +0,0 @@ -# A LAMP setup (Linux/Apache/Mysql/Php) - -class lamp { - include server - include apache-server - include php - include mysql-server -} - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/openstack.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/openstack.pp deleted file mode 100644 index c01b92c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/openstack.pp +++ /dev/null @@ -1,10 +0,0 @@ -# OpenStack private Cloud - -class openstack { - include openstack-all-in-one -} - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/webmin.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/webmin.pp deleted file mode 100644 index 33b6c00..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/webmin.pp +++ /dev/null @@ -1,6 +0,0 @@ -# has webmin installed and running - -class webmin { - include server - include webmin-server -} diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/webserver.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/webserver.pp deleted file mode 100644 index e282d66..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/groups/webserver.pp +++ /dev/null @@ -1,6 +0,0 @@ -# A basic webserver profile (Apache) - -class webserver { - include server - include apache-server -} diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/site.pp b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/site.pp deleted file mode 100644 index dd28cb6..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/manifests/site.pp +++ /dev/null @@ -1,6 +0,0 @@ -# /etc/puppet/manifests/site.pp - -import "classes/*.pp" -import "groups/*.pp" -import "appliances/*.pp" - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/puppet.conf b/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/puppet.conf deleted file mode 100644 index 01e92a1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/default/puppet.conf +++ /dev/null @@ -1,10 +0,0 @@ -[main] -logdir=/var/log/puppet -vardir=/var/lib/puppet -ssldir=/var/lib/puppet/ssl -rundir=/var/run/puppet -factpath=$vardir/lib/facter -pluginsync=true - -[puppetmasterd] -templatedir=/var/lib/puppet/templates diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/init.d/openqrm-plugin-puppet b/openQRM-5.3.50-CE/src/plugins/puppet/etc/init.d/openqrm-plugin-puppet deleted file mode 100644 index 8711c04..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/init.d/openqrm-plugin-puppet +++ /dev/null @@ -1,240 +0,0 @@ -#!/bin/bash -# init script for the openQRM puppet-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/include/openqrm-plugin-puppet-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/openqrm-plugin-puppet.conf -openqrm_server_get_config -export resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -export LANG=C -# define wget to use with https -if [ "$OPENQRM_WEB_PROTOCOL" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - - -function openqrm_plugin_puppet_start() { - echo "Starting the openQRM puppet-plugin" - stop_puppet - stop_puppet_master - openqrm_chkconfig del puppet - openqrm_chkconfig del puppetmaster - start_puppet_master - start_puppet - # linking further install scripts - mkdir -p $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/puppet/ - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/install/openstack/openstack-all-in-one $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/puppet/openstack-all-in-one - - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/puppet/.running -} - - -function openqrm_plugin_puppet_stop() { - echo "Stopping the openQRM puppet-plugin" - stop_puppet - stop_puppet_master - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/puppet/.running -} - -function openqrm_plugin_puppet_uninstall() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "puppet: Please give a username to uninstall the plugin : " - read USERNAME - echo - echo -n "puppet: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - echo "Uninstalling the openQRM puppet-plugin" - openqrm_plugin_puppet_stop - - # remove from cron - rm -f /etc/cron.d/openqrm-puppetm-config - if [ -x "/etc/init.d/cron" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d cron reload - else - /etc/init.d/cron reload - fi - elif [ -x /etc/init.d/crond ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d crond reload - else - /etc/init.d/crond reload - fi - else - echo "Could not find cron init script in /etc/init.d/. Please reload cron manually!" - fi - - # removing the puppet tables - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$USERNAME --http-password=$PASSWORD "$OPENQRM_WEB_PROTOCOL://$resource_openqrmserver/openqrm/base/plugins/puppet/puppet-action.php?puppet_command=uninstall"; then - puppet_manager_log uninstall "ERROR: Could not drop the puppet-plugin tables in the database!" - return 1 - fi - # restore orgigin puppet dir - if [ -d /etc/puppet.openqrm-puppet-plugin.bak ]; then - rm -rf /etc/puppet - cp -aR /etc/puppet.openqrm-puppet-plugin.bak /etc/puppet - fi - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/puppet - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-puppet.tgz - rm -rf $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/puppet - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet -} - -function openqrm_plugin_puppet_init() { - local USERNAME=$1 - local PASSWORD=$2 - if [ "$USERNAME" == "" ] && [ "$PASSWORD" == "" ]; then - echo -n "puppet: Please give a username to init the plugin : " - read USERNAME - echo - echo -n "puppet: Please give the password for user $USERNAME : " - read PASSWORD - echo - fi - - # the puppet plugin depends on dns working so it needs the dns plugin available+enabled - # puppet autosigning needs a domain name. This we get from the dns-plugin config - if [ ! -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf ]; then - echo "ERROR: The openQRM puppet-plugin depends on the dns-plugin. Please enable the dns-plugin first!" - openqrm_post_event 0 "puppet-plugin" 3 "puppet-plugin" "The openQRM puppet-plugin depends on the dns-plugin. Please enable the dns-plugin first!" - return 1 - fi - . $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/dns/etc/openqrm-plugin-dns.conf - - CURRENTD=`pwd` - echo "Initializing the openQRM puppet-plugin" - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/puppet - # link the boot-service - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/boot-service-puppet.tgz $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-puppet.tgz - # linking further install scripts - mkdir -p $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/puppet/ - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/install/openstack/openstack-all-in-one $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/puppet/openstack-all-in-one - - # creating the tables - if ! wget -q $WGET_NO_CERT_CHECK -O /dev/null --http-user=$USERNAME --http-password=$PASSWORD "$OPENQRM_WEB_PROTOCOL://$resource_openqrmserver/openqrm/base/plugins/puppet/puppet-action.php?puppet_command=init&puppet_domain=$OPENQRM_SERVER_DOMAIN"; then - puppet_manager_log init "ERROR: Could not create the puppet-plugin tables in the database!" - return 1 - fi - - # creating the svn dir at /etc/puppet to store the puppet configuration - # backup orgigin puppet dir first - if [ ! -d /etc/puppet.openqrm-puppet-plugin.bak ]; then - mv /etc/puppet /etc/puppet.openqrm-puppet-plugin.bak - fi - # create the svn dir - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/default/files - svnadmin create $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet - svn import -q $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/default/ file://$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet/ -m "initial import" - # and import to /etc/puppet - rm -rf /etc/puppet/* - rm -rf /etc/puppet/.svn - mkdir -p /etc/puppet - cd /etc/puppet - svn co -q file://$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet/ . - # also co the files for the web-dir - rm -rf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/puppet/ - mkdir -p $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/puppet/ - cd $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/puppet/ - svn co -q file://$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet/ . - chmod -R 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/web/puppet/ - # setup access through ssh+svn - rm -f $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet/conf/svnserve.conf - echo "[general]" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet/conf/svnserve.conf - echo "anon-access = read" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet/conf/svnserve.conf - echo "auth-access = write" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet/conf/svnserve.conf - echo "realm = openQRM Puppet configuration" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet/conf/svnserve.conf - echo "password-db = passwd" >> $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet/conf/svnserve.conf - chmod -R 777 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet/db - cd $CURRENTD - # configure autosigning - echo "*.$OPENQRM_SERVER_DOMAIN" > /etc/puppet/autosign.conf - # create cron job which will update the svn repo with files which were added by the web gui - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/cron.d/openqrm-puppetm-config.cron | \ - sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" > /etc/cron.d/openqrm-puppetm-config - if [ -x "/etc/init.d/cron" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d cron reload - else - /etc/init.d/cron reload - fi - elif [ -x /etc/init.d/crond ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d crond reload - else - /etc/init.d/crond reload - fi - else - echo "Could not find cron init script in /etc/init.d/. Please reload cron manually!" - fi - # create svn post-commit hook to immediately update the puppet configuration - cat $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/svn-hook/post-commit.tmpl | \ - sed -e "s#@@OPENQRM_SERVER_BASE_DIR@@#$OPENQRM_SERVER_BASE_DIR#g" > $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet/hooks/post-commit - chmod 755 $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/etc/puppet/hooks/post-commit - - # eventually clean up old ssl dir before starting - rm -rf /var/lib/puppet/ssl/* - rm -rf /var/lib/puppet/yaml/node/* - rm -rf /var/lib/puppet/yaml/facts/* - -} - - - - - - - -USER=$2 -PASS=$3 - -case "$1" in - start) - openqrm_plugin_puppet_start - ;; - stop) - openqrm_plugin_puppet_stop - ;; - restart) - openqrm_plugin_puppet_stop - sleep 1 - openqrm_plugin_puppet_start - ;; - init) - openqrm_plugin_puppet_init $USER $PASS - ;; - uninstall) - openqrm_plugin_puppet_uninstall $USER $PASS - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/init.d/openqrm-plugin-puppet.postinstall b/openQRM-5.3.50-CE/src/plugins/puppet/etc/init.d/openqrm-plugin-puppet.postinstall deleted file mode 100644 index b9714a5..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/init.d/openqrm-plugin-puppet.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-puppet postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/init.d/openqrm-plugin-puppet.preremove b/openQRM-5.3.50-CE/src/plugins/puppet/etc/init.d/openqrm-plugin-puppet.preremove deleted file mode 100644 index 982e587..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/init.d/openqrm-plugin-puppet.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-puppet preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-puppet stop diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/init.d/puppet b/openQRM-5.3.50-CE/src/plugins/puppet/etc/init.d/puppet deleted file mode 100644 index 26c5382..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/init.d/puppet +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the puppet resources -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -# for including the package functions -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/include/openqrm-plugin-puppet-functions -. $OPENQRM_RESOURCE_PARAMETER_FILE -OPENQRM_SERVER_IP=$resource_openqrmserver -LOCKFILE=/var/lock/openqrm-puppet - -# do not run on idle resources -if [ "$resource_image" == "idle" ]; then - exit 0 -fi - -# set the hostname early -hostname $appliance_name - -# also do not run before the real init of the rootfs -# if we have this file /etc/initrd-devices.conf we are still in the initrd -if [ -f /etc/initrd-devices.conf ]; then - exit 0 -fi -if [ -f /etc/debian_version ]; then - echo "$appliance_name" > /etc/hostname -elif [ -f /etc/redhat-release ]; then - sed -i -e "s#HOSTNAME=.*#HOSTNAME=$appliance_name#g" /etc/sysconfig/network -elif [ -f /etc/SuSE-release ]; then - echo "$appliance_name" > /etc/HOSTNAME -fi - - -function puppet_start() { - if [ -e "$LOCKFILE" ]; then - echo "puppet already started for the first time" - else - touch $LOCKFILE - # clean up eventual left-overs, be sure we get signed - rm -rf /etc/puppet/ssl/* /var/lib/puppet/ssl/* /var/lib/puppet/state/* - openqrm_chkconfig del puppet - fi - - echo "Starting the openQRM puppet-plugin" - if ! which puppet 1>/dev/null 2>&1; then - export FORCE_INSTALL=true - openqrm_install_os_dependency puppet - fi - puppet_stop 1>/dev/null 2>&1 - start_puppet -} - - -function puppet_stop() { - echo "Stopping the openQRM puppet-plugin" - stop_puppet -} - - - - - -case "$1" in - start) - puppet_start - ;; - stop) - puppet_stop - ;; - restart) - puppet_stop - sleep 1 - puppet_start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 - -esac -exit $? - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/install/openstack/openstack-all-in-one b/openQRM-5.3.50-CE/src/plugins/puppet/etc/install/openstack/openstack-all-in-one deleted file mode 100644 index a536d88..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/install/openstack/openstack-all-in-one +++ /dev/null @@ -1,155 +0,0 @@ -#!/bin/bash -# this script automatically installs openstack all-in-one -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -echo "puppet: starting openstack all-in-one installation" | logger - -# static defines + defaults -DEFAULT_NIC="eth0" -DEFAULT_FLOAT_SUBNET=27 -DEFAULT_EXTERNAL_SUBNET="24" -DEFAULT_EXTERNAL_NETWORK="10.11.12.0" -DEFAULT_FIXED_EXTERNAL_NETWORK_SIZE="256" -LOCALRC=/home/stack/devstack/localrc -RELEASE="icehouse" -DEFAULT_ADMIN_PASSWORD="openqrm" -DEFAULT_MYSQL_PASSWORD="openqrm" -DEFAULT_RABBIT_PASSWORD="openqrm" -DEFAULT_SERVICE_PASSWORD="openqrm" -DEFAULT_SERVICE_TOKEN="openqrm" - -OPENQRM_RESOURCE_PARAMETER_FILE="/var/openqrm/openqrm-resource.conf" -if [ ! -f "$OPENQRM_RESOURCE_PARAMETER_FILE" ]; then - echo "WARNING: Could not find $OPENQRM_RESOURCE_PARAMETER_FILE configuration. Installing openstack with defaults!" | logger - FLAT_INTERFACE=$DEFAULT_NIC - HOST_IP=`ip a s $FLAT_INTERFACE | grep -w $FLAT_INTERFACE$ | grep -w inet | awk '{ print $2 }' | cut -d'/' -f1` - if [ "$HOST_IP" == "" ]; then - HOST_IP=`ip a s | grep "$FLAT_INTERFACE:oq" | awk '{ print $2 }' | cut -d'/' -f1` - if [ "$HOST_IP" == "" ]; then - echo "ERROR: Could not find out ip address of nic $FLAT_INTERFACE" | logger - exit 1 - fi - fi - FLOAT_NET=`echo $HOST_IP | cut -d'.' -f1-3` - FLOAT_NET=$FLOAT_NET".0" - FLOATING_RANGE=$FLOAT_NET/$DEFAULT_FLOAT_SUBNET - FIXED_RANGE="$DEFAULT_EXTERNAL_NETWORK/$DEFAULT_EXTERNAL_SUBNET" - FIXED_NETWORK_SIZE=$DEFAULT_FIXED_EXTERNAL_NETWORK_SIZE - # openstack credentials - ADMIN_PASSWORD=$DEFAULT_ADMIN_PASSWORD - MYSQL_PASSWORD=$DEFAULT_MYSQL_PASSWORD - RABBIT_PASSWORD=$DEFAULT_RABBIT_PASSWORD - SERVICE_PASSWORD=$DEFAULT_SERVICE_PASSWORD - SERVICE_TOKEN=$DEFAULT_SERVICE_TOKEN -else - echo "puppet: Found $OPENQRM_RESOURCE_PARAMETER_FILE" | logger - . $OPENQRM_RESOURCE_PARAMETER_FILE - eval $appliance_capabilities -fi - -# check parameters - - -if [ "$HOST_IP" == "" ]; then - HOST_IP=$resource_ip -fi -if [ "$FLOATING_RANGE" == "" ]; then - FLOAT_NET=`echo $HOST_IP | cut -d'.' -f1-3` - FLOAT_NET=$FLOAT_NET".0" - FLOATING_RANGE=$FLOAT_NET/$DEFAULT_FLOAT_SUBNET -fi - -if [ "$FIXED_RANGE" == "" ]; then - FIXED_RANGE="$DEFAULT_EXTERNAL_NETWORK/$DEFAULT_EXTERNAL_SUBNET" -fi -if [ "$FIXED_NETWORK_SIZE" == "" ]; then - FIXED_NETWORK_SIZE=$DEFAULT_FIXED_EXTERNAL_NETWORK_SIZE -fi -if [ "$FLAT_INTERFACE" == "" ]; then - FLAT_INTERFACE=`ip a s | grep -B2 -w $HOST_IP | grep ^[0-9] | awk '{ print $2 }' | cut -d':' -f1` - if [ "$FLAT_INTERFACE" == "" ]; then - echo "ERROR: Could not find out interface for ip address $HOST_IP" | logger - exit 1 - fi -fi -if [ "$ADMIN_PASSWORD" == "" ]; then - ADMIN_PASSWORD=$DEFAULT_ADMIN_PASSWORD -fi -if [ "$MYSQL_PASSWORD" == "" ]; then - MYSQL_PASSWORD=$DEFAULT_MYSQL_PASSWORD -fi -if [ "$RABBIT_PASSWORD" == "" ]; then - RABBIT_PASSWORD=$DEFAULT_RABBIT_PASSWORD -fi -if [ "$SERVICE_PASSWORD" == "" ]; then - SERVICE_PASSWORD=$DEFAULT_SERVICE_PASSWORD -fi -if [ "$SERVICE_TOKEN" == "" ]; then - SERVICE_TOKEN=$DEFAULT_SERVICE_TOKEN -fi - - -echo "puppet: Preparing environment for openstack installation" | logger - -# main -if ! grep ^stack /etc/passwd 1>/dev/null; then - echo "adding user stack" - adduser --disabled-password --gecos "" stack -fi -if ! which sudo 1>/dev/null; then - apt-get install sudo -y -fi -if ! which git 1>/dev/null; then - apt-get install git -y -fi -if ! grep ^stack /etc/sudoers 1>/dev/null; then - echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers -fi - -echo "puppet: checking out openstack from git" | logger - -# checkout openstack -echo "checking out devstack" -su - stack -c "git clone https://github.com/openstack-dev/devstack.git" -echo "switching to $RELEASE release" -su - stack -c "cd devstack; git checkout stable/$RELEASE" -# create localrc config -echo "puppet: creating localrc for custom openstack installation" | logger -> $LOCALRC -echo "HOST_IP=$HOST_IP" >> $LOCALRC -echo "FLOATING_RANGE=$FLOATING_RANGE" >> $LOCALRC -echo "FIXED_RANGE=$FIXED_RANGE" >> $LOCALRC -echo "FIXED_NETWORK_SIZE=$FIXED_NETWORK_SIZE" >> $LOCALRC -echo "FLAT_INTERFACE=$FLAT_INTERFACE" >> $LOCALRC -echo "ADMIN_PASSWORD=$ADMIN_PASSWORD" >> $LOCALRC -echo "MYSQL_PASSWORD=$MYSQL_PASSWORD" >> $LOCALRC -echo "RABBIT_PASSWORD=$RABBIT_PASSWORD" >> $LOCALRC -echo "SERVICE_PASSWORD=$SERVICE_PASSWORD" >> $LOCALRC -echo "SERVICE_TOKEN=$SERVICE_TOKEN" >> $LOCALRC -echo "LOGFILE=/home/stack/stack.sh.log" >> $LOCALRC -chown stack:stack $LOCALRC -# ran stack.sh -echo "puppet: running openstack installation now" | logger -su - stack -c "cd devstack; ./stack.sh" -echo "puppet: finished setting up openstack" | logger - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/openqrm-plugin-puppet.conf b/openQRM-5.3.50-CE/src/plugins/puppet/etc/openqrm-plugin-puppet.conf deleted file mode 100644 index 98b6797..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/openqrm-plugin-puppet.conf +++ /dev/null @@ -1,40 +0,0 @@ -# this is the openQRM-plugin-puppet info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen, puppet, puppet-master, subversion" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen, puppet-server, subversion" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openqrm-server, screen, subversion" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Integrates Puppet for fully automated Configuration Management and Application deployment." -OPENQRM_PLUGIN_TYPE="deployment" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="dns" - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="" -# dirs which should be taken to the state backup -OPENQRM_PLUGIN_STATE_DIRS="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/web/puppet/ $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/etc/" - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/etc/svn-hook/post-commit.tmpl b/openQRM-5.3.50-CE/src/plugins/puppet/etc/svn-hook/post-commit.tmpl deleted file mode 100644 index a5010ce..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/etc/svn-hook/post-commit.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the openQRM Enterprise Server and Client License, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: http://openqrm-enterprise.com/license -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -cd @@OPENQRM_SERVER_BASE_DIR@@/openqrm/plugins/puppet/web/puppet; svn up 1> /var/log/puppet-commit.log 2>&1 -cd /etc/puppet; svn up 1> /var/log/puppet-commit.log 2>&1 - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/include/openqrm-plugin-puppet-functions b/openQRM-5.3.50-CE/src/plugins/puppet/include/openqrm-plugin-puppet-functions deleted file mode 100644 index 1f6287e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/include/openqrm-plugin-puppet-functions +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash -# this is the functions file for the puppet-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -################ common puppet functions - -# logs for puppet -function puppet_manager_log() { - local COMPONENT=$1 - shift - local MESSAGE=$@ - logger -i -t "puppet plug-in" "$COMPONENT : $MESSAGE" -} - - -################ puppet functions - -function stop_puppet() { - if [ -x "/etc/init.d/puppet" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d puppet stop 1>/dev/null 2>&1 - else - /etc/init.d/puppet stop 1>/dev/null 2>&1 - fi - sleep 2 - fi - if [ -x "/etc/init.d/puppetqd" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d puppetqd stop 1>/dev/null 2>&1 - else - /etc/init.d/puppetqd stop 1>/dev/null 2>&1 - fi - sleep 2 - fi - - kill `ps ax | grep puppetd | grep -v grep | awk {' print $1 '}` 2>/dev/null - kill `ps ax | grep "puppet agent" | grep -v grep | awk {' print $1 '}` 2>/dev/null - sleep 2 - kill -9 `ps ax | grep puppetd | grep -v grep | awk {' print $1 '}` 2>/dev/null - kill -9 `ps ax | grep "puppet agent" | grep -v grep | awk {' print $1 '}` 2>/dev/null -} - -function stop_puppet_master() { - if [ -x "/etc/init.d/puppetmaster" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d puppetmaster stop 1>/dev/null 2>&1 - else - /etc/init.d/puppetmaster stop 1>/dev/null 2>&1 - fi - sleep 2 - fi - kill `ps ax | grep puppetmaster | grep -v grep | awk {' print $1 '}` 2>/dev/null - kill `ps ax | grep "puppet master" | grep -v grep | awk {' print $1 '}` 2>/dev/null - sleep 2 - kill -9 `ps ax | grep puppetmaster | grep -v grep | awk {' print $1 '}` 2>/dev/null - kill -9 `ps ax | grep "puppet master" | grep -v grep | awk {' print $1 '}` 2>/dev/null -} - -function start_puppet() { - if which puppetd 1>/dev/null 2>&1; then - puppetd -v -d -D -l syslog - elif puppet help | grep agent 1>/dev/null 2>&1; then - puppet agent - else - echo "ERROR: Could not start Puppet agent" - fi -} - -function start_puppet_master() { - if which puppetmasterd 1>/dev/null 2>&1; then - puppetmasterd -v -d -l syslog - elif puppet help | grep master 1>/dev/null 2>&1; then - puppet master - else - echo "ERROR: Could not start Puppet master" - fi -} - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet-about.controller.class.php deleted file mode 100644 index c3cd49a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet-about.controller.class.php +++ /dev/null @@ -1,174 +0,0 @@ - - */ - - -class puppet_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'puppet_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'puppet_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'puppet_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'puppet_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About Puppet', - 'label' => 'About Puppet', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The Puppet plugin provides automated configuration-management for Appliances in openQRM. - It seamlessly integrates Puppet within the openQRM GUI and assists to put specific Appliances into pre-made or custom Puppet-classes. - By enabling the plugin the puppet-environment (server and client) is pre-configured and initialyzed automatically according to best-practice experiences e.g. by keeping the puppet-configuration within a svn-repsitory. - The puppet-configuration is organized in "classes", "goups" and "appliances". - Custom custom classes can be added to the class-directory. - Classes should be combined to "groups" these will be automatically displayed in the puppet-plugin. - The puppet-configuration repository is also available for external svn clients. - To check out the puppet-repo please run

    :', - 'introduction_title1' => 'Assigning Applications to Appliances', - 'introduction_content1' => '
    1. Go to the "Appliances" in the puppet-plugin menu
    2. -
    3. Select an Appliance to be configured via puppet
    4. -
    5. Select the puppet-groups the appliance should belong to
    - Within short time the puppet-server will distribute the new configuration to the Appliance automatically.', - 'requirements_title' => 'Requirements', - 'requirements_list' => '
  • The Puppet Plugin depends on the DNS Plugin! Please make sure to have the DNS Plugin enabled and started before.
  • ', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - 'provides_title' => 'Provides', - 'provides_list' => '
  • Automated configuration-management for Appliances in openQRM
  • ', - 'type_title' => 'Plugin Type', - 'type_content' => 'Deployment', - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - ), -); - - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/puppet/lang", 'puppet-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/puppet/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About Puppet - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/puppet/class/puppet-about.documentation.class.php'); - $controller = new puppet_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet-about.documentation.class.php deleted file mode 100644 index 7112f9b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet-about.documentation.class.php +++ /dev/null @@ -1,92 +0,0 @@ - - */ - -class puppet_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'puppet_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "puppet_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $svn_co_command = "svn co svn+ssh://[user]@[openqrm-server-ip]".$this->basedir."/openqrm/plugins/puppet/etc/puppet/"; - $t = $this->response->html->template($this->tpldir.'/puppet-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($svn_co_command, 'introduction_command'); - $t->add($this->lang['introduction_title1'], 'introduction_title1'); - $t->add($this->lang['introduction_content1'], 'introduction_content1'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.class.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.class.php deleted file mode 100644 index 5c79a20..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.class.php +++ /dev/null @@ -1,172 +0,0 @@ - -*/ - - -// This class represents a puppet user in openQRM - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/folder.class.php"; -require_once "$RootDir/class/file.class.php"; -require_once "$RootDir/plugins/puppet/class/puppetconfig.class.php"; - -$event = new event(); -global $event; - -$puppet_group_dir = "$RootDir/plugins/puppet/puppet/manifests/groups"; -global $puppet_group_dir; -$puppet_appliance_dir = "$RootDir/plugins/puppet/puppet/manifests/appliances"; -global $puppet_appliance_dir; -$PUPPET_CONFIG_TABLE="puppet_config"; -global $PUPPET_CONFIG_TABLE; - -class puppet { - - function __construct() { - $RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; - $this->group_dir = $RootDir.'/plugins/puppet/puppet/manifests/groups'; - $this->appliance_dir = $RootDir.'/plugins/puppet/puppet/manifests/appliances'; - $this->event = new event(); - } - -// --------------------------------------------------------------------------------- -// general puppetconfig methods -// --------------------------------------------------------------------------------- - - -function get_available_groups() { - $app_dir = new folder(); - $app_dir->getFolderContent($this->group_dir); - $puppet_groups = array(); - $puppet_groups = $app_dir->files; - $puppet_group_array = array(); - foreach($puppet_groups as $puppet) { - $puppet_group = str_replace(".pp", "", $puppet->name); - $puppet_group_array[] .= $puppet_group; - } - sort($puppet_group_array); - return $puppet_group_array; -} - - - -function get_group_info($group_name) { - - $filename = $this->group_dir."/$group_name.pp"; - if (file_exists($filename)) { - if (!$handle = fopen($filename, 'r')) { - $this->event->log("get_group_info", $_SERVER['REQUEST_TIME'], 2, "puppet.class.php", "Cannot open file ($filename)", "", "", 0, 0, 0); - exit; - } - while (!feof($handle)) { - $info = fgets($handle, 4096); - if (strstr($info, "#")) { - $info = str_replace("#", "", $info); - fclose($handle); - return $info; - } - } - } -} - - - -function get_supported_os($group_name) { - $filename = $this->group_dir."/$group_name.pp"; - if (file_exists($filename)) { - if (!$handle = fopen($filename, 'r')) { - $this->event->log("get_supported_os", $_SERVER['REQUEST_TIME'], 2, "puppet.class.php", "Cannot open file ($filename)", "", "", 0, 0, 0); - exit; - } - while (!feof($handle)) { - $os_version = fgets($handle, 4096); - if (strstr($os_version, "# os:")) { - $os_version = str_replace("# os:", "", $os_version); - fclose($handle); - $os_version_arr = explode(",", $os_version); - return $os_version_arr; - } - } - } -} - - -function get_domain() { - $puppetconfig = new puppetconfig(); - $puppet_domain = $puppetconfig->get_value(2); // 2 is the domain-name - return $puppet_domain; -} - - - -function set_groups($appliance_name, $puppet_group_array) { - $puppet_domain = $this->get_domain(); - $filename = $this->appliance_dir."/$appliance_name.$puppet_domain.pp"; - if (!$handle = fopen($filename, 'w+')) { - $this->event->log("set_groups", $_SERVER['REQUEST_TIME'], 2, "puppet.class.php", "Cannot open file ($filename)", "", "", 0, 0, 0); - exit; - } - // header - fwrite($handle, "\nnode '$appliance_name.$puppet_domain' {\n"); - // body with groups - foreach($puppet_group_array as $puppet_group) { - $puppet_include = " include $puppet_group\n"; - fwrite($handle, $puppet_include); - } - // base - fwrite($handle, "}\n\n"); - fclose($handle); -} - - -function get_groups($appliance_name) { - $puppet_group_array = array(); - $puppet_domain = $this->get_domain(); - $filename = $this->appliance_dir."/$appliance_name.$puppet_domain.pp"; - - if (file_exists($filename)) { - if (!$handle = fopen($filename, 'r')) { - $this->event->log("get_groups", $_SERVER['REQUEST_TIME'], 2, "puppet.class.php", "Cannot open file ($filename)", "", "", 0, 0, 0); - exit; - } - while (!feof($handle)) { - $buffer = fgets($handle, 4096); - if (strstr($buffer, "include")) { - $buffer = str_replace("include", "", $buffer); - $buffer = trim($buffer); - $puppet_group_array[] .= $buffer; - } - } - fclose($handle); - } - - - return $puppet_group_array; -} - -function remove_appliance($appliance_name) { - $puppet_domain = $this->get_domain(); - $filename = $this->appliance_dir."/$appliance_name.$puppet_domain.pp"; - if (file_exists($filename)) { - unlink($filename); - } -} - - -// --------------------------------------------------------------------------------- - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.config.class.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.config.class.php deleted file mode 100644 index 87bec37..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.config.class.php +++ /dev/null @@ -1,175 +0,0 @@ - - */ - -class puppet_config -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'puppet_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "puppet_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'puppet_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'puppet_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->tpldir = $this->rootdir.'/plugins/puppet/tpl'; - - require_once($this->rootdir.'/plugins/puppet/class/puppetconfig.class.php'); - $this->puppetconfig = new puppetconfig(); - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action() { - - $response = $this->config(); - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - if(isset($response->msg)) { - $response->redirect( - $response->get_url($this->actions_name, 'config', $this->message_param, $response->msg) - ); - } - $data['please_wait'] = $this->lang['please_wait']; - $data['prefix_tab'] = $this->prefix_tab; - $data['label'] = sprintf($this->lang['label']); - $data['baseurl'] = $this->openqrm->get('baseurl'); - $data['thisfile'] = $response->html->thisfile; - $t = $response->html->template($this->tpldir.'/puppet-config.tpl.php'); - $t->add($response->form); - $t->add($data); - $t->group_elements(array('param_' => 'form', 'f_' => 'fields')); - - return $t; - } - - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function config() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $response->submit()) { - $request = $form->get_request(); - foreach($request as $k => $v) { - $fields['cc_key'] = $k; - foreach($v as $id => $value) { - $fields['cc_id'] = $id; - $fields['cc_value'] = $value; - } - $this->puppetconfig->remove($fields['cc_id']); - $this->puppetconfig->add($fields); - } - $response->msg = $this->lang['msg_updated']; - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - - $response = $this->response; - $form = $response->get_form($this->actions_name, 'config'); - $fields = $this->puppetconfig->display_overview(0, 10000, 'cc_id', 'ASC'); - $i = 0; - foreach($fields as $k => $v) { - $d['f_'.$i]['label'] = $v['cc_key']; - $d['f_'.$i]['required'] = true; - $d['f_'.$i]['object']['type'] = 'htmlobject_input'; - $d['f_'.$i]['object']['attrib']['name'] = $v['cc_key'].'['.$v['cc_id'].']'; - $d['f_'.$i]['object']['attrib']['value'] = $v['cc_value']; - $d['f_'.$i]['object']['attrib']['maxlength'] = 50; - $i++; - } - $form->add($d); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $response->form = $form; - return $response; - - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.controller.class.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.controller.class.php deleted file mode 100644 index 8c9750a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.controller.class.php +++ /dev/null @@ -1,248 +0,0 @@ - - */ - -class puppet_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'puppet_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "puppet_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'puppet_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'puppet_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array( - 'tab' => 'Appliances', - 'label' => 'Puppet Appliances', - 'id' => 'ID', - 'appliance' => 'Appliance', - 'name' => 'Name', - 'resource' => 'Resource', - 'groups' => 'Groups', - 'action_edit' => 'edit', - 'please_wait' => 'Loading. Please wait ..', - ), - 'edit' => array( - 'tab' => 'Edit', - 'label' => 'Puppet groups for appliance %s', - 'msg_updated' => 'Updated appliance %s', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..' - ), - 'config' => array( - 'tab' => 'Config', - 'label' => 'Configure Puppet', - 'msg_updated' => 'Updated Puppet Config', - 'please_wait' => 'Loading. Please wait ..', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/puppet/lang", 'puppet.ini'); - $this->tpldir = $this->rootdir.'/plugins/puppet/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = 'select'; - } - - $content = array(); - switch( $this->action ) { - case '': - default: - case 'select': - $content[] = $this->select(true); - $content[] = $this->config(false); - break; - case 'edit': - $content[] = $this->select(false); - $content[] = $this->edit(true); - $content[] = $this->config(false); - break; - case 'config': - $content[] = $this->select(false); - $content[] = $this->config(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->auto_tab = false; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * Select appliance - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/puppet/class/puppet.select.class.php'); - $controller = new puppet_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Edit appliance - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function edit( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/puppet/class/puppet.edit.class.php'); - $controller = new puppet_edit($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['edit']; - $data = $controller->action(); - } - $content['label'] = $this->lang['edit']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'edit' ); - $content['onclick'] = false; - if($this->action === 'edit'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Configure Puppet - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function config( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/puppet/class/puppet.config.class.php'); - $controller = new puppet_config($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['config']; - $data = $controller->action(); - } - $content['label'] = $this->lang['config']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'config' ); - $content['onclick'] = false; - if($this->action === 'config'){ - $content['active'] = true; - } - return $content; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.edit.class.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.edit.class.php deleted file mode 100644 index e4d8177..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.edit.class.php +++ /dev/null @@ -1,186 +0,0 @@ - - */ - -class puppet_edit -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'puppet_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "puppet_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'puppet_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'puppet_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('basedir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->tpldir = $this->rootdir.'/plugins/puppet/web/tpl'; - - require_once($this->rootdir.'/plugins/puppet/web/class/puppet.class.php'); - $this->puppet = new puppet(); - - $id = $this->response->html->request()->get('appliance_id'); - $this->response->add('appliance_id', $id); - - $appliance = $this->openqrm->appliance(); - $this->appliance = $appliance->get_instance_by_id($id); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action() { - - $response = $this->edit(); - if(isset($response->error)) { - $_REQUEST[$this->message_param] = $response->error; - } - if(isset($response->msg)) { - $response->redirect( - $response->get_url($this->actions_name, 'select', $this->message_param, $response->msg) - ); - } - $data['canceled'] = $this->lang['canceled']; - $data['please_wait'] = $this->lang['please_wait']; - $data['prefix_tab'] = $this->prefix_tab; - $data['label'] = sprintf($this->lang['label'], $this->appliance->name); - $data['baseurl'] = $this->openqrm->get('baseurl'); - $data['thisfile'] = $response->html->thisfile; - $t = $response->html->template($this->tpldir.'/puppet-edit.tpl.php'); - $t->add($response->form); - $t->add($data); - $t->group_elements(array('param_' => 'form', 'input_' => 'input')); - - return $t; - - } - - - //-------------------------------------------- - /** - * Edit - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function edit() { - $response = $this->get_response(); - $form = $response->form; - if(!$form->get_errors() && $response->submit()) { - $groups = $form->get_request('groups'); - $this->puppet->remove_appliance($this->appliance->name); - if(is_array($groups)) { - $this->puppet->set_groups($this->appliance->name, $groups); - } - $response->msg = sprintf($this->lang['msg_updated'], $this->appliance->name); - } - return $response; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param enum $mode [select|edit] - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - - $response = $this->response; - $form = $response->get_form($this->actions_name, 'edit'); - $selected = $this->puppet->get_groups($this->appliance->name); - $groups = $this->puppet->get_available_groups(); - - $i = 0; - foreach($groups as $v) { - $d['input_'.$i]['label'] = ''.$v.' ('.$this->puppet->get_group_info($v).')'; - $d['input_'.$i]['object']['type'] = 'htmlobject_input'; - $d['input_'.$i]['object']['attrib']['type'] = 'checkbox'; - $d['input_'.$i]['object']['attrib']['name'] = 'groups[]'; - $d['input_'.$i]['object']['attrib']['value'] = $v; - if(in_array($v, $selected)) { - $d['input_'.$i]['object']['attrib']['checked'] = true; - } - $i++; - } - $form->add($d); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $response->form = $form; - return $response; - - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.select.class.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.select.class.php deleted file mode 100644 index 3c441ca..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppet.select.class.php +++ /dev/null @@ -1,195 +0,0 @@ - - */ - -class puppet_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'puppet_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "puppet_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'puppet_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'puppet_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->tpldir = $this->rootdir.'/plugins/puppet/tpl'; - - require_once($this->openqrm->get('basedir').'/plugins/puppet/web/class/puppet.class.php'); - $this->puppet = new puppet(); - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $response = $this->select(); - $t = $this->response->html->template($this->tpldir.'/puppet-select.tpl.php'); - $t->add($this->prefix_tab, 'prefix_tab'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($response->table, 'table'); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['please_wait'], 'please_wait'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return htmlobject_response - */ - //-------------------------------------------- - function select() { - $response = $this->response; - $appliance = new appliance(); - - $table = $this->response->html->tablebuilder('puppet', $this->response->get_array($this->actions_name, 'select')); - $table->offset = 0; - $table->sort = 'appliance_id'; - $table->limit = 10; - $table->order = 'ASC'; - $table->max = $appliance->get_count(); - - $table->init(); - - $h['appliance_id']['title'] = $this->lang['id']; - $h['appliance_id']['sortable'] = true; - $h['appliance_id']['hidden'] = true; - - $h['appliance']['title'] = $this->lang['appliance']; - $h['appliance']['sortable'] = false; - - $h['appliance_name']['title'] = $this->lang['name']; - $h['appliance_name']['sortable'] = true; - $h['appliance_name']['hidden'] = true; - - $h['appliance_resources']['title'] = $this->lang['resource']; - $h['appliance_resources']['sortable'] = true; - $h['appliance_resources']['hidden'] = true; - - - $h['groups']['title'] = $this->lang['groups']; - $h['groups']['sortable'] = false; - $h['action']['title'] = ' '; - $h['action']['sortable'] = false; - - $result = $appliance->display_overview($table->offset, $table->limit, $table->sort, $table->order); - $b = array(); - foreach($result as $k => $v) { - - $resource = new resource(); - $resource = $resource->get_instance_by_id($v['appliance_resources']); - - $tmp = array(); - $tmp['appliance_id'] = $v['appliance_id']; - $tmp['appliance_name'] = $v['appliance_name']; - $tmp['appliance_resources'] = $v['appliance_resources']; - $tmp['appliance'] = ''.$this->lang['id'].': '.$v['appliance_id'].'
    '; - $tmp['appliance'] .= ''.$this->lang['name'].': '.$v['appliance_name'].'
    '; - $tmp['appliance'] .= ''.$this->lang['resource'].': '.$resource->id.' / '.$resource->ip.'
    '; - - $groups = $this->puppet->get_groups($v['appliance_name']); - $tmp['groups'] = implode(', ', $groups); - - $a = $response->html->a(); - $a->href = $response->get_url($this->actions_name, 'edit' ).'&appliance_id='.$v['appliance_id']; - $a->label = $this->lang['action_edit']; - $a->title = $this->lang['action_edit']; - $a->css = 'edit'; - $a->handler = 'onclick="wait();"'; - $tmp['action'] = $a->get_string(); - - $b[] = $tmp; - } - - $table->css = 'htmlobject_table'; - $table->border = 0; - $table->id = 'Tabelle'; - $table->form_action = $this->response->html->thisfile; - $table->head = $h; - $table->body = $b; - $table->sort_params = $response->get_string( $this->actions_name, 'select' ); - $table->sort_form = true; - $table->sort_link = false; - $table->autosort = false; - $table->limit_select = array( - array("value" => 10, "text" => 10), - array("value" => 20, "text" => 20), - array("value" => 30, "text" => 30), - array("value" => 40, "text" => 40), - array("value" => 50, "text" => 50), - ); - $response->table = $table; - return $response; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppetconfig.class.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppetconfig.class.php deleted file mode 100644 index d708afd..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/class/puppetconfig.class.php +++ /dev/null @@ -1,224 +0,0 @@ - -*/ - - -// This class represents a puppet user in openQRM - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/kernel.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; - -$PUPPET_CONFIG_TABLE="puppet_config"; -global $PUPPET_CONFIG_TABLE; -$event = new event(); -global $event; - -class puppetconfig { - -var $id = ''; -var $key = ''; -var $value = ''; - - function __construct() { - $this->puppet_config_table = "puppet_config"; - $this->event = new event(); - } - - -// --------------------------------------------------------------------------------- -// methods to create an instance of a puppetconfig object filled from the db -// --------------------------------------------------------------------------------- - -// returns an appliance from the db selected by id or name -function get_instance($id, $name) { - $db=openqrm_get_db_connection(); - if ("$id" != "") { - $puppetconfig_array = $db->Execute("select * from ".$this->puppet_config_table." where cc_id=$id"); - } else if ("$name" != "") { - $puppetconfig_array = $db->Execute("select * from ".$this->puppet_config_table." where cc_key='$name'"); - } else { - $this->event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "puppetconfig.class.php", "Could not create instance of puppetconfig without data", "", "", 0, 0, 0); - return; - } - - foreach ($puppetconfig_array as $index => $puppetconfig) { - $this->id = $puppetconfig["cc_id"]; - $this->key = $puppetconfig["cc_key"]; - $this->value = $puppetconfig["cc_value"]; - } - return $this; -} - -// returns an appliance from the db selected by id -function get_instance_by_id($id) { - $this->get_instance($id, ""); - return $this; -} - -// returns an appliance from the db selected by key -function get_instance_by_key($name) { - $this->get_instance("", $name); - return $this; -} - - -// --------------------------------------------------------------------------------- -// general puppetconfig methods -// --------------------------------------------------------------------------------- - - - - -// checks if given puppetconfig id is free in the db -function is_id_free($puppetconfig_id) { - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select cc_id from ".$this->puppet_config_table." where cc_id=$puppetconfig_id"); - if (!$rs) - $this->event->log("is_id_free", $_SERVER['REQUEST_TIME'], 2, "puppetconfig.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - if ($rs->EOF) { - return true; - } else { - return false; - } -} - - -// adds puppetconfig to the database -function add($puppetconfig_fields) { - if (!is_array($puppetconfig_fields)) { - $this->event->log("add", $_SERVER['REQUEST_TIME'], 2, "puppetconfig.class.php", "coulduser_field not well defined", "", "", 0, 0, 0); - return 1; - } - // set stop time and status to now - $now=$_SERVER['REQUEST_TIME']; - $db=openqrm_get_db_connection(); - $result = $db->AutoExecute($this->puppet_config_table, $puppetconfig_fields, 'INSERT'); - if (! $result) { - $this->event->log("add", $_SERVER['REQUEST_TIME'], 2, "puppetconfig.class.php", "Failed adding new puppetconfig to database", "", "", 0, 0, 0); - } -} - - - -// removes puppetconfig from the database -function remove($puppetconfig_id) { - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from ".$this->puppet_config_table." where cc_id=$puppetconfig_id"); -} - -// removes puppetconfig from the database by key -function remove_by_name($puppetconfig_key) { - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from ".$this->puppet_config_table." where cc_key='$puppetconfig_key'"); -} - - -// returns puppetconfig value by puppetconfig_id -function get_value($puppetconfig_id) { - $db=openqrm_get_db_connection(); - $puppetconfig_set = $db->Execute("select cc_value from ".$this->puppet_config_table." where cc_id=$puppetconfig_id"); - if (!$puppetconfig_set) { - $this->event->log("get_name", $_SERVER['REQUEST_TIME'], 2, "puppetconfig.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - if (!$puppetconfig_set->EOF) { - return $puppetconfig_set->fields["cc_value"]; - } else { - return ""; - } - } -} - - -// sets a puppetconfig value by puppetconfig_id -function set_value($puppetconfig_id, $puppetconfig_value) { - $db=openqrm_get_db_connection(); - $puppetconfig_set = $db->Execute("update ".$this->puppet_config_table." set cc_value=\"$puppetconfig_value\" where cc_id=$puppetconfig_id"); - if (!$puppetconfig_set) { - $this->event->log("get_name", $_SERVER['REQUEST_TIME'], 2, "puppetconfig.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } -} - - -// returns the number of puppetconfigs for an puppetconfig type -function get_count() { - $count=0; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select count(cc_id) as num from ".$this->puppet_config_table); - if (!$rs) { - print $db->ErrorMsg(); - } else { - $count = $rs->fields["num"]; - } - return $count; -} - - - -// returns a list of all puppetconfig names -function get_list() { - $query = "select cc_id, cc_value from ".$this->puppet_config_table; - $puppetconfig_name_array = array(); - $puppetconfig_name_array = openqrm_db_get_result_double ($query); - return $puppetconfig_name_array; -} - - -// returns a list of all puppetconfig ids -function get_all_ids() { - $puppetconfig_list = array(); - $query = "select cc_id from ".$this->puppet_config_table; - $db=openqrm_get_db_connection(); - $rs = $db->Execute($query); - if (!$rs) - $this->event->log("get_list", $_SERVER['REQUEST_TIME'], 2, "puppetconfig.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $puppetconfig_list[] = $rs->fields; - $rs->MoveNext(); - } - return $puppetconfig_list; - -} - - - - -// displays the puppetconfig-overview -function display_overview($offset, $limit, $sort, $order) { - $db=openqrm_get_db_connection(); - $recordSet = $db->SelectLimit("select * from ".$this->puppet_config_table." order by $sort $order", $limit, $offset); - $puppetconfig_array = array(); - if (!$recordSet) { - $this->event->log("display_overview", $_SERVER['REQUEST_TIME'], 2, "puppetconfig.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($puppetconfig_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $puppetconfig_array; -} - - -} - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/css/puppet.css b/openQRM-5.3.50-CE/src/plugins/puppet/web/css/puppet.css deleted file mode 100644 index 37c7b46..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/css/puppet.css +++ /dev/null @@ -1,25 +0,0 @@ -.htmlobject_table .appliance { - width: 350px; -} -.htmlobject_table .action { - width: 120px; - text-align: right; -} - - - - - -#puppet_groups .htmlobject_box .left { - float: right; - text-align: left; - width: 600px; -} -#puppet_groups .htmlobject_box .right { - width: 30px; - float: right; - padding: 4px 0 0 0; -} -#buttons { - margin: 10px 0 0 0; -} diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/puppet/web/img/plugin.png deleted file mode 100644 index e969688..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/puppet/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/lang/de.puppet-about.ini b/openQRM-5.3.50-CE/src/plugins/puppet/web/lang/de.puppet-about.ini deleted file mode 100644 index 140958d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/lang/de.puppet-about.ini +++ /dev/null @@ -1,35 +0,0 @@ -[documentation] -tab = "Über Puppet" -label = "Über Puppet" -introduction_title = "Einleitung" -introduction_content = "Das Puppet-Plugin bietet automatisches Konfiguration-Managment (Applikations-Deployment plus Vorkonfiguration) für Server in openQRM. Es integriert Puppet in den openQRM-Server und erlaubt die Provisionierung spezifischer Applikationen mittels einfacher Zuordnung von Puppet-Klassen.

    -

    Das Puppet-Plugin beinhaltet einen nach 'best-practise' konfigurierten Puppet-Server und -Client. Die Puppet-Klassen (Rezepte) werden dabei automatisch in einem Subversion-Repository abgelegt. Die Puppet-Konfiguration ist in Server, Gruppen und Klassen organisiert. Eigene Klassen werden dem class Verzeichnis hinzugefügt. Klassen werden dann zu 'Gruppen' (groups) kombiniert, die direkt Server in der openQRM-Benutzeroberfläche zugeordnet werden können. Der Inhalt des 'Gruppen' (groups) Verzeichnis wird automatisch in der UI dargestellt. Das Puppet-Plugin beinhaltet einige vorgefertigte Puppet-Klassen und -Gruppen wie z.B. -

      -
    • basic-server
    • -
    • webserver
    • -
    • database-server
    • -
    • lamp
    • -
    - Diese vordefinierten Klassen und Gruppen können selbstverständlich nach eigenen Bedürfnissen angepasst werden. Das Puppet Konfigurations-Repository von openQRM ist auch für externe Subversion Clients verfügbar unter:" - -introduction_title1 = "Applikationen den Server zuordnen" -introduction_content1 = "
      -
    1. Klicken Sie auf 'Server' im Puppet-plugin Menu
    2. -
    3. Wählen Sie einen Server die von Puppet verwaltet werden soll
    4. -
    5. Wählen Sie die Puppet Gruppen zu denen der Server gehören soll
    6. -
    - Innerhalb kürzester Zeit wird der Puppet-Server die neue Konfiguration automatisch auf die Server angewenden." -requirements_title = "Anforderungen" -requirements_list = "Das Puppet-Plugin ist abhängig vom DNS-Plugin. Bitte vergewissern Sie sich, dass das DNS-Plugin vor dem Puppet-Plugin gestartet wurde." -tested_title = "Getestet mit" -tested_content = "Dieses Plugin ist getestet mit Debian, Ubuntu und CentOS" - -provides_title = "Bietet" -provides_list = "Automatisches Konfigurations-Managment für Server in openQRM" - -type_title = "Plugin-Typ" -type_content = "Deployment" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/lang/de.puppet.ini b/openQRM-5.3.50-CE/src/plugins/puppet/web/lang/de.puppet.ini deleted file mode 100644 index 9c59e0e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/lang/de.puppet.ini +++ /dev/null @@ -1,22 +0,0 @@ -[select] -tab = "Server" -label = "Puppet Server" -id = "ID" -appliance = "Server" -name = "Name" -resource = "Resource" -groups = "Gruppe" -action_edit = "bearbeiten" -please_wait = "Lade. Bitte warten .." -[edit] -tab = "Bearbeiten" -label = "Puppet Gruppen für Server %s" -puppet_groups = "Puppet Gruppen" -msg_updated = "Server %s aktuallisiert" -please_wait = "Lade. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." -[config] -tab = "Einstellungen" -label = "Puppet Einstellungen" -msg_updated = "Puppet Einstellungen aktuallisiert" -please_wait = "Lade. Bitte warten .." diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/lang/en.puppet-about.ini b/openQRM-5.3.50-CE/src/plugins/puppet/web/lang/en.puppet-about.ini deleted file mode 100644 index 12b51ae..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/lang/en.puppet-about.ini +++ /dev/null @@ -1,29 +0,0 @@ -[documentation] -tab = "About Puppet" -label = "About Puppet" -introduction_title = "Introduction" -introduction_content = "

    The puppet plugin provides automated configuration management for servers in openQRM. It seamlessly integrates puppet within the openQRM GUI and assists to put specific server into pre-made or custom puppet classes.

    -

    By enabling the plugin the puppet environment (server and client) is pre-configured and initialized automatically according to best-practice experiences e.g. by keeping the puppet configuration within a svn repository.

    -

    The puppet configuration is organized in 'classes' 'groups' and 'Server'. Custom custom classes can be added to the class-directory. Classes should be combined to 'groups' these will be automatically displayed in the puppet plugin.

    -

    The puppet configuration repository is also available for external svn clients. To check out the puppet repository please run:" -introduction_title1 = "Assigning applications to server" -introduction_content1 = "

    1. Go to the 'Server' in the puppet plugin menu
    2. -
    3. Select an server to be configured via puppet
    4. -
    5. Select the puppet groups the server should belong to
    6. -
    - Within short time the puppet server will distribute the new configuration to the server automatically." - -requirements_title = "Requirements" -requirements_list = "The puppet plugin depends on the DNS plugin! Please make sure to have the DNS plugin enabled and started before." - -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions." - -provides_title = "Provides" -provides_list = "Automated configuration management for Server in openQRM" - -type_title = "Plugin type" -type_content = "Deployment" - -documentation_title = "Documentation" -use_case_title = "Use case" diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/lang/en.puppet.ini b/openQRM-5.3.50-CE/src/plugins/puppet/web/lang/en.puppet.ini deleted file mode 100644 index 0cf2534..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/lang/en.puppet.ini +++ /dev/null @@ -1,22 +0,0 @@ -[select] -tab = "Server" -label = "Puppet Server" -id = "ID" -appliance = "Server" -name = "Name" -resource = "Resource" -groups = "Groups" -action_edit = "edit" -please_wait = "Loading. Please wait .." -[edit] -tab = "Edit" -label = "Puppet groups for Server %s" -puppet_groups = "Puppet Groups" -msg_updated = "Updated Server %s" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." -[config] -tab = "Config" -label = "Configure Puppet" -msg_updated = "Updated Puppet Config" -please_wait = "Loading. Please wait .." diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/puppet/web/menu.txt deleted file mode 100644 index 635eca3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/menu.txt +++ /dev/null @@ -1,23 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|Puppet -...|Appliances|index.php?plugin=puppet|Apply Puppet Classes to Appliances -...|Configuration|index.php?plugin=puppet&puppet_action=config|Configure Puppet -...|About|index.php?plugin=puppet&controller=puppet-about|How to use diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-appliance-edit-hook.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-appliance-edit-hook.php deleted file mode 100644 index 2914687..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-appliance-edit-hook.php +++ /dev/null @@ -1,27 +0,0 @@ - -*/ - -function get_puppet_appliance_edit($appliance_id, $openqrm, $response) { - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_id); - $plugin_title = "Configure Application on Appliance ".$appliance->name; - - $a = $response->html->a(); - $a->label = ''.$plugin_title.''; - $a->href = $openqrm->get('baseurl').'/index.php?base=appliance&appliance_action=load_edit&aplugin=puppet&puppet_action=edit&appliance_id='.$appliance_id; - return $a; -} - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-appliance-hook.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-appliance-hook.php deleted file mode 100644 index 15411c0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-appliance-hook.php +++ /dev/null @@ -1,65 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $OPENQRM_SERVER_IP_ADDRESS; -$event = new event(); -global $event; - - - -function openqrm_puppet_appliance($cmd, $appliance_fields) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $appliance_id=$appliance_fields["appliance_id"]; - $appliance_name=$appliance_fields["appliance_name"]; - $resource = new resource(); - $resource->get_instance_by_id($appliance_fields["appliance_resources"]); - $appliance_ip=$resource->ip; - // check appliance values, maybe we are in update and they are incomplete - if (($resource->id == "-1") || ($resource->id == "")) { - return; - } - - - $event->log("openqrm_new_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-puppet-appliance-hook.php", "Handling $cmd event $appliance_id/$appliance_name/$appliance_ip", "", "", 0, 0, $appliance_id); - switch($cmd) { - case "start": - $openqrm_server = new openqrm_server(); - $openqrm_server->send_command("$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/bin/openqrm-puppet-manager start $appliance_id $appliance_name $appliance_ip --openqrm-cmd-mode background"); - break; - case "stop": - $openqrm_server = new openqrm_server(); - $openqrm_server->send_command("$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/bin/openqrm-puppet-manager stop $appliance_id $appliance_name $appliance_ip --openqrm-cmd-mode background"); - break; - - } -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-cloud-application-hook.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-cloud-application-hook.php deleted file mode 100644 index e8d0743..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-cloud-application-hook.php +++ /dev/null @@ -1,90 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once $RootDir."/include/user.inc.php"; -require_once $RootDir."/class/event.class.php"; -require_once $RootDir."/class/resource.class.php"; -require_once $RootDir."/class/openqrm_server.class.php"; -require_once $RootDir."/include/openqrm-server-config.php"; -require_once $RootDir."/plugins/puppet/class/puppet.class.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $OPENQRM_SERVER_IP_ADDRESS; -$event = new event(); -global $event; - - - -// cloud hook to get the available application groups -function openqrm_puppet_get_cloud_applications() { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $puppet_group_list = array(); - $puppet = new puppet(); - $puppet_group_array = $puppet->get_available_groups(); - foreach ($puppet_group_array as $index => $puppet_app) { - $puppet_group_list[] = "puppet/".$puppet_app; - } - return $puppet_group_list; -} - - - -// cloud hook to get the supported os version by application -function openqrm_puppet_get_supported_os_version($application) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $puppet = new puppet(); - $puppet_os_array = $puppet->get_supported_os($application); - return $puppet_os_array; -} - - - -// cloud hook to set applications for a cloud server -function openqrm_puppet_set_cloud_applications($appliance_name, $application_array) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $puppet = new puppet(); - $puppet->set_groups($appliance_name, $application_array); -} - - -// cloud hook to remove applications from a cloud server -function openqrm_puppet_remove_cloud_applications($appliance_name) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $puppet = new puppet(); - $puppet->remove_appliance($appliance_name); -} - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-cloud-product-hook.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-cloud-product-hook.php deleted file mode 100644 index 04f31a0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-cloud-product-hook.php +++ /dev/null @@ -1,91 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once $RootDir."/plugins/puppet/class/puppet.class.php"; - -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $IMAGE_AUTHENTICATION_TABLE; -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $openqrm_server; -$event = new event(); -global $event; - - - -function openqrm_puppet_cloud_product($cmd, $cloud_hook_config) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - global $RootDir; - - $openqrm_server = new openqrm_server(); - - $event->log("openqrm_puppet_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-puppet-cloud-product-hook.php", "Handling ".$cmd." event", "", "", 0, 0, 0); - switch($cmd) { - case "add": - $event->log("openqrm_puppet_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-puppet-cloud-product-hook.php", "Handling cloud-product ".$cmd." event", "", "", 0, 0, 0); - // create application products - $next_sort_id = 0; - $db=openqrm_get_db_connection(); - $puppet = new puppet(); - $puppet_group_array = $puppet->get_available_groups(); - foreach ($puppet_group_array as $index => $puppet_app) { - $event->log("openqrm_puppet_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-puppet-cloud-product-hook.php", "Adding application ".$puppet_app." as cloud-product", "", "", 0, 0, 0); - $cloud_product_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $create_application_cloudselector_config = "insert into cloud_selector (id, type, sort_id, quantity, price, name, description, state) VALUES (".$cloud_product_id.", 'application', ".$next_sort_id.", 'puppet/".$puppet_app."', 1, '".$puppet_app."', '".$puppet_app." via puppet', 1);"; - $recordSet = $db->Execute($create_application_cloudselector_config); - $next_sort_id++; - } - break; - - case "remove": - $cloud_product_class = $RootDir."/plugins/cloud/class/cloudselector.class.php"; - if (file_exists($cloud_product_class)) { - require_once $cloud_product_class; - $cloud_selector = new cloudselector(); - $cloud_selector_id_ar = $cloud_selector->get_all_ids(); - foreach ($cloud_selector_id_ar as $key => $value) { - $id = $value['id']; - $cloud_selector->get_instance_by_id($id); - $pos = strpos($cloud_selector->quantity, 'puppet/'); - if ($pos !== false) { - $event->log("openqrm_puppet_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-puppet-cloud-product-hook.php", "Removing application ".$cloud_selector->quantity." from cloud-products", "", "", 0, 0, 0); - $cloud_selector->remove($id); - } - } - } - break; - } -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-resource-hook.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-resource-hook.php deleted file mode 100644 index dd10a04..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/openqrm-puppet-resource-hook.php +++ /dev/null @@ -1,89 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $OPENQRM_SERVER_IP_ADDRESS; -$event = new event(); -global $event; - - - -function openqrm_puppet_resource($cmd, $resource_fields) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - $resource_id=$resource_fields["resource_id"]; - if ($resource_id == '') { - $event->log("openqrm_puppet_resource", $_SERVER['REQUEST_TIME'], 5, "openqrm_puppet_resource.php", "Not handling ".$cmd." - empty resource-id", "", "", 0, 0, 0); - return; - } - $resource = new resource(); - $resource->get_instance_by_id($resource_id); - $resource_ip=$resource->ip; - $resource_name=$resource->hostname; - - $event->log("openqrm_puppet_resource", $_SERVER['REQUEST_TIME'], 5, "openqrm-puppet-resource-hook.php", "Handling $cmd event $resource_id/$resource_name/$resource_ip", "", "", 0, 0, $resource_id); - - // we do only care if we serving an appliance - $appliance = new appliance(); - $appliance_record_set = array(); - $appliance_id_array = array(); - $appliance_record_set = $appliance->get_all_ids(); - // the appliance_array from getlist is a 2-dimensional array - foreach ($appliance_record_set as $index => $appliance_id_array) { - - foreach ($appliance_id_array as $index => $id) { - $tapp = new appliance(); - $tapp->get_instance_by_id($id); - $tapp_state = $tapp->state; - $tapp_resources = $tapp->resources; - - if (!strcmp($tapp_state, "active")) { - - if ($tapp_resources == $resource_id) { - // we found the resources active appliance, running the cmd - - $appliance_name = $tapp->name; - switch($cmd) { - case "start": - $openqrm_server = new openqrm_server(); - $openqrm_server->send_command("$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/bin/openqrm-puppet-manager start $id $appliance_name $resource_ip --openqrm-cmd-mode background"); - break; - case "stop": - $openqrm_server = new openqrm_server(); - $openqrm_server->send_command("$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/puppet/bin/openqrm-puppet-manager stop $id $appliance_name $resource_ip --openqrm-cmd-mode background"); - break; - } - } - } - } - } -} - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/puppet-action.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/puppet-action.php deleted file mode 100644 index 02b6ad4..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/puppet-action.php +++ /dev/null @@ -1,129 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); -$thisfile = basename($_SERVER['PHP_SELF']); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -$BaseDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/'; -$PuppetDir = $_SERVER["DOCUMENT_ROOT"].'/puppet-portal/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -// filter inputs -require_once $RootDir.'/class/htmlobjects/htmlobject.class.php'; -require_once $RootDir.'/include/requestfilter.inc.php'; - -$cloud_product_hook = $RootDir.'/plugins/puppet/openqrm-puppet-cloud-product-hook.php'; -$cloud_selector_class = $RootDir.'/plugins/cloud/class/cloudselector.class.php'; - -$html = new htmlobject($RootDir.'/class/htmlobjects/'); -$request = $html->request(); -$request->filter = $requestfilter; - -$puppet_command = $request->get('puppet_command'); -$puppet_domain = $request->get('puppet_domain'); - - -// special puppet classes -require_once "$RootDir/plugins/puppet/class/puppetconfig.class.php"; -global $PUPPET_USER_TABLE; -global $PUPPET_REQUEST_TABLE; - -global $OPENQRM_SERVER_BASE_DIR; -$refresh_delay=5; - -$event = new event(); -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $event; - - -// user/role authentication -if ($OPENQRM_USER->role != "administrator") { - $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "puppet-action", "Un-Authorized access to puppet-actions from $OPENQRM_USER->name", "", "", 0, 0, 0); - exit(); -} - - -// gather request parameter in array -foreach ($_REQUEST as $key => $value) { - if (strncmp($key, "cr_", 3) == 0) { - $request_fields[$key] = $value; - } -} - - - -// main -$event->log("$puppet_command", $_SERVER['REQUEST_TIME'], 5, "puppet-action", "Processing puppet command $puppet_command", "", "", 0, 0, 0); - - switch ($puppet_command) { - - case 'init': - // this command creates the following table - // - // -> puppetconfig - // cc_id BIGINT - // cc_key VARCHAR(50) - // cc_value VARCHAR(50) - - $create_puppet_config = "create table puppet_config(cc_id BIGINT, cc_key VARCHAR(50), cc_value VARCHAR(50))"; - $db=openqrm_get_db_connection(); - $recordSet = $db->Execute($create_puppet_config); - // create the default configuration - $create_default_puppet_config1 = "insert into puppet_config(cc_id, cc_key, cc_value) values (1, 'ca_auto_sign', 'true')"; - $create_default_puppet_config2 = "insert into puppet_config(cc_id, cc_key, cc_value) values (2, 'domain_name', '".$puppet_domain."')"; - $recordSet = $db->Execute($create_default_puppet_config1); - $recordSet = $db->Execute($create_default_puppet_config2); - $db->Close(); - - if (file_exists($cloud_product_hook)) { - require_once $cloud_product_hook; - openqrm_puppet_cloud_product("add", NULL); - } - break; - - case 'uninstall': - $drop_puppet_config = "drop table puppet_config"; - $db=openqrm_get_db_connection(); - $recordSet = $db->Execute($drop_puppet_config); - $db->Close(); - - if (file_exists($cloud_product_hook)) { - require_once $cloud_product_hook; - openqrm_puppet_cloud_product("remove", NULL); - } - break; - - - default: - $event->log("$puppet_command", $_SERVER['REQUEST_TIME'], 3, "puppet-action", "No such event command ($puppet_command)", "", "", 0, 0, 0); - break; - - - } - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-about-documentation.tpl.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-about-documentation.tpl.php deleted file mode 100644 index f17797c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-about-documentation.tpl.php +++ /dev/null @@ -1,52 +0,0 @@ - -

    {label}

    - -
    - -
    - -

    {introduction_title}

    - {introduction_content} -
    {introduction_command}
    - -

    {introduction_title1}

    - {introduction_content1} - -

    {provides_title}

    - {provides_list} - -

    {requirements_title}

    - {requirements_list} -
    - -
    -

    {type_title}

    - {type_content} - -

    {tested_title}

    - {tested_content} -
    - - -
    - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-apply.tpl.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-apply.tpl.php deleted file mode 100644 index 278d22a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-apply.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ - -

    Apply Puppet Classes II

    - -

    Please Select the Puppet-groups for the appliance {appliance_name}

    -
    -{puppet_groups_table} -<- back -
    diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-config.tpl.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-config.tpl.php deleted file mode 100644 index f9bf3ac..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-config.tpl.php +++ /dev/null @@ -1,26 +0,0 @@ - -

    {label}

    - -
    -
    - {form} - {fields} -
    - {submit} -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-edit.tpl.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-edit.tpl.php deleted file mode 100644 index 268154c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-edit.tpl.php +++ /dev/null @@ -1,26 +0,0 @@ - -

    {label}

    - -
    -
    - {form} -
    {input}
    -
     
    -
    {submit} {cancel}
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-select.tpl.php b/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-select.tpl.php deleted file mode 100644 index bd68de0..0000000 --- a/openQRM-5.3.50-CE/src/plugins/puppet/web/tpl/puppet-select.tpl.php +++ /dev/null @@ -1,18 +0,0 @@ - -

    {label}

    -{table} diff --git a/openQRM-5.3.50-CE/src/plugins/role-administration/Makefile b/openQRM-5.3.50-CE/src/plugins/role-administration/Makefile deleted file mode 100644 index e47bf5e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/role-administration/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/role-administration/etc - cp etc/openqrm-plugin-role-administration.conf /usr/share/openqrm/plugins/role-administration/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/role-administration/etc/openqrm-plugin-role-administration.conf b/openQRM-5.3.50-CE/src/plugins/role-administration/etc/openqrm-plugin-role-administration.conf deleted file mode 100644 index 77f3a25..0000000 --- a/openQRM-5.3.50-CE/src/plugins/role-administration/etc/openqrm-plugin-role-administration.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Role-administration provides permission management for openQRM Administrator Usergroups.
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="management" diff --git a/openQRM-5.3.50-CE/src/plugins/sanboot-storage/Makefile b/openQRM-5.3.50-CE/src/plugins/sanboot-storage/Makefile deleted file mode 100644 index e16b489..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sanboot-storage/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -configure: -compile: -install: - mkdir -p /usr/share/openqrm/plugins/sanboot-storage/etc - cp etc/openqrm-plugin-sanboot-storage.conf /usr/share/openqrm/plugins/sanboot-storage/etc/ -uninstall: -clean: -all: diff --git a/openQRM-5.3.50-CE/src/plugins/sanboot-storage/etc/openqrm-plugin-sanboot-storage.conf b/openQRM-5.3.50-CE/src/plugins/sanboot-storage/etc/openqrm-plugin-sanboot-storage.conf deleted file mode 100644 index 3a12bad..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sanboot-storage/etc/openqrm-plugin-sanboot-storage.conf +++ /dev/null @@ -1,2 +0,0 @@ -OPENQRM_PLUGIN_DESCRIPTION="Integrates gPXE to boot Windows Systems directly from an iSCSI or AOE SAN (network-deployment)
    This plugin is only available in the openQRM Enterprise version!
    Please check https://openqrm-enterprise.com" -OPENQRM_PLUGIN_TYPE="storage" diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/Makefile b/openQRM-5.3.50-CE/src/plugins/sshterm/Makefile deleted file mode 100644 index 31c0e34..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# this is the openQRM sshterm-plugin Makefile -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -export OPENQRM_SERVER_CONF=$(shell pwd)/../../etc/openqrm-server.conf - -configure: - -compile: - ../../make-assistant openqrm_cache_or_download sshterm etc/build.conf/sshterm.conf - -install: - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc - . $(OPENQRM_SERVER_CONF) && cp etc/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/init.d - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && cp etc/init.d/sshterm $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/init.d/ && chmod 700 $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/init.d/* - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/build.conf - . $(OPENQRM_SERVER_CONF) && cp etc/build.conf/sshterm*.conf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/build.conf/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/include - . $(OPENQRM_SERVER_CONF) && cp include/openqrm* $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/include/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web - . $(OPENQRM_SERVER_CONF) && cp web/*.txt $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/ - . $(OPENQRM_SERVER_CONF) && cp web/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/img - . $(OPENQRM_SERVER_CONF) && cp web/img/*.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/img/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/tpl - . $(OPENQRM_SERVER_CONF) && cp web/tpl/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/tpl/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/class - . $(OPENQRM_SERVER_CONF) && cp web/class/*.php $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/class/ - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/css - . $(OPENQRM_SERVER_CONF) && cp web/css/*.css $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/css/ - - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/js - . $(OPENQRM_SERVER_CONF) && cp web/js/*.js $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/js/ - - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/lang - . $(OPENQRM_SERVER_CONF) && cp web/lang/*.ini $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/lang/ - . $(OPENQRM_SERVER_CONF) && . etc/build.conf/sshterm.conf && if ! tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/ -xzf $$OPENQRM_BUILD_TMP_DIR/openqrm-build/sshterm/source/ajaxterm-$$OPENQRM_SOURCE_VERSION.tar.gz 2>/dev/null; then tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/ -xzf ../../$$OPENQRM_BUILD_TMP_DIR/openqrm-build/sshterm/source/ajaxterm-$$OPENQRM_SOURCE_VERSION.tar.gz; fi - . $(OPENQRM_SERVER_CONF) && tar -C $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm -czf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/boot-service-sshterm.tgz include/ etc/init.d/sshterm etc/openqrm-plugin-sshterm.conf ajaxterm - # menu icons - . $(OPENQRM_SERVER_CONF) && mkdir -p $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/sshterm - . $(OPENQRM_SERVER_CONF) && cp web/img/plugin.png $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/web/base/img/menu/sshterm/ - -uninstall: - . $(OPENQRM_SERVER_CONF) && rm -rf $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/* - . $(OPENQRM_SERVER_CONF) && rmdir $(DESTINATION_DIR)$$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm - -clean: - -realclean: clean - -all: configure compile - -.PHONY: all configure compile install uninstall clean realclean diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/etc/build.conf/sshterm.conf b/openQRM-5.3.50-CE/src/plugins/sshterm/etc/build.conf/sshterm.conf deleted file mode 100644 index 85fe6c4..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/etc/build.conf/sshterm.conf +++ /dev/null @@ -1,21 +0,0 @@ -# Below the download locations for third-party components are defined -# openqrm-plugin-sshterm-components.tgz provides a stripped ajaxterm and a -# static compiled pound as the reverse ssl-proxy -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SOURCE_VERSION="2.1" -#OPENQRM_SOURCE_DOWNLOAD="http://web-shell.googlecode.com/files/WebShell-$OPENQRM_SOURCE_VERSION.zip" -OPENQRM_SOURCE_DOWNLOAD="http://support.openqrm-enterprise.com/openqrm-build/5.3/plugins/sshterm/ajaxterm-$OPENQRM_SOURCE_VERSION.tar.gz" -OPENQRM_SOURCE_BINARY_RESULT="" diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/etc/init.d/openqrm-plugin-sshterm b/openQRM-5.3.50-CE/src/plugins/sshterm/etc/init.d/openqrm-plugin-sshterm deleted file mode 100644 index c261630..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/etc/init.d/openqrm-plugin-sshterm +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/bash -# init script for the openQRM sshterm plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -. $OPENQRM_SERVER_BASE_DIR/openqrm/etc/openqrm-server.conf -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-server-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/include/openqrm-plugin-sshterm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/openqrm-plugin-sshterm.conf -# for the post-event to work -openqrm_server_get_config -OPENQRM_SERVER_IP=$OPENQRM_SERVER_IP_ADDRESS -resource_id=0 -resource_openqrmserver=$OPENQRM_SERVER_IP_ADDRESS -# which screen binary to use -if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" -else - RUNSCREEN=`which screen` -fi - - -function openqrm_plugin_sshterm_start() { - echo "Starting the openQRM sshterm-plugin" - local CURRENTDIR=`pwd` - openqrm_plugin_sshterm_stop 1>/dev/null 2>&1 - # generate cert - cd $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/ajaxterm/ - - if [ ! -f /root/.ajaxterm/ajaxterm.pem ]; then - umask 077 - mkdir -p /root/.ajaxterm/ - openssl req -config "make_certificate.cfg" -keyout "/root/.ajaxterm/ajaxterm.pem" -newkey rsa:1024 -nodes -x509 -days 365 -out "/root/.ajaxterm/ajaxterm.pem" - fi - # patch SocketServer.py for python 2.7 - # webshell/python bug http://code.google.com/p/web-shell/issues/detail?id=67&q=2.7 - if [ -f /usr/lib/python2.7/SocketServer.py ]; then - if [ ! -f /usr/lib/python2.7/SocketServer.py.openqrm-backup ]; then - cp -f /usr/lib/python2.7/SocketServer.py /usr/lib/python2.7/SocketServer.py.openqrm-backup - fi - # pls preserve the line breaks in the following sed command - if ! grep openQRM /usr/lib/python2.7/SocketServer.py 1>/dev/null; then - sed -i -e 's/request.shutdown(socket.SHUT_WR)/request.shutdown(socket.SHUT_WR)\ - # openQRM: fix for webshell in combination with python 2\.7\ - except TypeError:\ - request.shutdown()\ -/' /usr/lib/python2.7/SocketServer.py - fi - fi - # start the ajaxterm - SCREEN_NAME=`date +%T%x | sed -e "s/://g" | sed -e "s#/##g"` - $RUNSCREEN -dmS $SCREEN_NAME ./ajaxterm.py --host=0.0.0.0 --port=$OPENQRM_PLUGIN_WEBSHELL_PORT --cert=/root/.ajaxterm/ajaxterm.pem - cd $CURRENTDIR - touch $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/sshterm/.running - return 0 -} - -function openqrm_plugin_sshterm_stop() { - echo "Stopping the openQRM sshterm-plugin" - AJAXTERM_PID=`ps ax | grep ajaxterm.py | grep -v grep | awk {' print $1 '}` - for PID in $AJAXTERM_PID; do - kill $PID - done - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/sshterm/.running - return 0 -} - - -function openqrm_plugin_sshterm_init() { - echo "Initializing the openQRM sshterm-plugin" - # linking the web dir - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/sshterm - # link the boot-service - ln -sf $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/web/boot-service-sshterm.tgz $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-sshterm.tgz - return 0 -} - - -function openqrm_plugin_sshterm_uninstall() { - echo "Uninstalling the openQRM sshterm-plugin" - openqrm_plugin_sshterm_stop - # remove bootservice - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/boot-service/boot-service-sshterm.tgz - # unlinking the web dir - rm -f $OPENQRM_WEBSERVER_DOCUMENT_ROOT/openqrm/base/plugins/sshterm -} - - -case "$1" in - start) - openqrm_plugin_sshterm_start - ;; - stop) - openqrm_plugin_sshterm_stop - ;; - restart) - openqrm_plugin_sshterm_stop - sleep 1 - openqrm_plugin_sshterm_start - ;; - init) - openqrm_plugin_sshterm_init - ;; - uninstall) - openqrm_plugin_sshterm_uninstall - ;; - *) - echo "Usage: $0 {start|stop|restart|init|uninstall|createcert}" - exit 1 - -esac -exit $? - - diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/etc/init.d/openqrm-plugin-sshterm.postinstall b/openQRM-5.3.50-CE/src/plugins/sshterm/etc/init.d/openqrm-plugin-sshterm.postinstall deleted file mode 100644 index 6d28dbc..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/etc/init.d/openqrm-plugin-sshterm.postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-sshterm postinstall script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/etc/init.d/openqrm-plugin-sshterm.preremove b/openQRM-5.3.50-CE/src/plugins/sshterm/etc/init.d/openqrm-plugin-sshterm.preremove deleted file mode 100644 index 66c5ab1..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/etc/init.d/openqrm-plugin-sshterm.preremove +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is the openqrm-plugin-sshterm preremove script -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -`dirname $0`/openqrm-plugin-sshterm stop diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/etc/init.d/sshterm b/openQRM-5.3.50-CE/src/plugins/sshterm/etc/init.d/sshterm deleted file mode 100644 index e86393a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/etc/init.d/sshterm +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/bash -# this is the boot-service init script for the sshterm resources -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_SERVER_BASE_DIR=$(pushd $(dirname $0)/../../../../.. > /dev/null; echo $PWD; popd > /dev/null) -# for including the package functions -export OPENQRM_SOURCE_DIR="$OPENQRM_SERVER_BASE_DIR/openqrm/" -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/include/openqrm-package-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/include/openqrm-plugin-sshterm-functions -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/openqrm-plugin-sshterm.conf -. $OPENQRM_RESOURCE_PARAMETER_FILE -# define wget to use with https -if [ "$openqrm_web_protocol" == "https" ]; then - WGET_NO_CERT_CHECK="--no-check-certificate" -fi - -# do not run on idle resources -if [ "$resource_image" == "idle" ]; then - exit 0 -fi -# also do not run before the real init of the rootfs -# if we have this file /etc/initrd-devices.conf we are still in the initrd -if [ -f /etc/initrd-devices.conf ]; then - exit 0 -fi - - -function sshterm_start() { - echo "Starting the openQRM sshterm-plugin" - local CURRENTDIR=`pwd` - sshterm_stop 1>/dev/null 2>&1 - if ! which screen 1>/dev/null; then - export FORCE_INSTALL=true - openqrm_install_os_dependency screen - fi - if ! which openssl 1>/dev/null; then - export FORCE_INSTALL=true - openqrm_install_os_dependency openssl - fi - if [ -x /usr/bin/screen.real ]; then - RUNSCREEN="/usr/bin/screen.real" - else - RUNSCREEN=`which screen` - fi - if [ -f /etc/debian_version ]; then - if ! dpkg-query -s python3-openssl 1>/dev/null 2>&1; then - export FORCE_INSTALL=true - openqrm_install_os_dependency python3-openssl - fi - elif [ -f /etc/redhat-release ]; then - if ! rpm -q pyOpenSSL 1>/dev/null 2>&1; then - export FORCE_INSTALL=true - openqrm_install_os_dependency pyOpenSSL - fi - elif [ -f /etc/SuSE-release ]; then - if ! rpm -q python3-openssl 1>/dev/null 2>&1; then - export FORCE_INSTALL=true - openqrm_install_os_dependency python3-openssl - fi - fi - # generate cert - cd $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/ajaxterm/ - if [ ! -f /root/.ajaxterm/ajaxterm.pem ]; then - umask 077 - mkdir -p /root/.ajaxterm/ - openssl req -config "make_certificate.cfg" -keyout "/root/.ajaxterm/ajaxterm.pem" -newkey rsa:1024 -nodes -x509 -days 365 -out "/root/.ajaxterm/ajaxterm.pem" - fi - # patch SocketServer.py for python 2.7 - # webshell/python bug http://code.google.com/p/web-shell/issues/detail?id=67&q=2.7 - if [ -f /usr/lib/python2.7/SocketServer.py ]; then - if [ ! -f /usr/lib/python2.7/SocketServer.py.openqrm-backup ]; then - cp -f /usr/lib/python2.7/SocketServer.py /usr/lib/python2.7/SocketServer.py.openqrm-backup - fi - # pls preserve the line breaks in the following sed command - if ! grep openQRM /usr/lib/python2.7/SocketServer.py 1>/dev/null; then - sed -i -e 's/request.shutdown(socket.SHUT_WR)/request.shutdown(socket.SHUT_WR)\ - # openQRM: fix for webshell in combination with python 2\.7\ - except TypeError:\ - request.shutdown()\ -/' /usr/lib/python2.7/SocketServer.py - fi - fi - # apply css - SCREEN_NAME=`date +%T%x | sed -e "s/://g" | sed -e "s#/##g"` - $RUNSCREEN -dmS $SCREEN_NAME ./ajaxterm.py --host=0.0.0.0 --port=$OPENQRM_PLUGIN_WEBSHELL_PORT --cert=/root/.ajaxterm/ajaxterm.pem - cd $CURRENTDIR - return 0 -} - - -function sshterm_stop() { - echo "Stopping the openQRM sshterm-plugin" - AJAXTERM_PID=`ps ax | grep ajaxterm.py | grep -v grep | awk {' print $1 '}` - for PID in $AJAXTERM_PID; do - kill $PID - done -} - - - -case "$1" in - start) - sshterm_start - ;; - stop) - sshterm_stop - ;; - restart) - sshterm_stop - sleep 1 - sshterm_start - ;; - *) - echo "Usage: $0 {start|stop|restart|createcert}" - exit 1 - -esac -exit $? - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/etc/openqrm-plugin-sshterm.conf b/openQRM-5.3.50-CE/src/plugins/sshterm/etc/openqrm-plugin-sshterm.conf deleted file mode 100644 index e0fe595..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/etc/openqrm-plugin-sshterm.conf +++ /dev/null @@ -1,41 +0,0 @@ -# this is the openQRM-plugin-sshterm info file -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# - -OPENQRM_PLUGIN_VERSION="5.3.2.1" - -# Those items setting up the dependencies for the package -if [ -f /etc/debian_version ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openssl, screen, python3-openssl, openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/redhat-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openssl, screen, pyOpenSSL, openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -elif [ -f /etc/SuSE-release ]; then - OPENQRM_PLUGIN_DEPENDENCIES="openssl, screen, python-pyOpenSSL, openqrm-server" - OPENQRM_PLUGIN_BUILD_REQUIREMENTS="" -fi - -OPENQRM_PLUGIN_DESCRIPTION="Integrates WebShell providing a secure login to the openQRM-server and the managed resources through the Web-interface." -OPENQRM_PLUGIN_TYPE="management" -# openQRM plugin-dependencies - the following plugins must be enabled -OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES="" - -# define which port to use for the ajaxterm reverse proxy -OPENQRM_PLUGIN_WEBSHELL_PORT=8022 - -# files which should be taken to the state backup -OPENQRM_PLUGIN_STATE_FILES="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/openqrm-plugin-sshterm.conf" - diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/include/openqrm-plugin-sshterm-functions b/openQRM-5.3.50-CE/src/plugins/sshterm/include/openqrm-plugin-sshterm-functions deleted file mode 100644 index a8eacff..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/include/openqrm-plugin-sshterm-functions +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# this is the functions file for the sshterm-plugin -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -if [ "$OPENQRM_SERVER_BASE_DIR" == "" ]; then - echo "ERROR: Please export OPENQRM_SERVER_BASE_DIR before sourcing $0" - exit 1 -fi -. $OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/openqrm-plugin-sshterm.conf - - diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/include/openqrm-sshterm-css.template b/openQRM-5.3.50-CE/src/plugins/sshterm/include/openqrm-sshterm-css.template deleted file mode 100644 index d45fac2..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/include/openqrm-sshterm-css.template +++ /dev/null @@ -1,142 +0,0 @@ -body { -margin:25px 25px 25px 25px; -padding:0; -background:#141414; -color:#fff; -} - -.container { -margin:0 auto 0 auto; -width:480px; -float:left; -} - -#term { -position:absolute; -margin:25px 25px 25px 25px; -padding:0; -minimum-height:264px; -font:16px Andale Mono, monospace; -white-space:pre; -background:#DDDDDD; -} - -span.ul { text-decoration: underline; } - -span.f0 { color: #000000; } -span.f1 { color: #c00006; } -span.f2 { color: #1bc806; } -span.f3 { color: #c3c609; } -span.f4 { color: #0000c2; } -span.f5 { color: #bf00c2; } -span.f6 { color: #19c4c2; } -span.f7 { color: #f2f2f2; } -span.fc { color: transparent; } /* Concealed */ -span.fe { color: #000000; } /* Negative fg */ -span.ff { color: #000000; } /* Default fg */ - -span.b0 { background-color: #000000; } -span.b1 { background-color: #cc2300; } -span.b2 { background-color: #00cc00; } -span.b3 { background-color: #cccc00; } -span.b4 { background-color: #0e2acc; } -span.b5 { background-color: #cc34cc; } -span.b6 { background-color: #00cccc; } -span.b7 { background-color: #f5f5f5; } -span.bc { background-color: #555555; } /* Cursor */ -span.be { background-color: transparent; } /* Default bg */ -span.bf { background-color: #ffffff; } /* Negative bg */ - -.olCtrl { -display:none; -position:absolute; -top:0px; -} -.olAlert { -display:none; -position:absolute; -top:0px; -margin:78px 0 0 110px; -width:260px; -height:66px; -padding:42px 0 0px 0; -color:#fff; -text-align:center; -font:24px sans-serif; -background:#141414; -opacity:0.7; -} - -.hd { -width:480px; -height:64px; -} -.h { -float:left; -width:60px; -height:30px; -margin:10px 0 0 0; -padding:8px 0 0 0; -font:12px sans-serif; -text-align:center; -color:#fff; -cursor:pointer; -} -.hr { -margin:0 10px 0 0; -float:right; -} -.hb { -margin:10px 0 0 10px; -padding:8px 0 0 3px; -background:url('back.png') no-repeat; -} -.hscroll { -background:url('head.png') no-repeat -180px 0; -} - -.kd { -height:50px; -} -.k { -float:left; -height:36px; -margin:25px 25px 25px 25px; -padding:14px 0 0 0; -background:url('cell.png') no-repeat top right; -cursor:pointer; -font:22px sans-serif; -color:#fff; -text-align:center; -} -.k0 { -width:48px; -background:url('cell.png') no-repeat top right; -} -.k0s { -width:48px; -background:url('cells.png') no-repeat top right; -} -.k6 { -width:80px; -background:url('cell.png') no-repeat top right; -} -.k6s { -width:80px; -background:url('cells.png') no-repeat top right; -} -.k2 { -width:400px; -background:url('cell.png') no-repeat top right; -} - -.t { -width:399px; -margin:-4px 0 0 0; -padding:4px 0 4px 0; -background:#000; -border:0; -font:22px sans-serif; -color:#fff; -opacity:0.5; -} diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/class/sshterm-about.controller.class.php b/openQRM-5.3.50-CE/src/plugins/sshterm/web/class/sshterm-about.controller.class.php deleted file mode 100644 index 1a313db..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/web/class/sshterm-about.controller.class.php +++ /dev/null @@ -1,277 +0,0 @@ - - */ - -class sshterm_about_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'sshterm_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = 'sshterm_about_msg'; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'sshterm_about_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'sshterm_about_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'documentation' => array ( - 'tab' => 'About SshTerm', - 'label' => 'About SshTerm', - 'introduction_title' => 'Introduction', - 'introduction_content' => 'The SshTerm Plugin integrates WebShell into openQRM. - It provides a secure login to the openQRM Server and the managed Systems through the Web Interface. - No manual configuration is needed.', - - 'requirements_title' => 'Requirements', - 'requirements_list' => 'none', - 'tested_title' => 'Tested with', - 'tested_content' => 'This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions.', - 'provides_title' => 'Provides', - 'provides_list' => 'SSH Login through the openQRM Web Interface', - 'type_title' => 'Plugin Type', - 'type_content' => 'Management', - 'documentation_title' => 'Documentation', - 'use_case_title' => 'Use-Case', - ), - 'usage' => array ( - 'tab' => 'About SshTerm', - 'label' => 'SshTerm Use-Cases', - ), - -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/sshterm/lang", 'sshterm-about.ini'); - $this->tpldir = $this->rootdir.'/plugins/sshterm/tpl'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "documentation"; - } - $content = array(); - switch( $this->action ) { - case '': - case 'documentation': - $content[] = $this->documentation(true); - break; - case 'bootservice': - $content[] = $this->bootservice(true); - break; - case 'vms': - $content[] = $this->vms(true); - break; - case 'usage': - $content[] = $this->usage(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - - //-------------------------------------------- - /** - * About SshTerm - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function documentation( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/sshterm/class/sshterm-about.documentation.class.php'); - $controller = new sshterm_about_documentation($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['documentation']; - $data = $controller->action(); - } - $content['label'] = $this->lang['documentation']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'documentation' ); - $content['onclick'] = false; - if($this->action === 'documentation'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Boot-Service - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function bootservice( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/sshterm/class/sshterm-about.bootservice.class.php'); - $controller = new sshterm_about_bootservice($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['bootservice']; - $data = $controller->action(); - } - $content['label'] = $this->lang['bootservice']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'bootservice' ); - $content['onclick'] = false; - if($this->action === 'bootservice'){ - $content['active'] = true; - } - return $content; - } - - - - - //-------------------------------------------- - /** - * About SshTerm VM management - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function vms( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/sshterm/class/sshterm-about.vms.class.php'); - $controller = new sshterm_about_vms($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['vms']; - $data = $controller->action(); - } - $content['label'] = $this->lang['vms']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'vms' ); - $content['onclick'] = false; - if($this->action === 'vms'){ - $content['active'] = true; - } - return $content; - } - - - - //-------------------------------------------- - /** - * About SshTerm Use-Cases - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function usage( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/sshterm/class/sshterm-about.usage.class.php'); - $controller = new sshterm_about_usage($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->lang = $this->lang['usage']; - $data = $controller->action(); - } - $content['label'] = $this->lang['usage']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'usage' ); - $content['onclick'] = false; - if($this->action === 'usage'){ - $content['active'] = true; - } - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/class/sshterm-about.documentation.class.php b/openQRM-5.3.50-CE/src/plugins/sshterm/web/class/sshterm-about.documentation.class.php deleted file mode 100644 index db0ff9d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/web/class/sshterm-about.documentation.class.php +++ /dev/null @@ -1,88 +0,0 @@ - - */ - -class sshterm_about_documentation -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'sshterm_about_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "sshterm_about_msg"; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->basedir = $this->openqrm->get('basedir'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/sshterm-about-documentation.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['type_title'], 'type_title'); - $t->add($this->lang['type_content'], 'type_content'); - $t->add($this->lang['tested_title'], 'tested_title'); - $t->add($this->lang['tested_content'], 'tested_content'); - $t->add($this->lang['provides_title'], 'provides_title'); - $t->add($this->lang['provides_list'], 'provides_list'); - $t->add($this->lang['introduction_title'], 'introduction_title'); - $t->add($this->lang['introduction_content'], 'introduction_content'); - $t->add($this->lang['requirements_title'], 'requirements_title'); - $t->add($this->lang['requirements_list'], 'requirements_list'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/class/sshterm.controller.class.php b/openQRM-5.3.50-CE/src/plugins/sshterm/web/class/sshterm.controller.class.php deleted file mode 100644 index b9fab84..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/web/class/sshterm.controller.class.php +++ /dev/null @@ -1,175 +0,0 @@ - - */ - -class sshterm_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'sshterm_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "sshterm_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'sshterm_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'sshterm_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array ( - 'tab' => 'SSH Login', - 'label' => 'SSH Login', - 'action_login' => 'login', - 'table_login' => 'SSH Login', - 'table_state' => 'State', - 'table_id' => 'Id', - 'table_name' => 'Name', - 'table_type' => 'Type', - 'table_kernel' => 'Kernel', - 'table_image' => 'Image', - 'table_resource' => 'Resource', - 'table_deployment' => 'Deployment', - 'please_wait' => 'Loading. Please wait ..', - ), - 'login' => array ( - 'tab' => 'SSH Login', - 'label' => 'SSH Login', - 'login_msg' => 'Login to appliance %s', - 'please_wait' => 'Loading. Please wait ..', - 'canceled' => 'Operation canceled. Please wait ..', - ), - -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->basedir = $this->openqrm->get('basedir'); - $this->tpldir = $this->rootdir.'/plugins/sshterm/tpl'; - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/sshterm/lang", 'sshterm.ini'); - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "select"; - } - - $content = array(); - switch( $this->action ) { - case '': - case 'select': - $content[] = $this->select(true); - break; - } - - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * Select Appliance - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/sshterm/class/sshterm.select.class.php'); - $controller = new sshterm_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->prefix_tab = $this->prefix_tab; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - - -} diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/class/sshterm.select.class.php b/openQRM-5.3.50-CE/src/plugins/sshterm/web/class/sshterm.select.class.php deleted file mode 100644 index e54c50a..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/web/class/sshterm.select.class.php +++ /dev/null @@ -1,206 +0,0 @@ - - */ - -class sshterm_select -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'sshterm_action'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'sshterm_identifier'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "sshterm_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'sshterm_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $data = $this->select(); - $t = $this->response->html->template($this->tpldir.'/sshterm-select.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($data); - $t->add($this->lang['label'], 'label'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - return $t; - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return array - */ - //-------------------------------------------- - function select() { - - $h = array(); - $h['appliance_state']['title'] =' '; - $h['appliance_state']['sortable'] = false; -/* - $h['appliance_icon']['title'] =' '; - $h['appliance_icon']['sortable'] = false; -*/ - $h['appliance_id']['title'] = $this->lang['table_id']; - $h['appliance_name']['title'] = $this->lang['table_name']; - $h['appliance_values']['title'] = ' '; - $h['appliance_values']['sortable'] = false; - $h['login']['title'] =' '; - $h['login']['sortable'] = false; - - // use the appliance link hook - require_once $this->openqrm->get('webdir')."/plugins/sshterm/openqrm-sshterm-appliance-link-hook.php"; - - $appliance = new appliance(); - $params = $this->response->get_array($this->actions_name, 'select'); - $b = array(); - - $table = $this->response->html->tablebuilder('login', $params); - $table->offset = 0; - $table->sort = 'appliance_id'; - $table->limit = 10; - $table->order = 'ASC'; - $table->init(); - - $appliances = $appliance->display_overview($table->offset, 100000, $table->sort, $table->order); - foreach ($appliances as $index => $appliance_db) { - $appliance = new appliance(); - $appliance->get_instance_by_id($appliance_db["appliance_id"]); - - $resource = new resource(); - $resource->get_instance_by_id($appliance->resources); - - $kernel = new kernel(); - $kernel->get_instance_by_id($appliance_db["appliance_kernelid"]); - - $image = new image(); - $image->get_instance_by_id($appliance_db["appliance_imageid"]); - - $virtualization = new virtualization(); - $virtualization->get_instance_by_id($appliance_db["appliance_virtualization"]); - - $resource_icon_default="/openqrm/base/img/appliance.png"; - $active_state_icon="active"; - $inactive_state_icon="inactive"; - $login = ''; - if ($appliance->stoptime == 0 || $appliance->resources == 0) { - $state_icon=$active_state_icon; - // login - $login = get_sshterm_appliance_link($appliance->id); - if(is_object($login)) { - $login = $login->get_string(); - } - } else { - $state_icon=$inactive_state_icon; - $login = ''; - } - $str = 'Kernel: '.$kernel->name.'
    - Image: '.$image->name.'
    - Resource: '.$resource->id." / ".$resource->ip.'
    - Type: '.$virtualization->name.""; - - $state_pill = $this->response->html->span(); - $state_pill->css= "pill"; - $state_pill->add($state_icon); - - $b[] = array( - 'appliance_state' => $state_pill->get_string(), - // 'appliance_icon' => "", - 'appliance_id' => $appliance->id, - 'appliance_name' => $appliance->name, - 'appliance_values' => $str, - 'login' => $login, - ); - } - - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->form_action = $this->response->html->thisfile; - $table->autosort = true; - $table->sort_link = false; - $table->max = count($b); - $table->head = $h; - $table->body = $b; - $table->limit_select = array( - array("value" => 5, "text" => 5), - array("value" => 10, "text" => 10), - array("value" => 20, "text" => 20), - array("value" => 30, "text" => 30), - array("value" => 50, "text" => 50), - array("value" => 100, "text" => 100), - ); - - $d = array(); - $d['table'] = $table; - return $d; - } - -} diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/css/sshterm.css b/openQRM-5.3.50-CE/src/plugins/sshterm/web/css/sshterm.css deleted file mode 100644 index e69de29..0000000 diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/img/plugin.png b/openQRM-5.3.50-CE/src/plugins/sshterm/web/img/plugin.png deleted file mode 100644 index a4deeea..0000000 Binary files a/openQRM-5.3.50-CE/src/plugins/sshterm/web/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/js/sshterm.js b/openQRM-5.3.50-CE/src/plugins/sshterm/web/js/sshterm.js deleted file mode 100644 index 3d3e21c..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/web/js/sshterm.js +++ /dev/null @@ -1,5 +0,0 @@ -function open_sshterm(url, title, left, top) { - - sshterm_window = window.open(url, title, "width=900,height=520,scrollbars=1,left=" + left + ",top=" + top); - open_sshterm.focus(); -} \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/lang/de.sshterm-about.ini b/openQRM-5.3.50-CE/src/plugins/sshterm/web/lang/de.sshterm-about.ini deleted file mode 100644 index 42aee9e..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/web/lang/de.sshterm-about.ini +++ /dev/null @@ -1,24 +0,0 @@ -[documentation] -tab = "Über SshTerm" -label = "Über SshTerm" -introduction_title = "Einleitung" -introduction_content = "Das SshTerm-Plugin integriert WebShell und bietet einen sicheren, verschlüsselten SSH-Zugang zu den von openQRM verwalteten Systemen. Manuelle Konfiguration ist nicht nötig." - -requirements_title = "Anforderungen" -requirements_list = "keine" -tested_title = "Getestet mit" -tested_content = "Diese Plugin ist getestet mit Debian, Ubuntu und CentOS" - -provides_title = "Bietet" -provides_list = "SSH-Zugang eingebettet in openQRM." - -type_title = "Plugin Typ" -type_content = "Management" - -documentation_title = "Dokumentation" -use_case_title = "Anwendungsfall" - - -[usage] -tab = "About SshTerm" -label = "SshTerm Anwendungsfälle" diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/lang/de.sshterm.ini b/openQRM-5.3.50-CE/src/plugins/sshterm/web/lang/de.sshterm.ini deleted file mode 100644 index 0c519d3..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/web/lang/de.sshterm.ini +++ /dev/null @@ -1,21 +0,0 @@ -[select] -tab = "SSH Login" -label = "SSH Login" -action_login = "login" -table_login = "SSH Login" -table_state = "Status" -table_id = "Id" -table_name = "Name" -table_type = "Type" -table_kernel = "Kernel" -table_image = "Image" -table_resource = "Ressource" -table_deployment = "Deployment" -please_wait = "Lade. Bitte warten .." -[login] -tab = "SSH Login" -label = "SSH Login" -login_msg = "Einloggen auf den Server %s" -please_wait = "Lade. Bitte warten .." -canceled = "Operation abgebrochen. Bitte warten .." - diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/lang/en.sshterm-about.ini b/openQRM-5.3.50-CE/src/plugins/sshterm/web/lang/en.sshterm-about.ini deleted file mode 100644 index 832f8bd..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/web/lang/en.sshterm-about.ini +++ /dev/null @@ -1,27 +0,0 @@ -[documentation] -tab = "About SshTerm" -label = "About SshTerm" -introduction_title = "Introduction" -introduction_content = "The SshTerm Plugin integrates WebShell into openQRM. - It provides a secure login to the openQRM Server and the managed Systems through the Web Interface. - No manual configuration is needed." - -requirements_title = "Requirements" -requirements_list = "none" - -tested_title = "Tested with" -tested_content = "This plugin is tested with the Debian, Ubuntu and CentOS Linux distributions." - -provides_title = "Provides" -provides_list = "SSH Login through the openQRM Web Interface" - -type_title = "Plugin type" -type_content = "Management" - -documentation_title = "Documentation" -use_case_title = "Use-Case" - - -[usage] -tab = "About SshTerm" -label = "SshTerm use cases" diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/lang/en.sshterm.ini b/openQRM-5.3.50-CE/src/plugins/sshterm/web/lang/en.sshterm.ini deleted file mode 100644 index e1372dd..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/web/lang/en.sshterm.ini +++ /dev/null @@ -1,21 +0,0 @@ -[select] -tab = "SSH Login" -label = "SSH Login" -action_login = "login" -table_login = "SSH Login" -table_state = "State" -table_id = "Id" -table_name = "Name" -table_type = "Type" -table_kernel = "Kernel" -table_image = "Image" -table_resource = "Resource" -table_deployment = "Deployment" -please_wait = "Loading. Please wait .." -[login] -tab = "SSH Login" -label = "SSH Login" -login_msg = "Login to Server %s" -please_wait = "Loading. Please wait .." -canceled = "Operation canceled. Please wait .." - diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/menu.txt b/openQRM-5.3.50-CE/src/plugins/sshterm/web/menu.txt deleted file mode 100644 index 1466e08..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/web/menu.txt +++ /dev/null @@ -1,22 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -# Title -# Href -# Alt -# IMG -# Target -..|SSHTerm -...|SSHTerm|index.php?plugin=sshterm&controller=sshterm|SSHTerm -...|About|index.php?plugin=sshterm&controller=sshterm-about|How to use diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/openqrm-sshterm-appliance-link-hook.php b/openQRM-5.3.50-CE/src/plugins/sshterm/web/openqrm-sshterm-appliance-link-hook.php deleted file mode 100644 index 5b82f9b..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/web/openqrm-sshterm-appliance-link-hook.php +++ /dev/null @@ -1,73 +0,0 @@ - -*/ - - -// error_reporting(E_ALL); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/class/htmlobjects/htmlobject.class.php"; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -global $OPENQRM_SERVER_IP_ADDRESS; -$event = new event(); -global $event; - - - -function get_sshterm_appliance_link($appliance_id) { - global $event; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_SERVER_IP_ADDRESS; - global $OPENQRM_EXEC_PORT; - - $p_appliance = new appliance(); - $p_appliance->get_instance_by_id($appliance_id); - $p_resource = new resource(); - $p_resource->get_instance_by_id($p_appliance->resources); - // get the parameters from the plugin config file - $OPENQRM_PLUGIN_SSHTERM_CONFIG_FILE="$OPENQRM_SERVER_BASE_DIR/openqrm/plugins/sshterm/etc/openqrm-plugin-sshterm.conf"; - $store = openqrm_parse_conf($OPENQRM_PLUGIN_SSHTERM_CONFIG_FILE); - extract($store); - $sshterm_login_ip = $p_resource->ip; - $sshterm_window = 'window'.str_replace('.','',$sshterm_login_ip); - $sshterm_login_url="https://$sshterm_login_ip:$OPENQRM_PLUGIN_WEBSHELL_PORT"; - - $html = new htmlobject($OPENQRM_SERVER_BASE_DIR.'/openqrm/web/base/class/htmlobjects'); - $a = $html->a(); - $a->label = 'SSHTerm'; - $a->css = 'badge'; - $a->href = '#'; - $a->handler = 'onclick="sshwindow = window.open(\''.$sshterm_login_url.'\',\''.$sshterm_window.'\', \'location=0,status=0,scrollbars=yes,resizable=yes,width=972,height=500,left=100,top=100,screenX=400,screenY=100\'); sshwindow.focus(); return false;"'; - - $plugin_link = ''; - if (strstr($p_appliance->state, "active")) { - $plugin_link = $a; - } - if ($p_resource->id == 0) { - $plugin_link = $a; - } - if ($p_resource->id == '') { - $plugin_link = ""; - } - - return $plugin_link; -} - diff --git a/openQRM-5.3.50-CE/src/plugins/sshterm/web/openqrm-sshterm-dashboard-quicklink-hook.php b/openQRM-5.3.50-CE/src/plugins/sshterm/web/openqrm-sshterm-dashboard-quicklink-hook.php deleted file mode 100644 index ff8c10d..0000000 --- a/openQRM-5.3.50-CE/src/plugins/sshterm/web/openqrm-sshterm-dashboard-quicklink-hook.php +++ /dev/null @@ -1,44 +0,0 @@ - -*/ -function get_sshterm_dashboard_quicklink($html) { - // create tag for button icon - $quicklink_icon = $html->i(); - $quicklink_icon->css = 'glyphicons-icon keyboard-wireless'; - -/* - // create tag for the colored corner - $quicklink_corner = $html->span(); - $quicklink_corner->css = 'corner corner-orange'; - - // create
    - css_right.'>'.$this->content->get_string().'
    -
     
    - - '; - return $_strReturn; - } -} - diff --git a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.class.php b/openQRM-5.3.50-CE/src/web/base/class/htmlobject.class.php deleted file mode 100644 index 2b274d3..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.class.php +++ /dev/null @@ -1,713 +0,0 @@ - - */ - -class htmlobject extends http -{ -/** -* Attribute class -* @access public -* @var string -*/ -var $css = ''; -/** -* Attribute id -* @access public -* @var string -*/ -var $id = ''; -/** -* Attribute style -* @access public -* @var string -*/ -var $style = ''; -/** -* Attribute title -* @access public -* @var string -*/ -var $title = ''; - -/** -* adds an eventhandler to -* @access public -* @var string -*/ -var $handler = ''; - -/** -* string of attribs -* @acess protected -* @var string -*/ -var $_init; - - /** - * init attribs - * - * @acess protected - */ - function init() { - $this->_init = ''; - if ($this->css != '') { $this->_init .= ' class="'.$this->css.'"'; } - if ($this->style != '') { $this->_init .= ' style="'.$this->style.'"'; } - if ($this->title != '') { $this->_init .= ' title="'.$this->title.'"'; } - if ($this->handler != '') { $this->_init .= ' '.$this->handler; } - // set id - if ($this->id == '') { $this->set_id(); } - if ($this->id != '') { $this->_init .= ' id="'.$this->id.'"'; } - } - - /** - * set html id - * - * @acess public - * @param string $id - */ - function set_id($id = '') { - if($id != '') { - $this->id = $id; - } - // if no id is set - if($this->id == '') { - if(isset($this->name)) { - $this->id = $this->name; - } else { - $this->id = uniqid('p'); - } - } - } - -} - -/** - * Select - * - * @package htmlobject - * @author Alexander Kuballa akuballa@openqrm-enterprise.com - * @copyright Copyright (c) 2008, Alexander Kuballa - * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * @version 1.0 - */ -class htmlobject_select extends htmlobject -{ -/** -* disable select -* @access public -* @var bool -*/ -var $disabled = false; -/** -* allow multiple selection -* @access public -* @var bool -*/ -var $multiple = false; -/** -* Attribute name (should the the same as Attribute id) -* @access public -* @var string -*/ -var $name = ''; -/** -* number of lines to be shown -* @access public -* @var int -*/ -var $size = ''; -/** -* Attribute tabindex -* @access public -* @var int -*/ -var $tabindex = ''; -/** -* content of option element (text) -* @access public -* @var array -*/ -var $text = array(); -/** -* index of array text -* @access public -* @var array -*/ -var $text_index = array( -"value" => 'id', -"text" => 'name' -); -/** -* content of option element (value) -* @access public -* @var array -*/ -var $selected = array(); -/** -* selected by text or value -* -* true = selected by text -* false = selected by values -* @access public -* @var bool -*/ -var $selected_by_text = false; - - /** - * init attribs - * - * @acess protected - */ - function init() { - parent::init(); - if ($this->disabled === true) { $this->_init .= ' disabled'; } - if ($this->multiple === true) { $this->_init .= ' multiple'; } - if ($this->name != '') { $this->_init .= ' name="'.$this->name.'"'; } - if ($this->size != '') { $this->_init .= ' size="'.$this->size.'"'; } - if ($this->tabindex != '') { $this->_init .= ' tabindex="'.$this->tabindex.'"'; } - } - - /** - * Get html element as string - * - * @acess public - * @return string - */ - function get_string() { - $_strReturn = ''; - $this->init(); - $_strReturn = "\n_init>\n"; - $_strReturn .= $this->get_options(); - $_strReturn .= "\n"; - return $_strReturn; - } - - function get_options() { - $_strReturn = ''; - if(count($this->text) > 0){ - for ($i=0; count($this->text)>$i; $i++) { - $sel = ""; - if($this->selected_by_text === true) { - if(in_array($this->text[$i][$this->text_index['text']], $this->selected)) { - $sel = ' selected="selected"'; - } - } - else { - if(in_array($this->text[$i][$this->text_index['value']], $this->selected)) { - $sel = ' selected="selected"'; - } - } - $_strReturn .= "\n"; - } - } else { - $_strReturn .= ''; - } - return $_strReturn; - } -} - -/** - * Input - * - * @package htmlobject - * @author Alexander Kuballa akuballa@openqrm-enterprise.com - * @copyright Copyright (c) 2008, Alexander Kuballa - * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * @version 1.0 - */ -class htmlobject_input extends htmlobject -{ -/** -* @access public -* @var bool -*/ -var $checked = false; -/** -* disable select -* @access public -* @var bool -*/ -var $disabled = false; -/** -* maxlength -* @access public -* @var int -*/ -var $maxlength; -/** -* Attribute name -* @access public -* @var string -*/ -var $name = ''; -/** -* number of lines to be shown -* @access public -* @var int -*/ -var $size = ''; -/** -* Attribute tabindex -* @access public -* @var int -*/ -var $tabindex = ''; -/** -* type of element -* @access public -* @var string -* @values text | password | checkbox | radio | submit | reset | file | hidden | image | button -*/ -var $type = ''; -/** -* value of input -* @access public -* @var string -*/ -var $value = ''; - - /** - * init attribs - * - * @acess protected - */ - function init() { - parent::init(); - if ($this->checked != '') { $this->_init .= ' checked="checked"'; } - if ($this->disabled === true) { $this->_init .= ' disabled="disabled"'; } - if ($this->maxlength != '') { $this->_init .= ' maxlength="'.$this->maxlength.'"'; } - if ($this->name != '') { $this->_init .= ' name="'.$this->name.'"'; } - if ($this->size != '') { $this->_init .= ' size="'.$this->size.'"'; } - if ($this->tabindex != '') { $this->_init .= ' tabindex="'.$this->tabindex.'"'; } - if ($this->value != '') { $this->_init .= ' value="'.$this->value.'"'; } - $this->type = strtolower($this->type); - switch($this->type) { - case 'text': - case 'password': - case 'checkbox': - case 'radio': - case 'submit': - case 'reset': - case 'hidden': - case 'image': - case 'button': - $this->_init .= ' type="'.$this->type.'"'; - break; - default: - $this->_init .= ' type="text"'; - if(debug::active()) { - debug::add('type '.$this->type.' not supported - type set to text', 'ERROR'); - } - break; - } - } - - /** - * Get html element as string - * - * @acess public - * @return string - */ - function get_string() { - $_strReturn = ''; - $this->init(); - $_strReturn = "_init>"; - return $_strReturn; - } -} - -/** - * Button - * - * @package htmlobject - * @author Alexander Kuballa akuballa@openqrm-enterprise.com - * @copyright Copyright (c) 2008, Alexander Kuballa - * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * @version 1.0 - */ -class htmlobject_button extends htmlobject -{ -/** -* disable select -* @access public -* @var bool -*/ -var $disabled = false; -/** -* Attribute name -* @access public -* @var string -*/ -var $name = ''; -/** -* Attribute tabindex -* @access public -* @var int -*/ -var $tabindex = ''; -/** -* type of element -* @access public -* @var string -* @values button | submit | reset -*/ -var $type = ''; -/** -* value of input -* @access public -* @var string -*/ -var $value = ''; -/** -* value of input -* @access public -* @var string -*/ -var $label = ''; - - /** - * init attribs - * - * @acess protected - */ - function init() { - parent::init(); - if ($this->disabled === true) { $this->_init .= ' disabled="disabled"'; } - if ($this->name != '') { $this->_init .= ' name="'.$this->name.'"'; } - if ($this->tabindex != '') { $this->_init .= ' tabindex="'.$this->tabindex.'"'; } - if ($this->value != '') { $this->_init .= ' value="'.$this->value.'"'; } - $this->type = strtolower($this->type); - switch($this->type) { - case 'submit': - case 'reset': - case 'button': - $this->_init .= ' type="'.$this->type.'"'; - break; - default: - $this->_init .= ' type="button"'; - if(debug::active()) { - debug::add('type '.$this->type.' not supported - type set to button', 'ERROR'); - } - break; - } - } - - /** - * Get html element as string - * - * @acess public - * @return string - */ - function get_string() { - $_strReturn = ''; - $this->init(); - $_strReturn = "\n_init>$this->label"; - return $_strReturn; - } -} - -/** - * Textarea - * - * @package htmlobject - * @author Alexander Kuballa akuballa@openqrm-enterprise.com - * @copyright Copyright (c) 2008, Alexander Kuballa - * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * @version 1.0 - */ -class htmlobject_textarea extends htmlobject -{ -/** -* Attribute cols -* @access public -* @var int -*/ -var $cols = 50; -/** -* disable textarea -* @access public -* @var bool -*/ -var $disabled = false; -/** -* Attribute name (should the the same as Attribute id) -* @access public -* @var string -*/ -var $name = ''; -/** -* set textarea to readonly -* @access public -* @var bool -*/ -var $readonly = false; -/** -* number of rows -* @access public -* @var int -*/ -var $rows = 5; -/** -* Attribute tabindex -* @access public -* @var int -*/ -var $tabindex = ''; -/** -* wrap type (physical,virtual,none) -* @access public -* @var string -*/ -var $wrap = ''; - -/** -* Content of textarea -* @access public -* @var string -*/ -var $text = ''; - - /** - * init attribs - * - * @acess protected - */ - function init() { - parent::init(); - if ($this->cols != '') { $this->_init .= ' cols="'.$this->cols.'"'; } - if ($this->disabled === true) { $this->_init .= ' disabled'; } - if ($this->name != '') { $this->_init .= ' name="'.$this->name.'"'; } - if ($this->readonly === true) { $this->_init .= ' readonly'; } - if ($this->rows != '') { $this->_init .= ' rows="'.$this->rows.'"'; } - if ($this->tabindex != '') { $this->_init .= ' tabindex="'.$this->tabindex.'"'; } - if ($this->wrap != '') { $this->_init .= ' wrap="'.$this->wrap.'"'; } - } - - /** - * Get html element as string - * - * @acess public - * @return string - */ - function get_string() { - $_strReturn = ''; - $this->init(); - $_strReturn = "\n_init>"; - $_strReturn .= $this->text; - $_strReturn .= "\n"; - return $_strReturn; - } -} - -/** - * Form - * - * @package htmlobject - * @author Alexander Kuballa akuballa@openqrm-enterprise.com - * @copyright Copyright (c) 2008, Alexander Kuballa - * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * @version 1.0 - */ -class htmlobject_form extends htmlobject -{ -/** -* uri -* @access public -* @var string -*/ -var $action = ''; -/** -* mime type -* @access public -* @var string -*/ -var $enctype = ''; -/** -* Post/Get -* @access public -* @var string -*/ -var $method = ''; -/** -* Attribute name -* @access public -* @var string -*/ -var $name = ''; -/** -* target -* @access public -* @var string -*/ -var $target = ''; -/** -* form elements -* @access public -* @var string -*/ -var $fields = ''; - - /** - * init attribs - * - * @acess protected - */ - function init() { - parent::init(); - if ($this->action != '') { $this->_init .= ' action="'.$this->action.'"'; } - if ($this->enctype != '') { $this->_init .= ' enctype="'.$this->enctype.'"'; } - if ($this->method != '') { $this->_init .= ' method="'.$this->method.'"'; } - if ($this->name != '') { $this->_init .= ' name="'.$this->name.'"'; } - if ($this->target != '') { $this->_init .= ' target="'.$this->target.'"'; } - } - - /** - * Get html element as string - * - * @acess public - * @return string - */ - function get_string() { - $_strReturn = ''; - $this->init(); - $_strReturn .= "\n_init>\n"; - $_strReturn .= $this->fields; - $_strReturn .= "\n\n"; - return $_strReturn; - } -} - -/** - * Div - * - * @package htmlobject - * @author Alexander Kuballa akuballa@openqrm-enterprise.com - * @copyright Copyright (c) 2008, Alexander Kuballa - * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * @version 1.0 - */ -class htmlobject_div extends htmlobject -{ -/** -* text -* @access private -* @var string -*/ -var $text = ''; - - /** - * Get html element as string - * - * @acess public - * @return string - */ - function get_string() { - $_strReturn = ''; - $this->init(); - $_strReturn = "\n_init>$this->text"; - return $_strReturn; - } -} - -/** - * Box - * - * @package htmlobject - * @author Alexander Kuballa akuballa@openqrm-enterprise.com - * @copyright Copyright (c) 2008, Alexander Kuballa - * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * @version 1.0 - */ -class htmlobject_box extends htmlobject -{ - -/** -* Label (Title) of box -* @access public -* @var string -*/ -var $label = ''; -/** -* Label for input -* @access public -* @var string -*/ -var $label_for = ''; -/** -* content -* @access public -* @var object | string -*/ -var $content = ''; -/** -* css class for left box -* @access public -* @var string -*/ -var $css_left = 'left'; -/** -* css class for right box -* @access public -* @var string -*/ -var $css_right = 'right'; - - /** - * init attribs - * - * @acess protected - */ - function init() { - parent::init(); - if ($this->content == '') { $this->content = ' '; } - if ($this->css_left != '') { $this->css_left = ' class="'.$this->css_left.'"'; } - if ($this->css_right != '') { $this->css_right = ' class="'.$this->css_right.'"'; } - } - - /** - * Get html element as string - * - * @acess public - * @return string - */ - function get_string() { - $_strReturn = ''; - $this->init(); - $_strReturn .= "\n_init.">"; - - if($this->label != '') { - $_strReturn .= "\ncss_left.">"; - if(is_object($this->content) && isset($this->content->id)) { $_strReturn .= ''; } - if(is_string($this->content)) { - if($this->label_for != '') { $_strReturn .= ''; } - else { $_strReturn .= $this->label; } - } - $_strReturn .= ""; - } - $_strReturn .= "\ncss_right.">"; - - if(is_object($this->content)) { $_strReturn .= $this->content->get_string(); } - if(is_string($this->content)) { $_strReturn .= $this->content; } - - $_strReturn .= ""; - $_strReturn .= "\n
     
    "; - $_strReturn .= "\n"; - return $_strReturn; - } -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.debug.class.php b/openQRM-5.3.50-CE/src/web/base/class/htmlobject.debug.class.php deleted file mode 100644 index d34c224..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.debug.class.php +++ /dev/null @@ -1,102 +0,0 @@ - - */ -//---------------------------------------------------------------------------------------- - -class debug -{ -static protected $debug = false; -static protected $panic = false; -static protected $_infos = array(); - //-------------------------------- - /** - * Start Debugger - * - * @access public - */ - //-------------------------------- - public static function start($panic = false) { - if($panic === true) { - self::$panic = true; - } - self::$debug = true; - } - //-------------------------------- - /** - * Stop Debugger - * - * @access public - */ - //-------------------------------- - public static function stop() { - self::$debug = false; - } - //-------------------------------- - /** - * Stop Debugger - * - * @access public - */ - //-------------------------------- - public static function active() { - return self::$debug; - } - - //-------------------------------- - /** - * Add string to debugger info array - * - * @access public - * @param string $msg - * @param string $state - */ - //-------------------------------- - public static function add( $msg, $state = 'INFO' ) { - if(self::active()) { - #if((self::$panic === true) || (self::$panic === false && $state != strtolower('INFO'))) { - $debug = debug_backtrace(); - self::$_infos[] = $state.' '.$debug[1]['class'].'->'.$debug[1]['function'].'() '.$msg; - #for($i = 2; $i < count($debug); $i++) { - # self::$_infos[] = '---- line '.$debug[$i]['line'].' : '.$debug[$i]['class'].'->'.$debug[$i]['function'].'()'; - #} - #} - } - } - //-------------------------------- - /** - * Print Debuger Info - * - * @access public - */ - //-------------------------------- - public static function flush() { - if(self::$debug === true) { - print "Debugger Info\n"; - print "
    \n";
    -			foreach(self::$_infos as $msg) {
    -				print $msg."\n";
    -			}
    -			print '
    '; - // unset array - self::$_infos = array(); - } - } - - - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.form.class.php b/openQRM-5.3.50-CE/src/web/base/class/htmlobject.form.class.php deleted file mode 100644 index 20f1039..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.form.class.php +++ /dev/null @@ -1,637 +0,0 @@ - - */ - -class htmlobject_formbuilder extends http -{ -/** -* string to mark value as required -* @access public -* @var string -*/ -var $str_required = '*'; -/** -* store data -* @access protected -* @var string -*/ -var $data = array(); -/** -* store request -* @access protected -* @var array -*/ -var $request = null; -/** -* store errors -* @access protected -* @var array|null -*/ -var $check_request = null; - - - //--------------------------------------- - /** - * Constructor - * - * Good to know: - * If form is cleared (inputs are empty) and then submitted, - * form will load preset values and will not appear empty. - * No Errors will be displayed. Form will appear like opening - * it for the first time. - * - * - * - * $data = array(); - * $data['name'] = array (); - * $data['name']['label'] = 'Name'; - * $data['name']['required'] = true; - * // validation - * $data['name']['validate'] = array (); - * $data['name']['validate']['regex'] = '/^[a-z0-9~._-]+$/i'; - * $data['name']['validate']['errormsg'] = 'string must be a-z0-9~._-'; - * // build object - * $data['name']['object'] = array (); - * $data['name']['object']['type'] = 'htmlobject_input'; - * $data['name']['object']['attrib'] = array(); - * $data['name']['object']['attrib']['type'] = 'text'; - * $data['name']['object']['attrib']['name'] = 'name'; - * $data['name']['object']['attrib']['value'] = 'somevalue'; - * - * $formbuilder = new htmlobject_formbuilder( $data ); - * - * // Actions - * // no errors, do something - * if(!$formbuilder->get_errors()) { - * $values = $formbuilder->get_request_as_array(); - * print_r($values); - * } - * - * $template = new Template_PHPLIB(); - * $template->debug = 0; - * $template->setFile('t', 'html/template.html'); - * $template->setVar($formbuilder->get_template_array()); - * - * echo $template->parse('out', 't'); - * - * - * @acess public - * @param array $data - */ - //--------------------------------------- - function __construct($data=null) { - - if(debug::active()) { - foreach($data as $key => $value) { - if(!isset($value['object'])) { - debug::add('["'.$key.'"]["object"] not set', 'ERROR'); - } - if(!isset($value['object']['type'])) { - debug::add('["'.$key.'"]["object"]["type"] not set', 'ERROR'); - } - if(!isset($value['object']['attrib'])) { - debug::add('["'.$key.'"]["object"]["attrib"] not set', 'ERROR'); - } - if(!isset($value['object']['attrib']['name'])) { - debug::add('["'.$key.'"]["object"]["attrib"]["name"] not set', 'ERROR'); - } - elseif ($value['object']['attrib']['name'] == '') { - debug::add('["'.$key.'"]["object"]["attrib"]["name"] is empty', 'ERROR'); - } - if(isset($value['validate']) && - !isset($value['validate']['errormsg']) - ) { - debug::add('["'.$key.'"]["validate"]["errormsg"] not set', 'ERROR'); - } - elseif (isset($value['validate']) && - $value['validate']['errormsg'] == '' - ) { - debug::add('["'.$key.'"]["validate"]["errormsg"] is empty', 'NOTICE'); - } - } - } - - $this->data = $data; - - } - //---------------------------------------------------------------- Public Section - //--------------------------------------- - /** - * init - * - * @acess public - * @return array - */ - //--------------------------------------- - function init() { - - // only init if request not set - // set_request() will set array - if(!isset($this->request)) { - // filter quots (") - $this->add_request_filter(array( - array( 'pattern' => '~\r\n~', 'replace' => '\n'), - array( 'pattern' => '~<~', 'replace' => '<'), - array( 'pattern' => '~"~', 'replace' => '"'), - array( 'pattern' => '~\"~', 'replace' => '\"'), - )); - $this->set_request(); - $this->set_check_request(); - } - - } - //--------------------------------------- - /** - * get request values as array - * - * @acess public - * @return array - */ - //--------------------------------------- - function get_request_array($arg=null) { - - $this->init(); - if(count($this->request) > 0) { - return $this->request; - } - - } - - //--------------------------------------- - /** - * get request values as url params - * - * @acess public - * @return string - */ - //--------------------------------------- -// function get_request_string() { - function get_request_string($firstchar = '?', $excludes = Array()) { - $this->init(); - - $strReturn = ''; - foreach ($this->data as $data) { - if(isset($data['object']['attrib']['name'])) { - $name = $this->unindex_array($data['object']['attrib']['name']); - $request = '$this->request'.$this->string_to_index($name); - if(eval("return isset($request);")) { - if(is_array(eval("return $request;"))) { - foreach(eval("return $request;") as $key => $value) { - $strReturn .= '&'.$name.'['.$key.']='.$value; - } - } - else { - $strReturn .= '&'.$name.'='. eval("return $request;"); - } - } - } - } - return $strReturn; - - } - - //--------------------------------------- - /** - * get array for html template - * - * will return - * array[$key] = html element as string - * $key is - * - * @acess public - * @return array of strings - */ - //--------------------------------------- - function get_template_array() { - $this->init(); - - $ar = array(); - foreach ($this->data as $key => $data) { - $box = new htmlobject_box(); - $box->label = $this->get_label($data); - $box->content = $this->get_htmlobject_object($data); - $box->css = 'htmlobject_box'; - $ar = array_merge($ar, array($key => $box->get_string())); - } - return $ar; - - } - - //--------------------------------------- - /** - * get errors - * - * will return array('name' => 'errormsg', ...) - * or null if no error occured - * - * @acess public - * @return array|null - */ - //--------------------------------------- - function get_errors() { - - $this->init(); - return $this->check_request; - - } - - //---------------------------------------------------------------- Protected Section - //--------------------------------------- - /** - * set values from http request as array - * - * @acess protected - */ - //--------------------------------------- - function set_request() { - - $arReturn = array(); - foreach ($this->data as $data) { - if(isset($data['object']['attrib']['name'])) { - // set vars - $name = $this->unindex_array($data['object']['attrib']['name']); - if(debug::active()) { - debug::add($name); - } - $request = $this->get_request($name); - if($request) { - $ar = '$arReturn'.$this->string_to_index($name); - eval("return $ar = \"$request\";"); - if(is_array($request)) { - eval("return $ar = array();"); - foreach($request as $key => $value) { - $tar = $ar.'["'.$key.'"]'; - eval("return $tar = \"$value\";"); - } - } else { - eval("return $ar = \"$request\";"); - } - } - } - } - - // set request even when Array is - // empty - array is needed for - // init() request not set test - $this->request = $arReturn; - - } - - //--------------------------------------- - /** - * Check $this->data request - * - * Returns array of errors if - * request does not match given regex. - * Empty if no missmatch occured. - * - * @acess protected - * @return array('name'=> 'msg') - */ - //--------------------------------------- - function set_check_request() { - - $arReturn = array(); - foreach ($this->data as $data) { - if( - isset($data['validate']) && - isset($data['validate']['regex']) && - isset($data['validate']['errormsg']) && - isset($data['object']['attrib']['name']) && - count($this->request) > 0 - ) { - - // set vars - $regex = $data['validate']['regex']; - $name = $data['object']['attrib']['name']; - - $request = '$this->request'.$this->string_to_index($name); - if(eval("return isset($request);") && isset($regex) && $regex != '') { - $matches = regex::match($regex, eval("return $request;")); - if(!$matches) { - $this->check_request[$name] = $data['validate']['errormsg']; - } - } - elseif (eval("return !isset($request);") && isset($data['required']) && $data['required'] == true) { - $this->check_request[$name] = 'null'; - } - } - } - - } - - //--------------------------------------- - /** - * get html objects - * - * @acess protected - * @param array $data - * @return object|null - */ - //--------------------------------------- - function get_htmlobject_object($data) { - - if( - isset($data['object']) && - isset($data['object']['type']) && - isset($data['object']['attrib']) && - isset($data['object']['attrib']['name']) - ) { - - // set vars - $object = strtolower($data['object']['type']); - $attribs = $data['object']['attrib']; - $name = $data['object']['attrib']['name']; - - // build object - switch($object) { - case 'htmlobject_input': - case 'htmlobject_select': - case 'htmlobject_textarea': - case 'htmlobject_button': - $html = $this->make_htmlobject($object, $attribs); - break; - default: - if(debug::active()) { - debug::add($object.' is not supported', 'ERROR'); - } - break; - } - - // set request - if( isset($this->request) && count($this->request) > 0) { - $request = '$this->request'.$this->string_to_index($name); - } - - // build return - if( - isset($request) && - $request != '' && - isset($html) - ) { - // add request to object - switch($object) { - case 'htmlobject_input': - $html = $this->handle_htmlobject_input($html, $request); - break; - case 'htmlobject_select': - $html = $this->handle_htmlobject_select($html, $request); - break; - case 'htmlobject_textarea': - $html = $this->handle_htmlobject_textarea($html, $request); - break; - } - return $html; - } - elseif(isset($html)) { - return $html; - } else { - return ''; - } - } - - } - - //--------------------------------------- - /** - * make html objects - * - * @acess protected - * @param string $object - * @param array $attrib - * @return object - */ - //--------------------------------------- - function make_htmlobject($object, $attrib) { - - // build htmlobject - $html = new $object(); - foreach ($attrib as $key => $param) { - $html->$key = $param; - } - // make sure id is set - $html->set_id(); - return $html; - - } - - //------- Object Section - - //--------------------------------------- - /** - * handle htmlobject_input - * - * @acess protected - * @param object $html - * @param array $attrib - * @param string $request - * @return object - */ - //--------------------------------------- - function handle_htmlobject_input($html, $request) { - - $html->type = strtolower($html->type); - switch($html->type) { - case 'submit': - case 'reset': - case 'file': - case 'image': - case 'button': - // do nothing - break; - case 'radio': - if( - eval("return isset($request);") && - eval("return $request;") == $html->value - ) { - $html->checked = true; - } else { - $html->checked = false; - } - break; - case 'checkbox': - if( - eval("return isset($request);") && - eval("return $request;") != '' - ) { - $html->checked = true; - } else { - $html->checked = false; - } - break; - case 'text': - case 'hidden': - case 'password': - if(eval("return isset($request);")) { - $html->value = str_replace('"', '"', eval("return $request;")); - } else { - $html->value = ''; - } - break; - } - return $html; - - } - - //--------------------------------------- - /** - * handle htmlobject_select - * - * @acess protected - * @param object $html - * @param string $request - * @return object - */ - //--------------------------------------- - function handle_htmlobject_select($html, $request) { - - if(eval("return isset($request);")) { - if(is_array(eval("return $request;"))) { - $html->selected = eval("return $request;"); - } else { - $html->selected = array(eval("return $request;")); - } - } - return $html; - - } - - //--------------------------------------- - /** - * handle htmlobject_textarea - * - * @acess protected - * @param object $html - * @param string $request - * @return object - */ - //--------------------------------------- - function handle_htmlobject_textarea($html, $request) { - - if(eval("return isset($request);")) { - $html->text = str_replace('<', '<', eval("return $request;")); - } else { - $html->text = ''; - } - return $html; - - } - - //--------------------------------------- - /** - * handle label - * - * @acess protected - * @param array $data - * @return string - */ - //--------------------------------------- - function get_label($data) { - - $label = ''; - if( - isset($data['label']) && $data['label'] != '' && - isset($data['object']['attrib']['name']) - ) { - $label = $data['label']; - $name = $data['object']['attrib']['name']; - // mark error - if($this->check_request) { - if(array_key_exists($name, $this->check_request)) { - $label = ''.$label.''; - } - } - // mark required - if(isset($data['required']) && $data['required'] === true) { - $label = $label.' '.$this->str_required; - } - } - return $label; - - } - //-------------------------- Helpers - - //--------------------------------------- - /** - * get tab_request as html inputs - * - * @acess protected - * @param array $arValues - * @return string - */ - //--------------------------------------- - function get_tab_request_as_input($arValues = array()) { - - $strReturn = ''; - $arValues = array_merge($this->tab_request, $arValues); - foreach ($arValues as $key => $value) { - $strReturn .= $this->get_input($key, $value, 'hidden'); - } - return $strReturn; - - } - - //--------------------------------------- - /** - * get htmlobject_input as string - * - * @acess protected - * @param string $name - * @param string $value - * @param enum $type - * @return string - */ - //--------------------------------------- - function get_input($name, $value, $type = 'hidden') { - - $value = str_replace('"', '"', $value); - $value = str_replace('<', '<', $value); - - $html = new htmlobject_input(); - $html->name = $name; - $html->value = $value; - $html->type = $type; - - return $html->get_string(); - } - - //--------------------------------------- - /** - * get htmlobject_button as string - * - * @acess protected - * @param string $name - * @param string $value - * @param string $label - * @return string - */ - //--------------------------------------- - function get_button($name, $value, $label) { - - $html = new htmlobject_button(); - $html->name = $name; - $html->value = $value; - $html->type = 'submit'; - $html->label = $label; - - return $html->get_string(); - } - - -} // end class diff --git a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.head.class.php b/openQRM-5.3.50-CE/src/web/base/class/htmlobject.head.class.php deleted file mode 100644 index 8628b24..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.head.class.php +++ /dev/null @@ -1,155 +0,0 @@ - -*/ -class htmlobject_doctype -{ -/** -* Doctype -* @access public -* @var string ['html', 'xhtml'] -*/ -var $doctype = 'html'; -/** -* Doctypemodel -* @access public -* @var string ['strict', 'transitional', 'frameset'] -*/ -var $doctypemodel = 'transitional'; - -function get_doctype() { - -$this->doctype = strtolower($this->doctype); -$this->doctypemodel = strtolower($this->doctypemodel); - -if($this->doctype == 'xhtml' && $this->doctypemodel == 'strict') { -$_strReturn = ' - - -'; } - -if($this->doctype == 'xhtml' && $this->doctypemodel == 'transitional') { -$_strReturn = ' - - -'; } - -if($this->doctype == 'xhtml' && $this->doctypemodel == 'frameset') { -$_strReturn = ' - - -'; } - -if($this->doctype == 'html' && $this->doctypemodel == 'strict') { -$_strReturn = ' - - -'; } - -if($this->doctype == 'html' && $this->doctypemodel == 'transitional') { -$_strReturn = ' - - -'; } - -if($this->doctype == 'html' && $this->doctypemodel == 'frameset') { -$_strReturn = ' - - -'; } - -return $_strReturn; -} - - -} - - -class htmlobject_head extends htmlobject_doctype -{ -/** -* Title of page -* @access public -* @var string -*/ -var $title = ''; - -/** -* internal use only -*/ -var $_meta = array(); -var $_style = array(); -var $_script = array(); - - /** - * get head values as string - * @access public - * @return string - */ - function get_string() { - - if(count($this->_style) > 0) { - $this->add_meta('Content-Style-Type', 'text/css'); - } - if(count($this->_script) > 0) { - $this->add_meta('Content-Script-Type', 'text/javascript'); - } - $_strReturn = "\n"; - $_strReturn .= $this->get_doctype(); - $_strReturn .= "\n"; - $_strReturn .= implode("\n", $this->_meta)."\n"; - $_strReturn .= implode("\n", $this->_style)."\n"; - $_strReturn .= implode("\n", $this->_script)."\n"; - $_strReturn .= ''.$this->title."\n"; - $_strReturn .= "\n"; - - return $_strReturn; - } - /** - * Add metatag to head - * @access public - * @param $value string - * @param $content string - * @param $type string [http-equiv, name] - */ - function add_meta ($value, $content ,$type = 'http-equiv') { - $this->_meta[] = ''; - } - /** - * Add external stylesheet to head - * @access public - * @param $path string [url] - * @param $media string [all, screen, print] - */ - function add_style ($path, $media='all') { - $this->_style[] = ''; - } - /** - * Add external script to head - * @access public - * @param $path string [url] - */ - function add_script ($path) { - $this->_script[] = ''; - } -} - - - diff --git a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.http.class.php b/openQRM-5.3.50-CE/src/web/base/class/htmlobject.http.class.php deleted file mode 100644 index 9bd5782..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.http.class.php +++ /dev/null @@ -1,264 +0,0 @@ - - */ -//---------------------------------------------------------------------------------------- - -class http -{ -/** -* regex pattern for httprequest (crosssitescripting) -* @access protected -* @var array -*/ -var $request_filter; - - - //--------------------------------------------------------------- - /** - * returns http request as cleaned string - * string is empty when request not set - * @access public - * @param $arg string - * @return string | array [empty if request not set] - */ - //--------------------------------------------------------------- - function get_request($arg) - { - if(debug::active()) { - debug::add($arg); - } - $Req = '$_REQUEST'.$this->string_to_index($arg); - - if(eval("return isset($Req);") && eval("return $Req;") != '') { - if(is_array(eval("return $Req;"))) { - return $this->get_request_array(eval("return $Req;")); - } else { - return $this->filter_request(eval("return $Req;")); - } - } else { - return ''; - } - - } - - //------------------------------------------------- - /** - * get values from http request as array - * @acess protected - * @return array - */ - //------------------------------------------------- - function get_request_array($arg) { - - debug::add($arg); - - $arReturn = array(); - if(is_array($arg)) { - foreach($arg as $key => $value) { - if(is_array($value)) { - $arReturn[$key] = $this->get_request_array($value); - } - if(is_string($value)) { - $arReturn[$key] = $this->filter_request($value); - } - } - } - if(is_string($arg)) { - $arReturn[$key] = $this->filter_request($value); - } - return $arReturn; - } - - //--------------------------------------------------------------- - /** - * set filter for request handling (XSS) - * - * - * $http = new http(); - * $http->set_request_filter(array( - * array ( 'pattern' => '~\r\n~', 'replace' => '\n'), - * ); - * - * - * @access public - * @param array $arg - */ - //--------------------------------------------------------------- - function set_request_filter($arg = array()) { - if(isset($arg) && count($arg) > 0) { - $this->request_filter = array(); - foreach($arg as $key => $value) { - if(isset($value['pattern'])) { - if(!isset($value['replace'])) { - debug::add('could not find array key ["replace"]', 'NOTICE'); - $value['replace'] = ''; - } - $this->request_filter[] = array('pattern' => $value['pattern'], 'replace' => $value['replace']); - } else { - debug::add('could not find array key ["pattern"]', 'ERROR'); - } - } - } else { - debug::add('nothing to do', 'NOTICE'); - } - } - - //--------------------------------------------------------------- - /** - * add filter for request handling - * @access public - * @param array $arg - */ - //--------------------------------------------------------------- - function add_request_filter( $arg ) { - - $tmp = $this->request_filter; - $this->set_request_filter($arg); - if($tmp) { - $this->request_filter = array_merge($tmp, $this->request_filter); - } - - } - - - //--------------------------------------------------------------- - /** - * performes preg_replace - * @access protected - * @param string $arg - * @return string - */ - //--------------------------------------------------------------- - function filter_request($arg) { - if(is_string($arg)) { - $str = ''; - $arg = stripslashes($arg); - if(is_array($this->request_filter)) { - foreach ($this->request_filter as $reg) { - $arg = regex::replace($reg['pattern'], $reg['replace'], $arg); - } - $str = $arg; - } else { - debug::add('no filter set - use set_request_filter()', 'NOTICE'); - $str = $arg; - } - debug::add($arg.' return '.$str); - return $str; - } else { - debug::add($arg.' is not type string', 'ERROR'); - } - } - - //--------------------------------------------------------------- - /** - * returns http request [POST/GET] as string - * @access public - * @param $firstchar string - * @param $excludes array - * @return string [empty if request empty] - */ - //--------------------------------------------------------------- - function get_request_string($firstchar = '?', $excludes = array()) { - $type = array('$_POST','$_GET'); - $_strReturn = ''; - foreach($type as $request) { - foreach(eval("return $request;") as $name => $foo) { - if(in_array($name, $excludes) == false) { - $value = http_request($name); - if(is_array($value)) { - foreach($value as $key => $val) { - $_strReturn .= '&'.$name.'['.$key.']='.$val; - } - } else { - $_strReturn .= '&'.$name.'='.$value; - } - } - } - } - if($_strReturn != '') $_strReturn = preg_replace('/^&/', $firstchar, $_strReturn); - return $_strReturn; - } - - //------------------------------------------------- - /** - * transform string to array index string - * @acess public - * @param array $name - * @return string - */ - //------------------------------------------------- - function string_to_index($arg) { - - $strReturn = ''; - - // replace unindexed array - $arg = $this->unindex_array($arg); - $regex = '~(\[.*\])~'; - - preg_match($regex, $arg, $matches); - if($matches) { - $str = '['.preg_replace('~\[.*\]~', '', $arg).']'.$matches[0]; - } - else { - $str = '['.$arg.']'; - } - // add quots to make it array - $str = str_replace('[', '["', $str); - $str = str_replace(']', '"]', $str); - - return $str; - - } - - //------------------------------------------------- - /** - * remove unindexed array - * @acess protected - * @param array $name - * @return string - */ - //------------------------------------------------- - function unindex_array($name) { - return preg_replace('~\[]$~', '', $name); - } - - //--------------------------------------------------------------- - /** - * header redirect - * tries php header redirect, - * on fail js redirect, - * on fail meta redirect - * - * @access public - * @param $url string - */ - //--------------------------------------------------------------- - function redirect($url){ - if (!headers_sent()){ - header('Location: '.$url); exit; - } else { - echo ''; - echo ''; exit; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.preloader.class.php b/openQRM-5.3.50-CE/src/web/base/class/htmlobject.preloader.class.php deleted file mode 100644 index 5c4395a..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.preloader.class.php +++ /dev/null @@ -1,37 +0,0 @@ - -*/ -class htmlobject_preloader extends htmlobject -{ - function start($string = 'Loading ...') { - echo ' - - - '; - flush(); - } - - function stop() { - echo ' - - '; - } -} \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.table.class.php b/openQRM-5.3.50-CE/src/web/base/class/htmlobject.table.class.php deleted file mode 100644 index a9a1d20..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.table.class.php +++ /dev/null @@ -1,1157 +0,0 @@ - -*/ -//---------------------------------------------------------------------------------------- - -class htmlobject_table extends htmlobject -{ -/** -* align -* @access public -* @var enum (left | center | right) -*/ -var $align = ''; -/** -* table border -* @access public -* @var int -*/ -var $border = ''; -/** -* table backgroundcolor -* @access public -* @var HEX -*/ -var $bgcolor = ''; -/** -* cellpadding -* @access public -* @var int -*/ -var $cellpadding; -/** -* cellspacing -* @access public -* @var int -*/ -var $cellspacing; -/** -* frame -* @access public -* @var enum (void | above | below | hsides | lhs | rhs | vsides | box | border) -*/ -var $frame = ''; -/** -* rules -* @access public -* @var enum (none | groups | rows | cols | all) -*/ -var $rules = ''; -/** -* summary -* @access public -* @var string -*/ -var $summary = ''; -/** -* width -* @access public -* @var int -*/ -var $width = ''; - -/** -* Content of table -* @access public -* @var array -*/ -var $arr_table = array(); - - - function init() { - parent::init(); - if ($this->align != '') { $this->_init .= ' align="'.$this->align.'"'; } - if (isset($this->border) && $this->border !== '') { $this->_init .= ' border="'.$this->border.'"'; } - if ($this->bgcolor != '') { $this->_init .= ' bgcolor="'.$this->bgcolor.'"'; } - if (isset($this->cellpadding) && $this->cellpadding !== '') { $this->_init .= ' cellpadding="'.$this->cellpadding.'"'; } - if (isset($this->cellspacing) && $this->cellspacing !== '') { $this->_init .= ' cellspacing="'.$this->cellspacing.'"'; } - if ($this->frame != '') { $this->_init .= ' frame="'.$this->frame.'"'; } - if ($this->rules != '') { $this->_init .= ' rules="'.$this->rules.'"'; } - if ($this->summary != '') { $this->_init .= ' summary="'.$this->summary.'"'; } - if ($this->width != '') { $this->_init .= ' width="'.$this->width.'"'; } - } - - function get_string() { - $_strReturn = ''; - $this->init(); - $_strReturn = "\n_init>"; - foreach($this->arr_table as $tr) { - if(is_object($tr) == true && get_class($tr) == 'htmlobject_tr') { - $_strReturn .= $tr->get_string(); - } - elseif(is_string($tr) == true) { - $_strReturn .= $tr; - } - else { - $_strReturn .= 'tr type not defined'; - } - } - $_strReturn .= "\n"; - return $_strReturn; - } - - function add($tr) { - $this->arr_table[] = $tr; - } - -} - -//---------------------------------------------------------------------------------------- -/** - * Tr - * - * @package htmlobjects - * @author Alexander Kuballa akuballa@openqrm-enterprise.com - * @copyright Copyright (c) 2009, Alexander Kuballa - * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * @version 1.0 -*/ -//---------------------------------------------------------------------------------------- - -class htmlobject_tr extends htmlobject_table -{ -/** -* Content of tr -* @access public -* @var string -*/ -var $arr_tr = array(); - - - function get_string() { - $_strReturn = ''; - $this->init(); - $_strReturn = "\n_init>"; - foreach($this->arr_tr as $td) { - if(is_object($td) == true && get_class($td) == 'htmlobject_td') { - $_strReturn .= $td->get_string(); - } - elseif(is_string($td) == true) { - $_strReturn .= $td; - } - else { - $_strReturn .= ''; - } - } - $_strReturn .= "\n"; - return $_strReturn; - } - - function add($td) { - $this->arr_tr[] = $td; - } - -} - -//---------------------------------------------------------------------------------------- -/** - * Td - * - * @package htmlobjects - * @author Alexander Kuballa akuballa@openqrm-enterprise.com - * @copyright Copyright (c) 2009, Alexander Kuballa - * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * @version 1.0 -*/ -//---------------------------------------------------------------------------------------- - -class htmlobject_td extends htmlobject_tr -{ -/** -* colspan -* @access public -* @var int -*/ -var $colspan = ''; -/** -* td type -* @access public -* @var enum (td,th) -*/ -var $type = 'td'; -/** -* Content of td -* @access public -* @var string -*/ -var $text = ''; - - - function init() { - parent::init(); - if ($this->colspan != '') { $this->_init .= ' colspan="'.$this->colspan.'"'; } - } - - function get_string() { - $_strReturn = ''; - $this->init(); - $_strReturn = "\n<$this->type$this->_init>"; - $_strReturn .= $this->text; - $_strReturn .= "type>"; - return $_strReturn; - } -} - -//---------------------------------------------------------------------------------------- -/** - * Tablebuilder - * - * @package htmlobjects - * @author Alexander Kuballa akuballa@openqrm-enterprise.com - * @copyright Copyright (c) 2009, Alexander Kuballa - * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * @version 1.0 -*/ -//---------------------------------------------------------------------------------------- - -class htmlobject_table_builder extends htmlobject_table -{ -/** -* head row of table (th) -* -* $head = array(); -* $head['id'] = array(); -* $head['id']['title'] = 'id'; -* $head['date'] = array(); -* $head['date']['title'] = 'Datum'; -* $head['date']['sortable'] = false; -* $head['date']['hidden'] = true; -* -* $table = new htmlobject_table_builder(); -* $table->head = $head; -* -* @access public -* @var array -*/ -var $head = array(); -/** -* table body -* -* $body = array(); -* $body[] = array('id' => 'value1', 'date' => 'value2', ...) -* $body[] = array('id' => 'value1', 'date' => 'value2', ...) -* -* $table = new htmlobject_table_builder(); -* $table->body = $body; -* -* @access public -* @var array -*/ -var $body = array(); -/** -* bottom row of table -* -* $bottom = array(); -* $bottom[] = 'delete'; -* $bottom[] = 'sort'; -* -* $table = new htmlobject_table_builder(); -* $table->bottom = $bottom; -* -* @access public -* @var array -*/ -var $bottom = array(); -/** -* name for submit buttons -* @access public -* @var string -*/ -var $bottom_buttons_name = 'action'; - -/** -* ------------------------------------------------------------- Identifier Section -*/ -/** -* field to add value to checkbox -* @access public -* @var string -*/ -var $identifier = ''; -/** -* type of identifier input -* @access public -* @var enum $identifier_type possible values [checkbox, radio] -*/ -var $identifier_name = 'identifier'; -/** -* type of identifier input -* @access public -* @var enum $identifier_type possible values [checkbox, radio] -*/ -var $identifier_type = 'checkbox'; -/** -* array of identifiers to be checked -* @access public -* @var array() -*/ -var $identifier_checked = array(); -/** -* array of identifiers to be disabled -* @access public -* @var array() -*/ -var $identifier_disabled = array(); - -/** -* ------------------------------------------------------------- CSS Section -*/ -/** -* global prefix for css classes -* @access public -* @var string -*/ -var $css_prefix = 'htmlobject_'; - -/** -* ------------------------------------------------------------- Form Section -*/ -/** -* url to process request -* Form disabled if empty -* -* $thisfile = basename($_SERVER['PHP_SELF']); -* $table = new htmlobject_table_builder(); -* $table->form_action = $thisfile; -* -* @access public -* @var string -*/ -var $form_action = ''; -/** -* first limit -* -* // to change initial value to 10 -* $table = new htmlobject_table_builder('somefield','', 10); -* -* @access private -* @var string -*/ -var $limit = 20; -/** -* select with limit values -* -* $limit_select = array( -* array("value" => 10, "text" => 10), -* array("value" => 20, "text" => 20), -* array("value" => 30, "text" => 30), -* ); -* -* $table = new htmlobject_table_builder(); -* $table->limit_select = $limit_select; -* -* @access public -* @var array -*/ -var $limit_select = array(); -/** -* offset -* @access public -* @var int -*/ -var $offset = 0; -/** -* maximum -* @access public -* @var int -*/ -var $max = 0; -/** -* field to be sorted -* @access public -* @var int -*/ -var $sort = ''; -/** -* extra params for table head sort function -* disabled if not set -* @access public -* @var string -*/ -var $sort_params; -/** -* sort order -* @access public -* @var enum $order possible values [ASC, DESC] -*/ -var $order = ''; -var $dorder = 'ASC'; - -/** -* use array_sort to sort output -* @access public -* @var bol -*/ -var $autosort = false; - -/** -* ------------------------------------------------------------- Lang Section -*/ -/** -* capation of refresh button -* @access public -* @var string -*/ -var $lang_button_refresh = 'refresh'; -/** -* label for sort select -* @access public -* @var string -*/ -var $lang_label_sort = 'order by'; -/** -* label for offset input -* @access public -* @var string -*/ -var $lang_label_offset = 'offset'; -/** -* label for limit select -* @access public -* @var string -*/ -var $lang_label_limit = 'limit'; -/** -* text for nolimit option -* @access public -* @var string -*/ -var $lang_option_nolimit = 'none'; -/** -* Title for identifier Select function -* @access public -* @var string -*/ -var $lang_select_title = 'Select:'; -/** -* identifier Select function (all) -* @access public -* @var string -*/ -var $lang_select_all = 'all'; -/** -* identifier Select function (none) -* @access public -* @var string -*/ -var $lang_select_none = 'none'; -/** -* identifier Select function (none) -* @access public -* @var string -*/ -var $lang_select_invert = 'inverted'; - -/** -* ------------------------------------------------------------- Private Section -*/ -/** -* number of cols -* @access private -* @var int -*/ -var $_num_cols; -/** -* output body array -* @access private -* @var array -*/ -var $_body = array(); -/** -* additional headrows -* @access private -* @var array -*/ -var $_headrow = array(); -/** -* additional bottomrows -* @access private -* @var array -*/ -var $_bottomrow = array(); -/** -* internal prefix for posted vars -* @access private -* @var array -*/ -var $_var_prefix; - - - //---------------------------------------------------------------------------------------- - /** - * init htmlobject_table_builder vars from Request - * @access public - * @param string $sort key for initial sort - sort functionality is disabled if empty - * @param enum $order initial sort order [ASC, DESC] - * @param int $limit initial limit - * @param int $offset initial offset - * @param string $var_prefix prefix for posted vars - */ - //---------------------------------------------------------------------------------------- - function htmlobject_table_builder($sort = '', $orderr = '', $limit = '', $offset = '', $var_prefix = 'table_') { - - $this->_var_prefix = $var_prefix; - - // filter request - remove all none digits - $replace_tmp = $this->request_filter; - $this->request_filter = array(array('pattern' => '~[^0-9]~', 'replace' => '')); - - if($this->get_request($this->_var_prefix.'limit') != '') { - $this->limit = $this->get_request($this->_var_prefix.'limit'); - } - else if($limit != '') { - $this->limit = $limit; - } - if($this->get_request($this->_var_prefix.'max') != '') { - $this->max = $this->get_request($this->_var_prefix.'max'); - } - if($this->get_request($this->_var_prefix.'offset') != '') { - $this->offset = $this->get_request($this->_var_prefix.'offset'); - } - else if ($offset != '') { - $this->offset = $offset; - } - - // reset request filter - $this->request_filter = $replace_tmp; - - if($this->get_request($this->_var_prefix.'order') != '') { - $this->order = $this->get_request($this->_var_prefix.'order'); - } else if($orderr != '') { - $this->order = $orderr; - } else { - $this->order = $this->dorder; - } - if($this->get_request($this->_var_prefix.'sort') != '') { - $this->sort = $this->get_request($this->_var_prefix.'sort'); - } - else if($sort != '') { - $this->sort = $sort; - } - - //------------------------------------------------------------------- set new offset - if($this->get_request($this->_var_prefix.'action') != '') { - switch ($this->get_request($this->_var_prefix.'action')) { - case '<': $this->offset = $this->offset - $this->limit; break; - case '<<': $this->offset = 0; break; - case '>': $this->offset = $this->offset + $this->limit; break; - case '>>': $this->offset = $this->max - $this->limit; break; - case $this->lang_button_refresh: break; - } - } - //------------------------------------------- check offset - if($this->offset >= $this->max ) { - $this->offset = $this->max - $this->limit; - } - if($this->offset < 0 ) { - $this->offset = 0; - } - } - - //---------------------------------------------------------------------------------------- - /** - * init basic values _body, _num_cols - * @access public - */ - //---------------------------------------------------------------------------------------- - function init_table_builder() { - - $minus = 0; - // Execute head array special key values - foreach($this->head as $key => $value) { - // special key hidden - if(@array_key_exists('hidden', $this->head[$key]) == true) { - if($this->head[$key]['hidden'] === true) { - $minus = $minus+1; - } - } - } - $this->_num_cols = count($this->head) - $minus; - if($this->identifier != '') { $this->_num_cols = $this->_num_cols +1; } - - // Sortfunction eabled? - if($this->sort != '') { - // use autosort ? - if($this->autosort == true) { $this->arr_sort(); } - // max still untouched? - if($this->max == 0) { $this->max = count($this->body); } - // Input bigger than Output? - if(count($this->body) > $this->limit && $this->limit != 0) { - // max smaller than limit + offset? - if(($this->offset + $this->limit) < $this->max ) { - $max = $this->offset + $this->limit; - } else { $max = $this->max; } - // Transfer Input to Output - for($i = $this->offset; $i < $max; $i++) { - $this->_body[$i] = $this->body[$i]; - } - } else { $this->_body = $this->body; } - } else { $this->_body = $this->body; } - } - //---------------------------------------------------------------------------------------- - /** - * sorts array [body] by key [sort] - * @access public - */ - //---------------------------------------------------------------------------------------- - function arr_sort() { - if($this->order != '') { - if($this->order == 'ASC') $sort_order = SORT_ASC; - if($this->order == 'DESC') $sort_order = SORT_DESC; - } else { - $sort_order = SORT_ASC; - } - $column = array(); - foreach($this->body as $val) { - $column[] = $val[$this->sort]; - } - array_multisort($column, $sort_order, $this->body); - } - //---------------------------------------------------------------------------------------- - /** - * builds table head - * @access public - * @return object|string htmlobject_tr or empty string - */ - //---------------------------------------------------------------------------------------- - function get_table_head() { - $tr = ''; - if(count($this->head) > 0) { - $tr = new htmlobject_tr(); - $tr->css = $this->css_prefix.'tr'; - $tr->id = 'tr_'. uniqid(); - - foreach($this->head as $key_2 => $value) { - - $hidden = false; - if(@array_key_exists('hidden', $this->head[$key_2]) == true) { - if($this->head[$key_2]['hidden'] === true) { - $hidden = true; - } - } - - $sortable = true; - if(@array_key_exists('sortable', $this->head[$key_2]) == true) { - if($this->head[$key_2]['sortable'] === false) { - $sortable = false; - } - } - - if($hidden === false) { - if($value['title'] == '') { - $str = ' '; - } else { - if($this->sort != '' && $sortable === true && isset($this->sort_params)) { - $order_param = ''; - $linkclass = ''; - if($this->sort == $key_2) { - if($this->order == 'ASC') { - $order_param = '&'.$this->_var_prefix.'order=DESC'; - $linkclass = ' class="desc"'; - } else { - $linkclass = ' class="asc"'; - } - } - $str = ''.$value['title'].''; - } else { - $str = $value['title']; - } - } - $td = new htmlobject_td(); - $td->type = 'th'; - $td->css = $this->css_prefix.'td '.$key_2; - $td->text = $str; - $tr->add($td); - } - } - if($this->identifier != '') { - $td = new htmlobject_td(); - $td->type = 'th'; - $td->css = $this->css_prefix.'td '.$this->identifier_name; - $td->text = ' '; - $tr->add($td); - } - } - return $tr; - } - //---------------------------------------------------------------------------------------- - /** - * adds one row to table body - * @access public - * @param array $val - * @return object|string htmlobject_tr or empty string - */ - //---------------------------------------------------------------------------------------- - function get_table_body($key, $val, $i) { - $ident = 'id'. uniqid(); - - $tr = new htmlobject_tr(); - $tr->css = $this->css_prefix.'tr ' .$i; - $tr->id = 'tr_'. uniqid(); - $tr->handler = $this->get_js_tr($ident); - - foreach($val as $key_2 => $v) { - if($v == '') { $v = ' '; } - if(@array_key_exists('exec', $this->head[$key_2]) == true) { - #echo $key_2; - } - $hidden = false; - if(@array_key_exists('hidden', $this->head[$key_2]) == true) { - if($this->head[$key_2]['hidden'] === true) { - $hidden = true; - } - } - - if($hidden === false) { - $td = new htmlobject_td(); - $td->type = 'td'; - $td->css = $this->css_prefix.'td '.$key_2; - $td->text = $v; - $tr->add($td); - } - } - //--------------------------------------------------------------- identifier - if($this->identifier != '') { - $tr->add($this->get_indentifier($key, $ident)); - } - return $tr; - } - //---------------------------------------------------------------------------------------- - /** - * returns table bottom row - * @access public - * @return object|string htmlobject_tr or empty string - */ - //---------------------------------------------------------------------------------------- - function get_table_bottom () { - $tr = ''; - if(isset($this->bottom[0]) && isset($this->body[0])) { - $tr = new htmlobject_tr(); - $tr->css = $this->css_prefix.'tr'; - $tr->id = 'tr_'. uniqid(); - - $td = new htmlobject_td(); - $td->colspan = $this->_num_cols; - $td->type = 'td'; - $td->css = $this->css_prefix.'td bottom'; - $str = '
    '; - foreach($this->bottom as $key_2 => $v) { - $html = new htmlobject_input(); - $html->name = $this->bottom_buttons_name; - $html->value = $v; - $html->type = 'submit'; - $str .= $html->get_string(); - } - $str .= '
    '; - $td->text = $this->get_select().''.$str.'
     
    '; - $tr->add($td); - } - return $tr; - } - //---------------------------------------------------------------------------------------- - /** - * adds a row above the sort row - * @access public - * @param $str string - */ - //---------------------------------------------------------------------------------------- - function add_headrow($str = '') { - $tr = new htmlobject_tr(); - $tr->css = $this->css_prefix.'tr'; - $tr->id = 'tr_'. uniqid(); - - $td = new htmlobject_td(); - $td->colspan = $this->_num_cols; - $td->type = 'td'; - $td->css = $this->css_prefix.'td head'; - $td->text = $str; - $tr->add($td); - - $this->_headrow[] = $tr; - } - //---------------------------------------------------------------------------------------- - /** - * adds a row under the bottom row - * @access public - * @param $str string - */ - //---------------------------------------------------------------------------------------- - function add_bottomrow($str = '') { - $tr = new htmlobject_tr(); - $tr->css = $this->css_prefix.'tr'; - $tr->id = 'tr_'. uniqid(); - - $td = new htmlobject_td(); - $td->colspan = $this->_num_cols; - $td->type = 'td'; - $td->css = $this->css_prefix.'td head'; - $td->text = $str; - $tr->add($td); - - $this->_bottomrow[] = $tr; - } - //---------------------------------------------------------------------------------------- - /** - * adds sort functions to table - * @access public - * @return object|string - */ - //---------------------------------------------------------------------------------------- - function get_sort() { - $strR = ''; - if($this->sort != '') { - foreach($this->head as $key_2 => $v) { - if(isset($v['sortable']) == false) { - $v['sortable'] = true; - } - if($v['sortable'] == true) { - $value[] = array("value" => $key_2, "label" => $v['title']); - } - } - $sort = new htmlobject_select(); - $sort->id = 'p'.uniqid(); - $sort->name = $this->_var_prefix.'sort'; - $sort->text_index = array("value" => "value", "text" => "label"); - $sort->text = $value; - $sort->selected = array($this->sort); - $str_sort = ''; - - $order = new htmlobject_select(); - $order->id = 'p'.uniqid(); - $order->name = $this->_var_prefix.'order'; - $order->text_index = array("value" => "value", "text" => "text"); - $order->text = array(array("value" => "ASC", "text" => "ASC"),array("value" => "DESC", "text" => "DESC")); - $order->selected = array($this->order); - $str_order = $order->get_string(); - - if (count($this->limit_select) <= 0) { - $this->limit_select = array( - array("value" => 0, "text" => $this->lang_option_nolimit), - array("value" => 10, "text" => 10), - array("value" => 20, "text" => 20), - array("value" => 30, "text" => 30), - array("value" => 40, "text" => 40), - array("value" => 50, "text" => 50), - ); - } - $limit_input = new htmlobject_select(); - $limit_input->id = 'p'.uniqid(); - $limit_input->name = $this->_var_prefix.'limit'; - $limit_input->text_index = array("value" => "value", "text" => "text"); - $limit_input->text = $this->limit_select; - $limit_input->selected = array($this->limit); - $str_limit = ''; - - $offset_input = new htmlobject_input(); - $offset_input->id = 'p'.uniqid(); - $offset_input->name = $this->_var_prefix.'offset'; - $offset_input->value = "$this->offset"; - $offset_input->type = 'text'; - $offset_input->size = 3; - $str_offset = ''; - - $max_input = new htmlobject_input(); - $max_input->name = $this->_var_prefix.'max'; - $max_input->value = $this->max; - $max_input->type = 'hidden'; - - $action = new htmlobject_input(); - $action->name = $this->_var_prefix.'action'; - $action->value = $this->lang_button_refresh; - $action->type = 'submit'; - - $strR = '
    '; - $strR .= $max_input->get_string(). - $str_sort. - $str_order. - $str_offset. - $str_limit. - $action->get_string(); - $strR .= '
     
    '; - $strR .= '
    '; - } - return $strR; - } - //---------------------------------------------------------------------------------------- - /** - * returns page turn functions - * @access public - * @return string - */ - //---------------------------------------------------------------------------------------- - function get_pageturn() { - $strR = ''; - if($this->sort != '') { - #$this->init_table_builder(); - - $first = new htmlobject_input(); - $first->name = $this->_var_prefix.'action'; - $first->value = '<<'; - $first->type = 'submit'; - - $prev = new htmlobject_input(); - $prev->name = $this->_var_prefix.'action'; - $prev->value = '<'; - $prev->type = 'submit'; - - $next = new htmlobject_input(); - $next->name = $this->_var_prefix.'action'; - $next->value = '>'; - $next->type = 'submit'; - - $last = new htmlobject_input(); - $last->name = $this->_var_prefix.'action'; - $last->value = '>>'; - $last->type = 'submit'; - - if($this->limit == 0) { $this->limit = $this->max; } - - if(( $this->offset + $this->limit ) >= $this->max) { - $next->style = 'visibility:hidden;'; - $last->style = 'visibility:hidden;'; - } - if($this->offset <= 0) { - $first->style = 'visibility:hidden;'; - $prev->style = 'visibility:hidden;'; - } - - if(($this->offset + $this->limit) < $this->max ) { - $max = $this->offset + $this->limit; - } else { - $max = $this->max; - } - - $strR .= '
    '; - $strR .= ''; - $strR .= ' '; - $strR .= ' '; - $strR .= ' '; - $strR .= '
    '.$first->get_string().$prev->get_string().''; - $strR .= ' '.( $this->offset + 1 ).' - '; - $strR .= ' '.$max.' / '; - $strR .= ' '.$this->max.''; - $strR .= ' '.$next->get_string().$last->get_string().'
    '; - $strR .= '
    '; - } - return $strR; - } - //---------------------------------------------------------------------------------------- - /** - * returns identifier multi select functions - * @access public - * @return string - */ - //---------------------------------------------------------------------------------------- - function get_select() { - $strR = ''; - if($this->identifier_type == 'checkbox' && $this->identifier != '') { - $strR .= ''."\n"; - } - return $strR; - } - //---------------------------------------------------------------------------------------- - /** - * adds identifier td to body row - * @access public - * @param $ident string - * @return object|string - */ - //---------------------------------------------------------------------------------------- - function get_indentifier($key, $ident) { - $td = ''; - if($this->identifier != '') { - $html = new htmlobject_input(); - $html->id = $ident; - $html->name = $this->identifier_name.'[]'; - $html->value = $this->body[$key][$this->identifier]; - $html->type = $this->identifier_type; - if(in_array($this->body[$key][$this->identifier], $this->identifier_checked)) { - $html->checked = true; - } - if(in_array( $this->body[$key][$this->identifier], $this->identifier_disabled)) { - $html = new htmlobject_div(); - $html->text = ' '; - } - - $td = new htmlobject_td(); - $td->type = 'td'; - $td->css = $this->css_prefix.'td '.$this->identifier_name; - $td->text = $html->get_string(); - } - return $td; - } - //---------------------------------------------------------------------------------------- - /** - * returns JS for tr hover and click function - * @access public - * @return string - */ - //---------------------------------------------------------------------------------------- - function get_js() { - $_strReturn = ''; - $id_1 = ''; - $id_2 = ''; - if($this->identifier != '') { - $id_1 = 'try { document.getElementById(arg).checked = true; } catch(e) {}'; - $id_2 = 'try { document.getElementById(arg).checked = false; } catch(e) {}'; - } - $_strReturn .= "\n"; - $_strReturn .= ''."\n"; - return $_strReturn; - } - //---------------------------------------------------------------------------------------- - /** - * returns JS for tr - * @access public - * @return string - */ - //---------------------------------------------------------------------------------------- - function get_js_tr($ident) { - $script = 'onmouseover="tr_hover(this);" onmouseout="tr_hover(this);"'; - #if($this->identifier != '') { - $script .= ' onclick="tr_click(this, \''.$ident.'\')"'; - #} - return $script; - } - //---------------------------------------------------------------------------------------- - /** - * builds html table - * @access public - * @param $name string - * @param $value array(array(label=>, value=>, ...) - * @return string - */ - //---------------------------------------------------------------------------------------- - function get_string() { - $_strReturn = ''; - - // build table - $this->init_table_builder(); - - // build additional table head - foreach ($this->_headrow as $row) { - $row->arr_tr[0]->colspan = $this->_num_cols; - htmlobject_table::add($row); - } - // build sort functions - if($this->sort != '') { - $td = new htmlobject_td(); - $td->colspan = $this->_num_cols; - $td->type = 'td'; - $td->css = $this->css_prefix.'td pageturn_head'; - - $tr = new htmlobject_tr(); - $tr->css = $this->css_prefix.'tr pageturn_head'; - $tr->id = 'tr_'. uniqid(); - $td->text = $this->get_sort().$this->get_pageturn(); - $tr->add($td); - htmlobject_table::add($tr); - } - // build table head - htmlobject_table::add($this->get_table_head()); - - // build table body - $i = 'odd'; - foreach ($this->_body as $key => $value) { - htmlobject_table::add($this->get_table_body($key, $value, $i)); - if($i == 'odd') $i = 'even'; - else $i = 'odd'; - } - // build table bottom - htmlobject_table::add($this->get_table_bottom()); - - // insert bottom pageturn - if(count($this->_body) > 9 && $this->limit < $this->max && $this->sort != '') { - $td = new htmlobject_td(); - $td->colspan = $this->_num_cols; - $td->type = 'td'; - $td->css = $this->css_prefix.'td pageturn_bottom'; - - $tr = new htmlobject_tr(); - $tr->css = $this->css_prefix.'tr pageturn_bottom'; - $tr->id = 'tr_'. uniqid(); - $td->text = $this->get_pageturn(); - $tr->add($td); - htmlobject_table::add($tr); - } - - foreach ($this->_bottomrow as $row) { - $row->arr_tr[0]->colspan = $this->_num_cols; - htmlobject_table::add($row); - } - // build form - $_strReturn = $this->get_js(); - ($this->form_action != '') ? $_strReturn .= '
    ' : null; - $_strReturn .= htmlobject_table::get_string(); - ($this->form_action != '') ? $_strReturn .= '
    ' : null; - return $_strReturn; - } - -}//-- end class diff --git a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.tabmenu.class.php b/openQRM-5.3.50-CE/src/web/base/class/htmlobject.tabmenu.class.php deleted file mode 100644 index 98f99a6..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.tabmenu.class.php +++ /dev/null @@ -1,296 +0,0 @@ - -*/ -//---------------------------------------------------------------------------------------- - -class htmlobject_tabmenu extends htmlobject -{ -/** -* general prefix must be set via constructor -* @access private -* @var string -*/ -var $prefix; -/** -* prefix for $message_param value -* @access private -* @var string -*/ -var $prefix_tab = 'tab'; -/** -* url to process request -* Form disabled if empty -* @access public -* @var string -*/ -var $form_action = ''; -/** -* css class to highlight active tab -* @access public -* @var string -*/ -var $tabcss = 'current'; -/** -* add a custom string to tabs -* @access public -* @var string -*/ -var $custom_tab = ''; -//------------------------------------------------------------------------------------ Message Section -/** -* name of param to transport message to messagebox -* @access public -* @var string -*/ -var $message_param = 'strMsg'; -/** -* regex pattern for messagebox (crosssitescripting) -* replace pattern with replace -* @access public -* @var array(array('pattern'=>'','replace'=>'')); -*/ -var $message_replace = array ( - array ( 'pattern' => '~ ''), - array ( 'pattern' => '~ ''), - array ( 'pattern' => '~ ''), - array ( 'pattern' => '~on.+=~i', 'replace' => ''), - array ( 'pattern' => '~javascript~i', 'replace' => ''), - array ( 'pattern' => '~://~', 'replace' => ':⁄⁄'), - ); -/** -* time to show messagebox in milliseconds (1/1000 sec.) -* @access public -* @var int -*/ -var $message_time = 10000; -/** -* css class for messagebox -* @access public -* @var string -*/ -var $message_css = 'msgBox'; - -//------------------------------------------------------------------------------------Private Section -/** -* tab values -* @access private -* @var array -*/ -var $_tabs = array(); - - //---------------------------------------------------------------------------------------- - /** - * constructor - * - * $content = array(); - * $content[0]['label'] = 'some title'; - * $content[0]['value'] = 'some content text'; - * $content[0]['target'] = 'somefile.php'; - * $content[0]['request'] = '¶m1=value1¶m2=value2'; - * $content[0]['onclick'] = false; - * $tab = new htmlobject_tabmenu($content, 'some_prefix'); - * - * @access public - * @param array $arr - * @param string $prefix - */ - //---------------------------------------------------------------------------------------- - function htmlobject_tabmenu($arr, $prefix = 'currenttab', $prefix_tab = 'tab') { - $this->prefix = $prefix; - $this->prefix_tab = $prefix_tab; - $this->_set($arr); - } - - //---------------------------------------------------------------------------------------- - /** - * set tabs data - * @access private - * @param array $arr - */ - //---------------------------------------------------------------------------------------- - function _set( $arr ) { - $i = 0; - foreach ($arr as $val) { - - $identifier = $this->prefix.$this->prefix_tab.$i; - - if(array_key_exists('value', $val)) { - $html = new htmlobject_div(); - $html->id = $identifier; - $html->css = 'htmlobject_tab_box'; - $html->text = $val['value']."
     
    \n"; - $value = $html; - } else { $value = ''; } - - array_key_exists('label', $val) ? $label = $val['label'] : $label = ''; - array_key_exists('target', $val) ? $target = $val['target'].'?'.$this->prefix.'='.$this->prefix_tab.$i : $target = '?'.$this->prefix.'='.$this->prefix_tab.$i; - array_key_exists('request', $val) ? $request = $val['request'] : $request = array(); - array_key_exists('onclick', $val) ? $onclick = $val['onclick'] : $onclick = true; - array_key_exists('active', $val) ? $active = $val['active'] : $active = false; - - if( $active === true ) { - $_REQUEST[$this->prefix.$this->prefix_tab] = $i; - } - - $this->_tabs[] = array( - 'target' => $target, - 'value' => $value, - 'label' => $label, - 'id' => $identifier, - 'request' => $request, - 'onclick' => $onclick, - 'active' => $active, - ); - $i++; - } - } - - //---------------------------------------------------------------------------------------- - /** - * create tabs - * @access private - * @param string $currenttab - * @return string - */ - //---------------------------------------------------------------------------------------- - function _get_tabs($currenttab) { - $thisfile = basename($_SERVER['PHP_SELF']); - $_str = "\n
    _init.">\n"; - $_str .= "
      \n"; - foreach($this->_tabs as $tab) { - $css = ''; - if($tab['id'] == $this->prefix.$this->prefix_tab.$currenttab) { $css = ' class="'.$this->tabcss.'"'; } - foreach ($tab['request'] as $key => $arg) { - $tab['target'] = $tab['target'].'&'.$key.'='.$arg; - } - $_str .= '
    • '; - $_str .= ""; - - if(strstr($tab['target'], $thisfile) && $tab['onclick'] !== false) { - $_str .= ''; - } else { - $_str .= ''; - } - $_str .= $tab['label']; - $_str .= ""; - $_str .= ""; - $_str .= "
    • \n"; - } - $_str .= "
    \n"; - if($this->custom_tab != '') { - $_str .= "
    ".$this->custom_tab."
    \n"; - } - $_str .= "
    \n"; - $_str .= "
     
    \n"; - - return $_str; - } - - //---------------------------------------------------------------------------------------- - /** - * create JS toggle function - * @access private - * @return string - */ - //---------------------------------------------------------------------------------------- - function _get_js() { - $_str = ''; - $thisfile = basename($_SERVER['PHP_SELF']); - $_str .= "\n\n"; - - return $_str; - } - - //---------------------------------------------------------------------------------------- - /** - * create messagebox - * @access private - * @return string - */ - //---------------------------------------------------------------------------------------- - function _get_messagebox() { - $_str = ''; - $this->add_request_filter($this->message_replace); - $msg = $this->get_request($this->message_param); - if($msg != "") { - $_str .= ''; - $_str .= '
    '.$msg.'
    '; - $_str .= ''; - $_str .= ''; - } - return $_str; - } - - //---------------------------------------------------------------------------------------- - /** - * build tabs output - * @access public - * @param array $arr - * @return string - */ - //---------------------------------------------------------------------------------------- - function get_string() { - $_str = ''; - ($this->form_action != '') ? $_str .= '
    ' : null; - if(count($this->_tabs) > 0) { - $this->init(); - if(isset($_REQUEST[$this->prefix]) && $_REQUEST[$this->prefix] != '') { - $currenttab = str_replace($this->prefix_tab, '', $_REQUEST[$this->prefix]); - } else { - $currenttab = '0'; - } - $_str .= $this->_get_js(); - $_str .= $this->_get_tabs($currenttab); - foreach ($this->_tabs as $tab) { - if($tab['value'] != '') { - $html = $tab['value']; - if($tab['id'] !== $this->prefix.$this->prefix_tab.$currenttab) { - $html->style = 'display:none;'; - } else { - $html->text = $this->_get_messagebox().$html->text; - } - $_str .= $html->get_string(); - } - } - } - ($this->form_action != '') ? $_str .= '
    ' : null; - - return $_str; - } -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.tabs.class.php b/openQRM-5.3.50-CE/src/web/base/class/htmlobject.tabs.class.php deleted file mode 100644 index 099d2a3..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/htmlobject.tabs.class.php +++ /dev/null @@ -1,285 +0,0 @@ - -*/ -//---------------------------------------------------------------------------------------- - -class htmlobject_tabmenu extends htmlobject -{ -/** -* general prefix must be set via constructor -* @access private -* @var string -*/ -var $prefix; -/** -* prefix for $message_param value -* @access private -* @var string -*/ -var $prefix_tab = 'tab'; -/** -* url to process request -* Form disabled if empty -* @access public -* @var string -*/ -var $form_action = ''; -/** -* name of param to transport message to messagebox -* @access public -* @var string -*/ -var $message_param = 'strMsg'; -/** -* regex pattern for messagebox (crosssitescripting) -* @access public -* @var array -*/ -var $message_replace = array ( - array ( 'pattern' => '~ ''), - array ( 'pattern' => '~ ''), - array ( 'pattern' => '~ ''), - array ( 'pattern' => '~://~', 'replace' => ':⁄⁄'), - ); -/** -* time to show messagebox in milliseconds -* @access public -* @var int -*/ -var $message_time = 10000; -/** -* css class for messagebox -* @access public -* @var int -*/ -var $message_css = 'msgBox'; -/** -* css class to highlight active tab -* @access public -* @var string -*/ -var $tabcss = 'current'; -/** -* tab values -* @access private -* @var array -*/ -var $_tabs = array(); - - //---------------------------------------------------------------------------------------- - /** - * constructor - * - * $content = array(); - * $content[0]['label'] = 'some title'; - * $content[0]['value']= 'some content text'; - * $content[0]['target']= 'somefile.php'; - * $content[0]['request']= '¶m1=value1¶m2=value2'; - * $tab = new htmlobject_tabmenu($content, 'some_prefix'); - * - * @access public - * @param array $arr - * @param string $prefix - */ - //---------------------------------------------------------------------------------------- - function htmlobject_tabmenu($arr, $prefix = 'currenttab') { - $this->prefix = $prefix; - $this->_set($arr); - } - - //---------------------------------------------------------------------------------------- - /** - * set tabs data - * @access private - * @param array $arr - */ - //---------------------------------------------------------------------------------------- - function _set($arr) { - $i = 0; - foreach ($arr as $val) { - - $identifier = $this->prefix.$this->prefix_tab.$i; - - if(array_key_exists('value', $val)) { - $html = new htmlobject_div(); - $html->id = $identifier; - $html->css = 'htmlobject_tab_box'; - $html->text = $val['value'].'
     
    '; - $value = $html->get_string(); - } else { $value = ''; } - - array_key_exists('label', $val) ? $label = $val['label'] : $label = ''; - array_key_exists('target', $val) ? $target = $val['target'].'?'.$this->prefix.'='.$this->prefix_tab.$i : $target = '?'.$this->prefix.'='.$this->prefix_tab.$i; - array_key_exists('request', $val) ? $request = $val['request'] : $request = array(); - - $this->_tabs[] = array( - 'target' => $target, - 'value' => $value, - 'label' => $label, - 'id' => $identifier, - 'request' => $request, - ); - $i++; - } - } - - //---------------------------------------------------------------------------------------- - /** - * create tabs - * @access private - * @param string $currenttab - * @return string - */ - //---------------------------------------------------------------------------------------- - function _get_tabs($currenttab) { - $thisfile = basename($_SERVER['PHP_SELF']); - $_strReturn = "\n
    _init_htmlobject>\n"; - $_strReturn .= "
      \n"; - foreach($this->_tabs as $tab) { - $css = ''; - if($tab['id'] == $this->prefix.$this->prefix_tab.$currenttab) { $css = ' class="'.$this->tabcss.'"'; } - foreach ($tab['request'] as $key => $arg) { - $tab['target'] = $tab['target'].'&'.$key.'='.$arg; - } - $_strReturn .= '
    • '; - $_strReturn .= ""; - if(strstr($tab['target'], $thisfile)) { - $_strReturn .= ''; - } else { - $_strReturn .= ''; - } - $_strReturn .= $tab['label']; - $_strReturn .= ""; - $_strReturn .= ""; - $_strReturn .= "
    • \n"; - } - $_strReturn .= "
    \n"; - $_strReturn .= "
    \n"; - $_strReturn .= "
     
    \n"; - - return $_strReturn; - } - - //---------------------------------------------------------------------------------------- - /** - * create JS toggle function - * @access private - * @return string - */ - //---------------------------------------------------------------------------------------- - function _get_js() { - $_strReturn = ''; - $thisfile = basename($_SERVER['PHP_SELF']); - $_strReturn .= "\n\n"; - - return $_strReturn; - } - - //---------------------------------------------------------------------------------------- - /** - * create css - * @access private - * @param string $currenttab - * @return string - */ - //---------------------------------------------------------------------------------------- - function _get_css($currenttab) { - $_strReturn = ''; - - $_strReturn .= "\n\n"; - - return $_strReturn; - } - - //---------------------------------------------------------------------------------------- - /** - * create messagebox - * @access private - * @return string - */ - //---------------------------------------------------------------------------------------- - function _get_messagebox() { - $_strReturn = ''; - if($this->get_request($this->message_param) != "") { - - $this->http_request_replace = array_merge($this->message_replace, $this->http_request_replace); - $msg = $this->get_request($this->message_param); - - $_strReturn .= ''; - $_strReturn .= '
    '.$msg.'
    '; - $_strReturn .= ''; - $_strReturn .= ''; - } - return $_strReturn; - } - - //---------------------------------------------------------------------------------------- - /** - * build tabs output - * @access public - * @param array $arr - * @return string - */ - //---------------------------------------------------------------------------------------- - function get_string() { - $_strReturn = ''; - ($this->form_action != '') ? $_strReturn .= '
    ' : null; - if(count($this->_tabs) > 0) { - $this->init_htmlobject(); - if(isset($_REQUEST[$this->prefix]) && $_REQUEST[$this->prefix] != '') { - $currenttab = str_replace($this->prefix_tab, '', $_REQUEST[$this->prefix]); - } else { - $currenttab = '0'; - } - $_strReturn .= $this->_get_js(); - $_strReturn .= $this->_get_css($currenttab); - $_strReturn .= $this->_get_tabs($currenttab); - $_strReturn .= $this->_get_messagebox(); - foreach ($this->_tabs as $tab) { - if($tab['value'] != '') { - $_strReturn .= $tab['value']; - } - } - } - ($this->form_action != '') ? $_strReturn .= '
    ' : null; - - return $_strReturn; - } -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/http.class.php b/openQRM-5.3.50-CE/src/web/base/class/http.class.php deleted file mode 100644 index d2f9be8..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/http.class.php +++ /dev/null @@ -1,133 +0,0 @@ - -*/ -//---------------------------------------------------------------------------------------- - -class http -{ -/** -* regex pattern for httprequest (crosssitescripting) -* -* $http = new http(); -* $http->http_request_replace = array( -* array ( 'pattern' => '~\r\n~', 'replace' => '\n'), -* ); -* -* @access public -* @var array -*/ -var $http_request_replace = array( - array ( 'pattern' => '~\r\n~', 'replace' => '\n'), - ); - - - //--------------------------------------------------------------- - /** - * returns http request as cleaned string - * string is empty when request not set - * @access public - * @param $path string - * @return string [empty if request not set] - */ - //--------------------------------------------------------------- - function get_request($arg) - { - if (isset($_REQUEST[$arg])) { - if(is_array($_REQUEST[$arg])) { - foreach($_REQUEST[$arg] as $key => $value) { - $arr[$key] = $this->filter_request($value); - } - return $arr; - } else { - return $this->filter_request($_REQUEST[$arg]); - } - } else { - return ''; - } - } - - //--------------------------------------------------------------- - /** - * performes preg_replace - * @access public - * @param $value string - * @return string - */ - //--------------------------------------------------------------- - function filter_request($value) { - $value = stripslashes($value); - if(is_array($this->http_request_replace)) { - foreach ($this->http_request_replace as $reg) { - $value = preg_replace($reg['pattern'], $reg['replace'], $value); - } - } - return $value; - } - - //--------------------------------------------------------------- - /** - * returns http request [POST/GET] as string - * @access public - * @param $firstchar string - * @param $excludes array - * @return string [empty if request empty] - */ - //--------------------------------------------------------------- - function get_request_as_string($firstchar = '?', $excludes = array()) { - $type = array('_POST','_GET'); - $_strReturn = ''; - foreach($type as $request) { - foreach(eval("return \$$request;") as $name => $foo) { - if(in_array($name, $excludes) == false) { - $value = http_request($name); - if(is_array($value)) { - foreach($value as $key => $val) { - $_strReturn .= '&'.$name.'['.$key.']='.$val; - } - } else { - $_strReturn .= '&'.$name.'='.$value; - } - } - } - } - if($_strReturn != '') $_strReturn = preg_replace('/^&/', $firstchar, $_strReturn); - return $_strReturn; - } - - //--------------------------------------------------------------- - /** - * header redirect - * tries php header redirect, on fail js redirect, on fail meta redirect - * @access public - * @param $url string - */ - //--------------------------------------------------------------- - function redirect($url){ - if (!headers_sent()){ - header('Location: '.$url); exit; - } else { - echo ''; - echo ''; exit; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/image.class.php b/openQRM-5.3.50-CE/src/web/base/class/image.class.php deleted file mode 100644 index 815e379..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/image.class.php +++ /dev/null @@ -1,829 +0,0 @@ - -*/ - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-server-config.php"; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/event.class.php"; - -/** - * This class represents a filesystem-image (rootfs) - * In combination with a kernel it can be deployed to a resource - * via the appliance.class - * - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - * @author M. Rechenburg, A. Kuballa - * @version 1.1 added documentation - */ -class image -{ - -/** -* image id -* @access protected -* @var int -*/ -var $id = ''; -/** -* image name -* @access protected -* @var string -*/ -var $name = ''; -/** -* image version -* @access protected -* @var string -*/ -var $version = ''; -/** -* image type -* @access protected -* @var string -*/ -var $type = ''; -/** -* image rootdevice -* @access protected -* @var string -*/ -var $rootdevice = ''; -/** -* image root filesystem -* @access protected -* @var string -*/ -var $rootfstype = ''; -/** -* image size (MB) -* @access protected -* @var integer -*/ -var $size = 0; -/** -* storage id -* @access protected -* @var int -*/ -var $storageid = ''; -/** -* deployment type -* @access protected -* @var string -*/ -var $deployment_type = ''; -/** -* deployment parameter -* @access protected -* @var string -*/ -var $deployment_parameter = ''; -/** -* image is shared? -* @access protected -* @var bool -*/ -var $isshared = ''; -/** -* image is active? -* @access protected -* @var bool -*/ -var $isactive = ''; -/** -* image comment -* @access protected -* @var string -*/ -var $comment = ''; -/** -* image capabilities -* @access protected -* @var string -*/ -var $capabilities = ''; - -/** -* name of database table -* @access protected -* @var string -*/ -var $_db_table; -/** -* path to openqrm basedir -* @access protected -* @var string -*/ -var $_base_dir; -/** -* event object -* @access protected -* @var object -*/ -var $_event; - - //-------------------------------------------------- - /** - * Constructor - */ - //-------------------------------------------------- - function image($deployment_type=null) { - $this->init($deployment_type); - } - - //-------------------------------------------------- - /** - * init storage environment - * @access public - */ - //-------------------------------------------------- - function init($deployment_type=null) { - global $IMAGE_INFO_TABLE, $OPENQRM_SERVER_BASE_DIR; - $this->_event = new event(); - $this->_db_table = $IMAGE_INFO_TABLE; - $this->_base_dir = $OPENQRM_SERVER_BASE_DIR; - - $this->deployment_type = $deployment_type; - } - - //-------------------------------------------------- - /** - * get an instance of an image object from db - * @access public - * @param int $id - * @param string $name - * @return object - */ - //-------------------------------------------------- - function get_instance($id, $name) { - $db=openqrm_get_db_connection(); - - if(@strlen(@$this->deployment_type->type)>0){ - $where_extra_sql = " and image_type = '".$this->deployment_type->type."'"; - } - else if($this->deployment_type){ - $where_extra_sql = " and image_type = '".$this->deployment_type."'"; - }else{ - $where_extra_sql = null; - } - - if ("$id" != "") { - $image_array = $db->Execute("select * from $this->_db_table where image_id=$id".$where_extra_sql); - } else if ("$name" != "") { - $image_array = $db->Execute("select * from $this->_db_table where image_name='$name'".$where_extra_sql); - } else { - $error = ''; - foreach(debug_backtrace() as $key => $msg) { - if($key === 1) { - $error .= '( '.basename($msg['file']).' '.$msg['line'].' )'; - } - syslog(LOG_ERR, $msg['function'].'() '.basename($msg['file']).':'.$msg['line']); - } - $this->_event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "image.class.php", "Could not create instance of image without data ".$error, "", "", 0, 0, 0); - return; - } - foreach ($image_array as $index => $image) { - $this->id = $image["image_id"]; - $this->name = $image["image_name"]; - $this->version = $image["image_version"]; - $this->type = $image["image_type"]; - $this->rootdevice = $image["image_rootdevice"]; - $this->rootfstype = $image["image_rootfstype"]; - $this->size = $image["image_size"]; - $this->storageid = $image["image_storageid"]; - $this->deployment_parameter = $image["image_deployment_parameter"]; - $this->isshared = $image["image_isshared"]; - $this->isactive = $image["image_isactive"]; - $this->comment = $image["image_comment"]; - $this->capabilities = $image["image_capabilities"]; - } - return $this; - } - - //-------------------------------------------------- - /** - * get an instance of an image by id - * @access public - * @param int $id - * @return object - */ - //-------------------------------------------------- - function get_instance_by_id($id) { - $this->get_instance($id, ""); - return $this; - } - - //-------------------------------------------------- - /** - * get an instance of an image by name - * @access public - * @param int $id - * @return object - */ - //-------------------------------------------------- - function get_instance_by_name($name) { - $this->get_instance("", $name); - return $this; - } - - //-------------------------------------------------- - /** - * add a new image - * @access public - * @param array $image_fields - */ - //-------------------------------------------------- - function add($image_fields) { - if (!is_array($image_fields)) { - $this->_event->log("add", $_SERVER['REQUEST_TIME'], 2, "image.class.php", "Image_field not well defined", "", "", 0, 0, 0); - return 1; - } - // set to not active by default when adding - $image_fields['image_isactive']=0; - $db=openqrm_get_db_connection(); - $result = $db->AutoExecute($this->_db_table, $image_fields, 'INSERT'); - if (! $result) { - $this->_event->log("add", $_SERVER['REQUEST_TIME'], 2, "image.class.php", "Failed adding new image to database", "", "", 0, 0, 0); - } - } - - //-------------------------------------------------- - /** - * update an image - * - * $fields = array(); - * $fields['image_name'] = 'somename'; - * $fields['image_version'] = '1.1'; - * $fields['image_type'] = 1; - * $fields['image_rootdevice'] = 1; - * $fields['image_rootfstype'] = 1; - * $fields['image_size'] = 0; - * $fields['image_storageid'] = 1; - * $fields['image_deployment_parameter'] = 1; - * $fields['image_isshared'] = 1; - * $fields['image_isactive'] = 0; - * $fields['image_comment'] = 'sometext'; - * $fields['image_capabilities'] = 'sometext'; - * $image = new image(); - * $image->update(1, $fields); - * - * @access public - * @param int $image_id - * @param array $image_fields - * @return bool - */ - //-------------------------------------------------- - function update($image_id, $image_fields) { - if ($image_id < 0 || ! is_array($image_fields)) { - $this->_event->log("update", $_SERVER['REQUEST_TIME'], 2, "image.class.php", "Unable to update image $image_id", "", "", 0, 0, 0); - return 1; - } - $db=openqrm_get_db_connection(); - unset($image_fields["image_id"]); - $result = $db->AutoExecute($this->_db_table, $image_fields, 'UPDATE', "image_id = $image_id"); - if (! $result) { - $this->_event->log("update", $_SERVER['REQUEST_TIME'], 2, "image.class.php", "Failed updating image $image_id", "", "", 0, 0, 0); - } - } - - //-------------------------------------------------- - /** - * remove an image by id - * @access public - * @param int $image_id - */ - //-------------------------------------------------- - function remove($image_id) { - // do not remove the idle + openqrm image - if (($image_id == 0) || ($image_id == 1)) { - return; - } - // remove auth file - $CMD="rm -f $this->_base_dir/openqrm/web/action/image-auth/iauth.$image_id"; - exec($CMD); - // remove from db - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from $this->_db_table where image_id=$image_id"); - } - - //-------------------------------------------------- - /** - * remove an image by name - * @access public - * @param string $image_name - */ - //-------------------------------------------------- - function remove_by_name($image_name) { - // do not remove the idle + openqrm image - if (($image_name == "openqrm") || ($image_name == "idle")) { - return; - } - // remove auth file - $rem_image = new image(); - $rem_image->get_instance_by_name($image_name); - $rem_image_id = $rem_image->id; - $CMD="rm -f $this->_base_dir/openqrm/web/action/image-auth/iauth.$rem_image_id"; - exec($CMD); - // remove from db - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from $this->_db_table where image_name='$image_name'"); - - } - - //-------------------------------------------------- - /** - * get image name by id - * @access public - * @param int $image_id - * @return string - */ - //-------------------------------------------------- - function get_name($image_id) { - $db=openqrm_get_db_connection(); - $image_set = $db->Execute("select image_name from $this->_db_table where image_id=$image_id"); - if (!$image_set) { - $this->_event->log("get_name", $_SERVER['REQUEST_TIME'], 2, "image.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - if (!$image_set->EOF) { - return $image_set->fields["image_name"]; - } else { - return "idle"; - } - } - } - - - //-------------------------------------------------- - /** - * set the image is currently in use - * @access public - * @param int $active - */ - //-------------------------------------------------- - function set_active($active) { - $this->get_instance_by_id($this->id); - $image_fields=array(); - $image_fields["image_isactive"]=$active; - $this->update($this->id, $image_fields); - } - - - //-------------------------------------------------- - /** - * set the deployment parameters of an image - * @access public - * @param string $key - * @param string $value - */ - //-------------------------------------------------- - function set_deployment_parameters($key, $value) { - $this->get_instance_by_id($this->id); - $image_deployment_parameter = $this->deployment_parameter; - $key=trim($key); - if (strstr($image_deployment_parameter, $key)) { - // change - $cp1=trim($image_deployment_parameter); - $cp2 = strstr($cp1, $key); - $keystr="$key=\""; - $endmark="\""; - $cp3=str_replace($keystr, "", $cp2); - $endpos=strpos($cp3, $endmark); - $cp=substr($cp3, 0, $endpos); - $new_image_deployment_parameter = str_replace("$key=\"$cp\"", "$key=\"$value\"", $image_deployment_parameter); - } else { - // add - $new_image_deployment_parameter = "$image_deployment_parameter $key=\"$value\""; - } - $image_fields=array(); - $image_fields["image_deployment_parameter"]="$new_image_deployment_parameter"; - $this->update($this->id, $image_fields); - - } - - - - //-------------------------------------------------- - /** - * gets a deployment parameter of an image - * @access public - * @param string $key - * @return string $value - */ - //-------------------------------------------------- - function get_deployment_parameter($key) { - - $image_deployment_parameter = $this->deployment_parameter; - $key=trim($key); - if (strstr($image_deployment_parameter, $key)) { - // change - $cp1=trim($image_deployment_parameter); - $cp2 = strstr($cp1, $key); - $keystr="$key=\""; - $endmark="\""; - $cp3=str_replace($keystr, "", $cp2); - $endpos=strpos($cp3, $endmark); - $cp=substr($cp3, 0, $endpos); - return $cp; - } else { - return ""; - } - } - - - - - - - //-------------------------------------------------- - /** - * get image capabilities by id - * @access public - * @param int $image_id - * @return string - */ - //-------------------------------------------------- - function get_capabilities($image_id) { - $db=openqrm_get_db_connection(); - $image_set = $db->Execute("select image_capabilities from $this->_db_table where image_id=$image_id"); - if (!$image_set) { - $this->_event->log("get_capabilities", $_SERVER['REQUEST_TIME'], 2, "image.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - if ((!$image_set->EOF) && ($image_set->fields["image_capabilities"]!="")) { - return $image_set->fields["image_capabilities"]; - } else { - return "0"; - } - } - } - - //-------------------------------------------------- - /** - * get number of images per type - * @access public - * @param string $deployment_type - * @return int - */ - //-------------------------------------------------- - function get_count_per_type($deployment_type_str) { - $count=0; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select count(image_id) as num from $this->_db_table where image_type='".$deployment_type_str."'"); - if (!$rs) { - $this->_event->log("get_count_per_type", $_SERVER['REQUEST_TIME'], 2, "image.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - $count = $rs->fields["num"]; - } - return $count; - } - - - //-------------------------------------------------- - /** - * get number of images - * @access public - * @return int - */ - //-------------------------------------------------- - function get_count() { - $count=0; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select count(image_id) as num from $this->_db_table"); - if (!$rs) { - $this->_event->log("get_count", $_SERVER['REQUEST_TIME'], 2, "image.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - $count = $rs->fields["num"]; - } - return $count; - } - - //-------------------------------------------------- - /** - * get an array of all image names - * - * $image = new image(); - * $arr = $image->get_list(); - * // $arr[0]['value'] - * // $arr[0]['label'] - * - * @access public - * @return array - */ - //-------------------------------------------------- - function get_list() { - $query = "select image_id, image_name from $this->_db_table order by image_id ASC"; - $image_name_array = array(); - $image_name_array = openqrm_db_get_result_double ($query); - return $image_name_array; - } - - - //-------------------------------------------------- - /** - * get an array of all image ids - * - * $image = new image(); - * $arr = $image->get_ids(); - * // $arr['value'] - * - * @access public - * @return array - */ - //-------------------------------------------------- - function get_ids() { - $image_array = array(); - $query = "select image_id from $this->_db_table"; - $db=openqrm_get_db_connection(); - $rs = $db->Execute($query); - if (!$rs) - $event->log("get_list", $_SERVER['REQUEST_TIME'], 2, "image.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $image_array[] = $rs->fields; - $rs->MoveNext(); - } - return $image_array; - } - - //-------------------------------------------------- - /** - * get an array of all image ids on a storage - * - * $image = new image(); - * $arr = $image->get_ids_by_storage($storage_id); - * // $arr['value'] - * - * @access public - * @return array - */ - //-------------------------------------------------- - function get_ids_by_storage($storage_id) { - $image_array = array(); - $query = "select image_id from $this->_db_table where image_storageid=$storage_id"; - $db=openqrm_get_db_connection(); - $rs = $db->Execute($query); - if (!$rs) - $event->log("get_list", $_SERVER['REQUEST_TIME'], 2, "image.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $image_array[] = $rs->fields; - $rs->MoveNext(); - } - return $image_array; - } - - - //-------------------------------------------------- - /** - * get an array of all image ids on a storage - * - * $image = new image(); - * $arr = $image->get_ids_by_storage($storage_id); - * // $arr['value'] - * - * @access public - * @return array - */ - //-------------------------------------------------- - function get_ids_by_type($deployment_type_str) { - $image_array = array(); - $query = "select image_id from $this->_db_table where image_type='".$deployment_type_str."'"; - $db=openqrm_get_db_connection(); - $rs = $db->Execute($query); - if (!$rs) - $event->log("get_ids_by_type", $_SERVER['REQUEST_TIME'], 2, "image.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $image_array[] = $rs->fields; - $rs->MoveNext(); - } - return $image_array; - } - - - - //-------------------------------------------------- - /** - * get an array of images per type - * @access public - * @param string $deployment_type - * @param int $offset - * @param int $limit - * @param string $sort - * @param enum $order [ASC/DESC] - * @return array - */ - //-------------------------------------------------- - function display_overview_per_type($deployment_type_str, $offset, $limit, $sort, $order) { - $db=openqrm_get_db_connection(); - $recordSet = $db->SelectLimit("select * from $this->_db_table where image_id > 1 and image_type='".$deployment_type_str."' order by $sort $order", $limit, $offset); - $image_array = array(); - if (!$recordSet) { - $this->_event->log("display_overview_per_type", $_SERVER['REQUEST_TIME'], 2, "image.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($image_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $image_array; - } - - - - - //-------------------------------------------------- - /** - * get an array of images - * @access public - * @param int $offset - * @param int $limit - * @param string $sort - * @param enum $order [ASC/DESC] - * @return array - */ - //-------------------------------------------------- - function display_overview($offset, $limit, $sort, $order) { - $db=openqrm_get_db_connection(); - $recordSet = $db->SelectLimit("select * from $this->_db_table where image_id > 1 order by $sort $order", $limit, $offset); - $image_array = array(); - if (!$recordSet) { - $this->_event->log("display_overview", $_SERVER['REQUEST_TIME'], 2, "image.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($image_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $image_array; - } - - //-------------------------------------------------- - /** - * generate a random password for images - * @access public - * @param int $length - * @return string - */ - //-------------------------------------------------- - function generatePassword ($length) { - // start with a blank password - $password = ""; - // define possible characters - $possible = "abcdfghjkmnpqrstvwxyzABCDEFGHIYKLMNOPQRSTVWXYZ"; - $numbers = "0123456789"; - $special = "-_"; - // set up a counter - $i = 0; - // add random characters to $password until $length is reached - while ($i < $length) { - // pick a random character from the possible ones - $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); - // we don't want this character if it's already in the password - if (!strstr($password, $char)) { - $password .= $char; - $i++; - } - $char = substr($numbers, mt_rand(0, strlen($numbers)-1), 1); - if (!strstr($password, $char)) { - $password .= $char; - $i++; - } - $char = substr($special, mt_rand(0, strlen($special)-1), 1); - if (!strstr($password, $char)) { - $password .= $char; - $i++; - } - } - // done! - return $password; - } - - //-------------------------------------------------- - /** - * set crypted root-password from string - * @access public - * @param int $id - * @param string $passwd - */ - //-------------------------------------------------- - function set_root_password($id, $passwd) { - $this->get_instance_by_id($id); - if (stripos($this->version, 'Windows') !== false) { - $content = "\n"; - file_put_contents($this->_base_dir."/openqrm/web/action/image-auth/iauth.".$id.".php", $content); - } else { - $CMD=$this->_base_dir."/openqrm/sbin/openqrm-crypt ".$passwd." > ".$this->_base_dir."/openqrm/web/action/image-auth/iauth.".$id.".php"; - exec($CMD); - } - } - - //-------------------------------------------------- - /** - * check image is network deployment - * @access public - * @return bool - */ - //-------------------------------------------------- - function is_network_deployment() { - $hook = $this->_base_dir.'/openqrm/web/boot-service/image.'.$this->type.'.php'; - if (file_exists($hook)) { - require_once($hook); - $function = "get_". str_replace("-", "_", $this->type)."_is_network_deployment"; - return $function(); - } else { - return false; - } - } - - - - - //-------------------------------------------------- - /** - * get an array of the supported image OS versions - * @access public - * @return bool - */ - //-------------------------------------------------- - function get_os_version() { - - $image_version_arr[] = array("label" => "Linux", "value" => "linux"); - $image_version_arr[] = array("label" => "Windows", "value" => "windows"); - - $image_version_arr[] = array("label" => "CentOS 7", "value" => "linux_centos7"); - $image_version_arr[] = array("label" => "CentOS 6", "value" => "linux_centos4"); - $image_version_arr[] = array("label" => "CentOS 5", "value" => "linux_centos5"); - - $image_version_arr[] = array("label" => "Debian 8", "value" => "linux_debian8"); - $image_version_arr[] = array("label" => "Debian 7", "value" => "linux_debian7"); - $image_version_arr[] = array("label" => "Debian 6", "value" => "linux_debian6"); - - $image_version_arr[] = array("label" => "openSUSE Linux 13.x", "value" => "linux_opensuse13"); - $image_version_arr[] = array("label" => "openSUSE Linux 12.x", "value" => "linux_opensuse12"); - $image_version_arr[] = array("label" => "openSUSE Linux 11.x", "value" => "linux_opensuse11"); - $image_version_arr[] = array("label" => "openSUSE Linux 10.x", "value" => "linux_opensuse10"); - - $image_version_arr[] = array("label" => "Red Hat Enterprise Linux 7", "value" => "linux_rhel7"); - $image_version_arr[] = array("label" => "Red Hat Enterprise Linux 6", "value" => "linux_rhel6"); - $image_version_arr[] = array("label" => "Red Hat Enterprise Linux 5", "value" => "linux_rhel5"); - $image_version_arr[] = array("label" => "Red Hat Enterprise Linux 4", "value" => "linux_rhel4"); - - $image_version_arr[] = array("label" => "SUSE Linux Enterprise 12", "value" => "linux_suse12"); - $image_version_arr[] = array("label" => "SUSE Linux Enterprise 11", "value" => "linux_suse11"); - $image_version_arr[] = array("label" => "SUSE Linux Enterprise 10", "value" => "linux_suse10"); - - $image_version_arr[] = array("label" => "Ubuntu 15.10", "value" => "linux_ubuntu1510"); - $image_version_arr[] = array("label" => "Ubuntu 15.04", "value" => "linux_ubuntu1504"); - $image_version_arr[] = array("label" => "Ubuntu 14.10", "value" => "linux_ubuntu1410"); - $image_version_arr[] = array("label" => "Ubuntu 14.04 LTS", "value" => "linux_ubuntu1404"); - $image_version_arr[] = array("label" => "Ubuntu 13.10", "value" => "linux_ubuntu1310"); - $image_version_arr[] = array("label" => "Ubuntu 13.04", "value" => "linux_ubuntu1304"); - $image_version_arr[] = array("label" => "Ubuntu 12.10", "value" => "linux_ubuntu1210"); - $image_version_arr[] = array("label" => "Ubuntu 12.04 LTS", "value" => "linux_ubuntu1204"); - $image_version_arr[] = array("label" => "Ubuntu 11.10", "value" => "linux_ubuntu1110"); - $image_version_arr[] = array("label" => "Ubuntu 11.04", "value" => "linux_ubuntu1104"); - $image_version_arr[] = array("label" => "Ubuntu 10.10", "value" => "linux_ubuntu1010"); - $image_version_arr[] = array("label" => "Ubuntu 10.04 LTS ", "value" => "linux_ubuntu1004"); - - $image_version_arr[] = array("label" => "Windows Server 2016", "value" => "windows_server2016"); - $image_version_arr[] = array("label" => "Windows 10", "value" => "windows_10"); - $image_version_arr[] = array("label" => "Windows Server 2012 R2", "value" => "windows_server2012r2"); - $image_version_arr[] = array("label" => "Windows Server 2012", "value" => "windows_server2012"); - $image_version_arr[] = array("label" => "Windows 8.1", "value" => "windows_81"); - $image_version_arr[] = array("label" => "Windows 8", "value" => "windows_8"); - $image_version_arr[] = array("label" => "Windows 7", "value" => "windows_7"); - $image_version_arr[] = array("label" => "Windows Server 2008", "value" => "windows_2008"); - $image_version_arr[] = array("label" => "Windows Vista", "value" => "windows_vista"); - $image_version_arr[] = array("label" => "Windows Server 2003", "value" => "windows_server2003"); - $image_version_arr[] = array("label" => "Windows XP", "value" => "windows_xp"); - - $image_version_arr[] = array("label" => "Other", "value" => "Other"); - return $image_version_arr; - } - - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/image_authentication.class.php b/openQRM-5.3.50-CE/src/web/base/class/image_authentication.class.php deleted file mode 100644 index 06407d4..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/image_authentication.class.php +++ /dev/null @@ -1,335 +0,0 @@ - -*/ - -// This class represents a image_authentication object in openQRM -// its for registering to set (remove) the authenication of an image -// after its appliance stopped - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; - -global $IMAGE_AUTHENTICATION_TABLE; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXEC_PORT; -$event = new event(); -$openqrm_server = new openqrm_server(); -$OPENQRM_SERVER_IP_ADDRESS=$openqrm_server->get_ip_address(); -global $OPENQRM_SERVER_IP_ADDRESS; -global $event; - - -class image_authentication { - -var $id = ''; -var $image_id = ''; -var $resource_id = ''; -var $auth_type = ''; - // -> 0 = image-root - // -> 1 = image-deployment - - - -// --------------------------------------------------------------------------------- -// methods to create an instance of a image_authentication object filled from the db -// --------------------------------------------------------------------------------- - -// returns an appliance from the db selected by id or name -function get_instance($id, $image_id) { - global $IMAGE_AUTHENTICATION_TABLE; - global $event; - $db=openqrm_get_db_connection(); - if ("$id" != "") { - $image_authentication_array = $db->Execute("select * from $IMAGE_AUTHENTICATION_TABLE where ia_id=$id"); - } else if ("$image_id" != "") { - $image_authentication_array = $db->Execute("select * from $IMAGE_AUTHENTICATION_TABLE where ia_image_id=$image_id"); - } else { - $event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "image_authentication.class.php", "Could not create instance of event without data", "", "", 0, 0, 0); - array_walk(debug_backtrace(),create_function('$a,$b','syslog(LOG_ERR, "{$a[\'function\']}()(".basename($a[\'file\']).":{$a[\'line\']}); ");')); - return; - } - - foreach ($image_authentication_array as $index => $image_authentication) { - $this->id = $image_authentication["ia_id"]; - $this->image_id = $image_authentication["ia_image_id"]; - $this->resource_id = $image_authentication["ia_resource_id"]; - $this->auth_type = $image_authentication["ia_auth_type"]; - } - return $this; -} - -// returns an image_authentication from the db selected by id -function get_instance_by_id($id) { - $this->get_instance($id, ""); - return $this; -} - -// returns an image_authentication from the db selected by the image_id -function get_instance_by_image_id($image_id) { - $this->get_instance("", $image_id); - return $this; -} - -// --------------------------------------------------------------------------------- -// general image_authentication methods -// --------------------------------------------------------------------------------- - - - - -// checks if given image_authentication id is free in the db -function is_id_free($image_authentication_id) { - global $IMAGE_AUTHENTICATION_TABLE; - global $event; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select ia_id from $IMAGE_AUTHENTICATION_TABLE where ia_id=$image_authentication_id"); - if (!$rs) - $event->log("is_id_free", $_SERVER['REQUEST_TIME'], 2, "image_authentication.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - if ($rs->EOF) { - return true; - } else { - return false; - } -} - - -// adds image_authentication to the database -function add($image_authentication_fields) { - global $IMAGE_AUTHENTICATION_TABLE; - global $event; - if (!is_array($image_authentication_fields)) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "image_authentication.class.php", "image_authentication_field not well defined", "", "", 0, 0, 0); - return 1; - } - $image_id = $image_authentication_fields['ia_image_id']; - $auth_type = $image_authentication_fields['ia_auth_type']; - - // before we add we check that it is uniq per image - // so there can just be 2 image_authentications per image, rootfs + deployment - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select ia_id from $IMAGE_AUTHENTICATION_TABLE where ia_image_id=$image_id and ia_auth_type=$auth_type"); - if (!$rs) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "image_authentication.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - if ($rs->EOF) { - $event->log("add", $_SERVER['REQUEST_TIME'], 5, "image_authentication.class.php", "Adding image_authentication for image id $image_id type $auth_type.", "", "", 0, 0, 0); - $result = $db->AutoExecute($IMAGE_AUTHENTICATION_TABLE, $image_authentication_fields, 'INSERT'); - if (! $result) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "image_authentication.class.php", "Failed adding new image_authentication to database", "", "", 0, 0, 0); - } - - } else { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "image_authentication.class.php", "Not adding image_authentication for image id $image_id type $auth_type since it already is registered.", "", "", 0, 0, 0); - } - } -} - - - -// removes image_authentication from the database -function remove($image_authentication_id) { - global $IMAGE_AUTHENTICATION_TABLE; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from $IMAGE_AUTHENTICATION_TABLE where ia_id=$image_authentication_id"); -} - - - -// returns the number of image_authentications for an image_authentication type -function get_count() { - global $IMAGE_AUTHENTICATION_TABLE; - $count=0; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select count(id) as num from $IMAGE_AUTHENTICATION_TABLE"); - if (!$rs) { - print $db->ErrorMsg(); - } else { - $count = $rs->fields["num"]; - } - return $count; -} - - - -// returns a list of all image_authentication names -function get_list() { - global $IMAGE_AUTHENTICATION_TABLE; - $query = "select id, image_id from $IMAGE_AUTHENTICATION_TABLE"; - $image_authentication_name_array = array(); - $image_authentication_name_array = openqrm_db_get_result_double ($query); - return $image_authentication_name_array; -} - - -// returns a list of all image_authentication ids -function get_all_ids() { - global $IMAGE_AUTHENTICATION_TABLE; - global $event; - $image_authentication_list = array(); - $query = "select ia_id from $IMAGE_AUTHENTICATION_TABLE"; - $db=openqrm_get_db_connection(); - $rs = $db->Execute($query); - if (!$rs) - $event->log("get_list", $_SERVER['REQUEST_TIME'], 2, "image_authentication.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $image_authentication_list[] = $rs->fields; - $rs->MoveNext(); - } - return $image_authentication_list; - -} - - - - -// checks all image_authentications and de-authenticates them if -// its resource (the appliance resource) is idle/active again -function check_all_image_authentication() { - global $IMAGE_AUTHENTICATION_TABLE; - global $event; - global $RootDir; - - // $event->log("check_all_image_authentication", $_SERVER['REQUEST_TIME'], 5, "image_authentication.class.php", "Checking all image_authentications", "", "", 0, 0, 0); - $ia_id_ar = $this->get_all_ids(); - foreach($ia_id_ar as $ia_list) { - - $ia_auth_id = $ia_list['ia_id']; - $ia_auth = new image_authentication(); - $ia_auth->get_instance_by_id($ia_auth_id); - $event->log("check_all_image_authentication", $_SERVER['REQUEST_TIME'], 5, "image_authentication.class.php", "Checking image_authentication '$ia_auth_id'", "", "", 0, 0, 0); - - // get data - $image = new image(); - if($ia_auth->image_id>0){ - $image->get_instance_by_id($ia_auth->image_id); - }else{ - $image->get_instance_by_id($ia_auth_id); - } - $image_name = $image->name; - $image_id = $image->id; - - $deployment = new deployment(); - $deployment->get_instance_by_type($image->type); - $deployment_type = $deployment->type; - $deployment_plugin_name = $deployment->storagetype; - $storage_auth_hook = "$RootDir/plugins/$deployment_plugin_name/openqrm-$deployment_type-auth-hook.php"; - - $resource_id = $ia_auth->resource_id; - $resource = new resource(); - $resource->get_instance_by_id($resource_id); - - // check for root or deployment auth - switch ($ia_auth->auth_type) { - case 0: - // run storage_auth_stop (rootfs) - if ((!strcmp($resource->state, "active")) && ($resource->imageid == 1)) { - $event->log("check_all_image_authentication", $_SERVER['REQUEST_TIME'], 5, "image_authentication.class.php", "Resource $resource_id idle again, stop-auth $image_name ($image_id)", "", "", 0, 0, $resource_id); - // include storage-plugin auth-hook - if (file_exists($storage_auth_hook)) { - $event->log("check_all_image_authentication", $_SERVER['REQUEST_TIME'], 5, "image_authentication.class.php", "Deployment type $deployment_type handling stop-auth hook $image_id.", "", "", 0, 0, $resource_id); - require_once "$storage_auth_hook"; - storage_auth_stop($image->id); - // remove image_authentication - $ia_auth->remove($ia_auth_id); - - } - } else { - // resource is still on rebooting - $event->log("check_all_image_authentication", $_SERVER['REQUEST_TIME'], 5, "image_authentication.class.php", "Resource $resource_id still rebooting, waiting for stop-auth $image_name", "", "", 0, 0, $resource_id); - } - break; - - - case 1: - // run storage_auth_stop (deployment export) - // we stop the deployment hook when the resource is active or active/idle - // -> in both states it for sure does not need the deployment mount any more - if (!strcmp($resource->state, "active")) { - $event->log("check_all_image_authentication", $_SERVER['REQUEST_TIME'], 5, "image_authentication.class.php", "Resource $resource_id active, stop-deployment auth $image_name", "", "", 0, 0, $resource_id); - // include storage-plugin auth-hook - if (file_exists($storage_auth_hook)) { - $event->log("check_all_image_authentication", $_SERVER['REQUEST_TIME'], 5, "image_authentication.class.php", "Deployment type $deployment_type handling stop-deployment auth hook $image_id.", "", "", 0, 0, $resource_id); - require_once "$storage_auth_hook"; - storage_auth_deployment_stop($image->id); - - if($ia_auth->image_id > 0){ - $image->get_instance_by_id($ia_auth->image_id); - $image_name = $image->name; - $image_id = $image->id; - } - - if($deployment_type != 'tmpfs-deployment'){ - // remove all install from or transfer to deployment parameters - $image->set_deployment_parameters("IMAGE_INSTALL_FROM_NFS", ""); - $image->set_deployment_parameters("IMAGE_TRANSFER_TO_NFS", ""); - $image->set_deployment_parameters("IMAGE_INSTALL_FROM_LOCAL", ""); - $image->set_deployment_parameters("IMAGE_TRANSFER_TO_LOCAL", ""); - } - // remove image_authentication - $ia_auth->remove($ia_auth_id); - } - } else { - // resource is still on rebooting - $event->log("check_all_image_authentication", $_SERVER['REQUEST_TIME'], 5, "image_authentication.class.php", "Resource $resource_id is still rebooting, waiting for stop-deployment auth $image_name", "", "", 0, 0, $resource_id); - } - break; - - } - - } - -} - - - -// displays the image_authentication-overview -function display_overview($offset, $limit, $sort, $order) { - global $IMAGE_AUTHENTICATION_TABLE; - global $event; - $db=openqrm_get_db_connection(); - $recordSet = $db->SelectLimit("select * from $IMAGE_AUTHENTICATION_TABLE order by $sort $order", $limit, $offset); - $image_authentication_array = array(); - if (!$recordSet) { - $event->log("display_overview", $_SERVER['REQUEST_TIME'], 2, "image_authentication.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($image_authentication_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $image_authentication_array; -} - - - - - - - - - -// --------------------------------------------------------------------------------- - -} - diff --git a/openQRM-5.3.50-CE/src/web/base/class/kernel.class.php b/openQRM-5.3.50-CE/src/web/base/class/kernel.class.php deleted file mode 100644 index 39d6a7b..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/kernel.class.php +++ /dev/null @@ -1,236 +0,0 @@ - -*/ - -// This class represents boot-image (kernel) -// A Kernel can be used to deploy an (server-)image (image.class) -// to a resource (resource.class) via an appliance (appliance.class) - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/event.class.php"; - -global $KERNEL_INFO_TABLE; - - -class kernel { - -var $id = ''; -var $name = ''; -var $version = ''; -var $comment = ''; -var $capabilities = ''; - - -// --------------------------------------------------------------------------------- -// methods to create an instance of a kernel object filled from the db -// --------------------------------------------------------------------------------- - -//-------------------------------------------------- -/** -* Constructor -*/ -//-------------------------------------------------- -function kernel() { - global $KERNEL_INFO_TABLE; - $this->__event = new event(); -} - - -// returns a kernel from the db selected by id or name -function get_instance($id, $name) { - global $KERNEL_INFO_TABLE; - $db=openqrm_get_db_connection(); - if ("$id" != "") { - $kernel_array = $db->Execute("select * from $KERNEL_INFO_TABLE where kernel_id=$id"); - } else if ("$name" != "") { - $kernel_array = $db->Execute("select * from $KERNEL_INFO_TABLE where kernel_name='$name'"); - } else { - $this->__event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "kernel.class.php", "Could not create instance of kernel without data", "", "", 0, 0, 0); - foreach(debug_backtrace() as $key => $msg) { - syslog(LOG_ERR, $msg['function'].'() '.basename($msg['file']).':'.$msg['line']); - } - return; - } - foreach ($kernel_array as $index => $kernel) { - $this->id = $kernel["kernel_id"]; - $this->name = $kernel["kernel_name"]; - $this->version = $kernel["kernel_version"]; - $this->capabilities = $kernel["kernel_capabilities"]; - $this->comment = $kernel["kernel_comment"]; - } - return $this; -} - -// returns a kernel from the db selected by id -function get_instance_by_id($id) { - $this->get_instance($id, ""); - return $this; -} - -// returns a kernel from the db selected by iname -function get_instance_by_name($name) { - $this->get_instance("", $name); - return $this; -} - - - - -// --------------------------------------------------------------------------------- -// general kernel methods -// --------------------------------------------------------------------------------- - - -// checks if given kernel id is free in the db -function is_id_free($kernel_id) { - global $KERNEL_INFO_TABLE; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select kernel_id from $KERNEL_INFO_TABLE where kernel_id=$kernel_id"); - if (!$rs) - $this->__event->log("is_id_free", $_SERVER['REQUEST_TIME'], 2, "kernel.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - if ($rs->EOF) { - return true; - } else { - return false; - } -} - - -// adds kernel to the database -function add($kernel_fields) { - global $KERNEL_INFO_TABLE; - if (!is_array($kernel_fields)) { - $this->__event->log("add", $_SERVER['REQUEST_TIME'], 2, "kernel.class.php", "Kernel_field not well defined", "", "", 0, 0, 0); - return 1; - } - $db=openqrm_get_db_connection(); - $result = $db->AutoExecute($KERNEL_INFO_TABLE, $kernel_fields, 'INSERT'); - if (! $result) { - $this->__event->log("add", $_SERVER['REQUEST_TIME'], 2, "kernel.class.php", "Failed adding new kernel to database", "", "", 0, 0, 0); - } -} - -// updates kernel in the database -function update($kernel_id, $kernel_fields) { - global $KERNEL_INFO_TABLE; - if ($kernel_id < 0 || ! is_array($kernel_fields)) { - $this->__event->log("update", $_SERVER['REQUEST_TIME'], 2, "kernel.class.php", "Unable to update kernel $kernel_id", "", "", 0, 0, 0); - return 1; - } - $db=openqrm_get_db_connection(); - unset($kernel_fields["kernel_id"]); - $result = $db->AutoExecute($KERNEL_INFO_TABLE, $kernel_fields, 'UPDATE', "kernel_id = $kernel_id"); - if (! $result) { - $this->__event->log("update", $_SERVER['REQUEST_TIME'], 2, "kernel.class.php", "Failed updating kernel $kernel_id", "", "", 0, 0, 0); - } -} - -// removes kernel from the database -function remove($kernel_id) { - // do not remove the openqrm + default kernel - if (($kernel_id == 0) || ($kernel_id == 1)) { - return; - } - global $KERNEL_INFO_TABLE; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from $KERNEL_INFO_TABLE where kernel_id=$kernel_id"); -} - -// removes kernel from the database by name -function remove_by_name($kernel_name) { - // do not remove the idle + openqrm image - if (($kernel_name == "openqrm") || ($kernel_name == "default")) { - return; - } - global $KERNEL_INFO_TABLE; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from $KERNEL_INFO_TABLE where kernel_name='$kernel_name'"); -} - - -// returns kernel_name by kernel_id -function get_name($kernel_id) { - global $KERNEL_INFO_TABLE; - $db=openqrm_get_db_connection(); - $kernel_set = $db->Execute("select kernel_name from $KERNEL_INFO_TABLE where kernel_id=$kernel_id"); - if (!$kernel_set) { - $this->__event->log("get_name", $_SERVER['REQUEST_TIME'], 2, "kernel.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - if (!$kernel_set->EOF) { - return $kernel_set->fields["kernel_name"]; - } - } -} - - - -// returns the number of available kernels -function get_count() { - global $KERNEL_INFO_TABLE; - $count=0; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select count(kernel_id) as num from $KERNEL_INFO_TABLE"); - if (!$rs) { - $this->__event->log("get_name", $_SERVER['REQUEST_TIME'], 2, "kernel.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - $count = $rs->fields["num"]; - } - return $count; -} - - - - -// returns a list of all kernel names -function get_list() { - global $KERNEL_INFO_TABLE; - $query = "select kernel_id, kernel_name from $KERNEL_INFO_TABLE"; - $kernel_name_array = array(); - $kernel_name_array = openqrm_db_get_result_double ($query); - return $kernel_name_array; -} - - - -// displays the kernel-overview -function display_overview($offset, $limit, $sort, $order) { - global $KERNEL_INFO_TABLE; - $db=openqrm_get_db_connection(); - $recordSet = $db->SelectLimit("select * from $KERNEL_INFO_TABLE where kernel_id > 0 order by $sort $order", $limit, $offset); - $kernel_array = array(); - if (!$recordSet) { - $this->__event->log("display_overview", $_SERVER['REQUEST_TIME'], 2, "kernel.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($kernel_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $kernel_array; -} - - - - - - - -// --------------------------------------------------------------------------------- - -} - diff --git a/openQRM-5.3.50-CE/src/web/base/class/layersmenu.class.php b/openQRM-5.3.50-CE/src/web/base/class/layersmenu.class.php deleted file mode 100644 index 6328abb..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/layersmenu.class.php +++ /dev/null @@ -1,1353 +0,0 @@ - -*/ - - -// based on PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/ - -/** -* This file contains the code of the LayersMenuCommon class. -* @package PHPLayersMenu -*/ - -/** -* This is the "common" class of the PHP Layers Menu library. -* -* You need to include PEAR.php and DB.php if (and only if) you want to use the DB support provided by ths class. -* -* @version 3.2.0-rc -* @package PHPLayersMenu -*/ -class LayersMenuCommon -{ - -/** -* The name of the package -* @access private -* @var string -*/ -var $_packageName; -/** -* The version of the package -* @access private -* @var string -*/ -var $version; -/** -* The copyright of the package -* @access private -* @var string -*/ -var $copyright; -/** -* The author of the package -* @access private -* @var string -*/ -var $author; - -/** -* URL to be prepended to the menu hrefs -* @access private -* @var string -*/ -var $prependedUrl = ''; -/** -* Do you want that code execution halts on error? -* @access private -* @var string -*/ -var $haltOnError = 'yes'; - -/** -* The base directory where the package is installed -* @access private -* @var string -*/ -var $dirroot; -/** -* The "libjs" directory of the package -* @access private -* @var string -*/ -var $libjsdir; -/** -* The directory where images related to the menu can be found -* @access private -* @var string -*/ -var $imgdir; -/** -* The http path corresponding to imgdir -* @access private -* @var string -*/ -var $imgwww; -/** -* The directory where icons of menu items can be found -* @access private -* @var string -*/ -var $icondir; -/** -* The http path corresponding to icondir -* @access private -* @var string -*/ -var $iconwww; -/** -* This array may contain width and height of all icons -* @access private -* @var integer -*/ -var $iconsize = array(); -/** -* If this var is false, width and height of icons have to be detected; if this var is true, width and height of icons are not detected and are retrieved from the iconsize array -* @access private -* @var boolean -*/ -var $issetIconsize = false; -/** -* The directory where templates can be found -* @access private -* @var string -*/ -var $tpldir; -/** -* The string containing the menu structure -* @access private -* @var string -*/ -var $menuStructure; - -/** -* It counts nodes for all menus -* @access private -* @var integer -*/ -var $_nodesCount; -/** -* A multi-dimensional array to store informations for each menu entry -* @access private -* @var array -*/ -var $tree; -/** -* A multi-dimensional array used only with the DB support; for each $menu_name, it stores the $cnt associated to each item id -* -* This array is needed for selection of the current item -* through the corresponding id (see the DB table structure) -* as, internally, items are stored, sorted and addressed in terms of $cnt -* -* @access private -* @var array -*/ -var $treecnt; -/** -* The maximum hierarchical level of menu items -* @access private -* @var integer -*/ -var $_maxLevel; -/** -* An array that counts the number of first level items for each menu -* @access private -* @var array -*/ -var $_firstLevelCnt; -/** -* An array containing the number identifying the first item of each menu -* @access private -* @var array -*/ -var $_firstItem; -/** -* An array containing the number identifying the last item of each menu -* @access private -* @var array -*/ -var $_lastItem; - -/** -* Data Source Name: the connection string for PEAR DB -* @access private -* @var string -*/ -var $dsn = 'pgsql://dbuser:dbpass@dbhost/dbname'; -/** -* DB connections are either persistent or not persistent -* @access private -* @var boolean -*/ -var $persistent = false; -/** -* Name of the table storing data describing the menu -* @access private -* @var string -*/ -var $tableName = 'phplayersmenu'; -/** -* Name of the i18n table corresponding to $tableName -* @access private -* @var string -*/ -var $tableName_i18n = 'phplayersmenu_i18n'; -/** -* Names of fields of the table storing data describing the menu -* -* default field names correspond to the same field names foreseen -* by the menu structure format -* -* @access private -* @var array -*/ -var $tableFields = array( - 'id' => 'id', - 'parent_id' => 'parent_id', - 'text' => 'text', - 'href' => 'href', - 'title' => 'title', - 'icon' => 'icon', - 'target' => 'target', - 'orderfield' => 'orderfield', - 'expanded' => 'expanded' -); -/** -* Names of fields of the i18n table corresponding to $tableName -* @access private -* @var array -*/ -var $tableFields_i18n = array( - 'language' => 'language', - 'id' => 'id', - 'text' => 'text', - 'title' => 'title' -); -/** -* A temporary array to store data retrieved from the DB and to perform the depth-first search -* @access private -* @var array -*/ -var $_tmpArray = array(); - -/** -* The constructor method; it initializates the menu system -* @return void -*/ -function LayersMenuCommon() -{ - $this->_packageName = 'PHP Layers Menu'; - $this->version = '3.2.0-rc'; - $this->copyright = '(C) 2001-2004'; - $this->author = 'Marco Pratesi - http://www.marcopratesi.it/'; - - $this->prependedUrl = ''; - - $this->dirroot = './'; - $this->libjsdir = './libjs/'; - $this->imgdir = './menuimages/'; - $this->imgwww = 'menuimages/'; - $this->icondir = './menuicons/'; - $this->iconwww = 'menuicons/'; - $this->tpldir = './templates/'; - $this->menuStructure = ''; - $this->separator = '|'; - - $this->_nodesCount = 0; - $this->tree = array(); - $this->treecnt = array(); - $this->_maxLevel = array(); - $this->_firstLevelCnt = array(); - $this->_firstItem = array(); - $this->_lastItem = array(); -} - -/** -* The method to set the prepended URL -* @access public -* @return boolean -*/ -function setPrependedUrl($prependedUrl) -{ - // We do not perform any check - $this->prependedUrl = $prependedUrl; - return true; -} - -/** -* The method to set the dirroot directory -* @access public -* @return boolean -*/ -function setDirrootCommon($dirroot) -{ - if (!is_dir($dirroot)) { - $this->error("setDirroot: $dirroot is not a directory."); - return false; - } - if (substr($dirroot, -1) != '/') { - $dirroot .= '/'; - } - $oldlength = strlen($this->dirroot); - $foobar = strpos($this->libjsdir, $this->dirroot); - if (!($foobar === false || $foobar != 0)) { - $this->libjsdir = $dirroot . substr($this->libjsdir, $oldlength); - } - $foobar = strpos($this->imgdir, $this->dirroot); - if (!($foobar === false || $foobar != 0)) { - $this->imgdir = $dirroot . substr($this->imgdir, $oldlength); - } - $foobar = strpos($this->icondir, $this->dirroot); - if (!($foobar === false || $foobar != 0)) { - $this->icondir = $dirroot . substr($this->icondir, $oldlength); - } - $foobar = strpos($this->tpldir, $this->dirroot); - if (!($foobar === false || $foobar != 0)) { - $this->tpldir = $dirroot . substr($this->tpldir, $oldlength); - } - $this->dirroot = $dirroot; - return true; -} - -/** -* The method to set the libjsdir directory -* @access public -* @return boolean -*/ -function setLibjsdir($libjsdir) -{ - if ($libjsdir != '' && substr($libjsdir, -1) != '/') { - $libjsdir .= '/'; - } - if ($libjsdir == '' || substr($libjsdir, 0, 1) != '/') { - $foobar = strpos($libjsdir, $this->dirroot); - if ($foobar === false || $foobar != 0) { - $libjsdir = $this->dirroot . $libjsdir; - } - } - if (!is_dir($libjsdir)) { - $this->error("setLibjsdir: $libjsdir is not a directory."); - return false; - } - $this->libjsdir = $libjsdir; - return true; -} - -/** -* The method to set the imgdir directory -* @access public -* @return boolean -*/ -function setImgdir($imgdir) -{ - if ($imgdir != '' && substr($imgdir, -1) != '/') { - $imgdir .= '/'; - } - if ($imgdir == '' || substr($imgdir, 0, 1) != '/') { - $foobar = strpos($imgdir, $this->dirroot); - if ($foobar === false || $foobar != 0) { - $imgdir = $this->dirroot . $imgdir; - } - } - if (!is_dir($imgdir)) { - $this->error("setImgdir: $imgdir is not a directory."); - return false; - } - $this->imgdir = $imgdir; - return true; -} - -/** -* The method to set imgwww -* @access public -* @return void -*/ -function setImgwww($imgwww) -{ - if ($imgwww != '' && substr($imgwww, -1) != '/') { - $imgwww .= '/'; - } - $this->imgwww = $imgwww; -} - -/** -* The method to set the icondir directory -* @access public -* @return boolean -*/ -function setIcondir($icondir) -{ - if ($icondir != '' && substr($icondir, -1) != '/') { - $icondir .= '/'; - } - if ($icondir == '' || substr($icondir, 0, 1) != '/') { - $foobar = strpos($icondir, $this->dirroot); - if ($foobar === false || $foobar != 0) { - $icondir = $this->dirroot . $icondir; - } - } - if (!is_dir($icondir)) { - $this->error("setIcondir: $icondir is not a directory."); - return false; - } - $this->icondir = $icondir; - return true; -} - -/** -* The method to set iconwww -* @access public -* @return void -*/ -function setIconwww($iconwww) -{ - if ($iconwww != '' && substr($iconwww, -1) != '/') { - $iconwww .= '/'; - } - $this->iconwww = $iconwww; -} - -/** -* The method to set the iconsize array -* @access public -* @return void -*/ -function setIconsize($width, $height) -{ - $this->iconsize['width'] = ($width == (int) $width) ? $width : 0; - $this->iconsize['height'] = ($height == (int) $height) ? $height : 0; - $this->issetIconsize = true; -} - -/** -* The method to unset the iconsize array -* @access public -* @return void -*/ -function unsetIconsize() -{ - unset($this->iconsize['width']); - unset($this->iconsize['height']); - $this->issetIconsize = false; -} - -/** -* The method to set the tpldir directory -* @access public -* @return boolean -*/ -function setTpldirCommon($tpldir) -{ - if ($tpldir != '' && substr($tpldir, -1) != '/') { - $tpldir .= '/'; - } - if ($tpldir == '' || substr($tpldir, 0, 1) != '/') { - $foobar = strpos($tpldir, $this->dirroot); - if ($foobar === false || $foobar != 0) { - $tpldir = $this->dirroot . $tpldir; - } - } - if (!is_dir($tpldir)) { - $this->error("setTpldir: $tpldir is not a directory."); - return false; - } - $this->tpldir = $tpldir; - return true; -} - -/** -* The method to read the menu structure from a file -* @access public -* @param string $tree_file the menu structure file -* @return boolean -*/ -function setMenuStructureFile($tree_file) -{ - if (!($fd = fopen($tree_file, 'r'))) { - $this->error("setMenuStructureFile: unable to open file $tree_file."); - return false; - } - $this->menuStructure = ''; - while ($buffer = fgets($fd, 4096)) { - $buffer = str_replace(chr(13), '', $buffer); // Microsoft Stupidity Suppression - $this->menuStructure .= $buffer; - } - fclose($fd); - if ($this->menuStructure == '') { - $this->error("setMenuStructureFile: $tree_file is empty."); - return false; - } - return true; -} - -/** -* The method to set the menu structure passing it through a string -* @access public -* @param string $tree_string the menu structure string -* @return boolean -*/ -function setMenuStructureString($tree_string) -{ - $this->menuStructure = str_replace(chr(13), '', $tree_string); // Microsoft Stupidity Suppression - if ($this->menuStructure == '') { - $this->error('setMenuStructureString: empty string.'); - return false; - } - return true; -} - -/** -* The method to set the value of separator -* @access public -* @return void -*/ -function setSeparator($separator) -{ - $this->separator = $separator; -} - -/** -* The method to set parameters for the DB connection -* @access public -* @param string $dns Data Source Name: the connection string for PEAR DB -* @param bool $persistent DB connections are either persistent or not persistent -* @return boolean -*/ -function setDBConnParms($dsn, $persistent=false) -{ - if (!is_string($dsn)) { - $this->error('initdb: $dsn is not an string.'); - return false; - } - if (!is_bool($persistent)) { - $this->error('initdb: $persistent is not a boolean.'); - return false; - } - $this->dsn = $dsn; - $this->persistent = $persistent; - return true; -} - -/** -* The method to set the name of the table storing data describing the menu -* @access public -* @param string -* @return boolean -*/ -function setTableName($tableName) -{ - if (!is_string($tableName)) { - $this->error('setTableName: $tableName is not a string.'); - return false; - } - $this->tableName = $tableName; - return true; -} - -/** -* The method to set the name of the i18n table corresponding to $tableName -* @access public -* @param string -* @return boolean -*/ -function setTableName_i18n($tableName_i18n) -{ - if (!is_string($tableName_i18n)) { - $this->error('setTableName_i18n: $tableName_i18n is not a string.'); - return false; - } - $this->tableName_i18n = $tableName_i18n; - return true; -} - -/** -* The method to set names of fields of the table storing data describing the menu -* @access public -* @param array -* @return boolean -*/ -function setTableFields($tableFields) -{ - if (!is_array($tableFields)) { - $this->error('setTableFields: $tableFields is not an array.'); - return false; - } - if (count($tableFields) == 0) { - $this->error('setTableFields: $tableFields is a zero-length array.'); - return false; - } - reset ($tableFields); - while (list($key, $value) = each($tableFields)) { - $this->tableFields[$key] = ($value == '') ? "''" : $value; - } - return true; -} - -/** -* The method to set names of fields of the i18n table corresponding to $tableName -* @access public -* @param array -* @return boolean -*/ -function setTableFields_i18n($tableFields_i18n) -{ - if (!is_array($tableFields_i18n)) { - $this->error('setTableFields_i18n: $tableFields_i18n is not an array.'); - return false; - } - if (count($tableFields_i18n) == 0) { - $this->error('setTableFields_i18n: $tableFields_i18n is a zero-length array.'); - return false; - } - reset ($tableFields_i18n); - while (list($key, $value) = each($tableFields_i18n)) { - $this->tableFields_i18n[$key] = ($value == '') ? "''" : $value; - } - return true; -} - -/** -* The method to parse the current menu structure and correspondingly update related variables -* @access public -* @param string $menu_name the name to be attributed to the menu -* whose structure has to be parsed -* @return void -*/ -function parseStructureForMenu( - $menu_name = '' // non consistent default... - ) -{ - $this->_maxLevel[$menu_name] = 0; - $this->_firstLevelCnt[$menu_name] = 0; - $this->_firstItem[$menu_name] = $this->_nodesCount + 1; - $cnt = $this->_firstItem[$menu_name]; - $menuStructure = $this->menuStructure; - - /* *********************************************** */ - /* Partially based on a piece of code taken from */ - /* TreeMenu 1.1 - Bjorge Dijkstra (bjorge@gmx.net) */ - /* *********************************************** */ - - while ($menuStructure != '') { - $before_cr = strcspn($menuStructure, "\n"); - $buffer = substr($menuStructure, 0, $before_cr); - $menuStructure = substr($menuStructure, $before_cr+1); - if (substr($buffer, 0, 1) == '#') { - continue; // commented item line... - } - $tmp = rtrim($buffer); - $node = explode($this->separator, $tmp); - for ($i=count($node); $i<=6; $i++) { - $node[$i] = ''; - } - $this->tree[$cnt]['level'] = strlen($node[0]); - $this->tree[$cnt]['text'] = $node[1]; - $this->tree[$cnt]['href'] = $node[2]; - $this->tree[$cnt]['title'] = $node[3]; - $this->tree[$cnt]['icon'] = $node[4]; - $this->tree[$cnt]['target'] = $node[5]; - $this->tree[$cnt]['expanded'] = $node[6]; - $cnt++; - } - - /* *********************************************** */ - - $this->_lastItem[$menu_name] = count($this->tree); - $this->_nodesCount = $this->_lastItem[$menu_name]; - $this->tree[$this->_lastItem[$menu_name]+1]['level'] = 0; - $this->_postParse($menu_name); -} - -/** -* The method to parse the current menu table and correspondingly update related variables -* @access public -* @param string $menu_name the name to be attributed to the menu -* whose structure has to be parsed -* @param string $language i18n language; either omit it or pass -* an empty string ('') if you do not want to use any i18n table -* @return void -*/ -function scanTableForMenu( - $menu_name = '', // non consistent default... - $language = '' - ) -{ - $this->_maxLevel[$menu_name] = 0; - $this->_firstLevelCnt[$menu_name] = 0; - unset($this->tree[$this->_nodesCount+1]); - $this->_firstItem[$menu_name] = $this->_nodesCount + 1; -/* BEGIN BENCHMARK CODE -$time_start = $this->_getmicrotime(); -/* END BENCHMARK CODE */ - $db = DB::connect($this->dsn, $this->persistent); - if (DB::isError($db)) { - $this->error('scanTableForMenu: ' . $db->getMessage()); - } - $dbresult = $db->query(' - SELECT ' . - $this->tableFields['id'] . ' AS id, ' . - $this->tableFields['parent_id'] . ' AS parent_id, ' . - $this->tableFields['text'] . ' AS text, ' . - $this->tableFields['href'] . ' AS href, ' . - $this->tableFields['title'] . ' AS title, ' . - $this->tableFields['icon'] . ' AS icon, ' . - $this->tableFields['target'] . ' AS target, ' . - $this->tableFields['expanded'] . ' AS expanded - FROM ' . $this->tableName . ' - WHERE ' . $this->tableFields['id'] . ' <> 1 - ORDER BY ' . $this->tableFields['orderfield'] . ', ' . $this->tableFields['text'] . ' ASC - '); - $this->_tmpArray = array(); - while ($dbresult->fetchInto($row, DB_FETCHMODE_ASSOC)) { - $this->_tmpArray[$row['id']]['parent_id'] = $row['parent_id']; - $this->_tmpArray[$row['id']]['text'] = $row['text']; - $this->_tmpArray[$row['id']]['href'] = $row['href']; - $this->_tmpArray[$row['id']]['title'] = $row['title']; - $this->_tmpArray[$row['id']]['icon'] = $row['icon']; - $this->_tmpArray[$row['id']]['target'] = $row['target']; - $this->_tmpArray[$row['id']]['expanded'] = $row['expanded']; - } - if ($language != '') { - $dbresult = $db->query(' - SELECT ' . - $this->tableFields_i18n['id'] . ' AS id, ' . - $this->tableFields_i18n['text'] . ' AS text, ' . - $this->tableFields_i18n['title'] . ' AS title - FROM ' . $this->tableName_i18n . ' - WHERE ' . $this->tableFields_i18n['id'] . ' <> 1 - AND ' . $this->tableFields_i18n['language'] . ' = ' . "'$language'" . ' - '); - while ($dbresult->fetchInto($row, DB_FETCHMODE_ASSOC)) { - if (isset($this->_tmpArray[$row['id']])) { - $this->_tmpArray[$row['id']]['text'] = $row['text']; - $this->_tmpArray[$row['id']]['title'] = $row['title']; - } - } - } - unset($dbresult); - unset($row); - $this->_depthFirstSearch($menu_name, $this->_tmpArray, 1, 1); -/* BEGIN BENCHMARK CODE -$time_end = $this->_getmicrotime(); -$time = $time_end - $time_start; -print "TIME ELAPSED = $time\n
    "; -/* END BENCHMARK CODE */ - $this->_lastItem[$menu_name] = count($this->tree); - $this->_nodesCount = $this->_lastItem[$menu_name]; - $this->tree[$this->_lastItem[$menu_name]+1]['level'] = 0; - $this->_postParse($menu_name); -} - -function _getmicrotime() -{ - list($usec, $sec) = explode(' ', microtime()); - return ((float) $usec + (float) $sec); -} - -/** -* Recursive method to perform the depth-first search of the tree data taken from the current menu table -* @access private -* @param string $menu_name the name to be attributed to the menu -* whose structure has to be parsed -* @param array $tmpArray the temporary array that stores data to perform -* the depth-first search -* @param integer $parent_id id of the item whose children have -* to be searched for -* @param integer $level the hierarchical level of children to be searched for -* @return void -*/ -function _depthFirstSearch($menu_name, $tmpArray, $parent_id=1, $level=1) -{ - reset ($tmpArray); - while (list($id, $foobar) = each($tmpArray)) { - if ($foobar['parent_id'] == $parent_id) { - unset($tmpArray[$id]); - unset($this->_tmpArray[$id]); - $cnt = count($this->tree) + 1; - $this->tree[$cnt]['level'] = $level; - $this->tree[$cnt]['text'] = $foobar['text']; - $this->tree[$cnt]['href'] = $foobar['href']; - $this->tree[$cnt]['title'] = $foobar['title']; - $this->tree[$cnt]['icon'] = $foobar['icon']; - $this->tree[$cnt]['target'] = $foobar['target']; - $this->tree[$cnt]['expanded'] = $foobar['expanded']; - $this->treecnt[$menu_name][$id] = $cnt; - unset($foobar); - if ($id != $parent_id) { - $this->_depthFirstSearch($menu_name, $this->_tmpArray, $id, $level+1); - } - } - } -} - -/** -* A method providing parsing needed after both file/string parsing and DB table parsing -* @access private -* @param string $menu_name the name of the menu for which the parsing -* has to be performed -* @return void -*/ -function _postParse( - $menu_name = '' // non consistent default... - ) -{ - for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) { // this counter scans all nodes of the new menu - $this->tree[$cnt]['child_of_root_node'] = ($this->tree[$cnt]['level'] == 1); - $this->tree[$cnt]['parsed_text'] = stripslashes($this->tree[$cnt]['text']); - $this->tree[$cnt]['parsed_href'] = (str_replace(' ', '', $this->tree[$cnt]['href']) == '') ? '#' : $this->prependedUrl . $this->tree[$cnt]['href']; - $this->tree[$cnt]['parsed_title'] = ($this->tree[$cnt]['title'] == '') ? '' : ' title="' . stripslashes($this->tree[$cnt]['title']) . '"'; - $fooimg = $this->icondir . $this->tree[$cnt]['icon']; - if ($this->tree[$cnt]['icon'] != '' && (substr($this->tree[$cnt]['icon'], 0, 7) == 'http://' || substr($this->tree[$cnt]['icon'], 0, 8) == 'https://')) { - $this->tree[$cnt]['parsed_icon'] = $this->tree[$cnt]['icon']; - if ($this->issetIconsize) { - $this->tree[$cnt]['iconwidth'] = $this->iconsize['width']; - $this->tree[$cnt]['iconheight'] = $this->iconsize['height']; - } else { - $foobar = getimagesize($this->tree[$cnt]['icon']); - $this->tree[$cnt]['iconwidth'] = $foobar[0]; - $this->tree[$cnt]['iconheight'] = $foobar[1]; - } - } elseif ($this->tree[$cnt]['icon'] != '' && file_exists($fooimg)) { - $this->tree[$cnt]['parsed_icon'] = $this->iconwww . $this->tree[$cnt]['icon']; - if ($this->issetIconsize) { - $this->tree[$cnt]['iconwidth'] = $this->iconsize['width']; - $this->tree[$cnt]['iconheight'] = $this->iconsize['height']; - } else { - $foobar = getimagesize($fooimg); - $this->tree[$cnt]['iconwidth'] = $foobar[0]; - $this->tree[$cnt]['iconheight'] = $foobar[1]; - } - } else { - $this->tree[$cnt]['parsed_icon'] = ''; - } - $this->tree[$cnt]['parsed_target'] = ($this->tree[$cnt]['target'] == '') ? '' : ' target="' . $this->tree[$cnt]['target'] . '"'; - // $this->tree[$cnt]['expanded'] = ($this->tree[$cnt]['expanded'] == '') ? 0 : $this->tree[$cnt]['expanded']; - $this->_maxLevel[$menu_name] = max($this->_maxLevel[$menu_name], $this->tree[$cnt]['level']); - if ($this->tree[$cnt]['level'] == 1) { - $this->_firstLevelCnt[$menu_name]++; - } - } -} - -/** -* A method to replace strings in all URLs (hrefs) of a menu -* @access public -* @param string $menu_name the name of the menu for which the replacement -* has to be performed -* @param string $string the string to be replaced -* @param string $value the replacement string -* @return void -*/ -function replaceStringInUrls($menu_name, $string, $value) -{ - for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) { // this counter scans all nodes of the new menu - $this->tree[$cnt]['parsed_href'] = str_replace($string, $value, $this->tree[$cnt]['parsed_href']); - } -} - -/** -* A method to set the same target for all links of a menu -* @access public -* @param string $menu_name the name of the menu for which the targets -* have to be set -* @param string $target the target to be set for all links -* of the $menu_name menu -* @return void -*/ -function setLinksTargets($menu_name, $target) -{ - for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) { // this counter scans all nodes of the new menu - $this->tree[$cnt]['parsed_target'] = ' target="' . $target . '"'; - } -} - -/** -* A method to select the current item of $menu_name in terms of $cnt, i.e., very likely, in terms of its line number in the corresponding menu structure file (excluding from the count commented out lines, if any) -* @access public -* @param string $menu_name the name of the menu for which the current item -* has to be selected -* @param integer $count the line number of the current item -* in the corresponding menu structure file -* (excluding from the count commented out lines, if any) -* @return void -*/ -function setSelectedItemByCount($menu_name, $count) -{ - if ($count < 1) { - $this->error("setSelectedItemByCount: the \$count argument is $count, but \$count can not be lower than 1"); - return; - } - if ($count > $this->_lastItem[$menu_name] - $this->_firstItem[$menu_name] + 1) { - $this->error("setSelectedItemByCount: the \$count argument is $count and is larger than the number of items of the '$menu_name' menu"); - return; - } - $cnt = $this->_firstItem[$menu_name] + $count - 1; - $this->tree[$cnt]['selected'] = true; -} - -/** -* A method to select the current item of $menu_name in terms of the corresponding id (see the DB table structure); obviously, this method can be used only together with the DB support -* @access public -* @param string $menu_name the name of the menu for which the current item -* has to be selected -* @param integer $id the id of the current item in the corresponding DB table -* @return void -*/ -function setSelectedItemById($menu_name, $id) -{ - if (!isset($this->treecnt[$menu_name][$id])) { - $this->error("setSelectedItemById: there is not any item with \$id = $id in the '$menu_name' menu"); - return; - } - $cnt = $this->treecnt[$menu_name][$id]; - $this->tree[$cnt]['selected'] = true; -} - -/** -* A method to select the current item of $menu_name specifying a string that occurs in the current URL -* @access public -* @param string $menu_name the name of the menu for which the current item -* has to be selected -* @param string $url a string that occurs in the current URL -* @return void -*/ -function setSelectedItemByUrl($menu_name, $url) -{ - if(isset($url) && $url !== '') { - for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) { // this counter scans all nodes of the new menu - if (!(strpos($this->tree[$cnt]['parsed_href'], $url) === false)) { - $this->tree[$cnt]['selected'] = true; - break; - } - } - } -} - -/** -* A method to select the current item of $menu_name specifying a regular expression that matches (a substring of) the current URL; just the same as the setSelectedItemByUrl() method, but using eregi() instead of strpos() -* @access public -* @param string $menu_name the name of the menu for which the current item -* has to be selected -* @param string $url_eregi the regular expression that matches -* (a substring of) the current URL -* @return void -*/ -function setSelectedItemByUrlEregi($menu_name, $url_eregi) -{ - for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) { // this counter scans all nodes of the new menu - if (eregi($url_eregi, $this->tree[$cnt]['parsed_href'])) { - $this->tree[$cnt]['selected'] = true; - break; - } - } -} - -/** -* Method to handle errors -* @access private -* @param string $errormsg the error message -* @return void -*/ -function error($errormsg) -{ - print "LayersMenu Error: $errormsg
    \n"; - if ($this->haltOnError == 'yes') { - die("Halted.
    \n"); - } -} - -} /* END OF CLASS */ - -?> - -LayersMenuCommon(); - - $this->treeMenuImagesType = 'png'; - $this->treeMenuTheme = ''; - $this->_treeMenu = array(); - - $this->_nodesCount = 0; - $this->tree = array(); - $this->_maxLevel = array(); - $this->_firstLevelCnt = array(); - $this->_firstItem = array(); - $this->_lastItem = array(); -} - -/** -* The method to set the dirroot directory -* @access public -* @return boolean -*/ -function setDirroot($dirroot) -{ - return $this->setDirrootCommon($dirroot); -} - -/** -* The method to set the type of images used for the Tree Menu -* @access public -* @return void -*/ -function setTreeMenuImagesType($treeMenuImagesType) -{ - $this->treeMenuImagesType = $treeMenuImagesType; -} - -/** -* The method to set the prefix for filenames of images of a theme -* @access public -* @return void -*/ -function setTreeMenuTheme($treeMenuTheme) -{ - $this->treeMenuTheme = $treeMenuTheme; -} - -/** -* Method to prepare a new Tree Menu. -* -* This method processes items of a menu to prepare and return -* the corresponding Tree Menu code. -* -* @access public -* @param string $menu_name the name of the menu whose items have to be processed -* @return string -*/ -function newTreeMenu( - $menu_name = '' // non consistent default... - ) -{ - if (!isset($this->_firstItem[$menu_name]) || !isset($this->_lastItem[$menu_name])) { - $this->error("newTreeMenu: the first/last item of the menu '$menu_name' is not defined; please check if you have parsed its menu data."); - return 0; - } - - $this->_treeMenu[$menu_name] = ''; - - $img_collapse = $this->imgwww . $this->treeMenuTheme . 'tree_collapse.' . $this->treeMenuImagesType; - $alt_collapse = '--'; - $img_collapse_corner = $this->imgwww . $this->treeMenuTheme . 'tree_collapse_corner.' . $this->treeMenuImagesType; - $alt_collapse_corner = '--'; - $img_collapse_corner_first = $this->imgwww . $this->treeMenuTheme . 'tree_collapse_corner_first.' . $this->treeMenuImagesType; - $alt_collapse_corner_first = '--'; - $img_collapse_first = $this->imgwww . $this->treeMenuTheme . 'tree_collapse_first.' . $this->treeMenuImagesType; - $alt_collapse_first = '--'; - $img_corner = $this->imgwww . $this->treeMenuTheme . 'tree_corner.' . $this->treeMenuImagesType; - $alt_corner = '`-'; - $img_expand = $this->imgwww . $this->treeMenuTheme . 'tree_expand.' . $this->treeMenuImagesType; - $alt_expand = '+-'; - $img_expand_corner = $this->imgwww . $this->treeMenuTheme . 'tree_expand_corner.' . $this->treeMenuImagesType; - $alt_expand_corner = '+-'; - $img_expand_corner_first = $this->imgwww . $this->treeMenuTheme . 'tree_expand_corner_first.' . $this->treeMenuImagesType; - $alt_expand_corner_first = '+-'; - $img_expand_first = $this->imgwww . $this->treeMenuTheme . 'tree_expand_first.' . $this->treeMenuImagesType; - $alt_expand_first = '+-'; - $img_folder_closed = $this->imgwww . $this->treeMenuTheme . 'tree_folder_closed.' . $this->treeMenuImagesType; - $alt_folder_closed = '->'; - $img_folder_open = $this->imgwww . $this->treeMenuTheme . 'tree_folder_open.' . $this->treeMenuImagesType; - $alt_folder_open = '->'; - $img_leaf = $this->imgwww . $this->treeMenuTheme . 'tree_leaf.' . $this->treeMenuImagesType; - $alt_leaf = '->'; - $img_space = $this->imgwww . $this->treeMenuTheme . 'tree_space.' . $this->treeMenuImagesType; - $alt_space = ' '; - $img_split = $this->imgwww . $this->treeMenuTheme . 'tree_split.' . $this->treeMenuImagesType; - $alt_split = '|-'; - $img_split_first = $this->imgwww . $this->treeMenuTheme . 'tree_split_first.' . $this->treeMenuImagesType; - $alt_split_first = '|-'; - $img_vertline = $this->imgwww . $this->treeMenuTheme . 'tree_vertline.' . $this->treeMenuImagesType; - $alt_vertline = '| '; - - for ($i=0; $i<=$this->_maxLevel[$menu_name]; $i++) { - $levels[$i] = 0; - } - - // Find last nodes of subtrees - $last_level = $this->_maxLevel[$menu_name]; - for ($i=$this->_lastItem[$menu_name]; $i>=$this->_firstItem[$menu_name]; $i--) { - if ($this->tree[$i]['level'] < $last_level) { - for ($j=$this->tree[$i]['level']+1; $j<=$this->_maxLevel[$menu_name]; $j++) { - $levels[$j] = 0; - } - } - if ($levels[$this->tree[$i]['level']] == 0) { - $levels[$this->tree[$i]['level']] = 1; - $this->tree[$i]['last_item'] = 1; - } else { - $this->tree[$i]['last_item'] = 0; - } - $last_level = $this->tree[$i]['level']; - } - - $toggle = ''; - $toggle_function_name = 'toggle' . $menu_name; - - for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) { - if ($this->tree[$cnt]['text'] == '---') { - continue; // separators are significant only for layers-based menus - } - - if (isset($this->tree[$cnt]['selected']) && $this->tree[$cnt]['selected']) { - $linkstyle = 'phplmselected'; - } else { - $linkstyle = 'phplm'; - } - - $this->_treeMenu[$menu_name] .= '
    ' . "\n"; - - /* - Condition zum Ausschalten der leeren Menüeinträge (vorallem im Bereich "Plugins") - Bedingungen: - - * Menüeinträge: - - Aktueller Eintrag hat keinen Link: 'href' und/oder 'parsed_href' sind leer - - Der aktuelle tree-level ist gleich dem des folgenden Elements - - $cnt (Index-ID des aktuellen Eintrags) ist nicht '$this->_firstItem[$menu_name]' - * Letzter Menüeintrag: - - $cnt ist gleich dem letzten Menüeintrag - - Der letzte Menüeintrag hat keinen Link - if(!((empty($this->tree[$cnt]['href']) && $this->tree[$cnt]['level'] == $this->tree[$cnt+1]['level'] && $cnt != $this->_firstItem[$menu_name]) || ($cnt == $this->_lastItem[$menu_name] && empty($this->tree[$cnt]['href']))) - ) - */ - if(!((empty($this->tree[$cnt]['href']) && $this->tree[$cnt]['level'] == $this->tree[$cnt+1]['level'] && $cnt != $this->_firstItem[$menu_name]))) { - - // vertical lines from higher levels - for ($i=0; $i<$this->tree[$cnt]['level']-1; $i++) { - if ($levels[$i] == 1) { - $img = $img_vertline; - $alt = $alt_vertline; - } else { - $img = $img_space; - $alt = $alt_space; - } - $this->_treeMenu[$menu_name] .= '' . $alt . ''; - } - - $not_a_leaf = $cnt<$this->_lastItem[$menu_name] && $this->tree[$cnt+1]['level']>$this->tree[$cnt]['level']; - - if ($this->tree[$cnt]['last_item'] == 1) { - // corner at end of subtree or t-split - if ($not_a_leaf) { - if ($cnt == $this->_firstItem[$menu_name]) { - $img = $img_collapse_corner_first; - $alt = $alt_collapse_corner_first; - } else { - $img = $img_collapse_corner; - $alt = $alt_collapse_corner; - } - $this->_treeMenu[$menu_name] .= '' . $alt . ''; - } else { - $this->_treeMenu[$menu_name] .= '' . $alt_corner . ''; - } - $levels[$this->tree[$cnt]['level']-1] = 0; - } else { - if ($not_a_leaf) { - if ($cnt == $this->_firstItem[$menu_name]) { - $img = $img_collapse_first; - $alt = $alt_collapse_first; - } else { - $img = $img_collapse; - $alt = $alt_collapse; - } - $this->_treeMenu[$menu_name] .= '' . $alt . ''; - } else { - if ($cnt == $this->_firstItem[$menu_name]) { - $img = $img_split_first; - $alt = $alt_split_first; - } else { - $img = $img_split; - $alt = $alt_split; - } - $this->_treeMenu[$menu_name] .= '' . $alt . ''; - } - $levels[$this->tree[$cnt]['level']-1] = 1; - } - - if ($this->tree[$cnt]['parsed_href'] == '' || $this->tree[$cnt]['parsed_href'] == '#') { - $a_href_open_img = ''; - $a_href_close_img = ''; - $a_href_open = ''; - $a_href_close = ''; - } else { - $a_href_open_img = 'tree[$cnt]['parsed_title'] . $this->tree[$cnt]['parsed_target'] . '>'; - $a_href_close_img = ''; - $a_href_open = 'tree[$cnt]['parsed_title'] . $this->tree[$cnt]['parsed_target'] . ' class="' . $linkstyle . '">'; - $a_href_close = ''; - } - - if ($not_a_leaf) { - //$this->_treeMenu[$menu_name] .= $a_href_open_img . '' . $alt_folder_open . '' . $a_href_close_img; - $this->_treeMenu[$menu_name] .= $a_href_open_img . '' . $a_href_close_img; - } else { - if ($this->tree[$cnt]['parsed_icon'] != '') { - $this->_treeMenu[$menu_name] .= $a_href_open_img . '' . $alt_leaf . '' . $a_href_close_img; - } else { - //$this->_treeMenu[$menu_name] .= $a_href_open_img . '' . $alt_leaf . '' . $a_href_close_img; - - } - } - - - //$this->_treeMenu[$menu_name] .= ' drop this ->'; - - $this->_treeMenu[$menu_name] .= ' ' . $a_href_open . $this->tree[$cnt]['text']. $a_href_close . "\n"; - $this->_treeMenu[$menu_name] .= '
    ' . "\n"; - - } - - - if ($cnt<$this->_lastItem[$menu_name] && $this->tree[$cnt]['level']<$this->tree[$cnt+1]['level']) { - $this->_treeMenu[$menu_name] .= '
    ' . "\n"; - if ($this->tree[$cnt]['expanded'] != 1) { - $toggle .= 'if (phplm_expand[\'' . $menu_name . $cnt . '\'] != 1) ' . $toggle_function_name . "('".$menu_name . $cnt . "');\n"; - } else { - $toggle .= 'if (hplm_collapse[\'' . $menu_name . $cnt. '\'] == 1) ' . $toggle_function_name . "('".$menu_name . $cnt . "');\n"; - } - } - - if ($cnt>$this->_firstItem[$menu_name] && $this->tree[$cnt]['level']>$this->tree[$cnt+1]['level']) { - for ($i=max(1, $this->tree[$cnt+1]['level']); $i<$this->tree[$cnt]['level']; $i++) { - $this->_treeMenu[$menu_name] .= '
    ' . "\n"; - } - } - } - -/* - $this->_treeMenu[$menu_name] = - '
    ' . "\n" . - $this->_treeMenu[$menu_name] . - '
    ' . "\n"; -*/ - // Some (old) browsers do not support the "white-space: nowrap;" CSS property... - $this->_treeMenu[$menu_name] = - '' . "\n" . - '' . "\n" . - '' . "\n" . - '' . "\n" . - '
    ' . "\n" . - $this->_treeMenu[$menu_name] . - '
    ' . "\n"; - - - $t = new Template_PHPLIB(); - $t->setFile('tplfile', 'js/treemenu.js'); - $t->setVar(array( - 'menu_name' => $menu_name, - 'toggle_function_name' => $toggle_function_name, - 'img_collapse' => $img_collapse, - 'img_collapse_corner' => $img_collapse_corner, - 'img_collapse_corner_first' => $img_collapse_corner_first, - 'img_collapse_first' => $img_collapse_first, - 'img_expand' => $img_expand, - 'img_expand_corner' => $img_expand_corner, - 'img_expand_corner_first' => $img_expand_corner_first, - 'img_expand_first' => $img_expand_first, - 'img_folder_closed' => $img_folder_closed, - 'img_folder_open' => $img_folder_open - )); - $toggle_function = $t->parse('out', 'tplfile'); - - $toggle_function = - '' . "\n"; - - $toggle = - '' . "\n"; - - $this->_treeMenu[$menu_name] = $toggle_function . "\n" . $this->_treeMenu[$menu_name] . "\n" . $toggle; - - return $this->_treeMenu[$menu_name]; -} - -/** -* Method that returns the code of the requested Tree Menu -* @access public -* @param string $menu_name the name of the menu whose Tree Menu code -* has to be returned -* @return string -*/ -function getTreeMenu($menu_name) -{ - return $this->_treeMenu[$menu_name]; -} - -/** -* Method that prints the code of the requested Tree Menu -* @access public -* @param string $menu_name the name of the menu whose Tree Menu code -* has to be printed -* @return void -*/ -function printTreeMenu($menu_name) -{ - print $this->_treeMenu[$menu_name]; -} - -} /* END OF CLASS */ - diff --git a/openQRM-5.3.50-CE/src/web/base/class/lock.class.php b/openQRM-5.3.50-CE/src/web/base/class/lock.class.php deleted file mode 100644 index b2e5b1f..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/lock.class.php +++ /dev/null @@ -1,187 +0,0 @@ - -*/ - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/event.class.php"; - -$event = new event(); -global $event; - -class lock { - -var $id = ''; -var $time = ''; -var $section = ''; -var $resource_id = ''; -var $token = ''; -var $description = ''; - - - //-------------------------------------------- - /** - * Constructor - * - * @access public - */ - //-------------------------------------------- - function __construct() { - $this->db_name = "lock_info"; - $this->lock_timeout = 200000; - // 100000 = 10 secs - } - - - // --------------------------------------------------------------------------------- - // methods to create an instance of an lock object filled from the db - // --------------------------------------------------------------------------------- - - // returns an lock from the db selected by id, resource_id or section - function get_instance($id, $resource_id, $section) { - global $event; - $db=openqrm_get_db_connection(); - if ($id != "") { - $lock_array = $db->Execute("select * from ".$this->db_name." where lock_id=$id"); - } else if ($resource_id != "") { - $lock_array = $db->Execute("select * from ".$this->db_name." where lock_resource_id=$resource_id"); - } else if ($section != "") { - $lock_array = $db->Execute("select * from ".$this->db_name." where lock_section='$section'"); - } else { - $event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "lock.class.php", "Could not create instance of lock without data", "", "", 0, 0, 0); - foreach(debug_backtrace() as $key => $msg) { - syslog(LOG_ERR, $msg['function'].'() '.basename($msg['file']).':'.$msg['line']); - } - return; - } - foreach ($lock_array as $index => $lock) { - $this->id = $lock["lock_id"]; - $this->time = $lock["lock_time"]; - $this->section = $lock["lock_section"]; - $this->resource_id = $lock["lock_resource_id"]; - $this->token = $lock["lock_token"]; - $this->description = $lock["lock_description"]; - } - return $this; - } - - // returns an lock from the db selected by id - function get_instance_by_id($id) { - $this->get_instance($id, "", ""); - return $this; - } - - // returns an lock from the db selected by resource_id - function get_instance_by_resource_id($resource_id) { - $this->get_instance("", $resource_id, ""); - return $this; - } - - // returns an lock from the db selected by section - function get_instance_by_section($section) { - $this->get_instance("", "", $section); - return $this; - } - - // --------------------------------------------------------------------------------- - // general lock methods - // --------------------------------------------------------------------------------- - - - // checks if given lock id is free in the db - function is_id_free($lock_id) { - global $event; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select lock_id from ".$this->db_name." where lock_id=$lock_id"); - if (!$rs) - $event->log("is_id_free", $_SERVER['REQUEST_TIME'], 2, "lock.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - if ($rs->EOF) { - return true; - } else { - return false; - } - } - - - // adds lock to the database - function add($lock_fields) { - global $event; - if (!is_array($lock_fields)) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "lock.class.php", "array fields not well defined", "", "", 0, 0, 0); - return; - } - $section = $lock_fields['lock_section']; - if (!strlen($section)) { - return; - } - $lock_array = array(); - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select lock_time from ".$this->db_name." where lock_section='$section'"); - if (!$rs) { - $event->log("is_id_free", $_SERVER['REQUEST_TIME'], 2, "lock.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - return; - } else { - if (!$rs->EOF) { - array_push($lock_array, $rs->fields); - } - } - $new_id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - // timeout - $current_lock_time = ""; - if (isset($lock_array[0]['lock_time'])) { - $current_lock_time = $lock_array[0]['lock_time']; - } - if (strlen($current_lock_time)) { - if ($new_id > ($current_lock_time + $this->lock_timeout)) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "lock.class.php", "Timeout for lock ".$current_lock_time."! Force remove lock.", "", "", 0, 0, 0); - $this->remove_by_section($section); - } else { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "lock.class.php", "Still awaiting imeout for lock ".$current_lock_time."! Not adding new lock ".$new_id, "", "", 0, 0, 0); - return; - } - } - $lock_fields['lock_id'] = $new_id; - $lock_fields['lock_time'] = $new_id; - $result = $db->AutoExecute($this->db_name, $lock_fields, 'INSERT'); - if (! $result) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "lock.class.php", "Failed adding new lock to database", "", "", 0, 0, 0); - return; - } - return $new_id; - } - - - // removes lock from the database - function remove($lock_id) { - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from ".$this->db_name." where lock_id=$lock_id"); - } - - // removes lock from the database by section - function remove_by_section($section) { - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from ".$this->db_name." where lock_section='$section'"); - } - - - - -// --------------------------------------------------------------------------------- - -} - diff --git a/openQRM-5.3.50-CE/src/web/base/class/openqrm.api.class.php b/openQRM-5.3.50-CE/src/web/base/class/openqrm.api.class.php deleted file mode 100644 index 20b158a..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/openqrm.api.class.php +++ /dev/null @@ -1,303 +0,0 @@ - - */ - -class openqrm_api -{ -/** -* absolute path to template dir -* @access public -* @var string -*/ -var $tpldir; -/** -* absolute path to webroot -* @access public -* @var string -*/ -var $rootdir; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm_controller - */ - //-------------------------------------------- - function __construct($controller) { - $this->controller = $controller; - $this->response = $this->controller->response; - $this->openqrm = $this->controller->openqrm; - $this->file = $this->controller->openqrm->file(); - $this->user = $this->controller->openqrm->user(); - - $this->openqrm->init(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - */ - //-------------------------------------------- - function action() { - $action = $this->response->html->request()->get('action'); - switch( $action ) { - case 'get_event_status': - $this->get_event_status(); - break; - case 'get_queue_status': - $this->get_queue_status(); - break; - case 'get_info_box': - $this->get_info_box(); - break; - case 'set_language': - $this->set_language(); - break; - case 'plugin': - $this->plugin(); - break; - case 'base': - $this->base(); - break; - case 'lock': - $this->lock(); - break; - } - } - - //-------------------------------------------- - /** - * Get values for top status - * - * @access public - */ - //-------------------------------------------- - function get_event_status() { - $appliance = new appliance(); - $appliance_all = $appliance->get_count(); - $appliance_active = $appliance->get_count_active(); - - $resource = new resource(); - $resource_all = $resource->get_count("all"); - $resource_active = $resource->get_count("online"); - $resource_inactive = $resource->get_count("offline"); - $resource_error = $resource->get_count("error"); - - $event = new event(); - $event_error_count = $event->get_count('error'); - $event_active_count = $event->get_count('active'); - echo $appliance_all."@".$appliance_active."@".$resource_all."@".$resource_active."@".$resource_inactive."@".$resource_error."@".$event_error_count."@".$event_active_count; - } - - //-------------------------------------------- - /** - * Get values from queue - * - * @access public - */ - //-------------------------------------------- - function get_queue_status() { - $running = array(); - $content = ''; - $path = $this->openqrm->get('basedir').'/var/spool/'; - $files = $this->file->get_files($path); - $waiting = count($files); - if($waiting > 0) { - $i = 0; - foreach($files as $file) { - if(stripos($file['name'], 'ouput') !== false) { - $running[$i]['name'] = str_replace('ouput.', '', $file['name']); - $running[$i]['start'] = filemtime($file['path']); - $waiting = $waiting -2; - $i++; - } - } - if(count($running) > 0) { - foreach($running as $key) { - $time = time() - $key['start']; - $content .= 'Running since '.$time.' seconds
    '.$this->file->get_contents($path.'/openqrm-queue.'.$key['name']).'
    '; - } - } - } - // unset data if user is not admin - if(!$this->openqrm->user()->isAdmin()) { - $content = ''; - $running = array(); - } - echo $waiting.";;".count($running).';;'.$content; - } - - //-------------------------------------------- - /** - * Set language - * - * @access public - */ - //-------------------------------------------- - function set_language() { - $name = $this->response->html->request()->get('user'); - $lang = $this->response->html->request()->get('lang'); - $user = new user($name); - $user->set_user_language($name, $lang); - } - - - //-------------------------------------------- - /** - * Get values for info box - * - * @access public - */ - //-------------------------------------------- - function get_info_box() { - $now = $_SERVER['REQUEST_TIME']; - if ($this->openqrm->l[3] == 0) { - $valid = 'unlimited'; - } else { - $valid = date("F j, Y", $this->openqrm->l[3]); - } - $bd = $this->openqrm->get('baseurl'); - $green = 'Active'; - $red = 'Expired'; - $yellow = 'Expiring soon'; - $icon = $red; - $ex = ''; - echo '

    '; - echo "openQRM Community developed by OPENQRM AUSTRALIA PTY LTD.
    - All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. This source code is released under the GNU General Public License version 2 unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. - The latest version of this license can be found at https://openqrm-enterprise.com/license. By using this software, you acknowledge having read this license and agree to be bound thereby.
    "; - echo "

    "; - } - - //-------------------------------------------- - /** - * Load plugins - * - * @access public - */ - //-------------------------------------------- - function plugin() { - $plugin = $this->response->html->request()->get('plugin'); - $name = $plugin; - $class = $plugin; - if($this->response->html->request()->get('controller') !== '') { - $class = $this->response->html->request()->get('controller'); - $name = $class; - } - $class = str_replace('-', '_', $class).'_controller'; - $path = $this->controller->rootdir.'/plugins/'.$plugin.'/class/'.$name.'.controller.class.php'; - if($this->file->exists($path)) { - require_once($path); - $controller = new $class($this->openqrm, $this->response); - if(method_exists($controller, 'api')) { - $controller->api(); - } - } - } - - //-------------------------------------------- - /** - * Load Base - * - * @access public - */ - //-------------------------------------------- - function base() { - $plugin = $this->response->html->request()->get('base'); - $name = $plugin; - $class = $plugin; - if($this->response->html->request()->get('controller') !== '') { - $class = $this->response->html->request()->get('controller'); - $name = $class; - } - $class = str_replace('-', '_', $class).'_controller'; - $path = $this->controller->rootdir.'/server/'.$plugin.'/class/'.$name.'.controller.class.php'; - if($this->file->exists($path)) { - require_once($path); - $controller = new $class($this->openqrm, $this->response); - if(method_exists($controller, 'api')) { - $controller->api(); - } - } - } - - - - //-------------------------------------------- - /** - * global lock - * - * @access public - */ - //-------------------------------------------- - function lock() { - require_once($this->controller->rootdir.'/class/lock.class.php'); - require_once($this->controller->rootdir.'/class/event.class.php'); - $event = new event(); - - $lock_cmd = $this->response->html->request()->get('lock'); - $resource_id = $this->response->html->request()->get('resource_id'); - $section = $this->response->html->request()->get('section'); - if ((!strlen($lock_cmd)) || (!strlen($resource_id)) || (!strlen($section))) { - $event->log("lock", $_SERVER['REQUEST_TIME'], 2, "openqrm.api.class.php", "Got empty paramater for lock, section or resource_id!", "", "", 0, 0, 0); - return; - } - $lock = new lock(); - switch( $lock_cmd ) { - case 'aquire': - $description = $this->response->html->request()->get('description'); - $token = $this->response->html->request()->get('token'); - $lock_fields['lock_resource_id'] = $resource_id; - $lock_fields['lock_section'] = $section; - $lock_fields['lock_description'] = $description; - $lock_fields['lock_token'] = $token; - $lock_id = $lock->add($lock_fields); - if (strlen($lock_id)) { - echo $lock_id; - $event->log("lock", $_SERVER['REQUEST_TIME'], 5, "openqrm.api.class.php", "Section ".$section." is now locked by ".$resource_id."!", "", "", 0, 0, 0); - } else { - $event->log("lock", $_SERVER['REQUEST_TIME'], 2, "openqrm.api.class.php", "Section ".$section." is still locked!", "", "", 0, 0, 0); - } - break; - - case 'release': - $lock->get_instance_by_section($section); - if (!strlen($lock->id)) { - $event->log("lock", $_SERVER['REQUEST_TIME'], 2, "openqrm.api.class.php", "Resource ".$resource_id." trying to remove lock but no lock active for section ".$section, "", "", 0, 0, 0); - return; - } - if ($resource_id == $lock->resource_id) { - $event->log("lock", $_SERVER['REQUEST_TIME'], 5, "openqrm.api.class.php", "Resource ".$resource_id." released lock for section ".$section, "", "", 0, 0, 0); - echo $lock->id; - $lock->remove_by_section($section); - } else { - $event->log("lock", $_SERVER['REQUEST_TIME'], 2, "openqrm.api.class.php", "Resource ".$resource_id." trying to remove lock from ".$lock->resource_id." for section ".$section, "", "", 0, 0, 0); - } - - break; - } - } - - - - -} -?> diff --git a/openQRM-5.3.50-CE/src/web/base/class/openqrm.class.php b/openQRM-5.3.50-CE/src/web/base/class/openqrm.class.php deleted file mode 100644 index 5c284c0..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/openqrm.class.php +++ /dev/null @@ -1,465 +0,0 @@ - - */ - -class openqrm -{ -/** -* Absolute path to istall dir -* @access protected -* @var string -*/ -protected $basedir; -/** -* Absolute path to class dir -* @access protected -* @var string -*/ -protected $classdir; -/** -* Absolute path to web dir -* @access protected -* @var string -*/ -protected $webdir; -/** -* Absolute uri -* @access protected -* @var string -*/ -protected $baseurl; -/** -* openQRM config -* @access protected -* @var string -*/ -protected $config; -/** -* DB object -* @access private -* @var object -*/ -private $db; -/** -* file object -* @access private -* @var object -*/ -private $file; -/** -* admin user object -* @access private -* @var object -*/ -private $admin; -/** -* current user object -* @access private -* @var object -*/ -private $user; -/** -* name of db tables -* @access private -* @var array -*/ -private $table; - - //-------------------------------------------- - /** - * Constructor - * - * @param object $file - * @param object $user - * @param object $response - * @access public - */ - //-------------------------------------------- - function __construct($file, $user, $response) { - if ((file_exists("/etc/init.d/openqrm")) && (is_link("/etc/init.d/openqrm"))) { - $this->basedir = dirname(dirname(dirname(readlink("/etc/init.d/openqrm")))); - } else { - $this->basedir = "/usr/share/openqrm"; - } - $this->response = $response; - $this->classdir = $this->basedir.'/web/base/class'; - $this->webdir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base'; - $this->baseurl = '/openqrm/base'; - $this->config = $this->parse_conf($this->basedir.'/etc/openqrm-server.conf', 'OPENQRM_'); - - $this->table['appliance'] = 'appliance_info'; - $this->table['deployment'] = 'deployment_info'; - $this->table['event'] = 'event_info'; - $this->table['image'] = 'image_info'; - $this->table['kernel'] = 'kernel_info'; - $this->table['resource'] = 'resource_info'; - $this->table['storage'] = 'storage_info'; - $this->table['virtualization'] = 'virtualization_info'; - - // used regexes - $this->regex['name'] = '~^[a-z0-9]+$~i'; - $this->regex['hostname'] = '~^[a-z0-9]{1,}[a-z0-9-]*[a-z0-9]$~i'; - $this->regex['comment'] = '/^[a-z 0-9()._-]+$/i'; - - $this->file = $file; - $this->user = $user; - // load object - - } - - //-------------------------------------------- - /** - * Init - * - * @access public - */ - //-------------------------------------------- - function init() { - require_once($this->classdir.'/appliance.class.php'); - require_once($this->classdir.'/deployment.class.php'); - require_once($this->classdir.'/event.class.php'); - require_once($this->classdir.'/image.class.php'); - require_once($this->classdir.'/kernel.class.php'); - require_once($this->classdir.'/plugin.class.php'); - require_once($this->classdir.'/resource.class.php'); - require_once($this->classdir.'/storage.class.php'); - require_once($this->classdir.'/virtualization.class.php'); - } - - //-------------------------------------------- - /** - * Get object attributes - * - * @access public - * @param string $attrib name of attrib to return - * @param string $key name of attrib key to return - * @return mixed - */ - //-------------------------------------------- - function get($attrib, $key = null) { - if(isset($this->$attrib)) { - $attrib = $this->$attrib; - if(isset($key)) { - if(isset($attrib[$key])) { - return $attrib[$key]; - } - } else { - return $attrib; - } - } - } - - //-------------------------------------------- - /** - * Set object attributes - * - * @access public - * @param string $attrib name of attrib to return - * @param string $key name of attrib key to set - * @return bool - */ - //-------------------------------------------- - function set($attrib, $value, $key = null) { - if(isset($this->$attrib)) { - if(isset($key)) { - $tmp = &$this->$attrib; - if(isset($tmp[$key])) { - $tmp[$key] = $value; - return true; - } else { - return false; - } - } else { - $this->$attrib = $value; - return true; - } - } else { - return false; - } - } - - - //-------------------------------------------- - /** - * converts csv string to associative array - * - * @access public - * @return array - */ - //-------------------------------------------- - function string_to_array($string, $element_delimiter = '|', $value_delimiter = '=') { - $results = array(); - $array = explode($element_delimiter, $string); - foreach ($array as $result) { - $element = explode($value_delimiter, $result); - if (isset($element[1])) { - $results[$element[0]] = $element[1]; - } - } - return $results; - } - - - - //-------------------------------------------- - /** - * Get db object - * - * @access protected - * @return object db - */ - //-------------------------------------------- - protected function db() { - if(!isset($this->db)) { - require_once($this->classdir.'/db.class.php'); - $this->db = new db($this); - } - return $this->db; - } - - //-------------------------------------------- - /** - * Get file object - * - * @access public - * @return file_handler - */ - //-------------------------------------------- - function file() { - return $this->file; - } - - //-------------------------------------------- - /** - * Get admin object - * - * @access public - * @return file_handler - */ - //-------------------------------------------- - function admin() { - if(!isset($this->admin)) { - $user = $this->user(); - $class = get_class($user); - $admin = new $class('openqrm'); - $this->admin = $admin; - } - return $this->admin; - } - - //-------------------------------------------- - /** - * Get user object - * - * @access public - * @return file_handler - */ - //-------------------------------------------- - function user() { - return $this->user; - } - - //-------------------------------------------- - /** - * Get role object (plugin loader) - * - * @access public - * @param htmlobject_response $response - * @return openqrm_role - */ - //-------------------------------------------- - function role($response) { - require_once($this->classdir.'/openqrm.role.class.php'); - $role = new openqrm_role($this, $response); - return $role; - } - - //-------------------------------------------- - /** - * Get appliance object - * - * @access public - * @return object appliance - */ - //-------------------------------------------- - function appliance() { - require_once($this->classdir.'/appliance.class.php'); - return new appliance(); - } - - //-------------------------------------------- - /** - * Get deployment object - * - * @access public - * @return object deployment - */ - //-------------------------------------------- - function deployment() { - require_once($this->classdir.'/deployment.class.php'); - return new deployment(); - } - - //-------------------------------------------- - /** - * Get event object - * - * @access public - * @return object event - */ - //-------------------------------------------- - function event() { - require_once($this->classdir.'/event.class.php'); - return new event(); - } - - //-------------------------------------------- - /** - * Get image object - * - * @access public - * @return object image - */ - //-------------------------------------------- - function image() { - require_once($this->classdir.'/image.class.php'); - return new image(); - } - - //-------------------------------------------- - /** - * Get kernel object - * - * @access public - * @return object kernel - */ - //-------------------------------------------- - function kernel() { - require_once($this->classdir.'/kernel.class.php'); - return new kernel(); - } - - //-------------------------------------------- - /** - * Get plugin object - * - * @access public - * @return object plugin - */ - //-------------------------------------------- - function plugin() { - require_once($this->classdir.'/plugin.class.php'); - return new plugin(); - } - - //-------------------------------------------- - /** - * Get resource object - * - * @access public - * @return object resource - */ - //-------------------------------------------- - function resource() { - require_once($this->classdir.'/resource.class.php'); - return new resource(); - } - - //-------------------------------------------- - /** - * Get storage object - * - * @access public - * @return object storage - */ - //-------------------------------------------- - function storage() { - require_once($this->classdir.'/storage.class.php'); - return new storage(); - } - - //-------------------------------------------- - /** - * Get virtualization object - * - * @access public - * @return object virtualization - */ - //-------------------------------------------- - function virtualization() { - require_once($this->classdir.'/virtualization.class.php'); - return new virtualization(); - } - - //-------------------------------------------- - /** - * Get openqrm server object - * - * @access public - * @return object openqrm_server - */ - //-------------------------------------------- - function server() { - require_once($this->classdir.'/openqrm_server.class.php'); - return new openqrm_server(); - } - - //-------------------------------------------- - /** - * Parse an openqrm config file - * - * @access public - * @param string $path - * @param string $replace - * @return array - */ - //-------------------------------------------- - function parse_conf ( $path, $replace = null ) { - if(file_exists($path)) { - $ini = file( $path ); - if ( count( $ini ) == 0 ) { return array(); } - $globals = array(); - foreach( $ini as $line ){ - $line = trim( $line ); - // Comments - if ( $line == '' || $line{0} != 'O' ) { continue; } - // Key-value pair - list( $key, $value ) = explode( '=', $line, 2 ); - $key = trim( $key ); - if(isset($replace)) { - $key = str_replace($replace, "", $key ); - } - $value = trim( $value ); - $value = str_replace("\"", "", $value ); - $globals[ $key ] = $value; - } - return $globals; - } - } - - //-------------------------------------------- - /** - * lc - * - * @access public - * @param string $path - * @param string $replace - * @return array - */ - //-------------------------------------------- -} -?> diff --git a/openQRM-5.3.50-CE/src/web/base/class/openqrm.cli.class.php b/openQRM-5.3.50-CE/src/web/base/class/openqrm.cli.class.php deleted file mode 100644 index fe63caf..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/openqrm.cli.class.php +++ /dev/null @@ -1,140 +0,0 @@ - - */ - -class openqrm_cli -{ -/** -* absolute path to template dir -* @access public -* @var string -*/ -var $tpldir; -/** -* absolute path to webroot -* @access public -* @var string -*/ -var $rootdir; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm_controller $controller - * @param string $argv console parameters - */ - //-------------------------------------------- - function __construct($controller, $argv) { - $this->controller = $controller; - $this->response = $this->controller->response; - $this->openqrm = $this->controller->openqrm; - $this->file = $this->controller->openqrm->file(); - $this->user = $this->controller->openqrm->user(); - - $this->openqrm->init(); - - // set request params - foreach($argv as $k => $v) { - if($k !== 0) { - $tmp = explode('=', $v); - if(isset($tmp[0]) && isset($tmp[1])) { - if(strpos($tmp[0], '[]') !== false) { - $tmp[0] = str_replace('[]', '', $tmp[0]); - $_REQUEST[$tmp[0]][] = $tmp[1]; - } else { - $_REQUEST[$tmp[0]] = $tmp[1]; - } - } - } - } - #print_r($_REQUEST); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - */ - //-------------------------------------------- - function action() { - $action = $this->response->html->request()->get('action'); - switch( $action ) { - case 'plugin': - $this->plugin(); - break; - case 'base': - $this->base(); - break; - } - } - - //-------------------------------------------- - /** - * Load plugins - * - * @access public - */ - //-------------------------------------------- - function plugin() { - $plugin = $this->response->html->request()->get('plugin'); - $name = $plugin; - $class = $plugin; - if($this->response->html->request()->get('controller') !== '') { - $class = $this->response->html->request()->get('controller'); - $name = $class; - } - $class = str_replace('-', '_', $class).'_controller'; - $path = $this->controller->rootdir.'/plugins/'.$plugin.'/class/'.$name.'.controller.class.php'; - if($this->file->exists($path)) { - require_once($path); - $controller = new $class($this->openqrm, $this->response); - if(method_exists($controller, 'cli')) { - $controller->cli(); - } - } - } - - //-------------------------------------------- - /** - * Load Base - * - * @access public - */ - //-------------------------------------------- - function base() { - $plugin = $this->response->html->request()->get('base'); - $name = $plugin; - $class = $plugin; - if($this->response->html->request()->get('controller') !== '') { - $class = $this->response->html->request()->get('controller'); - $name = $class; - } - $class = str_replace('-', '_', $class).'_controller'; - $path = $this->controller->rootdir.'/server/'.$plugin.'/class/'.$name.'.controller.class.php'; - if($this->file->exists($path)) { - require_once($path); - $controller = new $class($this->openqrm, $this->response); - if(method_exists($controller, 'cli')) { - $controller->cli(); - } - } - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/openqrm.configure.class.php b/openQRM-5.3.50-CE/src/web/base/class/openqrm.configure.class.php deleted file mode 100644 index 6beec09..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/openqrm.configure.class.php +++ /dev/null @@ -1,509 +0,0 @@ - - */ - -class openqrm_configure -{ -/** -* absolute path to template dir -* @access public -* @var string -*/ -var $configure_timeout = 240; -/** -* absolute path to template dir -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'step1' => array ( - 'tab' => 'Step 1', - 'label' => 'Please select a network card', - 'howto' => 'The selected network card will be used to setup openQRM Server and create - the openQRM Management Network. All available and configured network interfaces - on this system are listed on the left.', - 'error_empty' => 'Networkcard may not be empty', - 'saved' => 'Saved networkcard %s', - ), - 'step2' => array ( - 'tab' => 'Step 2', - 'label' => 'Please select a database type', - 'howto' => 'Select the database type to use for storing the openQRM data.', - 'error_empty' => 'Database type may not be empty', - 'saved' => 'Saved database type %s', - ), - 'step3' => array ( - 'tab' => 'Step 3', - 'label' => 'Configure the database connection and initialize openQRM', - 'form_server' => 'Server', - 'form_db' => 'Database', - 'form_user' => 'User', - 'form_password' => 'Password', - 'form_restore' => 'Restore last backup', - 'howto' => 'Fill in the database name, the database server and a username plus password to setup the database connection.', - 'saved' => 'Successfully initialized openQRM', - 'failed' => 'Failed to initialyze openQRM! Please check syslog!', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param htmlobject_response $response - * @param file $file - * @param user $user - */ - //-------------------------------------------- - function __construct($response, $file) { - $this->response = $response; - $this->file = $file; - - if (($this->file->exists("/etc/init.d/openqrm")) && (is_link("/etc/init.d/openqrm"))) { - $this->basedir = dirname(dirname(dirname(readlink("/etc/init.d/openqrm")))); - } else { - $this->basedir = "/usr/share/openqrm"; - } - - $this->webdir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; - - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $this->action = ''; - $ar = $this->response->html->request()->get('step'); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - $content = array(); - switch( $this->action ) { - case '': - case '1': - $content[] = $this->step1(true); - break; - case '2': - $content[] = $this->step1(false); - $content[] = $this->step2(true); - break; - case '3': - $content[] = $this->step1(false); - $content[] = $this->step2(false); - $content[] = $this->step3(true); - break; - default: - $content[] = $this->step1(true); - break; - } - $tab = $this->response->html->tabmenu('configure_tab'); - $tab->message_param = 'configure_msg'; - $tab->css = 'htmlobject_tabs'; - $tab->auto_tab = false; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * Step1 - * - * @access public - * @return array - */ - //-------------------------------------------- - function step1( $visible = false ) { - - $t = ''; - if($visible === true) { - $form = $this->response->get_form('step', '1'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - if ($this->file->exists($this->webdir.'/unconfigured')) { - $i = 0; - $d = array(); - $lines = explode("\n", $this->file->get_contents($this->webdir.'/unconfigured')); - foreach($lines as $line) { - $line = trim($line); - if($line !== '') { - $d['param_nic_'.$i]['label'] = $line; - $d['param_nic_'.$i]['object']['type'] = 'htmlobject_input'; - $d['param_nic_'.$i]['object']['attrib']['type'] = 'radio'; - $d['param_nic_'.$i]['object']['attrib']['name'] = 'nic'; - $d['param_nic_'.$i]['object']['attrib']['value'] = $line; - if($i === 0) { - $d['param_nic_'.$i]['object']['attrib']['checked'] = true; - } - $i++; - } - } - $form->add($d); - } - - if(!$form->get_errors() && $this->response->submit()) { - $nic = $form->get_request('nic'); - if($nic === '') { - $_REQUEST['configure_msg'] = $this->lang['step1']['error_empty']; - } else { - $token = md5(uniqid(rand(), true)); - $command = $this->basedir."/sbin/openqrm-exec -i 127.0.0.1 -l true -t $token -c \"sed -i -e 's/^OPENQRM_SERVER_INTERFACE=.*/OPENQRM_SERVER_INTERFACE=\"$nic\"/g' ".$this->basedir."/etc/openqrm-server.conf\""; - shell_exec($command); - // send to sleep to wait for background command - sleep(6); - $this->response->redirect( - $this->response->get_url('step', '2', 'configure_msg', sprintf($this->lang['step1']['saved'], $nic)) - ); - } - } - - $t = $this->response->html->template($this->tpldir.'/configure1.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['step1']['label'], 'label'); - $t->add($this->lang['step1']['howto'], 'howto'); - $t->add($form); - $t->group_elements(array('param_' => 'form')); - } - - $content['label'] = $this->lang['step1']['tab']; - $content['value'] = $t; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array('step', '1' ); - $content['onclick'] = false; - if($this->action === '1'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Step2 - * - * @access public - * @return array - */ - //-------------------------------------------- - function step2( $visible = false ) { - - $t = ''; - if($visible === true) { - $form = $this->response->get_form('step', '2'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $i = 0; - $d = array(); - $lines = array('mysql', 'postgres'); - foreach($lines as $line) { - if($line !== '') { - $d['param_db_'.$i]['label'] = $line; - $d['param_db_'.$i]['object']['type'] = 'htmlobject_input'; - $d['param_db_'.$i]['object']['attrib']['type'] = 'radio'; - $d['param_db_'.$i]['object']['attrib']['name'] = 'db'; - $d['param_db_'.$i]['object']['attrib']['value'] = $line; - if($i === 0) { - $d['param_db_'.$i]['object']['attrib']['checked'] = true; - } - $i++; - } - } - $form->add($d); - - if($this->response->cancel()) { - $this->response->redirect( - $this->response->get_url('step', '1') - ); - } - - if(!$form->get_errors() && $this->response->submit()) { - $db = $form->get_request('db'); - if($db === '') { - $_REQUEST['configure_msg'] = $this->lang['step2']['error_empty']; - } else { - // do redirect adding db type - $this->response->redirect( - $this->response->get_url('step', '3', 'configure_msg', sprintf($this->lang['step2']['saved'], $db)).'&dbtype='.$db - ); - } - } - - $t = $this->response->html->template($this->tpldir.'/configure2.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['step2']['label'], 'label'); - $t->add($this->lang['step2']['howto'], 'howto'); - $t->add($form); - $t->group_elements(array('param_' => 'form')); - } - - $content['label'] = $this->lang['step2']['tab']; - $content['value'] = $t; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array('step', '2' ); - $content['onclick'] = false; - if($this->action === '2'){ - $content['active'] = true; - } - return $content; - } - - - //-------------------------------------------- - /** - * Step3 - * - * @access public - * @return array - */ - //-------------------------------------------- - function step3( $visible = false ) { - $t = ''; - $dbtype = $this->response->html->request()->get('dbtype'); - $this->response->add('dbtype', $dbtype); - if($visible === true) { - if($dbtype === '') { - $this->response->redirect( - $this->response->get_url('step', '2', 'configure_msg', $this->lang['step2']['error_empty']) - ); - } else { - $form = $this->response->get_form('step', '3'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $d['param_db_1']['label'] = $this->lang['step3']['form_server']; - $d['param_db_1']['required'] = true; - $d['param_db_1']['object']['type'] = 'htmlobject_input'; - $d['param_db_1']['object']['attrib']['type'] = 'text'; - $d['param_db_1']['object']['attrib']['name'] = 'db_server'; - $d['param_db_1']['object']['attrib']['value'] = 'localhost'; - - $d['param_db_2']['label'] = $this->lang['step3']['form_db']; - $d['param_db_2']['required'] = true; - $d['param_db_2']['object']['type'] = 'htmlobject_input'; - $d['param_db_2']['object']['attrib']['type'] = 'text'; - $d['param_db_2']['object']['attrib']['name'] = 'db_name'; - $d['param_db_2']['object']['attrib']['value'] = 'openqrm'; - - $d['param_db_3']['label'] = $this->lang['step3']['form_user']; - $d['param_db_3']['required'] = true; - $d['param_db_3']['object']['type'] = 'htmlobject_input'; - $d['param_db_3']['object']['attrib']['type'] = 'text'; - $d['param_db_3']['object']['attrib']['name'] = 'db_user'; - - $d['param_db_4']['label'] = $this->lang['step3']['form_password']; - $d['param_db_4']['object']['type'] = 'htmlobject_input'; - $d['param_db_4']['object']['attrib']['type'] = 'password'; - $d['param_db_4']['object']['attrib']['name'] = 'db_password'; - - $d['param_db_5']['label'] = $this->lang['step3']['form_restore']; - $d['param_db_5']['object']['type'] = 'htmlobject_input'; - $d['param_db_5']['object']['attrib']['type'] = 'checkbox'; - $d['param_db_5']['object']['attrib']['name'] = 'db_restore'; - - $form->add($d); - - if($this->response->cancel()) { - $this->response->redirect( - $this->response->get_url('step', '2') - ); - } - - if(!$form->get_errors() && $this->response->submit()) { - $type = $dbtype; - $server = $form->get_request('db_server'); - $db = $form->get_request('db_name'); - $user = $form->get_request('db_user'); - $pass = $form->get_request('db_password'); - $restore = $form->get_request('db_restore'); - - $token = md5(uniqid(rand(), true)); - $command = $this->basedir.'/sbin/openqrm-exec -i 127.0.0.1 -l true -t '.$token.' -c'; - $command .= ' "sed -i -e \'s/^OPENQRM_DATABASE_TYPE=.*/OPENQRM_DATABASE_TYPE="'.$type.'"/g\''; - $command .= ' -e \'s/^OPENQRM_DATABASE_SERVER=.*/OPENQRM_DATABASE_SERVER="'.$server.'"/g\''; - $command .= ' -e \'s/^OPENQRM_DATABASE_NAME=.*/OPENQRM_DATABASE_NAME="'.$db.'"/g\''; - $command .= ' -e \'s/^OPENQRM_DATABASE_USER=.*/OPENQRM_DATABASE_USER="'.$user.'"/g\''; - $command .= ' -e \'s/^OPENQRM_DATABASE_PASSWORD=.*/OPENQRM_DATABASE_PASSWORD="'.$pass.'"/g\''; - if (!strcmp($type, "oracle")) { - $command .= ' -e \'s/#OPENQRM_LD_LIBRARY_PATH=.*/OPENQRM_LD_LIBRARY_PATH="'.$oqc_db_ld_path.'"/g\''; - $command .= ' -e \'s/#OPENQRM_ORACLE_HOME=.*/OPENQRM_ORACLE_HOME="'.$oqc_db_home.'"/g\''; - $command .= ' -e \'s/#OPENQRM_TNS_ADMIN=.*/OPENQRM_TNS_ADMIN="'.$oqc_db_tns.'"/g\''; - $command .= ' -e \'s/OPENQRM_LD_LIBRARY_PATH=.*/OPENQRM_LD_LIBRARY_PATH="'.$oqc_db_ld_path.'"/g\''; - $command .= ' -e \'s/OPENQRM_ORACLE_HOME=.*/OPENQRM_ORACLE_HOME="'.$oqc_db_home.'"/g\''; - $command .= ' -e \'s/OPENQRM_TNS_ADMIN=.*/OPENQRM_TNS_ADMIN="'.$oqc_db_tns.'"/g\''; - } - $command .= ' '.$this->basedir.'/etc/openqrm-server.conf"'; - shell_exec($command); - // send to sleep to wait for background command - sleep(4); - // init token plus timeout - $token = md5(uniqid(rand(), true)); - $token .= ".".$this->configure_timeout; - // restore last backup ? - $command = $this->basedir."/sbin/openqrm-exec -i 127.0.0.1 -l true -t ".$token." -c \"".$this->basedir."/bin/openqrm init_config"; - if ($restore !== '') { - $command .= " restore\""; - } else { - $command .= "\""; - } - shell_exec($command); - if (!$this->__check_install($this->webdir.'/unconfigured')) { - $_REQUEST['configure_msg'] = $this->lang['step3']['failed']; - } else { - $this->response->redirect( - $this->response->get_url('none', 'none', 'datacenter_msg', $this->lang['step3']['saved']) - ); - } - } - $t = $this->response->html->template($this->tpldir.'/configure3.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($this->lang['step3']['label'], 'label'); - $t->add($this->lang['step3']['howto'], 'howto'); - $t->add($form); - $t->group_elements(array('param_' => 'form')); - } - } - - $content['label'] = $this->lang['step3']['tab']; - $content['value'] = $t; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array('step', '3' ); - $content['onclick'] = false; - if($this->action === '3'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * check if init was successful - * - * @access protected - * @param file - * @return null - */ - //-------------------------------------------- - function __check_install($file) { - $loop = 0; - while ($this->file->exists($file)) { - sleep(1); - flush(); - $loop++; - if ($loop > $this->configure_timeout) { - return false; - } - } - return true; - } - - //-------------------------------------------- - /** - * Check db - * - * @access protected - * @param $type - * @param $server - * @param $db - * @param $user - * @param $pass - * @return empty|string - */ - //-------------------------------------------- - - -/* - function __check($type, $server, $db, $user, $pass) { - - // try to connect - // different locations of adodb for suse/redhat/debian - if (file_exists('/usr/share/php/adodb/adodb.inc.php')) { - require_once ('/usr/share/php/adodb/adodb.inc.php'); - } else if (file_exists($this->basedir.'/include/adodb/adodb.inc.php')) { - require_once ($this->basedir.'/include/adodb/adodb.inc.php'); - } else if (file_exists('/usr/share/adodb/adodb.inc.php')) { - require_once ('/usr/share/adodb/adodb.inc.php'); - } else { - return 'ERROR: Could not find adodb on this system!'; - } - - // cache output - ob_start(); - - if ($type == "db2") { - $db = ADONewConnection('odbc'); - $db->PConnect($db, $user, $pass); - $db->SetFetchMode(ADODB_FETCH_ASSOC); - return $db; - - } else if ($type == "oracle") { - // we need to use the oci8po driver because it is the - // only oracle driver supporting to set the column-names to lowercase - // via define('ADODB_ASSOC_CASE',0); - $db = NewADOConnection("oci8po"); - $db->Connect($db, $user, $pass); - - } else { - if (strlen($pass)) { - $dsn = "$type://$user:$pass@$server/$db?persist"; - } else { - $dsn = "$type://$user@$server/$db?persist"; - } - $db = ADONewConnection($dsn); - } - - $error = ob_get_contents(); - // end cache - ob_end_clean(); - $error = str_replace("
    ", '', trim($error)); - return $error; - - } -*/ - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/openqrm.content.class.php b/openQRM-5.3.50-CE/src/web/base/class/openqrm.content.class.php deleted file mode 100644 index 258a1f9..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/openqrm.content.class.php +++ /dev/null @@ -1,191 +0,0 @@ - - */ - -class openqrm_content -{ - -var $pluginkey; -/** -* absolute path to template dir -* @access public -* @var string -*/ -var $tpldir; -/** -* absolute path to webroot -* @access public -* @var string -*/ -var $rootdir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param htmlobject_response $response - * @param file $file - * @param user $user - */ - //-------------------------------------------- - function __construct($response, $file, $user, $openqrm) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $file; - $this->user = $user; - $this->request = $this->response->html->request(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/index_content.tpl.php'); - $t->add($this->content(), 'content'); - $t->add($this->pluginkey, 'contentclass'); // needs to run after $this->content() - return $t; - } - - //-------------------------------------------- - /** - * Build content - * - * @access public - * @return htmlobject_tabmenu | string - */ - //-------------------------------------------- - function content() { - - if (isset($lc)) { - return $lc; - } - if($this->request->get('iframe') !== '') { - $this->pluginkey = 'iframe'; - $iframe = parse_url($this->request->get('iframe'), PHP_URL_PATH); - $str = ''; - $name = $this->request->get('name'); - if($name === '') { - $name = 'Iframe'; - } - // assign params to response - $this->response->add('iframe',$this->request->get('iframe')); - $this->response->add('name',$this->request->get('name')); - - // tabs - $content[] = array( - 'label' => $name, - 'value' => $str, - 'target' => $this->response->html->thisfile, - 'request' => $this->response->get_array(), - 'onclick' => false, - 'hidden' => false, - ); - $tab = $this->response->html->tabmenu('iframe_tab'); - $tab->message_param = 'noop'; - $tab->auto_tab = false; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - else if ($this->request->get('base') !== '') { - $plugin = $this->request->get('base'); - $this->pluginkey = $plugin; - $name = $plugin; - $class = $plugin; - if($this->request->get('controller') !== '') { - $class = $this->request->get('controller'); - $name = $class; - } - $class = str_replace('-', '_', $class).'_controller'; - $path = $this->rootdir.'/server/'.$plugin.'/class/'.$name.'.controller.class.php'; - $role = $this->openqrm->role($this->response); - $data = $role->get_plugin($class, $path); - return $data; - } - else if($this->request->get('plugin') !== '') { - $plugin = $this->request->get('plugin'); - $this->pluginkey = $plugin; - $name = $plugin; - $class = $plugin; - if($this->request->get('controller') !== '') { - $class = $this->request->get('controller'); - $name = $class; - } - $class = str_replace('-', '_', $class).'_controller'; - $path = $this->rootdir.'/plugins/'.$plugin.'/class/'.$name.'.controller.class.php'; - if($this->file->exists($path)) { - $role = $this->openqrm->role($this->response); - $data = $role->get_plugin($class, $path); - return $data; - } else { - // handle plugins not oop - $path = $this->rootdir.'/plugins/'.$plugin.'/'.$name.'-manager.php'; - if($this->file->exists($path)) { - $params = ''; - foreach($_REQUEST as $k => $v) { - if(is_string($v)) { - $params .= '&'.$k.'='.$v; - } - if(is_array($v)) { - foreach($v as $key => $value) { - $params .= '&'.$k.'['.$key.']'.'='.$value; - } - } - } - $str = ''; - return $str; - } else { - $role = $this->openqrm->role($this->response); - $data = $role->get_plugin($class, $path); - return $data; - } - } - } else { - // default page - datacenter overview - $this->pluginkey = 'aa_server'; - $path = $this->rootdir.'/server/'.$this->pluginkey.'/class/datacenter.controller.class.php'; - $this->openqrm->init(); - require_once($path); - $controller = new datacenter_controller($this->openqrm, $this->response); - $data = $controller->action(); - return $data; - } - } - - //-------------------------------------------- - /** - * lcc - * - * @access public - * @return null - */ - //-------------------------------------------- -} -?> diff --git a/openQRM-5.3.50-CE/src/web/base/class/openqrm.controller.class.php b/openQRM-5.3.50-CE/src/web/base/class/openqrm.controller.class.php deleted file mode 100644 index 76dd737..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/openqrm.controller.class.php +++ /dev/null @@ -1,393 +0,0 @@ - - */ - -class openqrm_controller -{ -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'content' => array( - 'tab' => 'License', - 'ltimeout' => 'Your openQRM license has expired!', - 'lclients' => 'Your openQRM client license has expired!', - ), - 'top' => array( - 'account' => 'Account', - 'support' => 'Support', - 'info' => 'Info', - 'documentation' => 'Documentation', - 'language' => 'Language', - ), - 'upload' => array( - 'tab' => 'Upload', - 'label' => 'Upload License File(s)', - 'public_key' => 'Public Key', - 'server_license' => 'Server License', - 'client_license' => 'Client Licenses (optional)', - 'welcome' => 'Welcome to your newly installed openQRM Enterprise Edition', - 'explanation' => 'Please activate it by uploading the license key files you received by email.', - 'msg' => 'Uploaded License File %s', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - */ - //-------------------------------------------- - function __construct() { - - // handle timezone needed since php 5.3 - if(function_exists('ini_get')) { - if(ini_get('date.timezone') === '') { - date_default_timezone_set('Europe/Berlin'); - } - } - - $this->rootdir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base'; - $this->tpldir = $this->rootdir.'/tpl'; - - require_once($this->rootdir.'/class/file.handler.class.php'); - $file = new file_handler(); - - require_once($this->rootdir.'/class/htmlobjects/htmlobject.class.php'); - require_once($this->rootdir.'/class/openqrm.htmlobjects.class.php'); - $html = new openqrm_htmlobject(); - - // if openQRM is unconfigured, set openqrm empty - if ($file->exists($this->rootdir.'/unconfigured')) { - $this->openqrm = ''; - $this->webdir = $this->rootdir; - $this->baseurl = $html->thisurl; - } else { - require_once($this->rootdir.'/class/user.class.php'); - $user = new user($_SERVER['PHP_AUTH_USER']); - $user->set_user(); - require_once($this->rootdir.'/class/openqrm.class.php'); - $this->openqrm = new openqrm($file, $user, $html->response()); - $this->webdir = $this->openqrm->get('webdir'); - $this->baseurl = $this->openqrm->get('baseurl'); - } - - // only translate if openqrm is not empty (configure mode) - if($this->openqrm !== '') { - $html->lang = $user->translate($html->lang, $this->rootdir."/lang", 'htmlobjects.ini'); - $file->lang = $user->translate($file->lang, $this->rootdir."/lang", 'file.handler.ini'); - $this->lang = $user->translate($this->lang, $this->rootdir."/lang", 'openqrm.controller.ini'); - } - - require_once $this->rootdir.'/include/requestfilter.inc.php'; - $request = $html->request(); - $request->filter = $requestfilter; - - $this->response = $html->response(); - $this->request = $this->response->html->request(); - $this->file = $file; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - */ - //-------------------------------------------- - function action() { - - $ti = microtime(true); - - // get js translation file; - // EN file serves master key for language labels - $file = $this->rootdir.'/lang/en.javascript.ini'; // 'en.' prefix is needed and must not be renamed - $jstranslation = ''; - if($this->file->exists($file)) { - $lang = $this->file->get_ini($file); - // only translate if openqrm is not empty (configure mode) - if($this->openqrm !== '') { - $lang = $this->openqrm->user()->translate($lang, $this->rootdir."/lang", 'javascript.ini'); - } - $jstranslation = ''."\n"; - } - - // handle scripts and stylesheets - $style = ''; - $script = ''; - $basetarget = ''; - - if($this->request->get('plugin') !== '') { - $plugin = $this->request->get('plugin'); - $style = $this->__renderAssetInclude( '/plugins/'.$plugin.'/css/', 'css' ); - $script = $this->__renderAssetInclude( '/plugins/'.$plugin.'/js/', 'js' ); - $basetarget = ''; - $this->response->add('plugin', $plugin); - if($this->request->get('controller') !== '') { - $this->response->add('controller', $this->request->get('controller')); - } - } - else if ( $this->request->get('base') !== '') { - $plugin = $this->request->get('base'); - $style = $this->__renderAssetInclude( '/server/'.$plugin.'/css/', 'css' ); - $script = $this->__renderAssetInclude( '/server/'.$plugin.'/js/', 'js' ); - $basetarget = ''; - $this->response->params['base'] = $plugin; - if($this->request->get('controller') !== '') { - $this->response->params['controller'] = $this->request->get('controller'); - } - } else { - $plugin = 'aa_server'; - $style = $this->__renderAssetInclude( '/server/'.$plugin.'/css/', 'css' ); - $script = $this->__renderAssetInclude( '/server/'.$plugin.'/js/', 'js' ); - $basetarget = ''; - } - - $t = $this->response->html->template($this->tpldir.'/index.tpl.php'); - - // Configure switch - if ($this->file->exists($this->webdir.'/unconfigured')) { - $t->add('', "lang"); - $t->add('

    Setup

    ', "menu"); - $content = $this->configure(); - } - else if ($this->response->html->request()->get('upload') !== '') { - $t->add($this->openqrm->user()->lang, "lang"); - $t->add($this->menu(), "menu"); - $content = $this->upload(); - } else { - $t->add($this->openqrm->user()->lang, "lang"); - $t->add($this->menu(), "menu"); - $content = $this->content(); - // handle scripts and styles of sub loaded objects (tab in tab) - if($content->__elements['content'] instanceof htmlobject_tabmenu) { - $tabs = $this->__renderTabs($content->__elements['content']); - isset($tabs['script']) ? $script .= $tabs['script'] : null; - isset($tabs['style']) ? $style .= $tabs['style'] : null; - } - } - - $t->add($content, "content"); - $t->add($this->baseurl, "baseurl"); - $t->add($basetarget, "basetarget"); - $t->add($jstranslation, "jstranslation"); - $t->add($style, "style"); - $t->add($script, "script"); - $t->add(date('Y'), "currentyear"); - $t->add($this->top(), "top"); - - $memory = ''; - if(function_exists('memory_get_peak_usage')) { - $memory = memory_get_peak_usage(false); - } - $t->add('Memory: '.$memory.' bytes', 'memory'); - $ti = (microtime(true) - $ti); - $t->add('Time: '.$ti.' sec', 'time'); - - return $t; - } - - //-------------------------------------------- - /** - * Api - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function api() { - if ($this->file->exists($this->rootdir.'/unconfigured')) { - return ''; - } else { - require_once($this->rootdir.'/class/openqrm.api.class.php'); - $controller = new openqrm_api($this); - $controller->action(); - } - } - - //-------------------------------------------- - /** - * CLI - * - * @access public - * @param string $argv console parameters - */ - //-------------------------------------------- - function cli($argv) { - if ($this->file->exists($this->rootdir.'/unconfigured')) { - return ''; - } else { - require_once($this->rootdir.'/class/openqrm.cli.class.php'); - $controller = new openqrm_cli($this, $argv); - $controller->action(); - } - } - - //-------------------------------------------- - /** - * Build Top of page - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function top() { - require_once($this->rootdir.'/class/openqrm.top.class.php'); - $controller = new openqrm_top($this->response, $this->file, $this->openqrm); - $controller->tpldir = $this->tpldir; - $controller->lang = $this->lang['top']; - return $controller->action(); - } - - //-------------------------------------------- - /** - * Build menu - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function menu() { - require_once($this->rootdir.'/class/openqrm.menu.class.php'); - $controller = new openqrm_menu($this->response, $this->file, $this->openqrm->user()); - $controller->tpldir = $this->tpldir; - return $controller->action(); - } - - //-------------------------------------------- - /** - * Handle content - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function content() { - require_once($this->rootdir.'/class/openqrm.content.class.php'); - $controller = new openqrm_content($this->response, $this->file, $this->openqrm->user(), $this->openqrm); - $controller->tpldir = $this->tpldir; - $controller->rootdir = $this->rootdir; - $controller->lang = $this->lang['content']; - $data = $controller->action(); - return $data; - } - - //-------------------------------------------- - /** - * Configure openQRM - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function configure() { - require_once($this->rootdir.'/class/openqrm.configure.class.php'); - $controller = new openqrm_configure($this->response, $this->file); - $controller->tpldir = $this->tpldir; - return $controller->action(); - } - - //-------------------------------------------- - /** - * Upload - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function upload() { - require_once($this->rootdir.'/class/openqrm.upload.class.php'); - $controller = new openqrm_upload($this->response, $this->openqrm); - $controller->tpldir = $this->tpldir; - $controller->lang = $this->lang['upload']; - return $controller->action(); - } - - //-------------------------------------------- - /** - * Render js/css include strings - * - * @access protected - * @param $path path to css/js dir - * @param $mode enum [css|js] - * @return string - */ - //-------------------------------------------- - protected function __renderAssetInclude( $path, $mode ) { - $str = ''; - $files = $this->file->get_files($this->webdir.$path, '', '*.'.$mode); - foreach($files as $file) { - if($mode === 'css') { - $str.= ''."\n"; - } - else if($mode === 'js') { - $str.= ''."\n"; - } - } - return $str; - } - - //-------------------------------------------- - /** - * Read pluginroot attrib (tab in tab) - * - * @access protected - * @param htmloject_tabmenu $obj - * @return array - */ - //-------------------------------------------- - protected function __renderTabs( $obj ) { - $return['script'] = ''; - $return['style'] = ''; - foreach($obj->__data as $a) { - if( - isset($a['active']) && - $a['active'] === true && - isset($a['value']) && - $a['value'] instanceof htmlobject_tabmenu - ){ - if(isset($a['value']->pluginroot)) { - $return['style'] .= $this->__renderAssetInclude( $a['value']->pluginroot.'/css/', 'css' ); - $return['script'] .= $this->__renderAssetInclude( $a['value']->pluginroot.'/js/', 'js' ); - } - $tabs = $this->__renderTabs($a['value']); - isset($tabs['script']) ? $return['script'] .= $tabs['script'] : null; - isset($tabs['style']) ? $return['style'] .= $tabs['style'] : null; - break; - } - } - return $return; - } - - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/openqrm.htmlobjects.class.php b/openQRM-5.3.50-CE/src/web/base/class/openqrm.htmlobjects.class.php deleted file mode 100644 index 1f6dc1d..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/openqrm.htmlobjects.class.php +++ /dev/null @@ -1,168 +0,0 @@ - -*/ - -class openqrm_htmlobject extends htmlobject -{ - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct() { - parent::__construct($_SERVER["DOCUMENT_ROOT"].'/openqrm/base/class/htmlobjects'); - } - - - //------------------------------------------------ - /** - * Request Object - * - * @access public - * @return htmlobject_request - */ - //------------------------------------------------ - function request() { - if(isset($this->__request)) { - $request = $this->__request; - } else { - $request = parent::request(); - $request->filter = array ( - array ( 'pattern' => '/(&#*\w+)[\x00-\x20]+;/u', 'replace' => '$1;'), - array ( 'pattern' => '/(&#x*[0-9A-F]+);*/iu', 'replace' => '$1;'), - // Remove any attribute starting with "on" or xmlns - array ( 'pattern' => '#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', 'replace' => '$1>'), - // Remove javascript: and vbscript: protocols - array ( 'pattern' => '#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', 'replace' => '$1=$2nojavascript...'), - array ( 'pattern' => '#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', 'replace' => '$1=$2novbscript...'), - array ( 'pattern' => '#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', 'replace' => '$1=$2nomozbinding...'), - // Only works in IE: - array ( 'pattern' => '#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', 'replace' => '$1>'), - array ( 'pattern' => '#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', 'replace' => '$1>'), - array ( 'pattern' => '#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#iu', 'replace' => '$1>'), - // Remove namespaced elements (we do not need them) - array ( 'pattern' => '#]*+>#i', 'replace' => ''), - // Remove really unwanted tags - array ( 'pattern' => '#]*+>#i', 'replace' => '') - ); - $this->__request = $request; - } - return $request; - } - - //------------------------------------------------ - /** - * Tabmenu Object - * - * @access public - * @param string $id prefix for posted vars - * @param array $params array(key => value, ...); - * @return htmlobject_tablebuilder - */ - //------------------------------------------------ - function tabmenu( $id = 'currenttab' ) { - $obj = parent::tabmenu($id); - #$obj->message_filter = $this->__request->filter; - return $obj; - } - - //------------------------------------------------ - /** - * Tablebuilder Object - * - * @access public - * @param string $id prefix for posted vars - * @param array $params array(key => value, ...); - * @return htmlobject_tablebuilder - */ - //------------------------------------------------ - - function tablebuilder( $id, $params = null ) { - // handle table params - !isset($_SESSION) ? @session_start() : null; - $vars = $this->request()->get($id); - if($vars !== '') { - $_SESSION['tablebuilder'][$id]['sort'] = $vars['sort']; - $_SESSION['tablebuilder'][$id]['order'] = $vars['order']; - $_SESSION['tablebuilder'][$id]['limit'] = $vars['limit']; - $_SESSION['tablebuilder'][$id]['offset'] = $vars['offset']; - } else { - if(isset($_SESSION['tablebuilder'][$id]['sort'])) { - $_REQUEST[$id]['sort'] = $_SESSION['tablebuilder'][$id]['sort']; - $_REQUEST[$id]['order'] = $_SESSION['tablebuilder'][$id]['order']; - $_REQUEST[$id]['limit'] = $_SESSION['tablebuilder'][$id]['limit']; - $_REQUEST[$id]['offset'] = $_SESSION['tablebuilder'][$id]['offset']; - } - } - $obj = parent::tablebuilder($id, $params); - return $obj; - } - - //------------------------------------------------ - /** - * B Object - * - * @access public - * @return htmlobject_customtag - */ - //------------------------------------------------ - function b() { - return $this->customtag('b'); - } - - //------------------------------------------------ - /** - * I Object - * - * @access public - * @return htmlobject_customtag - */ - //------------------------------------------------ - function i() { - return $this->customtag('i'); - } - - //------------------------------------------------ - /** - * Label Object - * - * @access public - * @return htmlobject_customtag - */ - //------------------------------------------------ - function label() { - return $this->customtag('label'); - } - - //------------------------------------------------ - /** - * Span Object - * - * @access public - * @return htmlobject_customtag - */ - //------------------------------------------------ - function span() { - return $this->customtag('span'); - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/openqrm.menu.class.php b/openQRM-5.3.50-CE/src/web/base/class/openqrm.menu.class.php deleted file mode 100644 index a91946c..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/openqrm.menu.class.php +++ /dev/null @@ -1,161 +0,0 @@ - - */ - -class openqrm_menu -{ -/** -* absolute path to template dir -* @access public -* @var string -*/ -var $tpldir; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param htmlobject_response $response - * @param file $file - * @param user $user - */ - //-------------------------------------------- - function __construct($response, $file, $user) { - global $OPENQRM_SERVER_BASE_DIR; - $this->response = $response; - $this->file = $file; - $this->user = $user; - - $RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; - $this->RootDir = $OPENQRM_SERVER_BASE_DIR.'/openqrm'; - $this->WebDir = '/openqrm/base/'; - $this->ImgDir = $RootDir.'/img/'; - $this->PluginsDir = $RootDir.'plugins/'; - $this->ClassDir = $RootDir.'class/'; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - require_once($_SERVER["DOCUMENT_ROOT"].'/openqrm/base/class/layersmenu.class.php'); - require_once($_SERVER["DOCUMENT_ROOT"].'/openqrm/base/class/PHPLIB.php'); - - $mid = new TreeMenu(); - $mid->dirroot = $this->RootDir; - $mid->imgdir = $this->ImgDir.'menu/'; - $mid->imgwww = $this->WebDir.'img/menu/'; - $mid->icondir = $this->ImgDir.'menu/'; - $mid->iconwww = $this->WebDir.'img/menu/'; - - $strMenuStructure = ''; - - // define the base menu item - $strMenuStructure .= implode('', file($this->RootDir.'/web/base/server/aa_server/menu.txt')); - - if($strMenuStructure != '') { - $mid->setMenuStructureString($strMenuStructure); - } - $mid->setIconsize(18, 18); - $mid->parseStructureForMenu('menu1_'); -// $mid->replaceStringInUrls('menu1_', '&', '&'); - - -// var_dump($_SERVER['QUERY_STRING']); - $mid->setSelectedItemByUrl('menu1_', $_SERVER['QUERY_STRING']); - $mid->newTreeMenu('menu1_'); - - $mid2 = new TreeMenu(); - $mid2->dirroot = $this->RootDir; - $mid2->imgdir = $this->ImgDir.'menu/'; - $mid2->imgwww = $this->WebDir.'img/menu/'; - $mid2->icondir = $this->ImgDir.'menu/'; - $mid2->iconwww = $this->WebDir.'img/menu/'; - - $strMenuStructure = ''; - - // define the plugin manager menu item - $strMenuStructure .= implode('', file($this->PluginsDir.'/aa_plugins/menu.txt')); - - // define the base plugin sections - $strMenuStructure .= $this->parse_subsection("Cloud", "cloud"); - $strMenuStructure .= $this->parse_subsection("Deployment", "deployment"); - $strMenuStructure .= $this->parse_subsection("Highavailability", "HA"); - $strMenuStructure .= $this->parse_subsection("Management", "management"); - $strMenuStructure .= $this->parse_subsection("Monitoring", "monitoring"); - $strMenuStructure .= $this->parse_subsection("Network", "network"); - $strMenuStructure .= $this->parse_subsection("Storage", "storage"); - $strMenuStructure .= $this->parse_subsection("Virtualization", "virtualization"); - $strMenuStructure .= $this->parse_subsection("Misc", "misc"); - - if($strMenuStructure != '') { - $mid2->setMenuStructureString($strMenuStructure); - } - $mid2->setIconsize(18, 18); - $mid2->parseStructureForMenu('menu2_'); - $mid2->setSelectedItemByUrl('menu2_', $_SERVER['QUERY_STRING']); - $mid2->newTreeMenu('menu2_'); - - $t = $this->response->html->template($this->tpldir.'/index_menu.tpl.php'); - $t->add("time()", 'timestamp'); - $t->add($mid->getTreeMenu('menu1_'), 'menu_1'); - $t->add($mid2->getTreeMenu('menu2_'), 'menu_2'); - return $t; - } - - //-------------------------------------------- - /** - * Parse menu.txt files for phplayers - * - * @access private - * @return string - */ - //-------------------------------------------- - function parse_subsection($menuname, $name) { - global $OPENQRM_SERVER_BASE_DIR; - $str = ''; - $folders = $this->file->get_folders($this->RootDir.'/plugins'); - $menu = ".|$menuname\n"; - foreach ($folders as $plug) { - $filename = $this->PluginsDir.'/'.$plug['name'].'/menu.txt'; - $plugin_config = $plug['path'].'/etc/openqrm-plugin-'.$plug['name'].'.conf'; - if($this->file->exists($plugin_config)) { - $store = ""; - $store = openqrm_parse_conf($plugin_config); - extract($store); - if (!strcmp($store['OPENQRM_PLUGIN_TYPE'], $name)) { - if($this->file->exists($filename)) { - $str .= implode('', file($filename)); - } - } - } - } - // workaround for img path - if($str !== '') { - $str = str_replace('|../../', '|', $str); - $str = $menu.$str; - } - return $str; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/openqrm.role.class.php b/openQRM-5.3.50-CE/src/web/base/class/openqrm.role.class.php deleted file mode 100644 index 4b42f6f..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/openqrm.role.class.php +++ /dev/null @@ -1,169 +0,0 @@ - - */ - -class openqrm_role -{ - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->response = $response; - } - - //-------------------------------------------- - /** - * Get plugin - * - * @access public - * @param string $class - * @param string $path - */ - //-------------------------------------------- - function get_plugin($class, $path) { - if($this->openqrm->file()->exists($path)) { - $this->openqrm->init(); - require_once($path); - $controller = new $class($this->openqrm, $this->response); - $data = $this->check_permission($controller); - return $data; - } - else { - $t = $this->response->html->template($this->openqrm->get('webdir').'/tpl/plugin_not_found.tpl.php'); - $t->add(str_replace('_controller', '', $class), 'plugin'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - - $content['label'] = 'Plugin not found'; - $content['value'] = $t; - $content['target'] = $this->response->html->thisfile; - $content['request'] = array(); - $content['onclick'] = false; - $content['active'] = true; - $tab = $this->response->html->tabmenu('permissions'); - $tab->css = 'htmlobject_tabs'; - $tab->add(array($content)); - return $tab; - } - } - - //-------------------------------------------- - /** - * check_permission - * - * datacenter_controller, user_controller, - * documentation_controller, about(_.._controller)s - * and action load(...) will be ignored - * - * @access public - * @param object $object - * @param bool $bool if true only true or false will be returned - * @return htmlobject_template|bool - */ - //-------------------------------------------- - function check_permission($object = null, $bool = false) { - $controller = get_class($object); - $action = $this->response->html->request()->get($object->actions_name); - $user = $this->openqrm->user(); - if(is_array($action)) { - $action = key($action); - } - if( - !$user->isAdmin() && - $controller !== 'datacenter_controller' && - $controller !== 'user_controller' && - $controller !== 'documentation_controller' && - strripos($controller, 'about') === false && - substr($action, 0, 4) !== 'load' - ) { - // check for plugin implementing the role hook - $plugin = new plugin(); - $enabled_plugins = $plugin->enabled(); - foreach ($enabled_plugins as $index => $plugin_name) { - $plugin_role_hook = $this->openqrm->get('webdir')."/plugins/".$plugin_name."/openqrm-".$plugin_name."-role-hook.class.php"; - if (file_exists($plugin_role_hook)) { - require_once $plugin_role_hook; - $plugin_role_hook_class = "openqrm-".$plugin_name."-role-hook"; - $plugin_role_hook_class = str_replace("-", "_", $plugin_role_hook_class); - $plugin_role_hook_method = $plugin_name."-check_permission"; - $plugin_role_hook_method = str_replace("-", "_", $plugin_role_hook_method); - $plugin_role_hook = new $plugin_role_hook_class($this->openqrm, $object); - return $plugin_role_hook->$plugin_role_hook_method($bool); - } - } - // no plugin implemented the role hook, go on with basic role permission check - // is_not_admin -> tab menu with global error permission msg - $response = $object->response; - $html = $response->html; - // handle empty action - if($action === '') { - // try select as first action - if(method_exists($object, 'select')) { - $action = 'select'; - } else { - // pick first method as action - $m = get_class_methods($object); - foreach($m as $a) { - if(!in_array($a, array('api', 'action')) && strpos($a, '__') === false && strripos($a, 'reload') === false) { - $action = $a; - break; - } - } - } - } - - if($bool === true) { - return false; - } else { - $controller = str_replace('_controller', '', get_class($object)); - $controller = str_replace('aa_', '', $controller); - - $t = $html->template($this->openqrm->get('webdir').'/tpl/permission_denied.tpl.php'); - $t->add($action, 'action'); - $t->add($controller, 'controller'); - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - - $content['label'] = 'Permissions'; - $content['value'] = $t; - $content['target'] = $html->thisfile; - $content['request'] = $response->get_array($object->actions_name, '' ); - $content['onclick'] = false; - $content['active'] = true; - $tab = $html->tabmenu('permissions'); - $tab->css = 'htmlobject_tabs'; - $tab->add(array($content)); - return $tab; - } - - } else { - if($bool === true) { - return true; - } else { - return $object->action(); - } - } - } - - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/openqrm.top.class.php b/openQRM-5.3.50-CE/src/web/base/class/openqrm.top.class.php deleted file mode 100644 index 1294892..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/openqrm.top.class.php +++ /dev/null @@ -1,129 +0,0 @@ - - */ - -class openqrm_top -{ -/** -* absolute path to template dir -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param htmlobject_response $response - * @param file $file - * @param openqrm $openqrm - */ - //-------------------------------------------- - function __construct($response, $file, $openqrm) { - $this->response = $response; - $this->file = $file; - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/index_top.tpl.php'); - // only translate if user is not empty (configure mode) - if($this->openqrm !== '') { - $t->add($this->openqrm->user()->name, 'username'); - $t->add($this->openqrm->user()->lang, 'userlang'); - $t->add($this->lang['account'], 'account'); - $t->add($this->lang['documentation'], 'documentation'); - $t->add($this->lang['info'], 'info'); - $t->add($this->lang['support'], 'support'); - $t->add($this->response->html->thisfile, 'thisfile'); - $t->add($this->openqrm->user()->lang, 'userlang'); - $openqrm_config = $this->openqrm->get('config'); - $openqrm_version = $openqrm_config['SERVER_VERSION'].".".$openqrm_config['MINOR_RELEASE_VERSION']; - $t->add($openqrm_version, 'version'); - - $a = $this->response->html->a(); - $a->href = '../'; - $a->label = ' '; - $a->title = 'Logout'; - $a->css = 'logout'; - $a->id = 'logoutbutton'; - $a->style = 'display:none;'; - $a->handler = 'onclick="Logout(this);return false;"'; - $logout = $a->get_string(); - $logout .= ''; - - $select = $this->response->html->select(); - $select->css = 'htmlobject_select'; - $select->id = 'Language_select'; - $select->name = 'language'; - $select->handler = 'onchange="wait(); set_language();"'; - - $languages = array(); - $files = $this->file->get_files($this->openqrm->get('basedir').'/web/base/lang/', '', '*.htmlobjects.ini'); - foreach($files as $v) { - $tmp = explode('.', $v['name']); - $languages[] = $tmp[0]; - } - - foreach($languages as $lang) { - $o = $this->response->html->option(); - $o->label = ' '.$lang; - $o->css = 'lang-'.$lang; - $o->value = $lang; - $o->style = 'background-image: url(img/'.$lang.'.gif) no-repeat'; - if($lang === $this->openqrm->user()->lang) { - $o->selected = true; - } - $select->add($o); - } - $box = $this->response->html->box(); - $box->id = 'Language_box'; - $box->label = $this->lang['language']; - $box->add($select); - $box->add($logout); - - $t->add($box, 'language_select'); - } else { - $t->add(' ', 'language_select'); - $t->add(' ', 'account'); - $t->add(' ', 'documentation'); - $t->add(' ', 'info'); - $t->add(' ', 'support'); - } - return $t; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/openqrm.upload.class.php b/openQRM-5.3.50-CE/src/web/base/class/openqrm.upload.class.php deleted file mode 100644 index b18d56e..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/openqrm.upload.class.php +++ /dev/null @@ -1,155 +0,0 @@ - - */ - -class openqrm_upload -{ -/** -* absolute path to template dir -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang; - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param htmlobject_response $response - * @param object $openqrm - */ - //-------------------------------------------- - function __construct($response, $openqrm) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->openqrm->init(); - require_once($this->openqrm->get('classdir').'/file.upload.class.php'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $content[] = $this->upload(); - - $tab = $this->response->html->tabmenu('upload_tab'); - $tab->message_param = 'upload_msg'; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * Upload - * - * @access public - * @return array - */ - //-------------------------------------------- - function upload() { - - $response = $this->response; - $form = $response->get_form('upload', 'true'); - $form->box_css = 'htmlobject_box'; - $form->display_errors = false; - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $d['upload_1']['label'] = $this->lang['public_key']; - $d['upload_1']['object']['type'] = 'input'; - $d['upload_1']['object']['attrib']['type'] = 'file'; - $d['upload_1']['object']['attrib']['name'] = 'upload_1'; - $d['upload_1']['object']['attrib']['size'] = 30; - - $d['upload_2']['label'] = $this->lang['server_license']; - $d['upload_2']['object']['type'] = 'input'; - $d['upload_2']['object']['attrib']['type'] = 'file'; - $d['upload_2']['object']['attrib']['name'] = 'upload_2'; - $d['upload_2']['object']['attrib']['size'] = 30; - - $d['upload_3']['label'] = $this->lang['client_license']; - $d['upload_3']['object']['type'] = 'input'; - $d['upload_3']['object']['attrib']['type'] = 'file'; - $d['upload_3']['object']['attrib']['name'] = 'upload_3'; - $d['upload_3']['object']['attrib']['size'] = 30; - - $form->add($d); - - if(!$form->get_errors() && $response->submit()) { - $upload = new file_upload($this->openqrm->file()); - $upload->lang = $this->openqrm->user()->translate($upload->lang, $this->openqrm->get('basedir')."/web/base/lang", 'file.upload.ini'); - $error = ''; - for($i = 1; $i < 4; $i++) { - if($_FILES['upload_'.$i]['name'] !== '') { - $msg = $upload->upload('upload_'.$i, $this->openqrm->get('webdir').'/tmp/', '', true); - if($msg !== '') { - $error .= $msg['msg'].'
    '; - } - } - } - if($error !== '') { - $_REQUEST['upload_msg'] = $error; - } else { - $response_msg = array(); - for($i = 1; $i < 4; $i++) { - if($_FILES['upload_'.$i]['name'] !== '') { - $command = $this->openqrm->get('basedir')."/bin/openqrm license -l ".$this->openqrm->get('webdir')."/tmp/".$_FILES['upload_'.$i]['name']." --openqrm-cmd-mode background"; - $resource = new resource(); - $resource->get_instance_by_id(0); - $resource->send_command($resource->ip, $command); - $response_msg[] = sprintf($this->lang['msg'], $_FILES['upload_'.$i]['name']); - sleep(4); - } - } - $response_msg = implode('
    ', $response_msg); - $response->redirect($this->openqrm->get('baseurl').'/index.php?datacenter_msg='.$response_msg.'&upload_msg='.$response_msg); - } - } - $t = $this->response->html->template($this->openqrm->get('webdir').'/tpl/upload.tpl.php'); - $t->add($response->html->thisfile, 'thisfile'); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['welcome'], 'welcome'); - $t->add($this->lang['explanation'], 'explanation'); - $t->add($form->get_elements()); - $t->group_elements(array('param_' => 'form')); - - $content['label'] = $this->lang['tab']; - $content['value'] = $t; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array('upload', 'true' ); - $content['onclick'] = false; - $content['active'] = true; - - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/openqrm_server.class.php b/openQRM-5.3.50-CE/src/web/base/class/openqrm_server.class.php deleted file mode 100644 index 58f031b..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/openqrm_server.class.php +++ /dev/null @@ -1,101 +0,0 @@ - -*/ - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/event.class.php"; - -global $RESOURCE_INFO_TABLE; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXECUTION_LAYER; -$event = new event(); -global $event; - -class openqrm_server { - -var $id = ''; - - -// --------------------------------------------------------------------------------- -// general server methods -// --------------------------------------------------------------------------------- - -// returns the ip of the openQRM-server -function get_ip_address() { - global $RESOURCE_INFO_TABLE; - global $event; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select resource_openqrmserver from $RESOURCE_INFO_TABLE where resource_id=0"); - if (!$rs) - $event->log("get_ip_address", $_SERVER['REQUEST_TIME'], 2, "openqrm_server.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $resource_openqrmserver=$rs->fields["resource_openqrmserver"]; - $rs->MoveNext(); - } - if (!strlen($resource_openqrmserver)) { - $event->log("get_ip_address", $_SERVER['REQUEST_TIME'], 2, "openqrm_server.class.php", "Could not find out IP-Address of the openQRM server. Server misconfiguration!", "", "", 0, 0, 0); - } - return $resource_openqrmserver; -} - - -// function to send a command to the openQRM-server -function send_command($server_command, $command_timeout = NULL, $run_local = NULL) { - global $OPENQRM_EXEC_PORT; - // global $OPENQRM_SERVER_IP_ADDRESS; - $OPENQRM_SERVER_IP_ADDRESS=$this->get_ip_address(); - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_EXECUTION_LAYER; - global $event; - - // check which execution layer to use - switch($OPENQRM_EXECUTION_LAYER) { - case 'dropbear': - // generate a random token for the cmd - $cmd_token = md5(uniqid(rand(), true)); - // custom timeout ? - if (!is_null($command_timeout)) { - $cmd_token .= ".".$command_timeout; - } - // run local ? - $run_local_parameter = ''; - if (!is_null($run_local)) { - $run_local_parameter = "-l true"; - } - $final_command = "$OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-exec -i $OPENQRM_SERVER_IP_ADDRESS -t $cmd_token $run_local_parameter -c \"$server_command\""; - // $event->log("send_command", $_SERVER['REQUEST_TIME'], 5, "openqrm_server.class.php", "Running : $final_command", "", "", 0, 0, 0); - shell_exec($final_command); - return true; - break; - case 'rabbitmq': - $event->log("send_command", $_SERVER['REQUEST_TIME'], 5, "openqrm_server.class.php", "Sending command to the rabbit queue $OPENQRM_SERVER_IP_ADDRESS", "", "", 0, 0, 0); - require_once $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/class/rabbit.class.php'; - $rabbit = new rabbit(); - $rabbit->queue($OPENQRM_SERVER_IP_ADDRESS, $server_command); - break; - } - -} - - - -// --------------------------------------------------------------------------------- - -} - diff --git a/openQRM-5.3.50-CE/src/web/base/class/plugin.class.php b/openQRM-5.3.50-CE/src/web/base/class/plugin.class.php deleted file mode 100644 index 721e82f..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/plugin.class.php +++ /dev/null @@ -1,216 +0,0 @@ - -*/ - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once ($RootDir.'include/openqrm-server-config.php'); -require_once "$RootDir/class/folder.class.php"; -require_once "$RootDir/class/event.class.php"; - -/** - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - * @author M. Rechenburg, A. Kuballa - * @version 1.1 added documentation - */ -class plugin -{ -/** -* path to openqrm webdir -* @access protected -* @var string -*/ -var $_web_dir; -/** -* path to openqrm basedir -* @access protected -* @var string -*/ -var $_base_dir; -/** -* event object -* @access protected -* @var object -*/ -var $_event; - - //-------------------------------------------------- - /** - * Constructor - */ - //-------------------------------------------------- - function plugin() { - $this->init(); - } - - //-------------------------------------------------- - /** - * init plugin environment - * @access public - */ - //-------------------------------------------------- - function init() { - global $RootDir, $OPENQRM_SERVER_BASE_DIR; - $this->_event = new event(); - $this->_web_dir = $RootDir; - $this->_base_dir = $OPENQRM_SERVER_BASE_DIR; - } - - //-------------------------------------------------- - /** - * return a list of available plugins - * @access public - * @return array - */ - //-------------------------------------------------- - // return a list of available plugins - function available() { - $plugin_array = array(); - $plugins = new Folder(); - $plugins->getFolders("$this->_base_dir/openqrm/plugins/"); - foreach ($plugins->folders as $plugin) { - array_push($plugin_array, $plugin); - } - return $plugin_array; - } - - //-------------------------------------------------- - /** - * return a list of enabled plugins - * @access public - * @return array - */ - //-------------------------------------------------- - function enabled() { - $plugin_array = array(); - $plugins = new Folder(); - $plugins->getFolders($this->_web_dir.'plugins/'); - foreach ($plugins->folders as $plugin) { - if ("$plugin" != "aa_plugins") { - $plugin=basename(dirname(realpath($this->_web_dir.'plugins/'.$plugin))); - array_push($plugin_array, $plugin); - } - - } - return $plugin_array; - } - - //-------------------------------------------------- - /** - * return a list of started plugins - * @access public - * @return array - */ - //-------------------------------------------------- - function started() { - $plugin_array = array(); - $plugins = new Folder(); - $plugins->getFolders($this->_web_dir.'plugins/'); - foreach ($plugins->folders as $plugin) { - if ("$plugin" != "aa_plugins") { - $plugin=basename(dirname(realpath($this->_web_dir.'plugins/'.$plugin))); - $plugin_status="$this->_web_dir/plugins/$plugin/.running"; - if (file_exists($plugin_status)) { - array_push($plugin_array, $plugin); - } - } - - } - return $plugin_array; - } - - //-------------------------------------------------- - /** - * get plugin config - * @access public - * @param string $plugin_name - * @return array - */ - //-------------------------------------------------- - function get_config($plugin_name) { - $ar_Return = array(); - - // values not configurable - $blacklist[] = 'OPENQRM_PLUGIN_VERSION'; - $blacklist[] = 'OPENQRM_PLUGIN_BUILD_REQUIREMENTS'; - $blacklist[] = 'OPENQRM_PLUGIN_DESCRIPTION'; - $blacklist[] = 'OPENQRM_PLUGIN_TYPE'; - $blacklist[] = 'OPENQRM_PLUGIN_DEPENDENCIES'; - $blacklist[] = 'OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES'; - $blacklist[] = 'OPENQRM_PLUGIN_STATE_DIRS'; - $blacklist[] = 'OPENQRM_PLUGIN_STATE_FILES'; - - $plugin_config="$this->_base_dir/openqrm/plugins/$plugin_name/etc/openqrm-plugin-$plugin_name.conf"; - $plugin_description=""; - $plugin_type=""; - $config_array=file($plugin_config); - foreach ($config_array as $index => $line) { - if (strstr($line, "OPENQRM_PLUGIN_DESCRIPTION")) { - $plugin_description=str_replace("OPENQRM_PLUGIN_DESCRIPTION=", "", $line); - $plugin_description=str_replace("\"", "", $plugin_description); - $plugin_description=trim($plugin_description); - } - else if (strstr($line, "OPENQRM_PLUGIN_TYPE")) { - $plugin_type=str_replace("OPENQRM_PLUGIN_TYPE=", "", $line); - $plugin_type=str_replace("\"", "", $plugin_type); - $plugin_type=trim($plugin_type); - } - else if (strstr($line, "OPENQRM_PLUGIN_VERSION")) { - $plugin_version=str_replace("OPENQRM_PLUGIN_VERSION=", "", $line); - $plugin_version=str_replace("\"", "", $plugin_version); - $plugin_version=trim($plugin_version); - } - // check plugin is configurable - else if((strpos($line, 'OPENQRM_') === 0 || stripos($line, str_replace('-', '_', $plugin_name)) === 0) && !in_array(substr($line, 0, strpos($line, '=')), $blacklist)) { - $ar_Return['configurable'] = true; - } - } - $ar_Return['type'] = $plugin_type; - $ar_Return['version'] = $plugin_version; - $ar_Return['description'] = $plugin_description; - return $ar_Return; - } - - //-------------------------------------------------- - /** - * get plugin dependencies - * @access public - * @param string $plugin_name - * @return array - */ - //-------------------------------------------------- - function get_dependencies($plugin_name) { - $ar_Return = array(); - $plugin_config="$this->_base_dir/openqrm/plugins/$plugin_name/etc/openqrm-plugin-$plugin_name.conf"; - $plugin_dependencies=""; - $config_array=file($plugin_config); - foreach ($config_array as $index => $line) { - // plugin deps - if (strstr($line, "OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES")) { - $plugin_dependencies=str_replace("OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES=", "", $line); - $plugin_dependencies=str_replace("\"", "", $plugin_dependencies); - $plugin_dependencies=trim($plugin_dependencies); - } - } - $ar_Return['dependencies'] = $plugin_dependencies; - return $ar_Return; - } - - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/rabbit.class.php b/openQRM-5.3.50-CE/src/web/base/class/rabbit.class.php deleted file mode 100644 index fe08cbc..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/rabbit.class.php +++ /dev/null @@ -1,85 +0,0 @@ - -*/ - -require_once $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/php-amqplib/vendor/autoload.php'; -use PhpAmqpLib\Connection\AMQPConnection; -use PhpAmqpLib\Message\AMQPMessage; - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/user.class.php"; -$event = new event(); -global $event; -global $OPENQRM_SERVER_BASE_DIR; - - -class rabbit { - -var $ip = ''; -var $cmd = ''; -var $read_only_commands = array("post_vm_list", "post_vg post_lv", "post_vm_config", "post_bridge_config", "post_identifier"); - - - //-------------------------------------------- - /** - * Constructor - */ - //-------------------------------------------- - function __construct() { - $OPENQRM_ADMIN = new user('openqrm'); - $OPENQRM_ADMIN->set_user(); - $connection = new AMQPConnection('localhost', 5672, 'openqrm', $OPENQRM_ADMIN->password); - $channel = $connection->channel(); - $this->connection = $connection; - $this->channel = $channel; - global $event; - $this->event = new event(); - global $OPENQRM_SERVER_BASE_DIR; - $this->openqrm_server_base_dir = $OPENQRM_SERVER_BASE_DIR; - } - - - //-------------------------------------------- - /** - * Add to RabbitMQ queue - * - * @param string $queue - * @param string $cmd - * @access public - */ - //-------------------------------------------- - function queue($queue, $cmd) { - $cmd_arr = explode(' ', $cmd); - if (isset($cmd_arr[1])) { - if (in_array($cmd_arr[1], $this->read_only_commands)) { - $queue = $queue.'.ui'; - } - } - $this->event->log("send_command", $_SERVER['REQUEST_TIME'], 5, "rabbit.class.php", "Adding command to RabbitMQ queue ".$queue, "", "", 0, 0, 0); - $this->channel->queue_declare($queue, false, false, false, false); - $msg = new AMQPMessage($this->openqrm_server_base_dir."/openqrm/bin/openqrm-cmd ".$cmd, array('delivery_mode' => 2)); - $this->channel->basic_publish($msg, '', $queue); - $this->channel->close(); - $this->connection->close(); - } - - - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/regex.class.php b/openQRM-5.3.50-CE/src/web/base/class/regex.class.php deleted file mode 100644 index 9fbfce7..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/regex.class.php +++ /dev/null @@ -1,81 +0,0 @@ - -*/ - -//---------------------------------------------------------------------------------------- -/** - * Regex - * - * @package htmlobjects - * @author Alexander Kuballa akuballa@openqrm-enterprise.com - * @copyright Copyright (c) 2009, Alexander Kuballa - * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * @version 1.0 - */ -//---------------------------------------------------------------------------------------- -class regex -{ - //-------------------------------- - /** - * pereg_match() - * - * @param string $pattern - * @param string $match - * @return array|null - */ - //-------------------------------- - static public function match($pattern, $match) { - @preg_match($pattern, $match, $matches); - if(debug::active()) { - $error = error_get_last(); - if(strstr($error['message'], 'preg_match')) { - $msg = str_replace('preg_match() [function.preg-match]:', '' , $error['message']); - debug::add($msg.' in '. $pattern, 'ERROR'); - } - } - if($matches) { - return $matches; - } else { - return null; - } - } - //-------------------------------- - /** - * pereg_replace() - * - * @param string $pattern - * @param string $replace - * @param string $string - * @return array|null - */ - //-------------------------------- - static public function replace($pattern, $replace, $string) { - $error = ''; - $str = @preg_replace($pattern, $replace, $string) | $error; - echo $error; - if(debug::active()) { - $error = error_get_last(); - if(strstr($error['message'], 'preg_replace')) { - $msg = str_replace('preg_replace() [function.preg-replace]:', '' , $error['message']); - debug::add($msg.' in '. $pattern, 'ERROR'); - } - } - return $str; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/resource.class.php b/openQRM-5.3.50-CE/src/web/base/class/resource.class.php deleted file mode 100644 index 4cefd41..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/resource.class.php +++ /dev/null @@ -1,1145 +0,0 @@ - -*/ - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -$BootServiceDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/boot-service/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/storage.class.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/plugin.class.php"; -require_once "$RootDir/class/event.class.php"; -require_once "$RootDir/class/user.class.php"; - -global $RESOURCE_INFO_TABLE; -$RESOURCE_TIME_OUT=240; -global $RESOURCE_TIME_OUT; -$event = new event(); -global $event; -global $OPENQRM_SERVER_BASE_DIR; -global $OPENQRM_EXECUTION_LAYER; -global $OPENQRM_WEB_PROTOCOL; - - -class resource { - -var $id = ''; -var $localboot = ''; -var $kernel = ''; -var $kernelid = ''; -var $image = ''; -var $imageid = ''; -var $openqrmserver = ''; -var $basedir = ''; -var $applianceid = ''; -var $ip = ''; -var $subnet = ''; -var $broadcast = ''; -var $network = ''; -var $mac = ''; -var $nics = ''; -var $uptime = ''; -var $cpunumber = ''; -var $cpuspeed = ''; -var $cpumodel = ''; -var $memtotal = ''; -var $memused = ''; -var $swaptotal = ''; -var $swapused = ''; -var $hostname = ''; -var $vtype = ''; -var $vhostid = ''; -var $vname = ''; -var $vnc = ''; -var $load = ''; -var $execdport = ''; -var $senddelay = ''; -var $capabilities = ''; -var $lastgood = ''; -var $state = ''; -var $event = ''; - -// --------------------------------------------------------------------------------- -// methods to create an instance of a resource object filled from the db -// --------------------------------------------------------------------------------- - -// returns a resource from the db selected by id, mac or ip -function get_instance($id, $mac, $ip) { - global $RESOURCE_INFO_TABLE; - global $event; - if (strlen($mac)) { - // check for both, lowercase + uppercase mac - $mac_lowercase = strtolower($mac); - $mac_uppercase = strtoupper($mac); - } - $db=openqrm_get_db_connection(); - if ("$id" != "") { - $resource_array = $db->GetAll("select * from $RESOURCE_INFO_TABLE where resource_id=$id"); - } else if ("$mac" != "") { - $resource_array = $db->GetAll("select * from $RESOURCE_INFO_TABLE where resource_mac='$mac_lowercase' or resource_mac='$mac_uppercase'"); - } else if ("$ip" != "") { - $resource_array = $db->GetAll("select * from $RESOURCE_INFO_TABLE where resource_ip='$ip'"); - } else { - $error = ''; - foreach(debug_backtrace() as $key => $msg) { - if($key === 1) { - $error .= '( '.basename($msg['file']).' '.$msg['line'].' )'; - } - syslog(LOG_ERR, $msg['function'].'() '.basename($msg['file']).':'.$msg['line']); - } - $event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", "Could not create instance of event without data ".$error, "", "", 0, 0, 0); - } - if(isset($resource_array)) { - foreach ($resource_array as $index => $resource) { - $this->id = $resource["resource_id"]; - $this->localboot = $resource["resource_localboot"]; - $this->kernel = $resource["resource_kernel"]; - $this->kernelid = $resource["resource_kernelid"]; - $this->image = $resource["resource_image"]; - $this->imageid = $resource["resource_imageid"]; - $this->openqrmserver = $resource["resource_openqrmserver"]; - $this->basedir = $resource["resource_basedir"]; - $this->applianceid = $resource["resource_applianceid"]; - $this->ip = $resource["resource_ip"]; - $this->subnet = $resource["resource_subnet"]; - $this->broadcast = $resource["resource_broadcast"]; - $this->network = $resource["resource_network"]; - $this->mac = $resource["resource_mac"]; - $this->nics = $resource["resource_nics"]; - $this->uptime = $resource["resource_uptime"]; - $this->cpunumber = $resource["resource_cpunumber"]; - $this->cpuspeed = $resource["resource_cpuspeed"]; - $this->cpumodel = $resource["resource_cpumodel"]; - $this->memtotal = $resource["resource_memtotal"]; - $this->memused = $resource["resource_memused"]; - $this->swaptotal = $resource["resource_swaptotal"]; - $this->swapused = $resource["resource_swapused"]; - $this->hostname = $resource["resource_hostname"]; - $this->vtype = $resource["resource_vtype"]; - $this->vhostid = $resource["resource_vhostid"]; - $this->vname = $resource["resource_vname"]; - $this->vnc = $resource["resource_vnc"]; - $this->load = $resource["resource_load"]; - $this->execdport = $resource["resource_execdport"]; - $this->senddelay = $resource["resource_senddelay"]; - $this->capabilities = $resource["resource_capabilities"]; - $this->lastgood = $resource["resource_lastgood"]; - $this->state = $resource["resource_state"]; - $this->event = $resource["resource_event"]; - } - return $this; - } -} - -// returns a resource from the db selected by id -function get_instance_by_id($id) { - $this->get_instance($id, "", ""); - return $this; -} - -// returns a resource from the db selected by ip -function get_instance_by_ip($ip) { - $this->get_instance("", "", $ip); - return $this; -} - -// returns a resource from the db selected by mac -function get_instance_by_mac($mac) { - $this->get_instance("", $mac, ""); - return $this; -} - - -// returns a resource with just the id set by the resource_hostname -function get_instance_id_by_hostname($resource_hostname) { - global $RESOURCE_INFO_TABLE; - global $event; - $db=openqrm_get_db_connection(); - if ($resource_hostname != "") { - $resource_array = $db->GetAll("select * from ".$RESOURCE_INFO_TABLE." where resource_hostname='".$resource_hostname."'"); - } else { - $event->log("get_instance_id_by_hostname", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", "Could not create instance of event without data", "", "", 0, 0, 0); - foreach(debug_backtrace() as $key => $msg) { - syslog(LOG_ERR, $msg['function'].'() '.basename($msg['file']).':'.$msg['line']); - } - return; - } - foreach ($resource_array as $index => $resource) { - $this->id = $resource["resource_id"]; - } - return $this; -} - - - - -// --------------------------------------------------------------------------------- -// getter + setter -// --------------------------------------------------------------------------------- - -function get_id() { - return $this->id; -} - -function set_id($id) { - $this->id = $id; -} - - - -// --------------------------------------------------------------------------------- -// general resource methods -// --------------------------------------------------------------------------------- - -// checks if a resource exists in the database -function exists($mac_address) { - global $RESOURCE_INFO_TABLE; - global $event; - // check for both, lowercase + uppercase mac - $mac_lowercase = strtolower($mac_address); - $mac_uppercase = strtoupper($mac_address); - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select resource_id from $RESOURCE_INFO_TABLE where resource_mac='$mac_lowercase' or resource_mac='$mac_uppercase'"); - if (!$rs) - $event->log("exists", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - if ($rs->EOF) { - return false; - } else { - return true; - } -} - - -// checks if a resource exists in the database by name -function exists_by_name($resource_hostname) { - global $RESOURCE_INFO_TABLE; - global $event; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select resource_id from ".$RESOURCE_INFO_TABLE." where resource_hostname='".$resource_hostname."'"); - if (!$rs) - $event->log("exists_by_name", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - if ($rs->EOF) { - return false; - } else { - return true; - } -} - - -// checks if given resource id is free in the db -function is_id_free($resource_id) { - global $RESOURCE_INFO_TABLE; - global $event; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select resource_id from $RESOURCE_INFO_TABLE where resource_id=$resource_id"); - if (!$rs) - $event->log("exists", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - if ($rs->EOF) { - return true; - } else { - return false; - } -} - - - -// adds resource to the database -function add($resource_fields) { - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $OPENQRM_RESOURCE_BASE_DIR; - global $event; - global $RootDir; - $openqrm_server = new openqrm_server(); - $OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address(); - if (!is_array($resource_fields)) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", "Resource_field not well defined", "", "", 0, 0, 0); - return 1; - } - # set defaults - $resource_fields["resource_basedir"]=$OPENQRM_RESOURCE_BASE_DIR; - $resource_fields["resource_openqrmserver"]=$OPENQRM_SERVER_IP_ADDRESS; - $resource_fields["resource_execdport"]=$OPENQRM_EXEC_PORT; - $resource_fields["resource_kernel"]='default'; - $resource_fields["resource_kernelid"]='1'; - $resource_fields["resource_image"]='idle'; - $resource_fields["resource_imageid"]='1'; - $resource_fields["resource_senddelay"]=10; - $resource_fields["resource_lastgood"]=$_SERVER['REQUEST_TIME']; - // add mac address always in lowercase - $macl = strtolower($resource_fields["resource_mac"]); - $resource_fields["resource_mac"] = $macl; - if ($this->exists($resource_fields["resource_mac"])) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", "Resource mac address ".$resource_fields["resource_mac"]." already existing! Not adding.", "", "", 0, 0, 0); - return 1; - } - $db=openqrm_get_db_connection(); - $result = $db->AutoExecute($RESOURCE_INFO_TABLE, $resource_fields, 'INSERT'); - if (! $result) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", "Failed adding new resource to database", "", "", 0, 0, 0); - } - // new resource hook - $plugin = new plugin(); - $enabled_plugins = $plugin->enabled(); - foreach ($enabled_plugins as $index => $plugin_name) { - $plugin_new_resource_hook = "$RootDir/plugins/$plugin_name/openqrm-$plugin_name-resource-hook.php"; - if (file_exists($plugin_new_resource_hook)) { - $event->log("add", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found plugin $plugin_name handling new-resource event.", "", "", 0, 0, $resource_fields["resource_id"]); - require_once "$plugin_new_resource_hook"; - $resource_function="openqrm_"."$plugin_name"."_resource"; - $resource_function=str_replace("-", "_", $resource_function); - $resource_function("add", $resource_fields); - } - } - -} - -// removes resource from the database -function remove($resource_id, $resource_mac) { - global $OPENQRM_EXEC_PORT; - global $RESOURCE_INFO_TABLE; - global $RootDir; - global $event; - // never remove the openQRM server resource - if ($resource_id == 0) { - return; - } - // never remove an auto-select resource - if ($resource_id == -1) { - return; - } - $openqrm_server = new openqrm_server(); - $OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address(); - - // remove resource hook - $plugin = new plugin(); - $enabled_plugins = $plugin->enabled(); - foreach ($enabled_plugins as $index => $plugin_name) { - $plugin_new_resource_hook = "$RootDir/plugins/$plugin_name/openqrm-$plugin_name-resource-hook.php"; - if (file_exists($plugin_new_resource_hook)) { - $event->log("remove", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found plugin $plugin_name handling remove-resource event.", "", "", 0, 0, $resource_id); - require_once "$plugin_new_resource_hook"; - $resource_fields = array(); - $resource_fields = $this->get_fields($resource_id); - // run remove hook - $resource_function="openqrm_"."$plugin_name"."_resource"; - $resource_function=str_replace("-", "_", $resource_function); - $resource_function("remove", $resource_fields); - } - } - - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from $RESOURCE_INFO_TABLE where resource_id=$resource_id and resource_mac='$resource_mac'"); -} - - -// assigns a kernel and fs-image to a resource -function assign($resource_id, $resource_kernelid, $resource_kernel, $resource_imageid, $resource_image) { - global $RESOURCE_INFO_TABLE; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("update $RESOURCE_INFO_TABLE set - resource_kernelid=$resource_kernelid, - resource_kernel='$resource_kernel', - resource_imageid=$resource_imageid, - resource_image='$resource_image' where resource_id=$resource_id"); -} - - - -// set a resource to net- or local boot -// resource_localboot = 0 -> netboot / 1 -> localboot -function set_localboot($resource_id, $resource_localboot) { - global $RESOURCE_INFO_TABLE; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("update $RESOURCE_INFO_TABLE set resource_localboot=$resource_localboot where resource_id=$resource_id"); -} - - -// displays resource parameter for resource_id -function get_parameter($resource_id) { - global $RESOURCE_INFO_TABLE; - global $KERNEL_INFO_TABLE; - global $IMAGE_INFO_TABLE; - global $APPLIANCE_INFO_TABLE; - global $STORAGE_INFO_TABLE; - global $DEPLOYMENT_INFO_TABLE; - global $BootServiceDir; - global $event; - global $OPENQRM_EXECUTION_LAYER; - global $OPENQRM_WEB_PROTOCOL; - $db=openqrm_get_db_connection(); - // resource parameter - if (!strlen($resource_id)) { - return; - } - $recordSet = $db->Execute("select * from $RESOURCE_INFO_TABLE where resource_id=$resource_id"); - if (!$recordSet) - $event->log("get_parameter", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$recordSet->EOF) { - array_walk($recordSet->fields, 'print_array'); - $image_id=$recordSet->fields["resource_imageid"]; - $kernel_id=$recordSet->fields["resource_kernelid"]; - $recordSet->MoveNext(); - } - $recordSet->Close(); - // kernel-parameter - $recordSet = $db->Execute("select * from $KERNEL_INFO_TABLE where kernel_id=$kernel_id"); - if (!$recordSet) - $event->log("get_parameter", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$recordSet->EOF) { - array_walk($recordSet->fields, 'print_array'); - $recordSet->MoveNext(); - } - $recordSet->Close(); - // image-parameter - $recordSet = $db->Execute("select * from $IMAGE_INFO_TABLE where image_id=$image_id"); - if (!$recordSet) - $event->log("get_parameter", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$recordSet->EOF) { - array_walk($recordSet->fields, 'print_array'); - $image_storageid=$recordSet->fields["image_storageid"]; - $recordSet->MoveNext(); - } - $recordSet->Close(); - // image storage parameter - if (strlen($image_storageid)) { - $storage = new storage(); - $storage->get_instance_by_id($image_storageid); - $storage_resource_id = $storage->resource_id; - $recordSet = $db->Execute("select resource_ip from $RESOURCE_INFO_TABLE where resource_id=$storage_resource_id"); - if (!$recordSet) - $event->log("get_parameter", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$recordSet->EOF) { - //array_walk($recordSet->fields, 'print_array'); - $image_storage_server_ip=$recordSet->fields['resource_ip']; - $recordSet->MoveNext(); - } - $recordSet->Close(); - echo "image_storage_server_ip=$image_storage_server_ip\n"; - } - // appliance parameter - $appliance_virtualization = 0; - $recordSet = $db->Execute("select * from $APPLIANCE_INFO_TABLE where appliance_resources=$resource_id and appliance_stoptime='0'"); - if (!$recordSet) - $event->log("get_parameter", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$recordSet->EOF) { - array_walk($recordSet->fields, 'print_array'); - $appliance_virtualization = $recordSet->fields["appliance_virtualization"]; - $recordSet->MoveNext(); - } - $recordSet->Close(); - - // virtualization parameter - if ($appliance_virtualization > 0) { - $virtualization = new virtualization(); - $virtualization->get_instance_by_id($appliance_virtualization); - echo "virtualization_type=\"$virtualization->type\"\n"; - echo "virtualization_name=\"$virtualization->name\"\n"; - } - // storage server parameter - if ($image_id<>1) { - $recordSet = $db->Execute("select * from $STORAGE_INFO_TABLE where storage_resource_id=$resource_id"); - if (!$recordSet) - $event->log("get_parameter", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$recordSet->EOF) { - $storage_type = $recordSet->fields["storage_type"]; - $recordSet1 = $db->Execute("select deployment_storagetype from $DEPLOYMENT_INFO_TABLE where deployment_id=$storage_type"); - if (!$recordSet1) - $event->log("get_parameter", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$recordSet1->EOF) { - $deployment_storagetype = $recordSet1->fields["deployment_storagetype"]; - echo "deployment_storagetype=$deployment_storagetype\n"; - $recordSet1->MoveNext(); - } - $recordSet1->Close(); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - - $db->Close(); - - // command execution layer - echo "openqrm_execution_layer=\"$OPENQRM_EXECUTION_LAYER\"\n"; - // openQRM server web protocol - echo "openqrm_web_protocol=\"$OPENQRM_WEB_PROTOCOL\"\n"; - - // plugin and bootservice list - $plugin_list = ''; - $boot_service_list = ''; - $plugin = new plugin(); - $enabled_plugins = $plugin->enabled(); - foreach ($enabled_plugins as $index => $plugin_name) { - $plugin_list = "$plugin_list$plugin_name "; - // add to list of boot-services only if boot-services for the resource exists - $plugin_boot_service = "$BootServiceDir/boot-service-$plugin_name.tgz"; - if (file_exists($plugin_boot_service)) { - $boot_service_list = "$boot_service_list$plugin_name "; - } - } - echo "openqrm_plugins=\"$plugin_list\"\n"; - echo "openqrm_boot_services=\"$boot_service_list\"\n"; - // here the appliance resouce got active - // now we remove the iscsi password from the deployment parameters - // TODO: this is not reboot save ! -// $image = new image(); -// $image->get_instance_by_id($image_id); -// if (strstr($image->deployment_parameter, "IMAGE_ISCSI_AUTH")) { -// $image->set_deployment_parameters("IMAGE_ISCSI_AUTH", ""); -// $event->log("get_parameter", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Resource $resource_id gets active. Removing authentication token from image $image_id", "", "", 0, 0, $resource_id); -// } - -} - -function get_parameter_array($resource_id) { - global $RESOURCE_INFO_TABLE; - $db = openqrm_get_db_connection(); - $resource_array = $db->GetAll("select * from $RESOURCE_INFO_TABLE where resource_id=$resource_id"); - return $resource_array; -} - -function get_list() { - global $RESOURCE_INFO_TABLE; - global $event; - $resource_list = array(); - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select resource_id, resource_ip, resource_state from $RESOURCE_INFO_TABLE ORDER BY resource_id ASC"); - if (!$rs) - $event->log("get_list", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $resource_list[] = $rs->fields; - $rs->MoveNext(); - } - return $resource_list; -} - - - -function update_info($resource_id, $resource_fields) { - global $RESOURCE_INFO_TABLE; - global $event; - if (! is_array($resource_fields)) { - $event->log("update_info", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", "Unable to update resource $resource_id", "", "", 0, 0, 0); - return 1; - } - if (!strlen($resource_id)) { - return 1; - } - $db=openqrm_get_db_connection(); - unset($resource_fields["resource_id"]); - if (isset($resource_fields["resource_mac"])) { - // add mac address always in lowercase - $macl = strtolower($resource_fields["resource_mac"]); - $resource_fields["resource_mac"] = $macl; - } - $result = $db->AutoExecute($RESOURCE_INFO_TABLE, $resource_fields, 'UPDATE', "resource_id = $resource_id"); - if (! $result) { - $event->log("update_info", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", "Failed updating resource $resource_id", "", "", 0, 0, 0); - } -} - -function update_status($resource_id, $resource_state, $resource_event) { - global $RESOURCE_INFO_TABLE; - $db=openqrm_get_db_connection(); - $query = "update $RESOURCE_INFO_TABLE set - resource_state='$resource_state', - resource_event='$resource_event' - where resource_id=$resource_id"; - $rs = $db->Execute("$query"); -} - - - -// returns an array of resource fields by id -function get_fields($which) { - $resource = new resource(); - $resource->get_instance_by_id($which); - $resource_fields = array(); - $resource_fields["resource_id"] = $resource->id; - $resource_fields["resource_localboot"] = $resource->localboot; - $resource_fields["resource_kernel"] = $resource->kernel; - $resource_fields["resource_kernelid"] = $resource->kernelid; - $resource_fields["resource_image"] = $resource->image; - $resource_fields["resource_imageid"] = $resource->imageid; - $resource_fields["resource_openqrmserver"] = $resource->openqrmserver; - $resource_fields["resource_basedir"] = $resource->basedir; - $resource_fields["resource_applianceid"] = $resource->applianceid; - $resource_fields["resource_ip"] = $resource->ip; - $resource_fields["resource_subnet"] = $resource->subnet; - $resource_fields["resource_broadcast"] = $resource->broadcast; - $resource_fields["resource_network"] = $resource->network; - $resource_fields["resource_mac"] = $resource->mac; - $resource_fields["resource_nics"] = $resource->nics; - $resource_fields["resource_uptime"] = $resource->uptime; - $resource_fields["resource_cpunumber"] = $resource->cpunumber; - $resource_fields["resource_cpuspeed"] = $resource->cpuspeed; - $resource_fields["resource_cpumodel"] = $resource->cpumodel; - $resource_fields["resource_memtotal"] = $resource->memtotal; - $resource_fields["resource_memused"] = $resource->memused; - $resource_fields["resource_swaptotal"] = $resource->swaptotal; - $resource_fields["resource_swapused"] = $resource->swapused; - $resource_fields["resource_hostname"] = $resource->hostname; - $resource_fields["resource_vtype"] = $resource->vtype; - $resource_fields["resource_vhostid"] = $resource->vhostid; - $resource_fields["resource_load"] = $resource->load; - $resource_fields["resource_execdport"] = $resource->execdport; - $resource_fields["resource_senddelay"] = $resource->senddelay; - $resource_fields["resource_capabilities"] = $resource->capabilities; - $resource_fields["resource_lastgood"] = $resource->lastgood; - $resource_fields["resource_state"] = $resource->state; - $resource_fields["resource_event"] = $resource->event; - return $resource_fields; -} - - - -// function to send a command to a resource by resource_ip -function send_command($resource_ip, $resource_command, $command_timeout = NULL) { - global $OPENQRM_EXEC_PORT; - global $OPENQRM_SERVER_BASE_DIR; - global $OPENQRM_EXECUTION_LAYER; - global $event; - global $RootDir; - // here we assume that we are the resource - - // plugin hook in case a resource gets rebooted or halted - switch($resource_command) { - case 'reboot': - // start the hook - $plugin = new plugin(); - $enabled_plugins = $plugin->enabled(); - foreach ($enabled_plugins as $index => $plugin_name) { - $plugin_start_resource_hook = "$RootDir/plugins/$plugin_name/openqrm-$plugin_name-resource-hook.php"; - if (file_exists($plugin_start_resource_hook)) { - $event->log("start", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found plugin $plugin_name handling start-resource event.", "", "", 0, 0, $this->id); - // prepare resource_fields array - $resource_fields = array(); - $resource_fields = $this->get_fields($this->id); - // include the plugin function file and run it - require_once "$plugin_start_resource_hook"; - $resource_function="openqrm_"."$plugin_name"."_resource"; - $resource_function=str_replace("-", "_", $resource_function); - $resource_function("start", $resource_fields); - } - } - // here we check if the resource is virtual or a host and if - // the virtualization plugin wants to reboot it via the host - $virtualization = new virtualization(); - $virtualization->get_instance_by_id($this->vtype); - $virtualization_plugin_name = $virtualization->get_plugin_name(); - $plugin_resource_virtual_command_hook_vm_type = "$RootDir/plugins/$virtualization_plugin_name/openqrm-$virtualization_plugin_name-resource-virtual-command-hook.php"; - // we also give the deployment type a chance to implement virtual commands - $deployment_plugin_name = ''; - if ($this->imageid != 1) { - $image = new image(); - $image->get_instance_by_id($this->imageid); - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - $deployment_plugin_name = $deployment->storagetype; - } - $plugin_resource_virtual_command_hook = ''; - $plugin_resource_virtual_command_hook_image_type = "$RootDir/plugins/$deployment_plugin_name/openqrm-$deployment_plugin_name-resource-virtual-command-hook.php"; - // $plugin_resource_virtual_command_hook_image_type = "$RootDir/plugins/sanboot-storage/openqrm-sanboot-storage-resource-virtual-command-hook.php"; - if (file_exists($plugin_resource_virtual_command_hook_vm_type)) { - $event->log("start", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found virtualization $virtualization_plugin_name managing virtual command.", "", "", 0, 0, $this->id); - $plugin_resource_virtual_command_hook = $plugin_resource_virtual_command_hook_vm_type; - } else if (file_exists($plugin_resource_virtual_command_hook_image_type)) { - // check if IMAGE_VIRTUAL_RESOURCE_COMMAND=true - $event->log("start", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found deploymetn $deployment_plugin_name managing virtual command.", "", "", 0, 0, $this->id); - $image = new image(); - $image->get_instance_by_id($this->imageid); - $virtual_command_enabled = $image->get_deployment_parameter("IMAGE_VIRTUAL_RESOURCE_COMMAND"); - if (!strcmp($virtual_command_enabled, "true")) { - $event->log("start", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found IMAGE_VIRTUAL_RESOURCE_COMMAND enabled, using virtual command.", "", "", 0, 0, $this->id); - $plugin_resource_virtual_command_hook = $plugin_resource_virtual_command_hook_image_type; - $virtualization_plugin_name=$deployment_plugin_name; - } else { - $event->log("start", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found IMAGE_VIRTUAL_RESOURCE_COMMAND disabled, using regular command.", "", "", 0, 0, $this->id); - } - } - if (strlen($plugin_resource_virtual_command_hook)) { - $event->log("start", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found plugin $virtualization_plugin_name virtually handling the reboot command.", "", "", 0, 0, $this->id); - // prepare resource_fields array - $resource_fields = array(); - $resource_fields = $this->get_fields($this->id); - // include the plugin function file and run it - require_once "$plugin_resource_virtual_command_hook"; - $resource_function="openqrm_"."$virtualization_plugin_name"."_resource_virtual_command"; - $resource_function=str_replace("-", "_", $resource_function); - $resource_function("reboot", $resource_fields); - // the virtual reboot function can only be - // implemented by a single plugin depending on the - // resource type. So we return after that and - // do not try to reboot the resource via its ip - return; - } - break; - - case 'halt': - // stop hook - $plugin = new plugin(); - $enabled_plugins = $plugin->enabled(); - foreach ($enabled_plugins as $index => $plugin_name) { - $plugin_start_resource_hook = "$RootDir/plugins/$plugin_name/openqrm-$plugin_name-resource-hook.php"; - if (file_exists($plugin_start_resource_hook)) { - $event->log("stop", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found plugin $plugin_name handling start-resource event.", "", "", 0, 0, $this->id); - // prepare resource_fields array - $resource_fields = array(); - $resource_fields = $this->get_fields($this->id); - // include the plugin function file and run it - require_once "$plugin_start_resource_hook"; - $resource_function="openqrm_"."$plugin_name"."_resource"; - $resource_function=str_replace("-", "_", $resource_function); - $resource_function("stop", $resource_fields); - } - } - // here we check if the resource is virtual or a host and if - // the virtualization plugin wants to reboot it via the host - $virtualization = new virtualization(); - $virtualization->get_instance_by_id($this->vtype); - $virtualization_plugin_name = $virtualization->get_plugin_name(); - $plugin_resource_virtual_command_hook_vm_type = "$RootDir/plugins/$virtualization_plugin_name/openqrm-$virtualization_plugin_name-resource-virtual-command-hook.php"; - // we also give the deployment type a chance to implement virtual commands - $deployment_plugin_name = ''; - if ($this->imageid != 1) { - $image = new image(); - $image->get_instance_by_id($this->imageid); - $storage = new storage(); - $storage->get_instance_by_id($image->storageid); - $deployment = new deployment(); - $deployment->get_instance_by_id($storage->type); - $deployment_plugin_name = $deployment->storagetype; - } - $plugin_resource_virtual_command_hook = ''; - $plugin_resource_virtual_command_hook_image_type = "$RootDir/plugins/$deployment_plugin_name/openqrm-$deployment_plugin_name-resource-virtual-command-hook.php"; - if (file_exists($plugin_resource_virtual_command_hook_vm_type)) { - $event->log("stop", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found virtualization $virtualization_plugin_name managing virtual command.", "", "", 0, 0, $this->id); - $plugin_resource_virtual_command_hook = $plugin_resource_virtual_command_hook_vm_type; - } else if (file_exists($plugin_resource_virtual_command_hook_image_type)) { - // check if IMAGE_VIRTUAL_RESOURCE_COMMAND=true - $event->log("stop", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found deploymetn $deployment_plugin_name managing virtual command.", "", "", 0, 0, $this->id); - $image = new image(); - $image->get_instance_by_id($this->imageid); - $virtual_command_enabled = $image->get_deployment_parameter("IMAGE_VIRTUAL_RESOURCE_COMMAND"); - if (!strcmp($virtual_command_enabled, "true")) { - $event->log("stop", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found IMAGE_VIRTUAL_RESOURCE_COMMAND enabled, using virtual command.", "", "", 0, 0, $this->id); - $plugin_resource_virtual_command_hook = $plugin_resource_virtual_command_hook_image_type; - $virtualization_plugin_name=$deployment_plugin_name; - } else { - $event->log("stop", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found IMAGE_VIRTUAL_RESOURCE_COMMAND disabled, using regular command.", "", "", 0, 0, $this->id); - } - } - if (strlen($plugin_resource_virtual_command_hook)) { - $event->log("stop", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found plugin $virtualization_plugin_name virtually handling the reboot command.", "", "", 0, 0, $this->id); - // prepare resource_fields array - $resource_fields = array(); - $resource_fields = $this->get_fields($this->id); - // include the plugin function file and run it - require_once "$plugin_resource_virtual_command_hook"; - $resource_function="openqrm_"."$virtualization_plugin_name"."_resource_virtual_command"; - $resource_function=str_replace("-", "_", $resource_function); - $resource_function("halt", $resource_fields); - // the virtual halt function can only be - // implemented by a single plugin depending on the - // resource type. So we return after that and - // do not try to halt the resource via its ip - return; - } - break; - } - - // check which execution layer to use - switch($OPENQRM_EXECUTION_LAYER) { - case 'dropbear': - // generate a random token for the cmd - $cmd_token = md5(uniqid(rand(), true)); - // custom timeout ? - if (!is_null($command_timeout)) { - $cmd_token .= ".".$command_timeout; - } - $final_resource_command = "$OPENQRM_SERVER_BASE_DIR/openqrm/sbin/openqrm-exec -i $resource_ip -t $cmd_token -c \"$resource_command\""; - //$event->log("start", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Running : $final_resource_command", "", "", 0, 0, 0); - shell_exec($final_resource_command); - break; - case 'rabbitmq': - $event->log("send_command", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Sending command to the rabbit queue $resource_ip", "", "", 0, 0, 0); - require_once "$RootDir/class/rabbit.class.php"; - $rabbit = new rabbit(); - $rabbit->queue($resource_ip, $resource_command); - break; - } -} - - - - -//-------------------------------------------------- -/** -* set the capabilities of a resource -* @access public -* @param string $key -* @param string $value -*/ -//-------------------------------------------------- -function set_resource_capabilities($key, $value) { - $this->get_instance_by_id($this->id); - $resource_capabilites_parameter = $this->capabilities; - $key=trim($key); - if (strstr($resource_capabilites_parameter, $key)) { - // change - $cp1=trim($resource_capabilites_parameter); - $cp2 = strstr($cp1, $key); - $keystr="$key=\""; - $endmark="\""; - $cp3=str_replace($keystr, "", $cp2); - $endpos=strpos($cp3, $endmark); - $cp=substr($cp3, 0, $endpos); - $new_resource_capabilites_parameter = str_replace("$key=\"$cp\"", "$key=\"$value\"", $resource_capabilites_parameter); - } else { - // add - $new_resource_capabilites_parameter = "$resource_capabilites_parameter $key=\"$value\""; - } - $resource_fields=array(); - $resource_fields["resource_capabilities"]="$new_resource_capabilites_parameter"; - $this->update_info($this->id, $resource_fields); -} - - - -//-------------------------------------------------- -/** -* gets a deployment parameter of an image -* @access public -* @param string $key -* @return string $value -*/ -//-------------------------------------------------- -function get_resource_capabilities($key) { - $resource_capabilites_parameter = $this->capabilities; - $key=trim($key); - if (strstr($resource_capabilites_parameter, $key)) { - // change - $cp1=trim($resource_capabilites_parameter); - $cp2 = strstr($cp1, $key); - $keystr="$key=\""; - $endmark="\""; - $cp3=str_replace($keystr, "", $cp2); - $endpos=strpos($cp3, $endmark); - $cp=substr($cp3, 0, $endpos); - return $cp; - } else { - return ""; - } -} - - - - - - -// returns the number of managed resource -function get_count($which) { - global $RESOURCE_INFO_TABLE; - global $event; - $count = 0; - $db=openqrm_get_db_connection(); - - $sql = "select count(resource_id) as num from $RESOURCE_INFO_TABLE where "; - switch($which) { - case 'all': - $sql .= " resource_id>=0"; - break; - case 'online': - $sql .= " resource_state='active'"; - break; - case 'offline': - $sql .= " resource_state!='active'"; - break; - case 'idle': - $sql .= " resource_state!='active' and resource_imageid=1"; - break; - case 'error': - $sql .= " resource_state='error'"; - break; - case 'phys': - $sql .= " resource_id=resource_vhostid or resource_vtype=1"; - break; - } - $rs = $db->Execute($sql); - if (!$rs) { - $event->log("get_count", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - $count = $rs->fields["num"]; - } - return $count; -} - - -// generates a mac address -function generate_mac() { - $CMD="(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{10}).*\$/\\1/; s/([0-9a-f]{2})/\\1:/g; s/:\$//;' | tr '[:lower:]:' '[:upper:]-' | sed -e 's/-/:/g'"; - $GEN_MAC=exec($CMD); - $GEN_MAC="00:".$GEN_MAC; - $this->mac = strtolower($GEN_MAC); -} - - - -// returns the next free vnc port number for a specific vm host -function generate_vnc_port($host_id) { - global $RESOURCE_INFO_TABLE; - global $RootDir; - global $event; - - $db=openqrm_get_db_connection(); - $recordSet = $db->Execute("select resource_vnc from ".$RESOURCE_INFO_TABLE." where resource_vnc != '' and resource_vhostid=".$host_id); - if (!$recordSet) - print $db->ErrorMsg(); - else { - $ar_ids = array(); - while ($arr = $recordSet->FetchRow()) { - foreach($arr as $val) { - $colon = strpos($val, ':'); - if ($colon !== false) { - $vnc_info_arr = explode(":", $val); - $val = $vnc_info_arr[1]; - } - $ar_ids[] = $val; - } - } - $i=1; - while($i > 0) { - if(in_array($i, $ar_ids) == false) { - return $i; - break; - } - $i++; - } - } - $db->Close(); - - -} - - -// check when resources last send their statistics -// update state in case of timeout -function check_all_states() { - global $RESOURCE_INFO_TABLE; - global $RESOURCE_TIME_OUT; - global $RootDir; - global $event; - $resource_list = array(); - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select resource_id, resource_lastgood, resource_state from $RESOURCE_INFO_TABLE"); - if (!$rs) - $event->log("check_all_states", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $resource_id=$rs->fields['resource_id']; - $resource_lastgood=$rs->fields['resource_lastgood']; - $resource_state=$rs->fields['resource_state']; - $check_time=$_SERVER['REQUEST_TIME']; - // get the HA-timeout per resource from the capabilites - $custom_resource_ha_timeout=""; - $resource_hat = new resource(); - $resource_hat->get_instance_by_id($resource_id); - $custom_resource_ha_timeout = $resource_hat->get_resource_capabilities("HAT"); - if (strlen($custom_resource_ha_timeout)) { - $RESOURCE_TIME_OUT = $custom_resource_ha_timeout; - } - - // resolve errors for all active resources - if (("$resource_state" == "active") && ($resource_id != 0)) { - if (($check_time - $resource_lastgood) < $RESOURCE_TIME_OUT) { - // resolve error event - $event->resolve_by_resource("check_all_states", $resource_id); - } - } - - // check for statistics (errors) for all resources which are not offline - // exclude manual added resources from the check ! - if (("$resource_state" != "off") && ("$resource_lastgood" != "-1")) { - if (($check_time - $resource_lastgood) > $RESOURCE_TIME_OUT) { - $resource_fields=array(); - $resource_fields["resource_state"]="error"; - $resource_error = new resource(); - $resource_error->update_info($resource_id, $resource_fields); - // log error event - $event->log("check_all_states", $_SERVER['REQUEST_TIME'], 1, "resource.class.php", "Resource $resource_id is in error state", "", "", 0, 0, $resource_id); - - // check for plugin which may want to handle the error event - $plugin = new plugin(); - $enabled_plugins = $plugin->started(); - foreach ($enabled_plugins as $index => $plugin_name) { - $plugin_ha_hook = "$RootDir/plugins/$plugin_name/openqrm-$plugin_name-ha-hook.php"; - if (file_exists($plugin_ha_hook)) { - $event->log("check_all_states", $_SERVER['REQUEST_TIME'], 1, "resource.class.php", "Found $plugin_name handling the resource error.", "", "", 0, 0, $resource_id); - require_once "$plugin_ha_hook"; - $ha_function="openqrm_"."$plugin_name"."_ha_hook"; - $ha_function=str_replace("-", "_", $ha_function); - $ha_function($resource_id); - } - } - } - } - - $rs->MoveNext(); - } -} - - - - -// displays only idle resources -function display_idle_overview($offset, $limit, $sort, $order) { - global $RESOURCE_INFO_TABLE; - global $event; - $db=openqrm_get_db_connection(); - $recordSet = $db->SelectLimit("select * from $RESOURCE_INFO_TABLE where resource_state='active' and resource_imageid=1 order by $sort $order", $limit, $offset); - $resource_array = array(); - if (!$recordSet) { - $event->log("display_overview", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($resource_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $resource_array; -} - - - -// displays the resource-overview -function display_overview($offset, $limit, $sort, $order) { - global $RESOURCE_INFO_TABLE; - global $event; - $db=openqrm_get_db_connection(); - $recordSet = $db->SelectLimit("select * from $RESOURCE_INFO_TABLE order by $sort $order", $limit, $offset); - $resource_array = array(); - if (!$recordSet) { - $event->log("display_overview", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($resource_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $resource_array; -} - -//-------------------------------------------- -/** - * find a resource by id, name or mac - * - * @access public - * @param string $search - * @return array - */ -//-------------------------------------------- -function find_resource($search) { - global $RESOURCE_INFO_TABLE; - global $event; - $db=openqrm_get_db_connection(); - - // replace glob wildcards with sql wildcards - $search = str_replace('_', '\_', $search); - $search = str_replace('%', '\%', $search); - $search = str_replace('?', '_', $search); - $search = str_replace('*', '%', $search); - - $sql = 'SELECT * FROM '.$RESOURCE_INFO_TABLE; - $sql .= ' WHERE resource_id LIKE ?'; - $sql .= ' OR resource_hostname LIKE ?'; - $sql .= ' OR resource_mac LIKE ?'; - - // handle sql injection - $sql = $db->db->Prepare($sql); - - $recordSet = $db->db->Execute($sql, array($search,$search,$search)); - $resource_array = array(); - if (!$recordSet) { - $event->log("find_resource", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($resource_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $resource_array; -} - -//-------------------------------------------- -/** - * Get all resources assigned to a host - * - * @access public - * @param string $hostid - * @return array - */ -//-------------------------------------------- -function get_resources_by_vhostid($hostid) { - global $RESOURCE_INFO_TABLE; - global $event; - $db=openqrm_get_db_connection(); - - $sql = 'SELECT resource_id FROM '.$RESOURCE_INFO_TABLE; - $sql .= ' WHERE resource_vhostid=?'; - $sql .= ' AND resource_id!=?'; - - // handle sql injection - $sql = $db->db->Prepare($sql); - - $recordSet = $db->db->Execute($sql, array($hostid,$hostid)); - $resource_array = array(); - if (!$recordSet) { - $event->log("get_resource_by_vhostid", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($resource_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $resource_array; -} - - -// --------------------------------------------------------------------------------- - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/storage.class.php b/openQRM-5.3.50-CE/src/web/base/class/storage.class.php deleted file mode 100644 index 63a7cac..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/storage.class.php +++ /dev/null @@ -1,481 +0,0 @@ - -*/ - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/deployment.class.php"; -require_once "$RootDir/class/event.class.php"; - -/** - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - * @author M. Rechenburg, A. Kuballa - * @version 1.1 added documentation - */ -class storage -{ - -/** -* storage id -* @access protected -* @var int -*/ -var $id = ''; -/** -* storage name -* @access protected -* @var string -*/ -var $name = ''; -/** -* resource id used by storage -* @access protected -* @var int -*/ -var $resource_id = ''; -/** -* storage type -* @access protected -* @var string -*/ -var $type = ''; -/** -* state of storage -* @access protected -* @var string -*/ -var $state = ''; -/** -* comment for storage -* @access protected -* @var string -*/ -var $comment = ''; -/** -* storage capabilities -* @access protected -* @var string -*/ -var $capabilities = ''; - -/** -* name of database table -* @access protected -* @var string -*/ -var $_db_table; - -/** -* event object -* @access protected -* @var object -*/ -var $_event; - - - //-------------------------------------------------- - /** - * Constructor - */ - //-------------------------------------------------- - function storage() { - $this->init(); - } - - //-------------------------------------------------- - /** - * init storage environment - * @access public - */ - //-------------------------------------------------- - function init() { - global $STORAGE_INFO_TABLE; - $this->_db_table = $STORAGE_INFO_TABLE; - $this->_event = new event(); - } - - //-------------------------------------------------- - /** - * get an instance of a storage object from db - * @access public - * @param int $id - * @param string $name - * @return object - */ - //-------------------------------------------------- - function get_instance($id, $name) { - $db=openqrm_get_db_connection(); - if ("$id" != "") { - $storage_array = $db->Execute("select * from $this->_db_table where storage_id=$id"); - } else if ("$name" != "") { - $storage_array = $db->Execute("select * from $this->_db_table where storage_name='$name'"); - } else { - $error = ''; - foreach(debug_backtrace() as $key => $msg) { - if($key === 1) { - $error .= '( '.basename($msg['file']).' '.$msg['line'].' )'; - } - syslog(LOG_ERR, $msg['function'].'() '.basename($msg['file']).':'.$msg['line']); - } - $this->_event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "storage.class.php", "Could not create instance of storage without data ".$error, "", "", 0, 0, 0); - return; - } - foreach ($storage_array as $index => $storage) { - $this->id = $storage["storage_id"]; - $this->name = $storage["storage_name"]; - $this->resource_id = $storage["storage_resource_id"]; - $this->type = $storage["storage_type"]; - $this->state = $storage["storage_state"]; - $this->comment = $storage["storage_comment"]; - $this->capabilities = $storage["storage_capabilities"]; - } - return $this; - } - - //-------------------------------------------------- - /** - * get an instance of a storage by id - * @access public - * @param int $id - * @return object - */ - //-------------------------------------------------- - function get_instance_by_id($id) { - $this->get_instance($id, ""); - return $this; - } - - //-------------------------------------------------- - /** - * get an instance of a storage by name - * @access public - * @param string $name - * @return object - */ - //-------------------------------------------------- - function get_instance_by_name($name) { - $this->get_instance("", $name); - return $this; - } - - //-------------------------------------------------- - /** - * add a new storage - * @access public - * @param array $storage_fields - */ - //-------------------------------------------------- - function add($storage_fields) { - if (!is_array($storage_fields)) { - $this->_event->log("add", $_SERVER['REQUEST_TIME'], 2, "storage.class.php", "Storage_field not well defined", "", "", 0, 0, 0); - return 1; - } - $db=openqrm_get_db_connection(); - $result = $db->AutoExecute($this->_db_table, $storage_fields, 'INSERT'); - if (! $result) { - $this->_event->log("add", $_SERVER['REQUEST_TIME'], 2, "storage.class.php", "Failed adding new storage to database", "", "", 0, 0, 0); - } - } - - //-------------------------------------------------- - /** - * update a storage - * - * $fields = array(); - * $fields['storage_name'] = 'somename'; - * $fields['storage_type'] = 1; - * $fields['storage_capabilities'] = 'sometext'; - * $fields['storage_comment'] = 'sometext'; - * $fields['storage_resource_id'] = 1; - * $storage = new storage(); - * $storage->update(1, $fields); - * - * @access public - * @param int $storage_id - * @param array $storage_fields - * @return bool - */ - //-------------------------------------------------- - function update($storage_id, $storage_fields) { - if ($storage_id < 0 || ! is_array($storage_fields)) { - $this->_event->log("update", $_SERVER['REQUEST_TIME'], 2, "storage.class.php", "Unable to update storage $storage_id", "", "", 0, 0, 0); - } - $db=openqrm_get_db_connection(); - unset($storage_fields["storage_id"]); - $result = $db->AutoExecute($this->_db_table, $storage_fields, 'UPDATE', "storage_id = $storage_id"); - if (! $result) { - $this->_event->log("update", $_SERVER['REQUEST_TIME'], 2, "storage.class.php", "Failed updating storage $storage_id", "", "", 0, 0, 0); - return false; - } else { - return true; - } - } - - //-------------------------------------------------- - /** - * remove a storage by id - * @access public - * @param int $storage_id - */ - //-------------------------------------------------- - function remove($storage_id) { - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from $this->_db_table where storage_id=$storage_id"); - } - - //-------------------------------------------------- - /** - * remove a storage by name - * @access public - * @param string $storage_name - */ - //-------------------------------------------------- - function remove_by_name($storage_name) { - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from $this->_db_table where storage_name='$storage_name'"); - } - - //-------------------------------------------------- - /** - * get a storage name by id - * @access public - * @param int $storage_id - */ - //-------------------------------------------------- - function get_name($storage_id) { - $db=openqrm_get_db_connection(); - $storage_set = $db->Execute("select storage_name from $this->_db_table where storage_id=$storage_id"); - if (!$storage_set) { - $this->_event->log("get_name", $_SERVER['REQUEST_TIME'], 2, "storage.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - if (!$storage_set->EOF) { - return $storage_set->fields["storage_name"]; - } else { - return "idle"; - } - } - } - - //-------------------------------------------------- - /** - * get capabilities string by storage_id - * @access public - * @param int $storage_id - * @return string - */ - //-------------------------------------------------- - function get_capabilities($storage_id) { - $db=openqrm_get_db_connection(); - $storage_set = $db->Execute("select storage_capabilities from $this->_db_table where storage_id=$storage_id"); - if (!$storage_set) { - $this->_event->log("get_capabilities", $_SERVER['REQUEST_TIME'], 2, "storage.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - if ((!$storage_set->EOF) && ($storage_set->fields["storage_capabilities"]!="")) { - return $storage_set->fields["storage_capabilities"]; - } else { - return "0"; - } - } - } - - //-------------------------------------------------- - /** - * get number of storages - * @access public - * @return int - */ - //-------------------------------------------------- - function get_count() { - $count=0; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select count(storage_id) as num from $this->_db_table"); - if (!$rs) { - $this->_event->log("get_count", $_SERVER['REQUEST_TIME'], 2, "storage.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - $count = $rs->fields["num"]; - } - return $count; - } - - - //-------------------------------------------------- - /** - * get number of storages by type - * @access public - * @return int - */ - //-------------------------------------------------- - function get_count_per_type($deployment_type) { - $count=0; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select count(storage_id) as num from $this->_db_table where storage_type = $deployment_type"); - if (!$rs) { - $this->_event->log("get_count_per_type", $_SERVER['REQUEST_TIME'], 2, "storage.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - $count = $rs->fields["num"]; - } - return $count; - } - - - //-------------------------------------------------- - /** - * get an array of all storage names - * - * $storage = new storage(); - * $arr = $storage->get_list(); - * // $arr[0]['value'] - * // $arr[0]['label'] - * - * @access public - * @return array - */ - //-------------------------------------------------- - function get_list() { - $query = "select storage_id, storage_name from $this->_db_table"; - $storage_name_array = array(); - $storage_name_array = openqrm_db_get_result_double ($query); - return $storage_name_array; - } - - - - //-------------------------------------------------- - /** - * get an array of all storage ids of a certain type - * - * $storage = new storage(); - * $arr = $storage->get_ids_by_storage_type($storage_type); - * // $arr[0]['value'] - * // $arr[0]['label'] - * - * @access public - * @return array - */ - //-------------------------------------------------- - function get_ids_by_storage_type($storage_type) { - $storage_array = array(); - $query = "select storage_id from $this->_db_table where storage_type=$storage_type"; - $db=openqrm_get_db_connection(); - $rs = $db->Execute($query); - if (!$rs) - $this->_event->log("get_ids_by_storage_type", $_SERVER['REQUEST_TIME'], 2, "storage.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $storage_array[] = $rs->fields; - $rs->MoveNext(); - } - return $storage_array; - } - - - - //-------------------------------------------------- - /** - * get an array of all storage types - * @access public - * @return array - */ - //-------------------------------------------------- - function get_storage_types() { - $ar_Return = array(); - $db=openqrm_get_db_connection(); - $ar_tmp = $db->Execute("select storage_type, storage_name from $this->_db_table"); - foreach($ar_tmp as $val) { - $ar_Return[] = $val['storage_type']; - } - return array_unique($ar_Return); - } - - //-------------------------------------------------- - /** - * get an array of all storage types with all record values - * @access public - * @return array - */ - //-------------------------------------------------- - function get_full_storage_list() { - $storageList = array(); - $db=openqrm_get_db_connection(); - $result = $db->Execute("SELECT * FROM $this->_db_table"); - foreach($result as $storageServer) { - $storageList[] = $storageServer; - } - return $storageList; - } - - //-------------------------------------------------- - /** - * get an array of storages by type - * @access public - * @param int $offset - * @param int $limit - * @param string $sort - * @param enum $order [ASC/DESC] - * @return array - */ - //-------------------------------------------------- - function display_overview_per_type($deployment_type, $offset, $limit, $sort, $order) { - $db=openqrm_get_db_connection(); - $recordSet = $db->SelectLimit("select * from $this->_db_table where storage_type = $deployment_type order by $sort $order", $limit, $offset); - $storage_array = array(); - if (!$recordSet) { - $this->_event->log("display_overview_per_type", $_SERVER['REQUEST_TIME'], 2, "storage.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($storage_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $storage_array; - } - - - - //-------------------------------------------------- - /** - * get an array of storages - * @access public - * @param int $offset - * @param int $limit - * @param string $sort - * @param enum $order [ASC/DESC] - * @return array - */ - //-------------------------------------------------- - function display_overview($offset, $limit, $sort, $order) { - $db=openqrm_get_db_connection(); - $recordSet = $db->SelectLimit("select * from $this->_db_table order by $sort $order", $limit, $offset); - $storage_array = array(); - if (!$recordSet) { - $this->_event->log("display_overview", $_SERVER['REQUEST_TIME'], 2, "storage.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($storage_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $storage_array; - } - - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/user.class.php b/openQRM-5.3.50-CE/src/web/base/class/user.class.php deleted file mode 100644 index ae38379..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/user.class.php +++ /dev/null @@ -1,616 +0,0 @@ - -*/ - - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/openqrm_server.class.php"; - - -class user -{ -/** -* Id -* @access public -* @var int -*/ -var $id; -/** -* Nickname -* @access public -* @var string -*/ -var $name = ''; -/** -* Password -* @access public -* @var string -*/ -var $password = ''; -/** -* Gender -* @access public -* @var string -*/ -var $gender = ''; -/** -* Firstname -* @access public -* @var string -*/ -var $first_name = ''; -/** -* Lastname -* @access public -* @var string -*/ -var $last_name = ''; -/** -* Department -* @access public -* @var string -*/ -var $department = ''; -/** -* Office -* @access public -* @var string -*/ -var $office = ''; -/** -* Role (Group) -* @access public -* @var string -*/ -var $role = ''; -/** - * -* Lang (language) -* @access public -* @var string -*/ -var $lang = ''; -/** -* Last update -* @access public -* @var string -*/ -var $last_update_time = ''; -/** -* Description -* @access public -* @var string -*/ -var $description = ''; -/** -* Capabilities -* @access public -* @var string -*/ -var $capabilities = ''; -/** -* wizard_name -* @access public -* @var string -*/ -var $wizard_name = ''; -/** -* wizard_step -* @access public -* @var string -*/ -var $wizard_step = ''; -/** -* wizard_id -* @access public -* @var string -*/ -var $wizard_id = ''; -/** -* State -* @access public -* @var string -*/ -var $state = ''; - -/** -* Internal use only -* @access private -* @var string -*/ -var $_user_table = ''; -/** -* Internal use only -* @access private -* @var string -*/ -var $_role_table = ''; - - - //----------------------------------------------------------------------------------- - function user($name) { - global $USER_INFO_TABLE; - $this->name = $name; - $this->get_instance_by_name($name); - $this->_role_table = 'role_info'; - $this->_user_table = $USER_INFO_TABLE; - } - - - - - // returns a user from the db selected by id, mac or ip - function get_instance($id, $name) { - global $USER_INFO_TABLE; - $event = new event(); - $db=openqrm_get_db_connection(); - if ($id != "") { - $user_array = $db->GetAll("select * from ".$this->_user_table." where user_id=$id"); - } else if ($name != "") { - $user_array = $db->GetAll("select * from ".$USER_INFO_TABLE." where user_name='$name'"); - } else { - $event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "user.class.php", "Could not create instance of user without data", "", "", 0, 0, 0); - array_walk(debug_backtrace(),create_function('$a,$b','syslog(LOG_ERR, "{$a[\'function\']}()(".basename($a[\'file\']).":{$a[\'line\']}); ");')); - return; - } - foreach ($user_array as $index => $user) { - $this->id = $user["user_id"]; - $this->name = $user["user_name"]; - $this->password = $user["user_password"]; - $this->gender = $user["user_gender"]; - $this->first_name = $user["user_first_name"]; - $this->last_name = $user["user_last_name"]; - $this->department = $user["user_department"]; - $this->office = $user["user_office"]; - $this->role = $user["user_role"]; - $this->lang = $user["user_lang"]; - $this->last_update_time = $user["user_last_update_time"]; - $this->description = $user["user_description"]; - $this->capabilities = $user["user_capabilities"]; - $this->wizard_name = $user["user_wizard_name"]; - $this->wizard_step = $user["user_wizard_step"]; - $this->wizard_id = $user["user_wizard_id"]; - $this->state = $user["user_state"]; - } - return $this; - } - - // returns a user from the db selected by id - function get_instance_by_id($id) { - $this->get_instance($id, ""); - return $this; - } - - - // returns a user from the db selected by id - function get_instance_by_name($name) { - $this->get_instance("", $name); - return $this; - } - - - - // for the ldap integration - - // adds user just to the database - function add($user_fields) { - global $event; - if (!is_array($user_fields)) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "user.class.php", "user_fields not well defined", "", "", 0, 0, 0); - return 1; - } - $db=openqrm_get_db_connection(); - $result = $db->AutoExecute($this->_user_table, $user_fields, 'INSERT'); - if (! $result) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "user.class.php", "Failed adding new user to database", "", "", 0, 0, 0); - } - } - - function get_name_list() { - $user_array = array(); - $query = "select user_name from $this->_user_table"; - $db=openqrm_get_db_connection(); - $rs = $db->Execute($query); - if (!$rs) - $event->log("get_name_list", $_SERVER['REQUEST_TIME'], 2, "user.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - while (!$rs->EOF) { - $user_array[] = $rs->fields; - $rs->MoveNext(); - } - return $user_array; - } - - function remove_by_name($user_name) { - // remove from db - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from $this->_user_table where user_name='$user_name'"); - return $rs; - } - - // end of ldap integration - - - //-------------------------------------------- - /** - * Find out user is admin - * - * @access public - * @return bool - */ - //-------------------------------------------- - function isAdmin() { - if(strtolower($this->role) === 'administrator' || $this->role === 0) { - return true; - } else { - return false; - } - } - - - //----------------------------------------------------------------------------------- - function set_user_form() { - - $query = $this->query_select(); - $result = openqrm_db_get_result($query); - - $this->name = array('value'=>$this->name, 'label'=>'Login'); - $this->id = $result[0][0]; - $this->gender = $result[0][1]; - $this->first_name = $result[0][2]; - $this->last_name = $result[0][3]; - $this->description = $result[0][4]; - $this->department = $result[0][5]; - $this->office = $result[0][6]; - $this->capabilities = $result[0][7]; - $this->state = $result[0][8]; - $this->role = $result[0][9]; - $this->last_update_time = $result[0][10]; - $this->password = array('value'=>'', 'label'=>$result[0][11]['label']); - } - //----------------------------------------------------------------------------------- - function set_user() { - - $query = $this->query_select(); - $result = openqrm_db_get_result($query); - - $this->id = $result[0][0]['value']; - $this->gender = $result[0][1]['value']; - $this->first_name = $result[0][2]['value']; - $this->last_name = $result[0][3]['value']; - $this->description = $result[0][4]['value']; - $this->department = $result[0][5]['value']; - $this->office = $result[0][6]['value']; - $this->capabilities = $result[0][7]['value']; - $this->state = $result[0][8]['value']; - $this->role = $result[0][9]['value']; - $this->last_update_time = $result[0][10]['value']; - $this->password = $result[0][11]['value']; - - $this->get_role_name(); - $this->role = $this->role['label']; - } - //----------------------------------------------------------------------------------- - function set_user_from_request() { - - $this->id = $this->http_request('id'); - $this->password = $this->http_request('password'); - $this->gender = $this->http_request('gender'); - $this->first_name = $this->http_request('first_name'); - $this->last_name = $this->http_request('last_name'); - $this->department = $this->http_request('department'); - $this->office = $this->http_request('office'); - $this->role = $this->http_request('role'); - $this->last_update_time = $this->http_request('last_update_time'); - $this->description = $this->http_request('description'); - $this->capabilities = $this->http_request('capabilities'); - $this->state = $this->http_request('state'); - - } - //----------------------------------------------------------------------------------- - function query_select(){ - $query = " - SELECT - user_id, - user_gender, - user_first_name, - user_last_name, - user_description, - user_department, - user_office, - user_capabilities, - user_state, - user_role, - user_last_update_time, - user_password - user_lang - FROM $this->_user_table - WHERE user_name = '$this->name' - "; - return $query; - } - //----------------------------------------------------------------------------------- - function query_insert(){ - global $USER_INFO_TABLE; - $this->id = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $query = " - INSERT INTO - $USER_INFO_TABLE ( - user_id, - user_name, - user_password, - user_gender, - user_first_name, - user_last_name, - user_department, - user_office, - user_role, - user_last_update_time, - user_description, - user_capabilities, - user_state, - user_lang - ) - VALUES ( - '$this->id', - '$this->name', - '$this->password', - '$this->gender', - '$this->first_name', - '$this->last_name', - '$this->department', - '$this->office', - '$this->role', - '$this->last_update_time', - '$this->description', - '$this->capabilities', - '$this->state.', - '$this->lang.' - ) - "; - - $this->change_htpasswd('insert'); - return openqrm_db_get_result($query); - } - //----------------------------------------------------------------------------------- - function query_update(){ - global $USER_INFO_TABLE; - $user_fields = array(); - if($this->password != '') { - $user_fields['user_password']=$this->password; - $this->change_htpasswd('update'); - } - $user_fields['user_gender']=$this->gender; - $user_fields['user_first_name']=$this->first_name; - $user_fields['user_last_name']=$this->last_name; - $user_fields['user_department']=$this->department; - $user_fields['user_office']=$this->office; - $user_fields['user_role']=$this->role; - $user_fields['user_last_update_time']=$this->last_update_time; - $user_fields['user_description']=$this->description; - $user_fields['user_capabilities']=$this->capabilities; - $user_fields['user_state']=$this->state; - $user_fields['user_lang']=$this->lang; - $db=openqrm_get_db_connection(); - $result = $db->AutoExecute($USER_INFO_TABLE, $user_fields, 'UPDATE', "user_name = '$this->name'"); - if (! $result) { - $event->log("query_update", $_SERVER['REQUEST_TIME'], 2, "user.class.php", "Failed updating user", "", "", 0, 0, 0); - } - } - //----------------------------------------------------------------------------------- - function query_delete(){ - $query = " - DELETE FROM $this->_user_table - WHERE user_name = '".$this->name."' - "; - $this->change_htpasswd('delete'); - return openqrm_db_get_result($query); - } - //----------------------------------------------------------------------------------- - function check_user_exists() { - $query = " - SELECT user_name - FROM $this->_user_table - WHERE user_name = '".$this->name."' - "; - $result = openqrm_db_get_result_single($query); - - if($result['value'] != '') { return true; } - else { return false; } - - } - //----------------------------------------------------------------------------------- - function get_gender_list() { - $ar_Return = array(); - $ar_Return[] = array("value"=>'', "label"=>'',); - $ar_Return[] = array("value"=>'f', "label"=>'female',); - $ar_Return[] = array("value"=>'m', "label"=>'male',); - return $ar_Return; - } - //----------------------------------------------------------------------------------- - function get_role_name() { - $query = " - SELECT user_role, role_name - FROM $this->_user_table, $this->_role_table - WHERE user_name = '".$this->name."' - AND user_role = role_id - "; - $result = openqrm_db_get_result_double($query); - $this->role = $result[0]; - } - //----------------------------------------------------------------------------------- - function get_role_list() { - $query = " - SELECT role_id, role_name - FROM $this->_role_table - "; - $result = openqrm_db_get_result_double($query); - return $result; - } - //----------------------------------------------------------------------------------- - function check_string_name($name) { - - if (!preg_match('#^[A-Za-z0-9]*$#', $name)) { - return '[A-Za-z0-9]'; - } else { - return ''; - } - } - //----------------------------------------------------------------------------------- - function check_string_password($pass) { - if (!preg_match('#^[A-Za-z0-9]*$#', $pass)) { - return '[A-Za-z0-9_-]'; - } else { - return ''; - } - } - //----------------------------------------------------------------------------------- - /** - * Change htpassswd - * @access private - * @param $mode [update, delete, insert] - */ - function change_htpasswd($mode = 'update') { - global $RootDir; - - $ar_values = array(); - - $handle = fopen ($RootDir.'/.htpasswd', "r"); - while (!feof($handle)) { - $tmp = explode(':', fgets($handle, 4096)); - if($tmp[0] != '') { - $ar_values[$tmp[0]] = $tmp[1]; - } - } - fclose ($handle); - - $handle = fopen ($RootDir.'/.htpasswd', "w+"); - - if($mode == 'insert') { - foreach($ar_values as $key => $value) { - fputs($handle, "$key:$value"); - } - fputs($handle, $this->name.':'.crypt($this->password)."\n"); - } - if($mode == 'update') { - foreach($ar_values as $key => $value) { - if($key == $this->name) { - fputs($handle, $this->name.':'.crypt($this->password)."\n"); - } else { - fputs($handle, "$key:$value"); - } - } - } - if($mode == 'delete') { - foreach($ar_values as $key => $value) { - if($key != $this->name) { - fputs($handle, "$key:$value"); - } - } - } - fclose ($handle); - } - //----------------------------------------------------------------------------------- - function get_users() { - $query = ' - SELECT - user_name, - user_id, - user_first_name, - user_last_name, - role_name - FROM '.$this->_user_table.', '.$this->_role_table.' - WHERE user_role = role_id - ORDER BY user_name - '; - $ar_db = openqrm_db_get_result($query); - $ar_headline = array(); - $ar_headline[] = array('Login', 'ID', 'First Name', 'Last Name', 'Role'); - $result = array_merge($ar_headline, $ar_db); - - return $result; - } - //----------------------------------------------------------------------------------- - function http_request($arg) - { - global $_REQUEST; - if (isset($_REQUEST[$arg])) - return $_REQUEST[$arg]; - else - return ''; - } - - - - // set users lang - function set_user_language($name, $lang) { - $db=openqrm_get_db_connection(); - $sql = "update ".$this->_user_table." set user_lang='".$lang."' where user_name='".$name."'"; - $rs = $db->Execute($sql); - } - - - // set wizard fields - function set_wizard($username, $wizardname, $step, $id) { - $db=openqrm_get_db_connection(); - $sql = "update ".$this->_user_table." set user_wizard_name='".$wizardname."', user_wizard_step=".$step.",user_wizard_id=".$id." where user_name='".$username."'"; - $rs = $db->Execute($sql); - return $rs; - } - - //-------------------------------------------- - /** - * Translate - * - * @access public - * @param array $text_array array to translate - * @param string $dir dir of translation files - * @param string $file translation file - * @return array - */ - //-------------------------------------------- - function translate( $text_array, $dir, $file ) { - $user_language = $this->lang; - $path = $dir.'/'.$user_language.'.'.$file; - if(file_exists($path)) { - $tmp = parse_ini_file( $path, true ); - foreach($tmp as $k => $v) { - if(is_array($v)) { - foreach($v as $k2 => $v2) { - $text_array[$k][$k2] = $v2; - } - } else { - $text_array[$k] = $v; - } - } - } - // use en file as first fallback - else if(file_exists($dir.'/en.'.$file)) { - $tmp = parse_ini_file( $dir.'/en.'.$file, true ); - foreach($tmp as $k => $v) { - if(is_array($v)) { - foreach($v as $k2 => $v2) { - $text_array[$k][$k2] = $v2; - } - } else { - $text_array[$k] = $v; - } - } - } - return $text_array; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/class/virtualization.class.php b/openQRM-5.3.50-CE/src/web/base/class/virtualization.class.php deleted file mode 100644 index e7081e8..0000000 --- a/openQRM-5.3.50-CE/src/web/base/class/virtualization.class.php +++ /dev/null @@ -1,166 +0,0 @@ - -*/ - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/openqrm-database-functions.php"; -require_once "$RootDir/class/event.class.php"; - -global $VIRTUALIZATION_INFO_TABLE; -$event = new event(); -global $event; - -class virtualization { - -var $id = ''; -var $name = ''; -var $type = ''; -var $mapping = ''; - - - -// --------------------------------------------------------------------------------- -// methods to create an instance of an virtualization object filled from the db -// --------------------------------------------------------------------------------- - -// returns an virtualization from the db selected by id, type or name -function get_instance($id, $name, $type) { - global $VIRTUALIZATION_INFO_TABLE; - global $event; - $db=openqrm_get_db_connection(); - if ("$id" != "") { - $virtualization_array = $db->Execute("select * from $VIRTUALIZATION_INFO_TABLE where virtualization_id=$id"); - } else if ("$name" != "") { - $virtualization_array = $db->Execute("select * from $VIRTUALIZATION_INFO_TABLE where virtualization_name='$name'"); - } else if ("$type" != "") { - $virtualization_array = $db->Execute("select * from $VIRTUALIZATION_INFO_TABLE where virtualization_type='$type'"); - } else { - $error = ''; - foreach(debug_backtrace() as $key => $msg) { - if($key === 1) { - $error .= '( '.basename($msg['file']).' '.$msg['line'].' )'; - } - syslog(LOG_ERR, $msg['function'].'() '.basename($msg['file']).':'.$msg['line']); - } - $event->log("get_instance", $_SERVER['REQUEST_TIME'], 2, "virtualization.class.php", "Could not create instance of virtualization without data -
    ".$error, "", "", 0, 0, 0); - return; - } - foreach ($virtualization_array as $index => $virtualization) { - $this->id = $virtualization["virtualization_id"]; - $this->name = $virtualization["virtualization_name"]; - $this->type = $virtualization["virtualization_type"]; - $this->mapping = $virtualization["virtualization_mapping"]; - } - return $this; -} - -// returns an virtualization from the db selected by id -function get_instance_by_id($id) { - $this->get_instance($id, "", ""); - return $this; -} - -// returns an virtualization from the db selected by name -function get_instance_by_name($name) { - $this->get_instance("", $name, ""); - return $this; -} - -// returns an virtualization from the db selected by type -function get_instance_by_type($type) { - $this->get_instance("", "", $type); - return $this; -} - -// --------------------------------------------------------------------------------- -// general virtualization methods -// --------------------------------------------------------------------------------- - - -// checks if given virtualization id is free in the db -function is_id_free($virtualization_id) { - global $VIRTUALIZATION_INFO_TABLE; - global $event; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select virtualization_id from $VIRTUALIZATION_INFO_TABLE where virtualization_id=$virtualization_id"); - if (!$rs) - $event->log("is_id_free", $_SERVER['REQUEST_TIME'], 2, "virtualization.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - else - if ($rs->EOF) { - return true; - } else { - return false; - } -} - - -// adds virtualization to the database -function add($virtualization_fields) { - global $VIRTUALIZATION_INFO_TABLE; - global $event; - if (!is_array($virtualization_fields)) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "virtualization.class.php", "Deployment_field not well defined", "", "", 0, 0, 0); - return 1; - } - $db=openqrm_get_db_connection(); - $result = $db->AutoExecute($VIRTUALIZATION_INFO_TABLE, $virtualization_fields, 'INSERT'); - if (! $result) { - $event->log("add", $_SERVER['REQUEST_TIME'], 2, "virtualization.class.php", "Failed adding new virtualization to database", "", "", 0, 0, 0); - } -} - - -// removes virtualization from the database -function remove($virtualization_id) { - global $VIRTUALIZATION_INFO_TABLE; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from $VIRTUALIZATION_INFO_TABLE where virtualization_id=$virtualization_id"); -} - -// removes virtualization from the database by virtualization_type -function remove_by_type($type) { - global $VIRTUALIZATION_INFO_TABLE; - $db=openqrm_get_db_connection(); - $rs = $db->Execute("delete from $VIRTUALIZATION_INFO_TABLE where virtualization_type='$type'"); -} - - - -// returns a list of all virtualization names -function get_list() { - global $VIRTUALIZATION_INFO_TABLE; - $query = "select virtualization_id, virtualization_name from $VIRTUALIZATION_INFO_TABLE"; - $virtualization_name_array = array(); - $virtualization_name_array = openqrm_db_get_result_double ($query); - return $virtualization_name_array; -} - - -// returns the virtualization plugin name -function get_plugin_name() { - $virtualization_plugin_name = str_replace("-vm-local", "", $this->type); - $virtualization_plugin_name = str_replace("-vm-net", "", $virtualization_plugin_name); - $virtualization_plugin_name = str_replace("-vm", "", $virtualization_plugin_name); - return $virtualization_plugin_name; -} - - - -// --------------------------------------------------------------------------------- - -} - diff --git a/openQRM-5.3.50-CE/src/web/base/cli.php b/openQRM-5.3.50-CE/src/web/base/cli.php deleted file mode 100644 index d082ba2..0000000 --- a/openQRM-5.3.50-CE/src/web/base/cli.php +++ /dev/null @@ -1,26 +0,0 @@ - -*/ -$_SERVER["DOCUMENT_ROOT"] = '/var/www/'; -$_SERVER['PHP_AUTH_USER'] = 'openqrm'; - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once($RootDir.'/class/openqrm.controller.class.php'); -if (!file_exists('unconfigured')) { - require_once($RootDir.'/include/user.inc.php'); -} - -#$controller = new openqrm_controller(); -#$controller->cli($argv); diff --git a/openQRM-5.3.50-CE/src/web/base/css/bootstrap/bootstrap.css b/openQRM-5.3.50-CE/src/web/base/css/bootstrap/bootstrap.css deleted file mode 100644 index c2cc1c4..0000000 --- a/openQRM-5.3.50-CE/src/web/base/css/bootstrap/bootstrap.css +++ /dev/null @@ -1,1723 +0,0 @@ -/*! - * Bootstrap v2.3.1 - * - * Copyright 2012 Twitter, Inc - * Licensed under the Apache License v2.0 - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Designed and built with all the love in the world @twitter by @mdo and @fat. - */ -.clearfix { - *zoom: 1; -} -.clearfix:before, -.clearfix:after { - display: table; - content: ""; - line-height: 0; -} -.clearfix:after { - clear: both; -} -.hide-text { - font: 0/0 a; - color: transparent; - text-shadow: none; - background-color: transparent; - border: 0; -} -.input-block-level { - display: block; - width: 100%; - min-height: 30px; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -p { - margin: 0 0 10px; -} -.lead { - margin-bottom: 20px; - font-size: 18px; - font-weight: 200; - line-height: 30px; -} -small { - font-size: 85%; -} -strong { - font-weight: bold; -} -em { - font-style: italic; -} -cite { - font-style: normal; -} -.muted { - color: #999999; -} -a.muted:hover, -a.muted:focus { - color: #808080; -} -.text-warning { - color: #c09853; -} -a.text-warning:hover, -a.text-warning:focus { - color: #a47e3c; -} -.text-error { - color: #b94a48; -} -a.text-error:hover, -a.text-error:focus { - color: #953b39; -} -.text-info { - color: #3a87ad; -} -a.text-info:hover, -a.text-info:focus { - color: #2d6987; -} -.text-success { - color: #468847; -} -a.text-success:hover, -a.text-success:focus { - color: #356635; -} -.text-left { - text-align: left; -} -.text-right { - text-align: right; -} -.text-center { - text-align: center; -} -h1, -h2, -h3, -h4, -h5, -h6 { - margin: 10px 0; - font-family: inherit; - font-weight: bold; - line-height: 20px; - color: inherit; - text-rendering: optimizelegibility; -} -h1 small, -h2 small, -h3 small, -h4 small, -h5 small, -h6 small { - font-weight: normal; - line-height: 1; - color: #999999; -} -h1, -h2, -h3 { - line-height: 40px; -} -h1 { - font-size: 33px; -} -h2 { - font-size: 27px; -} -h3 { - font-size: 21px; -} -h4 { - font-size: 15px; -} -h5 { - font-size: 12px; -} -h6 { - font-size: 10.2px; -} -h1 small { - font-size: 21px; -} -h2 small { - font-size: 15px; -} -h3 small { - font-size: 12px; -} -h4 small { - font-size: 12px; -} -.page-header { - padding-bottom: 9px; - margin: 20px 0 30px; - border-bottom: 1px solid #eeeeee; -} -ul, -ol { - padding: 0; - margin: 0 0 10px 25px; -} -ul ul, -ul ol, -ol ol, -ol ul { - margin-bottom: 0; -} -li { - line-height: 20px; -} -ul.unstyled, -ol.unstyled { - margin-left: 0; - list-style: none; -} -ul.inline, -ol.inline { - margin-left: 0; - list-style: none; -} -ul.inline > li, -ol.inline > li { - display: inline-block; - *display: inline; - /* IE7 inline-block hack */ - - *zoom: 1; - padding-left: 5px; - padding-right: 5px; -} -dl { - margin-bottom: 20px; -} -dt, -dd { - line-height: 20px; -} -dt { - font-weight: bold; -} -dd { - margin-left: 10px; -} -.dl-horizontal { - *zoom: 1; -} -.dl-horizontal:before, -.dl-horizontal:after { - display: table; - content: ""; - line-height: 0; -} -.dl-horizontal:after { - clear: both; -} -.dl-horizontal dt { - float: left; - width: 160px; - clear: left; - text-align: right; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} -.dl-horizontal dd { - margin-left: 180px; -} -hr { - margin: 20px 0; - border: 0; - border-top: 1px solid #eeeeee; - border-bottom: 1px solid #ffffff; -} -abbr[title], -abbr[data-original-title] { - cursor: help; - border-bottom: 1px dotted #999999; -} -abbr.initialism { - font-size: 90%; - text-transform: uppercase; -} -blockquote { - padding: 0 0 0 15px; - margin: 0 0 20px; - border-left: 5px solid #eeeeee; -} -blockquote p { - margin-bottom: 0; - font-size: 15px; - font-weight: 300; - line-height: 1.25; -} -blockquote small { - display: block; - line-height: 20px; - color: #999999; -} -blockquote small:before { - content: '\2014 \00A0'; -} -blockquote.pull-right { - float: right; - padding-right: 15px; - padding-left: 0; - border-right: 5px solid #eeeeee; - border-left: 0; -} -blockquote.pull-right p, -blockquote.pull-right small { - text-align: right; -} -blockquote.pull-right small:before { - content: ''; -} -blockquote.pull-right small:after { - content: '\00A0 \2014'; -} -q:before, -q:after, -blockquote:before, -blockquote:after { - content: ""; -} -address { - display: block; - margin-bottom: 20px; - font-style: normal; - line-height: 20px; -} -code, -pre { - padding: 0 3px 2px; - font-family: Monaco, Menlo, Consolas, "Courier New", monospace; - font-size: 10px; - color: #333333; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; -} -code { - padding: 2px 4px; - color: #d14; - background-color: #f7f7f9; - border: 1px solid #e1e1e8; - white-space: nowrap; -} -pre { - display: block; - padding: 9.5px; - margin: 0 0 10px; - font-size: 11px; - line-height: 20px; - word-break: break-all; - word-wrap: break-word; - white-space: pre; - white-space: pre-wrap; - background-color: #f5f5f5; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, 0.15); - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} -pre.prettyprint { - margin-bottom: 20px; -} -pre code { - padding: 0; - color: inherit; - white-space: pre; - white-space: pre-wrap; - background-color: transparent; - border: 0; -} -.pre-scrollable { - max-height: 340px; - overflow-y: scroll; -} -form { - margin: 0 0 20px; -} -fieldset { - padding: 0; - margin: 0; - border: 0; -} -legend { - display: block; - width: 100%; - padding: 0; - margin-bottom: 20px; - font-size: 18px; - line-height: 40px; - color: #333333; - border: 0; - border-bottom: 1px solid #e5e5e5; -} -legend small { - font-size: 15px; - color: #999999; -} -label, -input, -button, -select, -textarea { - font-size: 12px; - font-weight: normal; - line-height: 20px; -} -input, -button, -select, -textarea { - font-family: Arial, Helvetica, sans-serif; -} -label { - display: block; - margin-bottom: 5px; -} -select, -textarea, -input[type="text"], -input[type="password"], -input[type="datetime"], -input[type="datetime-local"], -input[type="date"], -input[type="month"], -input[type="time"], -input[type="week"], -input[type="number"], -input[type="email"], -input[type="url"], -input[type="search"], -input[type="tel"], -input[type="color"], -.uneditable-input { - display: inline-block; - height: 20px; - padding: 4px 6px; - font-size: 12px; - margin-bottom: 10px; - line-height: 20px; - color: #555555; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - vertical-align: middle; -} -input, -textarea, -.uneditable-input { - width: 206px; -} -textarea { - height: auto; -} -textarea, -input[type="text"], -input[type="password"], -input[type="datetime"], -input[type="datetime-local"], -input[type="date"], -input[type="month"], -input[type="time"], -input[type="week"], -input[type="number"], -input[type="email"], -input[type="url"], -input[type="search"], -input[type="tel"], -input[type="color"], -.uneditable-input { - background-color: #ffffff; - border: 1px solid #cccccc; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - -webkit-transition: border linear .2s, box-shadow linear .2s; - -moz-transition: border linear .2s, box-shadow linear .2s; - -o-transition: border linear .2s, box-shadow linear .2s; - transition: border linear .2s, box-shadow linear .2s; -} -textarea:focus, -input[type="text"]:focus, -input[type="password"]:focus, -input[type="datetime"]:focus, -input[type="datetime-local"]:focus, -input[type="date"]:focus, -input[type="month"]:focus, -input[type="time"]:focus, -input[type="week"]:focus, -input[type="number"]:focus, -input[type="email"]:focus, -input[type="url"]:focus, -input[type="search"]:focus, -input[type="tel"]:focus, -input[type="color"]:focus, -.uneditable-input:focus { - border-color: rgba(82, 168, 236, 0.8); - outline: 0; - outline: thin dotted \9; - /* IE6-9 */ - - -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); - -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); - box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); -} -input[type="radio"], -input[type="checkbox"] { - margin: 4px 0 0; - *margin-top: 0; - /* IE7 */ - - margin-top: 1px \9; - /* IE8-9 */ - - line-height: normal; -} -input[type="file"], -input[type="image"], -input[type="submit"], -input[type="reset"], -input[type="button"], -input[type="radio"], -input[type="checkbox"] { - width: auto; -} -select, -input[type="file"] { - height: auto; - /* In IE7, the height of the select element cannot be changed by height, only font-size */ - - *margin-top: 4px; - /* For IE7, add top margin to align select with labels */ - - line-height: auto; -} -select { - width: 220px; - border: 1px solid #cccccc; - background-color: #ffffff; -} -select[multiple], -select[size] { - height: auto; -} -select:focus, -input[type="file"]:focus, -input[type="radio"]:focus, -input[type="checkbox"]:focus { - outline: thin dotted #333; - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; -} -.uneditable-input, -.uneditable-textarea { - color: #999999; - background-color: #fcfcfc; - border-color: #cccccc; - -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); - -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); - cursor: not-allowed; -} -.uneditable-input { - overflow: hidden; - white-space: nowrap; -} -.uneditable-textarea { - width: auto; - height: auto; -} -input:-moz-placeholder, -textarea:-moz-placeholder { - color: #999999; -} -input:-ms-input-placeholder, -textarea:-ms-input-placeholder { - color: #999999; -} -input::-webkit-input-placeholder, -textarea::-webkit-input-placeholder { - color: #999999; -} -.radio, -.checkbox { - min-height: 20px; - padding-left: 20px; -} -.radio input[type="radio"], -.checkbox input[type="checkbox"] { - float: left; - margin-left: -20px; -} -.controls > .radio:first-child, -.controls > .checkbox:first-child { - padding-top: 5px; -} -.radio.inline, -.checkbox.inline { - display: inline-block; - padding-top: 5px; - margin-bottom: 0; - vertical-align: middle; -} -.radio.inline + .radio.inline, -.checkbox.inline + .checkbox.inline { - margin-left: 10px; -} -.input-mini { - width: 60px; -} -.input-small { - width: 90px; -} -.input-medium { - width: 150px; -} -.input-large { - width: 210px; -} -.input-xlarge { - width: 270px; -} -.input-xxlarge { - width: 530px; -} -input[class*="span"], -select[class*="span"], -textarea[class*="span"], -.uneditable-input[class*="span"], -.row-fluid input[class*="span"], -.row-fluid select[class*="span"], -.row-fluid textarea[class*="span"], -.row-fluid .uneditable-input[class*="span"] { - float: none; - margin-left: 0; -} -.input-append input[class*="span"], -.input-append .uneditable-input[class*="span"], -.input-prepend input[class*="span"], -.input-prepend .uneditable-input[class*="span"], -.row-fluid input[class*="span"], -.row-fluid select[class*="span"], -.row-fluid textarea[class*="span"], -.row-fluid .uneditable-input[class*="span"], -.row-fluid .input-prepend [class*="span"], -.row-fluid .input-append [class*="span"] { - display: inline-block; -} -input, -textarea, -.uneditable-input { - margin-left: 0; -} -.controls-row [class*="span"] + [class*="span"] { - margin-left: 20px; -} -input.span12, -textarea.span12, -.uneditable-input.span12 { - width: 926px; -} -input.span11, -textarea.span11, -.uneditable-input.span11 { - width: 846px; -} -input.span10, -textarea.span10, -.uneditable-input.span10 { - width: 766px; -} -input.span9, -textarea.span9, -.uneditable-input.span9 { - width: 686px; -} -input.span8, -textarea.span8, -.uneditable-input.span8 { - width: 606px; -} -input.span7, -textarea.span7, -.uneditable-input.span7 { - width: 526px; -} -input.span6, -textarea.span6, -.uneditable-input.span6 { - width: 446px; -} -input.span5, -textarea.span5, -.uneditable-input.span5 { - width: 366px; -} -input.span4, -textarea.span4, -.uneditable-input.span4 { - width: 286px; -} -input.span3, -textarea.span3, -.uneditable-input.span3 { - width: 206px; -} -input.span2, -textarea.span2, -.uneditable-input.span2 { - width: 126px; -} -input.span1, -textarea.span1, -.uneditable-input.span1 { - width: 46px; -} -.controls-row { - *zoom: 1; -} -.controls-row:before, -.controls-row:after { - display: table; - content: ""; - line-height: 0; -} -.controls-row:after { - clear: both; -} -.controls-row [class*="span"], -.row-fluid .controls-row [class*="span"] { - float: left; -} -.controls-row .checkbox[class*="span"], -.controls-row .radio[class*="span"] { - padding-top: 5px; -} -input[disabled], -select[disabled], -textarea[disabled], -input[readonly], -select[readonly], -textarea[readonly] { - cursor: not-allowed; - background-color: #eeeeee; -} -input[type="radio"][disabled], -input[type="checkbox"][disabled], -input[type="radio"][readonly], -input[type="checkbox"][readonly] { - background-color: transparent; -} -.control-group.warning .control-label, -.control-group.warning .help-block, -.control-group.warning .help-inline { - color: #c09853; -} -.control-group.warning .checkbox, -.control-group.warning .radio, -.control-group.warning input, -.control-group.warning select, -.control-group.warning textarea { - color: #c09853; -} -.control-group.warning input, -.control-group.warning select, -.control-group.warning textarea { - border-color: #c09853; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} -.control-group.warning input:focus, -.control-group.warning select:focus, -.control-group.warning textarea:focus { - border-color: #a47e3c; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; -} -.control-group.warning .input-prepend .add-on, -.control-group.warning .input-append .add-on { - color: #c09853; - background-color: #fcf8e3; - border-color: #c09853; -} -.control-group.error .control-label, -.control-group.error .help-block, -.control-group.error .help-inline { - color: #b94a48; -} -.control-group.error .checkbox, -.control-group.error .radio, -.control-group.error input, -.control-group.error select, -.control-group.error textarea { - color: #b94a48; -} -.control-group.error input, -.control-group.error select, -.control-group.error textarea { - border-color: #b94a48; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} -.control-group.error input:focus, -.control-group.error select:focus, -.control-group.error textarea:focus { - border-color: #953b39; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; -} -.control-group.error .input-prepend .add-on, -.control-group.error .input-append .add-on { - color: #b94a48; - background-color: #f2dede; - border-color: #b94a48; -} -.control-group.success .control-label, -.control-group.success .help-block, -.control-group.success .help-inline { - color: #468847; -} -.control-group.success .checkbox, -.control-group.success .radio, -.control-group.success input, -.control-group.success select, -.control-group.success textarea { - color: #468847; -} -.control-group.success input, -.control-group.success select, -.control-group.success textarea { - border-color: #468847; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} -.control-group.success input:focus, -.control-group.success select:focus, -.control-group.success textarea:focus { - border-color: #356635; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; -} -.control-group.success .input-prepend .add-on, -.control-group.success .input-append .add-on { - color: #468847; - background-color: #dff0d8; - border-color: #468847; -} -.control-group.info .control-label, -.control-group.info .help-block, -.control-group.info .help-inline { - color: #3a87ad; -} -.control-group.info .checkbox, -.control-group.info .radio, -.control-group.info input, -.control-group.info select, -.control-group.info textarea { - color: #3a87ad; -} -.control-group.info input, -.control-group.info select, -.control-group.info textarea { - border-color: #3a87ad; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} -.control-group.info input:focus, -.control-group.info select:focus, -.control-group.info textarea:focus { - border-color: #2d6987; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3; - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3; -} -.control-group.info .input-prepend .add-on, -.control-group.info .input-append .add-on { - color: #3a87ad; - background-color: #d9edf7; - border-color: #3a87ad; -} -input:focus:invalid, -textarea:focus:invalid, -select:focus:invalid { - color: #b94a48; - border-color: #ee5f5b; -} -input:focus:invalid:focus, -textarea:focus:invalid:focus, -select:focus:invalid:focus { - border-color: #e9322d; - -webkit-box-shadow: 0 0 6px #f8b9b7; - -moz-box-shadow: 0 0 6px #f8b9b7; - box-shadow: 0 0 6px #f8b9b7; -} -.form-actions { - padding: 19px 20px 20px; - margin-top: 20px; - margin-bottom: 20px; - background-color: #f5f5f5; - border-top: 1px solid #e5e5e5; - *zoom: 1; -} -.form-actions:before, -.form-actions:after { - display: table; - content: ""; - line-height: 0; -} -.form-actions:after { - clear: both; -} -.help-block, -.help-inline { - color: #595959; -} -.help-block { - display: block; - margin-bottom: 10px; -} -.help-inline { - display: inline-block; - *display: inline; - /* IE7 inline-block hack */ - - *zoom: 1; - vertical-align: middle; - padding-left: 5px; -} -.input-append, -.input-prepend { - display: inline-block; - margin-bottom: 10px; - vertical-align: middle; - font-size: 0; - white-space: nowrap; -} -.input-append input, -.input-prepend input, -.input-append select, -.input-prepend select, -.input-append .uneditable-input, -.input-prepend .uneditable-input, -.input-append .dropdown-menu, -.input-prepend .dropdown-menu, -.input-append .popover, -.input-prepend .popover { - font-size: 12px; -} -.input-append input, -.input-prepend input, -.input-append select, -.input-prepend select, -.input-append .uneditable-input, -.input-prepend .uneditable-input { - position: relative; - margin-bottom: 0; - *margin-left: 0; - vertical-align: top; - -webkit-border-radius: 0 4px 4px 0; - -moz-border-radius: 0 4px 4px 0; - border-radius: 0 4px 4px 0; -} -.input-append input:focus, -.input-prepend input:focus, -.input-append select:focus, -.input-prepend select:focus, -.input-append .uneditable-input:focus, -.input-prepend .uneditable-input:focus { - z-index: 2; -} -.input-append .add-on, -.input-prepend .add-on { - display: inline-block; - width: auto; - height: 20px; - min-width: 16px; - padding: 4px 5px; - font-size: 12px; - font-weight: normal; - line-height: 20px; - text-align: center; - text-shadow: 0 1px 0 #ffffff; - background-color: #eeeeee; - border: 1px solid #ccc; -} -.input-append .add-on, -.input-prepend .add-on, -.input-append .btn, -.input-prepend .btn, -.input-append .btn-group > .dropdown-toggle, -.input-prepend .btn-group > .dropdown-toggle { - vertical-align: top; - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; -} -.input-append .active, -.input-prepend .active { - background-color: #a9dba9; - border-color: #46a546; -} -.input-prepend .add-on, -.input-prepend .btn { - margin-right: -1px; -} -.input-prepend .add-on:first-child, -.input-prepend .btn:first-child { - -webkit-border-radius: 4px 0 0 4px; - -moz-border-radius: 4px 0 0 4px; - border-radius: 4px 0 0 4px; -} -.input-append input, -.input-append select, -.input-append .uneditable-input { - -webkit-border-radius: 4px 0 0 4px; - -moz-border-radius: 4px 0 0 4px; - border-radius: 4px 0 0 4px; -} -.input-append input + .btn-group .btn:last-child, -.input-append select + .btn-group .btn:last-child, -.input-append .uneditable-input + .btn-group .btn:last-child { - -webkit-border-radius: 0 4px 4px 0; - -moz-border-radius: 0 4px 4px 0; - border-radius: 0 4px 4px 0; -} -.input-append .add-on, -.input-append .btn, -.input-append .btn-group { - margin-left: -1px; -} -.input-append .add-on:last-child, -.input-append .btn:last-child, -.input-append .btn-group:last-child > .dropdown-toggle { - -webkit-border-radius: 0 4px 4px 0; - -moz-border-radius: 0 4px 4px 0; - border-radius: 0 4px 4px 0; -} -.input-prepend.input-append input, -.input-prepend.input-append select, -.input-prepend.input-append .uneditable-input { - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; -} -.input-prepend.input-append input + .btn-group .btn, -.input-prepend.input-append select + .btn-group .btn, -.input-prepend.input-append .uneditable-input + .btn-group .btn { - -webkit-border-radius: 0 4px 4px 0; - -moz-border-radius: 0 4px 4px 0; - border-radius: 0 4px 4px 0; -} -.input-prepend.input-append .add-on:first-child, -.input-prepend.input-append .btn:first-child { - margin-right: -1px; - -webkit-border-radius: 4px 0 0 4px; - -moz-border-radius: 4px 0 0 4px; - border-radius: 4px 0 0 4px; -} -.input-prepend.input-append .add-on:last-child, -.input-prepend.input-append .btn:last-child { - margin-left: -1px; - -webkit-border-radius: 0 4px 4px 0; - -moz-border-radius: 0 4px 4px 0; - border-radius: 0 4px 4px 0; -} -.input-prepend.input-append .btn-group:first-child { - margin-left: 0; -} -input.search-query { - padding-right: 14px; - padding-right: 4px \9; - padding-left: 14px; - padding-left: 4px \9; - /* IE7-8 doesn't have border-radius, so don't indent the padding */ - - margin-bottom: 0; - -webkit-border-radius: 15px; - -moz-border-radius: 15px; - border-radius: 15px; -} -/* Allow for input prepend/append in search forms */ -.form-search .input-append .search-query, -.form-search .input-prepend .search-query { - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; -} -.form-search .input-append .search-query { - -webkit-border-radius: 14px 0 0 14px; - -moz-border-radius: 14px 0 0 14px; - border-radius: 14px 0 0 14px; -} -.form-search .input-append .btn { - -webkit-border-radius: 0 14px 14px 0; - -moz-border-radius: 0 14px 14px 0; - border-radius: 0 14px 14px 0; -} -.form-search .input-prepend .search-query { - -webkit-border-radius: 0 14px 14px 0; - -moz-border-radius: 0 14px 14px 0; - border-radius: 0 14px 14px 0; -} -.form-search .input-prepend .btn { - -webkit-border-radius: 14px 0 0 14px; - -moz-border-radius: 14px 0 0 14px; - border-radius: 14px 0 0 14px; -} -.form-search input, -.form-inline input, -.form-horizontal input, -.form-search textarea, -.form-inline textarea, -.form-horizontal textarea, -.form-search select, -.form-inline select, -.form-horizontal select, -.form-search .help-inline, -.form-inline .help-inline, -.form-horizontal .help-inline, -.form-search .uneditable-input, -.form-inline .uneditable-input, -.form-horizontal .uneditable-input, -.form-search .input-prepend, -.form-inline .input-prepend, -.form-horizontal .input-prepend, -.form-search .input-append, -.form-inline .input-append, -.form-horizontal .input-append { - display: inline-block; - *display: inline; - /* IE7 inline-block hack */ - - *zoom: 1; - margin-bottom: 0; - vertical-align: middle; -} -.form-search .hide, -.form-inline .hide, -.form-horizontal .hide { - display: none; -} -.form-search label, -.form-inline label, -.form-search .btn-group, -.form-inline .btn-group { - display: inline-block; -} -.form-search .input-append, -.form-inline .input-append, -.form-search .input-prepend, -.form-inline .input-prepend { - margin-bottom: 0; -} -.form-search .radio, -.form-search .checkbox, -.form-inline .radio, -.form-inline .checkbox { - padding-left: 0; - margin-bottom: 0; - vertical-align: middle; -} -.form-search .radio input[type="radio"], -.form-search .checkbox input[type="checkbox"], -.form-inline .radio input[type="radio"], -.form-inline .checkbox input[type="checkbox"] { - float: left; - margin-right: 3px; - margin-left: 0; -} -.control-group { - margin-bottom: 10px; -} -legend + .control-group { - margin-top: 20px; - -webkit-margin-top-collapse: separate; -} -.form-horizontal .control-group { - margin-bottom: 20px; - *zoom: 1; -} -.form-horizontal .control-group:before, -.form-horizontal .control-group:after { - display: table; - content: ""; - line-height: 0; -} -.form-horizontal .control-group:after { - clear: both; -} -.form-horizontal .control-label { - float: left; - width: 160px; - padding-top: 5px; - text-align: right; -} -.form-horizontal .controls { - *display: inline-block; - *padding-left: 20px; - margin-left: 180px; - *margin-left: 0; -} -.form-horizontal .controls:first-child { - *padding-left: 180px; -} -.form-horizontal .help-block { - margin-bottom: 0; -} -.form-horizontal input + .help-block, -.form-horizontal select + .help-block, -.form-horizontal textarea + .help-block, -.form-horizontal .uneditable-input + .help-block, -.form-horizontal .input-prepend + .help-block, -.form-horizontal .input-append + .help-block { - margin-top: 10px; -} -.form-horizontal .form-actions { - padding-left: 180px; -} - - - -/* Tables */ -table { - max-width: 100%; - background-color: transparent; - border-collapse: collapse; - border-spacing: 0; -} -.table { - width: 100%; - margin-bottom: 20px; -} -.table th, -.table td { - padding: 8px; - line-height: 20px; - text-align: left; - vertical-align: top; - border-top: 1px solid #dddddd; -} -.table th { - font-weight: bold; -} -.table thead th { - vertical-align: bottom; -} -.table caption + thead tr:first-child th, -.table caption + thead tr:first-child td, -.table colgroup + thead tr:first-child th, -.table colgroup + thead tr:first-child td, -.table thead:first-child tr:first-child th, -.table thead:first-child tr:first-child td { - border-top: 0; -} -.table tbody + tbody { - border-top: 2px solid #dddddd; -} -.table .table { - background-color: #ffffff; -} -.table-condensed th, -.table-condensed td { - padding: 4px 5px; -} -.table-bordered { - border: 1px solid #dddddd; - border-collapse: separate; - *border-collapse: collapse; - border-left: 0; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} -.table-bordered th, -.table-bordered td { - border-left: 1px solid #dddddd; -} -.table-bordered caption + thead tr:first-child th, -.table-bordered caption + tbody tr:first-child th, -.table-bordered caption + tbody tr:first-child td, -.table-bordered colgroup + thead tr:first-child th, -.table-bordered colgroup + tbody tr:first-child th, -.table-bordered colgroup + tbody tr:first-child td, -.table-bordered thead:first-child tr:first-child th, -.table-bordered tbody:first-child tr:first-child th, -.table-bordered tbody:first-child tr:first-child td { - border-top: 0; -} -.table-bordered thead:first-child tr:first-child > th:first-child, -.table-bordered tbody:first-child tr:first-child > td:first-child, -.table-bordered tbody:first-child tr:first-child > th:first-child { - -webkit-border-top-left-radius: 4px; - -moz-border-radius-topleft: 4px; - border-top-left-radius: 4px; -} -.table-bordered thead:first-child tr:first-child > th:last-child, -.table-bordered tbody:first-child tr:first-child > td:last-child, -.table-bordered tbody:first-child tr:first-child > th:last-child { - -webkit-border-top-right-radius: 4px; - -moz-border-radius-topright: 4px; - border-top-right-radius: 4px; -} -.table-bordered thead:last-child tr:last-child > th:first-child, -.table-bordered tbody:last-child tr:last-child > td:first-child, -.table-bordered tbody:last-child tr:last-child > th:first-child, -.table-bordered tfoot:last-child tr:last-child > td:first-child, -.table-bordered tfoot:last-child tr:last-child > th:first-child { - -webkit-border-bottom-left-radius: 4px; - -moz-border-radius-bottomleft: 4px; - border-bottom-left-radius: 4px; -} -.table-bordered thead:last-child tr:last-child > th:last-child, -.table-bordered tbody:last-child tr:last-child > td:last-child, -.table-bordered tbody:last-child tr:last-child > th:last-child, -.table-bordered tfoot:last-child tr:last-child > td:last-child, -.table-bordered tfoot:last-child tr:last-child > th:last-child { - -webkit-border-bottom-right-radius: 4px; - -moz-border-radius-bottomright: 4px; - border-bottom-right-radius: 4px; -} -.table-bordered tfoot + tbody:last-child tr:last-child td:first-child { - -webkit-border-bottom-left-radius: 0; - -moz-border-radius-bottomleft: 0; - border-bottom-left-radius: 0; -} -.table-bordered tfoot + tbody:last-child tr:last-child td:last-child { - -webkit-border-bottom-right-radius: 0; - -moz-border-radius-bottomright: 0; - border-bottom-right-radius: 0; -} -.table-bordered caption + thead tr:first-child th:first-child, -.table-bordered caption + tbody tr:first-child td:first-child, -.table-bordered colgroup + thead tr:first-child th:first-child, -.table-bordered colgroup + tbody tr:first-child td:first-child { - -webkit-border-top-left-radius: 4px; - -moz-border-radius-topleft: 4px; - border-top-left-radius: 4px; -} -.table-bordered caption + thead tr:first-child th:last-child, -.table-bordered caption + tbody tr:first-child td:last-child, -.table-bordered colgroup + thead tr:first-child th:last-child, -.table-bordered colgroup + tbody tr:first-child td:last-child { - -webkit-border-top-right-radius: 4px; - -moz-border-radius-topright: 4px; - border-top-right-radius: 4px; -} -.table-striped tbody > tr:nth-child(odd) > td, -.table-striped tbody > tr:nth-child(odd) > th { - background-color: #f9f9f9; -} -.table-hover tbody tr:hover > td, -.table-hover tbody tr:hover > th { - background-color: #f5f5f5; -} -table td[class*="span"], -table th[class*="span"], -.row-fluid table td[class*="span"], -.row-fluid table th[class*="span"] { - display: table-cell; - float: none; - margin-left: 0; -} -.table td.span1, -.table th.span1 { - float: none; - width: 44px; - margin-left: 0; -} -.table td.span2, -.table th.span2 { - float: none; - width: 124px; - margin-left: 0; -} -.table td.span3, -.table th.span3 { - float: none; - width: 204px; - margin-left: 0; -} -.table td.span4, -.table th.span4 { - float: none; - width: 284px; - margin-left: 0; -} -.table td.span5, -.table th.span5 { - float: none; - width: 364px; - margin-left: 0; -} -.table td.span6, -.table th.span6 { - float: none; - width: 444px; - margin-left: 0; -} -.table td.span7, -.table th.span7 { - float: none; - width: 524px; - margin-left: 0; -} -.table td.span8, -.table th.span8 { - float: none; - width: 604px; - margin-left: 0; -} -.table td.span9, -.table th.span9 { - float: none; - width: 684px; - margin-left: 0; -} -.table td.span10, -.table th.span10 { - float: none; - width: 764px; - margin-left: 0; -} -.table td.span11, -.table th.span11 { - float: none; - width: 844px; - margin-left: 0; -} -.table td.span12, -.table th.span12 { - float: none; - width: 924px; - margin-left: 0; -} -.table tbody tr.success > td { - background-color: #dff0d8; -} -.table tbody tr.error > td { - background-color: #f2dede; -} -.table tbody tr.warning > td { - background-color: #fcf8e3; -} -.table tbody tr.info > td { - background-color: #d9edf7; -} -.table-hover tbody tr.success:hover > td { - background-color: #d0e9c6; -} -.table-hover tbody tr.error:hover > td { - background-color: #ebcccc; -} -.table-hover tbody tr.warning:hover > td { - background-color: #faf2cc; -} -.table-hover tbody tr.info:hover > td { - background-color: #c4e3f3; -} - - - - - - -/* Grid system */ - -.row { - margin-left: -15px; - *zoom: 1; -} -.row:before, -.row:after { - display: table; - content: ""; - line-height: 0; -} -.row:after { - clear: both; -} -[class*="span"] { - float: left; - min-height: 1px; - margin-left: 15px; -} -.container, -.navbar-static-top .container, -.navbar-fixed-top .container, -.navbar-fixed-bottom .container { - width: 1198px; -} -.span12 { - width: 1198px; -} -.span11 { - width: 1083px; -} -.span10 { - width: 960px; -} -.span9 { - width: 968px; -} -.span8 { - width: 738px; -} -.span7 { - width: 630px; -} -.span6 { - width: 575px; -} -.span5 { - width: 560px; -} -.span4 { - width: 345px; -} -.span3 { - width: 330px; -} -.span2 { - width: 215px; -} -.span1 { - width: 100px; -} -.offset12 { - margin-left: 1395px; -} -.offset11 { - margin-left: 1280px; -} -.offset10 { - margin-left: 1165px; -} -.offset9 { - margin-left: 1050px; -} -.offset8 { - margin-left: 935px; -} -.offset7 { - margin-left: 820px; -} -.offset6 { - margin-left: 705px; -} -.offset5 { - margin-left: 590px; -} -.offset4 { - margin-left: 475px; -} -.offset3 { - margin-left: 360px; -} -.offset2 { - margin-left: 245px; -} -.offset1 { - margin-left: 90px; -} -.row-fluid { - width: 100%; - *zoom: 1; -} -.row-fluid:before, -.row-fluid:after { - display: table; - content: ""; - line-height: 0; -} -.row-fluid:after { - clear: both; -} -.row-fluid [class*="span"] { - display: block; - width: 100%; - min-height: 30px; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - float: left; - margin-left: 1.098901098901099%; - *margin-left: 1.0622710622710623%; -} -.row-fluid [class*="span"]:first-child { - margin-left: 0; -} -.row-fluid .controls-row [class*="span"] + [class*="span"] { - margin-left: 1.098901098901099%; -} -.row-fluid .span12 { - width: 100%; - *width: 99.96336996336996%; -} -.row-fluid .span11 { - width: 91.57509157509159%; - *width: 91.53846153846155%; -} -.row-fluid .span10 { - width: 83.15018315018315%; - *width: 83.11355311355311%; -} -.row-fluid .span9 { - width: 74.72527472527473%; - *width: 74.68864468864469%; -} -.row-fluid .span8 { - width: 66.3003663003663%; - *width: 66.26373626373626%; -} -.row-fluid .span7 { - width: 57.875457875457876%; - *width: 57.83882783882784%; -} -.row-fluid .span6 { - width: 49.45054945054945%; - *width: 49.413919413919416%; -} -.row-fluid .span5 { - width: 41.02564102564103%; - *width: 40.98901098901099%; -} -.row-fluid .span4 { - width: 32.600732600732606%; - *width: 32.56410256410257%; -} -.row-fluid .span3 { - width: 24.175824175824175%; - *width: 24.13919413919414%; -} -.row-fluid .span2 { - width: 15.750915750915752%; - *width: 15.714285714285715%; -} -.row-fluid .span1 { - width: 7.326007326007327%; - *width: 7.28937728937729%; -} -.row-fluid .offset12 { - margin-left: 102.1978021978022%; - *margin-left: 102.12454212454212%; -} -.row-fluid .offset12:first-child { - margin-left: 101.0989010989011%; - *margin-left: 101.02564102564101%; -} -.row-fluid .offset11 { - margin-left: 93.7728937728938%; - *margin-left: 93.69963369963371%; -} -.row-fluid .offset11:first-child { - margin-left: 92.67399267399269%; - *margin-left: 92.6007326007326%; -} -.row-fluid .offset10 { - margin-left: 85.34798534798536%; - *margin-left: 85.27472527472527%; -} -.row-fluid .offset10:first-child { - margin-left: 84.24908424908425%; - *margin-left: 84.17582417582416%; -} -.row-fluid .offset9 { - margin-left: 76.92307692307693%; - *margin-left: 76.84981684981685%; -} -.row-fluid .offset9:first-child { - margin-left: 75.82417582417582%; - *margin-left: 75.75091575091574%; -} -.row-fluid .offset8 { - margin-left: 68.49816849816851%; - *margin-left: 68.42490842490842%; -} -.row-fluid .offset8:first-child { - margin-left: 67.3992673992674%; - *margin-left: 67.32600732600731%; -} -.row-fluid .offset7 { - margin-left: 60.07326007326007%; - *margin-left: 60%; -} -.row-fluid .offset7:first-child { - margin-left: 58.97435897435898%; - *margin-left: 58.901098901098905%; -} -.row-fluid .offset6 { - margin-left: 51.64835164835165%; - *margin-left: 51.57509157509158%; -} -.row-fluid .offset6:first-child { - margin-left: 50.549450549450555%; - *margin-left: 50.47619047619048%; -} -.row-fluid .offset5 { - margin-left: 43.223443223443226%; - *margin-left: 43.15018315018315%; -} -.row-fluid .offset5:first-child { - margin-left: 42.12454212454213%; - *margin-left: 42.05128205128206%; -} -.row-fluid .offset4 { - margin-left: 34.7985347985348%; - *margin-left: 34.72527472527473%; -} -.row-fluid .offset4:first-child { - margin-left: 33.69963369963371%; - *margin-left: 33.626373626373635%; -} -.row-fluid .offset3 { - margin-left: 26.373626373626372%; - *margin-left: 26.3003663003663%; -} -.row-fluid .offset3:first-child { - margin-left: 25.274725274725274%; - *margin-left: 25.2014652014652%; -} -.row-fluid .offset2 { - margin-left: 17.94871794871795%; - *margin-left: 17.875457875457876%; -} -.row-fluid .offset2:first-child { - margin-left: 16.84981684981685%; - *margin-left: 16.776556776556777%; -} -.row-fluid .offset1 { - margin-left: 9.523809523809526%; - *margin-left: 9.450549450549453%; -} -.row-fluid .offset1:first-child { - margin-left: 8.424908424908425%; - *margin-left: 8.351648351648352%; -} -[class*="span"].hide, -.row-fluid [class*="span"].hide { - display: none; -} -[class*="span"].pull-right, -.row-fluid [class*="span"].pull-right { - float: right; -} diff --git a/openQRM-5.3.50-CE/src/web/base/css/bootstrap/glyphicons.css b/openQRM-5.3.50-CE/src/web/base/css/bootstrap/glyphicons.css deleted file mode 100644 index e689dee..0000000 --- a/openQRM-5.3.50-CE/src/web/base/css/bootstrap/glyphicons.css +++ /dev/null @@ -1,2581 +0,0 @@ -/*! - * - * Project: GLYPHICONS - * Author: Jan Kovarik - www.glyphicons.com - * Twitter: @jankovarik - * - */ -html, -html .halflings { - -webkit-font-smoothing: antialiased !important; -} -@font-face { - font-family: 'Glyphicons'; - src: url('../../fonts/glyphicons-regular.eot'); - src: url('../../fonts/glyphicons-regular.eot?#iefix') format('embedded-opentype'), url('../../fonts/glyphicons-regular.woff') format('woff'), url('../../fonts/glyphicons-regular.ttf') format('truetype'), url('../../fonts/glyphicons-regular.svg#glyphicons_halflingsregular') format('svg'); - font-weight: normal; - font-style: normal; -} -.glyphicons { - display: inline-block; - position: relative; - padding: 5px 0 5px 35px; - color: #1d1d1b; - text-decoration: none; - *display: inline; - *zoom: 1; -} -.glyphicons i:before { - position: absolute; - left: 0; - top: 0; - font: 24px/1em 'Glyphicons'; - font-style: normal; - color: #1d1d1b; -} -.glyphicons.white i:before { - color: #fff; -} -.glyphicons.glass i:before { - content: "\e001"; -} -.glyphicons.leaf i:before { - content: "\e002"; -} -.glyphicons.dog i:before { - content: "\e003"; -} -.glyphicons.user i:before { - content: "\e004"; -} -.glyphicons.girl i:before { - content: "\e005"; -} -.glyphicons.car i:before { - content: "\e006"; -} -.glyphicons.user_add i:before { - content: "\e007"; -} -.glyphicons.user_remove i:before { - content: "\e008"; -} -.glyphicons.film i:before { - content: "\e009"; -} -.glyphicons.magic i:before { - content: "\e010"; -} -.glyphicons.envelope i:before { - content: "\2709"; -} -.glyphicons.camera i:before { - content: "\e012"; -} -.glyphicons.heart i:before { - content: "\e013"; -} -.glyphicons.beach_umbrella i:before { - content: "\e014"; -} -.glyphicons.train i:before { - content: "\e015"; -} -.glyphicons.print i:before { - content: "\e016"; -} -.glyphicons.bin i:before { - content: "\e017"; -} -.glyphicons.music i:before { - content: "\e018"; -} -.glyphicons.note i:before { - content: "\e019"; -} -.glyphicons.heart_empty i:before { - content: "\e020"; -} -.glyphicons.home i:before { - content: "\e021"; -} -.glyphicons.snowflake i:before { - content: "\2744"; -} -.glyphicons.fire i:before { - content: "\e023"; -} -.glyphicons.magnet i:before { - content: "\e024"; -} -.glyphicons.parents i:before { - content: "\e025"; -} -.glyphicons.binoculars i:before { - content: "\e026"; -} -.glyphicons.road i:before { - content: "\e027"; -} -.glyphicons.search i:before { - content: "\e028"; -} -.glyphicons.cars i:before { - content: "\e029"; -} -.glyphicons.notes_2 i:before { - content: "\e030"; -} -.glyphicons.pencil i:before { - content: "\270F"; -} -.glyphicons.bus i:before { - content: "\e032"; -} -.glyphicons.wifi_alt i:before { - content: "\e033"; -} -.glyphicons.luggage i:before { - content: "\e034"; -} -.glyphicons.old_man i:before { - content: "\e035"; -} -.glyphicons.woman i:before { - content: "\e036"; -} -.glyphicons.file i:before { - content: "\e037"; -} -.glyphicons.coins i:before { - content: "\e038"; -} -.glyphicons.airplane i:before { - content: "\2708"; -} -.glyphicons.notes i:before { - content: "\e040"; -} -.glyphicons.stats i:before { - content: "\e041"; -} -.glyphicons.charts i:before { - content: "\e042"; -} -.glyphicons.pie_chart i:before { - content: "\e043"; -} -.glyphicons.group i:before { - content: "\e044"; -} -.glyphicons.keys i:before { - content: "\e045"; -} -.glyphicons.calendar i:before { - content: "\e046"; -} -.glyphicons.router i:before { - content: "\e047"; -} -.glyphicons.camera_small i:before { - content: "\e048"; -} -.glyphicons.dislikes i:before { - content: "\e049"; -} -.glyphicons.star i:before { - content: "\e050"; -} -.glyphicons.link i:before { - content: "\e051"; -} -.glyphicons.eye_open i:before { - content: "\e052"; -} -.glyphicons.eye_close i:before { - content: "\e053"; -} -.glyphicons.alarm i:before { - content: "\e054"; -} -.glyphicons.clock i:before { - content: "\e055"; -} -.glyphicons.stopwatch i:before { - content: "\e056"; -} -.glyphicons.projector i:before { - content: "\e057"; -} -.glyphicons.history i:before { - content: "\e058"; -} -.glyphicons.truck i:before { - content: "\e059"; -} -.glyphicons.cargo i:before { - content: "\e060"; -} -.glyphicons.compass i:before { - content: "\e061"; -} -.glyphicons.keynote i:before { - content: "\e062"; -} -.glyphicons.paperclip i:before { - content: "\e063"; -} -.glyphicons.power i:before { - content: "\e064"; -} -.glyphicons.lightbulb i:before { - content: "\e065"; -} -.glyphicons.tag i:before { - content: "\e066"; -} -.glyphicons.tags i:before { - content: "\e067"; -} -.glyphicons.cleaning i:before { - content: "\e068"; -} -.glyphicons.ruller i:before { - content: "\e069"; -} -.glyphicons.gift i:before { - content: "\e070"; -} -.glyphicons.umbrella i:before { - content: "\2602"; -} -.glyphicons.book i:before { - content: "\e072"; -} -.glyphicons.bookmark i:before { - content: "\e073"; -} -.glyphicons.wifi i:before { - content: "\e074"; -} -.glyphicons.cup i:before { - content: "\e075"; -} -.glyphicons.stroller i:before { - content: "\e076"; -} -.glyphicons.headphones i:before { - content: "\e077"; -} -.glyphicons.headset i:before { - content: "\e078"; -} -.glyphicons.warning_sign i:before { - content: "\e079"; -} -.glyphicons.signal i:before { - content: "\e080"; -} -.glyphicons.retweet i:before { - content: "\e081"; -} -.glyphicons.refresh i:before { - content: "\e082"; -} -.glyphicons.roundabout i:before { - content: "\e083"; -} -.glyphicons.random i:before { - content: "\e084"; -} -.glyphicons.heat i:before { - content: "\e085"; -} -.glyphicons.repeat i:before { - content: "\e086"; -} -.glyphicons.display i:before { - content: "\e087"; -} -.glyphicons.log_book i:before { - content: "\e088"; -} -.glyphicons.adress_book i:before { - content: "\e089"; -} -.glyphicons.building i:before { - content: "\e090"; -} -.glyphicons.eyedropper i:before { - content: "\e091"; -} -.glyphicons.adjust i:before { - content: "\e092"; -} -.glyphicons.tint i:before { - content: "\e093"; -} -.glyphicons.crop i:before { - content: "\e094"; -} -.glyphicons.vector_path_square i:before { - content: "\e095"; -} -.glyphicons.vector_path_circle i:before { - content: "\e096"; -} -.glyphicons.vector_path_polygon i:before { - content: "\e097"; -} -.glyphicons.vector_path_line i:before { - content: "\e098"; -} -.glyphicons.vector_path_curve i:before { - content: "\e099"; -} -.glyphicons.vector_path_all i:before { - content: "\e100"; -} -.glyphicons.font i:before { - content: "\e101"; -} -.glyphicons.italic i:before { - content: "\e102"; -} -.glyphicons.bold i:before { - content: "\e103"; -} -.glyphicons.text_underline i:before { - content: "\e104"; -} -.glyphicons.text_strike i:before { - content: "\e105"; -} -.glyphicons.text_height i:before { - content: "\e106"; -} -.glyphicons.text_width i:before { - content: "\e107"; -} -.glyphicons.text_resize i:before { - content: "\e108"; -} -.glyphicons.left_indent i:before { - content: "\e109"; -} -.glyphicons.right_indent i:before { - content: "\e110"; -} -.glyphicons.align_left i:before { - content: "\e111"; -} -.glyphicons.align_center i:before { - content: "\e112"; -} -.glyphicons.align_right i:before { - content: "\e113"; -} -.glyphicons.justify i:before { - content: "\e114"; -} -.glyphicons.list i:before { - content: "\e115"; -} -.glyphicons.text_smaller i:before { - content: "\e116"; -} -.glyphicons.text_bigger i:before { - content: "\e117"; -} -.glyphicons.embed i:before { - content: "\e118"; -} -.glyphicons.embed_close i:before { - content: "\e119"; -} -.glyphicons.table i:before { - content: "\e120"; -} -.glyphicons.message_full i:before { - content: "\e121"; -} -.glyphicons.message_empty i:before { - content: "\e122"; -} -.glyphicons.message_in i:before { - content: "\e123"; -} -.glyphicons.message_out i:before { - content: "\e124"; -} -.glyphicons.message_plus i:before { - content: "\e125"; -} -.glyphicons.message_minus i:before { - content: "\e126"; -} -.glyphicons.message_ban i:before { - content: "\e127"; -} -.glyphicons.message_flag i:before { - content: "\e128"; -} -.glyphicons.message_lock i:before { - content: "\e129"; -} -.glyphicons.message_new i:before { - content: "\e130"; -} -.glyphicons.inbox i:before { - content: "\e131"; -} -.glyphicons.inbox_plus i:before { - content: "\e132"; -} -.glyphicons.inbox_minus i:before { - content: "\e133"; -} -.glyphicons.inbox_lock i:before { - content: "\e134"; -} -.glyphicons.inbox_in i:before { - content: "\e135"; -} -.glyphicons.inbox_out i:before { - content: "\e136"; -} -.glyphicons.cogwheel i:before { - content: "\e137"; -} -.glyphicons.cogwheels i:before { - content: "\e138"; -} -.glyphicons.picture i:before { - content: "\e139"; -} -.glyphicons.adjust_alt i:before { - content: "\e140"; -} -.glyphicons.database_lock i:before { - content: "\e141"; -} -.glyphicons.database_plus i:before { - content: "\e142"; -} -.glyphicons.database_minus i:before { - content: "\e143"; -} -.glyphicons.database_ban i:before { - content: "\e144"; -} -.glyphicons.folder_open i:before { - content: "\e145"; -} -.glyphicons.folder_plus i:before { - content: "\e146"; -} -.glyphicons.folder_minus i:before { - content: "\e147"; -} -.glyphicons.folder_lock i:before { - content: "\e148"; -} -.glyphicons.folder_flag i:before { - content: "\e149"; -} -.glyphicons.folder_new i:before { - content: "\e150"; -} -.glyphicons.edit i:before { - content: "\e151"; -} -.glyphicons.new_window i:before { - content: "\e152"; -} -.glyphicons.check i:before { - content: "\e153"; -} -.glyphicons.unchecked i:before { - content: "\e154"; -} -.glyphicons.more_windows i:before { - content: "\e155"; -} -.glyphicons.show_big_thumbnails i:before { - content: "\e156"; -} -.glyphicons.show_thumbnails i:before { - content: "\e157"; -} -.glyphicons.show_thumbnails_with_lines i:before { - content: "\e158"; -} -.glyphicons.show_lines i:before { - content: "\e159"; -} -.glyphicons.playlist i:before { - content: "\e160"; -} -.glyphicons.imac i:before { - content: "\e161"; -} -.glyphicons.macbook i:before { - content: "\e162"; -} -.glyphicons.ipad i:before { - content: "\e163"; -} -.glyphicons.iphone i:before { - content: "\e164"; -} -.glyphicons.iphone_transfer i:before { - content: "\e165"; -} -.glyphicons.iphone_exchange i:before { - content: "\e166"; -} -.glyphicons.ipod i:before { - content: "\e167"; -} -.glyphicons.ipod_shuffle i:before { - content: "\e168"; -} -.glyphicons.ear_plugs i:before { - content: "\e169"; -} -.glyphicons.phone i:before { - content: "\e170"; -} -.glyphicons.step_backward i:before { - content: "\e171"; -} -.glyphicons.fast_backward i:before { - content: "\e172"; -} -.glyphicons.rewind i:before { - content: "\e173"; -} -.glyphicons.play i:before { - content: "\e174"; -} -.glyphicons.pause i:before { - content: "\e175"; -} -.glyphicons.stop i:before { - content: "\e176"; -} -.glyphicons.forward i:before { - content: "\e177"; -} -.glyphicons.fast_forward i:before { - content: "\e178"; -} -.glyphicons.step_forward i:before { - content: "\e179"; -} -.glyphicons.eject i:before { - content: "\e180"; -} -.glyphicons.facetime_video i:before { - content: "\e181"; -} -.glyphicons.download_alt i:before { - content: "\e182"; -} -.glyphicons.mute i:before { - content: "\e183"; -} -.glyphicons.volume_down i:before { - content: "\e184"; -} -.glyphicons.volume_up i:before { - content: "\e185"; -} -.glyphicons.screenshot i:before { - content: "\e186"; -} -.glyphicons.move i:before { - content: "\e187"; -} -.glyphicons.more i:before { - content: "\e188"; -} -.glyphicons.brightness_reduce i:before { - content: "\e189"; -} -.glyphicons.brightness_increase i:before { - content: "\e190"; -} -.glyphicons.circle_plus i:before { - content: "\e191"; -} -.glyphicons.circle_minus i:before { - content: "\e192"; -} -.glyphicons.circle_remove i:before { - content: "\e193"; -} -.glyphicons.circle_ok i:before { - content: "\e194"; -} -.glyphicons.circle_question_mark i:before { - content: "\e195"; -} -.glyphicons.circle_info i:before { - content: "\e196"; -} -.glyphicons.circle_exclamation_mark i:before { - content: "\e197"; -} -.glyphicons.remove i:before { - content: "\e198"; -} -.glyphicons.ok i:before { - content: "\e199"; -} -.glyphicons.ban i:before { - content: "\e200"; -} -.glyphicons.download i:before { - content: "\e201"; -} -.glyphicons.upload i:before { - content: "\e202"; -} -.glyphicons.shopping_cart i:before { - content: "\e203"; -} -.glyphicons.lock i:before { - content: "\e204"; -} -.glyphicons.unlock i:before { - content: "\e205"; -} -.glyphicons.electricity i:before { - content: "\e206"; -} -.glyphicons.ok_2 i:before { - content: "\e207"; -} -.glyphicons.remove_2 i:before { - content: "\e208"; -} -.glyphicons.cart_out i:before { - content: "\e209"; -} -.glyphicons.cart_in i:before { - content: "\e210"; -} -.glyphicons.left_arrow i:before { - content: "\e211"; -} -.glyphicons.right_arrow i:before { - content: "\e212"; -} -.glyphicons.down_arrow i:before { - content: "\e213"; -} -.glyphicons.up_arrow i:before { - content: "\e214"; -} -.glyphicons.resize_small i:before { - content: "\e215"; -} -.glyphicons.resize_full i:before { - content: "\e216"; -} -.glyphicons.circle_arrow_left i:before { - content: "\e217"; -} -.glyphicons.circle_arrow_right i:before { - content: "\e218"; -} -.glyphicons.circle_arrow_top i:before { - content: "\e219"; -} -.glyphicons.circle_arrow_down i:before { - content: "\e220"; -} -.glyphicons.play_button i:before { - content: "\e221"; -} -.glyphicons.unshare i:before { - content: "\e222"; -} -.glyphicons.share i:before { - content: "\e223"; -} -.glyphicons.chevron-right i:before { - content: "\e224"; -} -.glyphicons.chevron-left i:before { - content: "\e225"; -} -.glyphicons.bluetooth i:before { - content: "\e226"; -} -.glyphicons.euro i:before { - content: "\20AC"; -} -.glyphicons.usd i:before { - content: "\e228"; -} -.glyphicons.gbp i:before { - content: "\e229"; -} -.glyphicons.retweet_2 i:before { - content: "\e230"; -} -.glyphicons.moon i:before { - content: "\e231"; -} -.glyphicons.sun i:before { - content: "\2609"; -} -.glyphicons.cloud i:before { - content: "\2601"; -} -.glyphicons.direction i:before { - content: "\e234"; -} -.glyphicons.brush i:before { - content: "\e235"; -} -.glyphicons.pen i:before { - content: "\e236"; -} -.glyphicons.zoom_in i:before { - content: "\e237"; -} -.glyphicons.zoom_out i:before { - content: "\e238"; -} -.glyphicons.pin i:before { - content: "\e239"; -} -.glyphicons.albums i:before { - content: "\e240"; -} -.glyphicons.rotation_lock i:before { - content: "\e241"; -} -.glyphicons.flash i:before { - content: "\e242"; -} -.glyphicons.google_maps i:before { - content: "\e243"; -} -.glyphicons.anchor i:before { - content: "\2693"; -} -.glyphicons.conversation i:before { - content: "\e245"; -} -.glyphicons.chat i:before { - content: "\e246"; -} -.glyphicons.male i:before { - content: "\e247"; -} -.glyphicons.female i:before { - content: "\e248"; -} -.glyphicons.asterisk i:before { - content: "\002A"; -} -.glyphicons.divide i:before { - content: "\00F7"; -} -.glyphicons.snorkel_diving i:before { - content: "\e251"; -} -.glyphicons.scuba_diving i:before { - content: "\e252"; -} -.glyphicons.oxygen_bottle i:before { - content: "\e253"; -} -.glyphicons.fins i:before { - content: "\e254"; -} -.glyphicons.fishes i:before { - content: "\e255"; -} -.glyphicons.boat i:before { - content: "\e256"; -} -.glyphicons.delete i:before { - content: "\e257"; -} -.glyphicons.sheriffs_star i:before { - content: "\e258"; -} -.glyphicons.qrcode i:before { - content: "\e259"; -} -.glyphicons.barcode i:before { - content: "\e260"; -} -.glyphicons.pool i:before { - content: "\e261"; -} -.glyphicons.buoy i:before { - content: "\e262"; -} -.glyphicons.spade i:before { - content: "\e263"; -} -.glyphicons.bank i:before { - content: "\e264"; -} -.glyphicons.vcard i:before { - content: "\e265"; -} -.glyphicons.electrical_plug i:before { - content: "\e266"; -} -.glyphicons.flag i:before { - content: "\e267"; -} -.glyphicons.credit_card i:before { - content: "\e268"; -} -.glyphicons.keyboard-wireless i:before { - content: "\e269"; -} -.glyphicons.keyboard-wired i:before { - content: "\e270"; -} -.glyphicons.shield i:before { - content: "\e271"; -} -.glyphicons.ring i:before { - content: "\02DA"; -} -.glyphicons.cake i:before { - content: "\e273"; -} -.glyphicons.drink i:before { - content: "\e274"; -} -.glyphicons.beer i:before { - content: "\e275"; -} -.glyphicons.fast_food i:before { - content: "\e276"; -} -.glyphicons.cutlery i:before { - content: "\e277"; -} -.glyphicons.pizza i:before { - content: "\e278"; -} -.glyphicons.birthday_cake i:before { - content: "\e279"; -} -.glyphicons.tablet i:before { - content: "\e280"; -} -.glyphicons.settings i:before { - content: "\e281"; -} -.glyphicons.bullets i:before { - content: "\e282"; -} -.glyphicons.cardio i:before { - content: "\e283"; -} -.glyphicons.t-shirt i:before { - content: "\e284"; -} -.glyphicons.pants i:before { - content: "\e285"; -} -.glyphicons.sweater i:before { - content: "\e286"; -} -.glyphicons.fabric i:before { - content: "\e287"; -} -.glyphicons.leather i:before { - content: "\e288"; -} -.glyphicons.scissors i:before { - content: "\e289"; -} -.glyphicons.bomb i:before { - content: "\e290"; -} -.glyphicons.skull i:before { - content: "\e291"; -} -.glyphicons.celebration i:before { - content: "\e292"; -} -.glyphicons.tea_kettle i:before { - content: "\e293"; -} -.glyphicons.french_press i:before { - content: "\e294"; -} -.glyphicons.coffe_cup i:before { - content: "\e295"; -} -.glyphicons.pot i:before { - content: "\e296"; -} -.glyphicons.grater i:before { - content: "\e297"; -} -.glyphicons.kettle i:before { - content: "\e298"; -} -.glyphicons.hospital i:before { - content: "\e299"; -} -.glyphicons.hospital_h i:before { - content: "\e300"; -} -.glyphicons.microphone i:before { - content: "\e301"; -} -.glyphicons.webcam i:before { - content: "\e302"; -} -.glyphicons.temple_christianity_church i:before { - content: "\e303"; -} -.glyphicons.temple_islam i:before { - content: "\e304"; -} -.glyphicons.temple_hindu i:before { - content: "\e305"; -} -.glyphicons.temple_buddhist i:before { - content: "\e306"; -} -.glyphicons.bicycle i:before { - content: "\e307"; -} -.glyphicons.life_preserver i:before { - content: "\e308"; -} -.glyphicons.share_alt i:before { - content: "\e309"; -} -.glyphicons.comments i:before { - content: "\e310"; -} -.glyphicons.flower i:before { - content: "\2698"; -} -.glyphicons.baseball i:before { - content: "\e312"; -} -.glyphicons.rugby i:before { - content: "\e313"; -} -.glyphicons.ax i:before { - content: "\e314"; -} -.glyphicons.table_tennis i:before { - content: "\e315"; -} -.glyphicons.bowling i:before { - content: "\e316"; -} -.glyphicons.tree_conifer i:before { - content: "\e317"; -} -.glyphicons.tree_deciduous i:before { - content: "\e318"; -} -.glyphicons.more_items i:before { - content: "\e319"; -} -.glyphicons.sort i:before { - content: "\e320"; -} -.glyphicons.filter i:before { - content: "\e321"; -} -.glyphicons.gamepad i:before { - content: "\e322"; -} -.glyphicons.playing_dices i:before { - content: "\e323"; -} -.glyphicons.calculator i:before { - content: "\e324"; -} -.glyphicons.tie i:before { - content: "\e325"; -} -.glyphicons.wallet i:before { - content: "\e326"; -} -.glyphicons.piano i:before { - content: "\e327"; -} -.glyphicons.sampler i:before { - content: "\e328"; -} -.glyphicons.podium i:before { - content: "\e329"; -} -.glyphicons.soccer_ball i:before { - content: "\e330"; -} -.glyphicons.blog i:before { - content: "\e331"; -} -.glyphicons.dashboard i:before { - content: "\e332"; -} -.glyphicons.certificate i:before { - content: "\e333"; -} -.glyphicons.bell i:before { - content: "\e334"; -} -.glyphicons.candle i:before { - content: "\e335"; -} -.glyphicons.pushpin i:before { - content: "\e336"; -} -.glyphicons.iphone_shake i:before { - content: "\e337"; -} -.glyphicons.pin_flag i:before { - content: "\e338"; -} -.glyphicons.turtle i:before { - content: "\e339"; -} -.glyphicons.rabbit i:before { - content: "\e340"; -} -.glyphicons.globe i:before { - content: "\e341"; -} -.glyphicons.briefcase i:before { - content: "\e342"; -} -.glyphicons.hdd i:before { - content: "\e343"; -} -.glyphicons.thumbs_up i:before { - content: "\e344"; -} -.glyphicons.thumbs_down i:before { - content: "\e345"; -} -.glyphicons.hand_right i:before { - content: "\e346"; -} -.glyphicons.hand_left i:before { - content: "\e347"; -} -.glyphicons.hand_up i:before { - content: "\e348"; -} -.glyphicons.hand_down i:before { - content: "\e349"; -} -.glyphicons.fullscreen i:before { - content: "\e350"; -} -.glyphicons.shopping_bag i:before { - content: "\e351"; -} -.glyphicons.book_open i:before { - content: "\e352"; -} -.glyphicons.nameplate i:before { - content: "\e353"; -} -.glyphicons.nameplate_alt i:before { - content: "\e354"; -} -.glyphicons.vases i:before { - content: "\e355"; -} -.glyphicons.bullhorn i:before { - content: "\e356"; -} -.glyphicons.dumbbell i:before { - content: "\e357"; -} -.glyphicons.suitcase i:before { - content: "\e358"; -} -.glyphicons.file_import i:before { - content: "\e359"; -} -.glyphicons.file_export i:before { - content: "\e360"; -} -.glyphicons.bug i:before { - content: "\e361"; -} -.glyphicons.crown i:before { - content: "\e362"; -} -.glyphicons.smoking i:before { - content: "\e363"; -} -.glyphicons.cloud-upload i:before { - content: "\e364"; -} -.glyphicons.cloud-download i:before { - content: "\e365"; -} -.glyphicons.restart i:before { - content: "\e366"; -} -.glyphicons.security_camera i:before { - content: "\e367"; -} -.glyphicons.expand i:before { - content: "\e368"; -} -.glyphicons.collapse i:before { - content: "\e369"; -} -.glyphicons.collapse_top i:before { - content: "\e370"; -} -.glyphicons.globe_af i:before { - content: "\e371"; -} -.glyphicons.global i:before { - content: "\e372"; -} -.glyphicons.spray i:before { - content: "\e373"; -} -.glyphicons.nails i:before { - content: "\e374"; -} -.glyphicons.claw_hammer i:before { - content: "\e375"; -} -.glyphicons.classic_hammer i:before { - content: "\e376"; -} -.glyphicons.hand_saw i:before { - content: "\e377"; -} -.glyphicons.riflescope i:before { - content: "\e378"; -} -.glyphicons.electrical_socket_eu i:before { - content: "\e379"; -} -.glyphicons.electrical_socket_us i:before { - content: "\e380"; -} -.glyphicons.pinterest i:before { - content: "\e381"; -} -.glyphicons.dropbox i:before { - content: "\e382"; -} -.glyphicons.google_plus i:before { - content: "\e383"; -} -.glyphicons.jolicloud i:before { - content: "\e384"; -} -.glyphicons.yahoo i:before { - content: "\e385"; -} -.glyphicons.blogger i:before { - content: "\e386"; -} -.glyphicons.picasa i:before { - content: "\e387"; -} -.glyphicons.amazon i:before { - content: "\e388"; -} -.glyphicons.tumblr i:before { - content: "\e389"; -} -.glyphicons.wordpress i:before { - content: "\e390"; -} -.glyphicons.instapaper i:before { - content: "\e391"; -} -.glyphicons.evernote i:before { - content: "\e392"; -} -.glyphicons.xing i:before { - content: "\e393"; -} -.glyphicons.zootool i:before { - content: "\e394"; -} -.glyphicons.dribbble i:before { - content: "\e395"; -} -.glyphicons.deviantart i:before { - content: "\e396"; -} -.glyphicons.read_it_later i:before { - content: "\e397"; -} -.glyphicons.linked_in i:before { - content: "\e398"; -} -.glyphicons.forrst i:before { - content: "\e399"; -} -.glyphicons.pinboard i:before { - content: "\e400"; -} -.glyphicons.behance i:before { - content: "\e401"; -} -.glyphicons.github i:before { - content: "\e402"; -} -.glyphicons.youtube i:before { - content: "\e403"; -} -.glyphicons.skitch i:before { - content: "\e404"; -} -.glyphicons.foursquare i:before { - content: "\e405"; -} -.glyphicons.quora i:before { - content: "\e406"; -} -.glyphicons.badoo i:before { - content: "\e407"; -} -.glyphicons.spotify i:before { - content: "\e408"; -} -.glyphicons.stumbleupon i:before { - content: "\e409"; -} -.glyphicons.readability i:before { - content: "\e410"; -} -.glyphicons.facebook i:before { - content: "\e411"; -} -.glyphicons.twitter i:before { - content: "\e412"; -} -.glyphicons.instagram i:before { - content: "\e413"; -} -.glyphicons.posterous_spaces i:before { - content: "\e414"; -} -.glyphicons.vimeo i:before { - content: "\e415"; -} -.glyphicons.flickr i:before { - content: "\e416"; -} -.glyphicons.last_fm i:before { - content: "\e417"; -} -.glyphicons.rss i:before { - content: "\e418"; -} -.glyphicons.skype i:before { - content: "\e419"; -} -.glyphicons.e-mail i:before { - content: "\e420"; -} -.glyphicons-icon { - display: inline-block; - width: 48px; - height: 48px; - line-height: 48px; - vertical-align: text-top; - background-image: url(../../img/glyphicons/glyphicons.png); - background-position: 0 0; - background-repeat: no-repeat; - vertical-align: top; - *display: inline; - *zoom: 1; - *margin-right: .3em; -} -.no-inlinesvg .glyphicons-icon { - background-image: url(../../img/glyphicons/glyphicons.png); -} -.glyphicons-icon.white { - background-image: url(../../img/glyphicons/glyphicons-white.svg); -} -.no-inlinesvg .glyphicons-icon.white { - background-image: url(../../img/glyphicons/glyphicons-white.png); -} -.glyphicons-icon.glass { - background-position: 4px 11px; -} -.glyphicons-icon.leaf { - background-position: -44px 11px; -} -.glyphicons-icon.dog { - background-position: -92px 11px; -} -.glyphicons-icon.user { - background-position: -140px 11px; -} -.glyphicons-icon.girl { - background-position: -188px 11px; -} -.glyphicons-icon.car { - background-position: -236px 11px; -} -.glyphicons-icon.user_add { - background-position: -284px 11px; -} -.glyphicons-icon.user_remove { - background-position: -332px 11px; -} -.glyphicons-icon.film { - background-position: -380px 11px; -} -.glyphicons-icon.magic { - background-position: -428px 11px; -} -.glyphicons-icon.envelope { - background-position: 4px -37px; -} -.glyphicons-icon.camera { - background-position: -44px -37px; -} -.glyphicons-icon.heart { - background-position: -92px -37px; -} -.glyphicons-icon.beach_umbrella { - background-position: -140px -37px; -} -.glyphicons-icon.train { - background-position: -188px -37px; -} -.glyphicons-icon.print { - background-position: -236px -37px; -} -.glyphicons-icon.bin { - background-position: -284px -37px; -} -.glyphicons-icon.music { - background-position: -332px -37px; -} -.glyphicons-icon.note { - background-position: -380px -37px; -} -.glyphicons-icon.heart_empty { - background-position: -428px -37px; -} -.glyphicons-icon.home { - background-position: 4px -85px; -} -.glyphicons-icon.snowflake { - background-position: -44px -85px; -} -.glyphicons-icon.fire { - background-position: -92px -85px; -} -.glyphicons-icon.magnet { - background-position: -140px -85px; -} -.glyphicons-icon.parents { - background-position: -188px -85px; -} -.glyphicons-icon.binoculars { - background-position: -236px -85px; -} -.glyphicons-icon.road { - background-position: -284px -85px; -} -.glyphicons-icon.search { - background-position: -332px -85px; -} -.glyphicons-icon.cars { - background-position: -380px -85px; -} -.glyphicons-icon.notes_2 { - background-position: -428px -85px; -} -.glyphicons-icon.pencil { - background-position: 4px -133px; -} -.glyphicons-icon.bus { - background-position: -44px -133px; -} -.glyphicons-icon.wifi_alt { - background-position: -92px -133px; -} -.glyphicons-icon.luggage { - background-position: -140px -133px; -} -.glyphicons-icon.old_man { - background-position: -188px -133px; -} -.glyphicons-icon.woman { - background-position: -236px -133px; -} -.glyphicons-icon.file { - background-position: -284px -133px; -} -.glyphicons-icon.coins { - background-position: -332px -133px; -} -.glyphicons-icon.airplane { - background-position: -380px -133px; -} -.glyphicons-icon.notes { - background-position: -428px -133px; -} -.glyphicons-icon.stats { - background-position: 4px -181px; -} -.glyphicons-icon.charts { - background-position: -44px -181px; -} -.glyphicons-icon.pie_chart { - background-position: -92px -181px; -} -.glyphicons-icon.group { - background-position: -140px -181px; -} -.glyphicons-icon.keys { - background-position: -188px -181px; -} -.glyphicons-icon.calendar { - background-position: -236px -181px; -} -.glyphicons-icon.router { - background-position: -284px -181px; -} -.glyphicons-icon.camera_small { - background-position: -332px -181px; -} -.glyphicons-icon.dislikes { - background-position: -380px -181px; -} -.glyphicons-icon.star { - background-position: -428px -181px; -} -.glyphicons-icon.link { - background-position: 4px -229px; -} -.glyphicons-icon.eye_open { - background-position: -44px -229px; -} -.glyphicons-icon.eye_close { - background-position: -92px -229px; -} -.glyphicons-icon.alarm { - background-position: -140px -229px; -} -.glyphicons-icon.clock { - background-position: -188px -229px; -} -.glyphicons-icon.stopwatch { - background-position: -236px -229px; -} -.glyphicons-icon.projector { - background-position: -284px -229px; -} -.glyphicons-icon.history { - background-position: -332px -229px; -} -.glyphicons-icon.truck { - background-position: -380px -229px; -} -.glyphicons-icon.cargo { - background-position: -428px -229px; -} -.glyphicons-icon.compass { - background-position: 4px -277px; -} -.glyphicons-icon.keynote { - background-position: -44px -277px; -} -.glyphicons-icon.paperclip { - background-position: -92px -277px; -} -.glyphicons-icon.power { - background-position: -140px -277px; -} -.glyphicons-icon.lightbulb { - background-position: -188px -277px; -} -.glyphicons-icon.tag { - background-position: -236px -277px; -} -.glyphicons-icon.tags { - background-position: -284px -277px; -} -.glyphicons-icon.cleaning { - background-position: -332px -277px; -} -.glyphicons-icon.ruller { - background-position: -380px -277px; -} -.glyphicons-icon.gift { - background-position: -428px -277px; -} -.glyphicons-icon.umbrella { - background-position: 4px -325px; -} -.glyphicons-icon.book { - background-position: -44px -325px; -} -.glyphicons-icon.bookmark { - background-position: -92px -325px; -} -.glyphicons-icon.wifi { - background-position: -140px -325px; -} -.glyphicons-icon.cup { - background-position: -188px -325px; -} -.glyphicons-icon.stroller { - background-position: -236px -325px; -} -.glyphicons-icon.headphones { - background-position: -284px -325px; -} -.glyphicons-icon.headset { - background-position: -332px -325px; -} -.glyphicons-icon.warning_sign { - background-position: -380px -325px; -} -.glyphicons-icon.signal { - background-position: -428px -325px; -} -.glyphicons-icon.retweet { - background-position: 4px -373px; -} -.glyphicons-icon.refresh { - background-position: -44px -373px; -} -.glyphicons-icon.roundabout { - background-position: -92px -373px; -} -.glyphicons-icon.random { - background-position: -140px -373px; -} -.glyphicons-icon.heat { - background-position: -188px -373px; -} -.glyphicons-icon.repeat { - background-position: -236px -373px; -} -.glyphicons-icon.display { - background-position: -284px -373px; -} -.glyphicons-icon.log_book { - background-position: -332px -373px; -} -.glyphicons-icon.adress_book { - background-position: -380px -373px; -} -.glyphicons-icon.building { - background-position: -428px -373px; -} -.glyphicons-icon.eyedropper { - background-position: 4px -421px; -} -.glyphicons-icon.adjust { - background-position: -44px -421px; -} -.glyphicons-icon.tint { - background-position: -92px -421px; -} -.glyphicons-icon.crop { - background-position: -140px -421px; -} -.glyphicons-icon.vector_path_square { - background-position: -188px -421px; -} -.glyphicons-icon.vector_path_circle { - background-position: -236px -421px; -} -.glyphicons-icon.vector_path_polygon { - background-position: -284px -421px; -} -.glyphicons-icon.vector_path_line { - background-position: -332px -421px; -} -.glyphicons-icon.vector_path_curve { - background-position: -380px -421px; -} -.glyphicons-icon.vector_path_all { - background-position: -428px -421px; -} -.glyphicons-icon.font { - background-position: 4px -469px; -} -.glyphicons-icon.italic { - background-position: -44px -469px; -} -.glyphicons-icon.bold { - background-position: -92px -469px; -} -.glyphicons-icon.text_underline { - background-position: -140px -469px; -} -.glyphicons-icon.text_strike { - background-position: -188px -469px; -} -.glyphicons-icon.text_height { - background-position: -236px -469px; -} -.glyphicons-icon.text_width { - background-position: -284px -469px; -} -.glyphicons-icon.text_resize { - background-position: -332px -469px; -} -.glyphicons-icon.left_indent { - background-position: -380px -469px; -} -.glyphicons-icon.right_indent { - background-position: -428px -469px; -} -.glyphicons-icon.align_left { - background-position: 4px -517px; -} -.glyphicons-icon.align_center { - background-position: -44px -517px; -} -.glyphicons-icon.align_right { - background-position: -92px -517px; -} -.glyphicons-icon.justify { - background-position: -140px -517px; -} -.glyphicons-icon.list { - background-position: -188px -517px; -} -.glyphicons-icon.text_smaller { - background-position: -236px -517px; -} -.glyphicons-icon.text_bigger { - background-position: -284px -517px; -} -.glyphicons-icon.embed { - background-position: -332px -517px; -} -.glyphicons-icon.embed_close { - background-position: -380px -517px; -} -.glyphicons-icon.table { - background-position: -428px -517px; -} -.glyphicons-icon.message_full { - background-position: 4px -565px; -} -.glyphicons-icon.message_empty { - background-position: -44px -565px; -} -.glyphicons-icon.message_in { - background-position: -92px -565px; -} -.glyphicons-icon.message_out { - background-position: -140px -565px; -} -.glyphicons-icon.message_plus { - background-position: -188px -565px; -} -.glyphicons-icon.message_minus { - background-position: -236px -565px; -} -.glyphicons-icon.message_ban { - background-position: -284px -565px; -} -.glyphicons-icon.message_flag { - background-position: -332px -565px; -} -.glyphicons-icon.message_lock { - background-position: -380px -565px; -} -.glyphicons-icon.message_new { - background-position: -428px -565px; -} -.glyphicons-icon.inbox { - background-position: 4px -613px; -} -.glyphicons-icon.inbox_plus { - background-position: -44px -613px; -} -.glyphicons-icon.inbox_minus { - background-position: -92px -613px; -} -.glyphicons-icon.inbox_lock { - background-position: -140px -613px; -} -.glyphicons-icon.inbox_in { - background-position: -188px -613px; -} -.glyphicons-icon.inbox_out { - background-position: -236px -613px; -} -.glyphicons-icon.cogwheel { - background-position: -284px -613px; -} -.glyphicons-icon.cogwheels { - background-position: -332px -613px; -} -.glyphicons-icon.picture { - background-position: -380px -613px; -} -.glyphicons-icon.adjust_alt { - background-position: -428px -613px; -} -.glyphicons-icon.database_lock { - background-position: 4px -661px; -} -.glyphicons-icon.database_plus { - background-position: -44px -661px; -} -.glyphicons-icon.database_minus { - background-position: -92px -661px; -} -.glyphicons-icon.database_ban { - background-position: -140px -661px; -} -.glyphicons-icon.folder_open { - background-position: -188px -661px; -} -.glyphicons-icon.folder_plus { - background-position: -236px -661px; -} -.glyphicons-icon.folder_minus { - background-position: -284px -661px; -} -.glyphicons-icon.folder_lock { - background-position: -332px -661px; -} -.glyphicons-icon.folder_flag { - background-position: -380px -661px; -} -.glyphicons-icon.folder_new { - background-position: -428px -661px; -} -.glyphicons-icon.edit { - background-position: 4px -709px; -} -.glyphicons-icon.new_window { - background-position: -44px -709px; -} -.glyphicons-icon.check { - background-position: -92px -709px; -} -.glyphicons-icon.unchecked { - background-position: -140px -709px; -} -.glyphicons-icon.more_windows { - background-position: -188px -709px; -} -.glyphicons-icon.show_big_thumbnails { - background-position: -236px -709px; -} -.glyphicons-icon.show_thumbnails { - background-position: -284px -709px; -} -.glyphicons-icon.show_thumbnails_with_lines { - background-position: -332px -709px; -} -.glyphicons-icon.show_lines { - background-position: -380px -709px; -} -.glyphicons-icon.playlist { - background-position: -428px -709px; -} -.glyphicons-icon.imac { - background-position: 4px -757px; -} -.glyphicons-icon.macbook { - background-position: -44px -757px; -} -.glyphicons-icon.ipad { - background-position: -92px -757px; -} -.glyphicons-icon.iphone { - background-position: -140px -757px; -} -.glyphicons-icon.iphone_transfer { - background-position: -188px -757px; -} -.glyphicons-icon.iphone_exchange { - background-position: -236px -757px; -} -.glyphicons-icon.ipod { - background-position: -284px -757px; -} -.glyphicons-icon.ipod_shuffle { - background-position: -332px -757px; -} -.glyphicons-icon.ear_plugs { - background-position: -380px -757px; -} -.glyphicons-icon.phone { - background-position: -428px -757px; -} -.glyphicons-icon.step_backward { - background-position: 4px -805px; -} -.glyphicons-icon.fast_backward { - background-position: -44px -805px; -} -.glyphicons-icon.rewind { - background-position: -92px -805px; -} -.glyphicons-icon.play { - background-position: -140px -805px; -} -.glyphicons-icon.pause { - background-position: -188px -805px; -} -.glyphicons-icon.stop { - background-position: -236px -805px; -} -.glyphicons-icon.forward { - background-position: -284px -805px; -} -.glyphicons-icon.fast_forward { - background-position: -332px -805px; -} -.glyphicons-icon.step_forward { - background-position: -380px -805px; -} -.glyphicons-icon.eject { - background-position: -428px -805px; -} -.glyphicons-icon.facetime_video { - background-position: 4px -853px; -} -.glyphicons-icon.download_alt { - background-position: -44px -853px; -} -.glyphicons-icon.mute { - background-position: -92px -853px; -} -.glyphicons-icon.volume_down { - background-position: -140px -853px; -} -.glyphicons-icon.volume_up { - background-position: -188px -853px; -} -.glyphicons-icon.screenshot { - background-position: -236px -853px; -} -.glyphicons-icon.move { - background-position: -284px -853px; -} -.glyphicons-icon.more { - background-position: -332px -853px; -} -.glyphicons-icon.brightness_reduce { - background-position: -380px -853px; -} -.glyphicons-icon.brightness_increase { - background-position: -428px -853px; -} -.glyphicons-icon.circle_plus { - background-position: 4px -901px; -} -.glyphicons-icon.circle_minus { - background-position: -44px -901px; -} -.glyphicons-icon.circle_remove { - background-position: -92px -901px; -} -.glyphicons-icon.circle_ok { - background-position: -140px -901px; -} -.glyphicons-icon.circle_question_mark { - background-position: -188px -901px; -} -.glyphicons-icon.circle_info { - background-position: -236px -901px; -} -.glyphicons-icon.circle_exclamation_mark { - background-position: -284px -901px; -} -.glyphicons-icon.remove { - background-position: -332px -901px; -} -.glyphicons-icon.ok { - background-position: -380px -901px; -} -.glyphicons-icon.ban { - background-position: -428px -901px; -} -.glyphicons-icon.download { - background-position: 4px -949px; -} -.glyphicons-icon.upload { - background-position: -44px -949px; -} -.glyphicons-icon.shopping_cart { - background-position: -92px -949px; -} -.glyphicons-icon.lock { - background-position: -140px -949px; -} -.glyphicons-icon.unlock { - background-position: -188px -949px; -} -.glyphicons-icon.electricity { - background-position: -236px -949px; -} -.glyphicons-icon.ok_2 { - background-position: -284px -949px; -} -.glyphicons-icon.remove_2 { - background-position: -332px -949px; -} -.glyphicons-icon.cart_out { - background-position: -380px -949px; -} -.glyphicons-icon.cart_in { - background-position: -428px -949px; -} -.glyphicons-icon.left_arrow { - background-position: 4px -997px; -} -.glyphicons-icon.right_arrow { - background-position: -44px -997px; -} -.glyphicons-icon.down_arrow { - background-position: -92px -997px; -} -.glyphicons-icon.up_arrow { - background-position: -140px -997px; -} -.glyphicons-icon.resize_small { - background-position: -188px -997px; -} -.glyphicons-icon.resize_full { - background-position: -236px -997px; -} -.glyphicons-icon.circle_arrow_left { - background-position: -284px -997px; -} -.glyphicons-icon.circle_arrow_right { - background-position: -332px -997px; -} -.glyphicons-icon.circle_arrow_top { - background-position: -380px -997px; -} -.glyphicons-icon.circle_arrow_down { - background-position: -428px -997px; -} -.glyphicons-icon.play_button { - background-position: 4px -1045px; -} -.glyphicons-icon.unshare { - background-position: -44px -1045px; -} -.glyphicons-icon.share { - background-position: -92px -1045px; -} -.glyphicons-icon.chevron-right { - background-position: -140px -1045px; -} -.glyphicons-icon.chevron-left { - background-position: -188px -1045px; -} -.glyphicons-icon.bluetooth { - background-position: -236px -1045px; -} -.glyphicons-icon.euro { - background-position: -284px -1045px; -} -.glyphicons-icon.usd { - background-position: -332px -1045px; -} -.glyphicons-icon.gbp { - background-position: -380px -1045px; -} -.glyphicons-icon.retweet_2 { - background-position: -428px -1045px; -} -.glyphicons-icon.moon { - background-position: 4px -1093px; -} -.glyphicons-icon.sun { - background-position: -44px -1093px; -} -.glyphicons-icon.cloud { - background-position: -92px -1093px; -} -.glyphicons-icon.direction { - background-position: -140px -1093px; -} -.glyphicons-icon.brush { - background-position: -188px -1093px; -} -.glyphicons-icon.pen { - background-position: -236px -1093px; -} -.glyphicons-icon.zoom_in { - background-position: -284px -1093px; -} -.glyphicons-icon.zoom_out { - background-position: -332px -1093px; -} -.glyphicons-icon.pin { - background-position: -380px -1093px; -} -.glyphicons-icon.albums { - background-position: -428px -1093px; -} -.glyphicons-icon.rotation_lock { - background-position: 4px -1141px; -} -.glyphicons-icon.flash { - background-position: -44px -1141px; -} -.glyphicons-icon.google_maps { - background-position: -92px -1141px; -} -.glyphicons-icon.anchor { - background-position: -140px -1141px; -} -.glyphicons-icon.conversation { - background-position: -188px -1141px; -} -.glyphicons-icon.chat { - background-position: -236px -1141px; -} -.glyphicons-icon.male { - background-position: -284px -1141px; -} -.glyphicons-icon.female { - background-position: -332px -1141px; -} -.glyphicons-icon.asterisk { - background-position: -380px -1141px; -} -.glyphicons-icon.divide { - background-position: -428px -1141px; -} -.glyphicons-icon.snorkel_diving { - background-position: 4px -1189px; -} -.glyphicons-icon.scuba_diving { - background-position: -44px -1189px; -} -.glyphicons-icon.oxygen_bottle { - background-position: -92px -1189px; -} -.glyphicons-icon.fins { - background-position: -140px -1189px; -} -.glyphicons-icon.fishes { - background-position: -188px -1189px; -} -.glyphicons-icon.boat { - background-position: -236px -1189px; -} -.glyphicons-icon.delete { - background-position: -284px -1189px; -} -.glyphicons-icon.sheriffs_star { - background-position: -332px -1189px; -} -.glyphicons-icon.qrcode { - background-position: -380px -1189px; -} -.glyphicons-icon.barcode { - background-position: -428px -1189px; -} -.glyphicons-icon.pool { - background-position: 4px -1237px; -} -.glyphicons-icon.buoy { - background-position: -44px -1237px; -} -.glyphicons-icon.spade { - background-position: -92px -1237px; -} -.glyphicons-icon.bank { - background-position: -140px -1237px; -} -.glyphicons-icon.vcard { - background-position: -188px -1237px; -} -.glyphicons-icon.electrical_plug { - background-position: -236px -1237px; -} -.glyphicons-icon.flag { - background-position: -284px -1237px; -} -.glyphicons-icon.credit_card { - background-position: -332px -1237px; -} -.glyphicons-icon.keyboard-wireless { - background-position: -380px -1237px; -} -.glyphicons-icon.keyboard-wired { - background-position: -428px -1237px; -} -.glyphicons-icon.shield { - background-position: 4px -1285px; -} -.glyphicons-icon.ring { - background-position: -44px -1285px; -} -.glyphicons-icon.cake { - background-position: -92px -1285px; -} -.glyphicons-icon.drink { - background-position: -140px -1285px; -} -.glyphicons-icon.beer { - background-position: -188px -1285px; -} -.glyphicons-icon.fast_food { - background-position: -236px -1285px; -} -.glyphicons-icon.cutlery { - background-position: -284px -1285px; -} -.glyphicons-icon.pizza { - background-position: -332px -1285px; -} -.glyphicons-icon.birthday_cake { - background-position: -380px -1285px; -} -.glyphicons-icon.tablet { - background-position: -428px -1285px; -} -.glyphicons-icon.settings { - background-position: 4px -1333px; -} -.glyphicons-icon.bullets { - background-position: -44px -1333px; -} -.glyphicons-icon.cardio { - background-position: -92px -1333px; -} -.glyphicons-icon.t-shirt { - background-position: -140px -1333px; -} -.glyphicons-icon.pants { - background-position: -188px -1333px; -} -.glyphicons-icon.sweater { - background-position: -236px -1333px; -} -.glyphicons-icon.fabric { - background-position: -284px -1333px; -} -.glyphicons-icon.leather { - background-position: -332px -1333px; -} -.glyphicons-icon.scissors { - background-position: -380px -1333px; -} -.glyphicons-icon.bomb { - background-position: -428px -1333px; -} -.glyphicons-icon.skull { - background-position: 4px -1381px; -} -.glyphicons-icon.celebration { - background-position: -44px -1381px; -} -.glyphicons-icon.tea_kettle { - background-position: -92px -1381px; -} -.glyphicons-icon.french_press { - background-position: -140px -1381px; -} -.glyphicons-icon.coffe_cup { - background-position: -188px -1381px; -} -.glyphicons-icon.pot { - background-position: -236px -1381px; -} -.glyphicons-icon.grater { - background-position: -284px -1381px; -} -.glyphicons-icon.kettle { - background-position: -332px -1381px; -} -.glyphicons-icon.hospital { - background-position: -380px -1381px; -} -.glyphicons-icon.hospital_h { - background-position: -428px -1381px; -} -.glyphicons-icon.microphone { - background-position: 4px -1429px; -} -.glyphicons-icon.webcam { - background-position: -44px -1429px; -} -.glyphicons-icon.temple_christianity_church { - background-position: -92px -1429px; -} -.glyphicons-icon.temple_islam { - background-position: -140px -1429px; -} -.glyphicons-icon.temple_hindu { - background-position: -188px -1429px; -} -.glyphicons-icon.temple_buddhist { - background-position: -236px -1429px; -} -.glyphicons-icon.bicycle { - background-position: -284px -1429px; -} -.glyphicons-icon.life_preserver { - background-position: -332px -1429px; -} -.glyphicons-icon.share_alt { - background-position: -380px -1429px; -} -.glyphicons-icon.comments { - background-position: -428px -1429px; -} -.glyphicons-icon.flower { - background-position: 4px -1477px; -} -.glyphicons-icon.baseball { - background-position: -44px -1477px; -} -.glyphicons-icon.rugby { - background-position: -92px -1477px; -} -.glyphicons-icon.ax { - background-position: -140px -1477px; -} -.glyphicons-icon.table_tennis { - background-position: -188px -1477px; -} -.glyphicons-icon.bowling { - background-position: -236px -1477px; -} -.glyphicons-icon.tree_conifer { - background-position: -284px -1477px; -} -.glyphicons-icon.tree_deciduous { - background-position: -332px -1477px; -} -.glyphicons-icon.more_items { - background-position: -380px -1477px; -} -.glyphicons-icon.sort { - background-position: -428px -1477px; -} -.glyphicons-icon.filter { - background-position: 4px -1525px; -} -.glyphicons-icon.gamepad { - background-position: -44px -1525px; -} -.glyphicons-icon.playing_dices { - background-position: -92px -1525px; -} -.glyphicons-icon.calculator { - background-position: -140px -1525px; -} -.glyphicons-icon.tie { - background-position: -188px -1525px; -} -.glyphicons-icon.wallet { - background-position: -236px -1525px; -} -.glyphicons-icon.piano { - background-position: -284px -1525px; -} -.glyphicons-icon.sampler { - background-position: -332px -1525px; -} -.glyphicons-icon.podium { - background-position: -380px -1525px; -} -.glyphicons-icon.soccer_ball { - background-position: -428px -1525px; -} -.glyphicons-icon.blog { - background-position: 4px -1573px; -} -.glyphicons-icon.dashboard { - background-position: -44px -1573px; -} -.glyphicons-icon.certificate { - background-position: -92px -1573px; -} -.glyphicons-icon.bell { - background-position: -140px -1573px; -} -.glyphicons-icon.candle { - background-position: -188px -1573px; -} -.glyphicons-icon.pushpin { - background-position: -236px -1573px; -} -.glyphicons-icon.iphone_shake { - background-position: -284px -1573px; -} -.glyphicons-icon.pin_flag { - background-position: -332px -1573px; -} -.glyphicons-icon.turtle { - background-position: -380px -1573px; -} -.glyphicons-icon.rabbit { - background-position: -428px -1573px; -} -.glyphicons-icon.globe { - background-position: 4px -1621px; -} -.glyphicons-icon.briefcase { - background-position: -44px -1621px; -} -.glyphicons-icon.hdd { - background-position: -92px -1621px; -} -.glyphicons-icon.thumbs_up { - background-position: -140px -1621px; -} -.glyphicons-icon.thumbs_down { - background-position: -188px -1621px; -} -.glyphicons-icon.hand_right { - background-position: -236px -1621px; -} -.glyphicons-icon.hand_left { - background-position: -284px -1621px; -} -.glyphicons-icon.hand_up { - background-position: -332px -1621px; -} -.glyphicons-icon.hand_down { - background-position: -380px -1621px; -} -.glyphicons-icon.fullscreen { - background-position: -428px -1621px; -} -.glyphicons-icon.shopping_bag { - background-position: 4px -1669px; -} -.glyphicons-icon.book_open { - background-position: -44px -1669px; -} -.glyphicons-icon.nameplate { - background-position: -92px -1669px; -} -.glyphicons-icon.nameplate_alt { - background-position: -140px -1669px; -} -.glyphicons-icon.vases { - background-position: -188px -1669px; -} -.glyphicons-icon.bullhorn { - background-position: -236px -1669px; -} -.glyphicons-icon.dumbbell { - background-position: -284px -1669px; -} -.glyphicons-icon.suitcase { - background-position: -332px -1669px; -} -.glyphicons-icon.file_import { - background-position: -380px -1669px; -} -.glyphicons-icon.file_export { - background-position: -428px -1669px; -} -.glyphicons-icon.bug { - background-position: 4px -1717px; -} -.glyphicons-icon.crown { - background-position: -44px -1717px; -} -.glyphicons-icon.smoking { - background-position: -92px -1717px; -} -.glyphicons-icon.cloud-upload { - background-position: -140px -1717px; -} -.glyphicons-icon.cloud-download { - background-position: -188px -1717px; -} -.glyphicons-icon.restart { - background-position: -236px -1717px; -} -.glyphicons-icon.security_camera { - background-position: -284px -1717px; -} -.glyphicons-icon.expand { - background-position: -332px -1717px; -} -.glyphicons-icon.collapse { - background-position: -380px -1717px; -} -.glyphicons-icon.collapse_top { - background-position: -428px -1717px; -} -.glyphicons-icon.globe_af { - background-position: 4px -1765px; -} -.glyphicons-icon.global { - background-position: -44px -1765px; -} -.glyphicons-icon.spray { - background-position: -92px -1765px; -} -.glyphicons-icon.nails { - background-position: -140px -1765px; -} -.glyphicons-icon.claw_hammer { - background-position: -188px -1765px; -} -.glyphicons-icon.classic_hammer { - background-position: -236px -1765px; -} -.glyphicons-icon.hand_saw { - background-position: -284px -1765px; -} -.glyphicons-icon.riflescope { - background-position: -332px -1765px; -} -.glyphicons-icon.electrical_socket_eu { - background-position: -380px -1765px; -} -.glyphicons-icon.electrical_socket_us { - background-position: -428px -1765px; -} -.glyphicons-icon.pinterest { - background-position: 4px -1813px; -} -.glyphicons-icon.dropbox { - background-position: -44px -1813px; -} -.glyphicons-icon.google_plus { - background-position: -92px -1813px; -} -.glyphicons-icon.jolicloud { - background-position: -140px -1813px; -} -.glyphicons-icon.yahoo { - background-position: -188px -1813px; -} -.glyphicons-icon.blogger { - background-position: -236px -1813px; -} -.glyphicons-icon.picasa { - background-position: -284px -1813px; -} -.glyphicons-icon.amazon { - background-position: -332px -1813px; -} -.glyphicons-icon.tumblr { - background-position: -380px -1813px; -} -.glyphicons-icon.wordpress { - background-position: -428px -1813px; -} -.glyphicons-icon.instapaper { - background-position: 4px -1861px; -} -.glyphicons-icon.evernote { - background-position: -44px -1861px; -} -.glyphicons-icon.xing { - background-position: -92px -1861px; -} -.glyphicons-icon.zootool { - background-position: -140px -1861px; -} -.glyphicons-icon.dribbble { - background-position: -188px -1861px; -} -.glyphicons-icon.deviantart { - background-position: -236px -1861px; -} -.glyphicons-icon.read_it_later { - background-position: -284px -1861px; -} -.glyphicons-icon.linked_in { - background-position: -332px -1861px; -} -.glyphicons-icon.forrst { - background-position: -380px -1861px; -} -.glyphicons-icon.pinboard { - background-position: -428px -1861px; -} -.glyphicons-icon.behance { - background-position: 4px -1909px; -} -.glyphicons-icon.github { - background-position: -44px -1909px; -} -.glyphicons-icon.youtube { - background-position: -92px -1909px; -} -.glyphicons-icon.skitch { - background-position: -140px -1909px; -} -.glyphicons-icon.foursquare { - background-position: -188px -1909px; -} -.glyphicons-icon.quora { - background-position: -236px -1909px; -} -.glyphicons-icon.badoo { - background-position: -284px -1909px; -} -.glyphicons-icon.spotify { - background-position: -332px -1909px; -} -.glyphicons-icon.stumbleupon { - background-position: -380px -1909px; -} -.glyphicons-icon.readability { - background-position: -428px -1909px; -} -.glyphicons-icon.facebook { - background-position: 4px -1957px; -} -.glyphicons-icon.twitter { - background-position: -44px -1957px; -} -.glyphicons-icon.instagram { - background-position: -92px -1957px; -} -.glyphicons-icon.posterous_spaces { - background-position: -140px -1957px; -} -.glyphicons-icon.vimeo { - background-position: -188px -1957px; -} -.glyphicons-icon.flickr { - background-position: -236px -1957px; -} -.glyphicons-icon.last_fm { - background-position: -284px -1957px; -} -.glyphicons-icon.rss { - background-position: -332px -1957px; -} -.glyphicons-icon.skype { - background-position: -380px -1957px; -} -.glyphicons-icon.e-mail { - background-position: -428px -1957px; -} diff --git a/openQRM-5.3.50-CE/src/web/base/css/bootstrap/halflings.css b/openQRM-5.3.50-CE/src/web/base/css/bootstrap/halflings.css deleted file mode 100644 index 94e457f..0000000 --- a/openQRM-5.3.50-CE/src/web/base/css/bootstrap/halflings.css +++ /dev/null @@ -1,1275 +0,0 @@ -/*! - * - * Project: GLYPHICONS HALFLINGS - * Author: Jan Kovarik - www.glyphicons.com - * Twitter: @glyphicons - * - */ -@font-face { - font-family: 'Glyphicons Halflings Regular'; - src: url('../fonts/glyphicons-halflings-regular.eot'); - src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); - font-weight: normal; - font-style: normal; -} -.halflings { - display: inline-block; - position: relative; - padding-left: 25px; - color: #1d1d1b; - text-decoration: none; - *display: inline; - *zoom: 1; - vertical-align: middle; -} -.halflings:before { - position: absolute; - left: 0; - top: 0; - display: inline-block; - margin: 0 5px 0 0; - font: 12px/1em 'Glyphicons Halflings Regular'; - font-style: normal; - font-weight: normal; - color: #1d1d1b; - *display: inline; - *zoom: 1; - vertical-align: middle; - text-transform: none; - -webkit-font-smoothing: antialiased; -} -.halflings.white:before { - color: #fff; -} -.halflings.glass:before { - content: "\E001"; -} -.halflings.music:before { - content: "\E002"; -} -.halflings.search:before { - content: "\E003"; -} -.halflings.envelope:before { - content: "\2709"; -} -.halflings.heart:before { - content: "\E005"; -} -.halflings.star:before { - content: "\E006"; -} -.halflings.star-empty:before { - content: "\E007"; -} -.halflings.user:before { - content: "\E008"; -} -.halflings.film:before { - content: "\E009"; -} -.halflings.th-large:before { - content: "\E010"; -} -.halflings.th:before { - content: "\E011"; -} -.halflings.th-list:before { - content: "\E012"; -} -.halflings.ok:before { - content: "\E013"; -} -.halflings.remove:before { - content: "\E014"; -} -.halflings.zoom-in:before { - content: "\E015"; -} -.halflings.zoom-out:before { - content: "\E016"; -} -.halflings.off:before { - content: "\E017"; -} -.halflings.signal:before { - content: "\E018"; -} -.halflings.cog:before { - content: "\E019"; -} -.halflings.trash:before { - content: "\E020"; -} -.halflings.home:before { - content: "\E021"; -} -.halflings.file:before { - content: "\E022"; -} -.halflings.time:before { - content: "\E023"; -} -.halflings.road:before { - content: "\E024"; -} -.halflings.download-alt:before { - content: "\E025"; -} -.halflings.download:before { - content: "\E026"; -} -.halflings.upload:before { - content: "\E027"; -} -.halflings.inbox:before { - content: "\E028"; -} -.halflings.play-circle:before { - content: "\E029"; -} -.halflings.repeat:before { - content: "\E030"; -} -.halflings.refresh:before { - content: "\E031"; -} -.halflings.list-alt:before { - content: "\E032"; -} -.halflings.lock:before { - content: "\1F512"; -} -.halflings.flag:before { - content: "\E034"; -} -.halflings.headphones:before { - content: "\E035"; -} -.halflings.volume-off:before { - content: "\E036"; -} -.halflings.volume-down:before { - content: "\E037"; -} -.halflings.volume-up:before { - content: "\E038"; -} -.halflings.qrcode:before { - content: "\E039"; -} -.halflings.barcode:before { - content: "\E040"; -} -.halflings.tag:before { - content: "\E041"; -} -.halflings.tags:before { - content: "\E042"; -} -.halflings.book:before { - content: "\E043"; -} -.halflings.bookmark:before { - content: "\1F516"; -} -.halflings.print:before { - content: "\E045"; -} -.halflings.camera:before { - content: "\1F4F7"; -} -.halflings.font:before { - content: "\E047"; -} -.halflings.bold:before { - content: "\E048"; -} -.halflings.italic:before { - content: "\E049"; -} -.halflings.text-height:before { - content: "\E050"; -} -.halflings.text-width:before { - content: "\E051"; -} -.halflings.align-left:before { - content: "\E052"; -} -.halflings.align-center:before { - content: "\E053"; -} -.halflings.align-right:before { - content: "\E054"; -} -.halflings.align-justify:before { - content: "\E055"; -} -.halflings.list:before { - content: "\E056"; -} -.halflings.indent-left:before { - content: "\E057"; -} -.halflings.indent-right:before { - content: "\E058"; -} -.halflings.facetime-video:before { - content: "\E059"; -} -.halflings.picture:before { - content: "\E060"; -} -.halflings.pencil:before { - content: "\270F"; -} -.halflings.map-marker:before { - content: "\E062"; -} -.halflings.adjust:before { - content: "\E063"; -} -.halflings.tint:before { - content: "\E064"; -} -.halflings.edit:before { - content: "\E065"; -} -.halflings.share:before { - content: "\E066"; -} -.halflings.check:before { - content: "\E067"; -} -.halflings.move:before { - content: "\E068"; -} -.halflings.step-backward:before { - content: "\E069"; -} -.halflings.fast-backward:before { - content: "\E070"; -} -.halflings.backward:before { - content: "\E071"; -} -.halflings.play:before { - content: "\E072"; -} -.halflings.pause:before { - content: "\E073"; -} -.halflings.stop:before { - content: "\E074"; -} -.halflings.forward:before { - content: "\E075"; -} -.halflings.fast-forward:before { - content: "\E076"; -} -.halflings.step-forward:before { - content: "\E077"; -} -.halflings.eject:before { - content: "\E078"; -} -.halflings.chevron-left:before { - content: "\E079"; -} -.halflings.chevron-right:before { - content: "\E080"; -} -.halflings.plus-sign:before { - content: "\E081"; -} -.halflings.minus-sign:before { - content: "\E082"; -} -.halflings.remove-sign:before { - content: "\E083"; -} -.halflings.ok-sign:before { - content: "\E084"; -} -.halflings.question-sign:before { - content: "\E085"; -} -.halflings.info-sign:before { - content: "\E086"; -} -.halflings.screenshot:before { - content: "\E087"; -} -.halflings.remove-circle:before { - content: "\E088"; -} -.halflings.ok-circle:before { - content: "\E089"; -} -.halflings.ban-circle:before { - content: "\E090"; -} -.halflings.arrow-left:before { - content: "\E091"; -} -.halflings.arrow-right:before { - content: "\E092"; -} -.halflings.arrow-up:before { - content: "\E093"; -} -.halflings.arrow-down:before { - content: "\E094"; -} -.halflings.share-alt:before { - content: "\E095"; -} -.halflings.resize-full:before { - content: "\E096"; -} -.halflings.resize-small:before { - content: "\E097"; -} -.halflings.plus:before { - content: "\002B"; -} -.halflings.minus:before { - content: "\2212"; -} -.halflings.asterisk:before { - content: "\002A"; -} -.halflings.exclamation-sign:before { - content: "\E101"; -} -.halflings.gift:before { - content: "\E102"; -} -.halflings.leaf:before { - content: "\E103"; -} -.halflings.fire:before { - content: "\1F525"; -} -.halflings.eye-open:before { - content: "\E105"; -} -.halflings.eye-close:before { - content: "\E106"; -} -.halflings.warning-sign:before { - content: "\E107"; -} -.halflings.plane:before { - content: "\E108"; -} -.halflings.calendar:before { - content: "\1F4C5"; -} -.halflings.random:before { - content: "\E110"; -} -.halflings.comments:before { - content: "\E111"; -} -.halflings.magnet:before { - content: "\E112"; -} -.halflings.chevron-up:before { - content: "\E113"; -} -.halflings.chevron-down:before { - content: "\E114"; -} -.halflings.retweet:before { - content: "\E115"; -} -.halflings.shopping-cart:before { - content: "\E116"; -} -.halflings.folder-close:before { - content: "\E117"; -} -.halflings.folder-open:before { - content: "\E118"; -} -.halflings.resize-vertical:before { - content: "\E119"; -} -.halflings.resize-horizontal:before { - content: "\E120"; -} -.halflings.hdd:before { - content: "\E121"; -} -.halflings.bullhorn:before { - content: "\E122"; -} -.halflings.bell:before { - content: "\1F514"; -} -.halflings.certificate:before { - content: "\E124"; -} -.halflings.thumbs-up:before { - content: "\E125"; -} -.halflings.thumbs-down:before { - content: "\E126"; -} -.halflings.hand-right:before { - content: "\E127"; -} -.halflings.hand-left:before { - content: "\E128"; -} -.halflings.hand-top:before { - content: "\E129"; -} -.halflings.hand-down:before { - content: "\E130"; -} -.halflings.circle-arrow-right:before { - content: "\E131"; -} -.halflings.circle-arrow-left:before { - content: "\E132"; -} -.halflings.circle-arrow-top:before { - content: "\E133"; -} -.halflings.circle-arrow-down:before { - content: "\E134"; -} -.halflings.globe:before { - content: "\E135"; -} -.halflings.wrench:before { - content: "\1F527"; -} -.halflings.tasks:before { - content: "\E137"; -} -.halflings.filter:before { - content: "\E138"; -} -.halflings.briefcase:before { - content: "\1F4BC"; -} -.halflings.fullscreen:before { - content: "\E140"; -} -.halflings.dashboard:before { - content: "\E141"; -} -.halflings.paperclip:before { - content: "\1F4CE"; -} -.halflings.heart-empty:before { - content: "\E143"; -} -.halflings.link:before { - content: "\E144"; -} -.halflings.phone:before { - content: "\E145"; -} -.halflings.pushpin:before { - content: "\1F4CC"; -} -.halflings.euro:before { - content: "\20AC"; -} -.halflings.usd:before { - content: "\E148"; -} -.halflings.gbp:before { - content: "\E149"; -} -.halflings.sort:before { - content: "\E150"; -} -.halflings.sort-by-alphabet:before { - content: "\E151"; -} -.halflings.sort-by-alphabet-alt:before { - content: "\E152"; -} -.halflings.sort-by-order:before { - content: "\E153"; -} -.halflings.sort-by-order-alt:before { - content: "\E154"; -} -.halflings.sort-by-attributes:before { - content: "\E155"; -} -.halflings.sort-by-attributes-alt:before { - content: "\E156"; -} -.halflings.unchecked:before { - content: "\E157"; -} -.halflings.expand:before { - content: "\E158"; -} -.halflings.collapse:before { - content: "\E159"; -} -.halflings.collapse-top:before { - content: "\E160"; -} -.halflings.log_in:before { - content: "\E161"; -} -.halflings.flash:before { - content: "\E162"; -} -.halflings.log_out:before { - content: "\E163"; -} -.halflings.new_window:before { - content: "\E164"; -} -.halflings.record:before { - content: "\E165"; -} -.halflings.save:before { - content: "\E166"; -} -.halflings.open:before { - content: "\E167"; -} -.halflings.saved:before { - content: "\E168"; -} -.halflings.import:before { - content: "\E169"; -} -.halflings.export:before { - content: "\E170"; -} -.halflings.send:before { - content: "\E171"; -} -.halflings.floppy_disk:before { - content: "\E172"; -} -.halflings.floppy_saved:before { - content: "\E173"; -} -.halflings.floppy_remove:before { - content: "\E174"; -} -.halflings.floppy_save:before { - content: "\E175"; -} -.halflings.floppy_open:before { - content: "\E176"; -} -.halflings.credit_card:before { - content: "\E177"; -} -.halflings.transfer:before { - content: "\E178"; -} -.halflings.cutlery:before { - content: "\E179"; -} -.halflings.header:before { - content: "\E180"; -} -.halflings.compressed:before { - content: "\E181"; -} -.halflings.earphone:before { - content: "\E182"; -} -.halflings.phone_alt:before { - content: "\E183"; -} -.halflings.tower:before { - content: "\E184"; -} -.halflings.stats:before { - content: "\E185"; -} -.halflings.sd_video:before { - content: "\E186"; -} -.halflings.hd_video:before { - content: "\E187"; -} -.halflings.subtitles:before { - content: "\E188"; -} -.halflings.sound_stereo:before { - content: "\E189"; -} -.halflings.sound_dolby:before { - content: "\E190"; -} -.halflings.sound_5_1:before { - content: "\E191"; -} -.halflings.sound_6_1:before { - content: "\E192"; -} -.halflings.sound_7_1:before { - content: "\E193"; -} -.halflings.copyright_mark:before { - content: "\E194"; -} -.halflings.registration_mark:before { - content: "\E195"; -} -.halflings.cloud:before { - content: "\2601"; -} -.halflings.cloud_download:before { - content: "\E197"; -} -.halflings.cloud_upload:before { - content: "\E198"; -} -.halflings.tree_conifer:before { - content: "\E199"; -} -.halflings.tree_deciduous:before { - content: "\E200"; -} -.halflings-icon { - display: inline-block; - width: 14px; - height: 14px; - margin: 0 8px 0 0; - line-height: 14px; - vertical-align: text-top; - background-image: url(../../img/glyphicons/halflings/glyphicons_halflings.svg); - background-position: 0 0; - background-repeat: no-repeat; - vertical-align: top; - *display: inline; - *zoom: 1; - *margin-right: .3em; -} -.halflings-icon _:-o-prefocus, -.halflings-icon { - background-image: url(../../img/glyphicons/halflings/glyphicons_halflings.png); -} -.no-inlinesvg .halflings-icon { - background-image: url(../../img/glyphicons/halflings/glyphicons_halflings.png); -} -.halflings-icon.white { - background-image: url(../../img/glyphicons/halflings/glyphicons_halflings-white.svg); -} -.halflings-icon.white _:-o-prefocus, -.halflings-icon.white { - background-image: url(../../img/glyphicons/halflings/glyphicons_halflings-white.png); -} -.no-inlinesvg .halflings-icon.white { - background-image: url(../../img/glyphicons/halflings/glyphicons_halflings-white.png); -} -.halflings-icon.glass { - background-position: 0px 0px; -} -.halflings-icon.music { - background-position: -24px 0px; -} -.halflings-icon.search { - background-position: -48px 0px; -} -.halflings-icon.envelope { - background-position: -72px 0px; -} -.halflings-icon.heart { - background-position: -96px 0px; -} -.halflings-icon.star { - background-position: -120px 0px; -} -.halflings-icon.star-empty { - background-position: -144px 0px; -} -.halflings-icon.user { - background-position: -168px 0px; -} -.halflings-icon.film { - background-position: -192px 0px; -} -.halflings-icon.th-large { - background-position: -216px 0px; -} -.halflings-icon.th { - background-position: -240px 0px; -} -.halflings-icon.th-list { - background-position: -264px 0px; -} -.halflings-icon.ok { - background-position: -288px 0px; -} -.halflings-icon.remove { - background-position: -312px 0px; -} -.halflings-icon.zoom-in { - background-position: -336px 0px; -} -.halflings-icon.zoom-out { - background-position: -360px 0px; -} -.halflings-icon.off { - background-position: -384px 0px; -} -.halflings-icon.signal { - background-position: -408px 0px; -} -.halflings-icon.cog { - background-position: -432px 0px; -} -.halflings-icon.trash { - background-position: -456px 0px; -} -.halflings-icon.home { - background-position: 0px -24px; -} -.halflings-icon.file { - background-position: -24px -24px; -} -.halflings-icon.time { - background-position: -48px -24px; -} -.halflings-icon.road { - background-position: -71px -24px; -} -.halflings-icon.download-alt { - background-position: -96px -24px; -} -.halflings-icon.download { - background-position: -120px -24px; -} -.halflings-icon.upload { - background-position: -144px -24px; -} -.halflings-icon.inbox { - background-position: -168px -24px; -} -.halflings-icon.play-circle { - background-position: -192px -24px; -} -.halflings-icon.repeat { - background-position: -216px -24px; -} -.halflings-icon.refresh { - background-position: -240px -24px; -} -.halflings-icon.list-alt { - background-position: -264px -24px; -} -.halflings-icon.lock { - background-position: -288px -24px; -} -.halflings-icon.flag { - background-position: -312px -24px; -} -.halflings-icon.headphones { - background-position: -336px -24px; -} -.halflings-icon.volume-off { - background-position: -360px -24px; -} -.halflings-icon.volume-down { - background-position: -384px -24px; -} -.halflings-icon.volume-up { - background-position: -408px -24px; -} -.halflings-icon.qrcode { - background-position: -432px -24px; -} -.halflings-icon.barcode { - background-position: -456px -24px; -} -.halflings-icon.tag { - background-position: 0px -48px; -} -.halflings-icon.tags { - background-position: -24px -48px; -} -.halflings-icon.book { - background-position: -48px -48px; -} -.halflings-icon.bookmark { - background-position: -72px -48px; -} -.halflings-icon.print { - background-position: -96px -48px; -} -.halflings-icon.camera { - background-position: -120px -48px; -} -.halflings-icon.font { - background-position: -144px -48px; -} -.halflings-icon.bold { - background-position: -168px -48px; -} -.halflings-icon.italic { - background-position: -192px -48px; -} -.halflings-icon.text-height { - background-position: -216px -48px; -} -.halflings-icon.text-width { - background-position: -240px -48px; -} -.halflings-icon.align-left { - background-position: -264px -48px; -} -.halflings-icon.align-center { - background-position: -288px -48px; -} -.halflings-icon.align-right { - background-position: -312px -48px; -} -.halflings-icon.align-justify { - background-position: -336px -48px; -} -.halflings-icon.list { - background-position: -360px -48px; -} -.halflings-icon.indent-left { - background-position: -384px -48px; -} -.halflings-icon.indent-right { - background-position: -408px -48px; -} -.halflings-icon.facetime-video { - background-position: -432px -48px; -} -.halflings-icon.picture { - background-position: -456px -48px; -} -.halflings-icon.pencil { - background-position: 0px -72px; -} -.halflings-icon.map-marker { - background-position: -24px -72px; -} -.halflings-icon.adjust { - background-position: -48px -72px; -} -.halflings-icon.tint { - background-position: -72px -72px; -} -.halflings-icon.edit { - background-position: -96px -72px; -} -.halflings-icon.share { - background-position: -120px -72px; -} -.halflings-icon.check { - background-position: -144px -72px; -} -.halflings-icon.move { - background-position: -168px -72px; -} -.halflings-icon.step-backward { - background-position: -192px -72px; -} -.halflings-icon.fast-backward { - background-position: -216px -72px; -} -.halflings-icon.backward { - background-position: -240px -72px; -} -.halflings-icon.play { - background-position: -264px -72px; -} -.halflings-icon.pause { - background-position: -288px -72px; -} -.halflings-icon.stop { - background-position: -312px -72px; -} -.halflings-icon.forward { - background-position: -336px -72px; -} -.halflings-icon.fast-forward { - background-position: -360px -72px; -} -.halflings-icon.step-forward { - background-position: -384px -72px; -} -.halflings-icon.eject { - background-position: -408px -72px; -} -.halflings-icon.chevron-left { - background-position: -432px -72px; -} -.halflings-icon.chevron-right { - background-position: -456px -72px; -} -.halflings-icon.plus-sign { - background-position: 0px -96px; -} -.halflings-icon.minus-sign { - background-position: -24px -96px; -} -.halflings-icon.remove-sign { - background-position: -48px -96px; -} -.halflings-icon.ok-sign { - background-position: -72px -96px; -} -.halflings-icon.question-sign { - background-position: -96px -96px; -} -.halflings-icon.info-sign { - background-position: -120px -96px; -} -.halflings-icon.screenshot { - background-position: -144px -96px; -} -.halflings-icon.remove-circle { - background-position: -168px -96px; -} -.halflings-icon.ok-circle { - background-position: -192px -96px; -} -.halflings-icon.ban-circle { - background-position: -216px -96px; -} -.halflings-icon.arrow-left { - background-position: -240px -96px; -} -.halflings-icon.arrow-right { - background-position: -264px -96px; -} -.halflings-icon.arrow-up { - background-position: -288px -96px; -} -.halflings-icon.arrow-down { - background-position: -312px -96px; -} -.halflings-icon.share-alt { - background-position: -336px -96px; -} -.halflings-icon.resize-full { - background-position: -360px -96px; -} -.halflings-icon.resize-small { - background-position: -384px -96px; -} -.halflings-icon.plus { - background-position: -408px -96px; -} -.halflings-icon.minus { - background-position: -432px -96px; -} -.halflings-icon.asterisk { - background-position: -456px -96px; -} -.halflings-icon.exclamation-sign { - background-position: 0px -120px; -} -.halflings-icon.gift { - background-position: -24px -120px; -} -.halflings-icon.leaf { - background-position: -48px -120px; -} -.halflings-icon.fire { - background-position: -72px -120px; -} -.halflings-icon.eye-open { - background-position: -95px -120px; -} -.halflings-icon.eye-close { - background-position: -119px -120px; -} -.halflings-icon.warning-sign { - background-position: -144px -120px; -} -.halflings-icon.plane { - background-position: -168px -120px; -} -.halflings-icon.calendar { - background-position: -192px -120px; -} -.halflings-icon.random { - background-position: -216px -120px; -} -.halflings-icon.comments { - background-position: -240px -120px; -} -.halflings-icon.magnet { - background-position: -264px -120px; -} -.halflings-icon.chevron-up { - background-position: -288px -120px; -} -.halflings-icon.chevron-down { - background-position: -312px -120px; -} -.halflings-icon.retweet { - background-position: -336px -120px; -} -.halflings-icon.shopping-cart { - background-position: -360px -120px; -} -.halflings-icon.folder-close { - background-position: -384px -120px; -} -.halflings-icon.folder-open { - background-position: -408px -120px; -} -.halflings-icon.resize-vertical { - background-position: -432px -120px; -} -.halflings-icon.resize-horizontal { - background-position: -456px -120px; -} -.halflings-icon.hdd { - background-position: 0px -144px; -} -.halflings-icon.bullhorn { - background-position: -24px -144px; -} -.halflings-icon.bell { - background-position: -48px -144px; -} -.halflings-icon.certificate { - background-position: -72px -144px; -} -.halflings-icon.thumbs-up { - background-position: -96px -144px; -} -.halflings-icon.thumbs-down { - background-position: -120px -144px; -} -.halflings-icon.hand-right { - background-position: -145px -144px; -} -.halflings-icon.hand-left { - background-position: -167px -144px; -} -.halflings-icon.hand-top { - background-position: -192px -144px; -} -.halflings-icon.hand-down { - background-position: -216px -144px; -} -.halflings-icon.circle-arrow-right { - background-position: -240px -144px; -} -.halflings-icon.circle-arrow-left { - background-position: -264px -144px; -} -.halflings-icon.circle-arrow-top { - background-position: -288px -144px; -} -.halflings-icon.circle-arrow-down { - background-position: -312px -144px; -} -.halflings-icon.globe { - background-position: -336px -144px; -} -.halflings-icon.wrench { - background-position: -360px -144px; -} -.halflings-icon.tasks { - background-position: -384px -144px; -} -.halflings-icon.filter { - background-position: -408px -144px; -} -.halflings-icon.briefcase { - background-position: -432px -144px; -} -.halflings-icon.fullscreen { - background-position: -456px -144px; -} -.halflings-icon.dashboard { - background-position: 0px -168px; -} -.halflings-icon.paperclip { - background-position: -24px -168px; -} -.halflings-icon.heart-empty { - background-position: -48px -168px; -} -.halflings-icon.link { - background-position: -72px -168px; -} -.halflings-icon.phone { - background-position: -96px -168px; -} -.halflings-icon.pushpin { - background-position: -120px -168px; -} -.halflings-icon.euro { - background-position: -144px -168px; -} -.halflings-icon.usd { - background-position: -168px -168px; -} -.halflings-icon.gbp { - background-position: -192px -168px; -} -.halflings-icon.sort { - background-position: -216px -168px; -} -.halflings-icon.sort-by-alphabet { - background-position: -240px -168px; -} -.halflings-icon.sort-by-alphabet-alt { - background-position: -264px -168px; -} -.halflings-icon.sort-by-order { - background-position: -288px -168px; -} -.halflings-icon.sort-by-order-alt { - background-position: -312px -168px; -} -.halflings-icon.sort-by-attributes { - background-position: -336px -168px; -} -.halflings-icon.sort-by-attributes-alt { - background-position: -360px -168px; -} -.halflings-icon.unchecked { - background-position: -384px -168px; -} -.halflings-icon.expand { - background-position: -408px -168px; -} -.halflings-icon.collapse { - background-position: -432px -168px; -} -.halflings-icon.collapse-top { - background-position: -456px -168px; -} -.halflings-icon.log_in { - background-position: 0px -192px; -} -.halflings-icon.flash { - background-position: -24px -192px; -} -.halflings-icon.log_out { - background-position: -48px -192px; -} -.halflings-icon.new_window { - background-position: -72px -192px; -} -.halflings-icon.record { - background-position: -96px -192px; -} -.halflings-icon.save { - background-position: -120px -192px; -} -.halflings-icon.open { - background-position: -144px -192px; -} -.halflings-icon.saved { - background-position: -168px -192px; -} -.halflings-icon.import { - background-position: -192px -192px; -} -.halflings-icon.export { - background-position: -216px -192px; -} -.halflings-icon.send { - background-position: -240px -192px; -} -.halflings-icon.floppy_disk { - background-position: -264px -192px; -} -.halflings-icon.floppy_saved { - background-position: -288px -192px; -} -.halflings-icon.floppy_remove { - background-position: -312px -192px; -} -.halflings-icon.floppy_save { - background-position: -336px -192px; -} -.halflings-icon.floppy_open { - background-position: -360px -192px; -} -.halflings-icon.credit_card { - background-position: -384px -192px; -} -.halflings-icon.transfer { - background-position: -408px -192px; -} -.halflings-icon.cutlery { - background-position: -432px -192px; -} -.halflings-icon.header { - background-position: -456px -192px; -} -.halflings-icon.compressed { - background-position: 0px -216px; -} -.halflings-icon.earphone { - background-position: -24px -216px; -} -.halflings-icon.phone_alt { - background-position: -48px -216px; -} -.halflings-icon.tower { - background-position: -72px -216px; -} -.halflings-icon.stats { - background-position: -96px -216px; -} -.halflings-icon.sd_video { - background-position: -119px -216px; -} -.halflings-icon.hd_video { - background-position: -143px -216px; -} -.halflings-icon.subtitles { - background-position: -167px -216px; -} -.halflings-icon.sound_stereo { - background-position: -191px -216px; -} -.halflings-icon.sound_dolby { - background-position: -215px -216px; -} -.halflings-icon.sound_5_1 { - background-position: -239px -216px; -} -.halflings-icon.sound_6_1 { - background-position: -263px -216px; -} -.halflings-icon.sound_7_1 { - background-position: -287px -216px; -} -.halflings-icon.copyright_mark { - background-position: -312px -216px; -} -.halflings-icon.registration_mark { - background-position: -336px -216px; -} -.halflings-icon.cloud { - background-position: -360px -216px; -} -.halflings-icon.cloud_download { - background-position: -384px -216px; -} -.halflings-icon.cloud_upload { - background-position: -408px -216px; -} -.halflings-icon.tree_conifer { - background-position: -432px -216px; -} -.halflings-icon.tree_deciduous { - background-position: -456px -216px; -} diff --git a/openQRM-5.3.50-CE/src/web/base/css/bootstrap/img/glyphicons-halflings-white.png b/openQRM-5.3.50-CE/src/web/base/css/bootstrap/img/glyphicons-halflings-white.png deleted file mode 100644 index 3bf6484..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/css/bootstrap/img/glyphicons-halflings-white.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/css/bootstrap/img/glyphicons-halflings.png b/openQRM-5.3.50-CE/src/web/base/css/bootstrap/img/glyphicons-halflings.png deleted file mode 100644 index a996999..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/css/bootstrap/img/glyphicons-halflings.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/css/bootstrap/normalize.css b/openQRM-5.3.50-CE/src/web/base/css/bootstrap/normalize.css deleted file mode 100644 index 4acf9bd..0000000 --- a/openQRM-5.3.50-CE/src/web/base/css/bootstrap/normalize.css +++ /dev/null @@ -1,402 +0,0 @@ -/*! normalize.css v2.1.1 | MIT License | git.io/normalize */ - -/* ========================================================================== - HTML5 display definitions - ========================================================================== */ - -/** - * Correct `block` display not defined in IE 8/9. - */ - -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -nav, -section, -summary { - display: block; -} - -/** - * Correct `inline-block` display not defined in IE 8/9. - */ - -audio, -canvas, -video { - display: inline-block; -} - -/** - * Prevent modern browsers from displaying `audio` without controls. - * Remove excess height in iOS 5 devices. - */ - -audio:not([controls]) { - display: none; - height: 0; -} - -/** - * Address styling not present in IE 8/9. - */ - -[hidden] { - display: none; -} - -/* ========================================================================== - Base - ========================================================================== */ - -/** - * 1. Prevent system color scheme's background color being used in Firefox, IE, - * and Opera. - * 2. Prevent system color scheme's text color being used in Firefox, IE, and - * Opera. - * 3. Set default font family to sans-serif. - * 4. Prevent iOS text size adjust after orientation change, without disabling - * user zoom. - */ - -html { - background: #fff; /* 1 */ - color: #000; /* 2 */ - font-family: sans-serif; /* 3 */ - -ms-text-size-adjust: 100%; /* 4 */ - -webkit-text-size-adjust: 100%; /* 4 */ -} - -/** - * Remove default margin. - */ - -body { - margin: 0 0 0 0; -} - -/* ========================================================================== - Links - ========================================================================== */ - -/** - * Address `outline` inconsistency between Chrome and other browsers. - */ - -a:focus { - outline: thin dotted; -} - -/** - * Improve readability when focused and also mouse hovered in all browsers. - */ - -a:active, -a:hover { - outline: 0; -} - -/* ========================================================================== - Typography - ========================================================================== */ - -/** - * Address variable `h1` font-size and margin within `section` and `article` - * contexts in Firefox 4+, Safari 5, and Chrome. - */ - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -/** - * Address styling not present in IE 8/9, Safari 5, and Chrome. - */ - -abbr[title] { - border-bottom: 1px dotted; -} - -/** - * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome. - */ - -b, -strong { - font-weight: bold; -} - -/** - * Address styling not present in Safari 5 and Chrome. - */ - -dfn { - font-style: italic; -} - -/** - * Address differences between Firefox and other browsers. - */ - -hr { - -moz-box-sizing: content-box; - box-sizing: content-box; - height: 0; -} - -/** - * Address styling not present in IE 8/9. - */ - -mark { - background: #ff0; - color: #000; -} - -/** - * Correct font family set oddly in Safari 5 and Chrome. - */ - -code, -kbd, -pre, -samp { - font-family: monospace, serif; - font-size: 1em; -} - -/** - * Improve readability of pre-formatted text in all browsers. - */ - -pre { - white-space: pre-wrap; -} - -/** - * Set consistent quote types. - */ - -q { - quotes: "\201C" "\201D" "\2018" "\2019"; -} - -/** - * Address inconsistent and variable font size in all browsers. - */ - -small { - font-size: 80%; -} - -/** - * Prevent `sub` and `sup` affecting `line-height` in all browsers. - */ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sup { - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -/* ========================================================================== - Embedded content - ========================================================================== */ - -/** - * Remove border when inside `a` element in IE 8/9. - */ - -img { - border: 0; -} - -/** - * Correct overflow displayed oddly in IE 9. - */ - -svg:not(:root) { - overflow: hidden; -} - -/* ========================================================================== - Figures - ========================================================================== */ - -/** - * Address margin not present in IE 8/9 and Safari 5. - */ - -figure { - margin: 0; -} - -/* ========================================================================== - Forms - ========================================================================== */ - -/** - * Define consistent border, margin, and padding. - */ - -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -/** - * 1. Correct `color` not being inherited in IE 8/9. - * 2. Remove padding so people aren't caught out if they zero out fieldsets. - */ - -legend { - border: 0; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * 1. Correct font family not being inherited in all browsers. - * 2. Correct font size not being inherited in all browsers. - * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome. - */ - -button, -input, -select, -textarea { - font-family: inherit; /* 1 */ - font-size: 100%; /* 2 */ - margin: 0; /* 3 */ -} - -/** - * Address Firefox 4+ setting `line-height` on `input` using `!important` in - * the UA stylesheet. - */ - -button, -input { - line-height: normal; -} - -/** - * Address inconsistent `text-transform` inheritance for `button` and `select`. - * All other form control elements do not inherit `text-transform` values. - * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+. - * Correct `select` style inheritance in Firefox 4+ and Opera. - */ - -button, -select { - text-transform: none; -} - -/** - * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` - * and `video` controls. - * 2. Correct inability to style clickable `input` types in iOS. - * 3. Improve usability and consistency of cursor style between image-type - * `input` and others. - */ - -button, -html input[type="button"], /* 1 */ -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; /* 2 */ - cursor: pointer; /* 3 */ -} - -/** - * Re-set default cursor for disabled elements. - */ - -button[disabled], -html input[disabled] { - cursor: default; -} - -/** - * 1. Address box sizing set to `content-box` in IE 8/9. - * 2. Remove excess padding in IE 8/9. - */ - -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. - * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome - * (include `-moz` to future-proof). - */ - -input[type="search"] { - -webkit-appearance: textfield; /* 1 */ - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; /* 2 */ - box-sizing: content-box; -} - -/** - * Remove inner padding and search cancel button in Safari 5 and Chrome - * on OS X. - */ - -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** - * Remove inner padding and border in Firefox 4+. - */ - -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} - -/** - * 1. Remove default vertical scrollbar in IE 8/9. - * 2. Improve readability and alignment in all browsers. - */ - -textarea { - overflow: auto; /* 1 */ - vertical-align: top; /* 2 */ -} - -/* ========================================================================== - Tables - ========================================================================== */ - -/** - * Remove most spacing between table cells. - */ - -table { - border-collapse: collapse; - border-spacing: 0; -} \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/web/base/css/default.css b/openQRM-5.3.50-CE/src/web/base/css/default.css deleted file mode 100644 index fbcca6a..0000000 --- a/openQRM-5.3.50-CE/src/web/base/css/default.css +++ /dev/null @@ -1,409 +0,0 @@ -html { - -} -body { - overflow-y:scroll; -} - -/* Page */ -#page { - margin: 0 0 30px 0; - width: 1198px; - background: #fff url(../img/menu-background.png) repeat-y -85px 0; - margin: 0 auto 0 auto; - border-left: 1px solid #aaaaaa; - border-right: 1px solid #aaaaaa; - border-bottom: 1px solid #aaaaaa; - position: relative; -} -#page #wrapper{ - background: url(../img/html-tabs-fix.png) repeat-x 0px 76px; -} - -option.imagebacked { - padding: 2px 10px 2px 20px; - background-repeat: no-repeat; - background-position: 0px 0px; - vertical-align: middle; -} - -/* Middle Head */ -#page #head { - display: block; - margin: 0px; - padding: 0px; - color: #353535; - position: relative; - border-bottom: 5px solid #39aacb; - height: 71px; -} -#page #head .logo { - background-repeat: no-repeat; - position: absolute; - overflow: hidden; - left: 0; - top: 8px; - width: 170px; - height: 47px; - padding: 0 0 0 25px; - font-size: 80%; - cursor: pointer; -} - -#page #head .logo .openqrmVersion { - position: absolute; - top: 53px; - left: 133px; -} -#page #head .main { - position: relative; - background: #2693b8; - margin: 20px 0 0 0; - height: 42px; - padding: 0 0 0 15px; - color: #ffffff; -} -#page #head .main #edition_label { - font-size: 25px; - line-height:37px; - opacity: 0.7; - text-transform: uppercase; - letter-spacing: -1; - float: left; - margin: 5px 0 0 14px; - color: #ffffff; - -} - - -#page #head .top { - margin: 0 0 0 450px; - text-align: right; - padding: 0 20px 0 0; - color: #fff; -} -#page #head .bottom-line { - position:absolute; - bottom:0; - clear:both; - line-height:0px; - width:100%; -} -#page #head #Event_box { - display:none; - float:left; - margin: 5px 0 5px 30px; - padding: 0 0 0 20px; - line-height:16px; - text-decoration:none; - color:red; -} -#page #head #Event_active_box { - display:none; - float:left; - margin: 5px 0 5px 30px; - padding: 0 0 0 20px; - line-height:16px; - text-decoration:none; - color:orange; -} -.top form{ - margin: 0; -} -#Watch, #Login_box, #Docu_box, #Info_box, #Support_box, #Language_box { - display:block; - margin: 25px 0 14px 20px; - padding: 0 0 0 20px; - float:right; - color: #353535; - line-height:18px; - text-decoration: none; - text-transform: uppercase; -} -#Language_box .right { - float: left; -} -#Language_box .left label { - margin-bottom: 0px; - font-size: inherit; -} -#Language_box .left { - float: left; - width: auto; - text-align: left; - padding: 0 8px 0 0; -} -#Language_select { - width: auto; - height: auto; - margin: 0; - padding: 1px; -} - -#page #head #Resource_box, -#page #head #Server_box { - margin: 15px 0 0 0; - padding: 0 10px 0 0px; - float: right; -} -#page #head #Resource_box { - margin-right: 30px; -} - -#page #head .appliances, -#page #head .resources { - float:left; - margin: 0 10px 0 0; - padding: 0 0 0 10px; - border-left: 1px solid #fff; -} - -#page #head .appliances.headline, -#page #head .resources.headline { - font-weight:bold; - text-transform: uppercase; - border: 0; -} -#page #head .appliances.first, -#page #head .resources.first { - border: 0; -} - -/* Middle Content */ -#page #content { - height: auto; - padding-bottom: 50px; - margin: 0px; -} -/* Middle Content Menu */ -#page .menu { - width: 214px; - padding: 0 0 60px 0; -} - -#page #content .menu table { - border: 0px none; -} - - -/* Middle Content Content */ -#page .container .middle { - min-height: 530px; -} - - -/* Footer */ -#page #footer { - position: absolute; - bottom: 0; - left: 0; - display: block; - width: 1198px; - margin: 0; - padding: 10px 0 10px 0; - background: #fff; - border-top: solid 1px #aaaaaa; - font-size: 11px; - margin: 0 auto 0 auto; -} - -#openqrm_enterprise_footer { - margin: 5px 20px 0 0; -} - -#performance-stats { - margin-left: 14px; -} - -#page #footer, -#page #footer a { - color: #888888; - text-decoration:none; -} - - -/* Misc */ -.noscript { - border: 2px solid red; - color: red; - font-weight: bold; - font-size: 12px; - padding: 15px; - margin: 20px; -} -.floatbreaker { - clear:both; - height:0px !important; - position:relative; - line-height:0px; - font-size:0px; - border:0px none; - margin:0; - padding:0; - overflow:hidden; - width:0px; -} -input[type="button"].namegenButton, -input[type="button"].browseButton { - margin: 3px 0 0 15px; - vertical-align: top; -} - -/* DEPRECATED: Info box, should be replaced by universal modal dialog */ -#infoScrollArea { - position:relative; - border:1px solid #cecece; - overflow: scroll; - height: 300px; -} - -#infoArea { - margin: 5px 0 5px 5px; - padding: 0 0 0 5px; -} - -#backgroundPopup{ - display:none; - position:fixed; - _position:absolute; - height:100%; - width:100%; - top:0; - left:0; - background:#000000; - z-index:1; -} -#popupInfo{ - display:none; - position:fixed; - _position:absolute; - width:650px; - background:#ffffff; - -moz-border-radius: 8px; - -webkit-border-radius: 8px; - border-radius: 8px; - -moz-box-shadow: 0 0 30px #555; - -webkit-box-shadow: 0 0 30px #555; - box-shadow: 0 0 30px #555; - padding: 20px 30px; - font-size:13px; - z-index: 2000; -} - -#popupInfoClose{ - -moz-box-shadow: 0 0 12px #555; - -webkit-box-shadow: 0 0 12px #555; - box-shadow: 0 0 12px #555; - border: 2px solid #fff; - -moz-border-radius: 16px; - -webkit-border-radius: 16px; - border-radius: 16px; - font-size: 12px; - line-height: 14px; - right: -10px; - top: -10px; - position: absolute; - color: #fff; - font-weight: 700; - display: block; - background: #555; - width: 15px; - text-align: center; - padding: 3px; - cursor: pointer; -} - - - -/* DEPRECATED: 2 column element */ -.clear_col { - clear: both; -} -.col_2_left, .col_2_right { - float: left; - padding: 15px 0 0; - width: 48%; -} -.col_wrap_2 .col_inner_left { - padding: 0 15px 0 0; -} -.col_wrap_2 .col_inner_right { - padding: 0 0 0 15px; -} - - -/* FILEPICKER */ -.functionbox-capation-box { - text-align: right; - padding: 5px; - background: #494949; - border-bottom: 5px solid #39AACB; -} -.functionbox-capation { - text-align: left; - color: white; - cursor: crosshair; - font-size: inherit; - line-height: 15px; - padding: 5px !important; -} -#filepicker { - z-index: 10; - position: absolute; - left: 0; - top: 0; - width:280px; - background: white; - border: 0px none; - border-left: 1px solid #ddd; - border-bottom: 1px solid #ddd; - box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.30); - -moz-box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.30); - -webkit-box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.30); -} -#filepicker .functionbox-capation input { - position: absolute; - right: 5px; - top: 7px; - width:18px; - height:18px; - font-size: 10px; - color: black; - border: 1px solid; - background: #fff; - text-align: center; - line-height: 18px; - padding: 0; -} -#filepicker #canvas { - vertical-align:middle; - text-align:center; - height:340px; - overflow: auto; - overflow-y: scroll; -} -#filepicker table { - width: 100%; - border: 0px none; - margin: 0; -} -#filepicker table td { - border-bottom: 1px solid #ccc; -} -#filepicker table a { - display: block; - line-height: 20px; - padding: 0 0 0 35px; - text-align: left; - text-decoration: none; - font-size: 11px; -} -#filepicker table a.folder { - background: url("../img/filepicker_icons.gif") no-repeat scroll 0 -20px transparent; -} -#filepicker table a.file { - background: url("../img/filepicker_icons.gif") no-repeat scroll 0 0 transparent; - color: black; -} - - diff --git a/openQRM-5.3.50-CE/src/web/base/css/htmlobject.css b/openQRM-5.3.50-CE/src/web/base/css/htmlobject.css deleted file mode 100644 index 1fdd929..0000000 --- a/openQRM-5.3.50-CE/src/web/base/css/htmlobject.css +++ /dev/null @@ -1,324 +0,0 @@ -iframe { - margin: 10px 0 0 0; - display: block; - width: 100%; - height: 600px; - border: 0 none; -} - - -/* Tabs */ -.htmlobject_tabs { - display: block; - width: 100%; - height: 29px; - line-height: normal; - padding: 3px 0 0px 13px; - margin: 0 0 0 -16px; - background: #ddd; - border-bottom: 1px solid #ccc; -} -.htmlobject_tabs_box .htmlobject_tabs { - padding: 3px 12px 0 11px; - margin: 0 0 0 -14px; -} - -.htmlobject_table a { - color: #000; - text-decoration: underline; -} -.htmlobject_tabs ul { - position: relative; - margin: 0; - padding: 0; - list-style: none; -} -.htmlobject_tabs li { - float: right; - padding:0; - margin: 0 0 0 10px; -} -.htmlobject_tabs li.current { } -.htmlobject_tabs li:hover, -.htmlobject_tabs li.current:hover { } - -.htmlobject_tabs span { - float: left; - display: block; - padding: 0; -} -.htmlobject_tabs li a, -.htmlobject_tabs li.current a { - margin: 0 !important; -} - - -/* Tabbox */ -.htmlobject_tabs_box { - position: relative; - margin: 0 0 65px 0; -} - -/*.htmlobject_tabs_box div, -.htmlobject_tabs_box p, -.htmlobject_tabs_box h1, -.htmlobject_tabs_box h3,*/ -.htmlobject_tabs_box form { - margin: 0; - padding: 5px; -} - -.htmlobject_tabs_box .error { - color: red; -} -.htmlobject_box.error .errormsg { - margin: 0 0 10px 2px; -} - -/* Box */ - -.htmlobject_box { - margin: 0 0 5px 0 !important; -} -/* disabled -.htmlobject_box input, -.htmlobject_box textarea, -.htmlobject_box select, -.htmlobject_box input[type=file] { - font-family: Tahoma, Verdana, sans-serif; - font-size: 11px; - line-height: 15px; - padding-left: 2px; -} -*/ -.htmlobject_box textarea { -/* width: 396px; */ -} -.htmlobject_box input[type=text], -.htmlobject_box input[type=password] { -/* width: 180px; */ -} -.htmlobject_box .left { - float: left; - width: 200px; - margin: 0; - padding: 0; -} -.htmlobject_box .left label{ - line-height: 30px; - margin: 0; -} -.htmlobject_box .right { - float: left; - margin: 0; - padding: 0; -} -.htmlobject_box.textarea .left { - width: 300px; - float: none; - margin: 15px 0 5px 0; -} -.htmlobject_box.textarea .right { - float: none; -} -.htmlobject_tabs_box .msgBox { - display: block; - position: absolute; - top: -70px; - left: 250px; - font-size: 11px; - border: solid 1px #aaaaaa; - background-color: #FFFFE0; - color: black; - padding: 10px 15px; - margin: 0; - z-index: 100; - -webkit-box-shadow: 0 2px 2px 0 rgba(33, 33, 33, 0.5); - box-shadow: 0 2px 2px 0 rgba(33, 33, 33, 0.5); -} -.msgBox strong { - font-weight: bold; - color: red; -} - -/* Table */ -.htmlobject_table { - width: 100%; - border: 0px none; -} -.htmlobject_td { - border: 0; - border-top : 1px solid #cccccc; - padding: 8px 10px; - vertical-align: top; -} -.htmlobject_tr .pageturn_head { - padding: 5px; -} -.htmlobject_table .last { - border-bottom : 1px solid #cccccc; -} - -.htmlobject_tr th { - background: #eee; - text-align: left; - border: 0; - border-top: 1px solid #ccc; - padding: 5px 10px; - font-size: 13px !important; -} -.htmlobject_td.head { - border-top: 1px solid white !important; - padding: 0 !important; -} -.htmlobject_td.identifier { - text-align: center; - width: 20px; -} -.htmlobject_td.sorttable { - border: 0px none; -} -.htmlobject_td.sorttable select, -.htmlobject_td.sorttable input { - border: 1px solid #cccccc; -} -.htmlobject_td.sorttable label { - margin: 0 0 0 5px; -} -.htmlobject_td.bottom { - padding-top: 15px !important; - text-align: right; - border: 0px none; -} -.htmlobject_table .selecttable { - display: inline; - padding: 0 20px 0 0 !important; - line-height: 18px; - white-space: nowrap; -} -.htmlobject_table .actiontable { - display: inline; -} - -.htmlobject_table .pageturn_head .pageturn_wrapper { - display: bolck; - -} -.htmlobject_table .pageturn_head .sort_box { - float: right; -} -.htmlobject_table .pageturn_head .pageturn_box { - float: left; -} -.htmlobject_table .pageturn_head .sort_box input, -.htmlobject_table .pageturn_head .sort_box select, -.htmlobject_table .pageturn_head .sort_box textarea { - width: auto; - height: auto; - line-height: auto; - margin-bottom: 0; - margin-bottom:0; - line-height: auto; - padding:5px; - font-size: 90%; -} -.htmlobject_table .pageturn_head .sort_box input.offset { - display: none; -} - - -.htmlobject_table .pageturn_head .sort_box { - font-size: 11px; -} - -.htmlobject_table .pageturn_head .sort_box input.submit { - vertical-align: middle; - margin: 0 0 0 8px; - width: 30px; - height: 30px; - text-indent: -1000px; - background-color: transparent; - background-image: url(../img/glyphicons/glyphicons.png); - background-position: -44px -382px; -} - - -.htmlobject_td.pageturn_head, -.htmlobject_td.pageturn_bottom { - border: 0 none; -} -.htmlobject_td.pageturn_bottom .pageturn_middle, -.htmlobject_td.pageturn_bottom a, -.htmlobject_td.pageturn_bottom span { - color: #000; -} -.htmlobject_td.pageturn_head { -/* background: #494949; */ -} - -.htmlobject_table .pageturn_table td { - border: 0 none; - padding: 0; -} - -.htmlobject_table .pageturn_table .last { - border-bottom: 0px none; -} - -.htmlobject_table .pageturn_box a { - display: block; - float: left; - font-weight: bold; - margin: 1px; - padding: 2px 6px; - color: #444; - text-align: center; - text-decoration: none; -} -.htmlobject_table .pageturn_bottom .pageturn_box a { - color: #000; -} -.htmlobject_table .pageturn_box a.disabled { - -} -.htmlobject_td.pageturn_head .pageturn_table { - margin: 0 0 0 auto; - border: 0 none; -} -.htmlobject_td.pageturn_bottom .pageturn_table { - margin: 0 auto; - border: 0 none; - padding: 25px 5px 5px 5px !important; -} -.pageturn_table td.pageturn_middle { - text-align: center; - color: #444; - padding: 3px 10px 0; -} -.pageturn_middle span { - color: #444; -} - - -.htmlobject_td.sort_form { - border: 0 none; - text-align: right; -} -.htmlobject_td.actions { - border: 0 none; - padding-top: 15px !important; - text-align: right; -} - -.tr_hover { -} -.tr_click { - background-color: #ddd; -} -/* defaults */ -.checkbox, -.radio { - border: 0px none; -} - - diff --git a/openQRM-5.3.50-CE/src/web/base/css/menu.css b/openQRM-5.3.50-CE/src/web/base/css/menu.css deleted file mode 100644 index 9dd2a9f..0000000 --- a/openQRM-5.3.50-CE/src/web/base/css/menu.css +++ /dev/null @@ -1,60 +0,0 @@ -.menuSection { - margin-top: 30px; -} -.menuSection table { - width: 100%; - margin: 0; - border: 0; - -} -.menuSection a, .menuSection span { - text-decoration: none; - color: #353535; - font-size: 90%; -} -.menuSection a.phplmselected { - font-weight: bold; -} -.treemenudiv { - display: block; - white-space: nowrap; - padding: 0 0 0 10px; -} - -.phplmnormal { - padding: 0; -} - -/* Setup headline (first config) */ -#setup_h1 { - text-align: center; - margin: 35px 0 0 0; -} - -/* styling for 1st item in both menu objects */ -#menu1_1, #menu2_1, #menuSection_queue_1{ - background: #ddd; - padding: 8px 20px 5px 13px; - -} -#menu1_1 a, #menu2_1 a, #menuSection_queue_1 a { - color: #353535; - font-family: "Arial Narrow",arial, verdana; - font-weight: normal; - font-size: 17px; -} -#menu1_1 img, #menu2_1 img, #menuSection_queue_1 img { - visibility: hidden; - display: none; -} - -#menu1_1 .glyphicons, #menu2_1 .glyphicons, #menuSection_queue_1 .glyphicons { - padding: 8px 0 5px 17px; -} - -/* Event counter */ -#Event_messages, #Queue_messages { - float:right; - text-align:right; - margin: 0 25px 0 0; -} diff --git a/openQRM-5.3.50-CE/src/web/base/css/openqrm-ui.css b/openQRM-5.3.50-CE/src/web/base/css/openqrm-ui.css deleted file mode 100644 index 539b554..0000000 --- a/openQRM-5.3.50-CE/src/web/base/css/openqrm-ui.css +++ /dev/null @@ -1,361 +0,0 @@ -html { - font-family: Arial, sans-serif; - font-size: 13px; -} - -hr { border-top-color: #ccc; } - - -/* text colors */ -.font-blue { color: #769cd3; } -.font-green { color: #2693b8; } -.font-orange { color: #FF8000; } -.font-red { color: #BA264B; } - -h1, h2, h3, h4, h5, h6 { - font-family: "Arial Narrow",arial, verdana; - color: #353535; - font-weight: normal; -} -h3, h4, h5, h6 { - line-height: 20px; - margin-top: 20px; -} - -code { - color: #353535; -} - - -/* modal dialog */ -.modal-overlay { - position: fixed; - top:0; - left:0; - bottom: 0; - right: 0; - width: 100%; - height:100%; - background: #999; - opacity:0.3; - z-index: 10000; -} -.modal-box { - position: fixed; - width: 350px; - height:150px; - padding: 20px 30px; - font-size:13px; - border: 8px solid #999; - background: #ffffff url(/openqrm/base/img/ajax-loader.gif) no-repeat center center; - text-align: center; - z-index: 10001; -} -.modal-box .ajax-loader { - margin: 20px auto; - z-index: 10002; -} - - -/* defaults */ -.justify { - text-align: justify; -} -.first { - margin-top: 0; - padding-top: 0; -} -.lead { - font-size: 16px; -} -.pull-left { - float: left; -} -.pull-right { - float: right; -} -.hidden { - display: none; - visibility: hidden; - line-height: 0; - font-size: 0; - margin: 0; - padding: 0; -} -.disabled { - opacity: .6; - cursor: default; -} - - -/* pills */ -.pill { - padding: 2px 8px; - color: #fff; - font-size: 10px; - line-height: 10px; - text-transform: uppercase; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background: #444; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - border-radius: 8px; -} -.pill a { color: #fff; text-decoration: none; } - -.pill.storage {} -.pill.virtualization {} -.pill.cloud {} -.pill.enterprise { background: #2693b8; } -.pill.deployment {} -.pill.network {} -.pill.ha {} -.pill.monitoring {} -.pill.management {} -.pill.misc {} -.pill.active { background: #3AE08A; color: black; } -.pill.idle { background: silver; color: black; } -.pill.inactive { background: #2693B8; } -.pill.warning { background: #f69437; } -.pill.error { - background: red; - color: #fff; /* override '.htmlobject_tabs_box .error', htmlobject.css:94 */ -} -.pill.acknowledged { background: green; } - -/* badge/pill colors */ -.pill.green, .pill.notice, .badge.green { background: #2693b8; } -.pill.red, .pill.error, .badge.red { background: #BA264B; } -.pill.orange, .pill.warning .badge.orange { background: #FF8000; } -.pill.yellow, .badge.yellow { background: #CCCC00; } - - -/* Common link classes */ -a.btn {} -a.badge {} -a.add {} -a.edit {} -a.details {} -a.console {} -a.resize {} -a.manage {} -a.migrate {} -a.clone {} -a.remove {} -a.snap {} -a.graphs {} -a.start {} -a.stop {} -a.enable {} -a.disable {} - -a.btn, -a.badge, .badge, -a.add, -a.edit, -a.details, -a.console, -a.resize, -a.manage, -a.migrate, -a.clone, -a.remove, -a.snap, -a.graphs, -a.start, -a.stop, -a.enable, -a.disable, -a.configure, -a.logout, -input.password-button, -input[type="submit"], -input[type="button"], -.submit, -.htmlobject_table .actiontable input, -.htmlobject_tabs li a, -.htmlobject_tabs li.current a { - display: inline-block; - cursor: pointer; - background: #999; - line-height: 17px; - font-family: arial, verdana; - font-size: 10px; - color: #fff; - text-decoration: none; - text-transform: uppercase; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - margin-right: 3px; - margin-bottom: 7px; - padding: 4px 8px; - border: 0; - white-space: nowrap; -} - -a:hover.btn, -a:hover.badge, -a:hover.add, -a:hover.edit, -a:hover.details, -a:hover.console, -a:hover.resize, -a:hover.manage, -a:hover.migrate, -a:hover.clone, -a:hover.remove, -a:hover.snap, -a:hover.graphs, -a:hover.start, -a:hover.stop, -a:hover.enable, -a:hover.disable, -input:hover.password-button, -input[type="submit"]:hover, -.submit:hover, -.htmlobject_table .actiontable input:hover, -.htmlobject_tabs li:hover a, -.htmlobject_tabs li:hover.current a { - opacity: 0.8; -} - -/* Quicklink buttons, use in dashboards - Supports: - * icons: (see glyphicons docs) - * button-label: label - * colored corner - top right with label -*/ -a.quicklink { - position: relative; - display: inline-block; - width: 90px; - height: 60px; - background: #e5e5e5; - border: 1px solid #c9c9c9; - text-align: center; - overflow: hidden; - -} -a.quicklink .label { - display: block; - clear: both; - text-align: center; - font-family: "Arial Narrow",arial, verdana; - font-weight: bold; - color: #444; - text-shadow: none; - text-transform: none; - font-size: 13px; -} -a.quicklink .glyphicons-icon { - opacity: 0.8; - text-align: center; - width: 40px; - height: 40px; -} -a.quicklink .corner { - position: absolute; - display: block; - top: -13px; - right: -3px; - width: 0; - height: 0; - border-top: 20px solid transparent; - border-bottom: 20px solid transparent; - border-right: 20px solid #444; - -webkit-transform: rotate(135deg); - -moz-transform: rotate(135deg); - transform: rotate(135deg); -} -a.quicklink .corner-orange { border-right: 20px solid #f07109; } -a.quicklink .corner-green { border-right: 20px solid #82c782; } -a.quicklink .corner-blue { border-right: 20px solid #769cd3; } -a.quicklink label { - position: absolute; - top: -2px; - right: 2px; - font-size: 10px; - letter-spacing: -1px; -} -a.logout { - width: 24px; - height: 24px; - line-height: 24px; - background: url('../img/logout.png') no-repeat center #999; - float: right; - margin: -2px 0 0 12px; - padding: 0; -} - - - -/* glyphicons customization */ -.glyphicons i:before { - font-size: 14px; -} - - -/* misc */ -.chart-bar { - position: relative; - display: block; - width: 90%; - height: 12px; - margin-top: 3px; - background: #e5e5e5; -} - -.chart-bar .bar { - position: absolute; - top: 0; - left: 0; - display: block; - width: 1%; - max-width: 90%; - height: 12px; - background: #454545; - margin: 0 30px 0 0; -} -.chart-bar .bar label { - position: absolute; - top: 0; - bottom: auto; - left: auto; - right: -30px; - font-size: 10px; - line-height: 12px; -} -.chart-bar .peak { - position: absolute; - background: #ff0000; - width: 1px; - height: 12px; - left: 0; -} - -.bar-01 .bar { background: #82c782; width: 0%; } -.bar-02 .bar { background: #f07109; width: 0%; } -.bar-03 .bar { background: #769cd3; width: 0%; } - -.doculink { - background: url(../img/help_small.png) no-repeat top right transparent; - line-height: 18px; - display: block; - margin: 0; - padding: 0 25px 0 0; - text-decoration: none; -} - -/* fix .lead and line-height when used in .table */ -.table .lead { - line-height: 20px; -} - -/* htmlobjects overrides */ -.htmlobject_tabs li.current a { - background: #39aacb; -} - diff --git a/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.eot b/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.eot deleted file mode 100644 index c73cdd8..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.eot and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.otf b/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.otf deleted file mode 100644 index b428a69..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.otf and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.svg b/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.svg deleted file mode 100644 index d84cf19..0000000 --- a/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.svg +++ /dev/null @@ -1,435 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.ttf b/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.ttf deleted file mode 100644 index 42d0591..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.ttf and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.woff b/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.woff deleted file mode 100644 index 6d892ed..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/fonts/glyphicons-regular.woff and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.eot b/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.eot deleted file mode 100644 index bd59ccd..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.eot and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.otf b/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.otf deleted file mode 100644 index b058f1c..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.otf and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.svg b/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.svg deleted file mode 100644 index 0fb4587..0000000 --- a/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.svg +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.ttf b/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.ttf deleted file mode 100644 index c63c068..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.ttf and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.woff b/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.woff deleted file mode 100644 index 4c778ff..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/fonts/glyphiconshalflings-regular.woff and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/active.png b/openQRM-5.3.50-CE/src/web/base/img/active.png deleted file mode 100644 index 94b9a47..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/active.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/active_small.png b/openQRM-5.3.50-CE/src/web/base/img/active_small.png deleted file mode 100644 index 816a9c9..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/active_small.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/add.png b/openQRM-5.3.50-CE/src/web/base/img/add.png deleted file mode 100644 index d72c64d..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/add.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/ajax-loader.gif b/openQRM-5.3.50-CE/src/web/base/img/ajax-loader.gif deleted file mode 100644 index e5ddc57..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/ajax-loader.gif and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/appliance.png b/openQRM-5.3.50-CE/src/web/base/img/appliance.png deleted file mode 100644 index ec8c184..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/appliance.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/auth.png b/openQRM-5.3.50-CE/src/web/base/img/auth.png deleted file mode 100644 index bd2d50b..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/auth.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/background.png b/openQRM-5.3.50-CE/src/web/base/img/background.png deleted file mode 100644 index 6371f54..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/background.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/clone.png b/openQRM-5.3.50-CE/src/web/base/img/clone.png deleted file mode 100644 index 163a104..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/clone.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/close.png b/openQRM-5.3.50-CE/src/web/base/img/close.png deleted file mode 100644 index 112f1ca..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/close.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/cloud.png b/openQRM-5.3.50-CE/src/web/base/img/cloud.png deleted file mode 100644 index 1ffffe9..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/cloud.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/console.png b/openQRM-5.3.50-CE/src/web/base/img/console.png deleted file mode 100644 index 218569a..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/console.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/conten_bg.gif b/openQRM-5.3.50-CE/src/web/base/img/conten_bg.gif deleted file mode 100644 index c872b9c..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/conten_bg.gif and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/datacenter.png b/openQRM-5.3.50-CE/src/web/base/img/datacenter.png deleted file mode 100644 index 483b39e..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/datacenter.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/de.gif b/openQRM-5.3.50-CE/src/web/base/img/de.gif deleted file mode 100644 index 10df61c..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/de.gif and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/deployment.png b/openQRM-5.3.50-CE/src/web/base/img/deployment.png deleted file mode 100644 index be00fea..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/deployment.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/disable.png b/openQRM-5.3.50-CE/src/web/base/img/disable.png deleted file mode 100644 index 294e5c1..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/disable.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/down.png b/openQRM-5.3.50-CE/src/web/base/img/down.png deleted file mode 100644 index 7cd0571..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/down.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/dummy-chart.png b/openQRM-5.3.50-CE/src/web/base/img/dummy-chart.png deleted file mode 100644 index a4c97c9..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/dummy-chart.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/edit.png b/openQRM-5.3.50-CE/src/web/base/img/edit.png deleted file mode 100644 index 7d241bf..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/edit.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/en.gif b/openQRM-5.3.50-CE/src/web/base/img/en.gif deleted file mode 100644 index cc372f7..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/en.gif and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/enable.png b/openQRM-5.3.50-CE/src/web/base/img/enable.png deleted file mode 100644 index ec9bbd7..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/enable.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/enterprise.png b/openQRM-5.3.50-CE/src/web/base/img/enterprise.png deleted file mode 100644 index 2283da4..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/enterprise.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/error.png b/openQRM-5.3.50-CE/src/web/base/img/error.png deleted file mode 100644 index 0a0e82d..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/error.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/error_small.png b/openQRM-5.3.50-CE/src/web/base/img/error_small.png deleted file mode 100644 index f64b8ef..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/error_small.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/export.png b/openQRM-5.3.50-CE/src/web/base/img/export.png deleted file mode 100644 index 9ae7349..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/export.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/favicon.ico b/openQRM-5.3.50-CE/src/web/base/img/favicon.ico deleted file mode 100644 index 2bdd231..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/favicon.ico and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/filepicker_icons.gif b/openQRM-5.3.50-CE/src/web/base/img/filepicker_icons.gif deleted file mode 100644 index 3459dba..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/filepicker_icons.gif and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/glyphicons-white.png b/openQRM-5.3.50-CE/src/web/base/img/glyphicons/glyphicons-white.png deleted file mode 100644 index 327f949..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/glyphicons-white.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/glyphicons-white.svg b/openQRM-5.3.50-CE/src/web/base/img/glyphicons/glyphicons-white.svg deleted file mode 100644 index a2be78a..0000000 --- a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/glyphicons-white.svg +++ /dev/null @@ -1,4259 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/glyphicons.png b/openQRM-5.3.50-CE/src/web/base/img/glyphicons/glyphicons.png deleted file mode 100644 index 68fe6a5..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/glyphicons.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/glyphicons.svg b/openQRM-5.3.50-CE/src/web/base/img/glyphicons/glyphicons.svg deleted file mode 100644 index a05dbd2..0000000 --- a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/glyphicons.svg +++ /dev/null @@ -1,4157 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/halflings/glyphicons_halflings-white.png b/openQRM-5.3.50-CE/src/web/base/img/glyphicons/halflings/glyphicons_halflings-white.png deleted file mode 100644 index 3889213..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/halflings/glyphicons_halflings-white.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/halflings/glyphicons_halflings-white.svg b/openQRM-5.3.50-CE/src/web/base/img/glyphicons/halflings/glyphicons_halflings-white.svg deleted file mode 100644 index 12fc444..0000000 --- a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/halflings/glyphicons_halflings-white.svg +++ /dev/null @@ -1,1119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/halflings/glyphicons_halflings.png b/openQRM-5.3.50-CE/src/web/base/img/glyphicons/halflings/glyphicons_halflings.png deleted file mode 100644 index 525b26d..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/halflings/glyphicons_halflings.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/halflings/glyphicons_halflings.svg b/openQRM-5.3.50-CE/src/web/base/img/glyphicons/halflings/glyphicons_halflings.svg deleted file mode 100644 index e519298..0000000 --- a/openQRM-5.3.50-CE/src/web/base/img/glyphicons/halflings/glyphicons_halflings.svg +++ /dev/null @@ -1,1119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/openQRM-5.3.50-CE/src/web/base/img/ha.png b/openQRM-5.3.50-CE/src/web/base/img/ha.png deleted file mode 100644 index 7f557fa..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/ha.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/header_dropShadow.png b/openQRM-5.3.50-CE/src/web/base/img/header_dropShadow.png deleted file mode 100644 index 6610929..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/header_dropShadow.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/help.png b/openQRM-5.3.50-CE/src/web/base/img/help.png deleted file mode 100644 index 2f9817d..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/help.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/help_small.png b/openQRM-5.3.50-CE/src/web/base/img/help_small.png deleted file mode 100644 index cc2ec66..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/help_small.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/html-tabs-fix.png b/openQRM-5.3.50-CE/src/web/base/img/html-tabs-fix.png deleted file mode 100644 index 8fac0ee..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/html-tabs-fix.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/idle.png b/openQRM-5.3.50-CE/src/web/base/img/idle.png deleted file mode 100644 index 2233b06..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/idle.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/image.png b/openQRM-5.3.50-CE/src/web/base/img/image.png deleted file mode 100644 index 5f5f2c7..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/image.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/import.png b/openQRM-5.3.50-CE/src/web/base/img/import.png deleted file mode 100644 index 635091d..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/import.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/kernel.png b/openQRM-5.3.50-CE/src/web/base/img/kernel.png deleted file mode 100644 index 07a55c0..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/kernel.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/loading.gif b/openQRM-5.3.50-CE/src/web/base/img/loading.gif deleted file mode 100644 index 1c72ebb..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/loading.gif and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/logo.png b/openQRM-5.3.50-CE/src/web/base/img/logo.png deleted file mode 100644 index 708c677..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/logo.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/logout.png b/openQRM-5.3.50-CE/src/web/base/img/logout.png deleted file mode 100644 index 683d838..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/logout.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/mail.png b/openQRM-5.3.50-CE/src/web/base/img/mail.png deleted file mode 100644 index 5420df9..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/mail.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/manage.png b/openQRM-5.3.50-CE/src/web/base/img/manage.png deleted file mode 100644 index 5e26e7c..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/manage.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/menu-background.png b/openQRM-5.3.50-CE/src/web/base/img/menu-background.png deleted file mode 100644 index 304f9de..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/menu-background.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/migrate.png b/openQRM-5.3.50-CE/src/web/base/img/migrate.png deleted file mode 100644 index 163a104..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/migrate.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/monitoring.png b/openQRM-5.3.50-CE/src/web/base/img/monitoring.png deleted file mode 100644 index d4028dc..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/monitoring.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/off.png b/openQRM-5.3.50-CE/src/web/base/img/off.png deleted file mode 100644 index 2a23a11..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/off.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/off_small.png b/openQRM-5.3.50-CE/src/web/base/img/off_small.png deleted file mode 100644 index c621292..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/off_small.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/page-background.gif b/openQRM-5.3.50-CE/src/web/base/img/page-background.gif deleted file mode 100644 index 0990486..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/page-background.gif and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/plugin.png b/openQRM-5.3.50-CE/src/web/base/img/plugin.png deleted file mode 100644 index 97b61a4..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/plugin.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/progress.gif b/openQRM-5.3.50-CE/src/web/base/img/progress.gif deleted file mode 100644 index 1c72ebb..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/progress.gif and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/resize.png b/openQRM-5.3.50-CE/src/web/base/img/resize.png deleted file mode 100644 index 642a21a..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/resize.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/resource.png b/openQRM-5.3.50-CE/src/web/base/img/resource.png deleted file mode 100644 index 5cc8bb5..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/resource.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/snapshot.png b/openQRM-5.3.50-CE/src/web/base/img/snapshot.png deleted file mode 100644 index 0b43c49..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/snapshot.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/spacer.gif b/openQRM-5.3.50-CE/src/web/base/img/spacer.gif deleted file mode 100644 index 68b18e3..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/spacer.gif and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/start.png b/openQRM-5.3.50-CE/src/web/base/img/start.png deleted file mode 100644 index 972c313..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/start.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/stop.png b/openQRM-5.3.50-CE/src/web/base/img/stop.png deleted file mode 100644 index 6659872..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/stop.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/storage.png b/openQRM-5.3.50-CE/src/web/base/img/storage.png deleted file mode 100644 index 4f1580e..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/storage.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/support.png b/openQRM-5.3.50-CE/src/web/base/img/support.png deleted file mode 100644 index e19d860..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/support.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/support_small.png b/openQRM-5.3.50-CE/src/web/base/img/support_small.png deleted file mode 100644 index 535fcf8..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/support_small.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/time.png b/openQRM-5.3.50-CE/src/web/base/img/time.png deleted file mode 100644 index a4417d7..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/time.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/top_pageBgr.png b/openQRM-5.3.50-CE/src/web/base/img/top_pageBgr.png deleted file mode 100644 index ed92bcc..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/top_pageBgr.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/transition.png b/openQRM-5.3.50-CE/src/web/base/img/transition.png deleted file mode 100644 index 4147b5e..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/transition.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/transition_small.png b/openQRM-5.3.50-CE/src/web/base/img/transition_small.png deleted file mode 100644 index da45bac..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/transition_small.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/unknown.png b/openQRM-5.3.50-CE/src/web/base/img/unknown.png deleted file mode 100644 index fbeec42..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/unknown.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/up.png b/openQRM-5.3.50-CE/src/web/base/img/up.png deleted file mode 100644 index 3f0b365..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/up.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/user.png b/openQRM-5.3.50-CE/src/web/base/img/user.png deleted file mode 100644 index e952cbc..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/user.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/user_small.png b/openQRM-5.3.50-CE/src/web/base/img/user_small.png deleted file mode 100644 index c770a17..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/user_small.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/img/virtualization.png b/openQRM-5.3.50-CE/src/web/base/img/virtualization.png deleted file mode 100644 index 0026b9f..0000000 Binary files a/openQRM-5.3.50-CE/src/web/base/img/virtualization.png and /dev/null differ diff --git a/openQRM-5.3.50-CE/src/web/base/include/htmlobject.inc.php b/openQRM-5.3.50-CE/src/web/base/include/htmlobject.inc.php deleted file mode 100644 index eefb7d8..0000000 --- a/openQRM-5.3.50-CE/src/web/base/include/htmlobject.inc.php +++ /dev/null @@ -1,423 +0,0 @@ - -*/ - -$ClassDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/class/'; - -require_once($ClassDir."htmlobject.http.class.php"); -require_once($ClassDir."htmlobject.class.php"); -require_once($ClassDir."htmlobject.head.class.php"); -require_once($ClassDir."htmlobject.tabmenu.class.php"); -require_once($ClassDir."htmlobject.table.class.php"); -require_once($ClassDir."htmlobject.preloader.class.php"); -require_once($ClassDir."htmlobject.form.class.php"); -require_once($ClassDir."htmlobject.debug.class.php"); -require_once($ClassDir."regex.class.php"); -require_once($ClassDir."PHPLIB.php"); - -//--------------------------------------------------------------- -/** -* builds html input box -* @access public -* @param $name string -* @param $value array(array(label=>, value=>)) -* @param $type enum(text,hidden,password,checkbox) -* @param $maxlength int -* @return string -*/ -function htmlobject_input($name, $value, $type = 'text', $arg = '') { - - $html = new htmlobject_input(); - $html->name = $name; - $html->id = 'p'.uniqid(); - $html->value = $value['value']; - $html->title = $value['label']; - $html->type = $type; - - switch($type) { - case 'text': - case 'password': - $html->maxlength = $arg; - return htmlobject_box_from_object($html, ' input'); - break; - case 'checkbox': - $html->value = ''; - $html->checked = $arg; - return htmlobject_box_from_object($html, ' checkbox'); - break; - case 'hidden': - $html->title = ''; - $html->id = ''; - return $html->get_string(); - break; - default: - return $html->get_string(); - break; - } -} -//--------------------------------------------------------------- -/** -* builds html select box -* @access public -* @param $name string -* @param $value array(label=>, value=>) -* @param $title string -* @param $selected array() -* @return string -*/ -function htmlobject_select($name, $value, $title = '', $selected = array()) { - - $html = new htmlobject_select(); - $html->id = 'p'.uniqid(); - $html->name = $name; - $html->title = $title; - $html->selected = $selected; - $html->text_index = array("value" => "value", "text" => "label"); - $html->text = $value; - - return htmlobject_box_from_object($html, ' select'); -} -//--------------------------------------------------------------- -/** -* builds html select -* @access public -* @param $name string -* @param $value array(label=>, value=>) -* @param $title string -* @param $selected array() -* @return string -*/ -function htmlobject_select_simple($name, $value, $title = '', $selected = '') { - $html = new htmlobject_select(); - $html->name = $name; - $html->title = $title; - $html->selected = $selected; - $html->text_index = array("value" => "value", "text" => "label"); - $html->text = $value; - return $html->get_string(); -} -//--------------------------------------------------------------- -/** -* builds html textarea box -* @access public -* @param $name string -* @param $value array(label=>, value=>) -* @return string -*/ -function htmlobject_textarea($name, $value) { - - $html = new htmlobject_textarea(); - $html->id = 'p'.uniqid(); - $html->name = $name; - $html->title = $value['label']; - $html->text = $value['value']; - - return htmlobject_box_from_object($html, ' textarea'); -} -//--------------------------------------------------------------- -/** -* builds tabmenu -* @access public -* @param $value array(array((label=>, value=>)) -* @return string -*/ -function htmlobject_tabmenu($value) { - - $tabmenu = new htmlobject_tabmenu($value); - $tabmenu->prefix_tab = 'tab'; - $tabmenu->css = 'htmlobject_tabs'; - - /* - $i = 0; - foreach ($value as $val) { - $html = new htmlobject_div(); - $html->id = 'tab'.$i; - $html->css = 'htmlobject_tab_box'; - $html->title = $val['label']; - $html->text = $val['value']; - $tabmenu->add($html); - $i++; - } - */ - - return $tabmenu->get_string(); -} -//--------------------------------------------------------------- -/** -* builds htmlbox from object -* object must be htmlobject -* @access public -* @param $html object -* @return string -*/ -function htmlobject_box_from_object($html, $css='', $usetitle = true) { - - $box = new htmlobject_box(); - $box->id = 'htmlobject_box_'. $html->name; - $box->css = 'htmlobject_box'.$css; - $box->label = $html->title; - $box->content = $html; - - if($usetitle === false) { - $html->title = ''; - } - - return $box->get_string(); -} -//--------------------------------------------------------------- -/** -* builds html radio box -* @access public -* @param $name string -* @param $value array(label=>, value=>) -* @param $checked string -* @return string -*/ -function htmlobject_radio_list($name, $value, $title = '', $checked = '') { - $_strReturn = ''; - - $i = 0; - foreach ($value as $val) { - $html = new htmlobject_input(); - $html->type = 'radio'; - $html->id = 'p'.uniqid(); - $html->name = $name; - $html->title = $val['label']; - if($checked == $val['value']) { - $html->checked = true; - } - $html->value = $val['value']; - $_strReturn .= htmlobject_box_from_object($html, ' radio'); - - $i++; - } - - $html = new htmlobject_div(); - $html->name = ''; - $html->title = $title; - $html->text = $_strReturn; - - $_strReturn = htmlobject_box_from_object($html, ' outerbox', false); - - return $_strReturn; -} -//--------------------------------------------------------------- -/** -* builds html table -* @access public -* @param $name string -* @param $value array(array(label=>, value=>, ...) -* @param $mode enum(object,string) -* @return string -*/ -function htmlobject_table($id, $value, $mode = 'object') { - $_strReturn = ''; - - $table = new htmlobject_table(); - $table->id = $id; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 0; - - $i = 0; - if($mode == 'object') { - foreach ($value as $val) { - $tr = new htmlobject_tr(); - foreach($val as $key => $v) { - $td = new htmlobject_td(); - $td->css = $key; - $td->text = $v; - $tr->add($td); - } - $table->add($tr); - } - } - if($mode == 'string') { - $tr = ''; - foreach ($value as $val) { - $tr .= $val; - } - $table->add($tr); - } - - return $table->get_string(); -} -//--------------------------------------------------------------- -/** -* builds head of Page -* @access public -* @param $title string -* @return string -*/ -function htmlobject_head($title = '', $timer = '', $url = '') { - - $html = new htmlobject_head(); - $html->add_meta('content-language','en'); - $html->add_meta('content-type','text/html; charset=utf-8'); - $html->add_meta('expires','Sat, 01 Dec 2001 00:00:00 GMT'); - $html->add_meta('cache-control','no-cache'); - $html->add_meta('pragma','no-cache'); - if($timer != '' && $url != '') { - $html->add_meta('refresh', $timer.'; URL='.$url); - } - $html->add_style('../../css/htmlobject.css'); - $html->title = $title; - - return $html->get_string(); -} -//--------------------------------------------------------------- -function htmlobject_request($arg) { - if (isset($_REQUEST[$arg])) - return $_REQUEST[$arg]; - else - return ''; -} - -function error_redirect($strMsg = '') { - global $thisfile; - $args = '?strMsg=Error:
    '.$strMsg; - foreach($_POST as $key => $value) { - if($key != 'action') { - - if(is_array($value)) { - foreach($value as $key1 => $value1) { - $args .= '&'.$key.'[]='.$value1; - } - } else { - $args .= '&'.$key.'='.$value; - } - } - } - foreach($_GET as $key => $value) { - if($key != 'action') { - - if(is_array($value)) { - foreach($value as $key1 => $value1) { - $args .= '&'.$key.'[]='.$value1; - } - } else { - $args .= '&'.$key.'='.$value; - } - } - } - return $thisfile.$args; -} - - - - - -class htmlobject_db_table extends htmlobject_table_builder -{ - function htmlobject_db_table($field = '', $order = '', $limit = '') { - parent::htmlobject_table_builder($field, $order, $limit); - } -} - -class htmlobject_table_identifiers_checked extends htmlobject_table_builder -{ - - var $_identifiers = array(); - - function get_indentifier($key, $ident) { - if($this->identifier != '') { - $html = new htmlobject_input(); - $html->id = $ident; - $html->name = 'identifier[]'; - $html->value = $this->body[$key][$this->identifier]; - $html->type = 'hidden'; - - $this->_identifiers[] = $html->get_string(); - } - } - - function get_table_head() { - $tr = ''; - if(count($this->head) > 0) { - $tr = new htmlobject_tr(); - $tr->css = 'htmlobject_tr'; - $tr->id = 'tr_'. uniqid(); - - foreach($this->head as $key_2 => $value) { - if($value['title'] == '') { $value['title'] = ' '; } - $td = new htmlobject_td(); - $td->type = 'th'; - $td->css = 'htmlobject_td '.$key_2; - $td->text = $value['title']; - $tr->add($td); - } - } - return $tr; - } - - function get_table_bottom () { - $tr = ''; - if(isset($this->bottom[0])) { - $tr = new htmlobject_tr(); - $tr->css = 'htmlobject_tr'; - $tr->id = 'tr_'. uniqid(); - - $td = new htmlobject_td(); - $td->colspan = $this->_num_cols; - $td->type = 'td'; - $td->css = 'htmlobject_td bottom'; - $str = ''; - foreach($this->bottom as $key_2 => $v) { - $html = new htmlobject_input(); - $html->name = 'action'; - $html->value = $v; - $html->type = 'submit'; - $str .= $html->get_string(); - } - $str .= join("", $this->_identifiers); - $td->text = $str; - $tr->add($td); - } - return $tr; - } -} -class htmlobject_table_identifiers_radio extends htmlobject_table_builder -{ - function htmlobject_table_identifiers_radio($field = '', $order = '', $limit = '') { - parent::htmlobject_table_builder($field, $order, $limit); - } - - //---------------------------------------------------------------------------------------- - /** - * returns JS for tr hover and click function - * @access public - * @return string - */ - //---------------------------------------------------------------------------------------- - function get_js() { - $_strReturn = ''; - $_strReturn .= "\n"; - $_strReturn .= ''."\n"; - return $_strReturn; - } -} - - - diff --git a/openQRM-5.3.50-CE/src/web/base/include/openqrm-database-functions.php b/openQRM-5.3.50-CE/src/web/base/include/openqrm-database-functions.php deleted file mode 100644 index 35473ca..0000000 --- a/openQRM-5.3.50-CE/src/web/base/include/openqrm-database-functions.php +++ /dev/null @@ -1,310 +0,0 @@ - -*/ - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once ($RootDir.'include/openqrm-server-config.php'); - -if (isset($OPENQRM_ORACLE_HOME)) { - PutEnv("LD_LIBRARY_PATH=$OPENQRM_LD_LIBRARY_PATH"); - PutEnv("ORACLE_HOME=$OPENQRM_ORACLE_HOME"); - PutEnv("TNS_ADMIN=$OPENQRM_TNS_ADMIN"); -} - -if (!defined("ADODB_ASSOC_CASE")) { - define('ADODB_ASSOC_CASE',0); -} -// different locations of adodb for suse/redhat/debian -if (file_exists('/usr/share/php/adodb/adodb.inc.php')) { - require_once ('/usr/share/php/adodb/adodb.inc.php'); -} else if (file_exists($RootDir.'include/adodb/adodb.inc.php')) { - require_once ($RootDir.'include/adodb/adodb.inc.php'); -} else if (file_exists('/usr/share/adodb/adodb.inc.php')) { - require_once ('/usr/share/adodb/adodb.inc.php'); -} else { - echo 'ERROR: Could not find adodb on this system!'; -} - - -global $OPENQRM_DATABASE_TYPE, $OPENQRM_DATABASE_USER; -$IMAGE_INFO_TABLE="image_info"; -$DEPLOYMENT_INFO_TABLE="deployment_info"; -$KERNEL_INFO_TABLE="kernel_info"; -$RESOURCE_INFO_TABLE="resource_info"; -$EVENT_INFO_TABLE="event_info"; -$USER_INFO_TABLE="user_info"; -$APPLIANCE_INFO_TABLE="appliance_info"; -$VIRTUALIZATION_INFO_TABLE="virtualization_info"; -$IMAGE_AUTHENTICATION_TABLE="image_authentication_info"; -$STORAGE_INFO_TABLE="storage_info"; -if ("$OPENQRM_DATABASE_TYPE" == "db2") { - $IMAGE_INFO_TABLE="$OPENQRM_DATABASE_USER.$IMAGE_INFO_TABLE"; - $DEPLOYMENT_INFO_TABLE="$OPENQRM_DATABASE_USER.$DEPLOYMENT_INFO_TABLE"; - $KERNEL_INFO_TABLE="$OPENQRM_DATABASE_USER.$KERNEL_INFO_TABLE"; - $RESOURCE_INFO_TABLE="$OPENQRM_DATABASE_USER.$RESOURCE_INFO_TABLE"; - $EVENT_INFO_TABLE="$OPENQRM_DATABASE_USER.$EVENT_INFO_TABLE"; - $USER_INFO_TABLE="$OPENQRM_DATABASE_USER.$USER_INFO_TABLE"; - $APPLIANCE_INFO_TABLE="$OPENQRM_DATABASE_USER.$APPLIANCE_INFO_TABLE"; - $VIRTUALIZATION_INFO_TABLE="$OPENQRM_DATABASE_USER.$VIRTUALIZATION_INFO_TABLE"; - $IMAGE_AUTHENTICATION_TABLE="$OPENQRM_DATABASE_USER.$IMAGE_AUTHENTICATION_TABLE"; - $STORAGE_INFO_TABLE="$OPENQRM_DATABASE_USER.$STORAGE_INFO_TABLE"; - -} - -define('IMAGE_INFO_TABLE', $IMAGE_INFO_TABLE); -define('DEPLOYMENT_INFO_TABLE', $DEPLOYMENT_INFO_TABLE); -define('KERNEL_INFO_TABLE', $KERNEL_INFO_TABLE); -define('RESOURCE_INFO_TABLE', $RESOURCE_INFO_TABLE); -define('EVENT_INFO_TABLE', $EVENT_INFO_TABLE); -define('USER_INFO_TABLE', $USER_INFO_TABLE); -define('APPLIANCE_INFO_TABLE', $APPLIANCE_INFO_TABLE); -define('VIRTUALIZATION_INFO_TABLE', $VIRTUALIZATION_INFO_TABLE); -define('IMAGE_AUTHENTICATION_TABLE', $IMAGE_AUTHENTICATION_TABLE); -define('STORAGE_INFO_TABLE', $STORAGE_INFO_TABLE); - -global $KERNEL_INFO_TABLE, $IMAGE_INFO_TABLE, $RESOURCE_INFO_TABLE, $EVENT_INFO_TABLE, $USER_INFO_TABLE, $DEPLOYMENT_INFO_TABLE, $APPLIANCE_INFO_TABLE, $STORAGE_INFO_TABLE, $VIRTUALIZATION_INFO_TABLE, $IMAGE_AUTHENTICATION_TABLE; - - -// returns a db-connection -function openqrm_get_db_connection() { - $openqrm_db = new openqrm_db(); - return $openqrm_db; -} - - - -class openqrm_db { - - function __construct() { - // to get lowercase column name form e.g. oracle - global $OPENQRM_DATABASE_TYPE; - global $OPENQRM_DATABASE_SERVER; - global $OPENQRM_DATABASE_NAME; - global $OPENQRM_DATABASE_USER; - global $OPENQRM_DATABASE_PASSWORD; - - if ("$OPENQRM_DATABASE_TYPE" == "db2") { - $db = ADONewConnection('odbc'); - $db->PConnect($OPENQRM_DATABASE_NAME,$OPENQRM_DATABASE_USER,$OPENQRM_DATABASE_PASSWORD); - $db->SetFetchMode(ADODB_FETCH_ASSOC); - return $db; - - } else if ("$OPENQRM_DATABASE_TYPE" == "oracle") { - // we need to use the oci8po driver because it is the - // only oracle driver supporting to set the column-names to lowercase - // via define('ADODB_ASSOC_CASE',0); - $db = NewADOConnection("oci8po"); - $db->Connect($OPENQRM_DATABASE_NAME, $OPENQRM_DATABASE_USER, $OPENQRM_DATABASE_PASSWORD); - - } else { - // use mysqli connector for adodb - if ("$OPENQRM_DATABASE_TYPE" == "mysql") { - $OPENQRM_DATABASE_TYPE="mysqli"; - } - if (strlen($OPENQRM_DATABASE_PASSWORD)) { - $dsn = "$OPENQRM_DATABASE_TYPE://$OPENQRM_DATABASE_USER:$OPENQRM_DATABASE_PASSWORD@$OPENQRM_DATABASE_SERVER/$OPENQRM_DATABASE_NAME?persist"; - } else { - $dsn = "$OPENQRM_DATABASE_TYPE://$OPENQRM_DATABASE_USER@$OPENQRM_DATABASE_SERVER/$OPENQRM_DATABASE_NAME?persist"; - } - $db = ADONewConnection($dsn); -# $db = adoNewConnection($dsn); - } - - // to get the column names in the resulting array - $db->SetFetchMode(ADODB_FETCH_ASSOC); - $this->db = $db; - - $this->ha = false; - - } - - - - - function get_ha_db() { - // to get lowercase column name form e.g. oracle - global $OPENQRM_DATABASE_TYPE; - global $OPENQRM_DATABASE_SERVER; - global $OPENQRM_DATABASE_NAME; - global $OPENQRM_DATABASE_USER; - global $OPENQRM_DATABASE_PASSWORD; - - -// DEBUG - -$OPENQRM_HA_DATABASE_SERVER = "192.168.88.249"; - - - if ("$OPENQRM_DATABASE_TYPE" == "db2") { - $ha_db = ADONewConnection('odbc'); - $ha_db->PConnect($OPENQRM_DATABASE_NAME,$OPENQRM_DATABASE_USER,$OPENQRM_DATABASE_PASSWORD); - $ha_db->SetFetchMode(ADODB_FETCH_ASSOC); - return $ha_db; - - } else if ("$OPENQRM_DATABASE_TYPE" == "oracle") { - // we need to use the oci8po driver because it is the - // only oracle driver supporting to set the column-names to lowercase - // via define('ADODB_ASSOC_CASE',0); - $ha_db = NewADOConnection("oci8po"); - $ha_db->Connect($OPENQRM_DATABASE_NAME, $OPENQRM_DATABASE_USER, $OPENQRM_DATABASE_PASSWORD); - - } else { - if (strlen($OPENQRM_DATABASE_PASSWORD)) { - $ha_dsn = "$OPENQRM_DATABASE_TYPE://$OPENQRM_DATABASE_USER:$OPENQRM_DATABASE_PASSWORD@$OPENQRM_HA_DATABASE_SERVER/openqrm?persist"; - } else { - $ha_dsn = "$OPENQRM_DATABASE_TYPE://$OPENQRM_DATABASE_USER@$OPENQRM_HA_DATABASE_SERVER/openqrm?persist"; - } - $ha_db = ADONewConnection($ha_dsn); - } - - // to get the column names in the resulting array - $ha_db->SetFetchMode(ADODB_FETCH_ASSOC); - return $ha_db; - } - - - - - - - function GetAll($sql) { - return $this->db->GetAll($sql); - } - - function SelectLimit($sql, $limit = NULL, $offset = NULL) { - return $this->db->SelectLimit($sql, $limit, $offset); - } - - function SetFetchMode($mode) { - $this->db->SetFetchMode($mode); - } - - - - function Execute($sql) { - $ret = $this->db->Execute($sql); - if ($this->ha) { - $ha_db = $this->get_ha_db(); - $ha_db->Execute($sql); - } - return $ret; - } - - function AutoExecute($table, $fields, $mode, $clause = NULL) { - if (isset($clause)) { - $ret = $this->db->AutoExecute($table, $fields, $mode, $clause); - if ($this->ha) { - $ha_db = $this->get_ha_db(); - $ha_db->AutoExecute($table, $fields, $mode, $clause); - } - return $ret; - } else { - $ret = $this->db->AutoExecute($table, $fields, $mode); - if ($this->ha) { - $ha_db = $this->get_ha_db(); - $ha_db->AutoExecute($table, $fields, $mode); - } - return $ret; - } - } - - - function Close() { - $this->db->Close(); - } - - - function ErrorMsg() { - $this->db->ErrorMsg(); - } - -} - - - - - - - - -// function to print arrays -function print_array($item, $key) { - if (!is_int($key)) { - echo "$key=\"$item\"\n"; - } -} - -//----------------------------------------------------------------------------------- -function openqrm_db_get_free_id($fieldname, $tablename) { - - $db=openqrm_get_db_connection(); - $recordSet = $db->Execute("select $fieldname from $tablename"); - if (!$recordSet) - print $db->ErrorMsg(); - else { - $ar_ids = array(); - - while ($arr = $recordSet->FetchRow()) { - foreach($arr as $val) { - $ar_ids[] = $val; - } - } - - $i=1; - while($i > 0) { - if(in_array($i, $ar_ids) == false) { - return $i; - break; - } - $i++; - } - } - $db->Close(); -} -//----------------------------------------------------------------------------------- -function openqrm_db_get_result($query) { - $ar = array(); - $db = openqrm_get_db_connection(); - $db->SetFetchMode(ADODB_FETCH_ASSOC); - $result = $db->Execute($query); - if(is_object($result)) { - while ($arr = $result->FetchRow()) { - $tmp = array(); - foreach ($arr as $key=>$val) { - if(is_string($key)) { - $tmp[] = array("value" => $val, "label" => $key); - } - } - $ar[] = $tmp; - } - } - return $ar; -} -//----------------------------------------------------------------------------------- -function openqrm_db_get_result_single ($query) { - $result = openqrm_db_get_result($query); - if(isset($result[0][0]["value"])) { - return array("value" => $result[0][0]["value"], "label" => $result[0][0]["label"]); - } -} -//----------------------------------------------------------------------------------- -function openqrm_db_get_result_double ($query) { - $ar_Return = array(); - $result = openqrm_db_get_result($query); - foreach ( $result as $res) { - $ar_Return[] = array("value" => $res[0]["value"], "label" => $res[1]["value"]); - } - return $ar_Return; -} diff --git a/openQRM-5.3.50-CE/src/web/base/include/openqrm-server-config.php b/openQRM-5.3.50-CE/src/web/base/include/openqrm-server-config.php deleted file mode 100644 index e17268b..0000000 --- a/openQRM-5.3.50-CE/src/web/base/include/openqrm-server-config.php +++ /dev/null @@ -1,51 +0,0 @@ - -*/ - -if ((file_exists("/etc/init.d/openqrm")) && (is_link("/etc/init.d/openqrm"))) { - $OPENQRM_BASE_DIR=dirname(dirname(dirname(dirname(readlink("/etc/init.d/openqrm"))))); -} else { - $OPENQRM_BASE_DIR="/usr/share"; -} -$OPENQRM_SERVER_CONFIG_FILE="$OPENQRM_BASE_DIR/openqrm/etc/openqrm-server.conf"; - - -// function to get infos from the openqrm-server.conf -function openqrm_parse_conf ( $filepath ) { - $ini = file( $filepath ); - if ( count( $ini ) == 0 ) { return array(); } - $sections = array(); - $values = array(); - $globals = array(); - $i = 0; - foreach( $ini as $line ){ - $line = trim( $line ); - // Comments - if ( $line == '' || $line[0] != 'O' ) { continue; } - // Key-value pair - list( $key, $value ) = explode( '=', $line, 2 ); - $key = trim( $key ); - $value = trim( $value ); - $value = str_replace("\"", "", $value ); - $globals[ $key ] = $value; - } - return $globals; -} - - -$store = openqrm_parse_conf($OPENQRM_SERVER_CONFIG_FILE); -extract($store); -global $OPENQRM_SERVER_CONFIG_FILE; - diff --git a/openQRM-5.3.50-CE/src/web/base/include/requestfilter.inc.php b/openQRM-5.3.50-CE/src/web/base/include/requestfilter.inc.php deleted file mode 100644 index 9d767b9..0000000 --- a/openQRM-5.3.50-CE/src/web/base/include/requestfilter.inc.php +++ /dev/null @@ -1,20 +0,0 @@ - '/(&#*\w+)[\x00-\x20]+;/u', 'replace' => '$1;'), - array ( 'pattern' => '/(&#x*[0-9A-F]+);*/iu', 'replace' => '$1;'), - // Remove any attribute starting with "on" or xmlns - array ( 'pattern' => '#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', 'replace' => '$1>'), - // Remove javascript: and vbscript: protocols - array ( 'pattern' => '#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', 'replace' => '$1=$2nojavascript...'), - array ( 'pattern' => '#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', 'replace' => '$1=$2novbscript...'), - array ( 'pattern' => '#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', 'replace' => '$1=$2nomozbinding...'), - // Only works in IE: - array ( 'pattern' => '#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', 'replace' => '$1>'), - array ( 'pattern' => '#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', 'replace' => '$1>'), - array ( 'pattern' => '#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#iu', 'replace' => '$1>'), - // Remove namespaced elements (we do not need them) - array ( 'pattern' => '#]*+>#i', 'replace' => ''), - // Remove really unwanted tags - array ( 'pattern' => '#]*+>#i', 'replace' => '') -); diff --git a/openQRM-5.3.50-CE/src/web/base/include/user.inc.php b/openQRM-5.3.50-CE/src/web/base/include/user.inc.php deleted file mode 100644 index 51ef5a6..0000000 --- a/openQRM-5.3.50-CE/src/web/base/include/user.inc.php +++ /dev/null @@ -1,42 +0,0 @@ - -*/ - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once( $RootDir.'/include/openqrm-database-functions.php'); -global $USER_INFO_TABLE; - -require_once( $RootDir.'/class/user.class.php'); -require_once ($RootDir.'/class/event.class.php'); - -function set_env() { - // auth user - if (isset($_SERVER['PHP_AUTH_USER'])) { - $OPENQRM_USER = new user($_SERVER['PHP_AUTH_USER']); - if ($OPENQRM_USER->check_user_exists()) { - $OPENQRM_USER->set_user(); - $GLOBALS['OPENQRM_USER'] = $OPENQRM_USER; - define('OPENQRM_USER_NAME', $OPENQRM_USER->name); - define('OPENQRM_USER_ROLE_NAME', $OPENQRM_USER->role); - } - } - // admin user for running commands - $OPENQRM_ADMIN = new user('openqrm'); - $OPENQRM_ADMIN->set_user(); - $GLOBALS['OPENQRM_ADMIN'] = $OPENQRM_ADMIN; -} - -set_env(); - diff --git a/openQRM-5.3.50-CE/src/web/base/index.php b/openQRM-5.3.50-CE/src/web/base/index.php deleted file mode 100644 index 7b7140d..0000000 --- a/openQRM-5.3.50-CE/src/web/base/index.php +++ /dev/null @@ -1,32 +0,0 @@ - -*/ -//$ti = microtime(true); - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/class/openqrm.controller.class.php"; -if (!file_exists('unconfigured')) { - require_once($RootDir.'/include/user.inc.php'); -} -$action = new openqrm_controller(); -$output = $action->action(); -echo $output->get_string(); - -//if(function_exists('memory_get_peak_usage')) { -// $memory = memory_get_peak_usage(false); -//} -//echo 'memory: '.$memory.' byte
    '; -//$ti = (microtime(true) - $ti); -//echo 'time: '.$ti.' sec'; diff --git a/openQRM-5.3.50-CE/src/web/base/js/helpers.js b/openQRM-5.3.50-CE/src/web/base/js/helpers.js deleted file mode 100644 index 933bc82..0000000 --- a/openQRM-5.3.50-CE/src/web/base/js/helpers.js +++ /dev/null @@ -1,378 +0,0 @@ -/** - * Get Browser Infos - * - */ -var BrowserInfo = { - swfVersion : function() { - var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; - var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; - var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; - var version = "false"; - if (navigator.plugins != null && navigator.plugins.length > 0) { - if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { - var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; - var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; - var descArray = flashDescription.split(" "); - var tempArrayMajor = descArray[2].split("."); - var vMa = tempArrayMajor[0]; - var vMin = tempArrayMajor[1]; - var vRev = descArray[3]; - if (vRev == "") { - vRev = descArray[4]; - } - if (vRev[0] == "d") { - vRev = vRev.substring(1); - } else if (vRev[0] == "r") { - vRev = vRev.substring(1); - if (vRev.indexOf("d") > 0) { - vRev = vRev.substring(0, vRev.indexOf("d")); - } - } - version = vMa + "," + vMin + "," + vRev; - } - } - else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) version = 4; - else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) version = 3; - else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) version = 2; - else if (isIE && isWin && !isOpera) { - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); - version = axo.GetVariable("$version"); - } catch (e) {} - if (!version) - { - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); - version = "WIN 6,0,21,0"; - axo.AllowScriptAccess = "always"; - version = axo.GetVariable("$version"); - } catch (e) {} - } - if (!version) - { - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); - version = axo.GetVariable("$version"); - } catch (e) {} - } - if (!version) - { - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); - version = "WIN 3,0,18,0"; - } catch (e) {} - } - if (!version) - { - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); - version = "WIN 2,0,0,11"; - } catch (e) { version = "false"; } - } - } - version = version.replace(/[a-z ]/gi, ''); - version = version.replace(/,/g, '.'); - return version; - }, - info : function() { - info = { - CODENAME : navigator.appCodeName, - APPNAME : navigator.appName, - VERSION : navigator.appVersion, - COOKIES : navigator.cookieEnabled, - LANGUAGE : navigator.language, - PLATFORM : navigator.platform, - USERAGENT : navigator.userAgent, - WxH : screen.width +" x "+ screen.height, - COLORDEPTH : screen.colorDepth, - FLASH : this.swfVersion() - } - return info; - } -}; - -/** - * Drag functions - * - */ -var Drag = { - - obj : null, - init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper) - { - o.onmousedown = Drag.start; - o.hmode = bSwapHorzRef ? false : true ; - o.vmode = bSwapVertRef ? false : true ; - o.root = oRoot && oRoot != null ? oRoot : o ; - - if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px"; - if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px"; - if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px"; - if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px"; - - o.minX = typeof minX != 'undefined' ? minX : 0; - o.minY = typeof minY != 'undefined' ? minY : 0; - o.maxX = typeof maxX != 'undefined' ? maxX : null; - o.maxY = typeof maxY != 'undefined' ? maxY : null; - - o.xMapper = fXMapper ? fXMapper : null; - o.yMapper = fYMapper ? fYMapper : null; - - o.root.onDragStart = new Function(); - o.root.onDragEnd = new Function(); - o.root.onDrag = new Function(); - }, - - start : function(e) - { - var o = Drag.obj = this; - e = Drag.fixE(e); - var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); - var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); - o.root.onDragStart(x, y); - - o.lastMouseX = e.clientX; - o.lastMouseY = e.clientY; - - if (o.hmode) { - if (o.minX != null) o.minMouseX = e.clientX - x + o.minX; - if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX; - } else { - if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x; - if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x; - } - - if (o.vmode) { - if (o.minY != null) o.minMouseY = e.clientY - y + o.minY; - if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY; - } else { - if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y; - if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y; - } - - document.onmousemove = Drag.drag; - document.onmouseup = Drag.end; - - return false; - }, - - drag : function(e) - { - e = Drag.fixE(e); - var o = Drag.obj; - - var ey = e.clientY; - var ex = e.clientX; - var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); - var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); - var nx, ny; - - if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX); - if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX); - if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY); - if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY); - - nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1)); - ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1)); - - if (o.xMapper) nx = o.xMapper(y) - else if (o.yMapper) ny = o.yMapper(x) - - Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px"; - Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px"; - Drag.obj.lastMouseX = ex; - Drag.obj.lastMouseY = ey; - - Drag.obj.root.onDrag(nx, ny); - return false; - }, - - end : function() - { - document.onmousemove = null; - document.onmouseup = null; - Drag.obj.root.onDragEnd( parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), - parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"])); - Drag.obj = null; - }, - - fixE : function(e) - { - if (typeof e == 'undefined') e = window.event; - if (typeof e.layerX == 'undefined') e.layerX = e.offsetX; - if (typeof e.layerY == 'undefined') e.layerY = e.offsetY; - return e; - } -}; - -/** - * Get current mouse position - * - */ -var MousePosition = { - init : function () - { - this.x = ''; - this.y = ''; - this.MicrosoftModel = 0; - if (document.all){ - this.MicrosoftModel = 1; - document.onmousemove = this.capture; - } - if (!(this.MicrosoftModel)){ - if (typeof(document.addEventListener) == "function"){ - document.addEventListener("mousemove", this.capture, true); - } else if (document.runner){ - window.captureEvents(Event.MOUSEMOVE); - window.onmousemove = this.capture; - } - } - }, - capture : function( event ){ - if (!event){ event = window.event; } - if (typeof(event)!="object") return; - if (document.all){ - x = event.clientX; - y = event.clientY + document.documentElement.scrollTop; - } else { - x = event.pageX; - y = event.pageY; - } - MousePosition.x = x; - MousePosition.y = y; - }, - get : function (){ - return { x: this.x, y: this.y }; - } -}; - -/** - * Get window size - * - */ -var WindowSize = function() { - height = ""; - if(window.innerHeight != "undefined") { - height = window.innerHeight; - } - if(document.body.clientHeight != "undefined") { - height = document.body.clientHeight; - } - if(document.documentElement.clientHeight != "undefined") { - height = document.documentElement.clientHeight; - } - - width = ""; - if(window.innerWidth != "undefined") { - width = window.innerWidth; - } - if(document.body.clientWidth != "undefined") { - width = document.body.clientWidth; - } - if(document.documentElement.clientWidth != "undefined") { - width = document.documentElement.clientWidth; - } - - return { height: height, width: width }; -}; - -/** - * Get or Set Selection or Insert at Selection of an element - * - */ -var SelectionRange = { - - get : function(element){ - if(window.getSelection) { - start = element.selectionStart; - end = element.selectionEnd; - } - else if( document.selection ){ - // current selection - range = document.selection.createRange(); - // use this as a 'dummy' - stored_range = range.duplicate(); - // select all text - stored_range.moveToElementText( element ); - // move 'dummy' end point to end point of original range - stored_range.setEndPoint( 'EndToEnd', range ); - // calculate start and end points - start = parseInt(stored_range.text.length) - parseInt(range.text.length); - end = parseInt(start) + parseInt(range.text.length); - } - return {start: start, end: end}; - }, - - set : function(element, start, end){ - if (element.setSelectionRange) { - element.focus(); - element.setSelectionRange(start, end); - } - else if (element.createTextRange) { - range = element.createTextRange(); - start = element.value.substring(0, start).replace(/\r/g,""); - end = element.value.substring(0, end).replace(/\r/g,""); - range.collapse(true); - range.moveEnd('character', end.length); - range.moveStart('character', start.length); - range.select(); - } - }, - - insert : function(element, content){ - st = element.scrollTop; - sl = element.scrollLeft; - sel = this.get(element); - element.value = element.value.substring(0, sel.start) + content + element.value.substring(sel.end, element.value.length); - this.set(element, parseInt(sel.start) + parseInt(content.length), parseInt(sel.start) + parseInt(content.length)); - element.scrollTop = st; - element.scrollLeft = sl; - } - -}; - -/** - * Parse object attributes - * - * - */ -function objects(obj) { - val = new Array(); - i = 0; - for (var attrib in obj) { - val[i] = attrib + ' : ' + obj[attrib]; - i = i+1; - } - val.sort(); - alert(val.join(", ")); -} - -/** - * Generate Password - */ -function GeneratePassword() { - var password = ""; - var password_characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - var one_random_char; - for (j=0; j<8; j++) { - one_random_char = password_characters.charAt(Math.floor(Math.random()*password_characters.length)); - password += one_random_char; - } - return password; -} - -/** - * Temporary for compatibility reasons - */ -function wait() { - var element = $('
    ').attr('data-message', jstranslation['please_wait']); - openqrm.wait(element, ''); -} - -function cancel() { - var element = $('
    ').attr('data-message', jstranslation['please_wait']); - openqrm.wait(element, ''); -} - - - diff --git a/openQRM-5.3.50-CE/src/web/base/js/openqrm-progressbar.js b/openQRM-5.3.50-CE/src/web/base/js/openqrm-progressbar.js deleted file mode 100644 index 8b83645..0000000 --- a/openQRM-5.3.50-CE/src/web/base/js/openqrm-progressbar.js +++ /dev/null @@ -1,35 +0,0 @@ - -
    -
    -
    -
    {lang_in_progress}
    - diff --git a/openQRM-5.3.50-CE/src/web/base/js/openqrm-ui.js b/openQRM-5.3.50-CE/src/web/base/js/openqrm-ui.js deleted file mode 100644 index 738c5b1..0000000 --- a/openQRM-5.3.50-CE/src/web/base/js/openqrm-ui.js +++ /dev/null @@ -1,414 +0,0 @@ -/** - * This file contains misc openqrm UI javascript methods - * - openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. - - All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. - - This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. - The latest version of this license can be found here: src/doc/LICENSE.txt - - By using this software, you acknowledge having read this license and agree to be bound thereby. - - http://openqrm-enterprise.com - - Copyright 2021, OPENQRM AUSTRALIA PTY LTD - */ - - - - -$.extend({ - error: function( msg ) { throw msg; }, - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - data = jQuery.trim( data ); - if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@") - .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]") - .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) { - return window.JSON && window.JSON.parse ? - window.JSON.parse( data ) : - (new Function("return " + data))(); - } else { - jQuery.error( "Invalid JSON: " + data ); - } - } -}); - - -/** - List of global 'a' tag classes and their icon class - (see glyphicons-halflings @ http://www.glyphicons.com) - used for action-buttons. -*/ -var actionButtons = { - 'a.add' : 'plus-sign', - 'a.edit' : 'edit', - 'a.manage' : 'cog', - 'a.resize' : 'resize-full', - 'a.details' : 'search', - 'a.remove' : 'minus-sign', - 'a.console' : 'dashboard', - 'a.snap' : 'camera', - 'a.migrate' : 'arrow-right', - 'a.clone' : 'export', - 'a.graphs' : 'signal', - 'a.stop' : 'stop', - 'a.start' : 'play', - 'a.enable' : 'plus', - 'a.disable' : 'minus' -}; - - -$(document).ready(function(){ - - // move error-event/active-event info from header to events menu item - //$('#Event_box').addClass('pull-right').appendTo('#menu1_9'); - //$('#Event_active_box').addClass('pull-right').attr('style','display: none; margin-right:3px').appendTo('#menu1_9'); - - // add icon to menu section headers - $('#menu1_1').prepend( $('').addClass('glyphicons global').prepend($('')) ); - $('#menu2_1').prepend( $('').addClass('glyphicons show_big_thumbnails').prepend($('')) ); - $('#menuSection_queue_1').prepend( $('').addClass('glyphicons inbox_in').prepend($('')) ); - - // prepare actionButton links - $.each(actionButtons, function(key, value) { - $(key).prepend( - $('').addClass('halflings-icon white ' + value).prepend($('')) - ); - }); - - // remove attribute 'style' from .pageturn_head a .pageturn_bottom a - $('.pageturn_head a[style="visibility:hidden;"]').addClass('disabled').removeAttr('style'); - $('.pageturn_bottom a[style="visibility:hidden;"]').addClass('disabled').removeAttr('style'); - - // find .disabled elements and remove href and onlick attributes - $('a.disabled').removeAttr('href').removeAttr('onclick').attr("disabled", "disabled"); - - // add openqrm.wait event to listed elements - // list of interface elements that should trigger the openqrm.wait() function - var waitElements = [ - 'input.submit', - 'a.edit', - 'a.manage', - '.htmlobject_tabs li span a', - '.pageturn_head a:not(.disabled)', - '.pageturn_bottom a:not(.disabled)', - '.actiontable input', - 'a.refresh' - ]; - - // attach wait function to list elements - $.each(waitElements, function(k, v) { - $(v).attr('data-message', jstranslation['please_wait']); - $(v).click(function() { openqrm.wait(v ,'') } ); - }); - - // attach namegen button to element - var namegen = $(''); - $(namegen).attr('type', 'button'); - $(namegen).attr('class', 'namegenButton'); - $(namegen).attr('tabindex', '-1'); - $(namegen).attr('value', jstranslation['generate_name']); - $(namegen).click(function() { - openqrm.generateUniqueName($('input.namegen').attr('data-prefix'), $('input.namegen'), $('input.namegen').attr('data-length')); - return false; - }); - $('input.namegen').after(namegen); - - // htmlobjects_tablebuilder - $('select.sort').attr('data-message', jstranslation['please_wait']); - $('select.sort').change(function() { openqrm.wait(this ,''); this.form.submit(); } ); - $('select.order').attr('data-message', jstranslation['please_wait']); - $('select.order').change(function() { openqrm.wait(this ,''); this.form.submit(); } ); - $('select.limit').attr('data-message', jstranslation['please_wait']); - $('select.limit').change(function() { openqrm.wait(this ,''); this.form.submit(); } ); - - // menu - $.each($('a.phplmselected'), function(k, v) { - t = $(v).attr('target'); - if(t != '_blank') { - $(v).attr('data-message', jstranslation['please_wait']); - $(v).click(function() { openqrm.wait(v ,'') } ); - } - }); - $.each($('a.phplm'), function(k, v) { - t = $(v).attr('target'); - if(t != '_blank') { - $(v).attr('data-message', jstranslation['please_wait']); - $(v).click(function() { openqrm.wait(v ,'') } ); - } - }); - -}); - -/* global openqrm interface methods */ -openqrm = { - - wait : function(element, msg) { - - // TODO: after updating jquery we should use the 'data' method - if($(element).attr('data-message') != 'undefined') { - msg = $(element).attr('data-message'); - } - - // create transparent background overlay - $('body').prepend( - $('
    ').attr('class','modal-overlay') - ); - - // create content box with message - $('body').prepend( - $('
    ') - .attr('class', 'modal-box lead') - .append( - $('

    ').html(msg) - ) - /* - .append( - $('').attr({'src':'/openqrm/base/img/ajax-loader.gif','class':'ajax-loader'}) - ) - */ - ); - - // center content box on screen - $('.modal-box').css({ - left: (($(window).width() - $('.modal-box').outerWidth())/2), - top: (($(window).height() - $('.modal-box').outerHeight())/2) - }); - }, - - /* Global generate names method - prefix: string prefix to generate unique string - element: input element that should be filled with generated string - length: length of unique string - */ - generateUniqueName : function (prefix, element, length) { - if(!length) { - length = 10; - } - var name = ""; - var name_characters = "123456789"; // don't use 0 because of openvz - var one_random_char; - for (j=0; j < length; j++) { - one_random_char = name_characters.charAt( Math.floor( Math.random() * name_characters.length ) ); - name += one_random_char; - } - $(element).attr('value', prefix + name); - }, - - /* Format date helper. - Usage: openqrm.formatDate([timestamp], '%Y-%M-%d') - date: unix timestamp - fmt: format string - */ - formatDate : function(date, fmt) { - function pad(value) { - return (value.toString().length < 2) ? '0' + value : value; - } - return fmt.replace(/%([a-zA-Z])/g, function (_, fmtCode) { - switch (fmtCode) { - case 'Y': - return date.getFullYear(); - case 'M': - return pad(date.getMonth() + 1); - case 'd': - return pad(date.getDate()); - case 'H': - return pad(date.getHours()); - case 'm': - return pad(date.getMinutes()); - case 's': - return pad(date.getSeconds()); - default: - throw new Error('Unsupported format code: ' + fmtCode); - } - }); - }, - - /* Crop text helper. Appends '...' to returned text if it was cropped. - text: the text that should be cropped - length: number of characters - */ - crop : function(text, length) { - return (text.length > length) ? text.substring(0, length) + '...' : text; - }, - - - getEventStatus : function(event_priority) { - var status; - switch (parseInt(event_priority)) { - /* - case 0: $icon = "off.png"; break; - case 1: $icon = "error.png"; break; - case 2: $icon = "error.png"; break; - case 3: $icon = "error.png"; break; - case 4: $icon = "unknown.png"; break; - case 5: $icon = "active.png"; break; - case 6: $icon = "idle.png"; break; - case 7: $icon = "idle.png"; break; - case 8: $icon = "idle.png"; break; - case 9: $icon = "transition.png"; break; - case 10:$icon = "active.png"; break; - */ - - case 0: - status = 'disabled'; - break; - case 1: - case 2: - case 3: - status = 'error'; // error event - break; - case 4: - case 5: - case 6: - case 7: - case 8: - status = 'notice'; // undefined event - break; - case 9: - status = 'running'; // active event - break; - case 10: - status = 'ok'; // notice event - break; - default: - status = 'undefined'; - break; - - } - - return status; - }, - - get_datacenter_status : function() { - - var data = $.ajax({ - url : "api.php?action=base&base=aa_server&controller=datacenter&datacenter_action=dc_status", - type: "POST", - cache: false, - async: false, - dataType: "text", - success : function () {} - }).responseText; - // TODO: Convert to json - return data.split(','); - }, - - get_datacenter_load : function() { - - var data = $.ajax({ - url : "api.php?action=base&base=aa_server&controller=datacenter&datacenter_action=statistics", - type: "POST", - cache: false, - async: false, - dataType: "json", - success : function () { } - }).responseText; - var response = $.parseJSON(data); - return (response != null) ? response : false; - }, - - get_event_list : function() { - var data = $.ajax({ - url : "api.php?action=base&base=aa_server&controller=datacenter&datacenter_action=eventlist", - type: "POST", - cache: false, - async: false, - dataType: "json", - success : function () { } - }).responseText; - var response = $.parseJSON(data); - return (response != null) ? response : false; - }, - - get_storage_list : function() { - var data = $.ajax({ - url : "api.php?action=base&base=aa_server&controller=datacenter&datacenter_action=storage_list", - type: "POST", - cache: false, - async: false, - dataType: "json", - success : function () { } - }).responseText; - var response = $.parseJSON(data); - return (response != null) ? response : false; - }, - - get_server_list : function() { - - var data = $.ajax({ - url : "api.php?action=base&base=aa_server&controller=datacenter&datacenter_action=server_list", - type: "POST", - cache: false, - async: false, - dataType: "json", - success : function () { } - }).responseText; - var response = $.parseJSON(data); - return (response != null) ? response : false; - } - -}; - - - -/** - method for resizing iframes depending on their content height -*/ -var resizeFrame = { - set : function() { - h = ''; - f = document.getElementById('MainFrame'); - if(f.contentDocument && f.contentDocument.body.offsetHeight != "undefined") { - p = parseFloat(navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1])>=0.1? 16 : 0 - h = f.contentDocument.body.offsetHeight+p; - } - if(f.Document && f.Document.body.offsetHeight != "undefined") { - h = f.Document.body.offsetHeight; - } - f.height = h +20; - }, - handlers : function() { - f = document.getElementById('MainFrame'); - if (window.addEventListener) { - f.addEventListener("load", resizeFrame.set, false); - } - else if (window.attachEvent) { - f.attachEvent("onload", resizeFrame.set); - } - else { - f.onload = resizeFrame.set; - } - } -}; -if(document.getElementById('MainFrame')) { - resizeFrame.handlers(); -} - - - -function Logout(element) { - path = window.location.protocol+"//dummy:dummy@"+window.location.host+""+window.location.pathname+'?'+Math.random()*11; - try{ - var agt=navigator.userAgent.toLowerCase(); - if (agt.indexOf("msie") != -1) { - // IE clear HTTP Authentication - document.execCommand("ClearAuthenticationCache"); - } else { - var data = $.ajax({ - url : path, - type: "POST", - cache: false, - async: false, - dataType: "text", - success : function () { } - }).responseText; - } - window.location.href = element.href; - } catch(e) { alert(e); } -} - diff --git a/openQRM-5.3.50-CE/src/web/base/lang/de.file.handler.ini b/openQRM-5.3.50-CE/src/web/base/lang/de.file.handler.ini deleted file mode 100644 index 4ff14ca..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/de.file.handler.ini +++ /dev/null @@ -1,9 +0,0 @@ -remove_error = "%s konnte nicht gelöscht werden" -copy_error = "%s konnte nicht nach %s kopiert werden" -filename_error = "Dateiname darf nur %s beinhalten" -saved_error = "%s konnte nicht gespeichert werden" -exists_error = "%s ist bereits vorhanden" -file = "Datei" -folder = "Verzeichnis" -permission_denied = "Zugang verweigert" -not_found = "Datei nicht gefunden" diff --git a/openQRM-5.3.50-CE/src/web/base/lang/de.file.upload.ini b/openQRM-5.3.50-CE/src/web/base/lang/de.file.upload.ini deleted file mode 100644 index 405bed5..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/de.file.upload.ini +++ /dev/null @@ -1,14 +0,0 @@ -400 = "Bad Request: Upload Datei nicht gesetzt" -401 = "Unauthorized: Verzeichnis ist schreibgeschützt" -403 = "Fehler: " -404 = "Not Found: Verzeichnis nicht gefunden" -406 = "Not Acceptable: Datei wurde nicht hochgeladen" -500 = "Server Error: " -[Server] -1 = "Datei überschreitet upload_max_filesize" -2 = "Datei überschreitet MAX_FILE_SIZE" -3 = "Datei konnte nur teilweise hochgeladen werden" -4 = "Keine Datei hochgeladen" -6 = "Temporäres Verzeichnis nicht gefunden" -7 = "Datei konnte nicht geschrieben werden" -8 = "Dateiendung (Format) unzulässig" diff --git a/openQRM-5.3.50-CE/src/web/base/lang/de.htmlobjects.ini b/openQRM-5.3.50-CE/src/web/base/lang/de.htmlobjects.ini deleted file mode 100644 index 38758a8..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/de.htmlobjects.ini +++ /dev/null @@ -1,25 +0,0 @@ -[table] -button_refresh = "aktualisieren" -label_sort = "sortieren nach" -label_offset = "Offset" -label_limit = "Limit" -option_nolimit = "none" -option_asc = "ASC" -option_desc = "DESC" -select_label = "Auswahl:" -select_all = "alles" -select_none = "nichts" -select_invert = "invertiert" -no_data = "Keine Daten vorhanden." - -[form] -error_required = "%s darf nicht leer sein" -required = "*" -error_maxlength = "%s überschreitet Maximalgröße von %d" -error_minlength = "%s unterschreitet Minimalgröße von %d" - -[response] -submit = "absenden" -cancel = "abbrechen" -reset = "zurücksetzen" - diff --git a/openQRM-5.3.50-CE/src/web/base/lang/de.javascript.ini b/openQRM-5.3.50-CE/src/web/base/lang/de.javascript.ini deleted file mode 100644 index d272e16..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/de.javascript.ini +++ /dev/null @@ -1,2 +0,0 @@ -please_wait = "Bitte warten ..." -generate_name = "Namen generieren" diff --git a/openQRM-5.3.50-CE/src/web/base/lang/de.openqrm.controller.ini b/openQRM-5.3.50-CE/src/web/base/lang/de.openqrm.controller.ini deleted file mode 100644 index d3b242f..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/de.openqrm.controller.ini +++ /dev/null @@ -1,19 +0,0 @@ -[content] -tab = "License" -ltimeout = "Ihre openQRM Enterprise Server Lizenz ist abgelaufen! Bitte kontaktieren Sie info@openqrm-enterprise.com!" -lclients = "Ihre openQRM Enterprise Client Lizenz ist abgelaufen! Bitte kontaktieren Sie info@openqrm-enterprise.com!" -[top] -account = "Benutzerkonto" -support = "Support" -info = "Info" -documentation = "Dokumentation" -language = "Sprache" -[upload] -tab = "Upload" -label = "Upload der Lizenz Dateien" -public_key = "Public Key" -server_license = "Server Lizenz" -client_license = "Client Lizenz (optional)" -welcome = "Willkommen zur neu installierten openQRM Enterprise Edition" -explanation = "Bitte aktivieren Sie die openQRM Enterprisee Edition mit den erhaltenen Lizenz Dateien." -msg = "Upload der Lizenz Dateie %s" diff --git a/openQRM-5.3.50-CE/src/web/base/lang/de.upload.ini b/openQRM-5.3.50-CE/src/web/base/lang/de.upload.ini deleted file mode 100644 index 410e9d9..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/de.upload.ini +++ /dev/null @@ -1,3 +0,0 @@ -label = "Lizenz Upload" -upload = "Bitte wählen Sie die openQRM Enterprise Server Lizenz Datei von Ihrem lokalen Rechner und klicken Sie auf "absenden"" -msg = "Lizenz Datei %s erfolgreich hochgeladen" diff --git a/openQRM-5.3.50-CE/src/web/base/lang/en.file.handler.ini b/openQRM-5.3.50-CE/src/web/base/lang/en.file.handler.ini deleted file mode 100644 index dffd9b8..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/en.file.handler.ini +++ /dev/null @@ -1,9 +0,0 @@ -remove_error = "failed to delete %s" -copy_error = "failed to copy %s to %s" -filename_error = "filename must be %s" -saved_error = "failed to save %s" -exists_error = "%s already exists" -file = "File" -folder = "Folder" -permission_denied = "Permission denied" -not_found = "File not found" diff --git a/openQRM-5.3.50-CE/src/web/base/lang/en.file.upload.ini b/openQRM-5.3.50-CE/src/web/base/lang/en.file.upload.ini deleted file mode 100644 index 621fe5c..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/en.file.upload.ini +++ /dev/null @@ -1,14 +0,0 @@ -400 = "Bad Request: Uploadfile not set" -401 = "Unauthorized: Directory is not writeable" -403 = "Forbidden: " -404 = "Not Found: Directory not exists" -406 = "Not Acceptable: File is not uploded" -500 = "Server Error: " -[Server] -1 = "File exceeds upload_max_filesize" -2 = "File exceeds MAX_FILE_SIZE" -3 = "File was only partially uploaded" -4 = "No file was uploaded" -6 = "Missing a temporary folder" -7 = "Failed to write file to disk" -8 = "File upload stopped by extension" diff --git a/openQRM-5.3.50-CE/src/web/base/lang/en.htmlobjects.ini b/openQRM-5.3.50-CE/src/web/base/lang/en.htmlobjects.ini deleted file mode 100644 index 3454823..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/en.htmlobjects.ini +++ /dev/null @@ -1,28 +0,0 @@ -[table] -button_refresh = "refresh" -label_sort = "sort by" -label_order = "sort order" -label_offset = "offset" -label_limit = "limit" -option_nolimit = "none" -option_asc = "ASC" -option_desc = "DESC" -select_label = "Select:" -select_all = "all" -select_none = "none" -select_invert = "inverted" -no_data = "no data" - - -[form] -error_required = "%s must not be empty" -error_maxlength = "%s exeeds maxlength of %d" -error_minlength = "%s undercuts minlength of %d" -required = "*" - - -[response] -submit = "submit" -cancel = "cancel" -reset = "reset" - diff --git a/openQRM-5.3.50-CE/src/web/base/lang/en.javascript.ini b/openQRM-5.3.50-CE/src/web/base/lang/en.javascript.ini deleted file mode 100644 index 73376e8..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/en.javascript.ini +++ /dev/null @@ -1,2 +0,0 @@ -please_wait = "Please wait ..." -generate_name = "Generate name" diff --git a/openQRM-5.3.50-CE/src/web/base/lang/en.openqrm.controller.ini b/openQRM-5.3.50-CE/src/web/base/lang/en.openqrm.controller.ini deleted file mode 100644 index a5c97ad..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/en.openqrm.controller.ini +++ /dev/null @@ -1,19 +0,0 @@ -[content] -tab = "License" -ltimeout = "Your openQRM Enterprise server license key has expired! Please contact info@openqrm-enterprise.com for renewal!" -lclients = "Your openQRM Enterprise client license key has expired! Please contact info@openqrm-enterprise.com for renewal!" -[top] -account = "Account" -support = "Support" -info = "Info" -documentation = "Documentation" -language = "Language" -[upload] -tab = "Upload" -label = "Upload License File(s)" -public_key = "Public Key" -server_license = "Server License" -client_license = "Client Licenses (optional)" -welcome = "Welcome to your newly installed openQRM Enterprise Edition" -explanation = "Please activate it by uploading the license key files you received by email." -msg = "Uploaded License File %s" diff --git a/openQRM-5.3.50-CE/src/web/base/lang/en.upload.ini b/openQRM-5.3.50-CE/src/web/base/lang/en.upload.ini deleted file mode 100644 index 82bf637..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/en.upload.ini +++ /dev/null @@ -1,3 +0,0 @@ -label = "License upload" -upload = "Please select the openQRM Enterprise Server License File and Public Key from your local computer and submit" -msg = "Uploaded License file %s" diff --git a/openQRM-5.3.50-CE/src/web/base/lang/es.htmlobjects.ini b/openQRM-5.3.50-CE/src/web/base/lang/es.htmlobjects.ini deleted file mode 100644 index 9495930..0000000 --- a/openQRM-5.3.50-CE/src/web/base/lang/es.htmlobjects.ini +++ /dev/null @@ -1,23 +0,0 @@ -[table] -button_refresh = "refrescar" -label_sort = "pedido de" -label_offset = "compensación" -label_limit = "límite" -option_nolimit = "nada" -option_asc = "ASC" -option_desc = "DESC" -select_label = "Seleccionar:" -select_all = "todo" -select_none = "mada" -select_invert = "invertir" -no_data = "ningún dato" - -[form] -error_required = "%s no debe estar vacío" -required = "*" - -[response] -submit = "enviar" -cancel = "cancelar" -reset = "reiniciar" - diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.configure.class.php b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.configure.class.php deleted file mode 100644 index b06caca..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.configure.class.php +++ /dev/null @@ -1,252 +0,0 @@ - - */ - -class aa_plugins_configure -{ -/** -* plugin key -* @access public -* @var string -*/ -var $plugin_key = 'aa_plugins'; -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'aa_plugins_action'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'aa_plugins_identifier'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "aa_plugins_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'aa_plugins_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param htmlobject_response $response - * @param file $file - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->user = $openqrm->user(); - $this->file = $this->openqrm->file(); - $this->plugin = $this->response->html->request()->get($this->identifier_name); - $this->response->add($this->identifier_name, $this->plugin); - require_once($this->openqrm->get('classdir').'/openqrm_server.class.php'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $form = $this->configure(); - if(isset($form->msg)) { - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $form->msg) - ); - } - $t = $this->response->html->template($this->tpldir.'/aa_plugins-configure.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($form); - $t->add(sprintf($this->lang['label'], $this->plugin), 'label'); - $t->group_elements(array('param_' => 'form')); - return $t; - } - - //-------------------------------------------- - /** - * Configure - * - * @access public - * @return htmlobject_tablebulider - */ - //-------------------------------------------- - function configure() { - - $response = $this->get_response(); - $form = $response->form; - - $server = new openqrm_server(); - $tmp = $this->openqrm->get('basedir').'/var/lock/plugin_manager.'.$this->plugin.'.conf.tmp'; - $file = $this->openqrm->get('basedir').'/var/lock/plugin_manager.'.$this->plugin.'.conf'; - - $command = $this->openqrm->get('basedir').'/bin/openqrm boot-service view'; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode raw'; - $command .= ' -n '.$this->plugin; - $command .= ' -a default'; - $command .= ' > '.$tmp; - $command .= ' && mv '.$tmp.' '.$file; - - if($this->file->exists($file)) { - $this->file->remove($file); - } - $server->send_command($command, null, true); - while (!$this->file->exists($file)) - { - usleep(10000); // sleep 10ms to unload the CPU - clearstatcache(); - } - sleep(2); - $d = $this->__parse_conf($file,str_replace('storage', '', $this->plugin)); - // clean up - $this->file->remove($file); - $i = 0; - if(!isset($d)) { - $div = $this->response->html->div(); - $div->name = 'no data'; - $div->add($this->lang['no_data']); - $d['param_placeholder']['object'] = $div; - } - $form->add($d); - if(!$form->get_errors() && $response->submit()) { - $request = $form->get_request(null, true); - foreach($request as $k => $v) { - if($v === '') { $v = 'NoValue'; } - $command = $this->openqrm->get('basedir').'/bin/openqrm boot-service configure'; - $command .= ' --openqrm-ui-user '.$this->user->name; - $command .= ' --openqrm-cmd-mode background'; - $command .= ' -a default'; - $command .= ' -v '.$v; - $command .= ' -k '.$k; - $command .= ' -n '.$this->plugin; - $server->send_command($command, null, true); - } - $form->msg = sprintf($this->lang['msg'], $this->plugin); - } - return $form; - } - - //-------------------------------------------- - /** - * Get Response - * - * @access public - * @param string $mode - * @return htmlobject_response - */ - //-------------------------------------------- - function get_response() { - $response = $this->response; - $form = $response->get_form($this->actions_name, 'configure'); - - $submit = $form->get_elements('submit'); - $submit->handler = 'onclick="wait();"'; - $form->add($submit, 'submit'); - - $submit = $form->get_elements('cancel'); - $submit->handler = 'onclick="cancel();"'; - $form->add($submit, 'cancel'); - - $response->form = $form; - - return $response; - } - - //-------------------------------------------- - /** - * Parse an openqrm config file - * - * @access public - * @param string $path - * @param string $replace - * @param string $plugin - * @return array - */ - //-------------------------------------------- - function __parse_conf ( $path, $plugin = null ) { - if(file_exists($path)) { - - $blacklist[] = 'OPENQRM_PLUGIN_VERSION'; - $blacklist[] = 'OPENQRM_PLUGIN_BUILD_REQUIREMENTS'; - $blacklist[] = 'OPENQRM_PLUGIN_DESCRIPTION'; - $blacklist[] = 'OPENQRM_PLUGIN_TYPE'; - $blacklist[] = 'OPENQRM_PLUGIN_DEPENDENCIES'; - $blacklist[] = 'OPENQRM_PLUGIN_PLUGIN_DEPENDENCIES'; - $blacklist[] = 'OPENQRM_PLUGIN_STATE_DIRS'; - $blacklist[] = 'OPENQRM_PLUGIN_STATE_FILES'; - - $ini = $this->file->get_contents( $path ); - $ini = explode("\n", $ini); - if ( count( $ini ) == 0 ) { return null; } - $d = null; - $i = 0; - foreach( $ini as $line ){ - $line = trim( $line ); - // only get lines starting with OPENQRM_ or $plugin_ - if(strpos($line, 'OPENQRM_') === 0 || (isset($plugin) && stripos($line, str_replace('-', '_', $plugin)) === 0)) { - // Key-value pair - list( $key, $value ) = explode( '=', $line, 2 ); - $key = trim( $key ); - $value = trim( $value ); - $value = str_replace("\"", "", $value ); - if(!in_array($key, $blacklist)) { - $d['param_f'.$i]['label'] = $key; - $d['param_f'.$i]['validate']['regex'] = '/^[^ ]+$/i'; - $d['param_f'.$i]['validate']['errormsg'] = $this->lang['error_value']; - $d['param_f'.$i]['object']['type'] = 'htmlobject_input'; - $d['param_f'.$i]['object']['attrib']['type'] = 'text'; - $d['param_f'.$i]['object']['attrib']['name'] = $key; - $d['param_f'.$i]['object']['attrib']['value'] = $value; - if(isset($ini[$i-1]) && strpos($ini[$i-1], '#') === 0) { - $d['param_f'.$i]['object']['attrib']['title'] = trim(substr($ini[$i-1],1)); - } - } - } - $i++; - } - return $d; - } - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.controller.class.php b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.controller.class.php deleted file mode 100644 index ac8fea8..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.controller.class.php +++ /dev/null @@ -1,427 +0,0 @@ - - */ - -class aa_plugins_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'aa_plugins_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "aa_plugins_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'aa_plugins_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'aa_plugins_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'select' => array ( - 'tab' => 'Plugin Manager', - 'label' => 'Plugin Manager', - 'action_start' => 'start', - 'action_stop' => 'stop', - 'action_enable' => 'install', - 'action_disable' => 'uninstall', - 'action_configure' => 'configure', - 'title_start' => 'click to start plugin %s', - 'title_stop' => 'click to stop plugin %s', - 'title_enable' => 'click to install plugin %s', - 'title_disable' => 'click to uninstall plugin %s', - 'title_configure' => 'click to configure plugin %s', - 'table_name' => 'Plugin', - 'table_type' => 'Type', - 'table_description' => 'Description', - 'table_enabled' => 'installed', - 'table_started' => 'running', - 'lang_filter' => 'Filter by type', - 'please_wait' => 'Loading. Please wait ..', - ), - 'start' => array ( - 'label' => 'Start plugin', - 'msg' => 'Started plugin %s', - 'error_timeout' => 'Timeout while trying to start plugin %s', - 'error_start' => 'Could not start plugin %s', - ), - 'stop' => array ( - 'label' => 'Stop plugin', - 'msg' => 'Stopped plugin %s', - 'error_timeout' => 'Timeout while trying to stop plugin %s', - 'error_stop' => 'Could not stop plugin %s', - ), - 'enable' => array ( - 'label' => 'Install plugin', - 'msg' => 'Install plugin %s', - 'error_timeout' => 'Timeout while trying to install plugin %s', - 'error_enable' => 'Could not install plugin %s', - 'error_enabled' => 'Plugin %s already installed', - 'error_dependencies' => 'Dependencies for %s failed. Please install %s first.', - ), - 'disable' => array ( - 'label' => 'Uninstall plugin', - 'msg' => 'Uninstall plugin %s', - 'error_timeout' => 'Timeout while trying to uninstall plugin %s', - 'error_in_use' => 'Plugin %s is still in use by openQRM', - 'error_disable' => 'Could not uninstall plugin %s', - 'error_dependencies' => 'Dependencies for %s failed. Please uninstall %s first.', - ), - 'configure' => array ( - 'tab' => 'Configure Plugin', - 'label' => 'Configure Plugin %s', - 'msg' => 'Configured plugin %s', - 'no_data' => 'No values found to configure', - 'error_value' => 'Please do not use blank spaces', - 'canceled' => 'Operation canceled. Please wait ..', - 'please_wait' => 'Loading. Please wait ..', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param htmlobject_response $response - * @param openqrm $openqrm - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; - $this->tpldir = $this->rootdir.'plugins/aa_plugins/tpl'; - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/plugins/aa_plugins/lang", 'aa_plugins.ini'); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - if(is_array($ar)) { - $this->action = key($ar); - } else { - $this->action = $ar; - } - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "select"; - } - - // handle response - $this->response->params['plugin_filter'] = $this->response->html->request()->get('plugin_filter'); - $vars = $this->response->html->request()->get('plugins'); - if($vars !== '') { - if(!isset($vars['action'])) { - foreach($vars as $k => $v) { - $this->response->add('plugins['.$k.']', $v); - } - } else { - foreach($vars as $k => $v) { - unset($this->response->params['plugins['.$k.']']); - } - } - } - - $content = array(); - switch( $this->action ) { - case '': - case 'select': - $content[] = $this->select(true); - break; - case 'start': - $content[] = $this->start(true); - break; - case 'stop': - $content[] = $this->stop(true); - break; - case 'enable': - $content[] = $this->enable(true); - break; - case 'disable': - $content[] = $this->disable(true); - break; - case 'configure': - $content[] = $this->select(false); - $content[] = $this->configure(true); - break; - } - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * API - * - * @access public - */ - //-------------------------------------------- - function api() { - require_once($this->rootdir.'/plugins/aa_plugins/class/aa_plugins.api.class.php'); - $controller = new aa_plugins_api($this); - $controller->action(); - } - - - //-------------------------------------------- - /** - * Select Plugins - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function select( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/aa_plugins/class/aa_plugins.select.class.php'); - $controller = new aa_plugins_select($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['select']; - $data = $controller->action(); - } - $content['label'] = $this->lang['select']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'select' ); - $content['onclick'] = false; - if($this->action === 'select'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Start Plugin - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function start( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/aa_plugins/class/aa_plugins.start.class.php'); - $controller = new aa_plugins_start($this->response, $this->file); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['start']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Start'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'start' ); - $content['onclick'] = false; - if($this->action === 'start'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Stop Plugin - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function stop( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/aa_plugins/class/aa_plugins.stop.class.php'); - $controller = new aa_plugins_stop($this->response, $this->file); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['stop']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Stop'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'stop' ); - $content['onclick'] = false; - if($this->action === 'stop'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Enable Plugin - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function enable( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/aa_plugins/class/aa_plugins.enable.class.php'); - $controller = new aa_plugins_enable($this->response, $this->file); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['enable']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'Enable'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'enable' ); - $content['onclick'] = false; - if($this->action === 'enable'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Disable Plugin - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function disable( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/aa_plugins/class/aa_plugins.disable.class.php'); - $controller = new aa_plugins_disable($this->response, $this->file); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['disable']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = 'disable'; - $content['hidden'] = true; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'disable' ); - $content['onclick'] = false; - if($this->action === 'disable'){ - $content['active'] = true; - } - return $content; - } - - //-------------------------------------------- - /** - * Configure Plugin - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function configure( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/plugins/aa_plugins/class/aa_plugins.configure.class.php'); - $controller = new aa_plugins_configure($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['configure']; - $controller->rootdir = $this->rootdir; - $controller->prefix_tab = $this->prefix_tab; - $data = $controller->action(); - } - $content['label'] = $this->lang['configure']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'configure' ); - $content['onclick'] = false; - if($this->action === 'configure'){ - $content['active'] = true; - } - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.disable.class.php b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.disable.class.php deleted file mode 100644 index e0c8303..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.disable.class.php +++ /dev/null @@ -1,163 +0,0 @@ - - */ - -class aa_plugins_disable -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'aa_plugins_action'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'aa_plugins_identifier'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "aa_plugins_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'aa_plugins_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param htmlobject_response $response - * @param file $file - */ - //-------------------------------------------- - function __construct($response, $file) { - $this->response = $response; - $this->file = $file; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $msg = ''; - $event = new event(); - $server = new openqrm_server(); - $plugin = new plugin(); - $identifier = $this->response->html->request()->get($this->identifier_name); - $enabled = $plugin->enabled(); - if($identifier !== '') { - foreach($identifier as $id) { - if(in_array($id, $enabled)) { - $error = false; - // check dependencies - foreach($enabled as $v) { - if($v !== $id) { - $tmp = $plugin->get_dependencies($v); - if($tmp !== '' && isset($tmp['dependencies']) && $tmp['dependencies'] !== '') { - if(strpos($tmp['dependencies'], $id) !== false) { - $msg .= sprintf($this->lang['error_dependencies'], $id, $v).'
    '; - $error = true; - } - } - } - } - // handle plugin type - if($error === false) { - $tmp = $plugin->get_config($id); - switch($tmp['type']) { - case 'storage': - $storage = new storage(); - $types = $storage->get_storage_types(); - $deployment = new deployment(); - $dep = $deployment->get_id_by_storagetype($id); - foreach($dep as $val) { - if(in_array($val['value'], $types)) { - $msg .= sprintf($this->lang['error_in_use'], $id).'
    '; - $error = true; - } - } - break; - } - } - if($error === false) { - $return = $server->send_command("openqrm_server_plugin_command ".$id." uninstall ".$GLOBALS['OPENQRM_ADMIN']->name.' '.$GLOBALS['OPENQRM_ADMIN']->password); - if($return === true) { - if ($this->__check($id)) { - $msg .= sprintf($this->lang['msg'], $id).'
    '; - } else { - $msg .= sprintf($this->lang['error_timeout'], $id).'
    '; - } - } else { - $msg .= sprintf($this->lang['error_disable'], $id).'
    '; - } - } - } - } - } - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - - //-------------------------------------------- - /** - * Check plugin state - * - * @access private - * @param string $plugin - * @return bool - */ - //-------------------------------------------- - function __check($plugin) { - $f = $_SERVER["DOCUMENT_ROOT"]."/openqrm/base/plugins/".$plugin; - $i = 0; - while ($this->file->exists($f)) { - sleep(1); - $i++; - if ($i > 20) { - return false; - } - } - return true; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.enable.class.php b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.enable.class.php deleted file mode 100644 index 132ba56..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.enable.class.php +++ /dev/null @@ -1,163 +0,0 @@ - - */ - -class aa_plugins_enable -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'aa_plugins_action'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'aa_plugins_identifier'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "aa_plugins_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'aa_plugins_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param htmlobject_response $response - * @param file $file - */ - //-------------------------------------------- - function __construct($response, $file) { - $this->response = $response; - $this->file = $file; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $msg = ''; - $event = new event(); - $server = new openqrm_server(); - $plugin = new plugin(); - $identifier = $this->response->html->request()->get($this->identifier_name); - $available = $plugin->available(); - if($identifier !== '') { - foreach($identifier as $id) { - if(in_array($id, $available)) { - $error = false; - // check dependencies - $tmp = $plugin->get_dependencies($id); - if($tmp !== '' && isset($tmp['dependencies']) && $tmp['dependencies'] !== '') { - $tmp = str_replace(' ', '', $tmp['dependencies']); - $tmp = explode(',', $tmp); - $enabled = $plugin->enabled(); - $result = array_diff($tmp, $enabled); - if(count($result) > 0) { - $msg .= sprintf($this->lang['error_dependencies'], $id, implode(', ', $result)).'
    '; - $error = true; - } - } - // handle plugin type - if($error === false) { - $tmp = $plugin->get_config($id); - switch($tmp['type']) { - case 'storage': - $storage = new storage(); - $types = $storage->get_storage_types(); - $deployment = new deployment(); - $dep = $deployment->get_id_by_storagetype($id); - foreach($dep as $val) { - if(in_array($val['value'], $types)) { - $msg .= sprintf($this->lang['error_enabled'], $id).'
    '; - $error = true; - } - } - break; - } - } - if($error === false) { - $return = $server->send_command("openqrm_server_plugin_command ".$id." init ".$GLOBALS['OPENQRM_ADMIN']->name.' '.$GLOBALS['OPENQRM_ADMIN']->password); - if($return === true) { - if ($this->__check($id)) { - $msg .= sprintf($this->lang['msg'], $id).'
    '; - } else { - $msg .= sprintf($this->lang['error_timeout'], $id).'
    '; - } - } else { - $msg .= sprintf($this->lang['error_enable'], $id).'
    '; - } - } - } - } - } - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - - //-------------------------------------------- - /** - * Check plugin state - * - * @access private - * @param string $plugin - * @return bool - */ - //-------------------------------------------- - function __check($plugin) { - $f = $_SERVER["DOCUMENT_ROOT"]."/openqrm/base/plugins/".$plugin; - $i = 0; - while (!$this->file->exists($f)) { - sleep(1); - $i++; - if ($i > 20) { - return false; - } - } - return true; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.select.class.php b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.select.class.php deleted file mode 100644 index 7735da8..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.select.class.php +++ /dev/null @@ -1,346 +0,0 @@ - - */ - -class aa_plugins_select -{ -/** -* plugin key -* @access public -* @var string -*/ -var $plugin_key = 'aa_plugins'; -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'aa_plugins_action'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'aa_plugins_identifier'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "aa_plugins_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'aa_plugins_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param htmlobject_response $response - * @param openqrm $openqrm - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->openqrm = $openqrm; - $this->file = $this->openqrm->file(); - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $table = $this->select(); - $t = $this->response->html->template($this->tpldir.'/aa_plugins-select.tpl.php'); - $t->add($this->response->html->thisfile, "thisfile"); - $t->add($table, 'table'); - $t->add($this->lang['label'], 'label'); - $t->add($this->lang['lang_filter'], 'lang_filter'); - $t->add($this->lang['please_wait'], 'please_wait'); - return $t; - } - - //-------------------------------------------- - /** - * Select - * - * @access public - * @return htmlobject_tablebulider - */ - //-------------------------------------------- - function select() { - - $icon_started = $this->lang['action_stop']; - $icon_stopped = $this->lang['action_start']; - $icon_enabled = $this->lang['action_disable']; - $icon_disabled = $this->lang['action_enable']; - - $plugin = new plugin(); - $plugins_available = $plugin->available(); - $plugins_enabled = $plugin->enabled(); - $plugins_started = $plugin->started(); - - $h = array(); - $h['name']['title'] = $this->lang['table_name']; - - $h['type']['title'] = ' '; - $h['type']['sortable'] = ' '; - - $h['type_n']['title'] = $this->lang['table_type']; - $h['type_n']['hidden'] = true; - - $h['description']['title'] = $this->lang['table_description']; - $h['description']['sortable'] = false; - - $h['configure']['title'] = " "; - $h['configure']['sortable'] = false; - - $h['enabled']['title'] = " "; - $h['enabled']['sortable'] = false; - - $h['enabled_n']['title'] = $this->lang['table_enabled']; - $h['enabled_n']['hidden'] = true; - - $h['started']['title'] = " "; - $h['started']['sortable'] = false; - - $h['started_n']['title'] = $this->lang['table_started']; - $h['started_n']['hidden'] = true; - - $table = $this->response->html->tablebuilder('plugins', $this->response->get_array($this->actions_name, 'select')); - $table->max = count($plugins_available); - $table->sort = 'name'; - $table->limit = 0; - $table->order = 'ASC'; - $table->init(); - $tps = $table->get_params(); - $tp = ''; - foreach($tps['plugins'] as $k => $v) { - $tp .= '&plugins['.$k.']='.$v; - } - - $RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; - $thisfile = $this->response->html->thisfile; - $b = array(); - $plugtype = array(); - $i = 0; - $openqrm_version = $this->openqrm->get('config', 'SERVER_VERSION'); - - foreach ($plugins_available as $index => $plugin_name) { - $tmp = $plugin->get_config($plugin_name); - $plugin_description = $tmp['description']; - $plugin_type = $tmp['type']; - $plugtype[] = $plugin_type; - $plugin_version = $tmp['version']; - $plugin_major = substr($plugin_version, 0, strpos($plugin_version, '.')); - $plugin_minor = substr($plugin_version, strpos($plugin_version, '.')+1); - $plugin_minor = substr($plugin_minor, 0, strpos($plugin_minor, '.')); - $plugin_base_version = $plugin_major.".".$plugin_minor; - - if (!strlen($this->response->html->request()->get('plugin_filter')) || strstr($this->response->html->request()->get('plugin_filter'), $plugin_type )) { - - // - $b[$i] = array(); - - // plugin version mismatch - if ($openqrm_version != $plugin_base_version) { - $b[$i]['name'] = $plugin_name; - $b[$i]['type'] = ''.$plugin_type.''; - $b[$i]['type_n'] = $plugin_type; - $b[$i]['description'] = $plugin_description; - $b[$i]['enabled'] = $this->lang['version_mismatch']; - $b[$i]['enabled_n'] = 'b'; - $b[$i]['started'] = ' '; - $b[$i]['started_n'] = 'c'; - $b[$i]['configure'] = ''; - - } else { - - // plugin not enabled! - if (!in_array($plugin_name, $plugins_enabled)) { - - $a = $this->response->html->a(); - $a->label = $icon_disabled; - $a->href = $this->response->get_url($this->actions_name, "enable"); - $a->href .= '&'.$this->identifier_name.'[]='.$plugin_name; - $a->href .= '&plugin_filter='.$this->response->html->request()->get('plugin_filter'); - $a->href .= $tp; - $a->href .= '#'.$plugin_name; - // anchor - $a->name = $plugin_name; - $a->handler = 'onclick="wait();"'; - $a->css = 'enable'; - $a->title = sprintf($this->lang['title_enable'], $plugin_name); - - $b[$i]['name'] = $plugin_name; - $b[$i]['type'] = ''.$plugin_type.''; - $b[$i]['type_n'] = $plugin_type; - $b[$i]['description'] = $plugin_description; - $b[$i]['enabled'] = $a->get_string(); - $b[$i]['enabled_n'] = 'b'; - $b[$i]['started'] = ' '; - $b[$i]['started_n'] = 'c'; - } else { - $plugin_icon_path="$RootDir/plugins/$plugin_name/img/plugin.png"; - $plugin_icon="/openqrm/base/plugins/$plugin_name/img/plugin.png"; - $plugin_icon_default="/openqrm/base/plugins/aa_plugins/img/plugin.png"; - if ($this->file->exists($plugin_icon_path)) { - $plugin_icon_default=$plugin_icon; - } - - $a = $this->response->html->a(); - $a->label = $icon_enabled; - $a->href = $this->response->get_url($this->actions_name, "disable"); - $a->href .= '&'.$this->identifier_name.'[]='.$plugin_name; - $a->href .= '&plugin_filter='.$this->response->html->request()->get('plugin_filter'); - $a->href .= $tp; - $a->href .= '#'.$plugin_name; - // anchor - $a->name = $plugin_name; - $a->handler = 'onclick="wait();"'; - $a->css = (!in_array($plugin_name, $plugins_started)) - ? 'disable' - : 'disable disabled'; - $a->title = sprintf($this->lang['title_disable'], $plugin_name); - - $b[$i]['name'] = $plugin_name; - $b[$i]['type'] = ''.$plugin_type.''; - $b[$i]['type_n'] = $plugin_type; - $b[$i]['description'] = $plugin_description; - $b[$i]['enabled'] = $a->get_string(); - $b[$i]['enabled_n'] = 'a'; - - // started ? - if (!in_array($plugin_name, $plugins_started)) { - $a = $this->response->html->a(); - $a->label = $icon_stopped; - $a->href = $this->response->get_url($this->actions_name, "start"); - $a->href .= '&'.$this->identifier_name.'[]='.$plugin_name; - $a->href .= '&plugin_filter='.$this->response->html->request()->get('plugin_filter'); - $a->href .= $tp; - $a->href .= '#'.$plugin_name; - $a->handler = 'onclick="wait();"'; - $a->css = 'start'; - $a->title = sprintf($this->lang['title_start'], $plugin_name); - - $b[$i]['started'] = $a->get_string(); - $b[$i]['started_n'] = 'b'; - } else { - $a = $this->response->html->a(); - $a->label = $icon_started; - $a->href = $this->response->get_url($this->actions_name, "stop"); - $a->href .= '&'.$this->identifier_name.'[]='.$plugin_name; - $a->href .= '&plugin_filter='.$this->response->html->request()->get('plugin_filter'); - $a->href .= $tp; - $a->href .= '#'.$plugin_name; - $a->handler = 'onclick="wait();"'; - $a->css = 'stop'; - $a->title = sprintf($this->lang['title_stop'], $plugin_name); - - $b[$i]['started'] = $a->get_string(); - $b[$i]['started_n'] = 'a'; - } - } - // configure button - $b[$i]['configure'] = ''; - if(isset($tmp['configurable'])) { - $a = $this->response->html->a(); - $a->label = $this->lang['action_configure']; - $a->href = $this->response->get_url($this->actions_name, "configure"); - $a->href .= '&'.$this->identifier_name.'='.$plugin_name; - $a->href .= '&plugin_filter='.$this->response->html->request()->get('plugin_filter'); - $a->href .= $tp; - $a->handler = 'onclick="wait();"'; - $a->css = 'manage'; - $a->title = sprintf($this->lang['title_configure'], $plugin_name); - $b[$i]['configure'] = $a->get_string(); - } - } - $i++; - } - } - - $plugs = array(); - $plugs[] = array('',''); - $plugtype = array_unique($plugtype); - natcasesort($plugtype); - foreach($plugtype as $p) { - $plugs[] = array($p,ucfirst($p)); - } - - $select = $this->response->html->select(); - $select->add($plugs, array(0,1)); - $select->name = 'plugin_filter'; - $select->handler = 'onchange="wait();this.form.submit();return false;"'; - $select->selected = array($this->response->html->request()->get('plugin_filter')); - - $box = $this->response->html->box(); - $box->add($select); - $box->id = 'plugins_filter'; - $box->css = 'htmlobject_box'; - $box->label = $this->lang['lang_filter']; - - $table->id = 'Tabelle'; - $table->tr_handler = array(); - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->autosort = true; - $table->sort_link = false; - $table->add_headrow($box->get_string()); - $table->head = $h; - $table->body = $b; - $table->max = count($b); - $table->form_action = $this->response->html->thisfile; - /* - $table->actions_name = $this->actions_name; - $table->actions = array( - array('enable' => $this->lang['action_enable']), - array('disable' => $this->lang['action_disable']), - array('start' => $this->lang['action_start']), - array('stop' => $this->lang['action_stop']) - ); - - $table->identifier = 'name'; - $table->identifier_name = $this->identifier_name; - */ - return $table; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.start.class.php b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.start.class.php deleted file mode 100644 index d2366c4..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.start.class.php +++ /dev/null @@ -1,130 +0,0 @@ - - */ - -class aa_plugins_start -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'aa_plugins_action'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'aa_plugins_identifier'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "aa_plugins_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'aa_plugins_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param htmlobject_response $response - * @param file $file - */ - //-------------------------------------------- - function __construct($response, $file) { - $this->response = $response; - $this->file = $file; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $msg = ''; - $event = new event(); - $server = new openqrm_server(); - $plugin = new plugin(); - $identifier = $this->response->html->request()->get($this->identifier_name); - $enabled = $plugin->enabled(); - if($identifier !== '') { - foreach($identifier as $id) { - if(in_array($id, $enabled)) { - $return = $server->send_command("openqrm_server_plugin_command $id start"); - if($return === true) { - if ($this->__check($id)) { - $msg .= sprintf($this->lang['msg'], $id).'
    '; - } else { - $msg .= sprintf($this->lang['error_timeout'], $id).'
    '; - } - } else { - $msg .= sprintf($this->lang['error_start'], $id).'
    '; - } - } - } - } - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - - //-------------------------------------------- - /** - * Check plugin state - * - * @access private - * @param string $plugin - * @return bool - */ - //-------------------------------------------- - function __check($plugin) { - $f = $_SERVER["DOCUMENT_ROOT"]."/openqrm/base/plugins/".$plugin."/.running"; - $i = 0; - while (!$this->file->exists($f)) { - sleep(1); - $i++; - if ($i > 20) { - return false; - } - } - return true; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.stop.class.php b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.stop.class.php deleted file mode 100644 index ac38ccd..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/class/aa_plugins.stop.class.php +++ /dev/null @@ -1,131 +0,0 @@ - - */ - -class aa_plugins_stop -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'aa_plugins_action'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'aa_plugins_identifier'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "aa_plugins_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'aa_plugins_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param htmlobject_response $response - * @param file $file - */ - //-------------------------------------------- - function __construct($response, $file) { - $this->response = $response; - $this->file = $file; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $msg = ''; - $event = new event(); - $server = new openqrm_server(); - $plugin = new plugin(); - $identifier = $this->response->html->request()->get($this->identifier_name); - $enabled = $plugin->enabled(); - $started = $plugin->started(); - if($identifier !== '') { - foreach($identifier as $id) { - if(in_array($id, $enabled) && in_array($id, $started)) { - $return = $server->send_command("openqrm_server_plugin_command $id stop"); - if($return === true) { - if ($this->__check($id)) { - $msg .= sprintf($this->lang['msg'], $id).'
    '; - } else { - $msg .= sprintf($this->lang['error_timeout'], $id).'
    '; - } - } else { - $msg .= sprintf($this->lang['error_stop'], $id).'
    '; - } - } - } - } - $this->response->redirect( - $this->response->get_url($this->actions_name, 'select', $this->message_param, $msg) - ); - } - - //-------------------------------------------- - /** - * Check plugin state - * - * @access private - * @param string $plugin - * @return bool - */ - //-------------------------------------------- - function __check($plugin) { - $f = $_SERVER["DOCUMENT_ROOT"]."/openqrm/base/plugins/".$plugin."/.running"; - $i = 0; - while ($this->file->exists($f)) { - sleep(1); - $i++; - if ($i > 20) { - return false; - } - } - return true; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/css/aa_plugins.css b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/css/aa_plugins.css deleted file mode 100644 index 3f0f752..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/css/aa_plugins.css +++ /dev/null @@ -1,52 +0,0 @@ -.htmlobject_td.icon, -.htmlobject_td.type, -.htmlobject_td.type { - text-align:center; - width: 60px; -} -.htmlobject_td.enabled, -.htmlobject_td.configure, -.htmlobject_td.started { - width: 80px; - padding: 8px 5px 0px 0px; -} -.htmlobject_td.configure { - padding: 10px 4px 10px 15px; -} -.htmlobject_td.enabled, -.htmlobject_td.started { - padding: 10px 4px 10px 0px; - margin: 0px; -} -#page #middle #content #plugins_filter .left { - width:110px; -} -a.enable, a.disable, a.manage { display:block; padding: 5px 12px 5px 5px; margin: 0px;} -a.start, a.stop { display:block; padding: 5px 12px 5px 5px; margin: 0px;} -a.start { - background: #FF8000; -} -#configure_plugin .htmlobject_box .left { - width: 450px; -} -#configure_plugin .htmlobject_box .left label{ - font-size: 11px; -} -#configure_plugin .htmlobject_box .right input.text { - width: 350px; -} -.htmlobject_tabs_box .msgBox { - display: block; - position: fixed; - top: 20px; - left: 500px; - font-size: 11px; - border: solid 1px #aaaaaa; - background-color: #FFFFE0; - color: black; - padding: 10px 15px; - margin: 0; - z-index: 100; - -webkit-box-shadow: 0 2px 2px 0 rgba(33, 33, 33, 0.5); - box-shadow: 0 2px 2px 0 rgba(33, 33, 33, 0.5); -} diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/lang/de.aa_plugins.ini b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/lang/de.aa_plugins.ini deleted file mode 100644 index a53ad51..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/lang/de.aa_plugins.ini +++ /dev/null @@ -1,58 +0,0 @@ -[select] -tab = "Plugin Verwaltung" -label = "Plugin Verwaltung" -action_start = "starten" -action_stop = "stoppen" -action_enable = "installieren" -action_disable = "deinstallieren" -action_configure = "konfigurieren" -title_start = "Plugin %s starten" -title_stop = "Plugin %s stoppen" -title_enable = "Plugin %s installieren" -title_disable = "Plugin %s deinstallieren" -title_configure = "Plugin %s konfigurieren" -table_name = "Plugin" -table_type = "Typ" -table_description = "Beschreibung" -table_enabled = "installiert" -table_started = "gestartet" -lang_filter = "Filter nach Typ" -please_wait = "Lade Plugins. Bitte warten .." - -[start] -label = "Starte Plugins(s)" -msg = "Plugin %s gestartet" -error_timeout = "Timeout beim starten des Plugins %s" -error_start = "Plugin %s konnte nicht gestartet werden" - -[stop] -label = "Stop Plugins(s)" -msg = "Plugin %s gestoppt" -error_timeout = "Timeout beim stoppen des Plugins %s" -error_stop = "Plugin %s konnte nicht gestoppt werden" - -[enable] -label = "Plugins(s) initialisiern" -msg = "Plugin %s initialisiert" -error_timeout = "Timeout beim initialisiern des Plugin %s" -error_enable = "Plugin %s konnte nicht initialisiert werden" -error_enabled = "Plugin %s ist bereist initialisiert" -error_dependencies = "Plugin Abhängigkeit des %s Plugins fehlgeschlagen. Bitte schlaten Sie zuerst die folgenden Plugins ein: %s" - -[disable] -label = "Plugins(s) deinstallieren" -msg = "Plugin %s deinstalliert" -error_timeout = "Timeout beim deinstallieren des Plugins %s" -error_in_use = "Plugin %s ist noch in Benutzung von openQRM" -error_disable = "Plugin %s konnte nicht deinstalliert werden" -error_dependencies = "Plugin Abhängigkeit des %s Plugins fehlgeschlagen. Bitte schalten Sie zuerst die folgenden Plugins aus: %s" - -[configure] -tab = "Configure Plugin" -label = "Configure Plugin %s" -msg = "Configured plugin %s" -no_data = "No values found to configure" -error_value = "Please do not use blank spaces" -canceled = "Operation canceled. Please wait .." -please_wait = "Loading. Please wait .." - diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/lang/en.aa_plugins.ini b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/lang/en.aa_plugins.ini deleted file mode 100644 index 708b8a9..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/lang/en.aa_plugins.ini +++ /dev/null @@ -1,57 +0,0 @@ -[select] -tab = "Plugin Manager" -label = "Plugin Manager" -action_start = "start" -action_stop = "stop" -action_enable = "install" -action_disable = "uninstall" -action_configure = "configure" -title_start = "click to start plugin %s" -title_stop = "click to stop plugin %s" -title_enable = "click to enable plugin %s" -title_disable = "click to disable plugin %s" -title_configure = "click to configure plugin %s" -table_name = "Plugin" -table_type = "Type" -table_description = "Description" -table_enabled = "installed" -table_started = "running" -lang_filter = "Filter by Type" -please_wait = "Loading. Please wait ..." - -[start] -label = "Start plugin" -msg = "Started plugin %s" -error_timeout = "Timeout while trying to start plugin %s" -error_start = "Could not start plugin %s" - -[stop] -label = "Stop plugin" -msg = "Stopped plugin %s" -error_timeout = "Timeout while trying to stop plugin %s" -error_stop = "Could not stop plugin %s" - -[enable] -label = "Install plugin" -msg = "Install plugin %s" -error_timeout = "Timeout while trying to install plugin %s" -error_enable = "Could not enable plugin %s" -error_enabled = "Plugin %s already installed" -error_dependencies = "Dependencies for %s failed. Please install %s first." - -[disable] -label = "Uninstall plugin" -msg = "Uninstall plugin %s" -error_timeout = "Timeout while trying to uninstall plugin %s" -error_in_use = "Plugin %s is still in use by openQRM" -error_disable = "Could not uninstall plugin %s" -error_dependencies = "Dependencies for %s failed. Please uninstall %s first." - -[configure] -tab = "Configure Plugin" -label = "Configure Plugin %s" -msg = "Configured plugin %s" -no_data = "No values found to configure" -error_value = "Please do not use blank spaces" -canceled = "Operation canceled. Please wait .." -please_wait = "Loading. Please wait .." diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/lang/es.aa_plugins.ini b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/lang/es.aa_plugins.ini deleted file mode 100644 index c4c27f9..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/lang/es.aa_plugins.ini +++ /dev/null @@ -1,57 +0,0 @@ -[select] -tab = "Administrador de extensiones" -label = "Administrador de extensiones" -action_start = "Iniciar" -action_stop = "Detener" -action_enable = "Instalar" -action_disable = "Desintalar" -action_configure = "Configurar" -title_start = "pulsar para iniciar la extensión '%s'" -title_stop = "pulsar para detener la extensión '%s'" -title_enable = "pulsar para habilitar la extensión '%s'" -title_disable = "pulsar para deshabilitar la extensión '%s'" -title_configure = "pulsar para configurar la extensión %s" -table_name = "extensión clave" -table_type = "Clase" -table_description = "Descripción" -table_enabled = "instalado" -table_started = "procesando" -lang_filter = "Clase de filtro" -please_wait = "Cargando. Por favor espere..." - -[start] -label = "Iniciar extensión" -msg = "extensión iniciada %s" -error_timeout = "El tiempo se expiró mientras se intenta iniciar la extensión %s" -error_start = "La extensión %s no se pudo iniciar" - -[stop] -label = "Detener extensión" -msg = "extensión detenida %s" -error_timeout = "El tiempo se expiró mientras se intenta detener la extensión %s" -error_stop = "La extensión %s no se pudo detener" - -[enable] -label = "Habilitar extensión" -msg = "extensión habilitada %s" -error_timeout = "El tiempo se expiró mientras se intenta habilitar la extensión %s" -error_enable = "La extensión %s no se pudo habilitar" -error_enabled = "La extensión %s ya ha sido habilitada" -error_dependencies = "Las dependencias para %s fallaron. Por favor habilite %s primero." - -[disable] -label = "Desabilitar extensión" -msg = "extensión %s desabilitada" -error_timeout = "El tiempo se expiró mientras se intenta desabilitar la extensión %s" -error_in_use = "La extensión %s aun esta en uso por openQRM" -error_disable = "La extensión %s no se pudo desabilitar" -error_dependencies = "Las dependencias para %s fallaron. Por favor habilite %s primero." - -[configure] -tab = "Configurar extensión" -label = "Configurar extensión %s" -msg = "Configurado extensión %s" -no_data = "No se han encontrado para configurar los valores" -error_value = "Por favor, no utilice espacios en blanco" -canceled = "Operación cancelada. Por favor espere .." -please_wait = "Cargando. Por favor espere .." diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/menu.txt b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/menu.txt deleted file mode 100644 index 4ac7fd4..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/menu.txt +++ /dev/null @@ -1,16 +0,0 @@ -# -# openQRM Enterprise developed by OPENQRM AUSTRALIA PTY LTD. -# -# All source code and content (c) Copyright 2021, OPENQRM AUSTRALIA PTY LTD unless specifically noted otherwise. -# -# This source code is released under the GNU General Public License version 2, unless otherwise agreed with OPENQRM AUSTRALIA PTY LTD. -# The latest version of this license can be found here: src/doc/LICENSE.txt -# -# By using this software, you acknowledge having read this license and agree to be bound thereby. -# -# http://openqrm-enterprise.com -# -# Copyright 2021, OPENQRM AUSTRALIA PTY LTD -# -.|Plugins -.|Plugin manager|index.php?plugin=aa_plugins|Manage the available Plugins diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/tpl/aa_plugins-configure.tpl.php b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/tpl/aa_plugins-configure.tpl.php deleted file mode 100644 index bc72064..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/tpl/aa_plugins-configure.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ - -

    {label}

    -
    -
    -
    - {form} -
    {submit} {cancel}
    -
    -
    -
    diff --git a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/tpl/aa_plugins-select.tpl.php b/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/tpl/aa_plugins-select.tpl.php deleted file mode 100644 index bd68de0..0000000 --- a/openQRM-5.3.50-CE/src/web/base/plugins/aa_plugins/tpl/aa_plugins-select.tpl.php +++ /dev/null @@ -1,18 +0,0 @@ - -

    {label}

    -{table} diff --git a/openQRM-5.3.50-CE/src/web/base/server/aa_server/class/datacenter.api.class.php b/openQRM-5.3.50-CE/src/web/base/server/aa_server/class/datacenter.api.class.php deleted file mode 100644 index 40b76b4..0000000 --- a/openQRM-5.3.50-CE/src/web/base/server/aa_server/class/datacenter.api.class.php +++ /dev/null @@ -1,402 +0,0 @@ - -*/ - -class datacenter_api -{ - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param object $controller - */ - //-------------------------------------------- - function __construct($controller) { - $this->controller = $controller; - $this->user = $this->controller->user; - $this->html = $this->controller->response->html; - $this->response = $this->html->response(); - $this->file = $this->controller->file; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - */ - //-------------------------------------------- - function action() { - $action = $this->response->html->request()->get($this->controller->actions_name); - switch( $action ) { - case 'dc_status': - $this->dc_status(); - break; - case 'eventlist': - $this->eventlist(); - break; - case 'statistics': - $this->statistics(); - break; - case 'storage_list': - $this->storage_list(); - break; - case 'server_list': - $this->server_list(); - break; - } - } - - //-------------------------------------------- - /** - * DC Status - * - * @access public - */ - //-------------------------------------------- - function dc_status() { - - // number of idle systems - $resources_all = 0; - // active deployed resources - $resources_active = 0; - // resources in error state - $resources_error = 0; - // physical resources - $resources_physical = 0; - // virtual resources - $resources_virtual = 0; - // number of idle systems - $resources_available = 0; - // physical resource available - $resources_available_physical = 0; - // virtal resource available - $resources_available_virtual = 0; - // overall load - $dc_load_overall = 0; - // active appliance load - $appliance_load_overall = 0; - // peak in appliance load - $appliance_load_peak = 0; - // active appliances - $appliance_active = 0; - // active appliance with resource in error state - $appliance_error = 0; - // storage load - $storage_load_overall = 0; - // storage peak - $storage_load_peak = 0; - // active storages - $storage_active = 0; - // storage with resource in error state - $storage_error = 0; - - // get an array of resources which are assigned to an appliance - $appliance_resources_array = array(); - $appliance = new appliance(); - $appliance_list = $appliance->get_all_ids(); - foreach ($appliance_list as $app) { - $app_id = $app['appliance_id']; - $g_appliance = new appliance(); - $g_appliance->get_instance_by_id($app_id); - $g_appliance_resource = $g_appliance->resources; - if ((!strcmp($g_appliance->state, "active")) || ($g_appliance_resource == 0)) { - if ($g_appliance_resource != "-1") { - $appliance_resources_array[] .= $g_appliance_resource; - } - } - } - // get an array of resources which are a storage server - $storage_resources_array = array(); - $storage = new storage(); - $storage_list = $storage->get_list(); - foreach ($storage_list as $store) { - $storage_id = $store['value']; - $g_storage = new storage(); - $g_storage->get_instance_by_id($storage_id); - $g_storage_resource = $g_storage->resource_id; - $storage_resources_array[] .= $g_storage_resource; - - } - - $restype = 0; - $resource = new resource(); - $resource_list = $resource->get_list(); - foreach ($resource_list as $res) { - $res_id = $res['resource_id']; - //echo "!! res_id $res_id
    "; - $g_resource = new resource(); - $g_resource->get_instance_by_id($res_id); - // start gathering - $resources_all++; - // physical or virtual ? - if ((strlen($g_resource->vtype)) && ($g_resource->vtype != "NULL")) { - $virtualization = new virtualization(); - $virtualization->get_instance_by_id($g_resource->vtype); - if (strstr($virtualization->type, "-vm")) { - // virtual - $resources_virtual++; - $restype=1; - } else { - // physical - $resources_physical++; - $restype=0; - } - } else { - // we treat unknown system types as physical - $resources_physical++; - $restype=0; - } - - - // resource load - // is idle or active ? - if (("$g_resource->imageid" == "1") && ("$g_resource->state" == "active")) { - // idle - $resources_available++; - // virtual or physical ? - if ($restype == 0) { - $resources_available_physical++; - } else { - $resources_available_virtual++; - } - } else if ("$g_resource->state" == "active") { - // active - $resources_active++; - $dc_load_overall = $dc_load_overall + $g_resource->load; - - // is storage ? - if (in_array($g_resource->id, $storage_resources_array)) { - $storage_active++; - $storage_load_overall = $storage_load_overall + $g_resource->load; - // is peak ? - if ($g_resource->load > $storage_load_peak) { - $storage_load_peak = $g_resource->load; - } - } - // is appliance ? - if (in_array($g_resource->id, $appliance_resources_array)) { - $appliance_active++; - $appliance_load_overall = $appliance_load_overall + $g_resource->load; - // is peak ? - if ($g_resource->load > $appliance_load_peak) { - $appliance_load_peak = $g_resource->load; - } - } - - - } else if ("$g_resource->state" == "error") { - // error - $resources_error++; - // is storage ? - if (in_array($g_resource->id, $storage_resources_array)) { - $storage_error++; - } - // is appliance ? - if (in_array($g_resource->id, $appliance_resources_array)) { - $appliance_error++; - } - } - } - // end of gathering - - // divide with number of active resources, appliances + storages - if ($resources_active != 0) { - $dc_load_overall = $dc_load_overall/$resources_active; - $dc_load_overall = number_format($dc_load_overall, 2, '.', ''); - } - if ($appliance_active != 0) { - $appliance_load_overall = $appliance_load_overall/$appliance_active; - $appliance_load_overall = number_format($appliance_load_overall, 2, '.', ''); - } - if ($storage_active != 0) { - $storage_load_overall = $storage_load_overall/$storage_active; - $storage_load_overall = number_format($storage_load_overall, 2, '.', ''); - } - - echo "$dc_load_overall,$storage_load_overall,$storage_load_peak,$appliance_load_overall,$appliance_load_peak,$resources_all,$resources_physical,$resources_virtual,$resources_available,$resources_available_physical,$resources_available_virtual,$resources_error,$appliance_error,$storage_error"; - exit(0); - } - - //-------------------------------------------- - /** - * Get the last 10 event log entries - * TODO: Add param 'limit' - * - * @access public - */ - //-------------------------------------------- - function eventlist() { - // check permissions - $this->controller->openqrm->init(); - $class ='event_controller'; - $path = $this->controller->openqrm->get('webdir').'/server/event/class/event.controller.class.php'; - $role = $this->controller->openqrm->role($this->response); - require_once($path); - $controller = new $class($this->controller->openqrm, $this->response); - $_REQUEST[$controller->actions_name] = 'select'; - $data = $role->check_permission($controller, true); - if($data === true) { - $event = new event(); - $event_list = $event->display_overview(0,14,'event_time','desc'); // $offset, $limit, $sort, $order, $mode = null - echo json_encode($event_list); - } else { - $msg = array( - array( - 'event_priority' => '9', - 'event_source' => 'Permissions', - 'event_time' => time(), - 'event_description' => 'Permission denied for action select on controller events', - ) - ); - echo json_encode($msg); - } - exit(0); - } - - //-------------------------------------------- - /** - * Get datacenter load statistics - * currently used in the dashboard load chart - * - * @access public - */ - //-------------------------------------------- - function statistics() { - require_once($this->controller->openqrm->get('basedir').'/web/base/server/aa_server/class/datacenter.class.php'); - $data = new datacenter(); - echo json_encode($data->get()); - exit(0); - } - - //-------------------------------------------- - /** - * Get full storage list. - * Storage type names are injected in storageList - * used in the dashboard load chart - * - * @access public - */ - //-------------------------------------------- - function storage_list() { - require_once($this->controller->openqrm->get('basedir').'/web/base/class/storage.class.php'); - require_once($this->controller->openqrm->get('basedir').'/web/base/class/deployment.class.php'); - - $deploymentObj = new deployment(); - foreach($deploymentObj->get_storagedescription_list() as $deploymentType){ - $deploymentMap[$deploymentType['value']] = $deploymentType['label']; - } - - $storageObj = new storage(); - $list = $storageObj->get_full_storage_list(); - $storageList = array(); - $i=0; - foreach($list as $key => $storage) { - // check deployment type exists - if(isset($deploymentMap[$storage['storage_type']])) { - $storageList[$i]['storage_type'] = $deploymentMap[$storage['storage_type']]; - $i++; - } - } - echo json_encode($storageList); - exit(0); - } - - //-------------------------------------------- - /** - * Get full server list. - * Virtualization names are injected as string in applist - * used in the dashboard server donut chart - * TODO: Make limit in "display_overview()" call dynamic (e.g. no. of servers) - * - * @access public - */ - //-------------------------------------------- - function server_list() { - require_once($this->controller->openqrm->get('basedir').'/web/base/class/appliance.class.php'); - require_once($this->controller->openqrm->get('basedir').'/web/base/class/virtualization.class.php'); - - $virtObj = new virtualization(); - $list = $virtObj->get_list(); - foreach($list as $virtualization) { - $virtualizationMap[$virtualization['value']] = $virtualization['label']; - } - - $applianceObj = new appliance(); - $list = $applianceObj->display_overview(0, 1000, 'appliance_id', ''); - $applist = array(); - $i=0; - foreach($list as $appliance) { - // check virtualization type exists - if(isset($virtualizationMap[$appliance['appliance_virtualization']])) { - $applist[$i]['appliance_virtualization'] = $virtualizationMap[$appliance['appliance_virtualization']]; - $i++; - } - } - echo json_encode($applist); - exit(0); - } - - //-------------------------------------------- - /** - * Method to map event_priority to status strings. - * - * @todo Should be moved to event object - * @param int $event_priority - * @return string status string - */ - //-------------------------------------------- - function __getEventStatus($event_priority) { - switch ($event_priority) { - /* - case 0: $icon = "off.png"; break; - case 1: $icon = "error.png"; break; - case 2: $icon = "error.png"; break; - case 3: $icon = "error.png"; break; - case 4: $icon = "unknown.png"; break; - case 5: $icon = "active.png"; break; - case 6: $icon = "idle.png"; break; - case 7: $icon = "idle.png"; break; - case 8: $icon = "idle.png"; break; - case 9: $icon = "transition.png"; break; - case 10:$icon = "active.png"; break; - */ - - case 0: - $status = 'disabled'; break; - case 1: - case 2: - case 3: - $status = 'error'; break; // error event - case 4: - case 5: - case 6: - case 7: - case 8: - $status = 'notice'; break; // undefined event - case 9: - $status = 'running'; break; // active event - case 10: - $status = 'ok'; break; // notice event - default: - $status = 'unkown'; break; - - } - return $status; - } -} diff --git a/openQRM-5.3.50-CE/src/web/base/server/aa_server/class/datacenter.class.php b/openQRM-5.3.50-CE/src/web/base/server/aa_server/class/datacenter.class.php deleted file mode 100644 index 524729b..0000000 --- a/openQRM-5.3.50-CE/src/web/base/server/aa_server/class/datacenter.class.php +++ /dev/null @@ -1,322 +0,0 @@ - -*/ - -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once $RootDir."/include/openqrm-database-functions.php"; -require_once $RootDir."/class/resource.class.php"; -require_once $RootDir."/class/storage.class.php"; -require_once $RootDir."/class/appliance.class.php"; -require_once $RootDir."/class/event.class.php"; - - -/** - * This class represents the datacenter statistics for the openQRM Dashboard - * - * @package openQRM - * @author Matt Rechenburg - * @version 1.0 - * @author M. Rechenburg, A. Kuballa - * @version 1.1 added documentation - * @copyright Copyright 2013, OPENQRM AUSTRALIA PTY LTD - */ -class datacenter -{ - -/** -* datacenter id -* @access protected -* @var int -*/ -var $id = ''; -/** -* datacenter load_overall -* @access protected -* @var string -*/ -var $load_overall = ''; -/** -* datacenter load_server -* @access protected -* @var date -*/ -var $load_server = ''; -/** -* datacenter load_storage -* @access protected -* @var int -*/ -var $load_storage = ''; -/** -* datacenter cpu_total -* @access protected -* @var string -*/ -var $cpu_total = ''; -/** -* datacenter mem_total -* @access protected -* @var string -*/ -var $mem_total = ''; -/** -* datacenter mem_used -* @access protected -* @var string -*/ -var $mem_used = ''; -/** -* datacenter resolution -* @access protected -* @var string -*/ -var $resolution = 60; -/** -* datacenter last statistic id -* @access protected -* @var string -*/ -var $oldest_statistics_id = ''; -/** -* datacenter time of the last statistics -* @access protected -* @var string -*/ -var $last_statistics = ''; - - - - - //-------------------------------------------------- - /** - * Constructor - */ - //-------------------------------------------------- - function datacenter() { - $this->init(); - } - - //-------------------------------------------------- - /** - * init datacenter environment - * @access public - */ - //-------------------------------------------------- - function init() { - $this->_db_table = 'datacenter_info'; - $this->RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; - $this->event = new event(); - } - - - //-------------------------------------------------- - /** - * get number of statistics in datacenter - * @access public - * @return int - */ - //-------------------------------------------------- - function get_count() { - $count=0; - $sql = "select count(datacenter_id) as num from ".$this->_db_table; - $db=openqrm_get_db_connection(); - $rs = $db->Execute($sql); - if (!$rs) { - $this->log("get_count", $_SERVER['REQUEST_TIME'], 2, "datacenter.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - $count = $rs->fields["num"]; - } - return $count; - } - - - - - //-------------------------------------------------- - /** - * add statistics to datacenter - * - * $datacenter = new datacenter(); - * $datacenter->statistics(); - * - * @access public - * @param int $datacenter_id - * @param array $datacenter_fields - * @return bool - */ - //--------------------------------------------------e - function statistics() { - $resources_all = 0; - $resources_active = 0; - $resources_available = 0; - $dc_load_overall = 0; - $appliance_load_overall = 0; - $appliance_active = 0; - $storage_load_overall = 0; - $storage_active = 0; - $cpu_total = 0; - $mem_used = 0; - $mem_total = 0; - - // run only each minute - $db=openqrm_get_db_connection(); - $rs = $db->Execute("select MAX(datacenter_id) from $this->_db_table"); - foreach ($rs as $index => $dc) { - if (isset($dc['MAX(datacenter_id)'])) { - $this->last_statistics = $dc['MAX(datacenter_id)']; - } else if (isset($dc['max'])) { - $this->last_statistics = $dc['max']; - } - } - // get an array of resources which are assigned to an appliance - $appliance_resources_array = array(); - $appliance = new appliance(); - $appliance_list = $appliance->get_all_ids(); - foreach ($appliance_list as $app) { - $app_id = $app['appliance_id']; - $g_appliance = new appliance(); - $g_appliance->get_instance_by_id($app_id); - $g_appliance_resource = $g_appliance->resources; - if ((!strcmp($g_appliance->state, "active")) || ($g_appliance_resource == 0)) { - if ($g_appliance_resource != "-1") { - $appliance_resources_array[] .= $g_appliance_resource; - } - } - } - // get an array of resources which are a storage server - $storage_resources_array = array(); - $storage = new storage(); - $storage_list = $storage->get_list(); - foreach ($storage_list as $store) { - $storage_id = $store['value']; - $g_storage = new storage(); - $g_storage->get_instance_by_id($storage_id); - $g_storage_resource = $g_storage->resource_id; - $storage_resources_array[] .= $g_storage_resource; - - } - - $resource = new resource(); - $resource_list = $resource->get_list(); - foreach ($resource_list as $res) { - $res_id = $res['resource_id']; - //echo "!! res_id $res_id
    "; - $g_resource = new resource(); - $g_resource->get_instance_by_id($res_id); - // start gathering - $resources_all++; - $cpu_total = $cpu_total + $g_resource->cpunumber; - $mem_used = $mem_used + $g_resource->memused; - $mem_total = $mem_total + $g_resource->memtotal; - // resource load - if (("$g_resource->imageid" == "1") && ("$g_resource->state" == "active")) { - // idle - $resources_available++; - } else if ("$g_resource->state" == "active") { - // active - $resources_active++; - $dc_load_overall = $dc_load_overall + $g_resource->load; - // is storage ? - if (in_array($g_resource->id, $storage_resources_array)) { - $storage_active++; - $storage_load_overall = $storage_load_overall + $g_resource->load; - } - // is appliance ? - if (in_array($g_resource->id, $appliance_resources_array)) { - $appliance_active++; - $appliance_load_overall = $appliance_load_overall + $g_resource->load; - } - } - } - if ($resources_active != 0) { - $dc_load_overall = $dc_load_overall/$resources_active; - $dc_load_overall = number_format($dc_load_overall, 2, '.', ''); - } - if ($appliance_active != 0) { - $appliance_load_overall = $appliance_load_overall/$appliance_active; - $appliance_load_overall = number_format($appliance_load_overall, 2, '.', ''); - } - if ($storage_active != 0) { - $storage_load_overall = $storage_load_overall/$storage_active; - $storage_load_overall = number_format($storage_load_overall, 2, '.', ''); - } - - $datacenter_fields = array(); - $datacenter_fields['datacenter_load_overall'] = $dc_load_overall; - $datacenter_fields['datacenter_load_server'] = $appliance_load_overall; - $datacenter_fields['datacenter_load_storage'] = $storage_load_overall; - $datacenter_fields['datacenter_cpu_total'] = $cpu_total; - $datacenter_fields['datacenter_mem_total'] = $mem_total; - $datacenter_fields['datacenter_mem_used'] = $mem_used; - - $stats_count = $this->get_count(); - if ($stats_count >= $this->resolution) { - $rs = $db->Execute("select MIN(datacenter_id) from $this->_db_table"); - foreach ($rs as $index => $dc) { - if (isset($dc['MIN(datacenter_id)'])) { - $this->oldest_statistics_id = $dc['MIN(datacenter_id)']; - } else if (isset($dc['min'])) { - $this->oldest_statistics_id = $dc['min']; - } - } - $rs = $db->Execute("delete from $this->_db_table where datacenter_id=$this->oldest_statistics_id"); - $stats_count = $this->get_count(); - } - $datacenter_fields['datacenter_id'] = (int)str_replace(".", "", str_pad(microtime(true), 15, "0")); - $result = $db->AutoExecute($this->_db_table, $datacenter_fields, 'INSERT'); - if (! $result) { - $this->event->log("add", $_SERVER['REQUEST_TIME'], 2, "datacenter.class.php", "Failed updating datacenter ".$datacenter_fields['datacenter_id'], "", "", 0, 0, 0); - } - } - - - //-------------------------------------------------- - /** - * get an array of datacenter statistics - * - * $datacenter = new datacenter(); - * $arr = $datacenter->get_list(); - * // $arr[0]['value'] - * // $arr[0]['label'] - * - * @access public - * @return array - */ - //-------------------------------------------------- - function get() { - $sql = "select * from ".$this->_db_table." order by datacenter_id ASC"; - $db=openqrm_get_db_connection(); - $recordSet = $db->SelectLimit($sql, 60, 0); - $datacenter_array = array(); - if (!$recordSet) { - $this->log("get", $_SERVER['REQUEST_TIME'], 2, "datacenter.class.php", $db->ErrorMsg(), "", "", 0, 0, 0); - } else { - while (!$recordSet->EOF) { - array_push($datacenter_array, $recordSet->fields); - $recordSet->MoveNext(); - } - $recordSet->Close(); - } - return $datacenter_array; - - } - - - - -} diff --git a/openQRM-5.3.50-CE/src/web/base/server/aa_server/class/datacenter.controller.class.php b/openQRM-5.3.50-CE/src/web/base/server/aa_server/class/datacenter.controller.class.php deleted file mode 100644 index d8a9009..0000000 --- a/openQRM-5.3.50-CE/src/web/base/server/aa_server/class/datacenter.controller.class.php +++ /dev/null @@ -1,185 +0,0 @@ - - */ - -class datacenter_controller -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'datacenter_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "datacenter_msg"; -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'datacenter_tab'; -/** -* identifier name -* @access public -* @var string -*/ -var $identifier_name = 'datacenter_identifier'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array( - 'dashboard' => array ( - 'tab' => 'Datacenters', - 'label' => 'Datacenters', - 'title' => 'openQRM Datacenter Dashboard', - 'load_headline' => 'Datacenter Load', - 'load_current' => 'current', - 'load_last_hour' => 'last hour', - 'inventory_headline' => 'Inventory', - 'inventory_servers' => 'Server by type', - 'inventory_storages' => 'Storage Pool', - 'events_headline' => 'Events', - 'events_date' => 'Date', - 'events_source' => 'Source', - 'events_description' => 'Description', - 'datacenter_load_overall' => 'Datacenter (overall)', - 'appliance_load_overall' => 'Server', - 'storage_load_overall' => 'Storage', - 'link_server_management' => 'Server Management', - 'link_storage_management' => 'Storage Management', - 'no_data_available' => 'No Data available', - 'please_wait' => 'Loading. Please wait ..', - ), -); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->openqrm = $openqrm; - $this->user = $this->openqrm->user(); - $this->rootdir = $this->openqrm->get('webdir'); - $this->tpldir = $this->rootdir.'/server/aa_server/tpl'; - $this->response = $response; - $this->file = $this->openqrm->file(); - $this->lang = $this->user->translate($this->lang, $this->rootdir."/server/aa_server/lang", 'datacenter.ini'); -// $response->html->debug(); - - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @param string $action - * @return htmlobject_tabmenu - */ - //-------------------------------------------- - function action($action = null) { - $this->action = ''; - $ar = $this->response->html->request()->get($this->actions_name); - if($ar !== '') { - $this->action = $ar; - } - else if(isset($action)) { - $this->action = $action; - } - if($this->response->cancel()) { - $this->action = "dashboard"; - } - - $content = array(); - switch( $this->action ) { - case '': - case 'dashboard': - $content[] = $this->dashboard(true); - break; - } - - $tab = $this->response->html->tabmenu($this->prefix_tab); - $tab->message_param = $this->message_param; - $tab->css = 'htmlobject_tabs'; - $tab->add($content); - return $tab; - } - - //-------------------------------------------- - /** - * API - * - * @access public - */ - //-------------------------------------------- - function api() { - require_once($this->rootdir.'/server/aa_server/class/datacenter.api.class.php'); - $controller = new datacenter_api($this); - $controller->action(); - } - - - //-------------------------------------------- - /** - * Datacenter Dashboard - * - * @access public - * @param bool $hidden - * @return array - */ - //-------------------------------------------- - function dashboard( $hidden = true ) { - $data = ''; - if( $hidden === true ) { - require_once($this->rootdir.'/server/aa_server/class/datacenter.dashboard.class.php'); - $controller = new datacenter_dashboard($this->openqrm, $this->response); - $controller->actions_name = $this->actions_name; - $controller->tpldir = $this->tpldir; - $controller->message_param = $this->message_param; - $controller->identifier_name = $this->identifier_name; - $controller->lang = $this->lang['dashboard']; - $data = $controller->action(); - } - $content['label'] = $this->lang['dashboard']['tab']; - $content['value'] = $data; - $content['target'] = $this->response->html->thisfile; - $content['request'] = $this->response->get_array($this->actions_name, 'dashboard' ); - $content['onclick'] = false; - if($this->action === 'dashboard'){ - $content['active'] = true; - } - return $content; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/server/aa_server/class/datacenter.dashboard.class.php b/openQRM-5.3.50-CE/src/web/base/server/aa_server/class/datacenter.dashboard.class.php deleted file mode 100644 index 38ab941..0000000 --- a/openQRM-5.3.50-CE/src/web/base/server/aa_server/class/datacenter.dashboard.class.php +++ /dev/null @@ -1,184 +0,0 @@ - - */ - -class datacenter_dashboard -{ -/** -* name of action buttons -* @access public -* @var string -*/ -var $actions_name = 'datacenter_action'; -/** -* message param -* @access public -* @var string -*/ -var $message_param = "datacenter_msg"; - -/** -* id for tabs -* @access public -* @var string -*/ -var $prefix_tab = 'datacenter_tab'; -/** -* path to templates -* @access public -* @var string -*/ -var $tpldir; -/** -* translation -* @access public -* @var array -*/ -var $lang = array(); - - //-------------------------------------------- - /** - * Constructor - * - * @access public - * @param openqrm $openqrm - * @param htmlobject_response $response - */ - //-------------------------------------------- - function __construct($openqrm, $response) { - $this->response = $response; - $this->file = $openqrm->file(); - $this->openqrm = $openqrm; - } - - //-------------------------------------------- - /** - * Action - * - * @access public - * @return htmlobject_template - */ - //-------------------------------------------- - function action() { - $t = $this->response->html->template($this->tpldir.'/datacenter-dashboard.tpl.php'); - - $t->add($this->lang['title'], 'title'); - $t->add($this->lang['load_headline'], 'load_headline'); - $t->add($this->lang['load_current'], 'load_current'); - $t->add($this->lang['load_last_hour'], 'load_last_hour'); - $t->add($this->lang['datacenter_load_overall'], 'datacenter_load_overall'); - $t->add($this->lang['appliance_load_overall'], 'appliance_load_overall'); - $t->add($this->lang['storage_load_overall'], 'storage_load_overall'); - $t->add($this->lang['inventory_headline'], 'inventory_headline'); - $t->add($this->lang['inventory_servers'], 'lang_inventory_servers'); - $t->add($this->lang['inventory_storages'], 'lang_inventory_storages'); - $t->add($this->lang['events_headline'], 'events_headline'); - $t->add($this->lang['events_date'], 'events_date'); - $t->add($this->lang['events_source'], 'events_source'); - $t->add($this->lang['events_description'], 'events_description'); - $t->add($this->lang['no_data_available'], 'no_data_available'); - -/* - $t->add($this->lang['resource_overview'], 'resource_overview'); - $t->add($this->lang['resource_load_physical'], 'resource_load_physical'); - $t->add($this->lang['resource_load_vm'], 'resource_load_vm'); - $t->add($this->lang['resource_available_overall'], 'resource_available_overall'); - $t->add($this->lang['resource_available_physical'], 'resource_available_physical'); - $t->add($this->lang['resource_available_vm'], 'resource_available_vm'); - $t->add($this->lang['resource_error_overall'], 'resource_error_overall'); - $t->add($this->lang['appliance_overview'], 'appliance_overview'); - $t->add($this->lang['appliance_load_peak'], 'appliance_load_peak'); - $t->add($this->lang['appliance_error_overall'], 'appliance_error_overall'); - $t->add($this->lang['storage_overview'], 'storage_overview'); - $t->add($this->lang['storage_load_peak'], 'storage_load_peak'); - $t->add($this->lang['storage_error_overall'], 'storage_error_overall'); -*/ - - $t->add($this->openqrm->get('baseurl'), 'baseurl'); - $t->add($this->lang['please_wait'], 'please_wait'); - $t->add($this->prefix_tab, 'prefix_tab'); - $t->group_elements(array('param_' => 'form')); - - - $link_server = $this->response->html->a(); - $link_server->label = $this->lang['link_server_management']; - $link_server->title = 'Server Management'; - $link_server->href = 'index.php?base=appliance'; - $link_server->css = 'btn add'; - $t->add($link_server, 'link_server_management'); - - $link_storage = $this->response->html->a(); - $link_storage->label = $this->lang['link_storage_management']; - $link_storage->title = 'Server Management'; - $link_storage->href = 'index.php?base=storage'; - $link_storage->css = 'btn add'; - $t->add($link_storage, 'link_storage_management'); - - - // Get dashboard quicklink from hook files - $quicklinks = $this->build_quicklinks(); - if(count($quicklinks) > 0) { - $t->add('

    Quicklinks

    ', 'quicklinks_headline'); - $t->add(implode('', $quicklinks), 'quicklinks'); - } else { - - // TODO: find nicer way to 'unset' view markers if not needed - // perhaps htmlobjects can do the job - $t->add('', 'quicklinks_headline'); - $t->add('', 'quicklinks'); - } - - return $t; - } - - - - //-------------------------------------------- - /** - * build_quicklinks: Scan directories of started plugins for the - * dashboard quicklink hook and call hook method - * - * @access private - * @return array - */ - //-------------------------------------------- - private function build_quicklinks() { - - $quicklinks = array(); - $plugin = new plugin(); - $started_plugins = $plugin->started(); // get list of running plugins - - foreach ($started_plugins as $plugin_name) { - - $hook_file = $this->openqrm->get('webdir')."/plugins/".$plugin_name."/openqrm-".$plugin_name."-dashboard-quicklink-hook.php"; - if (file_exists($hook_file)) { - require_once $hook_file; - - $hook_function = 'get_'.$plugin_name.'_dashboard_quicklink'; - if(function_exists($hook_function)) { - - $link = $hook_function($this->response->html); - if(is_object($link)) { - $quicklinks[] = $link->get_string(); - } - } - } - } - return $quicklinks; - } - -} diff --git a/openQRM-5.3.50-CE/src/web/base/server/aa_server/css/aa_server.css b/openQRM-5.3.50-CE/src/web/base/server/aa_server/css/aa_server.css deleted file mode 100644 index 1a39016..0000000 --- a/openQRM-5.3.50-CE/src/web/base/server/aa_server/css/aa_server.css +++ /dev/null @@ -1,38 +0,0 @@ -/* Override default margin in dashboard */ -.aa_server h2 { - margin-top: 30px; - border-bottom: 1px solid #ccc; -} - -.aa_server h2 .widget-action { - font-size:12px; - opacity: 0.7; - text-decoration: none; - color: #353535; -} -.aa_server h2 .widget-action *{ - vertical-align: baseline; -} -.aa_server .eventtable td { - font-size: 85%; -} -.aa_server .donut-chart-legend { - margin-top:-25px; -} -.aa_server .donut-chart-legend ul { - list-style: none; - margin: 0; - padding-left: 40px; -} -.aa_server .donut-chart-legend ul li { - font-size: 11px; -} - -.aa_server .donut-chart-legend li .legend-tile { - width: 10px; - height: 10px; - background: #bababa; - float: left; - display: inline; - margin: 5px 5px 0 0; -} diff --git a/openQRM-5.3.50-CE/src/web/base/server/aa_server/css/jquery.jqplot.min.css b/openQRM-5.3.50-CE/src/web/base/server/aa_server/css/jquery.jqplot.min.css deleted file mode 100644 index 4cd9d55..0000000 --- a/openQRM-5.3.50-CE/src/web/base/server/aa_server/css/jquery.jqplot.min.css +++ /dev/null @@ -1 +0,0 @@ -.jqplot-target{position:relative;color:#666;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:1em;}.jqplot-axis{font-size:.75em;}.jqplot-xaxis{margin-top:10px;}.jqplot-x2axis{margin-bottom:10px;}.jqplot-yaxis{margin-right:10px;}.jqplot-y2axis,.jqplot-y3axis,.jqplot-y4axis,.jqplot-y5axis,.jqplot-y6axis,.jqplot-y7axis,.jqplot-y8axis,.jqplot-y9axis{margin-left:10px;margin-right:10px;}.jqplot-axis-tick,.jqplot-xaxis-tick,.jqplot-yaxis-tick,.jqplot-x2axis-tick,.jqplot-y2axis-tick,.jqplot-y3axis-tick,.jqplot-y4axis-tick,.jqplot-y5axis-tick,.jqplot-y6axis-tick,.jqplot-y7axis-tick,.jqplot-y8axis-tick,.jqplot-y9axis-tick{position:absolute;}.jqplot-xaxis-tick{top:0;left:15px;vertical-align:top;}.jqplot-x2axis-tick{bottom:0;left:15px;vertical-align:bottom;}.jqplot-yaxis-tick{right:0;top:15px;text-align:right;}.jqplot-y2axis-tick,.jqplot-y3axis-tick,.jqplot-y4axis-tick,.jqplot-y5axis-tick,.jqplot-y6axis-tick,.jqplot-y7axis-tick,.jqplot-y8axis-tick,.jqplot-y9axis-tick{left:0;top:15px;text-align:left;}.jqplot-meterGauge-tick{font-size:.75em;color:#999;}.jqplot-meterGauge-label{font-size:1em;color:#999;}.jqplot-xaxis-label{margin-top:10px;font-size:11pt;position:absolute;}.jqplot-x2axis-label{margin-bottom:10px;font-size:11pt;position:absolute;}.jqplot-yaxis-label{margin-right:10px;font-size:11pt;position:absolute;}.jqplot-y2axis-label,.jqplot-y3axis-label,.jqplot-y4axis-label,.jqplot-y5axis-label,.jqplot-y6axis-label,.jqplot-y7axis-label,.jqplot-y8axis-label,.jqplot-y9axis-label{font-size:11pt;position:absolute;}table.jqplot-table-legend{margin-top:12px;margin-bottom:12px;margin-left:12px;margin-right:12px;}table.jqplot-table-legend,table.jqplot-cursor-legend{background-color:rgba(255,255,255,0.6);border:1px solid #ccc;position:absolute;font-size:.75em;}td.jqplot-table-legend{vertical-align:middle;}td.jqplot-seriesToggle:hover,td.jqplot-seriesToggle:active{cursor:pointer;}td.jqplot-table-legend>div{border:1px solid #ccc;padding:1px;}div.jqplot-table-legend-swatch{width:0;height:0;border-top-width:5px;border-bottom-width:5px;border-left-width:6px;border-right-width:6px;border-top-style:solid;border-bottom-style:solid;border-left-style:solid;border-right-style:solid;}.jqplot-title{top:0;left:0;padding-bottom:.5em;font-size:1.2em;}table.jqplot-cursor-tooltip{border:1px solid #ccc;font-size:.75em;}.jqplot-cursor-tooltip{border:1px solid #ccc;font-size:.75em;white-space:nowrap;background:rgba(208,208,208,0.5);padding:1px;}.jqplot-highlighter-tooltip{border:1px solid #ccc;font-size:.75em;white-space:nowrap;background:rgba(208,208,208,0.5);padding:1px;}.jqplot-point-label{font-size:.75em;z-index:2;}td.jqplot-cursor-legend-swatch{vertical-align:middle;text-align:center;}div.jqplot-cursor-legend-swatch{width:1.2em;height:.7em;}.jqplot-error{text-align:center;}.jqplot-error-message{position:relative;top:46%;display:inline-block;}div.jqplot-bubble-label{font-size:.8em;padding-left:2px;padding-right:2px;color:rgb(20%,20%,20%);}div.jqplot-bubble-label.jqplot-bubble-label-highlight{background:rgba(90%,90%,90%,0.7);} \ No newline at end of file diff --git a/openQRM-5.3.50-CE/src/web/base/server/aa_server/dc-overview.php b/openQRM-5.3.50-CE/src/web/base/server/aa_server/dc-overview.php deleted file mode 100644 index 0ed73cd..0000000 --- a/openQRM-5.3.50-CE/src/web/base/server/aa_server/dc-overview.php +++ /dev/null @@ -1,797 +0,0 @@ - -*/ - -$thisfile = basename($_SERVER['PHP_SELF']); -$RootDir = $_SERVER["DOCUMENT_ROOT"].'/openqrm/base/'; -require_once "$RootDir/include/user.inc.php"; -require_once "$RootDir/class/image.class.php"; -require_once "$RootDir/class/resource.class.php"; -require_once "$RootDir/class/appliance.class.php"; -require_once "$RootDir/class/kernel.class.php"; -require_once "$RootDir/class/virtualization.class.php"; -require_once "$RootDir/class/openqrm_server.class.php"; -require_once "$RootDir/include/htmlobject.inc.php"; - - - -if(htmlobject_request('action') != '') { - switch (htmlobject_request('action')) { - case 'get_dc_status': - // number of idle systems - $resources_all = 0; - // active deployed resources - $resources_active = 0; - // resources in error state - $resources_error = 0; - // physical resources - $resources_physical = 0; - // virtual resources - $resources_virtual = 0; - // number of idle systems - $resources_available = 0; - // physical resource available - $resources_available_physical = 0; - // virtal resource available - $resources_available_virtual = 0; - // overall load - $dc_load_overall = 0; - // active appliance load - $appliance_load_overall = 0; - // peak in appliance load - $appliance_load_peak = 0; - // active appliances - $appliance_active = 0; - // active appliance with resource in error state - $appliance_error = 0; - // storage load - $storage_load_overall = 0; - // storage peak - $storage_load_peak = 0; - // active storages - $storage_active = 0; - // storage with resource in error state - $storage_error = 0; - - // get an array of resources which are assigned to an appliance - $appliance_resources_array = array(); - $appliance = new appliance(); - $appliance_list = $appliance->get_all_ids(); - foreach ($appliance_list as $app) { - $app_id = $app['appliance_id']; - $g_appliance = new appliance(); - $g_appliance->get_instance_by_id($app_id); - $g_appliance_resource = $g_appliance->resources; - if ((!strcmp($g_appliance->state, "active")) || ($g_appliance_resource == 0)) { - if ($g_appliance_resource != "-1") { - $appliance_resources_array[] .= $g_appliance_resource; - } - } - } - // get an array of resources which are a storage server - $storage_resources_array = array(); - $storage = new storage(); - $storage_list = $storage->get_list(); - foreach ($storage_list as $store) { - $storage_id = $store['value']; - $g_storage = new storage(); - $g_storage->get_instance_by_id($storage_id); - $g_storage_resource = $g_storage->resource_id; - $storage_resources_array[] .= $g_storage_resource; - - } - - $restype = 0; - $resource = new resource(); - $resource_list = $resource->get_list(); - foreach ($resource_list as $res) { - $res_id = $res['resource_id']; - //echo "!! res_id $res_id
    "; - $g_resource = new resource(); - $g_resource->get_instance_by_id($res_id); - // start gathering - $resources_all++; - // physical or virtual ? - if ((strlen($g_resource->vtype)) && ($g_resource->vtype != "NULL")) { - $virtualization = new virtualization(); - $virtualization->get_instance_by_id($g_resource->vtype); - if (strstr($virtualization->type, "-vm")) { - // virtual - $resources_virtual++; - $restype=1; - } else { - // physical - $resources_physical++; - $restype=0; - } - } else { - // we treat unknown system types as physical - $resources_physical++; - $restype=0; - } - - - // resource load - // is idle or active ? - if (("$g_resource->imageid" == "1") && ("$g_resource->state" == "active")) { - // idle - $resources_available++; - // virtual or physical ? - if ($restype == 0) { - $resources_available_physical++; - } else { - $resources_available_virtual++; - } - } else if ("$g_resource->state" == "active") { - // active - $resources_active++; - $dc_load_overall = $dc_load_overall + $g_resource->load; - - // is storage ? - if (in_array($g_resource->id, $storage_resources_array)) { - $storage_active++; - $storage_load_overall = $storage_load_overall + $g_resource->load; - // is peak ? - if ($g_resource->load > $storage_load_peak) { - $storage_load_peak = $g_resource->load; - } - } - // is appliance ? - if (in_array($g_resource->id, $appliance_resources_array)) { - $appliance_active++; - $appliance_load_overall = $appliance_load_overall + $g_resource->load; - // is peak ? - if ($g_resource->load > $appliance_load_peak) { - $appliance_load_peak = $g_resource->load; - } - } - - - } else if ("$g_resource->state" == "error") { - // error - $resources_error++; - // is storage ? - if (in_array($g_resource->id, $storage_resources_array)) { - $storage_error++; - } - // is appliance ? - if (in_array($g_resource->id, $appliance_resources_array)) { - $appliance_error++; - } - } - } - // end of gathering - - // divide with number of active resources, appliances + storages - if ($resources_active != 0) { - $dc_load_overall = $dc_load_overall/$resources_active; - $dc_load_overall = number_format($dc_load_overall, 2, '.', ''); - } - if ($appliance_active != 0) { - $appliance_load_overall = $appliance_load_overall/$appliance_active; - $appliance_load_overall = number_format($appliance_load_overall, 2, '.', ''); - } - if ($storage_active != 0) { - $storage_load_overall = $storage_load_overall/$storage_active; - $storage_load_overall = number_format($storage_load_overall, 2, '.', ''); - } - - - echo "$dc_load_overall,$storage_load_overall,$storage_load_peak,$appliance_load_overall,$appliance_load_peak,$resources_all,$resources_physical,$resources_virtual,$resources_available,$resources_available_physical,$resources_available_virtual,$resources_error,$appliance_error,$storage_error"; - exit(0); - break; - - - - // event status - case 'get_event_status': - // how many errors to show in the ui - $max_show_error = 10; - // all events - $events_all = 0; - // all error events - $events_error = 0; - - $table = new htmlobject_table_identifiers_checked('event_id'); - - $arHead = array(); - $arHead['event_icon'] = array(); - $arHead['event_icon']['title'] =''; - - $arHead['event_id'] = array(); - $arHead['event_id']['title'] ='ID'; - - $arHead['event_description'] = array(); - $arHead['event_description']['title'] ='Description'; - - $arBody = array(); - $event = new event(); - $event_list = $event->get_list(); - foreach ($event_list as $ev) { - $events_all++; - $event_id = $ev['value']; - $g_event = new event(); - $g_event->get_instance_by_id($event_id); - if (($g_event->priority <= 2) && ($g_event->status == 0)) { - // fill in event-error - $events_error++; - if ($events_error < $max_show_error) { - $arBody[] = array( - 'event_icon' => "", - 'event_id' => $g_event->id, - 'event_description' => $g_event->description, - ); - } - } - } - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->sort = ''; - $table->head = $arHead; - $table->body = $arBody; - $table->max = $max_show_error; - - // set template - $e = new Template_PHPLIB(); - $e->debug = false; - $e->setFile('tplfile', $RootDir.'/server/aa_server/tpl/events-summary.tpl.php'); - $e->setVar(array( - 'events_all' => $events_all, - 'events_error' => $events_error, - 'events_error_table' => $table->get_string(), - 'max_show_error' => $max_show_error, - )); - $disp = $e->parse('out', 'tplfile'); - echo $disp; - exit(0); - break; - - - - // event status - case 'get_resource_status': - // how many errors to show in the ui - $max_show_resources = 10; - // all resources - $res_all = 0; - // all available resources - $res_available = 0; - // all active resources - $res_active = 0; - // resources in error - $res_error = 0; - - $table = new htmlobject_table_identifiers_checked('resource_id'); - - $arHead = array(); - $arHead['resource_icon'] = array(); - $arHead['resource_icon']['title'] =''; - - $arHead['resource_id'] = array(); - $arHead['resource_id']['title'] ='ID'; - - $arHead['resource_hostname'] = array(); - $arHead['resource_hostname']['title'] ='Name'; - - $arHead['resource_ip'] = array(); - $arHead['resource_ip']['title'] ='Ip-address'; - - $arHead['resource_mac'] = array(); - $arHead['resource_mac']['title'] ='Mac-address'; - - $arHead['resource_load'] = array(); - $arHead['resource_load']['title'] ='Load'; - - $arBody = array(); - $resource = new resource(); - // find active, error + available - $in_res_table=0; - $res_load_array = array(); - $resource_list = $resource->get_list(); - foreach ($resource_list as $res) { - $res_id = $res['resource_id']; - $g_resource = new resource(); - $g_resource->get_instance_by_id($res_id); - // start gathering - $res_all++; - // resource load - // is idle or active ? - if (("$g_resource->imageid" == "1") && ("$g_resource->state" == "active")) { - // idle - $res_available++; - } else if ("$g_resource->state" == "active") { - // active - $res_active++; - // check load - $res_load_array[$g_resource->id] = $g_resource->load; - } else if ("$g_resource->state" == "error") { - // error - $res_error++; - } - } - - // find the most loaded resources - arsort($res_load_array, true); - $sorted_res_load_array_ids = array_keys($res_load_array); - foreach ($sorted_res_load_array_ids as $ml_res_id) { - $l_resource = new resource(); - $l_resource->get_instance_by_id($ml_res_id); - if (("$l_resource->state" == "active") && ("$l_resource->imageid" != "1")) { - if ($in_res_table < $max_show_resources) { - // fill in array body - $arBody[] = array( - 'resource_icon' => "", - 'resource_id' => $l_resource->id, - 'resource_hostname' => $l_resource->hostname, - 'resource_ip' => $l_resource->ip, - 'resource_mac' => $l_resource->mac, - 'resource_load' => $l_resource->load, - ); - $in_res_table++; - } else { - break; - } - } - } - - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->sort = ''; - $table->head = $arHead; - $table->body = $arBody; - $table->max = $max_show_resources; - - // set template - $e = new Template_PHPLIB(); - $e->debug = false; - $e->setFile('tplfile', $RootDir.'/server/aa_server/tpl/resource-summary.tpl.php'); - $e->setVar(array( - 'resource_all' => $res_all, - 'resource_available' => $res_available, - 'resource_active' => $res_active, - 'resource_error' => $res_error, - 'resource_table' => $table->get_string(), - 'max_show_resources' => $max_show_resources, - )); - $disp = $e->parse('out', 'tplfile'); - echo $disp; - exit(0); - break; - - - - // appliance status - case 'get_appliance_status': - // how many appliances to show in the ui - $max_show_appliance = 10; - // all appliances - $app_all = 0; - // all active appliances - $app_active = 0; - // all error events - $app_error = 0; - - $table = new htmlobject_table_identifiers_checked('appliance_id'); - - $arHead = array(); - $arHead['appliance_icon'] = array(); - $arHead['appliance_icon']['title'] =''; - - $arHead['appliance_id'] = array(); - $arHead['appliance_id']['title'] ='ID'; - - $arHead['appliance_name'] = array(); - $arHead['appliance_name']['title'] ='Name'; - - $arHead['appliance_resource'] = array(); - $arHead['appliance_resource']['title'] ='Res.'; - - $arHead['appliance_load'] = array(); - $arHead['appliance_load']['title'] ='Load'; - - $in_app_table = 0; - $arBody = array(); - $app_load_array = array(); - $appliance = new appliance(); - $appliance_list = $appliance->get_list(); - foreach ($appliance_list as $ap) { - $app_all++; - $appliance_id = $ap['value']; - $g_appliance = new appliance(); - $g_appliance->get_instance_by_id($appliance_id); - if ((!strcmp($g_appliance->state, "active")) || ($g_appliance->resources == 0)) { - // fill in app_all - $app_active++; - // check resource state - $a_resource = new resource(); - $a_resource->get_instance_by_id($g_appliance->resources); - if ("$a_resource->state" == "active") { - $app_load = $a_resource->load; - $app_load_array[$g_appliance->id] = $a_resource->load; - } else if ("$a_resource->state" == "error") { - $app_error++; - } - - } - } - - // find the most loaded appliance - arsort($app_load_array, true); - $sorted_app_load_array_ids = array_keys($app_load_array); - foreach ($sorted_app_load_array_ids as $ml_app_id) { - $l_app = new appliance(); - $l_app->get_instance_by_id($ml_app_id); - if ($in_app_table < $max_show_appliance) { - $l_res = new resource(); - $l_res->get_instance_by_id($l_app->resources); - $l_app_load = $l_res->load; - // fill in array body - $arBody[] = array( - 'appliance_icon' => "", - 'appliance_id' => $l_app->id, - 'appliance_name' => $l_app->name, - 'appliance_resource' => $l_app->resources, - 'appliance_load' => $l_app_load, - ); - $in_app_table++; - } else { - break; - } - } - - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->sort = ''; - $table->head = $arHead; - $table->body = $arBody; - $table->max = $max_show_appliance; - - // set template - $e = new Template_PHPLIB(); - $e->debug = false; - $e->setFile('tplfile', $RootDir.'/server/aa_server/tpl/appliance-summary.tpl.php'); - $e->setVar(array( - 'appliance_all' => $app_all, - 'appliance_error' => $app_error, - 'appliance_active' => $app_active, - 'appliance_table' => $table->get_string(), - 'max_show_appliance_' => $max_show_appliance, - )); - $disp = $e->parse('out', 'tplfile'); - echo $disp; - exit(0); - break; - - - - // storage status - case 'get_storage_status': - // how many storages to show in the ui - $max_show_storage = 10; - // all storages - $store_all = 0; - // all storages in error - $store_error = 0; - - $table = new htmlobject_table_identifiers_checked('storage_id'); - - $arHead = array(); - $arHead['storage_icon'] = array(); - $arHead['storage_icon']['title'] =''; - - $arHead['storage_id'] = array(); - $arHead['storage_id']['title'] ='ID'; - - $arHead['storage_name'] = array(); - $arHead['storage_name']['title'] ='Name'; - - $arHead['storage_resource'] = array(); - $arHead['storage_resource']['title'] ='Res.'; - - $arHead['storage_type'] = array(); - $arHead['storage_type']['title'] ='Type'; - - $arHead['storage_load'] = array(); - $arHead['storage_load']['title'] ='Load'; - - - $arBody = array(); - $store_load_array = array(); - $storage = new storage(); - $storage_list = $storage->get_list(); - - foreach ($storage_list as $st) { - $store_all++; - $storage_id = $st['value']; - $g_storage = new storage(); - $g_storage->get_instance_by_id($storage_id); - // check resource state - $st_resource = new resource(); - $st_resource->get_instance_by_id($g_storage->resource_id); - if ("$st_resource->state" == "active") { - $store_load = $st_resource->load; - $store_load_array[$g_storage->id] = $st_resource->load; - } else if ("$st_resource->state" == "error") { - $store_error++; - } - } - - // find the most loaded storage - $in_store_table = 0; - arsort($store_load_array, true); - $sorted_store_load_array_ids = array_keys($store_load_array); - foreach ($sorted_store_load_array_ids as $ml_store_id) { - $l_store = new storage(); - $l_store->get_instance_by_id($ml_store_id); - if ($in_store_table < $max_show_storage) { - // get resource load - $l_res = new resource(); - $l_res->get_instance_by_id($l_store->resource_id); - $l_store_load = $l_res->load; - // get storage type - $deployment = new deployment(); - $deployment->get_instance_by_id($l_store->type); - - // fill in array body - $arBody[] = array( - 'storage_icon' => "", - 'storage_id' => $l_store->id, - 'storage_name' => $l_store->name, - 'storage_resource' => $l_store->resource_id, - 'storage_type' => $deployment->storagedescription, - 'storage_load' => $l_store_load, - ); - $in_store_table++; - } else { - break; - } - } - - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->sort = ''; - $table->head = $arHead; - $table->body = $arBody; - $table->max = $max_show_storage; - - // set template - $e = new Template_PHPLIB(); - $e->debug = false; - $e->setFile('tplfile', $RootDir.'/server/aa_server/tpl/storage-summary.tpl.php'); - $e->setVar(array( - 'storage_all' => $store_all, - 'storage_error' => $store_error, - 'storage_table' => $table->get_string(), - 'max_show_storage' => $max_show_storage, - )); - $disp = $e->parse('out', 'tplfile'); - echo $disp; - exit(0); - break; - - - - // cloud status - case 'get_cloud_status': - - // check if the cloud is enabled - if (!file_exists($RootDir."plugins/cloud/.running")) { - echo "


    The Cloud is not enabled

    "; - echo "

    Please enable (and start) it via the Plugin-Manager

    "; - exit(0); - } - require_once "$RootDir/plugins/cloud/class/clouduser.class.php"; - require_once "$RootDir/plugins/cloud/class/cloudrequest.class.php"; - // how many cloud requests to show in the ui - $max_show_cr = 10; - // all cloud users - $cloud_users = 0; - // all cloud requests - $cr_all = 0; - // all active cloud requests - $cr_active = 0; - // active cloud appliances which resource are in error - $cloud_errors = 0; - - $table = new htmlobject_table_identifiers_checked('cr_id'); - - $arHead = array(); - - $arHead['cr_icon'] = array(); - $arHead['cr_icon']['title'] =''; - - $arHead['cr_id'] = array(); - $arHead['cr_id']['title'] ='ID'; - - $arHead['cr_user'] = array(); - $arHead['cr_user']['title'] ='User'; - - $arHead['cr_state'] = array(); - $arHead['cr_state']['title'] ='State'; - - $arHead['cr_app'] = array(); - $arHead['cr_app']['title'] ='Appliance'; - - $arHead['cr_res'] = array(); - $arHead['cr_res']['title'] ='Res.'; - - $arHead['cr_load'] = array(); - $arHead['cr_load']['title'] ='Load'; - - $arBody = array(); - $cloud_load_array = array(); - $cr = new cloudrequest(); - $cr_list = $cr->get_all_ids(); - - foreach ($cr_list as $cr_id_arr) { - $cr_id=$cr_id_arr['cr_id']; - $cr_all++; - $g_cr = new cloudrequest(); - $g_cr->get_instance_by_id($cr_id); - if ($g_cr->status == 3) { - // fill active - $cr_active++; - // find most active cloud appliance - $c_app = new appliance(); - $c_app->get_instance_by_id($g_cr->appliance_id); - $c_resource = new resource(); - $c_resource->get_instance_by_id($c_app->resources); - if ("$c_resource->state" == "active") { - $cloud_load_array[$cr_id] = $c_resource->load; - } else if ("$c_resource->state" == "error") { - $cloud_errors++; - } - } - } - - // find the most loaded cloud appliance - $in_cr_table = 0; - arsort($cloud_load_array, true); - $sorted_cr_load_array_ids = array_keys($cloud_load_array); - foreach ($sorted_cr_load_array_ids as $ml_cr_id) { - $l_cr = new cloudrequest(); - $l_cr->get_instance_by_id($ml_cr_id); - if ($in_cr_table < $max_show_cr) { - $ml_cr = new cloudrequest(); - $ml_cr->get_instance_by_id($ml_cr_id); - // get user - $ml_cr_user = new clouduser(); - $ml_cr_user->get_instance_by_id($ml_cr->cu_id); - // get appliance - $ml_app = new appliance(); - $ml_app->get_instance_by_id($ml_cr->appliance_id); - // get resource load - $cr_res = new resource(); - $cr_res->get_instance_by_id($ml_app->resources); - $cr_load = $cr_res->load; - // fill in array body - $arBody[] = array( - 'cr_icon' => "", - 'cr_id' => $ml_cr->id, - 'cr_user' => $ml_cr_user->name, - 'cr_state' => "active", - 'cr_app' => $ml_cr->appliance_id." / ".$ml_app->name, - 'cr_res' => $cr_res->id, - 'cr_load' => $cr_load, - ); - $in_cr_table++; - } else { - break; - } - } - // how many cloud users we have ? - $cu = new clouduser(); - $cloud_users = $cu->get_count(); - - $table->id = 'Tabelle'; - $table->css = 'htmlobject_table'; - $table->border = 1; - $table->cellspacing = 0; - $table->cellpadding = 3; - $table->sort = ''; - $table->head = $arHead; - $table->body = $arBody; - $table->max = $max_show_cr; - - // set template - $e = new Template_PHPLIB(); - $e->debug = false; - $e->setFile('tplfile', $RootDir.'/server/aa_server/tpl/cloud-summary.tpl.php'); - $e->setVar(array( - 'cr_all' => $cr_all, - 'cr_active' => $cr_active, - 'cloud_users' => $cloud_users, - 'cloud_errors' => $cloud_errors, - 'cloud_table' => $table->get_string(), - 'max_show_cr' => $max_show_cr, - )); - $disp = $e->parse('out', 'tplfile'); - echo $disp; - exit(0); - break; - - - case 'get_eventlist': - - $event = new event(); - $event_list = $event->display_overview(0,10,'event_time','desc'); // $offset, $limit, $sort, $order, $mode = null - echo json_encode($event_list); - - exit(0); - break; - - } -} - -/** - * Method to map event_priority to status strings. - * - * @todo Should be moved to event object - * @param int $event_priority - * @return string status string - */ -function getEventStatus($event_priority) { - switch ($event_priority) { - /* - case 0: $icon = "off.png"; break; - case 1: $icon = "error.png"; break; - case 2: $icon = "error.png"; break; - case 3: $icon = "error.png"; break; - case 4: $icon = "unknown.png"; break; - case 5: $icon = "active.png"; break; - case 6: $icon = "idle.png"; break; - case 7: $icon = "idle.png"; break; - case 8: $icon = "idle.png"; break; - case 9: $icon = "transition.png"; break; - case 10:$icon = "active.png"; break; - */ - - case 0: - $status = 'disabled'; break; - case 1: - case 2: - case 3: - $status = 'error'; break; // error event - case 4: - case 5: - case 6: - case 7: - case 8: - $status = 'notice'; break; // undefined event - case 9: - $status = 'running'; break; // active event - case 10: - $status = 'ok'; break; // notice event - default: - $status = 'unkown'; break; - - } - return $status; -} - - - diff --git a/openQRM-5.3.50-CE/src/web/base/server/aa_server/js/09-jquery.min.js b/openQRM-5.3.50-CE/src/web/base/server/aa_server/js/09-jquery.min.js deleted file mode 100644 index 006e953..0000000 --- a/openQRM-5.3.50-CE/src/web/base/server/aa_server/js/09-jquery.min.js +++ /dev/null @@ -1,5 +0,0 @@ -/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license -//@ sourceMappingURL=jquery.min.map -*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
    a",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="
    t
    ",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="
    ",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj; -return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="
    ",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/\s*$/g,At={option:[1,""],legend:[1,"
    ","
    "],area:[1,"",""],param:[1,"",""],thead:[1,"","
    "],tr:[2,"","
    "],col:[2,"","
    "],td:[3,"","
    "],_default:b.support.htmlSerialize?[0,"",""]:[1,"X
    ","
    "]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?""!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l) -}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("