public void Logout() { Debug.Assert((state & VMSTATE.login) != 0); Program.WaitJob(((IVM)handle).LogoutFromGuest(null), false); Debug.WriteLine("logged out"); state &= ~VMSTATE.login; }
public void Login(string username, string password) { IVM hvm = (IVM)handle; Debug.WriteLine("wait for vmware-tools...", name); // Program.WaitJob(hvm.PowerOn(Constants.VIX_VMPOWEROP_LAUNCH_GUI, null, null), false); if (!((POWERSTATE)props["power"]).HasFlag(POWERSTATE.on)) { Debug.Assert(false, "PowerState must be ON", "{0} power_state = {1}", name, (POWERSTATE)props["power"]); } Program.WaitJob(hvm.WaitForToolsInGuest(3, null), false); Debug.WriteLine("login...", name); Program.WaitJob(hvm.LoginInGuest(username, password, Constants.VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT, null), false); state |= VMSTATE.login; }
public void UpdateProps() { _props = new Dictionary <string, dynamic>(); int[] propids = new int[] { Constants.VIX_PROPERTY_VM_NUM_VCPUS, Constants.VIX_PROPERTY_VM_VMX_PATHNAME, Constants.VIX_PROPERTY_VM_MEMORY_SIZE, Constants.VIX_PROPERTY_VM_POWER_STATE, Constants.VIX_PROPERTY_VM_TOOLS_STATE, Constants.VIX_PROPERTY_VM_SUPPORTED_FEATURES }; object p = null; ulong err = handle.GetProperties(propids, ref p); object[] result = (object [])p; Debug.Assert(err == 0); _props["vcpu"] = (int)result[0]; _props["path"] = (string)result[1]; _props["mem"] = (int)result[2]; _props["power"] = Enum.Parse(typeof(POWERSTATE), ((int)result[3]).ToString()); _props["tool"] = (int)result[4]; _props["features"] = result[5]; _props["name"] = name; state = VMSTATE.run; }