Previous page

Next page

Locate page in Contents

Print this page

Restarting a Virtuozzo Container

The restart call from the vzaenvm interface is used to restart a Virtuozzo Container. The call accepts a single parameter: the Server ID of the Container to restart. We will use the Server ID of one of the Containers from the list that we retrieved in the previous step.

#XML message. Restarting a Container.

$request=qq~

<packet version="4.0.0" id="4">

  <target>vzaenvm</target>

  <data>

    <vzaenvm>

      <restart>

        <eid>e9ab2834-ed97-1f4b-bd41-81c27facfc30</eid>

      </restart>

    </vzaenvm>

  </data>

</packet>

~;

#Write the XML message to the socket.

$socket->printflush($request.&MSG_TERMINATOR);

#Read the response and display it on the screen.

$response = $socket->getline;

chomp($response);

print $response;

If the call succeeds, you should see an output similar to the following:

<packet id="4" time="2007-08-29T23:26:50+0000" priority="0" version="4.0.0">

  <origin>vzaenvm</origin>

  <target>vzclient27-4fce28dd-0cd3-1345-bb94-3192b940fb90</target>

  <dst>

    <director>gend</director>

  </dst>

  <data>

    <vzaenvm>

      <ok/>

    </vzaenvm>

  </data>

  <src>

    <director>gend</director>

  </src>

</packet>

The response is a standard Agent "OK" message, which is returned when an API call doesn't return any data. It simply means that the request executed successfully.

Please send us your feedback on this help page