// vzctl is retarded enough to return exit status 0 when the command fails because the container isn't running, so we'll have to check the stderr for specific error string(s) as well. come on guys, it's 2012.
/* vzctl is retarded enough to return code 0 when the command fails because the container isn't running,
* so we'll have to check stderr for specific error strings as well. Come on guys, it's 2012. */
if($result->returncode == 0 && strpos($result->stderr, "Unable to stop") === false)
if($result->returncode == 0 && strpos($result->stderr, "Unable to stop") === false)
{
{
$this->uStatus = CVM_STATUS_STOPPED;
$this->uStatus = CVM_STATUS_STOPPED;
@ -527,7 +528,7 @@ class Container extends CPHPDatabaseRecordClass
}
}
else
else
{
{
throw new ContainerStopException($result->stderr, $result->returncode, $this->sInternalId);
throw new VpsStopException($result->stderr, $result->returncode, $this->sInternalId);
}
}
}
}
}
}
@ -542,14 +543,14 @@ class Container extends CPHPDatabaseRecordClass
$this->uStatus = CVM_STATUS_SUSPENDED;
$this->uStatus = CVM_STATUS_SUSPENDED;
$this->InsertIntoDatabase();
$this->InsertIntoDatabase();
}
}
catch (ContainerStopException $e)
catch (VpsStopException $e)
{
{
throw new ContainerSuspendException("Suspension failed as the VPS could not be stopped.", 1, $this->sInternalId, $e);
throw new VpsSuspendException("Suspension failed as the VPS could not be stopped.", 1, $this->sInternalId, $e);
}
}
}
}
else
else
{
{
throw new ContainerSuspendException("The VPS is already suspended.", 1, $this->sInternalId);
throw new VpsSuspendException("The VPS is already suspended.", 1, $this->sInternalId);
}
}
}
}
@ -563,14 +564,14 @@ class Container extends CPHPDatabaseRecordClass
$this->uStatus = CVM_STATUS_STARTED;
$this->uStatus = CVM_STATUS_STARTED;
$this->InsertIntoDatabase();
$this->InsertIntoDatabase();
}
}
catch (ContainerStartException $e)
catch (VpsStartException $e)
{
{
throw new ContainerUnsuspendException("Unsuspension failed as the VPS could not be started.", 1, $this->sInternalId, $e);
throw new VpsUnsuspendException("Unsuspension failed as the VPS could not be started.", 1, $this->sInternalId, $e);
}
}
}
}
else
else
{
{
throw new ContainerUnsuspendException("The VPS is not suspended.", 1, $this->sInternalId);
throw new VpsUnsuspendException("The VPS is not suspended.", 1, $this->sInternalId);
}
}
}
}
@ -586,7 +587,7 @@ class Container extends CPHPDatabaseRecordClass
}
}
else
else
{
{
throw new ContainerIpAddException($result->stderr, $result->returncode, $this->sInternalId);
throw new VpsIpAddException($result->stderr, $result->returncode, $this->sInternalId);
}
}
}
}
@ -602,7 +603,7 @@ class Container extends CPHPDatabaseRecordClass
}
}
else
else
{
{
throw new ContainerIpRemoveException($result->stderr, $result->returncode, $this->sInternalId);
throw new VpsIpRemoveException($result->stderr, $result->returncode, $this->sInternalId);
}
}
}
}
@ -642,7 +643,7 @@ class Container extends CPHPDatabaseRecordClass
}
}
else
else
{
{
throw new ContainerTrafficRetrieveException($result->stderr, $result->returncode, $this->sInternalId);
throw new VpsTrafficRetrieveException($result->stderr, $result->returncode, $this->sInternalId);
}
}
}
}
@ -650,11 +651,11 @@ class Container extends CPHPDatabaseRecordClass
{
{
if($this->sStatus == CVM_STATUS_SUSPENDED)
if($this->sStatus == CVM_STATUS_SUSPENDED)
{
{
throw new ContainerSuspendedException("The root password cannot be changed, because the VPS is suspended.", 1, $this->sInternalId);
throw new VpsSuspendedException("The root password cannot be changed, because the VPS is suspended.", 1, $this->sInternalId);
}
}
elseif($this->sStatus == CVM_STATUS_TERMINATED)
elseif($this->sStatus == CVM_STATUS_TERMINATED)
{
{
throw new ContainerTerminatedException("The root password cannot be changed, because the VPS is terminated.", 1, $this->sInternalId);
throw new VpsTerminatedException("The root password cannot be changed, because the VPS is terminated.", 1, $this->sInternalId);