Previous page

Next page

Locate page in Contents

Print this page

Suspending and Resuming a Container

The following two examples show how to suspend and then resume the operation of a Virtuozzo Container.

/// <summary>

/// Sample function SuspendCT.

/// Suspends a VE.

/// </summary>

/// <param name="ve_eid">Server ID of the Container.</param>

/// <returns>"OK" or error information.</returns>

public string SuspendCT(string ve_eid)

{

    try {

        vzaenvmBinding env = (vzaenvmBinding)binder.InitBinding(typeof(vzaenvmBinding));

        suspend1 suspend_input = new suspend1();

        // Set Server ID.

        suspend_input.eid = ve_eid;

  

        // Suspend Container.

        env.suspend(suspend_input);

  

        return "OK!";

    }

    catch (Exception e) {

        return "Exception: " + e.Message;

    }

}

    

/// <summary>

/// Sample function ResumeVE.

/// Resumes a Container that was previuosly suspended.

/// </summary>

/// <param name="ve_eid">Server ID of the Container.</param>

/// <returns></returns>

public string ResumeVE(string ve_eid)

{

    try {

        vzaenvmBinding env = (vzaenvmBinding)binder.InitBinding(typeof(vzaenvmBinding));

        resume1 resume_input = new resume1();

  

        // Set Server ID.

        resume_input.eid = ve_eid;

    

        // Resume Container.

        env.resume(resume_input);

    

        return "OK!";

    }

    catch (Exception e) {

        return "Exception: " + e.Message;

    }

}

Please send us your feedback on this help page