-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VOLUME.page
176 lines (160 loc) · 5.33 KB
/
VOLUME.page
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
Menu="iscsi_main:3"
Title="2 - Volumes"
Cond="exec('/usr/local/emhttp/plugins/iscsi/include/exec.sh avail_iqns')"
---
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/jquery.filetree.css")?>">
<script src="<?=autov("/webGui/javascript/jquery.filetree.js")?>"></script>
<script>
$(function(){
$("#destinationShare").fileTreeAttach();
});
</script>
<script>
function path_selected() {
var share = $("#destinationShare").val();
document.getElementById("pathfromjs").value = share;
}
</script>
<h1 style="text-align: center;"><span style="color: red;">WARNING!</span></a></h1>
<p style="text-align: center;"><b>Please be carefull which disk you choose and double check it again since it can happen that a wrong disk is displayed in the dropdown.<br>Disks that are mounted/assigned through the Unassigned-Devices-Plguin are included in the dropdown list! Please double check and be carefull, if you choose a wrong disk this could lead to data loss!</b></p>
<table>
<div id="title">
<span class="left"></span>
</div>
<td><b><font size="+1">Create FileIO Volume:</font></b></td>
<tr>
<td>Path:</td>
<td>Name:</td>
<td>Size:</td>
<td>Write Back:</td>
</tr>
<form id="s" method="post" autocomplete="off">
<tr style="height:20px;">
<td>
<input id="pathfromjs" name="pathfromjs" type="hidden"></input>
<input type='text' size="15" class='setting' id="destinationShare" placeholder="/mnt/user/iSCSI/" name="shareFolder" data-pickroot="/mnt" data-pickfilter="HIDE_FILES_FILTER" data-pickfolders="true" onchange="path_selected()" required>
</td>
<td><input type = "text" style="width: 100px;" name = "name" placeholder="fileIO" required> .img</td>
<td> <input type = "text" name = "size" placeholder="20G" required></td>
<td>
<select name="write_back">
<option value="false">false</option>
<option value="true">true</option>
</select>
</td>
</tr>
</table>
<option id="s" method ="post">
<input type="submit" name="createFileIO" value="Create FileIO">
</option>
</form>
<?php
if(isset($_POST['createFileIO'])) {
$size = $_POST["size"];
$name = $_POST["name"];
$path = $_POST["pathfromjs"];
$writeback = $_POST["write_back"];
shell_exec("/usr/local/emhttp/plugins/iscsi/include/exec.sh create_fileIO $name $path $size $writeback");
echo '<script>parent.window.location.reload();</script>';
}
?>
<?
if (isset($_SESSION['availfilios'] ) === true && trim($_SESSION['availfilios'] ) !== ''):
?>
<b>Available FileIO Volumes:</b><br>
<?php
echo str_replace("\n", '<br>', $_SESSION['availfilios']);
?>
<br>
<form id="s" method="post" >
<select name="deletefileio" required>
<option selected="selected" value="">Choose FileIO</option>
<?php
$output = $_SESSION['availfilios'];
$data = explode("\n", $output);
var_dump($data);
foreach($data as $item){
echo "<option value=\"$item\"> $item</option>";
}
?>
</select>
<input type="submit" name="deleteFileIO" value="Delete">
</form>
<p><b><i>If you delete a FileIO Backstore it won't remove the image from your hard disk!</i></b></p>
<?php
if(isset($_POST['deleteFileIO'])) {
$deletefileio = $_POST["deletefileio"];
shell_exec("/usr/local/emhttp/plugins/iscsi/include/exec.sh delete_fileIO $deletefileio");
echo '<script>parent.window.location.reload();</script>';
}
?>
<? endif; ?>
<table>
<div id="title">
<span class="left"></span>
</div>
<td><b><font size="+1">Create Block Volume:</font></b></td>
<tr>
<td>Disk:</td>
<td>Name:</td>
</tr>
<form id="a" method="post">
<tr style="height:20px;">
<td>
<select name="disk" required>
<option selected="selected" value="">Choose disk</option>
<?php
$output = $_SESSION['availdisks'];
$data = explode("\n", $output);
var_dump($data);
foreach($data as $item){
echo "<option value=\"$item\"> $item</option>";
}
?>
</td>
<td><input type = "text" style="width: 100px;" name = "name" placeholder="1TB_Disk" required></td>
</tr>
</table>
<option id="a" method ="post">
<input type="submit" name="createBlock" value="Create Block">
</option>
</form>
<?php
if(isset($_POST['createBlock'])) {
$disk = $_POST["disk"];
$name = $_POST["name"];
shell_exec("/usr/local/emhttp/plugins/iscsi/include/exec.sh create_blockvol $disk $name");
echo '<script>parent.window.location.reload();</script>';
}
?>
<?
if (isset($_SESSION['availblockvols'] ) === true && trim($_SESSION['availblockvols'] ) !== ''):
?>
<b>Available Block Volumes:</b><br>
<?php
echo str_replace("\n", '<br>', $_SESSION['availblockvols']);
?>
<br>
<form id="s" method="post" >
<select name="deleteblockvol" required>
<option selected="selected" value="">Choose Block Volume</option>
<?php
$output = $_SESSION['availblockvols'];
$data = explode("\n", $output);
var_dump($data);
foreach($data as $item){
echo "<option value=\"$item\"> $item</option>";
}
?>
</select>
<input type="submit" name="deleteBlockVOL" value="Delete">
</form>
<p><b><i>If you delete a Block Volume Backstore it won't remove the image from your hard disk!</i></b></p>
<?php
if(isset($_POST['deleteBlockVOL'])) {
$deleteblockvol = $_POST["deleteblockvol"];
shell_exec("/usr/local/emhttp/plugins/iscsi/include/exec.sh delete_blockVOL $deleteblockvol");
echo '<script>parent.window.location.reload();</script>';
}
?>
<? endif; ?>