ServerManager
extends ServerManagerAbstraction
in package
This class will handle the comunication between our system and the Open Stack API system.
Table of Contents
- $errorLogName : string
- $warningLogName : string
- $apiVersion : string
- API Version
- $authenticationManager : AuthenticationManager
- The authentication manager, used to interact with Open Stack APIs
- $jobsLogName : string
- The name of the log in which we are going to log actions performed by jobs
- $passwordComplexity : int
- __construct() : mixed
- changePassword() : string
- This function will ask to Open Stack to set a new password for the root user.
- delete() : bool
- This function will send the delete request to the Open Stack API
- fromOpenStack() : Server
- Fill model from OpenStack
- getAuthenticationManager() : AuthenticationManager
- getConsoleVnc() : array<string|int, mixed>
- This functions asks OpenStack the VNC Console Url for the server
- getOpenStackServer() : Server
- hasChanged() : bool
- import() : Server
- logEntry() : Activity
- logEntryWithoutModel() : Activity
- logError() : Activity
- logWarning() : Activity
- pause() : bool
- Pause the OpenStack server instance
- reboot() : bool
- This function will ask to Open Stack to reboot the server.
- rebuild() : bool
- This function will ask to Open Stack to rebuild the server.
- refresh() : bool
- It refreshes the Bennu server instance with data retrieved from OpenStack remote
- resize() : bool
- This function asks OpenStack to start a resize action on the Server
- resizeConfirm() : bool
- This function asks OpenStack to confirm the resizing operation on the server
- resizeRevert() : bool
- retrieveOrImport() : Server
- setAuthenticationManager() : OpenStackObjectManager
- start() : bool
- Starts the OpenStack server instance
- stop() : bool
- Stops the OpenStack server instance
- toOpenStack() : Server
- Fill OpenStack from model
- toOpenStackArray() : array<string|int, mixed>
- Return an array to be used vs OpenStack
- unpause() : bool
- Pause the OpenStack server instance
- log() : array<string|int, Activity>
- create() : void
- This function will send the creation request to the Open Stack APi
- getComputeService() : Service
- update() : void
- This function will send the update request to the Open Stack API.
Properties
$errorLogName
public
static string
$errorLogName
= "error"
$warningLogName
public
static string
$warningLogName
= "warning"
$apiVersion
API Version
protected
static string
$apiVersion
= 'v1'
$authenticationManager
The authentication manager, used to interact with Open Stack APIs
protected
AuthenticationManager
$authenticationManager
$jobsLogName
The name of the log in which we are going to log actions performed by jobs
protected
string
$jobsLogName
= "jobs"
$passwordComplexity
private
int
$passwordComplexity
= 8
Tags
Methods
__construct()
public
__construct(AuthenticationManager $authenticationManager) : mixed
Parameters
- $authenticationManager : AuthenticationManager
Return values
mixed —changePassword()
This function will ask to Open Stack to set a new password for the root user.
public
changePassword(Server $server) : string
Parameters
- $server : Server
Tags
Return values
string —delete()
This function will send the delete request to the Open Stack API
public
delete(Server $server) : bool
Parameters
- $server : Server
Tags
Return values
bool —true or Exception if it fail
fromOpenStack()
Fill model from OpenStack
public
fromOpenStack(Server $server, Server $openStackServer) : Server
Parameters
- $server : Server
- $openStackServer : Server
Tags
Return values
Server —getAuthenticationManager()
public
getAuthenticationManager() : AuthenticationManager
Return values
AuthenticationManager —getConsoleVnc()
This functions asks OpenStack the VNC Console Url for the server
public
getConsoleVnc(Server $server) : array<string|int, mixed>
Parameters
- $server : Server
Tags
Return values
array<string|int, mixed> —getOpenStackServer()
public
getOpenStackServer(string $id[, bool $retrieve = false ]) : Server
Parameters
- $id : string
- $retrieve : bool = false
Tags
Return values
Server —hasChanged()
public
hasChanged(Server $server) : bool
Parameters
- $server : Server
Tags
Return values
bool —import()
public
import(string $external_id) : Server
Parameters
- $external_id : string
Tags
Return values
Server —logEntry()
public
static logEntry(Model $model, array<string|int, mixed> $properties, string $description, string $event, string $logName) : Activity
Parameters
- $model : Model
- $properties : array<string|int, mixed>
- $description : string
- $event : string
- $logName : string
Return values
Activity —logEntryWithoutModel()
public
static logEntryWithoutModel(array<string|int, mixed> $properties, string $description, string $event, string $logName) : Activity
Parameters
- $properties : array<string|int, mixed>
- $description : string
- $event : string
- $logName : string
Return values
Activity —logError()
public
static logError(Model $model, array<string|int, mixed> $properties, string $description, string $event) : Activity
Parameters
- $model : Model
- $properties : array<string|int, mixed>
- $description : string
- $event : string
Return values
Activity —logWarning()
public
static logWarning(Model $model, array<string|int, mixed> $properties, string $description, string $event) : Activity
Parameters
- $model : Model
- $properties : array<string|int, mixed>
- $description : string
- $event : string
Return values
Activity —pause()
Pause the OpenStack server instance
public
pause(Server $server) : bool
Parameters
- $server : Server
Tags
Return values
bool —reboot()
This function will ask to Open Stack to reboot the server.
public
reboot(Server $server[, bool $hardReboot = false ]) : bool
Parameters
- $server : Server
-
the server instance
- $hardReboot : bool = false
-
whether perform a hard reboot or a soft reboot
Tags
Return values
bool —true on success, false otherwise
rebuild()
This function will ask to Open Stack to rebuild the server.
public
rebuild(Server $server) : bool
The original image used to build the server will be used to rebuild it.
Parameters
- $server : Server
Tags
Return values
bool —refresh()
It refreshes the Bennu server instance with data retrieved from OpenStack remote
public
refresh(Server $server[, OperatorResource|null $openStackServer = null ][, bool $refreshStatus = true ]) : bool
Parameters
- $server : Server
-
the server instance
- $openStackServer : OperatorResource|null = null
-
the openstack server instance (optional)
- $refreshStatus : bool = true
Return values
bool —true on success, false otherwise
resize()
This function asks OpenStack to start a resize action on the Server
public
resize(Server $server, Flavor $flavor) : bool
Parameters
Tags
Return values
bool —true on success, false otherwise
resizeConfirm()
This function asks OpenStack to confirm the resizing operation on the server
public
resizeConfirm(Server $server) : bool
Parameters
- $server : Server
Tags
Return values
bool —true on success, false otherwise
resizeRevert()
public
resizeRevert(Server $server) : bool
Parameters
- $server : Server
Tags
Return values
bool —retrieveOrImport()
public
retrieveOrImport(string $external_id[, bool $refresh = false ][, bool $refreshStatus = true ]) : Server
Parameters
- $external_id : string
- $refresh : bool = false
- $refreshStatus : bool = true
Tags
Return values
Server —setAuthenticationManager()
public
setAuthenticationManager([AuthenticationManager|null $authenticationManager = null ]) : OpenStackObjectManager
Parameters
- $authenticationManager : AuthenticationManager|null = null
Return values
OpenStackObjectManager —start()
Starts the OpenStack server instance
public
start(Server $server) : bool
Parameters
- $server : Server
Tags
Return values
bool —true or Exception if it fail
stop()
Stops the OpenStack server instance
public
stop(Server $server) : bool
Parameters
- $server : Server
Tags
Return values
bool —toOpenStack()
Fill OpenStack from model
public
toOpenStack(Server $server, Server $openStackServer) : Server
Parameters
- $server : Server
- $openStackServer : Server
Return values
Server —toOpenStackArray()
Return an array to be used vs OpenStack
public
toOpenStackArray(Server $server) : array<string|int, mixed>
Parameters
- $server : Server
Return values
array<string|int, mixed> —unpause()
Pause the OpenStack server instance
public
unpause(Server $server) : bool
Parameters
- $server : Server
Tags
Return values
bool —log()
protected
log(Model|array<string|int, mixed> $models, array<string|int, mixed> $properties, string $description[, null $logName = null ]) : array<string|int, Activity>
Parameters
- $models : Model|array<string|int, mixed>
- $properties : array<string|int, mixed>
- $description : string
- $logName : null = null
Return values
array<string|int, Activity> —create()
This function will send the creation request to the Open Stack APi
private
create(Server $server) : void
Parameters
- $server : Server
Tags
Return values
void —getComputeService()
private
getComputeService() : Service
Return values
Service —update()
This function will send the update request to the Open Stack API.
private
update(Server $server) : void
As today this function will only change the Server name
Parameters
- $server : Server
Tags
Return values
void —void or Exception if it fail