Versions Compared

Key

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

...

  

...

pre_capture
Anchor
pre_capture
pre_capture

...

  • 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 was called.
  • Called By
    • Provisioning module's own get_current_image() 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())
    • 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

reserve 
Anchor
reserve
reserve

  • 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())
    • 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

grant_access 
Anchor
grant_access
grant_access

  • 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())
    • 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