GetVncConsole() public method

public GetVncConsole ( string serverId ) : VncConsole
serverId string
return VncConsole
コード例 #1
0
ファイル: Program.cs プロジェクト: crowdy/OpenStack-ConoHa
        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
ファイル: UnitTest.cs プロジェクト: crowdy/OpenStack-ConoHa
        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.");
            }
        }
コード例 #3
0
        public void GetVncConsoleTest_VM_Invalid()
        {
            var os = new OpenStackMember(UserName, Password, TenantName, TenantId);

            // expect ItemNotFoundException
            VncConsole v = os.GetVncConsole(InvalidId);
        }
コード例 #4
0
 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);
 }