Esempio n. 1
0
  static void testMultiServer() {
    VirtualBoxManager mgr1 = VirtualBoxManager.createInstance(null);
    VirtualBoxManager mgr2 = VirtualBoxManager.createInstance(null);

    try {
      mgr1.connect("http://i7:18083", "", "");
      mgr2.connect("http://main:18083", "", "");

      IMachine m1 = mgr1.getVBox().getMachines().get(0);
      IMachine m2 = mgr2.getVBox().getMachines().get(0);
      String name1 = m1.getName();
      String name2 = m2.getName();
      ISession session1 = mgr1.getSessionObject();
      ISession session2 = mgr2.getSessionObject();
      IProgress p1 = m1.launchVMProcess(session1, "gui", "");
      IProgress p2 = m2.launchVMProcess(session2, "gui", "");
      progressBar(mgr1, p1, 10000);
      progressBar(mgr2, p2, 10000);
      session1.unlockMachine();
      session2.unlockMachine();
    } finally {
      mgr1.cleanup();
      mgr2.cleanup();
    }
  }
Esempio n. 2
0
  static void testStart(VirtualBoxManager mgr, IVirtualBox vbox) {
    IMachine m = vbox.getMachines().get(0);
    String name = m.getName();
    System.out.println("\nAttempting to start VM '" + name + "'");

    ISession session = mgr.getSessionObject();
    IProgress p = m.launchVMProcess(session, "gui", "");
    progressBar(mgr, p, 10000);
    session.unlockMachine();
  }