diff --git a/frontend/classes/class.container.php b/frontend/classes/class.container.php index 4a4de25..ea36baf 100644 --- a/frontend/classes/class.container.php +++ b/frontend/classes/class.container.php @@ -112,6 +112,21 @@ class Container extends CPHPDatabaseRecordClass // TODO: throw exception for failed container creation } } + + public function Start() + { + $command = "vzctl start {$this->sInternalId}"; + $result = $this->sNode->ssh->RunCommand($command, false); + + if($result->returncode == 0) + { + return true; + } + else + { + // TODO: throw exception for failed container start + } + } } ?> diff --git a/frontend/includes/include.base.php b/frontend/includes/include.base.php index 265d80b..81b8145 100644 --- a/frontend/includes/include.base.php +++ b/frontend/includes/include.base.php @@ -14,6 +14,7 @@ $_CPHP = true; require("cphp/base.php"); require("include.exceptions.php"); +require("include.constants.php"); require("include.parsing.php"); require("classes/class.controller.php"); require("classes/class.container.php"); diff --git a/frontend/includes/include.constants.php b/frontend/includes/include.constants.php new file mode 100644 index 0000000..5c1f1eb --- /dev/null +++ b/frontend/includes/include.constants.php @@ -0,0 +1,26 @@ + diff --git a/frontend/test.php b/frontend/test.php index 7f7c9c5..f2ca17f 100644 --- a/frontend/test.php +++ b/frontend/test.php @@ -16,8 +16,13 @@ $settings['master_pubkey'] = "/etc/cvm/key.pub"; var_dump($sNode->sDiskFree, $sNode->sDiskUsed, $sNode->sRealHostname);*/ $sContainer = new Container(1); -$sContainer->Deploy(); +// $sContainer->Deploy(); // returncode 127 = failed (CT ID missing?) -pretty_dump($sContainer); + +$sContainer->Start(); + +echo("Done!"); + +//pretty_dump($sContainer); ?>