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


PHP resource::update_info方法代码示例

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


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

示例1: openqrm_hybrid_cloud_monitor


//.........这里部分代码省略.........
                            $type = $tmp[9];
                            $date = $tmp[10];
                            $region = $tmp[11];
                            $unknown4 = $tmp[12];
                            $unknown5 = $tmp[13];
                            $unknown6 = $tmp[14];
                            $monitoring = $tmp[15];
                            $public_ip = $hc->format_ip_address($tmp[16]);
                            $private_ip = $hc->format_ip_address($tmp[17]);
                            $unknown7 = $tmp[18];
                            $unknown8 = $tmp[19];
                            $store = $tmp[20];
                            $unknown9 = $tmp[21];
                            $unknown10 = $tmp[22];
                            $unknown11 = $tmp[23];
                            $unknown12 = $tmp[24];
                            $hvm = $tmp[25];
                            $virt_type = $tmp[26];
                            $mac = '';
                            // check for idle instances
                            $resource = new resource();
                            if ($state == 'idle') {
                                $mac = $tmp[30];
                                $resource->get_instance_by_mac($mac);
                                $resource_fields["resource_state"] = 'active';
                                $resource_fields["resource_lastgood"] = $now;
                                $resource_fields["resource_cpunumber"] = $hc->translate_resource_components('cpu', $type);
                                $resource_fields["resource_nics"] = $hc->translate_resource_components('net', $type);
                                $resource_fields["resource_memtotal"] = $hc->translate_resource_components('mem', $type);
                                $resource_fields["resource_memused"] = "0";
                                $resource_fields["resource_load"] = "0";
                                // restore mgmt ip
                                $resource_fields["resource_ip"] = $resource->network;
                                $resource->update_info($resource->id, $resource_fields);
                            } else {
                                if ($state == 'running') {
                                    // check if existing, if not auto-create resource, image and appliance
                                    if ($resource->exists_by_name($name)) {
                                        // update stats
                                        $resource->get_instance_id_by_hostname($name);
                                        $resource->get_instance_by_id($resource->id);
                                        $resource_fields["resource_state"] = 'active';
                                        $resource_fields["resource_lastgood"] = $now;
                                        $resource_fields["resource_cpunumber"] = $hc->translate_resource_components('cpu', $type);
                                        $resource_fields["resource_nics"] = $hc->translate_resource_components('net', $type);
                                        $resource_fields["resource_memtotal"] = $hc->translate_resource_components('mem', $type);
                                        $resource_fields["resource_memused"] = $resource_fields["resource_memtotal"];
                                        $resource_fields["resource_load"] = "1";
                                        if (strlen($public_ip) && $resource->ip != $public_ip) {
                                            // set public ip, update early and run nagios hook
                                            $resource_fields["resource_ip"] = $public_ip;
                                            $resource->update_info($resource->id, $resource_fields);
                                            // nagios enabled and started ?
                                            if (file_exists($RootDir . "/plugins/nagios3/.running")) {
                                                $virtualization = new virtualization();
                                                $virtualization->get_instance_by_type("hybrid-cloud-vm-local");
                                                $hc_appliance = new appliance();
                                                $hc_appliance->get_instance_by_virtualization_and_resource($virtualization->id, $resource->id);
                                                if (strlen($hc_appliance->name)) {
                                                    // special nagios classes
                                                    require_once $RootDir . "/plugins/nagios3/class/nagios3_service.class.php";
                                                    require_once $RootDir . "/plugins/nagios3/class/nagios3_host.class.php";
                                                    // get the nagios service checks
                                                    $nagios_host = new nagios3_host();
                                                    $nagios_host->get_instance_by_appliance_id($hc_appliance->id);
                                                    $active_nagios_services = explode(',', $nagios_host->appliance_services);
开发者ID:kelubo,项目名称:OpenQRM,代码行数:67,代码来源:openqrm-hybrid-cloud-monitor-hook.php

示例2: openqrm_cloud_monitor


//.........这里部分代码省略.........
                $ca_resource_stop = new resource();
                $ca_resource_stop->get_instance_by_id($ca_appliance->resources);
                $resource_external_ip = $ca_resource_stop->ip;
                $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "cloud-monitor", "Pausing Appliance {$ca_appliance->name}", "", "", 0, 0, 0);
                $openqrm_server->send_command("openqrm_assign_kernel {$ca_resource_stop->id} {$ca_resource_stop->mac} default");
                // now stop
                $ca_appliance->stop();
                // remove resource
                $ar_update = array('appliance_resources' => "-1");
                // update appliance
                $ca_appliance->update($ca_appliance_id, $ar_update);
                // reset the cmd field
                $ca->set_cmd($ca_id, "noop");
                // set state to paused
                $ca->set_state($ca_id, "paused");
                $phase_five_actions = 1;
                break;
            case 3:
                // restart
                $ca_appliance = new appliance();
                $ca_appliance->get_instance_by_id($ca_appliance_id);
                $ca_resource_id = $ca_appliance->resources;
                $ca_resource_restart = new resource();
                $ca_resource_restart->get_instance_by_id($ca_resource_id);
                $ca_resource_ip = $ca_resource_restart->ip;
                $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "cloud-monitor", "Restarting Appliance {$ca_appliance->name}", "", "", 0, 0, 0);
                $ca_resource_restart->send_command("{$ca_resource_ip}", "reboot");
                // reset the cmd field
                $ca->set_cmd($ca_id, "noop");
                sleep(2);
                // set state to transition
                $resource_fields = array();
                $resource_fields["resource_state"] = "transition";
                $ca_resource_restart->update_info($ca_resource_id, $resource_fields);
                $phase_five_actions = 1;
                break;
        }
        // check if we continue or go on
        if ($phase_five_actions == 1) {
            $parallel_phase_five_actions++;
            if ($max_parallel_phase_five_actions > 0 && $parallel_phase_five_actions >= $max_parallel_phase_five_actions) {
                break;
            }
        }
    }
    // ###################### end cloudappliance commands ######################
    // ##################### start cloudimage-resize-life-cycle ################
    // $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "monitor-hook", "Cloud Phase VI - Cloud Image resize live-cycle", "", "", 0, 0, 0);
    $cirlc = new cloudirlc();
    $cirlc_list = $cirlc->get_all_ids();
    foreach ($cirlc_list as $cdlist) {
        $cd_id = $cdlist['cd_id'];
        $cd = new cloudirlc();
        $cd->get_instance_by_id($cd_id);
        $cd_appliance_id = $cd->appliance_id;
        $cd_state = $cd->state;
        switch ($cd_state) {
            case 0:
                // remove
                $cd->remove($cd_id);
                // $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "cloudirlc", "(REMOVE) Resize life-cycle of Appliance $cd_appliance_id", "", "", 0, 0, 0);
                break;
            case 1:
                // pause
                // $event->log("cloud", $_SERVER['REQUEST_TIME'], 5, "cloudirlc", "(PAUSE) Resize life-cycle of Appliance $cd_appliance_id", "", "", 0, 0, 0);
                $cloud_app_resize = new cloudappliance();
开发者ID:kelubo,项目名称:OpenQRM,代码行数:67,代码来源:openqrm-cloud-monitor-hook.php

示例3: resource

 $appliance->update($next_appliance_id, $appliance_fields);
 // set resource to localboot
 $resource = new resource();
 $resource->get_instance_by_id($local_server_id);
 $openqrm_server->send_command("openqrm_server_set_boot local {$local_server_id} {$resource->mac} 0.0.0.0");
 $resource->set_localboot($local_server_id, 1);
 // update resource fields with kernel + image
 $kernel->get_instance_by_id($kernel_fields["kernel_id"]);
 $resource_fields["resource_kernel"] = $kernel->name;
 $resource_fields["resource_kernelid"] = $kernel_fields["kernel_id"];
 $image->get_instance_by_id($image_fields["image_id"]);
 $resource_fields["resource_image"] = $image->name;
 $resource_fields["resource_imageid"] = $image_fields["image_id"];
 // set capabilites
 $resource_fields["resource_capabilities"] = 'TYPE=local-server';
 $resource->update_info($local_server_id, $resource_fields);
 // add + start hook
 $appliance->get_instance_by_id($next_appliance_id);
 $now = $_SERVER['REQUEST_TIME'];
 $appliance_fields = array();
 $appliance_fields['appliance_stoptime'] = $now;
 $appliance_fields['appliance_state'] = 'stopped';
 // fill in the rest of the appliance info in the array for the plugin hook
 $appliance_fields["appliance_id"] = $next_appliance_id;
 $appliance_fields["appliance_name"] = $appliance->name;
 $appliance_fields["appliance_kernelid"] = $appliance->kernelid;
 $appliance_fields["appliance_imageid"] = $appliance->imageid;
 $appliance_fields["appliance_cpunumber"] = $appliance->cpunumber;
 $appliance_fields["appliance_cpuspeed"] = $appliance->cpuspeed;
 $appliance_fields["appliance_cpumodel"] = $appliance->cpumodel;
 $appliance_fields["appliance_memtotal"] = $appliance->memtotal;
开发者ID:kelubo,项目名称:OpenQRM,代码行数:31,代码来源:local-server-action.php

示例4: resource

     // array of resource_fields
 // update_info requires :
 // resource_id
 // array of resource_fields
 case 'update_info':
     $resource = new resource();
     if (strlen($resource_id)) {
         $resource->get_instance_by_id($resource_id);
         if (!strcmp($resource->event, "reboot")) {
             // we do not accept this stats since the resource will be rebooted
             // reset the events field
             $resource_reboot_fields = array();
             $resource_reboot_fields["resource_state"] = "transition";
             $resource_reboot_fields["resource_event"] = "reboot1";
             $event->log("update_info", $_SERVER['REQUEST_TIME'], 5, "resource-monitor", "Rejecting statistics from rebooting resource {$resource_id} (1)", "", "", 0, 0, $resource_id);
             $resource->update_info($resource_id, $resource_reboot_fields);
         } else {
             if (!strcmp($resource->event, "reboot1")) {
                 $resource_reboot_fields = array();
                 $resource_reboot_fields["resource_state"] = "transition";
                 $resource_reboot_fields["resource_event"] = "reboot2";
                 $event->log("update_info", $_SERVER['REQUEST_TIME'], 5, "resource-monitor", "Rejecting statistics from rebooting resource {$resource_id} (2)", "", "", 0, 0, $resource_id);
                 $resource->update_info($resource_id, $resource_reboot_fields);
             } else {
                 if (!strcmp($resource->event, "reboot2")) {
                     $resource_reboot_fields = array();
                     $resource_reboot_fields["resource_state"] = "transition";
                     $resource_reboot_fields["resource_event"] = "reboot3";
                     $event->log("update_info", $_SERVER['REQUEST_TIME'], 5, "resource-monitor", "Rejecting statistics from rebooting resource {$resource_id} (3)", "", "", 0, 0, $resource_id);
                     $resource->update_info($resource_id, $resource_reboot_fields);
                 } else {
开发者ID:kelubo,项目名称:OpenQRM,代码行数:31,代码来源:resource-monitor.php

示例5: 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;
}
开发者ID:kelubo,项目名称:OpenQRM,代码行数:42,代码来源:openqrm-hybrid-cloud-ha-cmd-hook.php

示例6: create_hybrid_cloud_vm_local

function create_hybrid_cloud_vm_local($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str)
{
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    global $RESOURCE_INFO_TABLE;
    global $event;
    $max_loop = 30;
    $ip_wait_loop = 0;
    $event->log("create_hybrid_cloud_vm_local", $_SERVER['REQUEST_TIME'], 5, "hybrid-cloud-cloud-hook", "Creating Cloud VM {$name} on Host resource {$host_resource_id}", "", "", 0, 0, 0);
    $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'];
    $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;
        $hc_authentication .= ' -iz ' . $ini['OPENQRM_PLUGIN_HYBRID_CLOUD_DEFAULT_AVAILABILITY_ZONE'];
        $hc_authentication .= ' -ir ' . $ini['OPENQRM_PLUGIN_HYBRID_CLOUD_DEFAULT_REGION'];
        $hc_authentication .= ' -it ' . $hc->translate_resource_components_to_instance_type($cpu, $memory);
    }
    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;
        $hc_authentication .= ' -it ' . $hc->translate_resource_components_to_instance_type($cpu, $memory);
    }
    // set hybrid-cloud account in new resource
    $cloud_resource = new resource();
    $cloud_resource->get_instance_by_mac($mac);
    $cloud_resource->set_resource_capabilities("HCACL", $hc_default_account_id);
    // $event->log("create_hybrid_cloud_vm_local", $_SERVER['REQUEST_TIME'], 2, "hybrid-cloud-cloud-hook", "!!! Found new resource ".$cloud_resource->id." and set HC account id", "", "", 0, 0, 0);
    // set resource hostname + ip config
    // check to have a ip from the dhcpd-resource hook
    while ($cloud_resource->ip == "0.0.0.0") {
        sleep(1);
        clearstatcache();
        $cloud_resource->get_instance_by_mac($cloud_resource->mac);
        $ip_wait_loop++;
        if ($ip_wait_loop > $max_loop) {
            break;
        }
        // $event->log("create_hybrid_cloud_vm_local", $_SERVER['REQUEST_TIME'], 2, "hybrid-cloud-cloud-hook", "!!! Waiting for ip address ".$ip_wait_loop."!", "", "", 0, 0, 0);
    }
    // save the mgmt ip in the resource network field
    $rufields["resource_network"] = $cloud_resource->ip;
    $rufields["resource_hostname"] = $hc->account_type . $cloud_resource->id;
    $cloud_resource->update_info($cloud_resource->id, $rufields);
    // $event->log("create_hybrid_cloud_vm_local", $_SERVER['REQUEST_TIME'], 2, "hybrid-cloud-cloud-hook", "!!! Updated resource with hostname + ip", "", "", 0, 0, 0);
    // we need to find the ami name from the appliance->image->root-device
    $appliance = new appliance();
    $appliance->get_instance_by_name($name);
    $image = new image();
    $image->get_instance_by_id($appliance->imageid);
    // $event->log("create_hybrid_cloud_vm_local", $_SERVER['REQUEST_TIME'], 2, "hybrid-cloud-cloud-hook", "!!! Found AMI ".$image->name." root-dev: ".$image->rootdevice, "", "", 0, 0, 0);
    $openqrm = new openqrm_server();
    $command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/hybrid-cloud/bin/openqrm-hybrid-cloud-vm create ";
    $command .= ' -i ' . $hc->id;
    $command .= ' -n ' . $hc->account_name;
    $command .= ' -t ' . $hc->account_type;
    $command .= $hc_authentication;
    $command .= ' -in ' . $hc->account_type . $cloud_resource->id;
    $command .= ' -im ' . $mac;
    $command .= ' -a ' . $image->rootdevice;
    $command .= ' -ig ' . $ini['OPENQRM_PLUGIN_HYBRID_CLOUD_DEFAULT_SECURITY_GROUP'];
    $command .= ' -ik ' . $ini['OPENQRM_PLUGIN_HYBRID_CLOUD_DEFAULT_KEYPAIR'];
    $command .= ' --openqrm-cmd-mode background';
    // $event->log("create_hybrid_cloud_vm_local", $_SERVER['REQUEST_TIME'], 2, "hybrid-cloud-cloud-hook", "Running $command", "", "", 0, 0, 0);
    $openqrm->send_command($command, NULL, true);
}
开发者ID:kelubo,项目名称:OpenQRM,代码行数:75,代码来源:openqrm-hybrid-cloud-cloud-hook.php

示例7: openqrm_kvm_resource_virtual_command

function openqrm_kvm_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);
    $host_resource = new resource();
    $host_resource->get_instance_by_id($resource->vhostid);
    $virtualization = new virtualization();
    $virtualization->get_instance_by_id($resource->vtype);
    $openqrm_admin_user = new user("openqrm");
    $openqrm_admin_user->set_user();
    switch ($cmd) {
        case "reboot":
            $event->log("openqrm_kvm_resource_virtual_command", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-resource-virtual-command-hook.php", "Handling {$cmd} command", "", "", 0, 0, 0);
            if ($virtualization->type == "kvm-vm-local") {
                $virtual_command = "{$OPENQRM_SERVER_BASE_DIR}/openqrm/plugins/kvm/bin/openqrm-kvm-vm restart_by_mac -m " . $resource->mac . " -u " . $openqrm_admin_user->name . " -p " . $openqrm_admin_user->password . " -d noop --openqrm-cmd-mode background";
                $host_resource->send_command($host_resource->ip, $virtual_command);
            }
            if ($virtualization->type == "kvm-vm-net") {
                // simply add to cmd queue. do not use resource->send_command(ip, reboot) since this will re-trigger this hook
                $cmd_token = md5(uniqid(rand(), true));
                $resource_command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/sbin/openqrm-exec -i " . $resource->ip . " -t " . $cmd_token . " -c reboot";
                shell_exec($resource_command);
            }
            if ($virtualization->type == "kvm") {
                $cmd_token = md5(uniqid(rand(), true));
                $resource_command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/sbin/openqrm-exec -i " . $resource->ip . " -t " . $cmd_token . " -c reboot";
                shell_exec($resource_command);
            }
            $resource_reboot_fields = array();
            $resource_reboot_fields["resource_state"] = "transition";
            $resource_reboot_fields["resource_event"] = "reboot";
            $resource->update_info($resource->id, $resource_reboot_fields);
            break;
        case "halt":
            $event->log("openqrm_kvm_resource_virtual_command", $_SERVER['REQUEST_TIME'], 5, "openqrm-kvm-resource-virtual-command-hook.php", "Handling {$cmd} command", "", "", 0, 0, 0);
            if ($virtualization->type == "kvm-vm-local") {
                $virtual_command = "{$OPENQRM_SERVER_BASE_DIR}/openqrm/plugins/kvm/bin/openqrm-kvm-vm stop_by_mac -m " . $resource->mac . " -u " . $openqrm_admin_user->name . " -p " . $openqrm_admin_user->password . " --openqrm-cmd-mode background";
                $host_resource->send_command($host_resource->ip, $virtual_command);
            }
            if ($virtualization->type == "kvm-vm-net") {
                // simply add to cmd queue. do not use resource->send_command(ip, reboot) since this will re-trigger this hook
                $cmd_token = md5(uniqid(rand(), true));
                $resource_command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/sbin/openqrm-exec -i " . $resource->ip . " -t " . $cmd_token . " -c halt";
                shell_exec($resource_command);
            }
            if ($virtualization->type == "kvm") {
                // simply add to cmd queue. do not use resource->send_command(ip, reboot) since this will re-trigger this hook
                $cmd_token = md5(uniqid(rand(), true));
                $resource_command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/sbin/openqrm-exec -i " . $resource->ip . " -t " . $cmd_token . " -c halt";
                shell_exec($resource_command);
            }
            $resource_reboot_fields = array();
            $resource_reboot_fields["resource_state"] = "off";
            $resource_reboot_fields["resource_event"] = "reboot";
            $resource->update_info($resource->id, $resource_reboot_fields);
            break;
    }
}
开发者ID:kelubo,项目名称:OpenQRM,代码行数:63,代码来源:openqrm-kvm-resource-virtual-command-hook.php

示例8: migrate

 function migrate()
 {
     $response = $this->get_response();
     if (isset($response->msg)) {
         return $response;
     }
     $form = $response->form;
     if (!$form->get_errors() && $this->response->submit()) {
         $target = $form->get_request('target');
         $vm_resource = new resource();
         $vm_resource->get_instance_by_mac($this->mac);
         $dest_host_resource = new resource();
         $dest_host_resource->get_instance_by_id($target);
         $source_host_resource = new resource();
         $source_host_resource->get_instance_by_id($vm_resource->vhostid);
         // first transfer the VM config from source to destination
         $tstatfile = $this->openqrm->get('basedir') . '/plugins/kvm/web/kvm-stat/' . $this->vm . '.transfer_status';
         if ($this->file->exists($tstatfile)) {
             $this->file->remove($tstatfile);
         }
         $t_command = $this->openqrm->get('basedir') . '/plugins/kvm/bin/openqrm-kvm-vm transfer_vm_config';
         $t_command .= ' -n ' . $this->vm;
         $t_command .= ' -k ' . $dest_host_resource->ip;
         $t_command .= ' -k1 ' . $source_host_resource->ip;
         $t_command .= ' -u ' . $this->openqrm->admin()->name . ' -p ' . $this->openqrm->admin()->password;
         $t_command .= ' --openqrm-ui-user ' . $this->user->name;
         $t_command .= ' --openqrm-cmd-mode background';
         $openqrm = new openqrm_server();
         $openqrm->send_command($t_command, NULL, true);
         while (!$this->file->exists($tstatfile)) {
             usleep(10000);
             // sleep 10ms to unload the CPU
             clearstatcache();
         }
         $msg = trim($this->file->get_contents($tstatfile));
         if ($msg !== "ok") {
             $response->error = $msg;
             return $response;
         }
         // calcuate the migration port
         list($o1, $o2, $o3, $o4) = explode(".", $vm_resource->ip, 4);
         $kvm_vm_migration_port = $o4 + 6000;
         // start as incoming on destination
         $s_command = $this->openqrm->get('basedir') . '/plugins/kvm/bin/openqrm-kvm-vm start_as_incoming';
         $s_command .= ' -n ' . $this->vm;
         $s_command .= ' -j ' . $kvm_vm_migration_port;
         $s_command .= ' -u ' . $this->openqrm->admin()->name . ' -p ' . $this->openqrm->admin()->password;
         $s_command .= ' --openqrm-ui-user ' . $this->user->name;
         $s_command .= ' --openqrm-cmd-mode background';
         $statfile = $this->openqrm->get('basedir') . '/plugins/kvm/web/kvm-stat/' . $this->vm . '.vm_migrated_successfully';
         if ($this->file->exists($statfile)) {
             $this->file->remove($statfile);
         }
         $dest_host_resource->send_command($dest_host_resource->ip, $s_command);
         sleep(5);
         $m_command = $this->openqrm->get('basedir') . '/plugins/kvm/bin/openqrm-kvm-vm migrate';
         $m_command .= ' -n ' . $this->vm;
         $m_command .= ' -k ' . $dest_host_resource->ip;
         $m_command .= ' -j ' . $kvm_vm_migration_port;
         $m_command .= ' -u ' . $this->openqrm->admin()->name . ' -p ' . $this->openqrm->admin()->password;
         $m_command .= ' --openqrm-ui-user ' . $this->user->name;
         $m_command .= ' --openqrm-cmd-mode background';
         $this->resource->send_command($this->resource->ip, $m_command);
         $fields = array();
         $fields["resource_vhostid"] = $dest_host_resource->id;
         $vm_resource->update_info($vm_resource->id, $fields);
         $response->msg = sprintf($this->lang['msg_migrated'], $this->vm, $dest_host_resource->id . ' / ' . $dest_host_resource->ip);
     }
     return $response;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:70,代码来源:kvm-vm.migrate.class.php

示例9: resource

     $resource->get_instance_by_ip($resource_ip);
     $resource->update_info($resource->id, $resource_fields);
     break;
     // halt requires :
     // resource_ip
 // halt requires :
 // resource_ip
 case 'halt':
     $resource = new resource();
     $resource->send_command("{$resource_ip}", "halt");
     // set state to off
     $resource_fields = array();
     $resource_fields["resource_state"] = "off";
     $resource = new resource();
     $resource->get_instance_by_ip($resource_ip);
     $resource->update_info($resource->id, $resource_fields);
     break;
     // list requires :
     // nothing
 // list requires :
 // nothing
 case 'list':
     $resource = new resource();
     $resource_list = $resource->get_resource_list();
     foreach ($resource_list as $resource_l) {
         foreach ($resource_l as $key => $val) {
             print "{$key}={$val} ";
         }
         print "\n";
     }
     exit(0);
开发者ID:kelubo,项目名称:OpenQRM,代码行数:31,代码来源:resource-action.php

示例10: import

 function import()
 {
     $response = '';
     $errors = array();
     $message = array();
     $event = new event();
     $instance_command = $this->response->html->request()->get('instance_command');
     if ($instance_command !== '') {
         switch ($instance_command) {
             case 'add':
                 // instance_command=add
                 // &instance_name='.$name.'
                 // &instance_mac='.$mac.'
                 // &instance_public_ip='.$public_ip.'
                 // &instance_type='.$type.'
                 // &instance_keypair='.$keypair.'
                 // &instance_region='.$region.'
                 // &instance_ami='.$ami;
                 $now = $_SERVER['REQUEST_TIME'];
                 $openqrm = new openqrm_server();
                 $instance_name = $this->response->html->request()->get('instance_name');
                 $instance_mac = $this->response->html->request()->get('instance_mac');
                 $instance_public_ip = $this->response->html->request()->get('instance_public_ip');
                 $instance_type = $this->response->html->request()->get('instance_type');
                 $instance_keypair = $this->response->html->request()->get('instance_keypair');
                 $instance_region = $this->response->html->request()->get('instance_region');
                 $instance_ami = $this->response->html->request()->get('instance_ami');
                 // create resource, image and appliance
                 $event->log("import", $_SERVER['REQUEST_TIME'], 5, "hybrid-cloud-vm-import", "Importing " . $instance_name . " - " . $instance_mac . " - " . $instance_public_ip . " - " . $instance_type . " - " . $instance_keypair . " - " . $instance_region . " - " . $instance_ami . ".", "", "", 0, 0, 0);
                 $import_resource = new resource();
                 $deployment = new deployment();
                 $deployment->get_instance_by_name('ami-deployment');
                 $virtualization = new virtualization();
                 $virtualization->get_instance_by_type("hybrid-cloud-vm-local");
                 // create resource
                 $resid = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
                 // send command to the openQRM-server
                 $openqrm->send_command('openqrm_server_add_resource ' . $resid . ' ' . $instance_mac . ' ' . $instance_public_ip);
                 // add to openQRM database
                 $resource_fields["resource_id"] = $resid;
                 $resource_fields["resource_ip"] = $instance_public_ip;
                 $resource_fields["resource_mac"] = $instance_mac;
                 $resource_fields["resource_kernel"] = 'local';
                 $resource_fields["resource_kernelid"] = 0;
                 $resource_fields["resource_localboot"] = 0;
                 $resource_fields["resource_hostname"] = $this->hc->account_type . $resid;
                 $resource_fields["resource_vtype"] = $virtualization->id;
                 $resource_fields["resource_vhostid"] = 0;
                 $import_resource->add($resource_fields);
                 $import_resource->get_instance_by_mac($instance_mac);
                 // update stats
                 #if ($state == 'running') {
                 $rfields["resource_state"] = 'idle';
                 #$rfields["resource_lastgood"]=$now;
                 #} else {
                 #	$rfields["resource_state"]='off';
                 #}
                 #$import_resource->update_info($import_resource->id, $rfields);
                 // set account id in resource capabilities
                 $import_resource->set_resource_capabilities("HCACL", $this->id);
                 // auto create image object
                 $storage = new storage();
                 $storage->get_instance_by_name('ami-image-storage');
                 $image = new image();
                 $image->get_instance_by_name($instance_ami);
                 if (isset($image->id) && $image->id > 0) {
                     $image_exists = true;
                 } else {
                     $image_fields = array();
                     $vm_image_id = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
                     $image_fields["image_id"] = $vm_image_id;
                     $image_fields['image_name'] = $instance_ami;
                     $image_fields['image_type'] = 'ami-deployment';
                     $image_fields['image_rootfstype'] = 'local';
                     $image_fields['image_isactive'] = 0;
                     $image_fields['image_storageid'] = $storage->id;
                     $image_fields['image_comment'] = "Image Object for AMI {$instance_ami}";
                     $image_fields['image_rootdevice'] = $instance_ami;
                     $image->add($image_fields);
                     # update image object
                     $image->get_instance_by_id($vm_image_id);
                     // update resource with image infos
                     $rfields["resource_id"] = $resid;
                     $rfields["resource_image"] = $image->name;
                     $rfields["resource_imageid"] = $image->id;
                     $import_resource->update_info($import_resource->id, $rfields);
                     $import_resource->get_instance_by_mac($instance_mac);
                 }
                 // create the appliance
                 $appliance = new appliance();
                 $appliance->get_instance_by_name($instance_name);
                 if (isset($appliance->id) && $appliance->id > 0) {
                     $appliance_exists = true;
                 } else {
                     $new_appliance_id = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
                     $afields['appliance_id'] = $new_appliance_id;
                     $afields['appliance_name'] = $this->hc->account_type . $resid;
                     $afields['appliance_resources'] = $resid;
                     $afields['appliance_kernelid'] = '1';
                     $afields['appliance_imageid'] = $image->id;
//.........这里部分代码省略.........
开发者ID:kelubo,项目名称:OpenQRM,代码行数:101,代码来源:hybrid-cloud-vm.import.class.php

示例11: add

 function add()
 {
     $response = $this->get_response();
     $form = $response->form;
     $errors = array();
     if (!$form->get_errors() && $this->response->submit()) {
         $image_id = $form->get_request('ami_image_id');
         $image = new image();
         if (isset($image_id) && $image_id !== '') {
             $image->get_instance_by_id($image_id);
         } else {
             $errors[] = $this->lang['error_boot'];
         }
         if (count($errors) > 0 || $form->get_errors()) {
             $response->error = join('<br>', $errors);
         } else {
             $tables = $this->openqrm->get('table');
             $custom_script_parameter = '';
             $custom_script = $form->get_request('custom_script');
             if (strlen($custom_script)) {
                 $custom_script_parameter = ' -ic ' . $custom_script;
             }
             $custom_name = $form->get_request('name');
             $resource = new resource();
             $id = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
             if (strlen($custom_name)) {
                 $name = $custom_name;
             } else {
                 $name = $this->hc->account_type . $id;
             }
             $ip = "0.0.0.0";
             $resource->generate_mac();
             $mac = $resource->mac;
             // send command to the openQRM-server
             $openqrm = new openqrm_server();
             $openqrm->send_command('openqrm_server_add_resource ' . $id . ' ' . $mac . ' ' . $ip);
             // set resource type
             $virtualization = new virtualization();
             $virtualization->get_instance_by_type("hybrid-cloud-vm-local");
             // add to openQRM database
             $fields["resource_id"] = $id;
             $fields["resource_ip"] = $ip;
             $fields["resource_mac"] = $mac;
             $fields["resource_hostname"] = $name;
             $fields["resource_localboot"] = 0;
             $fields["resource_vtype"] = $virtualization->id;
             $fields["resource_vhostid"] = 0;
             $fields["resource_image"] = $image->name;
             $fields["resource_imageid"] = $image->id;
             $rfields["resource_kernel"] = 'default';
             $rfields["resource_kernelid"] = 1;
             $resource->add($fields);
             $resource->get_instance_by_mac($mac);
             // set account id in resource capabilities
             $resource->set_resource_capabilities("HCACL", $this->hc->id);
             $hc_authentication = '';
             if ($this->hc->account_type == 'aws' || $this->hc->account_type == 'euca') {
                 $hc_authentication .= ' -O ' . $this->hc->access_key;
                 $hc_authentication .= ' -W ' . $this->hc->secret_key;
                 $hc_authentication .= ' -ir ' . $this->region;
                 $hc_authentication .= ' -iz ' . $form->get_request('availability_zone');
             }
             if ($this->hc->account_type == 'lc-openstack') {
                 $hc_authentication .= ' -u ' . $this->hc->username;
                 $hc_authentication .= ' -p ' . $this->hc->password;
                 $hc_authentication .= ' -q ' . $this->hc->host;
                 $hc_authentication .= ' -x ' . $this->hc->port;
                 $hc_authentication .= ' -g ' . $this->hc->tenant;
                 $hc_authentication .= ' -e ' . $this->hc->endpoint;
             }
             $command = $this->openqrm->get('basedir') . '/plugins/hybrid-cloud/bin/openqrm-hybrid-cloud-vm create';
             $command .= ' -i ' . $this->hc->id;
             $command .= ' -n ' . $this->hc->account_name;
             $command .= ' -t ' . $this->hc->account_type;
             $command .= $hc_authentication;
             $command .= ' -in ' . $name;
             $command .= ' -im ' . $mac;
             $command .= ' -a ' . $image->name;
             $command .= ' -it ' . $form->get_request('type');
             $command .= ' -ik ' . $form->get_request('keypair');
             if ($this->hc->account_type == 'aws') {
                 $command .= ' -subnet ' . $form->get_request('subnet');
             } else {
                 $command .= ' -ig ' . $form->get_request('group');
             }
             $command .= ' --openqrm-ui-user ' . $this->user->name;
             $command .= ' --openqrm-cmd-mode background';
             $command .= $custom_script_parameter;
             $openqrm->send_command($command, NULL, true);
             // check to have a ip from the dhcpd-resource hook
             while ($resource->ip == "0.0.0.0") {
                 sleep(1);
                 clearstatcache();
                 $resource->get_instance_by_mac($mac);
             }
             // save the mgmt ip in the resource network field
             $rufields["resource_network"] = $resource->ip;
             $resource->update_info($resource->id, $rufields);
             $response->resource_id = $id;
             $response->msg = sprintf($this->lang['msg_added'], $name);
//.........这里部分代码省略.........
开发者ID:kelubo,项目名称:OpenQRM,代码行数:101,代码来源:hybrid-cloud-vm.add.class.php

示例12: resource

 function resource_new()
 {
     $response = $this->get_response();
     $form = $response->form;
     $name = $form->get_request('name');
     $ip = $form->get_request('ip');
     $mac = $form->get_request('mac');
     if (strlen($name)) {
         if (!$form->get_errors() && $this->response->submit()) {
             // check that mac adress + ip does not yet exists
             $resource = new resource();
             $resource->get_instance_by_mac($mac);
             if (strlen($resource->id)) {
                 $response->error = sprintf($this->lang['msg_mac_in_use']);
                 return $response;
             }
             $resource->get_instance_by_ip($ip);
             if (strlen($resource->id)) {
                 $response->error = sprintf($this->lang['msg_ip_in_use']);
                 return $response;
             }
             $tables = $this->openqrm->get('table');
             $id = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
             $mac = strtolower($mac);
             // send command to the openQRM-server
             $openqrm = new openqrm_server();
             $openqrm->send_command('openqrm_server_add_resource ' . $id . ' ' . $mac . ' ' . $ip);
             // add to openQRM database
             $fields["resource_id"] = $id;
             $fields["resource_hostname"] = $name;
             $fields["resource_ip"] = $ip;
             $fields["resource_mac"] = $mac;
             $fields["resource_localboot"] = 0;
             $fields["resource_vtype"] = 1;
             $fields["resource_vhostid"] = $id;
             $fields["resource_state"] = 'unknown';
             $fields["resource_lastgood"] = '-1';
             $resource->add($fields);
             // set lastgood to -1 to prevent automatic checking the state
             $resource->update_info($id, $fields);
             $response->msg = sprintf($this->lang['msg'], $name);
             $response->resource_id = $id;
         } else {
             $response->error = sprintf($this->lang['msg_add_failed']);
         }
     }
     return $response;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:48,代码来源:resource.new.class.php

示例13: 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();
         }
     }
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:61,代码来源:resource.class.php

示例14: stop

 function stop()
 {
     global $event;
     global $RootDir;
     $resource = new resource();
     $resource->get_instance_by_id($this->resources);
     $resource->assign($resource->id, "1", "default", "1", "idle");
     // update stoptime + state
     $now = $_SERVER['REQUEST_TIME'];
     $appliance_fields = array();
     $appliance_fields['appliance_stoptime'] = $now;
     $appliance_fields['appliance_state'] = 'stopped';
     $this->update($this->id, $appliance_fields);
     // update resource state to transition
     $resource_fields = array();
     $resource_fields["resource_state"] = "transition";
     $resource_fields["resource_event"] = "reboot";
     $resource->update_info($resource->id, $resource_fields);
     // stop appliance hook
     // fill in the rest of the appliance info in the array for the plugin hook
     $appliance_fields["appliance_id"] = $this->id;
     $appliance_fields["appliance_name"] = $this->name;
     $appliance_fields["appliance_kernelid"] = $this->kernelid;
     $appliance_fields["appliance_imageid"] = $this->imageid;
     $appliance_fields["appliance_cpunumber"] = $this->cpunumber;
     $appliance_fields["appliance_cpuspeed"] = $this->cpuspeed;
     $appliance_fields["appliance_cpumodel"] = $this->cpumodel;
     $appliance_fields["appliance_memtotal"] = $this->memtotal;
     $appliance_fields["appliance_swaptotal"] = $this->swaptotal;
     $appliance_fields["appliance_nics"] = $this->nics;
     $appliance_fields["appliance_capabilities"] = $this->capabilities;
     $appliance_fields["appliance_cluster"] = $this->cluster;
     $appliance_fields["appliance_ssi"] = $this->ssi;
     $appliance_fields["appliance_resources"] = $this->resources;
     $appliance_fields["appliance_highavailable"] = $this->highavailable;
     $appliance_fields["appliance_virtual"] = $this->virtual;
     $appliance_fields["appliance_virtualization"] = $this->virtualization;
     $appliance_fields["appliance_virtualization_host"] = $this->virtualization_host;
     $appliance_fields["appliance_comment"] = $this->comment;
     $appliance_fields["appliance_wizard"] = $this->wizard;
     $appliance_fields["appliance_event"] = $this->event;
     // stop the hook
     $plugin = new plugin();
     $enabled_plugins = $plugin->enabled();
     foreach ($enabled_plugins as $index => $plugin_name) {
         $plugin_stop_appliance_hook = "{$RootDir}/plugins/{$plugin_name}/openqrm-{$plugin_name}-appliance-hook.php";
         if (file_exists($plugin_stop_appliance_hook)) {
             $event->log("stop", $_SERVER['REQUEST_TIME'], 5, "appliance.class.php", "Found plugin {$plugin_name} handling stop-appliance event.", "", "", 0, 0, $this->resources);
             require_once "{$plugin_stop_appliance_hook}";
             $appliance_function = "openqrm_" . "{$plugin_name}" . "_appliance";
             $appliance_function = str_replace("-", "_", $appliance_function);
             $appliance_function("stop", $appliance_fields);
         }
     }
     // delay a bit to make sure all appliance hooks have been executed or at least arrived in the queue
     sleep(2);
     $resource->send_command("{$resource->ip}", "reboot");
     // storage authentication hook
     $image = new image();
     $image->get_instance_by_id($this->imageid);
     $deployment = new deployment();
     $deployment->get_instance_by_type($image->type);
     $deployment_type = $deployment->type;
     $deployment_plugin_name = $deployment->storagetype;
     $storage_auth_hook = "{$RootDir}/plugins/{$deployment_plugin_name}/openqrm-{$deployment_type}-auth-hook.php";
     if (file_exists($storage_auth_hook)) {
         $event->log("stop", $_SERVER['REQUEST_TIME'], 5, "appliance.class.php", "Found deployment type {$deployment_type} handling the stop auth hook.", "", "", 0, 0, $this->resources);
         require_once "{$storage_auth_hook}";
         storage_auth_function("stop", $this->id);
     }
     // set image to deactive
     $image->set_active(0);
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:73,代码来源:appliance.class.php

示例15: event

global $IMAGE_INFO_TABLE;
global $DEPLOYMENT_INFO_TABLE;
global $OPENQRM_SERVER_BASE_DIR;
// get params
$dhcpd_command = $request->get('dhcpd_command');
$dhcpd_resource_id = $request->get('resource_id');
$dhcpd_resource_ip = $request->get('resource_ip');
// get event + openQRM server
$event = new event();
$openqrm_server = new openqrm_server();
$OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address();
global $OPENQRM_SERVER_IP_ADDRESS;
global $event;
// user/role authentication
if ($OPENQRM_USER->role != "administrator") {
    $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "dhcpd-action", "Un-Authorized access to dhcpd-actions from {$OPENQRM_USER->name}", "", "", 0, 0, 0);
    exit;
}
$event->log("{$dhcpd_command}", $_SERVER['REQUEST_TIME'], 5, "dhcpd-action", "Processing dhcpd command {$dhcpd_command}", "", "", 0, 0, 0);
switch ($dhcpd_command) {
    case 'post_ip':
        $event->log("{$dhcpd_command}", $_SERVER['REQUEST_TIME'], 5, "dhcpd-action", "Updateing resource {$dhcpd_resource_id} with ip {$dhcpd_resource_ip}", "", "", 0, 0, 0);
        $dhcpd_resource = new resource();
        $dhcpd_resource->get_instance_by_id($dhcpd_resource_id);
        $dhcpd_resource_fields["resource_ip"] = $dhcpd_resource_ip;
        $dhcpd_resource->update_info($dhcpd_resource_id, $dhcpd_resource_fields);
        break;
    default:
        $event->log("{$dhcpd_command}", $_SERVER['REQUEST_TIME'], 3, "dhcpd-action", "No such dhcpd command ({$dhcpd_command})", "", "", 0, 0, 0);
        break;
}
开发者ID:kelubo,项目名称:OpenQRM,代码行数:31,代码来源:dhcpd-action.php


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