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 a Virtuozzo Container.

/// <summary>

/// Sample function. Suspends a Container.

/// </summary>

/// <param name="ve_eid">The 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 the Container Server ID.

        suspend_input.eid = ve_eid;

        // Suspend the Container.

        env.suspend(suspend_input);

        return "OK!";

    }

    catch (Exception e) {

        return "Exception: " + e.Message;

    }

}

  

/// <summary>

/// Sample function ResumeCT.

/// Resumes a Container that was previuosly suspended.

/// </summary>

/// <param name="ve_eid"></param>

/// <returns></returns>

public string ResumeCT(string ve_eid)

{

    try {

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

        resume1 resume_input = new resume1();

        //Set the Container 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