Exemplo n.º 1
0
html_inputbox("name", gettext("Name"), $pconfig['name'], "", true, 20);
?>
					<?php 
$a_device = array();
foreach ($a_vdevice as $vdevicev) {
    if (isset($uuid) && false !== $cnid && !(isset($pconfig['vdevice']) && is_array($pconfig['vdevice']) && in_array($vdevicev['name'], $pconfig['vdevice']))) {
        continue;
    }
    if ((!isset($uuid) || isset($uuid) && false === $cnid) && false !== array_search_ex($vdevicev['name'], $a_pool, "vdevice")) {
        continue;
    }
    $a_device[$vdevicev['name']] = htmlspecialchars("{$vdevicev['name']} ({$vdevicev['type']}" . (!empty($vdevicev['desc']) ? ", {$vdevicev['desc']})" : ")"));
}
?>
					<?php 
html_listbox("vdevice", gettext("Virtual devices"), !empty($pconfig['vdevice']) ? $pconfig['vdevice'] : array(), $a_device, "", true);
?>
					<?php 
html_inputbox("root", gettext("Root"), $pconfig['root'], gettext("Creates the pool with an alternate root."), false, 40);
?>
					<?php 
html_inputbox("mountpoint", gettext("Mount point"), $pconfig['mountpoint'], gettext("Sets an alternate mount point for the root dataset. Default is /mnt."), false, 40);
?>
					<?php 
html_checkbox("force", gettext("Force use"), !empty($pconfig['force']) ? true : false, gettext("Forces use of vdevs, even if they appear in use or specify different size. (This is not recommended.)"), "", false);
?>
					<?php 
html_inputbox("desc", gettext("Description"), $pconfig['desc'], gettext("You may enter a description here for your reference."), false, 40);
?>
				</table>
				<div id="submit">
</td>
			    </tr>
			    <?php 
$a_provider = array();
foreach ($a_disk as $diskv) {
    if (isset($id) && !(is_array($pconfig['device']) && in_array($diskv['devicespecialfile'], $pconfig['device']))) {
        continue;
    }
    if (!isset($id) && false !== array_search_ex($diskv['devicespecialfile'], $all_raid, "device")) {
        continue;
    }
    $a_provider[$diskv[devicespecialfile]] = htmlspecialchars("{$diskv['name']} ({$diskv['size']}, {$diskv['desc']})");
}
?>
			    <?php 
html_listbox("device", gettext("Provider"), $pconfig['device'], $a_provider, gettext("Note: Ctrl-click (or command-click on the Mac) to select multiple entries."), true, isset($id));
?>
			    <?php 
if (!isset($id)) {
    ?>
			    <tr>
						<td width="22%" valign="top" class="vncell"><?php 
    echo gettext("Initialize");
    ?>
</td>
			      <td width="78%" class="vtable">
							<input name="init" type="checkbox" id="init" value="yes" <?php 
    if (true === $pconfig['init']) {
        echo "checked=\"checked\"";
    }
    ?>
html_combobox("laggproto", gettext("Aggregation protocol"), $pconfig['laggproto'], array("failover" => gettext("Failover"), "fec" => gettext("FEC (Fast EtherChannel)"), "lacp" => gettext("LACP (Link Aggregation Control Protocol)"), "loadbalance" => gettext("Loadbalance"), "roundrobin" => gettext("Roundrobin"), "none" => gettext("None")), "", true);
?>
					<?php 
$a_port = array();
foreach (get_interface_list() as $ifk => $ifv) {
    if (eregi('lagg', $ifk)) {
        continue;
    }
    if (!(isset($uuid) && FALSE !== $cnid) && false !== array_search_ex($ifk, $a_lagg, "laggport")) {
        continue;
    }
    $a_port[$ifk] = htmlspecialchars("{$ifk} ({$ifv['mac']})");
}
?>
					<?php 
html_listbox("laggport", gettext("Ports"), $pconfig['laggport'], $a_port, gettext("Note: Ctrl-click (or command-click on the Mac) to select multiple entries."), true);
?>
					<?php 
html_inputbox("desc", gettext("Description"), $pconfig['desc'], gettext("You may enter a description here for your reference."), false, 40);
?>
				</table>
				<div id="submit">
					<input name="Submit" type="submit" class="formbtn" value="<?php 
echo isset($uuid) && FALSE !== $cnid ? gettext("Save") : gettext("Add");
?>
" />
					<input name="Cancel" type="submit" class="formbtn" value="<?php 
echo gettext("Cancel");
?>
" />
					<input name="enable" type="hidden" value="<?php 
if (isset($uuid) && false !== $cnid) {
    foreach ($a_vdevice[$cnid]['device'] as $dev) {
        $tmp = disks_label_to_device($dev);
        if (strcmp($tmp, $dev) != 0) {
            $a_device[strip_dev($dev)] = htmlspecialchars(sprintf("%s (%s)", strip_dev($dev), strip_dev($tmp)));
        } else {
            $tmp = strip_partition($dev);
            if (strcmp($tmp, $dev) != 0) {
                $a_device[strip_dev($dev)] = htmlspecialchars(sprintf("%s (%s)", strip_dev($dev), strip_dev($tmp)));
            }
        }
    }
}
?>
					<?php 
html_listbox("device", gettext("Devices"), !empty($pconfig['device']) ? $pconfig['device'] : array(), $a_device, "", true, isset($uuid) && false !== $cnid);
?>
					<?php 
html_checkbox("aft4k", gettext("4KB wrapper"), !empty($pconfig['aft4k']) ? true : false, gettext("Create 4KB wrapper (nop device)."), "", false, "");
?>
					<?php 
html_inputbox("desc", gettext("Description"), $pconfig['desc'], gettext("You may enter a description here for your reference."), false, 40);
?>
				</table>
				<div id="submit">
					<input name="Submit" type="submit" class="formbtn" value="<?php 
echo isset($uuid) && FALSE !== $cnid ? gettext("Save") : gettext("Add");
?>
" onclick="enable_change(true)" />
					<input name="Cancel" type="submit" class="formbtn" value="<?php 
echo gettext("Cancel");
Exemplo n.º 5
0
html_inputbox("if", gettext("Interface"), $pconfig['if'], "", true, 5, true);
?>
				<?php 
$a_bridgeif = array();
foreach (get_interface_list() as $ifk => $ifv) {
    if (preg_match('/bridge/i', $ifk)) {
        continue;
    }
    if (!(isset($uuid) && FALSE !== $cnid) && false !== array_search_ex($ifk, $a_bridge, "bridgeif")) {
        continue;
    }
    $a_bridgeif[$ifk] = htmlspecialchars("{$ifk} ({$ifv['mac']})");
}
?>
				<?php 
html_listbox("bridgeif", gettext("Member Interface"), $pconfig['bridgeif'], $a_bridgeif, gettext("Note: Ctrl-click (or command-click on the Mac) to select multiple entries."), true);
?>
				<?php 
html_inputbox("mtu", gettext("MTU"), $pconfig['mtu'], gettext("Set the maximum transmission unit of the interface to n, default is interface specific. The MTU is used to limit the size of packets that are transmitted on an interface. Not all interfaces support setting the MTU, and some interfaces have range restrictions."), false, 5);
?>
				<?php 
html_inputbox("extraoptions", gettext("Extra options"), $pconfig['extraoptions'], gettext("Extra options to ifconfig (usually empty)."), false, 40);
?>
				<?php 
html_inputbox("desc", gettext("Description"), $pconfig['desc'], gettext("You may enter a description here for your reference."), false, 40);
?>
			</table>
			<div id="submit">
				<input name="Submit" type="submit" class="formbtn" value="<?php 
echo isset($uuid) && FALSE !== $cnid ? gettext("Save") : gettext("Add");
?>
html_inputbox("name", gettext("Name"), $pconfig['name'], "", true, 20);
?>
					<?php 
$a_device = array();
foreach ($a_vdevice as $vdevicev) {
    if (isset($uuid) && false !== $cnid && !(is_array($pconfig['vdevice']) && in_array($vdevicev['name'], $pconfig['vdevice']))) {
        continue;
    }
    if ((!isset($uuid) || isset($uuid) && false === $cnid) && false !== array_search_ex($vdevicev['name'], $a_pool, "vdevice")) {
        continue;
    }
    $a_device[$vdevicev['name']] = htmlspecialchars("{$vdevicev['name']} ({$vdevicev['type']}" . (!empty($vdevicev['desc']) ? ", {$vdevicev['desc']})" : ")"));
}
?>
					<?php 
html_listbox("vdevice", gettext("Virtual devices"), $pconfig['vdevice'], $a_device, "", true);
?>
					<?php 
html_inputbox("root", gettext("Root"), $pconfig['root'], gettext("Creates the pool with an alternate root."), false, 40);
?>
					<?php 
html_inputbox("mountpoint", gettext("Mount point"), $pconfig['mountpoint'], gettext("Sets an alternate mount point for the root dataset. Default is /mnt."), false, 40);
?>
					<?php 
html_inputbox("desc", gettext("Description"), $pconfig['desc'], gettext("You may enter a description here for your reference."), false, 40);
?>
				</table>
				<div id="submit">
					<input name="Submit" type="submit" class="formbtn" value="<?php 
echo isset($uuid) && FALSE !== $cnid ? gettext("Save") : gettext("Add");
?>
html_inputbox("userid", gettext("User ID"), $pconfig['userid'], gettext("User numeric id."), true, 20, isset($uuid) && FALSE !== $cnid);
?>
					<?php 
html_combobox("shell", gettext("Shell"), $pconfig['shell'], array("nologin" => "nologin", "scponly" => "scponly", "sh" => "sh", "csh" => "csh", "tcsh" => "tcsh", "bash" => "bash"), gettext("The user's login shell."), true);
?>
					<?php 
$grouplist = array();
foreach ($a_group as $groupk => $groupv) {
    $grouplist[$groupv] = $groupk;
}
?>
					<?php 
html_combobox("primarygroup", gettext("Primary group"), $pconfig['primarygroup'], $grouplist, gettext("Set the account's primary group to the given group."), true);
?>
					<?php 
html_listbox("group", gettext("Additional group"), $pconfig['group'], $grouplist, gettext("Set additional group memberships for this account.") . "<br />" . gettext("Note: Ctrl-click (or command-click on the Mac) to select and deselect groups."));
?>
					<?php 
html_filechooser("homedir", gettext("Home directory"), $pconfig['homedir'], gettext("Enter the path to the home directory of that user. Leave this field empty to use default path /mnt."), $g['media_path'], false, 60);
?>
					<?php 
html_checkbox("userportal", gettext("User portal"), $pconfig['userportal'] ? true : false, gettext("Grant access to the user portal."), "", false);
?>
				</table>
				<div id="submit">
					<input name="Submit" type="submit" class="formbtn" value="<?php 
echo isset($uuid) && FALSE !== $cnid ? gettext("Save") : gettext("Add");
?>
" />
					<input name="Cancel" type="submit" class="formbtn" value="<?php 
echo gettext("Cancel");
html_combobox("type", gettext("Type"), $pconfig['type'], array("stripe" => gettext("Stripe"), "mirror" => gettext("Mirror"), "raidz1" => gettext("Single-parity RAID-5"), "raidz2" => gettext("Double-parity RAID-5"), "spare" => gettext("Hot Spare")), "", true, isset($uuid) && false !== $cnid);
?>
					<?php 
$a_device = array();
foreach ($a_disk as $diskv) {
    if (isset($uuid) && false !== $cnid && !(is_array($pconfig['device']) && in_array($diskv['devicespecialfile'], $pconfig['device']))) {
        continue;
    }
    if ((!isset($uuid) || isset($uuid) && false === $cnid) && false !== array_search_ex($diskv['devicespecialfile'], $a_vdevice, "device")) {
        continue;
    }
    $a_device[$diskv['devicespecialfile']] = htmlspecialchars("{$diskv['name']} ({$diskv['size']}, {$diskv['desc']})");
}
?>
					<?php 
html_listbox("device", gettext("Devices"), $pconfig['device'], $a_device, "", true, isset($uuid) && false !== $cnid);
?>
					<?php 
html_inputbox("desc", gettext("Description"), $pconfig['desc'], gettext("You may enter a description here for your reference."), false, 40);
?>
				</table>
				<div id="submit">
					<input name="Submit" type="submit" class="formbtn" value="<?php 
echo isset($uuid) && FALSE !== $cnid ? gettext("Save") : gettext("Add");
?>
" onclick="enable_change(true)" />
					<input name="Cancel" type="submit" class="formbtn" value="<?php 
echo gettext("Cancel");
?>
" />
					<input name="uuid" type="hidden" value="<?php 
html_checkbox("vmdebug", "Debug", $pconfig['vmdebug'], "Set  to run vm-bhyve in debug mode.", "In this mode, all output from the bhyve process is written to\nvm_dir/{guest}/bhyve.log. This is useful if the guest is crashing or exiting abnormally as the log will contain any output from bhyve.", false, "");
?>
					<?php 
html_combobox("vmdisk0_type", "Disk0 type", $pconfig['vmdisk0_type'], array("virtio-blk", "ahci-hd"), "This specifies the emulation type for disk0. Please note that each disk requires at least a type and name.", true, false);
?>
					<?php 
html_combobox("vmdisk0_dev", "Disk0 device", $pconfig['vmdisk0_dev'], array("file", "zvol", "sparse-zvol", "custom"), "The type of device used as the backing store for this disk. The default is <i>file</i>, which means a sparse file is used. This file is stored in the guest's directory.\n\t\t\t\t\tFor the zvol options, the zvol must be directly under the guest dataset.\n\t\t\t\t\tThere is also a <i>custom</i> option, in which case the disk name should be the full path to the file or device you want to use.", true, false);
?>
					<?php 
html_filechooser('vmdisk0_name', "Disk0 name", $pconfig['vmdisk0_name'], "The name of the file or zvol for this disk. If the device type is 'custom', it should be the full path to whichever device or file you want to use. This value is translated to a path as follows, based on disk0_dev<br />\n\t\t\t\t\t<table border='3'><tr><td><b>DEVICE TYPE</b></td><td><b> DISK NAME </b></td><td><b> BHYVE PATH USED </b></td></tr>\n\t\t\t\t\t<tr><td>file</td><td>'disk0.img'</td> <td>'vm_dir/name/disk0.img'</td></tr>\n\t\t\t\t\t<tr><td>zvol|sparse-zvol</td><td>'disk0'</td><td>'/dev/zvol/pool/dataset/path/guest/disk0'</td></tr>\n\t\t\t\t\t<tr><td>custom</td><td>'/dev/da10'</td><td>'/dev/da10'</td></tr></table>", "/", false, "67", false, "");
?>
					<?php 
//html_optionsbox("disk0_opts", "Disk0 options", $pconfig['disk0_opts'], array("direct","nocache","ro","sectorsize=logical","sectorsize=physical"), false, false) ;
?>
					<?php 
html_listbox("disk0_opts", "Disk0 options", $pconfig['disk0_opts'], array("direct", "nocache", "ro", "sectorsize=logical", "sectorsize=physical"), "List of additional options for the specified disk.\nThe available options are listed below. See the <a href='https://www.freebsd.org/cgi/man.cgi?query=bhyve&sektion=8'>bhyve(8) man page</a> for more details", false, false, "");
?>
					<?php 
html_inputbox("network0_switch", gettext("network0 switch"), empty($pconfig['network0_switch']) ? "public" : $pconfig['network0_switch'], "The name of the virtual switch to connect this interface to. When starting the guest, if this switch cannot be found, or no switch is specified, the interface\nis still created but will not be connected to anything. All default templates use a switch called 'public', although it's perfectly reasonable to use other switch names that make sense in your environment", false, 16, false);
?>
					<?php 
html_bhyveinterfacecombobox("network0_device", "network0 device", $pconfig['network0_device'], "If you do not want vm-bhyve to create a new interface, but use an existing\none, enter the interface name here. This allows you to preconfigure the network\ndevice in a custom configuration, then instruct vm-bhyve to use that rather\nthan create all interfaces dynamically at run time.", false, false);
?>
					<?php 
html_inputbox("macaddr", "MAC address", $pconfig['macaddr'], "This allows you to specify a fixed mac address for this interface inside the guest.\nWithout this option, bhyve will automatically assign a mac address to the interface.", false, 26, false);
?>
					<?php 
$devices = bhyve_pci_devices();
html_combobox("passthru0", "Add a pass-through PCI device", $pconfig['passthru0'], $devices, "This allows the guest to access a hardware device no differently than if it was running on bare\nmetal. The value of this option is the Bus/Slot/Function of the appropriate device. Please note that in order to stop the bhyve host from attaching to the device,\nthere are some steps required to reserve the device in /boot/loader.conf.  More details can be found in the <a href='https://wiki.freebsd.org/bhyve/pci_passthru'>FreeBSD bhyve wiki</a> pages", false, false);
?>
					<?php