3 Replies Latest reply on Apr 23, 2012 3:00 AM by TrungNguyenHCM

    PowerOn VM failse with error 3008-Cannot connect to the virtual machine

    TrungNguyenHCM Lurker

      Hello,

       

      (I am sorry about my English) I am using VIX1.11 to start VM on ESXi5.0 host. The PowerOn() has always been failing for me with error "3008 Cannot connect to the virtual machine".However the VM still Power On. I also looked up some discussions already on this site but it just wont work for me. Could you please help me get it working?.

       

      My code as bellow:

       

                     //connec to esxi5.0 - work well

                     UInt64 err;
                      VixCOM.VixLibClass lib = new VixCOM.VixLibClass();
                      job = lib.Connect(
                          Constants.VIX_API_VERSION,
                          VixCom.Constants.VIX_SERVICEPROVIDER_VMWARE_VI_SERVER,
                          hostName,
                          hostPort,
                          userName,
                          password,
                          0,
                          null,
                          null
                          );
                      err = job.Wait(new int[] { VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE },
                                 ref Results);
                      if (lib.ErrorIndicatesFailure(err))
                      {
                               ;
                      }
                      IHost host = (VixCOM.IHost)((object[])Results)[0];

       

                     //open vm - work well

                     job = host.RegisterVM(vmPath, null);

                      err = job.WaitWithoutResults();

                      if (lib.ErrorIndicatesFailure(err))

                      {

                          ;

                      }

                      job = host.OpenVM(vmPath, null);

                      err = job.Wait(new int[] { VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE },

                                     ref Results);

                      if (lib.ErrorIndicatesFailure(err))

                      {

                          ;

                      }

       

                      IVM2 vm = (VixCOM.IVM2)((object[])Results)[0];

       

                     //start vm - work with error 3008

                     job = vm.PowerOn(VixCOM.Constants.VIX_VMPOWEROP_LAUNCH_GUI, null, null);

                      err = job.WaitWithoutResults();

                      if (lib.ErrorIndicatesFailure(err))

                      {

                          ;

                      }