本文整理汇总了C++中VM::create方法的典型用法代码示例。如果您正苦于以下问题:C++ VM::create方法的具体用法?C++ VM::create怎么用?C++ VM::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VM
的用法示例。
在下文中一共展示了VM::create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
// fprintf(stderr,"Name of the VM:\n");
// fprintf(stderr,vm.virtual_machine_name.c_str());
arg_list="";
arg_list=" list vms";
if (!vbm_popen(arg_list,buffer,sizeof(buffer))){
fprintf(stderr, "CernVMManager list failed!\n");
boinc_finish(1);
}
string VMlist=buffer;
// DEBUG for the list of running VMs
// fprintf(stderr,"List of running VMs:\n");
// fprintf(stderr,VMlist.c_str());
// fprintf(stderr,"\n");
if(VMlist.find(vm.virtual_machine_name.c_str()) != string::npos){
VMexist=true;
}
//Maybe voluteers delete CernVM using VB GUI
if(!VMexist){
fprintf(stderr,"INFO: VM does not exists.\n");
fprintf(stderr,"INFO: Cleaning old instances...\n");
vm.remove();
fprintf(stderr,"INFO: Done!\n");
fprintf(stderr,"INFO: Unzipping image...\n");
retval = boinc_resolve_filename_s("cernvm.vmdk.gz",resolved_name);
if (retval) fprintf(stderr,"can't resolve cernvm.vmdk.gz filename");
unzip(resolved_name.c_str(),cernvm.c_str());
fprintf(stderr,"INFO: Uncompressed finished\n");
fprintf(stderr,"Registering a new VM from an unzipped image...\n");
vm.create();
fprintf(stderr,"Done!\n");
}
}
else{
fprintf(stderr,"INFO: Cleaning old instances...\n");
vm.remove();
fprintf(stderr,"Registering a new VM from unzipped image...\n");
vm.create();
fprintf(stderr,"Done!\n");
}
time_t elapsed_secs = 0, dif_secs = 0;
long int t = 0;
double frac_done = 0;
read_cputime(cpu_time);
cpu_chkpt_time = cpu_time;
vm.current_period=cpu_time;
vm.start(vrde,headless);
vm.last_poll_point = time(NULL);
while (1) {
boinc_get_status(&status);
poll_boinc_messages(vm, status);
// Report progress to BOINC client
if (!status.suspended)
{
vm.poll();