Merge branch 'compute' into develop
This commit is contained in:
commit
b50d3cc788
1 changed files with 95 additions and 11 deletions
|
@ -224,31 +224,115 @@ class compute
|
|||
$this->app->setOutput("Success", $serverId." has been deleted successfully.");
|
||||
return;
|
||||
}
|
||||
/*
|
||||
public function changePassword($newPassword)
|
||||
/**
|
||||
* Change the password of a server
|
||||
* @return void
|
||||
*/
|
||||
public function changePassword()
|
||||
{
|
||||
//TODO
|
||||
$serverId = $this->app->getPostParam("serverId");
|
||||
$password = $this->app->getPostParam("newPassword");
|
||||
if(!isset($serverId) || !isset($password)){
|
||||
$this->app->setOutput("Error", "Server ID or new password missing.");
|
||||
return;
|
||||
}
|
||||
public function reboot($type = Enum::REBOOT_SOFT)
|
||||
$opt = array('id' => $serverId);
|
||||
$server = $this->libClass->getServer($opt);
|
||||
$server->changePassword($password);
|
||||
$this->app->setOutput("Success", "Password for ".$serverId." has been updated successfully.");
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Reboot a server
|
||||
* @return void
|
||||
*/
|
||||
public function reboot()
|
||||
{
|
||||
//TODO
|
||||
$serverId = $this->app->getPostParam("serverId");
|
||||
if(!isset($serverId)){
|
||||
$this->app->setOutput("Error", "Server ID is missing, son!");
|
||||
return;
|
||||
}
|
||||
public function rebuild(array $options)
|
||||
$opt = array('id' => $serverId);
|
||||
$server = $this->libClass->getServer($opt);
|
||||
$server->reboot();
|
||||
$this->app->setOutput("Success", $serverId." has been deleted successfully.");
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Rebuild a server
|
||||
* @return void
|
||||
*/
|
||||
public function rebuild()
|
||||
{
|
||||
//TODO
|
||||
$serverId = $this->app->getPostParam("serverId");
|
||||
$imageId = $this->app->getPostParam("imageId");
|
||||
$newName = $this->app->getPostParam("newName");
|
||||
$adminPass = $this->app->getPostParam("adminPass");
|
||||
if(!isset($serverId)|| !isset($imageId) || isset($newName) || isset($adminPass)) ){
|
||||
$this->app->setOutput("Error", "You'll have to provide server ID and the new image, name and admin password!");
|
||||
return;
|
||||
}
|
||||
public function resize($flavorId)
|
||||
$opt = array('id' => $serverId);
|
||||
$server = $this->libClass->getServer($opt);
|
||||
$attr = array('imageId' => $imageId, 'name' => $newName, 'adminPass' => $adminPass);
|
||||
$server->rebuild($attr);
|
||||
$this->app->setOutput("Success", $serverId." has been rebuilt successfully with the new image.");
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Resize a server
|
||||
* A call to this method has to be followed by either confirmResize or revertResize
|
||||
* @return void
|
||||
*/
|
||||
public function resize()
|
||||
{
|
||||
//TODO
|
||||
$serverId = $this->app->getPostParam("serverId");
|
||||
$newFlavorId = $this->app->getPostParam("newFlavorId");
|
||||
if(!isset($serverId)|| !isset($flavorId)){
|
||||
$this->app->setOutput("Error", "You'll have to provide server ID and the new flavor ID!");
|
||||
return;
|
||||
}
|
||||
$opt = array('id' => $serverId);
|
||||
$server = $this->libClass->getServer($opt);
|
||||
$server->resize($newFlavorId);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Confirm resize operation on a server
|
||||
* @return void
|
||||
*/
|
||||
public function confirmResize()
|
||||
{
|
||||
//TODO
|
||||
$serverId = $this->app->getPostParam("serverId");
|
||||
if(!isset($serverId)){
|
||||
$this->app->setOutput("Error", "Server ID is missing!");
|
||||
return;
|
||||
}
|
||||
$opt = array('id' => $serverId);
|
||||
$server = $this->libClass->getServer($opt);
|
||||
$server->confirmResize();
|
||||
$this->app->setOutput("Success", $serverId." has been resized successfully as the new flavor.");
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Revert resize operation on a server
|
||||
* @return void
|
||||
*/
|
||||
public function revertResize()
|
||||
{
|
||||
//TODO
|
||||
$serverId = $this->app->getPostParam("serverId");
|
||||
if(!isset($serverId)){
|
||||
$this->app->setOutput("Error", "Server ID is missing!");
|
||||
return;
|
||||
}
|
||||
$opt = array('id' => $serverId);
|
||||
$server = $this->libClass->getServer($opt);
|
||||
$server->revertResize();
|
||||
$this->app->setOutput("Success", $serverId." : resize operation has been reverted to the old flavor.");
|
||||
return;
|
||||
}
|
||||
/*
|
||||
public function createImage(array $options)
|
||||
{
|
||||
//TODO
|
||||
|
|
Loading…
Add table
Reference in a new issue