...
- Modules make it easier for developers to implement new technologies to be used with VCL easily
- Core VCL code does not need to be altered in order to support additional technologies or functionality
- Increased flexibility for different configurations
- Consistent methods to access data stored in the database
- Code maintainability is increased because each module focuses on a distinct task and the core code does not need to check for numerous different conditions based on the technology being used
Architecture
A module is comprised of a Perl module file.
Object Orientation and Inheritance
Module.pm (VCL::Module)
- Provides a constructor for all derived objects to use
- Objects which inherit from VCL::Module do not need to implement their own new() subroutines
- Objects which inherit from VCL::Module do not need to deal with "blessing" themselves
- Provides access to the database data for the reservation via the data() subroutine implemented by Module.pm
Wiki Markup |
---|
Any module derived from VCL::Module can call $self->data->\[get_something\] or $self->data->\[set_something\] |
State.pm (VCL::Module::State)
- Supports the core VCL state modules such as new.pm, image.pm, reclaim.pm, and others
- Provides an initialize() subroutine which performs common tasks whenever a state object is created
- initialize() creates the provisioning and OS objects
Wiki Markup |
---|
Provides an os() subroutine which allows the state objects to interact with the resource's operating system by calling $self->os->\[subroutine\] |
Wiki Markup |
---|
Provides a provisioner() subroutine which allows the state objects to interact with the provisioning engine that has been configured for the resource by calling $self->provisioner->\[subroutine\] |
- Provides other subroutines such as reservation_failed() which performs a consistent set of tasks when a reservation fails
Provisioning.pm (VCL::Module::Provisioning)
- Provisioning engine modules should inherit from VCL::Module::Provisioning
- Modules which are a subclass of VCL::Module::Provisioning also receive the functionality provided by VCL::Module through inheritance
- VCL::Module::Provisioning provides provisioning modules with access to the OS object created for the reservation
OS.pm (VCL::Module::OS)
- OS modules should inherit from VCL::Module::OS
- Modules which are a subclass of VCL::Module::OS also receive the functionality provided by VCL::Module through inheritance
- VCL::Module::OS provides OS modules with access to the provisioning object created for the reservation
- This is useful if the OS needs to perform a task such as power cycling the computer if a reboot fails
...