VMware {code} Community
TrungNguyenHCM
Contributor
Contributor

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

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))

                {

                    ;

                }

0 Kudos
3 Replies
lemke
VMware Employee
VMware Employee

It may be a firewall issue.  Can your client reach port 902 on the ESX system?

TrungNguyenHCM
Contributor
Contributor

Thanks Lemke for your anwser but the firewall is off on client and ESXi server.

0 Kudos
TrungNguyenHCM
Contributor
Contributor

Hi all,

The error appear because my ESXi server did not support virtual machine 64 bit.

0 Kudos