- Timestamp:
- Jan 12, 2011, 2:42:12 AM (14 years ago)
- Location:
- devel/pb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r1146 r1153 523 523 if ($@) { 524 524 # Sys::CPU not found, defaulting to 1 525 pb_log(1,"ADVISE: Install Sys::CPU to benefit from automatic parallelism optimization.\nOr use pbparallel in your pb.conf file\nOnly 1 process at a time for the moment\n"); 525 526 $pbparallel = 1; 526 527 } else { 527 528 # Using the number of cores 528 529 $pbparallel = Sys::CPU::cpu_count(); 530 pb_log(1,"Using parallel mode with $pbparallel processes\n"); 529 531 } 530 532 } … … 538 540 if ($@) { 539 541 $pbparallel = undef; 542 pb_log(1,"ADVISE: Install Parallel::ForkManager to benefit from automatic parallelism optimization.\nOnly 1 process at a time for the moment\n"); 540 543 } 541 544 … … 1805 1808 # For monitoring control 1806 1809 if ((($vmtype->{$ENV{'PBPROJ'}}) eq "kvm") || (($vmtype->{$ENV{'PBPROJ'}}) eq "qemu")) { 1810 eval 1811 { 1807 1812 require Net::Telnet; 1808 my $t = new Net::Telnet (Timeout => 120, Host => "localhost", Port => $vmmonport->{$ENV{'PBPROJ'}}) || die "Unable to dialog on the monitor"; 1809 # move to monitor mode 1810 my @lines = $t->cmd("c"); 1811 # Create a snapshot named pb 1812 @lines = $t->cmd("savevm pb"); 1813 # Write the new status in the VM 1814 @lines = $t->cmd("commit all"); 1815 # End 1816 @lines = $t->cmd("quit"); 1813 Net::Telnet->import(); 1814 }; 1815 if ($@) { 1816 # Net::Telnet not found 1817 pb_log(1,"ADVISE: Install Net::Telnet to benefit from monitoring control and snapshot feature.\nWARNING: No snapshot created"); 1818 } else { 1819 my $t = new Net::Telnet (Timeout => 120, Host => "localhost", Port => $vmmonport->{$ENV{'PBPROJ'}}) || die "Unable to dialog on the monitor"; 1820 # move to monitor mode 1821 my @lines = $t->cmd("c"); 1822 # Create a snapshot named pb 1823 @lines = $t->cmd("savevm pb"); 1824 # Write the new status in the VM 1825 @lines = $t->cmd("commit all"); 1826 # End 1827 @lines = $t->cmd("quit"); 1828 } 1817 1829 } 1818 1830 } … … 1911 1923 # TODO: vmmonport should be optional 1912 1924 my ($ptr,$ptr2,$vmpath,$vmport,$vmsize,$vmmonport) = pb_conf_get("vmtype","vmcmd","vmpath","vmport","vmsize","vmmonport"); 1913 my ($vmopt,$vmmem,$vmtmout,$vmsnap ) = pb_conf_get_if("vmopt","vmmem","vmtmout","vmsnap");1925 my ($vmopt,$vmmem,$vmtmout,$vmsnap,$vmbuildtm) = pb_conf_get_if("vmopt","vmmem","vmtmout","vmsnap","vmbuildtm"); 1914 1926 1915 1927 my $vmtype = $ptr->{$ENV{'PBPROJ'}}; … … 2001 2013 pb_log(0,"Unable to find VM $vmm\n"); 2002 2014 } else { 2015 # Is the SSH port free? if not kill the existing process using it after a build timeout period 2016 my $vmssh = pb_check_ps($tmpcmd,"tcp:$nport:10.0.2.15:22"); 2017 if ($vmssh) { 2018 my $buildtm = $ENV{'PBVMTMOUT'}; 2019 if (defined $vmbuildtm->{$v}) { 2020 $buildtm = $vmbuildtm->{$v}; 2021 } elsif (defined $vmbuildtm->{$ENV{'PBPROJ'}}) { 2022 $buildtm = $vmbuildtm->{$ENV{'PBPROJ'}}; 2023 } 2024 2025 sleep $buildtm; 2026 pb_log(0,"WARNING: Killing the process ($vmssh) using port $nport (previous failed VM ?)\n"); 2027 kill 15,$vmssh; 2028 } 2003 2029 pb_system("$cmd &","Launching the VM $vmm"); 2030 # Using system allows to kill it externaly if needed 2004 2031 pb_system("sleep $ENV{'PBVMTMOUT'}","Waiting $ENV{'PBVMTMOUT'} s for VM $v to come up"); 2005 2032 $vmpid = pb_check_ps($tmpcmd,$vmm); … … 2238 2265 foreach my $v (@$v) { 2239 2266 $counter++; 2240 # Modulo pbparallel2241 $counter = 1 if ($counter > $pbparallel);2267 # Modulo 2 * pbparallel (to avoid synchronization problems) 2268 $counter = 1 if ($counter > 2 * $pbparallel); 2242 2269 $pm->start($counter) and next if (defined $pbparallel); 2243 2270 # Prepare the script to be executed on the VM/VE … … 3498 3525 }; 3499 3526 if ($@) { 3500 # Linux::SysInfo not found , defaulting to 43501 $pbparallel = 4;3527 # Linux::SysInfo not found 3528 pb_log(1,"ADVISE: Install Linux::SysInfo to benefit from automatic parallelism optimization.\nOr optimize manually pbparallel in your pb.conf file\nUsing $pbparallel processes max at a time for the moment\nWARNING: This may consume too much memory for your system"); 3502 3529 } else { 3503 3530 # Using the memory size 3504 3531 my $si = Linux::SysInfo::sysinfo(); 3505 3532 if (not defined $si) { 3506 $pbparallel = 43533 pb_log(1,"ADVISE: Install Linux::SysInfo to benefit from automatic parallelism optimization.\nOr optimize manually pbparallel in your pb.conf file\nUsing $pbparallel processes max at a time for the moment\nWARNING: This may consume too much memory for your system"); 3507 3534 } else { 3508 3535 # Keep the number of VM whose memory can be allocated 3509 3536 my $ram = $si->{"totalram"}-$si->{"sharedram"}-$si->{"bufferram"}; 3510 3537 my $ram2; 3511 my ($pbvmmem) = pb_conf_get_if("pbvmmem"); 3512 3513 if ((defined $pbvmmem) and (defined $pbvmmem->{$ENV{'PBPROJ'}})) { 3514 $ram2 = $pbvmmem->{$ENV{'PBPROJ'}}; 3538 my ($vmmem) = pb_conf_get_if("vmmem"); 3539 3540 my $v = "default"; 3541 if ((defined $vmmem) and (defined $vmmem->{$v})) { 3542 $ram2 = $vmmem->{$v}; 3515 3543 } else { 3516 3544 # Default for KVM/QEMU … … 3519 3547 $pbparallel = sprintf("%d",$ram/$ram2); 3520 3548 } 3549 pb_log(1,"Using $pbparallel processes at a time\n"); 3521 3550 } 3522 3551 } -
devel/pb/lib/ProjectBuilder/CMS.pm
r1148 r1153 209 209 return("$ENV{'PBTMP'}/$f"); 210 210 } elsif ($scheme eq "file") { 211 use File::MimeInfo; 211 eval 212 { 213 require File::MimeInfo; 214 File::MimeInfo->import(); 215 }; 216 if ($@) { 217 # File::MimeInfo not found 218 die("ERROR: Install File::MimeInfo to handle scheme $scheme\n"); 219 } 220 212 221 my $mm = mimetype($path); 213 222 pb_log(2,"mimetype: $mm\n");
Note:
See TracChangeset
for help on using the changeset viewer.