Changeset 1153 in ProjectBuilder
- Timestamp:
- Jan 12, 2011, 2:42:12 AM (13 years ago)
- Location:
- devel
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/etc/pb.conf.pod
r1133 r1153 491 491 Example: vertype default = chroot 492 492 493 =item B<vmbuildtm> 494 495 Nature: Optional 496 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch). Default value is set to vmtmout 497 Value: Time in seconds to wait before killing the VM if SSH port already used. This should corresponds to the time to send files, build the project and get packages in the VM. 498 Conffile: project 499 Example: vmbuildtm default = 600,vmbuildtm mandriva-2009.0-x86_64 = 1200 500 493 501 =item B<vmcmd> 494 502 … … 524 532 Example: vmlogin default = pb 525 533 534 =item B<vmmem> 535 536 Nature: Optional 537 Key: project (as defined in the -p option or PBPROJ environment variable) 538 Value: Memory size in MB to allocate to the VM. 539 Conffile: vm 540 Example: vmmem default = 512 541 526 542 =item B<vmmonport> 527 543 … … 592 608 Nature: Optional 593 609 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch). NB: a default value is highly interesting here. 594 Value: Time in seconds to wa y beofre interacting with the VM. This should correspondsto the time the VM takes to boot.610 Value: Time in seconds to wait before interacting with the VM. This should correspond to the time the VM takes to boot. 595 611 Conffile: vm 596 612 Example: vmtmout default = 180,vmtmout mandriva-2009.0-x86_64 = 500 -
devel/pb-modules/lib/ProjectBuilder/Log.pm
r1148 r1153 227 227 # mails the summary to $to 228 228 sub mailSummary { 229 require Mail::Sendmail; 230 my $self = shift; 231 my $to = shift || ""; 232 233 if ($to eq "") { 234 pb_log(0,"Please give a To: address\n"); 235 return; 236 } 237 my %mail = ( 238 To => $to, 239 From => "pb\@localhost", 240 Message => $self->summary() 241 ); 242 if (! sendmail(%mail)) { 243 if (defined $Mail::Sendmail::error) { 244 return $Mail::Sendmail::error; 245 } else { 246 return "Unkown error"; 247 } 248 } 249 pb_log(0,"Mail send to ". $to ."\n"); 229 eval 230 { 231 require Mail::Sendmail; 232 Mail::Sendmail->import(); 233 }; 234 if ($@) { 235 # Mail::Sendmail not found not sending mail ! 236 pb_log(0,"No Mail::Sendmail module found so not sending any mail !\n"); 237 } else { 238 my $self = shift; 239 my $to = shift || ""; 240 241 if ($to eq "") { 242 pb_log(0,"Please give a To: address\n"); 243 return; 244 } 245 my %mail = ( 246 To => $to, 247 From => "pb\@localhost", 248 Message => $self->summary() 249 ); 250 if (! sendmail(%mail)) { 251 if (defined $Mail::Sendmail::error) { 252 return $Mail::Sendmail::error; 253 } else { 254 return "Unkown error"; 255 } 256 } 257 pb_log(0,"Mail send to ". $to ."\n"); 258 } 250 259 } 251 260 -
devel/pb-modules/t/Base.t
r1147 r1153 19 19 if ($@) { 20 20 require Test; 21 Test->import(); 21 22 plan(tests => 1); 22 23 print "# Faking tests as Test::More is not available in an appropriate version\n"; -
devel/pb-modules/t/Log.t
r1147 r1153 19 19 if ($@) { 20 20 require Test; 21 Test->import(); 21 22 plan(tests => 1); 22 23 print "# Faking tests as test::More is not available in an appropriate version\n"; -
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.