Enter search terms or a module, class or function name.
This models takes cares of persistence of the Services and its associated elements.
DESCRIBE HIEARARCHY HERE
Bases: django.db.models.base.Model
A Provider represents the Service provider itself, (i.e. a KVM Server or a Terminal Server)
Used to invoke the Provider class “Destroy” before deleting it from database.
The main purpuse of this hook is to call the “destroy” method of the object to delete and to clear related data of the object (environment data such as own storage, cache, etc...
Note: | If destroy raises an exception, the deletion is not taken. |
---|
Returns an environment valid for the record this object represents
Instantiates the object this record contains.
Every single record of Provider model, represents an object.
Raises:
Bases: django.db.models.base.Model
A Service represents an specidied type of service offered to final users, with it configuration (i.e. a KVM Base Machine for cloning or a Terminal Server configuration).
Used to invoke the Service class “Destroy” before deleting it from database.
The main purpuse of this hook is to call the “destroy” method of the object to delete and to clear related data of the object (environment data such as own storage, cache, etc...
Note: | If destroy raises an exception, the deletion is not taken. |
---|
Returns an environment valid for the record this object represents
Instantiates the object this record contains.
Every single record of Provider model, represents an object.
Raises:
Get the type of the object this record represents.
The type is Python type, it obtains this type from ServiceProviderFactory and associated record field.
Note: | We only need to get info from this, not access specific data (class specific info) |
---|
Bases: django.db.models.base.Model
A deployed service is the Service produced element that is assigned finally to an user (i.e. a Virtual Machine, etc..)
Returns the current valid publication for this deployed service.
Publication db record if this deployed service has an valid active publication.
None if there is no valid publication for this deployed service.
Utility method to access the assigned user services
Used to invoke the Service class “Destroy” before deleting it from database.
The main purpuse of this hook is to call the “destroy” method of the object to delete and to clear related data of the object (environment data such as own storage, cache, etc...
Note: | If destroy raises an exception, the deletion is not taken. |
---|
Utility method to access the cached user services (level 1 and 2)
Utility method to locate invalid assigned user services.
If an user deployed service is assigned, it MUST have an user associated.
If it don’t has an user associated, the user deployed service is wrong.
Return deployed services with publications for the groups requested.
Returns an environment valid for the record this object represents
Maybe this deployed service is having problems, and that may block some task in some situations.
To avoid this, we will use a “restrain” policy, where we restrain a deployed service for, for example, create new cache elements is reduced.
The policy to check is that if a Deployed Service has 3 errors in the last 20 Minutes (by default), it is considered restrained.
The time that a service is in restrain mode is 20 minutes by default (1200 secs), but it can be modified at globalconfig variables
Used when a new publication is finished.
Marks all user deployed services that belongs to this deployed service, that do not belongs to “activePub” and are not in use as removable.
Also cancels all preparing user services
Better see the code, it’s easier to understand :-)
This method is provided for consistency between UserService and DeployedService There is no posibility to check the username and password that a user will use to connect to a service at this level, because here there is no relation between both.
The only function of this method is allow Transport to transform username/password in getConnectionInfo without knowing if it is requested by a DeployedService or an UserService
Launches the publication of this deployed service.
No check is done, it simply redirects the request to PublicationManager, where checks are done.
Recovers a value from custom storage
Marks the deployed service for removing.
The background worker will be the responsible for removing the deployed service
Mark the deployed service as removed.
A background worker will check for removed deloyed services and clean database of them.
Updates the state of this object and, optionally, saves it
state: new State to store at record
save: Defaults to true. If false, record will not be saved to db, just modified
Stores a value inside custom storage
Unpublish (removes) current active publcation.
It checks that there is an active publication, and then redirects the request to the publication itself
Validates that the user has access to this deployed service
InvalidUserException() if user do not has access to this deployed service
InvalidServiceException() if user has rights to access, but the deployed service is not ready (no active publication)
Bases: django.db.models.base.Model
A deployed service publication keep track of data needed by services that needs “preparation”. (i.e. Virtual machine –> base machine –> children of base machines)
Used to invoke the Service class “Destroy” before deleting it from database.
The main purpuse of this hook is to call the “destroy” method of the object to delete and to clear related data of the object (environment data such as own storage, cache, etc...
Note: | If destroy raises an exception, the deletion is not taken. |
---|
Invoques the cancelation of this publication
Returns an environment valid for the record this object represents
Instantiates the object this record contains.
Every single record of Provider model, represents an object.
Raises:
Updates the state of this object and, optionally, saves it
state: new State to store at record
save: Defaults to true. If false, record will not be saved to db, just modified
Tries to remove the publication
No check is done, it simply redirects the request to PublicationManager, where checks are done.
Updates the data field with the serialized uds.core.services.Publication
Note: | This method do not saves the updated record, just updates the field |
---|
Bases: django.db.models.base.Model
This is the base model for assigned user service and cached user services. This are the real assigned services to users. DeployedService is the container (the group) of this elements.
Assigns this user deployed service to an user.
Used to invoke the Service class “Destroy” before deleting it from database.
The main purpuse of this hook is to call the “destroy” method of the object to delete and to clear related data of the object (environment data such as own storage, cache, etc...
Note: | If destroy raises an exception, the deletion is not taken. |
---|
Asks the UserServiceManager to cancel the current operation of this user deployed service.
Returns stored connection source data (ip & hostname)
Note: | If the transport did not notified this data, this may be “empty” |
---|
Returns an environment valid for the record this object represents.
In the case of the user, there is an instatiation of “generators”. Right now, there is two generators provided to child instance objects, that are valid for generating unique names and unique macs. In a future, there could be more generators
To access this generators, use the Envirnment class, and the keys ‘name’ and ‘mac’.
(see related classes uds.core.util.UniqueNameGenerator and uds.core.util.UniqueMacGenerator)
Instantiates the object this record contains. In this case, the instantiated object needs also the os manager and the publication, so we also instantiate those here.
Every single record of UserService model, represents an object.
Raises:
Returns the name of the user deployed service
Returns the unique id of the user deployed service
Return DeployedUserServices (not deployed services) that this user owns and are assignable For this to happen, we locate all user services assigned to this user, and we keep those that: * Must assign service manually This method is probably slow, but i don’t think a user will have more than a bunch of services assigned @returns and array of dicts with id, name and transports
Returns if this service is in preparation (not ready to use, but in its way to be so...)
Returns if this service is ready (not preparing or marked for removal)
Returns if this service is usable
Moves cache items betwen levels, managed directly
Before accessing a service by a transport, we can request the service to “transform” the username & password that the transport will use to connect to that service.
This method is here so transport USE it before using the username/password provided by user or by own transport configuration.
Note: | This method MUST be invoked by transport before using credentials passed to getHtml. |
---|
Recovers a value from custom storage
Mark this user deployed service for removal
Marks for removal or cancels it, depending on state
Notifies that the last access to this service was initiated from provided params
Set the “in_use” flag for this user deployed service
Note: | If the state is Fase (set to not in use), a check for removal of this deployed service is launched. |
---|
Updates the os state (state of the os) of this object and, optionally, saves it
state: new State to store at record
save: Defaults to true. If false, record will not be saved to db, just modified
Updates the state of this object and, optionally, saves it
state: new State to store at record
save: Defaults to true. If false, record will not be saved to db, just modified
Stores a value inside custom storage
If the os manager changes the username or the password, this will return True
Updates the data field with the serialized :py:class:uds.core.services.UserDeployment
Note: | This method do not saves the updated record, just updates the field |
---|