Esempio n. 1
0
							<input name="lab_id" value="' . $lab_id . '" type="hidden" />
							<input name="action" value="show_vm_console" type="hidden" />';
$vm_table = ace_lab_get_vm_table($lab_id);
foreach ($vm_table as $vm) {
    if ($vm['user_visible'] == 1) {
        $vm_button_class = $vm['id'] == $_POST['vm_id'] ? 'active' : '';
        $html_select_vm_console_buttons .= '
							<div class="row_element">
								<button name="vm_id" value="' . $vm['id'] . '" class="' . $vm_button_class . '" type="submit">' . $vm['display_name'] . '</button>
							</div>';
    }
}
$html_select_vm_console_buttons .= '
							<input name="nonce" value=' . $nonce . ' type="hidden" />
						</form>';
$vm_cdrom_table = ace_vm_get_cdrom_table($_POST['vm_id']);
$html_vm_cdrom_dropdown_list = NULL;
foreach ($vm_cdrom_table as $cdrom) {
    $volume_display_name = ace_volume_get_display_name_by_id($cdrom['volume_id']);
    $html_volume_display_name = $volume_display_name ? ' : ' . $volume_display_name : '';
    $html_vm_cdrom_dropdown_list .= '<option value="' . $cdrom['instance'] . '">cd' . $cdrom['instance'] . $html_volume_display_name . '</option>';
}
$vm_cdrom_exists = FALSE;
if (is_array($vm_cdrom_table)) {
    $vm_cdrom_exists = TRUE;
}
$iso_table = ace_get_iso_table();
$html_vm_media_dropdown_list = '<option value="none">none</option>';
foreach ($iso_table as $volume) {
    if ($volume['user_visible'] == 1) {
        $volume_display_name = $volume['display_name'];
Esempio n. 2
0
     $virt_vm_active = ace_vm_get_virt_state($vm_id);
     if (!$virt_vm_active && $vm_active) {
         $db_success = ace_vm_deactivate($vm_id);
         $vm['state'] = 0;
         $vm_active = FALSE;
     }
     if ($virt_vm_active && !$vm_active) {
         $db_success = ace_vm_activate($vm_id);
         $vm['state'] = 1;
         $vm_active = TRUE;
     }
 }
 $vm_change_state_disabled = $lab_state ? '' : 'disabled';
 $vm_shutdown_button_disabled = $vm_active ? '' : 'disabled';
 $vm_console_disabled = $lab_state ? '' : 'disabled';
 $num_vm_cdroms = ($vm_cdroms = ace_vm_get_cdrom_table($vm_id)) ? count($vm_cdroms) : 0;
 $vm_cdrom_attach_disabled = $vm_active ? 'disabled' : '';
 $vm_cdrom_detach_disabled = $num_vm_cdroms == 0 || $vm_active ? 'disabled' : '';
 $vm_cdrom_eject_disabled = $num_vm_cdroms == 0 ? 'disabled' : '';
 $num_vm_disks = ($vm_disks = ace_vm_get_disk_table($vm_id)) ? count($vm_disks) : 0;
 $vm_disk_attach_disabled = $vm_active ? 'disabled' : '';
 $vm_disk_detach_disabled = $num_vm_disks == 0 || $vm_active ? 'disabled' : '';
 $num_vm_nics = ($vm_nics = ace_vm_get_nic_table($vm_id)) ? count($vm_nics) : 0;
 $vm_nic_attach_disabled = $vm_active ? 'disabled' : '';
 $vm_nic_detach_disabled = $num_vm_nics == 0 || $vm_active ? 'disabled' : '';
 $vm_nic_disconnect_disabled = $num_vm_nics == 0 ? 'disabled' : '';
 $vm_state = $vm['state'] == 1 ? TRUE : FALSE;
 $vm_snapshots = ace_vm_get_snapshot_list($vm_id);
 $num_vm_snapshots = $vm_snapshots ? count($vm_snapshots) : 0;
 $vm_snapshot_button_disabled = !$lab_state || $virt_vm_active ? 'disabled' : '';
 $vm_snapshot_revert_button_disabled = $num_vm_snapshots == 0 || $virt_vm_active || !$lab_state ? 'disabled' : '';