本文整理汇总了PHP中image::is_network_deployment方法的典型用法代码示例。如果您正苦于以下问题:PHP image::is_network_deployment方法的具体用法?PHP image::is_network_deployment怎么用?PHP image::is_network_deployment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::is_network_deployment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resource
function get_response()
{
$response = $this->response;
$form = $response->get_form($this->actions_name, 'step3');
$resource = new resource();
$resource->get_instance_by_id($this->appliance->resources);
// if not openQRM resource
if ($resource->id != 0) {
$virtualization = new virtualization();
$virtualization->get_instance_by_id($resource->vtype);
}
$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');
// prepare image list according to the resource capabilities + vtype
$image = new image();
$list = $image->get_list();
unset($list[0]);
unset($list[1]);
$images = array();
// openQRM
if ($resource->id == 0) {
$images[] = array(0, 'Local openQRM Installation');
// local-server integrated resource
} else {
if (strstr($resource->capabilities, "TYPE=local-server")) {
$local_image = new image();
$local_image->get_instance_by_id($resource->imageid);
$images[] = array($local_image->id, 'Local OS Installation');
// local-deployment VMs
} else {
if (strstr($virtualization->type, "-vm-local")) {
$virtualization_plugin_name = $virtualization->get_plugin_name();
$deployment = new deployment();
$deployment_id_arr = $deployment->get_deployment_ids();
$possible_deployment_types_arr = '';
foreach ($deployment_id_arr as $deployment_id_db) {
$deployment_id = $deployment_id_db['deployment_id'];
$deployment->get_instance_by_id($deployment_id);
if ($deployment->storagetype === $virtualization_plugin_name) {
$possible_deployment_types_arr[] = $deployment->type;
}
}
// filter image list with only the images from the VM deployment type
foreach ($list as $value) {
$image_id = $value['value'];
$image->get_instance_by_id($image_id);
// is image active ? then do not show it here
if ($image->isactive == 1) {
continue;
}
if (!in_array($image->type, $possible_deployment_types_arr)) {
continue;
}
// filter local-server images
$images[] = array($image_id, $image->id . ' / ' . $image->name . ' (' . $image->type . ')');
}
// network-deployment - show only network-boot images
} else {
if (strstr($virtualization->type, "-vm-net")) {
foreach ($list as $value) {
$image_id = $value['value'];
$image->get_instance_by_id($image_id);
// is image active ? then do not show it here
if ($image->isactive == 1) {
continue;
}
// filter local-server images
if (strstr($image->capabilities, "TYPE=local-server")) {
continue;
}
$is_network_deployment = false;
if ($image->is_network_deployment() === true) {
$is_network_deployment = true;
}
if ($is_network_deployment) {
$images[] = array($image_id, $image->id . ' / ' . $image->name . ' (' . $image->type . ')');
}
}
// network deployment - physical systems - show only network-boot images
} else {
foreach ($list as $value) {
$image_id = $value['value'];
$image->get_instance_by_id($image_id);
// is image active ? then do not show it here
if ($image->isactive == 1) {
continue;
}
// filter local-server images
if (strstr($image->capabilities, "TYPE=local-server")) {
continue;
}
$is_network_deployment = false;
if ($image->is_network_deployment() === true) {
$is_network_deployment = true;
}
if ($is_network_deployment) {
//.........这里部分代码省略.........
示例2: 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';
//.........这里部分代码省略.........