示例#1
0
        public bool Initialize(ProxyTaskInfo ptI)
        {
            if (ptI.Node == null || ptI.Hypervisor == null)
            {
                return(false);
            }
            proxyInfo      = ptI;
            vmwh           = new VMWareHandler();
            vmwh.LogEvent += new EventHandler <LogEventArgs>(this.LogReceivedEvent);

            vddk           = new VDDK.VDDK(Environment.OSVersion.Platform == PlatformID.Unix);
            vddk.LogEvent += new EventHandler <LogEventArgs>(this.LogReceivedEvent);            //new VDDK.LogHandler(this.LogReceived);
            // Force log to be suscribed to
            if (this.LogEvent == null)
            {
                throw new Exception("Must suscribe to LogEvent");
            }
            return(true);
        }
示例#2
0
        public void SetItems(List <string> spoPaths)
        {
            VMWareHandler vmwh = new VMWareHandler();

            try{
                vmwh.Connect(pti.Hypervisor.Url, pti.Hypervisor.UserName, pti.Hypervisor.Password.Value);
                VirtualMachineConfigInfo vmci = vmwh.GetVmConfig(pti.Node);
                System.IO.MemoryStream   ms   = new System.IO.MemoryStream();
                BinaryFormatter          bf   = new BinaryFormatter();
                bf.Serialize(ms, vmci);
                ms.Flush();
                Console.WriteLine("VMWareSPO serialized vm config called ");
                //serialize vmci to Metadata!!!
                this.Metadata = new SPOMetadata();
                this.Metadata.Metadata.Add(pti.Node.InternalId, ms.ToArray());
            }
            catch (Exception e) {
                if (LogEvent != null)
                {
                    LogEvent(this, new LogEventArgs(850, Severity.WARNING, e.Message));
                }
                Console.WriteLine("VMWareSPO error : " + e.ToString());
            }
        }