当前位置: 首页>>代码示例>>PHP>>正文


PHP image::get_ids方法代码示例

本文整理汇总了PHP中image::get_ids方法的典型用法代码示例。如果您正苦于以下问题:PHP image::get_ids方法的具体用法?PHP image::get_ids怎么用?PHP image::get_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在image的用法示例。


在下文中一共展示了image::get_ids方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_ami_deployment_image_rootdevice_identifier

function get_ami_deployment_image_rootdevice_identifier($id)
{
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_ADMIN;
    global $event;
    $rootdevice_identifier_array = array();
    $image = new image();
    $image_id_list = $image->get_ids();
    foreach ($image_id_list as $id => $ikey) {
        $image_tmp = new image();
        $image_tmp->get_instance_by_id($id);
        if ($image_tmp->type === "ami-deployment") {
            $rootdevice_identifier_array[] = array("value" => $image_tmp->rootdevice, "label" => $image_tmp->name);
        }
    }
    return $rootdevice_identifier_array;
}
开发者ID:kelubo,项目名称:OpenQRM,代码行数:17,代码来源:image.ami-deployment.php

示例2: array

 function get_response()
 {
     $response = $this->response;
     $form = $response->get_form($this->actions_name, 'edit');
     $id = $this->response->html->request()->get('image_id');
     $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');
     $image = $this->openqrm->image();
     $image->get_instance_by_id($id);
     $storage = $this->openqrm->storage();
     $storage->get_instance_by_id($image->storageid);
     $deployment = $this->openqrm->deployment();
     $deployment->get_instance_by_id($storage->type);
     $storage_resource = $this->openqrm->resource();
     $storage_resource->get_instance_by_id($storage->resource_id);
     // making the deployment parameters plugg-able
     $rootdevice_identifier_hook = $this->openqrm->get('basedir') . "/web/boot-service/image." . $deployment->type . ".php";
     if (file_exists($rootdevice_identifier_hook)) {
         require_once "{$rootdevice_identifier_hook}";
         // run function returning rootdevice array
         $get_rootfs_transfer_methods_function = "get_" . $deployment->type . "_rootfs_transfer_methods";
         $get_rootfs_transfer_methods_function = str_replace("-", "_", $get_rootfs_transfer_methods_function);
         $rootfs_transfer_methods = $get_rootfs_transfer_methods_function();
         $get_rootfs_set_password_method_function = "get_" . $deployment->type . "_rootfs_set_password_method";
         $get_rootfs_set_password_method_function = str_replace("-", "_", $get_rootfs_set_password_method_function);
         $rootfs_set_password_method = $get_rootfs_set_password_method_function();
         $get_rootfs_local_deployment_enabled_function = "get_" . $deployment->type . "_local_deployment_enabled";
         $get_rootfs_local_deployment_enabled_function = str_replace("-", "_", $get_rootfs_local_deployment_enabled_function);
         $rootfs_local_deployment_enabled = $get_rootfs_local_deployment_enabled_function();
     } else {
         $rootfs_transfer_methods = false;
         $rootfs_set_password_method = false;
         $rootfs_local_deployment_enabled = false;
     }
     // making the local deployment parameter plugg-able
     $local_deployment_methods_input = "";
     if ($rootfs_local_deployment_enabled) {
         $local_deployment_methods_arr[] = array("value" => "", "label" => "");
         $local_deployment = new deployment();
         $deployment_id_arr = $local_deployment->get_deployment_ids();
         foreach ($deployment_id_arr as $deployment_id) {
             $local_deployment->get_instance_by_id($deployment_id['deployment_id']);
             $local_deployment_templates_identifier_hook = $this->openqrm->get('basedir') . "/web/boot-service/template." . $local_deployment->type . ".php";
             if (file_exists($local_deployment_templates_identifier_hook)) {
                 require_once "{$local_deployment_templates_identifier_hook}";
                 $deployment_function = "get_" . "{$local_deployment->type}" . "_methods";
                 $deployment_function = str_replace("-", "_", $deployment_function);
                 $local_deployment_methods_arr[] = $deployment_function();
             }
         }
     }
     // in case the deployment method provides the rootfs-transfer options
     $nfs_image_identifier_array = array();
     if ($rootfs_transfer_methods) {
         // prepare the install-from and transfer-to selects
         $nfs_image_identifier_array[] = array("value" => "", "label" => "");
         $nfs_image = new image();
         $image_arr = $nfs_image->get_ids();
         foreach ($image_arr as $id) {
             $i_id = $id['image_id'];
             $timage = new image();
             $timage->get_instance_by_id($i_id);
             if (strstr($timage->type, "nfs")) {
                 $timage_name = $timage->name;
                 $nfs_image_identifier_array[] = array("value" => "{$i_id}", "label" => "{$timage_name}");
             }
         }
     }
     $html = new htmlobject_div();
     $html->text = '<a href="../../plugins/' . $deployment->storagetype . '/' . $deployment->storagetype . '-about.php" target="_blank" class="doculink">' . $deployment->description . '</a>';
     $html->id = 'htmlobject_image_type';
     $storage_deploy_box = new htmlobject_box();
     $storage_deploy_box->id = 'htmlobject_box_image_deploy';
     $storage_deploy_box->css = 'htmlobject_box';
     $storage_deploy_box->label = 'Deployment';
     $storage_deploy_box->content = $html;
     $html = new htmlobject_div();
     $html->text = $deployment->storagedescription;
     $html->id = 'htmlobject_storage_type';
     $storage_type_box = new htmlobject_box();
     $storage_type_box->id = 'htmlobject_box_storage_type';
     $storage_type_box->css = 'htmlobject_box';
     $storage_type_box->label = 'Storage';
     $storage_type_box->content = $html;
     #$storage_resource->id /
     $html = new htmlobject_div();
     $html->text = "{$storage_resource->ip}";
     $html->id = 'htmlobject_storage_resource';
     $storage_resource_box = new htmlobject_box();
     $storage_resource_box->id = 'htmlobject_box_storage_resource';
     $storage_resource_box->css = 'htmlobject_box';
     $storage_resource_box->label = 'Resource';
     $storage_resource_box->content = $html;
     // in case the deployment type allows to set the password in the image
     if ($rootfs_set_password_method) {
         $d['image_password']['label'] = $this->lang['form_image_password'];
//.........这里部分代码省略.........
开发者ID:kelubo,项目名称:OpenQRM,代码行数:101,代码来源:image.edit.class.php

示例3: array

 function get_response()
 {
     $size_select_arr = array();
     $availability_zones_select_arr = array();
     $security_group_select_arr = array();
     $subnet_select_arr = array();
     $keypair_select_arr = array();
     // get the datastore and vswitchlist for the selects
     if (file_exists($this->statfile)) {
         $lines = explode("\n", file_get_contents($this->statfile));
         if (count($lines) >= 1) {
             foreach ($lines as $line) {
                 if ($line !== '') {
                     $line = explode('@', $line);
                     switch ($line[0]) {
                         case 'SIZES':
                             $size_select_arr[] = array($line[1], $line[1]);
                             break;
                         case 'KEYPAIR':
                             $keypair_select_arr[] = array($line[1], $line[1]);
                             break;
                         case 'GROUP':
                             $security_group_select_arr[] = array($line[1], $line[1]);
                             break;
                         case 'ZONES':
                             $availability_zones_select_arr[] = array($line[1], $line[1]);
                             break;
                         case 'SUBNET':
                             $subnet_select_arr[] = array($line[1], $line[2] . " (" . $line[3] . ")");
                             break;
                     }
                 }
             }
         }
     }
     if ($this->hc->account_type == 'aws' || $this->hc->account_type == 'euca') {
         $instance_types[] = array("t1.micro", "t1.micro");
         $instance_types[] = array("m1.small", "m1.small");
         $instance_types[] = array("m1.medium", "m1.medium");
         $instance_types[] = array("m1.large", "m1.large");
         $instance_types[] = array("m1.xlarge", "m1.xlarge");
         $instance_types[] = array("m3.xlarge", "m3.xlarge");
         $instance_types[] = array("m3.2xlarge", "m3.2xlarge");
         $instance_types[] = array("c1.medium", "c1.medium");
         $instance_types[] = array("c1.xlarge", "c1.xlarge");
         $instance_types[] = array("m2.xlarge", "m2.xlarge");
         $instance_types[] = array("m2.2xlarge", "m2.2xlarge");
         $instance_types[] = array("m2.4xlarge", "m2.4xlarge");
         $instance_types[] = array("cr1.8xlarge", "cr1.8xlarge");
         $instance_types[] = array("hi1.4xlarge", "hi1.4xlarge");
         $instance_types[] = array("hs1.8xlarge", "hs1.8xlarge");
         $instance_types[] = array("cc1.4xlarge", "cc1.4xlarge");
         $instance_types[] = array("cc2.8xlarge", "cc2.8xlarge");
         $instance_types[] = array("cg1.4xlarge", "cg1.4xlarge");
         $instance_type_selected = "t1.micro";
     }
     if ($this->hc->account_type == 'lc-openstack') {
         $instance_types = $size_select_arr;
         $instance_type_selected = "m1.nano";
     }
     // AMIs
     $ami_select_arr = array();
     $image = new image();
     $image_id_list = $image->get_ids();
     foreach ($image_id_list as $id => $ikey) {
         $image_tmp = new image();
         $image_tmp->get_instance_by_id($ikey['image_id']);
         if ($image_tmp->type === "ami-deployment") {
             $ami_select_arr[] = array($image_tmp->id, $image_tmp->comment);
         }
     }
     $response = $this->response;
     $form = $response->get_form($this->actions_name, 'add');
     $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');
     if ($this->hc->account_type == 'lc-openstack') {
         $d['name']['label'] = $this->lang['form_name'];
         $d['name']['required'] = false;
         $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']['id'] = 'name';
         $d['name']['object']['attrib']['name'] = 'name';
         $d['name']['object']['attrib']['type'] = 'text';
         $d['name']['object']['attrib']['value'] = '';
         $d['name']['object']['attrib']['maxlength'] = 255;
     }
     if ($this->hc->account_type == 'aws' || $this->hc->account_type == 'euca') {
         $d['name'] = '';
     }
     $d['instance_type']['label'] = $this->lang['form_instance_type'];
     $d['instance_type']['required'] = true;
     $d['instance_type']['object']['type'] = 'htmlobject_select';
     $d['instance_type']['object']['attrib']['name'] = 'type';
     $d['instance_type']['object']['attrib']['index'] = array(0, 1);
     $d['instance_type']['object']['attrib']['options'] = $instance_types;
//.........这里部分代码省略.........
开发者ID:kelubo,项目名称:OpenQRM,代码行数:101,代码来源:hybrid-cloud-vm.add.class.php

示例4: array

 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';
//.........这里部分代码省略.........
开发者ID:kelubo,项目名称:OpenQRM,代码行数:101,代码来源:kvm-vm.add.class.php


注:本文中的image::get_ids方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。