Changeset 590
- Timestamp:
- 06/20/07 23:01:20 (1 year ago)
- Files:
-
- honeyclient/trunk/lib/HoneyClient/Manager/VM.pm (modified) (2 diffs)
- honeyclient/trunk/lib/HoneyClient/Manager/VM/Clone.pm (modified) (5 diffs)
- honeyclient/trunk/t/honeyclient_manager_vm.t (modified) (2 diffs)
- honeyclient/trunk/t/honeyclient_manager_vm_clone.t (modified) (1 diff)
- honeyclient/trunk/t/test_vm/nvram (modified) (previous)
- honeyclient/trunk/t/test_vm/winXPPro.vmx (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
honeyclient/trunk/lib/HoneyClient/Manager/VM.pm
r588 r590 355 355 =begin testing 356 356 357 # Make sure ExtUtils::MakeMaker loads. 358 BEGIN { use_ok('ExtUtils::MakeMaker', qw(prompt)) or diag("Can't load ExtUtils::MakeMaker package. Check to make sure the package library is correctly listed within the path."); } 359 require_ok('ExtUtils::MakeMaker'); 360 can_ok('ExtUtils::MakeMaker', 'prompt'); 361 use ExtUtils::MakeMaker qw(prompt); 362 357 363 # Generate a notice, to clarify our assumptions. 358 diag("Note: These unit tests *expect* the VMware Server / GSX daemon to be operational on this system beforehand."); 364 diag("About to run basic unit tests."); 365 diag("Note: These tests *expect* VMware Server or VMware GSX to be installed and running on this system beforehand."); 366 367 my $question; 368 $question = prompt("# Do you want to run basic tests?", "yes"); 369 if ($question !~ /^y.*/i) { 370 exit; 371 } 359 372 360 373 # Make sure Log::Log4perl loads … … 500 513 use Thread::Semaphore; 501 514 502 # TODO: Remove this once unit testing should actually be used. 503 # Ideally, this should be handled programmatically, based upon user prompt. 504 #exit; 505 515 diag("About to run extended tests."); 506 516 # Generate a notice, to inform the tester that these tests are not 507 517 # exactly quick. 508 diag("Note: These unit tests will take *significant* time to complete (10-30 minutes)."); 518 diag("Note: These extended tests will take *significant* time to complete (10-30 minutes)."); 519 520 my $question = prompt("# Do you want to run extended tests?", "no"); 521 if ($question !~ /^y.*/i) { 522 exit; 523 } 509 524 510 525 =end testing honeyclient/trunk/lib/HoneyClient/Manager/VM/Clone.pm
r589 r590 218 218 use VMware::VmPerl qw(VM_EXECUTION_STATE_ON VM_EXECUTION_STATE_OFF VM_EXECUTION_STATE_STUCK VM_EXECUTION_STATE_SUSPENDED); 219 219 220 # XXX: FIX THIS221 220 # Make sure the module loads properly, with the exportable 222 221 # functions shared. 223 222 BEGIN { use_ok('HoneyClient::Manager::VM::Clone') or diag("Can't load HoneyClient::Manager::VM::Clone package. Check to make sure the package library is correctly listed within the path."); } 224 223 require_ok('HoneyClient::Manager::VM::Clone'); 225 can_ok('HoneyClient::Manager::VM::Clone', 'new');226 can_ok('HoneyClient::Manager::VM::Clone', 'drive');227 can_ok('HoneyClient::Manager::VM::Clone', 'isFinished');228 can_ok('HoneyClient::Manager::VM::Clone', 'next');229 can_ok('HoneyClient::Manager::VM::Clone', 'status');230 224 use HoneyClient::Manager::VM::Clone; 231 225 … … 424 418 Creates a new Clone object, which contains a hashtable 425 419 containing any of the supplied "param => value" arguments. 426 Upon creation, the Clone object clones the supplied master VM.427 420 428 421 I<Inputs>: … … 549 542 550 543 # Set the master VM. 544 $LOG->info("Setting VM (" . $self->{'master_vm_config'} . ") as master."); 551 545 my $som = $self->{'_vm_handle'}->setMasterVM(config => $self->{'master_vm_config'}); 552 546 if (!$som->result()) { … … 564 558 =pod 565 559 566 =head2 $object-> drive()560 =head2 $object->start() 567 561 568 562 =over 4 569 563 570 Drives the back-end application for one iteration, updating the 571 corresponding internal object state with information obtained 572 from driving this application for one iteration. 573 574 I<Output>: The updated Driver B<$object>, containing state information 575 from driving the application for one iteration. Will croak if 576 operation fails. 564 If not previously called, this method creates a new clone VM 565 from the supplied master VM. Furthermore, this method will power 566 on the clone, and wait until the clone VM has fully booted and 567 has an operational Agent daemon running on it. 568 569 During this power on process, the name, MAC address, and 570 IP address of the running clone are recorded in the object. 571 572 I<Output>: The updated Clone B<$object>, containing state information 573 from starting the clone VM. Will croak if this operation fails. 577 574 578 575 =back 579 576 577 # XXX: FINISH THIS 580 578 #=begin testing 581 579 # … … 588 586 =cut 589 587 590 sub drive { 591 # Get the class name. 592 my $self = shift; 588 sub start { 589 # Extract arguments. 590 my ($self, %args) = @_; 591 592 # Sanity check: Make sure we've been fed an object. 593 unless (ref($self)) { 594 $LOG->error("Error: Function must be called in reference to a " . 595 __PACKAGE__ . "->new() object!"); 596 Carp::croak "Error: Function must be called in reference to a " . 597 __PACKAGE__ . "->new() object!"; 598 } 593 599 594 # Check to see if the class name is inherited or defined. 595 my $class = ref($self) || $self; 596 597 # Emit generic "not implemented" error message. 598 $LOG->error($class . "->drive() is not implemented!"); 599 Carp::croak "Error: " . $class . "->drive() is not implemented!\n"; 600 # Temporary variable to hold SOAP Object Message. 601 my $som = undef; 602 603 # Perform the quick clone operation. 604 $LOG->info("Quick cloning master VM (" . $self->{'master_vm_config'} . ")."); 605 $som = $self->{'_vm_handle'}->quickCloneVM(src_config => $self->{'master_vm_config'}); 606 if (!$som->result()) { 607 $LOG->fatal("Unable to quick clone master VM (" . $self->{'master_vm_config'} . ")."); 608 Carp::croak "Unable to quick clone master VM (" . $self->{'master_vm_config'} . ")."; 609 } 600 610 } 601 611 honeyclient/trunk/t/honeyclient_manager_vm.t
r589 r590 9 9 # =begin testing 10 10 { 11 # Make sure ExtUtils::MakeMaker loads. 12 BEGIN { use_ok('ExtUtils::MakeMaker', qw(prompt)) or diag("Can't load ExtUtils::MakeMaker package. Check to make sure the package library is correctly listed within the path."); } 13 require_ok('ExtUtils::MakeMaker'); 14 can_ok('ExtUtils::MakeMaker', 'prompt'); 15 use ExtUtils::MakeMaker qw(prompt); 16 11 17 # Generate a notice, to clarify our assumptions. 12 diag("Note: These unit tests *expect* the VMware Server / GSX daemon to be operational on this system beforehand."); 18 diag("About to run basic unit tests."); 19 diag("Note: These tests *expect* VMware Server or VMware GSX to be installed and running on this system beforehand."); 20 21 my $question; 22 $question = prompt("# Do you want to run basic tests?", "yes"); 23 if ($question !~ /^y.*/i) { 24 exit; 25 } 13 26 14 27 # Make sure Log::Log4perl loads … … 154 167 use Thread::Semaphore; 155 168 156 # TODO: Remove this once unit testing should actually be used. 157 # Ideally, this should be handled programmatically, based upon user prompt. 158 #exit; 159 169 diag("About to run extended tests."); 160 170 # Generate a notice, to inform the tester that these tests are not 161 171 # exactly quick. 162 diag("Note: These unit tests will take *significant* time to complete (10-30 minutes)."); 172 diag("Note: These extended tests will take *significant* time to complete (10-30 minutes)."); 173 174 my $question = prompt("# Do you want to run extended tests?", "no"); 175 if ($question !~ /^y.*/i) { 176 exit; 177 } 163 178 } 164 179 honeyclient/trunk/t/honeyclient_manager_vm_clone.t
r589 r590 59 59 use VMware::VmPerl qw(VM_EXECUTION_STATE_ON VM_EXECUTION_STATE_OFF VM_EXECUTION_STATE_STUCK VM_EXECUTION_STATE_SUSPENDED); 60 60 61 # XXX: FIX THIS62 61 # Make sure the module loads properly, with the exportable 63 62 # functions shared. 64 63 BEGIN { use_ok('HoneyClient::Manager::VM::Clone') or diag("Can't load HoneyClient::Manager::VM::Clone package. Check to make sure the package library is correctly listed within the path."); } 65 64 require_ok('HoneyClient::Manager::VM::Clone'); 66 can_ok('HoneyClient::Manager::VM::Clone', 'new');67 can_ok('HoneyClient::Manager::VM::Clone', 'drive');68 can_ok('HoneyClient::Manager::VM::Clone', 'isFinished');69 can_ok('HoneyClient::Manager::VM::Clone', 'next');70 can_ok('HoneyClient::Manager::VM::Clone', 'status');71 65 use HoneyClient::Manager::VM::Clone; 72 66 honeyclient/trunk/t/test_vm/winXPPro.vmx
r276 r590 25 25 redoLogDir = "." 26 26 27 uuid.location = "56 4d 47 6f 36 7b e1 31-d6 26 da 2e 4f a7 f0 c4"28 uuid.bios = "56 4d 47 6f 36 7b e1 31-d6 26 da 2e 4f a7 f0 c4"27 uuid.location = "56 4d 63 26 ef 9e 06 a5-3e 05 81 73 13 e7 c2 0a" 28 uuid.bios = "56 4d 63 26 ef 9e 06 a5-3e 05 81 73 13 e7 c2 0a" 29 29 30 30 Ethernet0.present = "TRUE" 31 31 32 32 Ethernet0.addressType = "generated" 33 ethernet0.generatedAddress = "00:0c:29: a7:f0:c4"33 ethernet0.generatedAddress = "00:0c:29:e7:c2:0a" 34 34 ethernet0.generatedAddressOffset = "0" 35 35
