function openqrm_hybrid_cloud_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_hybrid_cloud_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-hybrid-cloud-cloud-product-hook.php", "Handling " . $cmd . " event", "", "", 0, 0, 0);
    switch ($cmd) {
        case "add":
            $event->log("openqrm_hybrid_cloud_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-hybrid-cloud-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, 'hybrid-cloud-vm-');
                if ($pos !== false) {
                    $event->log("openqrm_hybrid_cloud_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-hybrid-cloud-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_hybrid_cloud_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-hybrid-cloud-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('hybrid-cloud');
            $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('hybrid-cloud-vm-local');
                $event->log("openqrm_hybrid_cloud_cloud_product", $_SERVER['REQUEST_TIME'], 5, "openqrm-hybrid-cloud-cloud-product-hook.php", "Removing resource type " . $virtualization->type . " from cloud-products", "", "", 0, 0, 0);
                $cloud_selector->remove_by_quantity($virtualization->id);
            }
            break;
    }
}
Esempio n. 2
0
 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('', '');
     $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['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['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;
         // 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;
         // 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;
         // 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;
         // 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;
         // 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;
 }