velaware Posted February 20, 2014 Report Posted February 20, 2014 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! Michael, MemoryX2 and ADelmerlope 3 Quote
Paul Posted February 20, 2014 Report Posted February 20, 2014 Awesome, thanks for the contribution. I've added a note to CORE-1036, we'll review your implementation. MemoryX2 and Michael 2 Quote
Tyson Posted March 20, 2014 Report Posted March 20, 2014 This contribution will be in the SolusVM module for Blesta v3.2+. Michael 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.