Jump to content

Make Solusvm Module Properly (Un)Suspend Vserver


velaware

Recommended Posts

While doing work for a client, one of the requests was to make it so the SolusVM module properly (un)suspends a virtual server, instead of shutting down/starting up (which the client could then easily reverse if they wanted via SolusVM CP).  The fix to this is actually pretty simple, so I thought I'd share it!

 

This assumes you're running Blesta v3.1.1 with no changes made to the module:

 

Open /path/to/blesta/components/module/solusvm/solusvm.php in your favorite text editor, and look for line 482:

$this->log($row->meta->host . "|vserver-shutdown", serialize($params), "input", true);
$response = $this->parseResponse($server_api->shutdown($params), $row);

Now, here we want to edit both references of "shutdown" to "suspend" like so:

$this->log($row->meta->host . "|vserver-suspend", serialize($params), "input", true);
$response = $this->parseResponse($server_api->suspend($params), $row);

To unsuspend it we just use go to the unsuspendService function and look for this (around #526):

$this->log($row->meta->host . "|vserver-boot", serialize($params), "input", true);
$response = $this->parseResponse($server_api->boot($params), $row);

We want to replace "boot" with "unsuspend":

$this->log($row->meta->host . "|vserver-unsuspend", serialize($params), "input", true);
$response = $this->parseResponse($server_api->unsuspend($params), $row);

There you have it.  Suspendable SolusVM containers that clients can't just start back up!

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...