本文整理汇总了PHP中resource::get_resource_capabilities方法的典型用法代码示例。如果您正苦于以下问题:PHP resource::get_resource_capabilities方法的具体用法?PHP resource::get_resource_capabilities怎么用?PHP resource::get_resource_capabilities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类resource
的用法示例。
在下文中一共展示了resource::get_resource_capabilities方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_hybrid_cloud_appliance_link
function get_hybrid_cloud_appliance_link($appliance_id)
{
global $event;
global $OPENQRM_SERVER_BASE_DIR;
global $OPENQRM_SERVER_IP_ADDRESS;
global $OPENQRM_EXEC_PORT;
$p_appliance = new appliance();
$p_appliance->get_instance_by_id($appliance_id);
$p_resource = new resource();
$p_resource->get_instance_by_id($p_appliance->resources);
$virtualization = new virtualization();
$virtualization->get_instance_by_id($p_appliance->virtualization);
if ($virtualization->type != "hybrid-cloud-vm-local") {
return;
}
// get hybrid-cloud account
$hybrid_cloud_acl_id = $p_resource->get_resource_capabilities("HCACL");
if ($hybrid_cloud_acl_id == '') {
$event->log("get_hybrid_cloud_appliance_link", $_SERVER['REQUEST_TIME'], 2, "openqrm-hybrid-cloud-appliance-link-hook.php", "Could not find Hybrid-Cloud Account for resource " . $p_resource->id, "", "", 0, 0, $appliance_id);
return;
}
$hc = new hybrid_cloud();
$hc->get_instance_by_id($hybrid_cloud_acl_id);
$html = new htmlobject($OPENQRM_SERVER_BASE_DIR . '/openqrm/web/base/class/htmlobjects');
$a = $html->a();
$a->label = 'Dashboard';
$a->css = 'badge';
$a->target = '_BLANK';
if ($hc->account_type == 'aws' || $hc->account_type == 'euca') {
$a->href = 'https://console.aws.amazon.com/ec2/';
}
if ($hc->account_type == 'lc-openstack') {
$a->href = 'http://' . $hc->host . '/project/instances/';
}
$plugin_link = $a->get_string();
return $plugin_link;
}
示例2: fence_hybrid_cloud_vm_local
function fence_hybrid_cloud_vm_local($host_resource_id, $mac)
{
global $OPENQRM_SERVER_BASE_DIR;
global $OPENQRM_SERVER_IP_ADDRESS;
global $OPENQRM_EXEC_PORT;
global $RESOURCE_INFO_TABLE;
global $event;
$event->log("fence_hybrid_cloud_vm_local", $_SERVER['REQUEST_TIME'], 5, "hybrid-cloud-ha-hook", "Fencing Cloud VM " . $mac, "", "", 0, 0, 0);
$origin_resource = new resource();
$origin_resource->get_instance_by_mac($mac);
// get hybrid-cloud account from origin resource
$hybrid_acl_id = $origin_resource->get_resource_capabilities("HCACL");
$hc = new hybrid_cloud();
$hc->get_instance_by_id($hybrid_acl_id);
$hc_authentication = '';
if ($hc->account_type == 'aws' || $hc->account_type == 'euca') {
$hc_authentication .= ' -O ' . $hc->access_key;
$hc_authentication .= ' -W ' . $hc->secret_key;
}
if ($hc->account_type == 'lc-openstack') {
$hc_authentication .= ' -u ' . $hc->username;
$hc_authentication .= ' -p ' . $hc->password;
$hc_authentication .= ' -q ' . $hc->host;
$hc_authentication .= ' -x ' . $hc->port;
$hc_authentication .= ' -g ' . $hc->tenant;
$hc_authentication .= ' -e ' . $hc->endpoint;
}
$openqrm = new openqrm_server();
$command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/hybrid-cloud/bin/openqrm-hybrid-cloud-vm fence ";
$command .= ' -i ' . $hc->id;
$command .= ' -n ' . $hc->account_name;
$command .= ' -t ' . $hc->account_type;
$command .= $hc_authentication;
$command .= ' -im ' . $mac;
$command .= ' --openqrm-cmd-mode background';
$event->log("fence_hybrid_cloud_vm_local", $_SERVER['REQUEST_TIME'], 5, "hybrid-cloud-ha-hook", "Running {$command}", "", "", 0, 0, 0);
$openqrm->send_command($command, NULL, true);
$rufields["resource_hostname"] = $hc->account_type . $origin_resource->id;
$origin_resource->update_info($origin_resource->id, $rufields);
// debug
// echo "1:".$command;
}
示例3: remove_hybrid_cloud_vm_local
function remove_hybrid_cloud_vm_local($host_resource_id, $name, $mac)
{
global $OPENQRM_SERVER_BASE_DIR;
global $OPENQRM_SERVER_IP_ADDRESS;
global $OPENQRM_EXEC_PORT;
global $RESOURCE_INFO_TABLE;
global $event;
$event->log("remove_hybrid_cloud_vm_local", $_SERVER['REQUEST_TIME'], 5, "hybrid-cloud-cloud-hook", "Removing Cloud VM {$name}/{$mac} from Host resource {$host_resource_id}", "", "", 0, 0, 0);
$openqrm = new openqrm_server();
$cloud_resource = new resource();
$cloud_resource->get_instance_by_mac($mac);
$hc_default_account_id = $cloud_resource->get_resource_capabilities("HCACL");
$cloud_resource_hostname = $cloud_resource->hostname;
if (strlen($hc_default_account_id)) {
// $event->log("remove_hybrid_cloud_vm_local", $_SERVER['REQUEST_TIME'], 2, "hybrid-cloud-cloud-hook", "!!! found Cloud Account ".$hc_default_account_id." from resource config", "", "", 0, 0, 0);
} else {
$file = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/hybrid-cloud/etc/openqrm-plugin-hybrid-cloud.conf";
$ini = openqrm_parse_conf($file);
$hc_default_account_id = $ini['OPENQRM_PLUGIN_HYBRID_CLOUD_DEFAULT_ACCOUNT'];
// $event->log("remove_hybrid_cloud_vm_local", $_SERVER['REQUEST_TIME'], 2, "hybrid-cloud-cloud-hook", "!!! got Cloud Account ".$hc_default_account_id." from plugin config", "", "", 0, 0, 0);
}
$hc = new hybrid_cloud();
$hc->get_instance_by_id($hc_default_account_id);
$hc_authentication = '';
if ($hc->account_type == 'aws' || $hc->account_type == 'euca') {
$hc_authentication .= ' -O ' . $hc->access_key;
$hc_authentication .= ' -W ' . $hc->secret_key;
}
if ($hc->account_type == 'lc-openstack') {
$hc_authentication .= ' -u ' . $hc->username;
$hc_authentication .= ' -p ' . $hc->password;
$hc_authentication .= ' -q ' . $hc->host;
$hc_authentication .= ' -x ' . $hc->port;
$hc_authentication .= ' -g ' . $hc->tenant;
$hc_authentication .= ' -e ' . $hc->endpoint;
}
$openqrm = new openqrm_server();
$command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/hybrid-cloud/bin/openqrm-hybrid-cloud-vm remove ";
$command .= ' -i ' . $hc->id;
$command .= ' -n ' . $hc->account_name;
$command .= ' -t ' . $hc->account_type;
$command .= $hc_authentication;
$command .= ' -in ' . $cloud_resource_hostname;
$command .= ' --openqrm-cmd-mode background';
// $event->log("remove_hybrid_cloud_vm_local", $_SERVER['REQUEST_TIME'], 2, "hybrid-cloud-cloud-hook", "Running $command", "", "", 0, 0, 0);
$openqrm->send_command($command, NULL, true);
}
示例4: openqrm_hybrid_cloud_resource_virtual_command
function openqrm_hybrid_cloud_resource_virtual_command($cmd, $resource_fields)
{
global $event;
global $OPENQRM_SERVER_BASE_DIR;
global $OPENQRM_SERVER_IP_ADDRESS;
global $OPENQRM_EXEC_PORT;
$resource_id = $resource_fields["resource_id"];
$resource = new resource();
$resource->get_instance_by_id($resource_id);
$virtualization = new virtualization();
$virtualization->get_instance_by_id($resource->vtype);
switch ($virtualization->type) {
case "hybrid-cloud":
$event->log("openqrm_hybrid_cloud_resource_virtual_command", $_SERVER['REQUEST_TIME'], 5, "openqrm-hybrid-cloud-resource-virtual-command-hook.php", "Handling " . $cmd . " command of resource " . $resource->id, "", "", 0, 0, 0);
// noop
break;
case "hybrid-cloud-vm-local":
$event->log("openqrm_hybrid_cloud_resource_virtual_command", $_SERVER['REQUEST_TIME'], 5, "openqrm-hybrid-cloud-resource-virtual-command-hook.php", "Handling " . $cmd . " command of resource " . $resource->id, "", "", 0, 0, 0);
$openqrm_server = new openqrm_server();
// get hybrid-cloud account
$hybrid_cloud_acl_id = $resource->get_resource_capabilities("HCACL");
if ($hybrid_cloud_acl_id == '') {
$event->log("openqrm_hybrid_cloud_resource_virtual_command", $_SERVER['REQUEST_TIME'], 2, "openqrm-hybrid-cloud-resource-virtual-command-hook.php", "Could not find Hybrid-Cloud Account for resource " . $resource->id, "", "", 0, 0, $appliance_id);
return;
}
$hc = new hybrid_cloud();
$hc->get_instance_by_id($hybrid_cloud_acl_id);
$hc_authentication = '';
if ($hc->account_type == 'aws' || $hc->account_type == 'euca') {
$hc_authentication .= ' -O ' . $hc->access_key;
$hc_authentication .= ' -W ' . $hc->secret_key;
}
if ($hc->account_type == 'lc-openstack') {
$hc_authentication .= ' -u ' . $hc->username;
$hc_authentication .= ' -p ' . $hc->password;
$hc_authentication .= ' -q ' . $hc->host;
$hc_authentication .= ' -x ' . $hc->port;
$hc_authentication .= ' -g ' . $hc->tenant;
$hc_authentication .= ' -e ' . $hc->endpoint;
}
switch ($cmd) {
case "reboot":
$command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/hybrid-cloud/bin/openqrm-hybrid-cloud-vm restart ";
$command .= ' -i ' . $hc->id;
$command .= ' -n ' . $hc->account_name;
$command .= ' -t ' . $hc->account_type;
$command .= ' -in ' . $resource->hostname;
$command .= $hc_authentication;
$command .= ' --openqrm-cmd-mode background';
$openqrm_server->send_command($command, NULL, true);
break;
case "halt":
$command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/hybrid-cloud/bin/openqrm-hybrid-cloud-vm stop ";
$command .= ' -i ' . $hc->id;
$command .= ' -n ' . $hc->account_name;
$command .= ' -t ' . $hc->account_type;
$command .= ' -in ' . $resource->hostname;
$command .= $hc_authentication;
$command .= ' --openqrm-cmd-mode background';
$openqrm_server->send_command($command, NULL, true);
break;
}
break;
}
}
示例5: array
function check_all_states()
{
global $RESOURCE_INFO_TABLE;
global $RESOURCE_TIME_OUT;
global $RootDir;
global $event;
$resource_list = array();
$db = openqrm_get_db_connection();
$rs = $db->Execute("select resource_id, resource_lastgood, resource_state from {$RESOURCE_INFO_TABLE}");
if (!$rs) {
$event->log("check_all_states", $_SERVER['REQUEST_TIME'], 2, "resource.class.php", $db->ErrorMsg(), "", "", 0, 0, 0);
} else {
while (!$rs->EOF) {
$resource_id = $rs->fields['resource_id'];
$resource_lastgood = $rs->fields['resource_lastgood'];
$resource_state = $rs->fields['resource_state'];
$check_time = $_SERVER['REQUEST_TIME'];
// get the HA-timeout per resource from the capabilites
$custom_resource_ha_timeout = "";
$resource_hat = new resource();
$resource_hat->get_instance_by_id($resource_id);
$custom_resource_ha_timeout = $resource_hat->get_resource_capabilities("HAT");
if (strlen($custom_resource_ha_timeout)) {
$RESOURCE_TIME_OUT = $custom_resource_ha_timeout;
}
// resolve errors for all active resources
if ("{$resource_state}" == "active" && $resource_id != 0) {
if ($check_time - $resource_lastgood < $RESOURCE_TIME_OUT) {
// resolve error event
$event->resolve_by_resource("check_all_states", $resource_id);
}
}
// check for statistics (errors) for all resources which are not offline
// exclude manual added resources from the check !
if ("{$resource_state}" != "off" && "{$resource_lastgood}" != "-1") {
if ($check_time - $resource_lastgood > $RESOURCE_TIME_OUT) {
$resource_fields = array();
$resource_fields["resource_state"] = "error";
$resource_error = new resource();
$resource_error->update_info($resource_id, $resource_fields);
// log error event
$event->log("check_all_states", $_SERVER['REQUEST_TIME'], 1, "resource.class.php", "Resource {$resource_id} is in error state", "", "", 0, 0, $resource_id);
// check for plugin which may want to handle the error event
$plugin = new plugin();
$enabled_plugins = $plugin->enabled();
foreach ($enabled_plugins as $index => $plugin_name) {
$plugin_ha_hook = "{$RootDir}/plugins/{$plugin_name}/openqrm-{$plugin_name}-ha-hook.php";
if (file_exists($plugin_ha_hook)) {
$event->log("check_all_states", $_SERVER['REQUEST_TIME'], 1, "resource.class.php", "Found {$plugin_name} handling the resource error.", "", "", 0, 0, $resource_id);
require_once "{$plugin_ha_hook}";
$ha_function = "openqrm_" . "{$plugin_name}" . "_ha_hook";
$ha_function = str_replace("-", "_", $ha_function);
$ha_function($resource_id);
}
}
}
}
$rs->MoveNext();
}
}
}
示例6: virtualization
function find_host_to_start_from_off($virtualization_type_id, $resource_pools_enabled, $cu_id, $timeout)
{
global $OPENQRM_SERVER_BASE_DIR;
global $OPENQRM_SERVER_IP_ADDRESS;
global $OPENQRM_EXEC_PORT;
global $RESOURCE_INFO_TABLE;
global $vmware_mac_address_space;
global $RootDir;
$this->init($timeout);
global $event;
// find out the host virtualization type via the plugin name
$vhost_type = new virtualization();
$vhost_type->get_instance_by_id($virtualization_type_id);
$event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 5, "cloudhoststartfromoff.class.php", "Trying to find a powered-off virtualization host from type {$vhost_type->type} {$vhost_type->name}", "", "", 0, 0, 0);
// for all in appliance list, find virtualization host appliances
$appliance_tmp = new appliance();
$appliance_id_list = $appliance_tmp->get_all_ids();
$in_active_appliance_list = array();
foreach ($appliance_id_list as $id_arr) {
foreach ($id_arr as $id) {
$appliance = new appliance();
$appliance->get_instance_by_id($id);
$sfo_resource = new resource();
$sfo_resource->get_instance_by_id($appliance->resources);
// state off ?
if (!strcmp($appliance->state, "stopped") && !strcmp($sfo_resource->state, "off")) {
if ($appliance->virtualization == $virtualization_type_id) {
// we have found an active appliance from the right virtualization type
//
// here we check if there is still enough space
// to create the new vm -> max_vm setting per resource
$res_hostlimit = new cloudhostlimit();
$res_hostlimit->get_instance_by_resource($appliance->resources);
if (strlen($res_hostlimit->id)) {
if ($res_hostlimit->max_vms >= 0) {
$new_current_vms = $res_hostlimit->current_vms + 1;
if ($new_current_vms >= $res_hostlimit->max_vms) {
$event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 2, "cloudhoststartfromoff.class.php", "Hostlimit max_vm is reached for resource {$appliance->resources}", "", "", 0, 0, $appliance->resources);
continue;
}
}
}
// resource pooling enabled ?
if (strcmp($resource_pools_enabled, "true")) {
// disabled, add any appliance from the right virtualization type
// $event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 5, "cloudhoststartfromoff.class.php", "resource pooling is disabled", "", "", 0, 0, 0);
// check if the resource can start-from-off
$can_start_from_off = $sfo_resource->get_resource_capabilities('SFO');
if ($can_start_from_off == 1) {
$in_active_appliance_list[] .= $id;
$event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 5, "cloudhoststartfromoff.class.php", "Resource pooling is disabled, adding appliance {$id}", "", "", 0, 0, 0);
} else {
$event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 2, "cloudhoststartfromoff.class.php", "Resource pooling is disabled, resource of appliance {$id} cannot start-from-off", "", "", 0, 0, 0);
}
} else {
// $event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 2, "cloudhoststartfromoff.class.php", "resource pooling is enabled $appliance->resources", "", "", 0, 0, 0);
// resource pooling enabled, check to which user group the resource belongs to
$private_resource = new cloudrespool();
$private_resource->get_instance_by_resource($appliance->resources);
// is this resource configured in the resource pools ?
// $event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 2, "cloudhoststartfromoff.class.php", "resource pool id $private_resource->id ", "", "", 0, 0, 0);
if (strlen($private_resource->id)) {
// $event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 2, "cloudhoststartfromoff.class.php", "resource $appliance->resources is in a resource pool", "", "", 0, 0, 0);
// is it hidden ?
if ($private_resource->cg_id >= 0) {
// $event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 2, "cloudhoststartfromoff.class.php", "resource $appliance->resources is also configured in resource pool (not hidden)", "", "", 0, 0, 0);
$cloud_user = new clouduser();
$cloud_user->get_instance_by_id($cu_id);
$cloud_user_group = new cloudusergroup();
$cloud_user_group->get_instance_by_id($cloud_user->cg_id);
// $event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 2, "cloudhoststartfromoff.class.php", "we have found the users group $cloud_user_group->id", "", "", 0, 0, 0);
// does it really belongs to the users group ?
if ($private_resource->cg_id == $cloud_user_group->id) {
// resource belongs to the users group, add appliance to list
// check if the resource can start-from-off
$sfo_resource = new resource();
$sfo_resource->get_instance_by_id($appliance->resources);
$can_start_from_off = $sfo_resource->get_resource_capabilities('SFO');
if ($can_start_from_off == 1) {
$in_active_appliance_list[] .= $id;
$event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 5, "cloudhoststartfromoff.class.php", "Adding appliance {$id}", "", "", 0, 0, 0);
} else {
$event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 2, "cloudhoststartfromoff.class.php", "Resource of appliance {$id} cannot start-from-off", "", "", 0, 0, 0);
}
} else {
$event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 2, "cloudhoststartfromoff.class.php", "Appliance {$id} (resource {$appliance->resources}) is NOT in dedicated for the users group", "", "", 0, 0, 0);
}
} else {
$event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 2, "cloudhoststartfromoff.class.php", "Appliance {$id} (resource {$appliance->resources}) is marked as hidden", "", "", 0, 0, 0);
}
} else {
$event->log("find_host_to_start_from_off", $_SERVER['REQUEST_TIME'], 2, "cloudhoststartfromoff.class.php", "Appliance {$id} (resource {$appliance->resources}) is NOT member of any resource pools", "", "", 0, 0, 0);
}
}
}
}
}
}
// did we found any active host ?
if (count($in_active_appliance_list) < 1) {
//.........这里部分代码省略.........
示例7: openqrm_hybrid_cloud_appliance
function openqrm_hybrid_cloud_appliance($cmd, $appliance_fields)
{
global $event;
global $OPENQRM_SERVER_BASE_DIR;
global $OPENQRM_SERVER_IP_ADDRESS;
global $OPENQRM_EXEC_PORT;
global $IMAGE_AUTHENTICATION_TABLE;
global $RootDir;
$openqrm_server = new openqrm_server();
$appliance_id = $appliance_fields["appliance_id"];
$appliance_name = $appliance_fields["appliance_name"];
$resource = new resource();
$resource->get_instance_by_id($appliance_fields["appliance_resources"]);
$appliance_ip = $resource->ip;
$appliance = new appliance();
$appliance->get_instance_by_id($appliance_id);
// check appliance values, maybe we are in update and they are incomplete
if ($appliance->imageid == 1) {
return;
}
if ($resource->id == "-1" || $resource->id == "" || !isset($resource->vtype)) {
return;
}
$event->log("openqrm_hybrid_cloud_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-hybrid-cloud-appliance-hook.php", "Handling " . $cmd . " event " . $appliance_id . "/" . $appliance_name . "/" . $appliance_ip, "", "", 0, 0, $appliance_id);
// check resource type -> hybrid-cloud-strorage-vm
$virtualization = new virtualization();
$virtualization->get_instance_by_id($resource->vtype);
switch ($virtualization->type) {
case "hybrid-cloud-vm-local":
$image = new image();
$image->get_instance_by_id($appliance->imageid);
// get hybrid-cloud account
$hybrid_cloud_acl_id = $resource->get_resource_capabilities("HCACL");
if ($hybrid_cloud_acl_id == '') {
$event->log("openqrm_hybrid_cloud_appliance", $_SERVER['REQUEST_TIME'], 2, "openqrm-hybrid-cloud-appliance-hook.php", "Could not find Hybrid-Cloud Account for resource " . $resource->id, "", "", 0, 0, $appliance_id);
return;
}
$hc = new hybrid_cloud();
$hc->get_instance_by_id($hybrid_cloud_acl_id);
$hc_authentication = '';
if ($hc->account_type == 'aws' || $hc->account_type == 'euca') {
$hc_authentication .= ' -O ' . $hc->access_key;
$hc_authentication .= ' -W ' . $hc->secret_key;
}
if ($hc->account_type == 'lc-openstack') {
$hc_authentication .= ' -u ' . $hc->username;
$hc_authentication .= ' -p ' . $hc->password;
$hc_authentication .= ' -q ' . $hc->host;
$hc_authentication .= ' -x ' . $hc->port;
$hc_authentication .= ' -g ' . $hc->tenant;
$hc_authentication .= ' -e ' . $hc->endpoint;
}
$statfile = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/hybrid-cloud/web/hybrid-cloud-stat/" . $hybrid_cloud_acl_id . ".run_instances.hostname";
switch ($cmd) {
case "start":
// send command to assign image and start instance
$command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/hybrid-cloud/bin/openqrm-hybrid-cloud-vm run ";
$command .= ' -i ' . $hc->id;
$command .= ' -n ' . $hc->account_name;
$command .= ' -t ' . $hc->account_type;
$command .= $hc_authentication;
$command .= ' -in ' . $resource->hostname;
$command .= ' -a ' . $image->rootdevice;
$command .= ' -ii ' . $image->id;
$command .= ' -ia ' . $appliance->name;
$command .= ' --openqrm-cmd-mode background';
// wait for hostname statfile
if (file_exists($statfile)) {
unlink($statfile);
}
$openqrm_server->send_command($command, NULL, true);
while (!file_exists($statfile)) {
usleep(10000);
clearstatcache();
}
// special hostname handling for aws + euca
if ($hc->account_type == 'aws' || $hc->account_type == 'euca') {
$resource_new_hostname = file_get_contents($statfile);
$resource_new_hostname = trim($resource_new_hostname);
unlink($statfile);
// update hostname in resource
$resource_fields["resource_hostname"] = $resource_new_hostname;
$resource->update_info($resource->id, $resource_fields);
}
// reset image_isactive -> AMI are cloned anyway
$image->set_active(1);
break;
case "stop":
// send command to stop the vm and deassign image
$command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/hybrid-cloud/bin/openqrm-hybrid-cloud-vm terminate ";
$command .= ' -i ' . $hc->id;
$command .= ' -n ' . $hc->account_name;
$command .= ' -t ' . $hc->account_type;
$command .= $hc_authentication;
$command .= ' -in ' . $resource->hostname;
$command .= ' --openqrm-cmd-mode background';
$openqrm_server->send_command($command, NULL, true);
// special hostname handling for aws + euca
if ($hc->account_type == 'aws' || $hc->account_type == 'euca') {
$resource_new_hostname = $hc->account_type . $resource->id;
//.........这里部分代码省略.........