GetVncConsole() public method

public GetVncConsole ( string serverId ) : VncConsole
serverId string
return VncConsole
示例#1
0
        static void Main(string[] args)
        {
            string username = ""; // input your user name like gncu12345678
            string password = ""; // input your own password
            string tenantname = ""; // input your own tenant name like gnct12345678
            string tenantid = ""; // input your tenant id, which is 32 characters
            string region = "tyo1";

            var osm = new OpenStackMember(
               username,
               password,
               tenantname,
               tenantid,
               defaultregion: region,
               bLazyProviderSetting: false
               );

            var activeServer = osm.ListServers().FirstOrDefault(s => s.GetDetails().Status == ServerState.Active);
            if (activeServer != null)
            {
                Console.WriteLine(String.Format("{0} is active.", activeServer.Id));
                var console = osm.GetVncConsole(activeServer.Id);
                Console.WriteLine(console.Url);
                System.Diagnostics.Process.Start(console.Url);
            }
            else
            {
                Console.WriteLine("there is no active servers.");
            }
        }
示例#2
0
        public void TestMethod1()
        {
            var osm = new OpenStackMember(
            username,
            password,
            tenantname,
            tenantid,
            defaultregion: region,
            bLazyProviderSetting: false
            );

            var activeServer = osm.ListServers().FirstOrDefault(s => s.GetDetails().Status == ServerState.Active);
            if (activeServer != null)
            {
                Trace.WriteLine(String.Format("{0} is active.", activeServer.Id));
                var console = osm.GetVncConsole(activeServer.Id);
                Console.WriteLine(console.Url);
                System.Diagnostics.Process.Start(console.Url);
            }
            else
            {
                Console.WriteLine("there is no active servers.");
            }
        }
        public void GetVncConsoleTest_VM_Invalid()
        {
            var os = new OpenStackMember(UserName, Password, TenantName, TenantId);

            // expect ItemNotFoundException
            VncConsole v = os.GetVncConsole(InvalidId);
        }
 public void GetVncConsoleTest()
 {
     var osm = new OpenStackMember(UserName, Password, TenantName, TenantId);
     SimpleServer ss = osm.ListServers().FirstOrDefault(s => s.GetDetails().Status == ServerState.Active);
     VncConsole v = osm.GetVncConsole(ss.Id);
     Assert.IsNotNull(v);
 }