Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  

...

pre_capture
Anchor
pre_capture
pre_capture

...

  • Description
    • Performs a graceful shutdown of the OS.
    • May forcibly log off users if necessary.
    • Waits for the shutdown to complete.
    • Returns after the shutdown is complete and the computer is off.
  • Expected Beginning State
    • Computer is up and accessible.
    • Users may be logged on to the computer.
  • Expected Ending State
    • Computer is off.
  • Called By
    • May be called by any module which has access to the OS object
  • Arguments & Calling Environment
    • Must only be called as an object method of an OS object ($os->reboot())
    • Argument:
      • Name: timeout
      • Description:
        • Instructs shutdown() to wait a maximum number of minutes for the shutdown to complete
        • If timeout has been reached and computer has not finished shutting down, 0 should be returned
      • Required: No
      • Default Value: 5 minutes
      • Data Type: integer
      • Possible Values:
        • Any positive integer
  • Return Values
    • 1
      • Shudown completed successfully
    • 0
      • Shutdown was initiated but computer never shut down
      • Timeout was reached
    • Undefined
      • Shutdown could not be initiated

get_current_image_name
Anchor
get_current_image_name
get_current_image_name

  • Description
    • Returns the name of the current image that is loaded on the resource.
    • The name corresponds to the imagerevision.imagename column in the database.
    • Returning a name implies that the resource is accessible.
  • Expected Beginning State
    • Resource is accessible.
  • Expected Ending State
    • The resource state should be identical to before get_current_image_name was called.
  • Called By
    • Provisioning module's own get_current_image_name() subroutine.
    • Used to determine if the OS and provisioning engine agree on the current image loaded on a resource.
    • Can be used to determine if a resource is accessible.  A valid string will be returned if the resource is accessible.
  • Arguments & Calling Environment
    • Must only be called as an object method of an OS object ($os->get_current_image_name())
    • No arguments
  • Return Values
    • String
      • String contains a VCL image name
    • 0
      • Computer is accessible but failed to determine the current loaded image
    • Undefined
      • Computer is not accessible

...

  • Description
    • reserve() gets called by new.pm after a machine has been reloaded if the state is "new" (new.pm also handles the "reload" state and others)
    • It should perform the steps necessary to take a reloaded machine and prepare it for a particular reservation
    • Anything reservation-specific that doesn't require knowing the user's IP should be done in reserve()
    • After reserve() has run, the state can be changed to reserved and the "Connect" button can be presented to the user
    • reserve() would normally add the reservation user and any users set in imagemeta usergroup to the computer, set their passwords, and add them to the appropriate groups
    • reserve() does not configure the firewall or do anything networking related because at the time it's called, the state has not been changed to reserved and the user has not been shown the "Connect" button.  Hence, the user's IP is not known.
    • reserve() is called by new.pm before the "Connect" button is shown to the user because adding several user accounts may take a long time.  If adding users was done after the state was changed to reserved, a user could attempt to connect before all of the users accounts were added.
  • Expected Beginning State
    • Request state is pending/new 
    • Computer has been reloaded
  • Expected Ending State
    • Computer has been configured for a particular reservation
    • User accounts have been added and configured
    • Request state can be changed to reserved and the "Connect" button can be presented to the user
  • Called By
    • new.pm
  • Arguments & Calling Environment
    • Must only be called as an object method of an OS object ($os->get_current_image_name())
    • No arguments
  • Return Values
    • True (1) 
      • Computer has successfully been configured for a particular reservation
    • False (0 or undefined) 
      • Computer could not be configured for a particular reservation

...

  • Description
    • grant_access() gets called by reserved.pm after the user has clicked the "Connect" button
    • The user's IP address is known when grant_access() is called
    • grant_access() should perform all the steps necessary to open up the machine so the user(s) added by reserve() can connect
    • grant_access() may enables RDP or public SSH traffic depending on the OS
  • Expected Beginning State
    • User has just clicked the "Connect" button 
    • Request state is pending/reserved
  • Expected Ending State
    • Computer has been configured to allow the user to connect
  • Called By
    • reserved.pm
  • Arguments & Calling Environment
    • Must only be called as an object method of an OS object ($os->get_current_image_name())
    • No arguments
  • Return Values
    • True (1) 
      • Computer was successfully configured to allow access for the reservation users
    • False (0 or undefined)
      • Computer could not be configured to allow access for the reservation users