summaryrefslogtreecommitdiffstats
path: root/modules-available/vmstore
diff options
context:
space:
mode:
authorSimon Rettberg2016-05-03 19:03:09 +0200
committerSimon Rettberg2016-05-03 19:03:09 +0200
commit50404f3b23b7fd6aeae4c9d2f6df0ea25e984e66 (patch)
tree05e99fdffa696434960d7c77966c0bc36d6339e8 /modules-available/vmstore
parentSecond half of merge.... (diff)
downloadslx-admin-50404f3b23b7fd6aeae4c9d2f6df0ea25e984e66.tar.gz
slx-admin-50404f3b23b7fd6aeae4c9d2f6df0ea25e984e66.tar.xz
slx-admin-50404f3b23b7fd6aeae4c9d2f6df0ea25e984e66.zip
WIP
Diffstat (limited to 'modules-available/vmstore')
-rw-r--r--modules-available/vmstore/config.json4
-rw-r--r--modules-available/vmstore/lang/de/templates/mount.json5
-rw-r--r--modules-available/vmstore/lang/de/templates/page-vmstore.json17
-rw-r--r--modules-available/vmstore/lang/en/module.json21
-rw-r--r--modules-available/vmstore/lang/en/templates/mount.json5
-rw-r--r--modules-available/vmstore/lang/en/templates/page-vmstore.json17
-rw-r--r--modules-available/vmstore/lang/pt/module.json21
-rw-r--r--modules-available/vmstore/page.inc.php63
-rw-r--r--modules-available/vmstore/templates/mount.html25
-rw-r--r--modules-available/vmstore/templates/page-vmstore.html111
10 files changed, 289 insertions, 0 deletions
diff --git a/modules-available/vmstore/config.json b/modules-available/vmstore/config.json
new file mode 100644
index 00000000..f2abe27c
--- /dev/null
+++ b/modules-available/vmstore/config.json
@@ -0,0 +1,4 @@
+{
+ "category":"main.settings",
+ "enabled":"true"
+}
diff --git a/modules-available/vmstore/lang/de/templates/mount.json b/modules-available/vmstore/lang/de/templates/mount.json
new file mode 100644
index 00000000..dbc75281
--- /dev/null
+++ b/modules-available/vmstore/lang/de/templates/mount.json
@@ -0,0 +1,5 @@
+{
+ "lang_back": "Zur\u00fcck",
+ "lang_configure": "Konfigurieren",
+ "lang_vmLocationConfiguration": "VM Speicherort wird konfiguriert"
+} \ No newline at end of file
diff --git a/modules-available/vmstore/lang/de/templates/page-vmstore.json b/modules-available/vmstore/lang/de/templates/page-vmstore.json
new file mode 100644
index 00000000..bb2c0634
--- /dev/null
+++ b/modules-available/vmstore/lang/de/templates/page-vmstore.json
@@ -0,0 +1,17 @@
+{
+ "lang_close": "Schlie\u00dfen",
+ "lang_intern": "Intern",
+ "lang_nfsHelp1": "Ben\u00f6tigt wird ein NFSv4\/3-Share, der f\u00fcr den Satelliten-Server schreibbar, und f\u00fcr die Arbeitsstationen lesbar ist. Beispielkonfiguration auf dem NFS-Server, wenn der Satelliten-Server die Adresse 1.2.3.4 hat:",
+ "lang_nfsHelp2": "Alternative Konfiguration mittels all_sqash. In diesem Fall muss das Verzeichnis auf dem Server dem Benutzer mit der uid 1234 geh\u00f6ren:",
+ "lang_noAdditionalInformation": "Keine weitere Konfiguration notwendig",
+ "lang_password": "Passwort",
+ "lang_readOnly": "Nur-Lese-Zugangsdaten",
+ "lang_readWrite": "Lese\/Schreib-Zugangsdaten",
+ "lang_save": "Speichern",
+ "lang_username": "Benutzerkennung",
+ "lang_vmLocation": "VM Speicherort",
+ "lang_vmLocationChoose": "Bitte w\u00e4hlen Sie, wo die Images der Virtuellen Maschinen gespeichert werden sollen.",
+ "lang_vmLocationHelp1": "F\u00fcr Testzwecke k\u00f6nnen die VMs direkt auf dem Satellitenserver gespeichert werden. Sofern Sie jedoch die ausgelieferte Satelliten-vmdk betreiben bedenken Sie bitte, dass Sie dann nur ca. 100GB Speicher zur Verf\u00fcgung haben.",
+ "lang_vmLocationHelp2": "Im Produktivbetrieb bietet es sich an, hierf\u00fcr einen performanten Netzwerkspeicher zu benutzen. Dieser Netzwerkspeicher kann per NFS oder CIFS\/SMB eingebunden werden. In jedem Fall muss sichergestellt werden, dass der Satellitenserver zum Hinzuf\u00fcgen neuer Virtueller Maschinen Schreibzugriff auf diesen Netzwerkspeicher hat. Bei der Nutzung von NFSv3 kann dies IP-Basiert eingerichtet werden, f\u00fcr die Nutzung von CIFS\/SMB k\u00f6nnen Sie Zugangsdaten angaben, die zum Schreiben berechtigen.",
+ "lang_vmLocationHelp3": "Die bwLehrpool-Clients brauchen lediglich Lesezugriff auf den Netzwerkspeicher (und sollten aus Sicherheitsgr\u00fcnden auch wirklich nur lesen k\u00f6nnen). Bei CIFS\/SMB erreichen Sie dies am einfachsten, indem Sie passwortlosen Gastzugriff mit Leserechten auf die Freigabe erlauben."
+} \ No newline at end of file
diff --git a/modules-available/vmstore/lang/en/module.json b/modules-available/vmstore/lang/en/module.json
new file mode 100644
index 00000000..9d11656f
--- /dev/null
+++ b/modules-available/vmstore/lang/en/module.json
@@ -0,0 +1,21 @@
+{
+ "lang_back": "Back",
+ "lang_close": "Close",
+ "lang_configure": "Configure",
+ "lang_intern": "Intern",
+ "lang_nfsHelp1": "An NFSv3-Share is required. It should be readable by all the workstations, and writable for the satellite server. An example, assuming the satellite server has IP address 1.2.3.4:",
+ "lang_nfsHelp2": "Alternate configuration using all_squash. The exported directory should be owned (and be writable) by the user with uid 1234.",
+ "lang_noAdditionalInformation": "No additional cofiguration required",
+ "lang_password": "Password",
+ "lang_readOnly": "Read-only Access",
+ "lang_readWrite": "Read\/Write Access",
+ "lang_save": "Save",
+ "lang_username": "Username",
+ "lang_vmLocation": "VM Location",
+ "lang_vmLocationChoose": "Please choose where the images of virtual machines will be stored.",
+ "lang_vmLocationConfiguration": "VM Location is being configured",
+ "lang_vmLocationHelp1": "For test purposes, the VMs can be stored directly on the Satellite server. However, if you operate the delivered satellite vmdk please remember that you have only about 100GB of memory.",
+ "lang_vmLocationHelp2": "In productive operation, it makes sense for this to use a high-performance network storage. This network storage can be integrated via NFS or CIFS \/ SMB. In any case, it must be ensured that the satellite server has write access to this network storage to add a new Virtual Machine . When using NFSv3 this can be set up IP-based, for the use of CIFS \/ SMB, you can access data disclosures that would entitle them to write.",
+ "lang_vmLocationHelp3": "The bwLehrpool clients only need read access to the network storage (and for security reasons, really can only read). In CIFS \/ SMB You can do this most easily by allowing passwordless guest access with read access to the share.",
+ "module_name": "Virtual Machine"
+} \ No newline at end of file
diff --git a/modules-available/vmstore/lang/en/templates/mount.json b/modules-available/vmstore/lang/en/templates/mount.json
new file mode 100644
index 00000000..29814430
--- /dev/null
+++ b/modules-available/vmstore/lang/en/templates/mount.json
@@ -0,0 +1,5 @@
+{
+ "lang_back": "Back",
+ "lang_configure": "Configure",
+ "lang_vmLocationConfiguration": "VM location is configured"
+} \ No newline at end of file
diff --git a/modules-available/vmstore/lang/en/templates/page-vmstore.json b/modules-available/vmstore/lang/en/templates/page-vmstore.json
new file mode 100644
index 00000000..23ddbbd3
--- /dev/null
+++ b/modules-available/vmstore/lang/en/templates/page-vmstore.json
@@ -0,0 +1,17 @@
+{
+ "lang_close": "Close",
+ "lang_intern": "Intern",
+ "lang_nfsHelp1": "An NFSv4\/3-Share is required. It should be readable by all the workstations, and writable for the satellite server. An example, assuming the satellite server has IP address 1.2.3.4:",
+ "lang_nfsHelp2": "Alternate configuration using all_squash. The exported directory should be owned (and be writable) by the user with uid 1234.",
+ "lang_noAdditionalInformation": "No additional cofiguration required",
+ "lang_password": "Password",
+ "lang_readOnly": "Read-only Access",
+ "lang_readWrite": "Read\/Write Access",
+ "lang_save": "Save",
+ "lang_username": "Username",
+ "lang_vmLocation": "VM Location",
+ "lang_vmLocationChoose": "Please choose where the images of virtual machines will be stored.",
+ "lang_vmLocationHelp1": "For test purposes, the VMs can be stored directly on the Satellite server. However, if you operate the delivered satellite vmdk please remember that you have only about 100GB of memory.",
+ "lang_vmLocationHelp2": "In productive operation, it makes sense for this to use a high-performance network storage. This network storage can be integrated via NFS or CIFS \/ SMB. In any case, it must be ensured that the satellite server has write access to this network storage to add a new Virtual Machine . When using NFSv3 this can be set up IP-based, for the use of CIFS \/ SMB, you can access data disclosures that would entitle them to write.",
+ "lang_vmLocationHelp3": "The bwLehrpool clients only need read access to the network storage (and for security reasons, really can only read). In CIFS \/ SMB You can do this most easily by allowing passwordless guest access with read access to the share."
+} \ No newline at end of file
diff --git a/modules-available/vmstore/lang/pt/module.json b/modules-available/vmstore/lang/pt/module.json
new file mode 100644
index 00000000..1aa7fdaf
--- /dev/null
+++ b/modules-available/vmstore/lang/pt/module.json
@@ -0,0 +1,21 @@
+{
+ "lang_back": "Voltar",
+ "lang_close": "Fechar",
+ "lang_configure": "configurar",
+ "lang_intern": "Iterna",
+ "lang_nfsHelp1": "\u00c9 necess\u00e1rio um NFSv3-Share. Ele deve poder ser lido por todas as esta\u00e7\u00f5es de trabalho, e poder ser escrito pelo server. Um exemplo, assumindo que o server possui endere\u00e7o ip 1.2.3.4:",
+ "lang_nfsHelp2": "Configura\u00e7\u00e3o alternativa usando all_squash. O usu\u00e1rio com uid 1234 deve possuir ( e poder escrever em ) o diret\u00f3rio exportado.",
+ "lang_noAdditionalInformation": "Nenhuma configura\u00e7\u00e3o adicional necess\u00e1ria",
+ "lang_password": "Senha",
+ "lang_readOnly": "Acesso Somente Leitura",
+ "lang_readWrite": "Acesso Leitura\/Escrita",
+ "lang_save": "Salvar",
+ "lang_username": "Nome de Usu\u00e1rio",
+ "lang_vmLocation": "Localiza\u00e7\u00e3o da VM",
+ "lang_vmLocationChoose": "Por favor, escolha aonde as imagens das m\u00e1quinas virtuais ser\u00e3o armazenadas.",
+ "lang_vmLocationConfiguration": "Localiza\u00e7\u00e3o da VM \u00e9 configurada",
+ "lang_vmLocationHelp1": "Para fins de teste, as VMs podem ser armazenados diretamente no servidor sat\u00e9lite. No entanto, se voc\u00ea operar o vmdk do sat\u00e9lite entregue por favor lembre-se que voc\u00ea tem apenas cerca de 100 GB de mem\u00f3ria.",
+ "lang_vmLocationHelp2": "Em opera\u00e7\u00e3o, faz sentido para este usar um armazenamento de rede de alto desempenho. Este armazenamento de rede pode ser integrado atrav\u00e9s de NFS ou CIFS \/ SMB. Em qualquer caso, deve-se assegurar de que o servidor de sat\u00e9lite tenha acesso de grava\u00e7\u00e3o para este armazenamento de rede para poder adicionar uma nova m\u00e1quina virtual. Ao utilizar NFSv3 este pode ser configurado com base em IP, para o uso de CIFS \/ SMB, voc\u00ea pode acessar as divulga\u00e7\u00f5es de dados que lhe permitiria escrever.",
+ "lang_vmLocationHelp3": "Os clientes bwLehrpool s\u00f3 precisam ter acesso de leitura ao armazenamento de rede (e por raz\u00f5es de seguran\u00e7a, realmente s\u00f3 pode ler). Em CIFS \/ SMB Voc\u00ea pode fazer isso mais facilmente, permitindo o acesso a visitantes sem senha com acesso de leitura.",
+ "module_name": "M\u00e1quina Virtual"
+} \ No newline at end of file
diff --git a/modules-available/vmstore/page.inc.php b/modules-available/vmstore/page.inc.php
new file mode 100644
index 00000000..81f92ee3
--- /dev/null
+++ b/modules-available/vmstore/page.inc.php
@@ -0,0 +1,63 @@
+<?php
+
+class Page_VmStore extends Page
+{
+ private $mountTask = false;
+
+ protected function doPreprocess()
+ {
+ User::load();
+
+ if (!User::hasPermission('superadmin')) {
+ Message::addError('no-permission');
+ Util::redirect('?do=Main');
+ }
+
+ $action = Request::post('action');
+
+ if ($action === 'setstore') {
+ $this->setStore();
+ }
+ }
+
+ protected function doRender()
+ {
+ $action = Request::post('action');
+ if ($action === 'setstore' && !Taskmanager::isFailed($this->mountTask)) {
+ Render::addTemplate('mount', array(
+ 'task' => $this->mountTask['id']
+ ));
+ return;
+ }
+ $vmstore = Property::getVmStoreConfig();
+ if (isset($vmstore['storetype'])) {
+ $vmstore['pre-' . $vmstore['storetype']] = 'checked';
+ }
+ Render::addTemplate('page-vmstore', $vmstore);
+ }
+
+ private function setStore()
+ {
+ foreach (array('storetype', 'nfsaddr', 'cifsaddr', 'cifsuser', 'cifspasswd', 'cifsuserro', 'cifspasswdro') as $key) {
+ $vmstore[$key] = trim(Request::post($key, ''));
+ }
+ $storetype = $vmstore['storetype'];
+ if (!in_array($storetype, array('internal', 'nfs', 'cifs'))) {
+ Message::addError('value-invalid', 'type', $storetype);
+ Util::redirect('?do=VmStore');
+ }
+ // Validate syntax of nfs/cifs
+ if ($storetype === 'nfs' && !preg_match('#^\S+:\S+$#is', $vmstore['nfsaddr'])) {
+ Message::addError('value-invalid', 'nfsaddr', $vmstore['nfsaddr']);
+ Util::redirect('?do=VmStore');
+ }
+ $vmstore['cifsaddr'] = str_replace('\\', '/', $vmstore['cifsaddr']);
+ if ($storetype === 'cifs' && !preg_match('#^//\S+/.+$#is', $vmstore['cifsaddr'])) {
+ Message::addError('value-invalid', 'nfsaddr', $vmstore['nfsaddr']);
+ Util::redirect('?do=VmStore');
+ }
+ $this->mountTask = Trigger::mount($vmstore);
+ TaskmanagerCallback::addCallback($this->mountTask, 'manualMount', $vmstore);
+ }
+
+} \ No newline at end of file
diff --git a/modules-available/vmstore/templates/mount.html b/modules-available/vmstore/templates/mount.html
new file mode 100644
index 00000000..eabee81a
--- /dev/null
+++ b/modules-available/vmstore/templates/mount.html
@@ -0,0 +1,25 @@
+<div class="panel panel-default">
+ <div class="panel-heading">
+ {{lang_vmLocationConfiguration}}
+ </div>
+
+ <div class="panel-body">
+ <div data-tm-id="{{task}}" data-tm-log="messages" data-tm-callback="mountCb">{{lang_configure}}</div>
+
+ <br>
+ <div id="finish" class="pull-right" style="display:none">
+ <a href="?do=VmStore" class="btn btn-primary">{{lang_back}}</a>
+ </div>
+ <script type="text/javascript">
+ function mountCb(task)
+ {
+ if (!task || !task.statusCode)
+ return;
+ if (task.statusCode !== 'TASK_WAITING' && task.statusCode !== 'TASK_PROCESSING') {
+ $('#finish').attr('style', '');
+ }
+ }
+ </script>
+
+ </div>
+</div> \ No newline at end of file
diff --git a/modules-available/vmstore/templates/page-vmstore.html b/modules-available/vmstore/templates/page-vmstore.html
new file mode 100644
index 00000000..fe2c5225
--- /dev/null
+++ b/modules-available/vmstore/templates/page-vmstore.html
@@ -0,0 +1,111 @@
+<form role="form" method="post" action="?do=VmStore">
+ <input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="display:none;">
+ <input type="password" name="password_fake" id="password_fake" value="" style="display:none;">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="setstore">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ {{lang_vmLocation}} <a class="btn btn-default" data-toggle="modal" data-target="#help-store"><span class="glyphicon glyphicon-question-sign"></span></a>
+ </div>
+ <div class="panel-body slx-md-width">
+ <p>{{lang_vmLocationChoose}}</p>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <input type="radio" name="storetype" value="internal" {{pre-internal}}> {{lang_intern}}
+ </div>
+ <div class="panel-body">
+ {{lang_noAdditionalInformation}}
+ </div>
+ </div>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <input type="radio" name="storetype" value="nfs" {{pre-nfs}}> NFS
+ <a class="btn btn-default btn-sm" data-toggle="modal" data-target="#help-nfs"><span class="glyphicon glyphicon-question-sign"></span></a>
+ </div>
+ <div class="panel-body">
+ <label for="nfsaddr">NFS-Export</label>
+ <input type="text" class="form-control" name="nfsaddr" value="{{nfsaddr}}" placeholder="1.2.3.4:/export/bwlp" id="nfsaddr">
+ </div>
+ </div>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <input type="radio" name="storetype" value="cifs" {{pre-cifs}}> CIFS
+ </div>
+ <div class="panel-body">
+ <label for="cifsaddr">UNC-Pfad</label>
+ <input type="text" class="form-control" name="cifsaddr" value="{{cifsaddr}}" placeholder="\\samba.server.example.com\bwlp" id="cifsaddr">
+ <br>
+ <label for="cifsuser">{{lang_readWrite}}</label>
+ <div class="input-group">
+ <span class="input-group-addon slx-ga">
+ {{lang_username}}
+ </span>
+ <input type="text" class="form-control" name="cifsuser" value="{{cifsuser}}" placeholder="{{lang_username}}" id="cifsuser">
+ <span class="input-group-addon">
+ {{lang_password}}
+ </span>
+ <input type="{{password_type}}" class="form-control" name="cifspasswd" value="{{cifspasswd}}" placeholder="{{lang_password}}">
+ </div>
+ <br>
+ <label for="cifsuserro">{{lang_readOnly}}</label>
+ <div class="input-group">
+ <span class="input-group-addon slx-ga">
+ {{lang_username}}
+ </span>
+ <input type="text" class="form-control" name="cifsuserro" value="{{cifsuserro}}" placeholder="{{lang_username}}" id="cifsuserro">
+ <span class="input-group-addon">
+ {{lang_password}}
+ </span>
+ <input type="{{password_type}}" class="form-control" name="cifspasswdro" value="{{cifspasswdro}}" placeholder="{{lang_password}}">
+ </div>
+ </div>
+ </div>
+ <button class="btn btn-primary" type="submit">{{lang_save}}</button>
+ </div>
+ </div>
+</form>
+
+<div class="modal fade" id="help-store" tabindex="-1" role="dialog">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">{{lang_vmLocation}}</div>
+ <div class="modal-body">
+ <p>
+ {{lang_vmLocationHelp1}}
+ </p>
+ <p>
+ {{lang_vmLocationHelp2}}
+ </p>
+ <p>
+ {{lang_vmLocationHelp3}}
+ </p>
+ </div>
+ <div class="modal-footer"><a class="btn btn-primary" data-dismiss="modal">{{lang_close}}</a></div>
+ </div>
+ </div>
+</div>
+
+<div class="modal fade" id="help-nfs" tabindex="-1" role="dialog">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">NFS</div>
+ <div class="modal-body">
+ <p>
+ {{lang_nfsHelp1}}
+ </p>
+ <pre>
+/mnt/images 1.2.3.4(rw,no_root_squash,async)
+/mnt/images *(ro,async,nolock)
+ </pre>
+ <p>
+ {{lang_nfsHelp2}}
+ </p>
+ <pre>
+/mnt/images 1.2.3.4(rw,all_squash,anon_uid=1234,async)
+/mnt/images *(ro,async,nolock)
+ </pre>
+ </div>
+ <div class="modal-footer"><a class="btn btn-primary" data-dismiss="modal">{{lang_close}}</a></div>
+ </div>
+ </div>
+</div>