コード例 #1
0
        public VimDatastoreItem[] FindDatastoreItemsInFolder(string folderName, VimClientlContext ctx)
        {
            if (this.snapshotDiskPattern == null)
            {
                this.snapshotDiskPattern = new Regex("w*-[0-9][0-9][0-9][0-9][0-9][0-9]w*");
            }
            List <VimDatastoreItem>           vimDatastoreItemList   = new List <VimDatastoreItem>();
            HostDatastoreBrowserSearchResults datastoreSearchResults = this.GetDatastoreSearchResults(VCService.GetVolumeName(this.Name) + folderName, ctx);

            if (datastoreSearchResults != null && datastoreSearchResults.file != null && datastoreSearchResults.file.Length != 0)
            {
                foreach (VimApi.FileInfo fileInfo in datastoreSearchResults.file)
                {
                    VimDatastoreItem vimDatastoreItem = new VimDatastoreItem()
                    {
                        Name = fileInfo.path, Size = fileInfo.fileSize
                    };
                    if (fileInfo is FolderFileInfo)
                    {
                        vimDatastoreItem.Type = "FOLDER";
                    }
                    else if (fileInfo is VmDiskFileInfo && !this.snapshotDiskPattern.IsMatch(fileInfo.path))
                    {
                        vimDatastoreItem.Type = "VMDK";
                    }
                    else
                    {
                        continue;
                    }
                    vimDatastoreItemList.Add(vimDatastoreItem);
                }
            }
            return(vimDatastoreItemList.ToArray());
        }
コード例 #2
0
        public bool FileExist(string fullName, VimClientlContext ctx)
        {
            fullName = fullName.Replace("\\", "/");
            string str1 = fullName.Substring(0, fullName.LastIndexOf("/"));
            string str2 = fullName.Substring(fullName.LastIndexOf("/") + 1);

            HostDatastoreBrowserSearchResults[] browserSearchResultsArray = (HostDatastoreBrowserSearchResults[])null;
            Task task = new Task(this.VcService, this.VcService.Service.SearchDatastoreSubFolders_Task(this.GetManagedObjects(new string[1] {
                "browser"
            })[0], this.GetVolumeName(this.Name) + str1.Trim("/".ToCharArray()), new HostDatastoreBrowserSearchSpec()
            {
                matchPattern = new string[1] {
                    str2
                }, searchCaseInsensitive = true, searchCaseInsensitiveSpecified = true, sortFoldersFirst = true, sortFoldersFirstSpecified = true
            }));
            string            op     = "Browse Datastore";
            VimClientlContext rstate = ctx;

            task.WaitForResult(op, rstate);
            string[] properties1 = new string[1] {
                "info.result"
            };
            Dictionary <string, object> properties2 = task.GetProperties(properties1);

            if (properties2.ContainsKey("info.result"))
            {
                browserSearchResultsArray = (HostDatastoreBrowserSearchResults[])properties2["info.result"];
            }
            return(browserSearchResultsArray != null && browserSearchResultsArray.Length != 0 && browserSearchResultsArray[0].file != null);
        }
コード例 #3
0
 public void DeleteFile(string filePath, VimClientlContext ctx)
 {
     filePath = filePath.Replace("\\", "/");
     this.VcService.Service.DeleteFile(this.GetManagedObjects(new string[1] {
         "browser"
     })[0], filePath);
 }
コード例 #4
0
        public string[] GetVmdksFullName(string folderName, VimClientlContext ctx)
        {
            List <string> stringList = new List <string>();
            string        str1       = VimUtils.GetVolumeName(this.Name) + folderName;

            HostDatastoreBrowserSearchResults[] browserSearchResults1 = this.GetBrowserSearchResults(str1, ctx);
            if (browserSearchResults1 != null && browserSearchResults1.Length != 0)
            {
                foreach (HostDatastoreBrowserSearchResults browserSearchResults2 in browserSearchResults1)
                {
                    string strA = browserSearchResults2.folderPath.TrimEnd('/');
                    if (browserSearchResults2.file != null && string.Compare(strA, str1, true) == 0)
                    {
                        foreach (VimApi.FileInfo fileInfo in browserSearchResults2.file)
                        {
                            string pattern = "w*-[0-9][0-9][0-9][0-9][0-9][0-9]w*";
                            if (!Regex.Match(fileInfo.path, pattern, RegexOptions.IgnoreCase).Success)
                            {
                                string str2 = browserSearchResults2.folderPath + fileInfo.path;
                                if (!stringList.Contains(str2))
                                {
                                    stringList.Add(browserSearchResults2.folderPath + fileInfo.path);
                                }
                            }
                        }
                        break;
                    }
                }
            }
            return(stringList.ToArray());
        }
コード例 #5
0
        public bool Invoke()
        {
            if (this._GetAllVmsIndexedByName().ContainsKey(this._Context.JobInfoWrapper.VmName))
            {
                return(true);
            }
            IVimDatastore     replicaVmDatastore = this._GetVmDatastore();
            VimClientlContext vimClientlContext  = (VimClientlContext) new OculiServiceVimCallContext();
            string            replicaVmName      = this._Context.JobInfoWrapper.VmName;
            VimClientlContext ctx = vimClientlContext;

            return(replicaVmDatastore.IsFolderOnRootExist(replicaVmName, ctx));
        }
コード例 #6
0
        public Dictionary <string, VimDatastoreItem[]> FindDatastoreItems(VimClientlContext ctx)
        {
            if (this.snapshotDiskPattern == null)
            {
                this.snapshotDiskPattern = new Regex("w*-[0-9][0-9][0-9][0-9][0-9][0-9]w*");
            }
            Dictionary <string, VimDatastoreItem[]> dictionary = new Dictionary <string, VimDatastoreItem[]>((IEqualityComparer <string>)StringComparer.CurrentCultureIgnoreCase);

            HostDatastoreBrowserSearchResults[] datastoreSearchResults = this.GetDatastoreSearchResults(ctx);
            int length = VCService.GetVolumeName(this.Name).Length;

            if (datastoreSearchResults != null && datastoreSearchResults.Length != 0)
            {
                foreach (HostDatastoreBrowserSearchResults browserSearchResults in datastoreSearchResults)
                {
                    string str = browserSearchResults.folderPath.TrimEnd('/');
                    if (length > str.Length)
                    {
                        length = str.Length;
                    }
                    string key = str.Remove(0, length);
                    List <VimDatastoreItem> vimDatastoreItemList = new List <VimDatastoreItem>();
                    if (browserSearchResults.file != null)
                    {
                        foreach (VimApi.FileInfo fileInfo in browserSearchResults.file)
                        {
                            VimDatastoreItem vimDatastoreItem = new VimDatastoreItem()
                            {
                                Name = fileInfo.path, Size = fileInfo.fileSize
                            };
                            if (fileInfo is FolderFileInfo)
                            {
                                vimDatastoreItem.Type = "FOLDER";
                            }
                            else if (fileInfo is VmDiskFileInfo && !this.snapshotDiskPattern.IsMatch(fileInfo.path))
                            {
                                vimDatastoreItem.Type = "VMDK";
                            }
                            else
                            {
                                continue;
                            }
                            vimDatastoreItemList.Add(vimDatastoreItem);
                        }
                    }
                    dictionary.Add(key, vimDatastoreItemList.ToArray());
                }
            }
            return(dictionary);
        }
コード例 #7
0
        private HostDatastoreBrowserSearchResults[] GetDatastoreSearchResults(VimClientlContext ctx)
        {
            string volumeName = VCService.GetVolumeName(this.Name);

            HostDatastoreBrowserSearchResults[] browserSearchResultsArray = (HostDatastoreBrowserSearchResults[])null;
            ManagedObjectReference[]            managedObjects            = this.GetManagedObjects(new string[1] {
                "browser"
            });
            HostDatastoreBrowserSearchSpec searchSpec = new HostDatastoreBrowserSearchSpec();

            searchSpec.matchPattern = new string[1] {
                "*.vmdk"
            };
            searchSpec.searchCaseInsensitive          = true;
            searchSpec.searchCaseInsensitiveSpecified = true;
            searchSpec.sortFoldersFirst               = true;
            searchSpec.sortFoldersFirstSpecified      = true;
            searchSpec.searchCaseInsensitiveSpecified = true;
            searchSpec.details                    = new FileQueryFlags();
            searchSpec.details.fileSize           = true;
            searchSpec.details.fileOwner          = false;
            searchSpec.details.fileType           = true;
            searchSpec.details.fileOwnerSpecified = true;
            searchSpec.query = new FileQuery[3]
            {
                (FileQuery) new FolderFileQuery(),
                (FileQuery) new VmDiskFileQuery(),
                new FileQuery()
            };
            Task              task   = new Task(this.VcService, this.VcService.Service.SearchDatastoreSubFolders_Task(managedObjects[0], volumeName, searchSpec));
            string            op     = "Search Datastore";
            VimClientlContext rstate = ctx;

            task.WaitForResult(op, rstate);
            string[] properties1 = new string[1] {
                "info.result"
            };
            Dictionary <string, object> properties2 = task.GetProperties(properties1);

            if (properties2.ContainsKey("info.result"))
            {
                browserSearchResultsArray = (HostDatastoreBrowserSearchResults[])properties2["info.result"];
            }
            return(browserSearchResultsArray);
        }
コード例 #8
0
        public Dictionary <string, VmdkFileInfo> GetVmdksFileInfo(string fullName, VimClientlContext ctx)
        {
            fullName = fullName.Replace("\\", "/");
            string str1     = fullName.Substring(0, fullName.LastIndexOf("/"));
            string fileName = Path.GetFileName(fullName);
            Dictionary <string, VmdkFileInfo> dictionary = new Dictionary <string, VmdkFileInfo>((IEqualityComparer <string>)StringComparer.InvariantCultureIgnoreCase);

            try
            {
                string str2 = VCService.GetVolumeName(this.Name) + str1;
                HostDatastoreBrowserSearchResults[] browserSearchResults1 = this.GetBrowserSearchResults(str2, ctx);
                if (browserSearchResults1 != null)
                {
                    if (browserSearchResults1.Length != 0)
                    {
                        foreach (HostDatastoreBrowserSearchResults browserSearchResults2 in browserSearchResults1)
                        {
                            string strA = browserSearchResults2.folderPath.TrimEnd('/');
                            if (browserSearchResults2.file != null && string.Compare(strA, str2, true) == 0)
                            {
                                foreach (VimApi.FileInfo fileInfo in browserSearchResults2.file)
                                {
                                    if (!dictionary.ContainsKey(fileInfo.path))
                                    {
                                        dictionary.Add(fileInfo.path, new VmdkFileInfo(fileInfo.path, browserSearchResults2.folderPath, (ulong)fileInfo.fileSize));
                                        if (dictionary[fileInfo.path].Name != fileName)
                                        {
                                            dictionary.Remove(fileInfo.path);
                                        }
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(dictionary);
        }
コード例 #9
0
        private HostDatastoreBrowserSearchResults GetDatastoreSearchResults(string datastorePath, VimClientlContext ctx)
        {
            HostDatastoreBrowserSearchResults browserSearchResults = (HostDatastoreBrowserSearchResults)null;

            ManagedObjectReference[] managedObjects = this.GetManagedObjects(new string[1] {
                "browser"
            });
            HostDatastoreBrowserSearchSpec searchSpec = new HostDatastoreBrowserSearchSpec();
            VmDiskFileQuery vmDiskFileQuery           = new VmDiskFileQuery();

            vmDiskFileQuery.details            = new VmDiskFileQueryFlags();
            vmDiskFileQuery.details.capacityKb = true;
            searchSpec.details                    = new FileQueryFlags();
            searchSpec.details.fileSize           = true;
            searchSpec.details.fileOwner          = false;
            searchSpec.details.fileOwner          = false;
            searchSpec.details.fileType           = true;
            searchSpec.details.fileOwnerSpecified = true;
            searchSpec.query = new FileQuery[2]
            {
                (FileQuery) new FolderFileQuery(),
                (FileQuery)vmDiskFileQuery
            };
            Task              task   = new Task(this.VcService, this.VcService.Service.SearchDatastore_Task(managedObjects[0], datastorePath, searchSpec));
            string            op     = "Search Datastore";
            VimClientlContext rstate = ctx;

            task.WaitForResult(op, rstate);
            string[] properties1 = new string[1] {
                "info.result"
            };
            Dictionary <string, object> properties2 = task.GetProperties(properties1);

            if (properties2.ContainsKey("info.result"))
            {
                browserSearchResults = (HostDatastoreBrowserSearchResults)properties2["info.result"];
            }
            return(browserSearchResults);
        }
コード例 #10
0
ファイル: Task.cs プロジェクト: phspies/OculiService
 public void WaitForResult(string op, VimClientlContext rstate)
 {
     if (this._logger != null)
     {
         this._logger.Verbose("WaitForResult: start, op: " + op, "Task");
     }
     object[] objArray = this.WaitForValues(rstate, new string[3] {
         "info.state", "info.error", "info.progress"
     }, new string[1] {
         "state"
     }, new object[1][] { new object[2] {
                              (object)TaskInfoState.success, (object)TaskInfoState.error
                          } });
     if (objArray[0].Equals((object)TaskInfoState.success))
     {
         if (this._logger == null)
         {
             return;
         }
         this._logger.Verbose("WaitForResult: success, op: " + op, "Task");
     }
     else
     {
         if (objArray.Length > 1 && objArray[1] != null)
         {
             if (this._logger != null)
             {
                 this._logger.Verbose("WaitForResult: LocalizedMethodFault: " + ((LocalizedMethodFault)objArray[1]).localizedMessage + ", op: " + op, "Task");
             }
             throw new EsxException(((LocalizedMethodFault)objArray[1]).localizedMessage, true);
         }
         if (this._logger != null)
         {
             this._logger.Verbose("WaitForResult: unknown fault, op: " + op, "Task");
         }
         throw new EsxException("WaitForResult: Unknown error returned by Vim", true);
     }
 }
コード例 #11
0
        public Dictionary <string, List <VmdkFileInfo> > GetAllFoldersAndFilesInfo(VimClientlContext ctx)
        {
            Dictionary <string, List <VmdkFileInfo> > dictionary = new Dictionary <string, List <VmdkFileInfo> >((IEqualityComparer <string>)StringComparer.InvariantCultureIgnoreCase);
            string volumeName = VimUtils.GetVolumeName(this.Name);

            HostDatastoreBrowserSearchResults[] browserSearchResults1 = this.GetBrowserSearchResults(volumeName, ctx);
            if (browserSearchResults1 != null && browserSearchResults1.Length != 0)
            {
                foreach (HostDatastoreBrowserSearchResults browserSearchResults2 in browserSearchResults1)
                {
                    string str    = browserSearchResults2.folderPath.TrimEnd('/');
                    int    length = volumeName.Length;
                    if (length > str.Length)
                    {
                        length = str.Length;
                    }
                    string key = str.Remove(0, length);
                    List <VmdkFileInfo> vmdkFileInfoList = new List <VmdkFileInfo>();
                    if (browserSearchResults2.file != null)
                    {
                        foreach (VimApi.FileInfo fileInfo in browserSearchResults2.file)
                        {
                            string pattern = "w*-[0-9][0-9][0-9][0-9][0-9][0-9]w*";
                            if (!Regex.Match(fileInfo.path, pattern, RegexOptions.IgnoreCase).Success)
                            {
                                vmdkFileInfoList.Add(new VmdkFileInfo(fileInfo.path, browserSearchResults2.folderPath, (ulong)fileInfo.fileSize));
                            }
                        }
                    }
                    if (!dictionary.ContainsKey(key))
                    {
                        dictionary.Add(key, vmdkFileInfoList);
                    }
                }
            }
            return(dictionary);
        }
コード例 #12
0
        public bool IsFolderOnRootExist(string folderName, VimClientlContext ctx)
        {
            Task task = new Task(this.VcService, this.VcService.Service.SearchDatastoreSubFolders_Task(this.GetManagedObjects(new string[1] {
                "browser"
            })[0], VimUtils.GetVolumeName(this.Name), new HostDatastoreBrowserSearchSpec()
            {
                matchPattern = new string[1] {
                    folderName
                }, searchCaseInsensitive = true, searchCaseInsensitiveSpecified = true
            }));
            string            op     = "Browse Datastore";
            VimClientlContext rstate = ctx;

            task.WaitForResult(op, rstate);
            string[] properties1 = new string[1] {
                "info.result"
            };
            Dictionary <string, object> properties2 = task.GetProperties(properties1);

            if (properties2.ContainsKey("info.result"))
            {
                HostDatastoreBrowserSearchResults[] browserSearchResultsArray = (HostDatastoreBrowserSearchResults[])properties2["info.result"];
                if (browserSearchResultsArray != null && browserSearchResultsArray.Length != 0)
                {
                    string strB = VimUtils.GetVolumeName(this.Name).Trim();
                    foreach (HostDatastoreBrowserSearchResults browserSearchResults in browserSearchResultsArray)
                    {
                        if (browserSearchResults.file != null && browserSearchResults.file.Length != 0 && string.Compare(browserSearchResults.folderPath, strB) == 0)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
コード例 #13
0
        public void DownloadFile(string remotePath, string localPath, string fileName, VimClientlContext ctx)
        {
            string url  = this.VcService.Service.Url;
            string str1 = url.Substring(0, url.LastIndexOf("sdk") - 1);

            remotePath = remotePath.Replace("\\", "/");
            remotePath = remotePath.Trim("/".ToCharArray());
            string fullName = "/" + remotePath + "/" + fileName;

            if (!this.FileExist(fullName, ctx))
            {
                throw new FileNotFoundException(string.Format("The file {0} not found on datastore {1}.", (object)fullName, (object)this.Name));
            }
            string    str2      = Path.Combine(localPath, fileName);
            string    str3      = (str1 + "/folder" + fullName + "?dcPath=" + this.GetDatacenterAndProperties().Name + "&dsName=" + this.Name).Replace("\\ ", "%20");
            WebClient webClient = new WebClient();
            string    str4      = this.VcService.Service.CookieContainer.GetCookies(new Uri(this.VcService.Service.Url))[0].ToString();

            webClient.Headers.Add(HttpRequestHeader.Cookie, str4);
            string address   = str3;
            string fileName1 = str2;

            webClient.DownloadFile(address, fileName1);
        }
コード例 #14
0
        public Dictionary <string, bool> GetVirtualDisksTypes(string folderName, VimClientlContext ctx)
        {
            Dictionary <string, bool> dictionary = new Dictionary <string, bool>((IEqualityComparer <string>)StringComparer.CurrentCultureIgnoreCase);

            try
            {
                string datastorePath = VCService.GetVolumeName(this.Name) + folderName;
                HostDatastoreBrowserSearchResults[] browserSearchResultsArray = (HostDatastoreBrowserSearchResults[])null;
                ManagedObjectReference[]            managedObjects            = this.GetManagedObjects(new string[1] {
                    "browser"
                });
                HostDatastoreBrowserSearchSpec searchSpec = new HostDatastoreBrowserSearchSpec();
                searchSpec.matchPattern = new string[1] {
                    "*.vmdk"
                };
                searchSpec.searchCaseInsensitive          = true;
                searchSpec.searchCaseInsensitiveSpecified = true;
                searchSpec.sortFoldersFirst               = true;
                searchSpec.sortFoldersFirstSpecified      = true;
                searchSpec.searchCaseInsensitiveSpecified = true;
                searchSpec.details                    = new FileQueryFlags();
                searchSpec.details.fileOwner          = false;
                searchSpec.details.fileOwnerSpecified = true;
                searchSpec.details.fileSize           = true;
                searchSpec.details.modification       = true;
                searchSpec.details.fileType           = true;
                VmDiskFileQuery vmDiskFileQuery = new VmDiskFileQuery();
                vmDiskFileQuery.details               = new VmDiskFileQueryFlags();
                vmDiskFileQuery.details.thin          = true;
                vmDiskFileQuery.details.thinSpecified = true;
                FileQuery fileQuery = new FileQuery();
                searchSpec.query = new FileQuery[1]
                {
                    (FileQuery)vmDiskFileQuery
                };
                Task              task   = new Task(this._vimService, this._vimService.Service.SearchDatastoreSubFolders_Task(managedObjects[0], datastorePath, searchSpec));
                string            op     = "Browse Datastore";
                VimClientlContext rstate = ctx;
                task.WaitForResult(op, rstate);
                string[] properties1 = new string[1] {
                    "info.result"
                };
                Dictionary <string, object> properties2 = task.GetProperties(properties1);
                if (properties2.ContainsKey("info.result"))
                {
                    browserSearchResultsArray = (HostDatastoreBrowserSearchResults[])properties2["info.result"];
                }
                if (browserSearchResultsArray != null)
                {
                    if (browserSearchResultsArray.Length != 0)
                    {
                        foreach (HostDatastoreBrowserSearchResults browserSearchResults in browserSearchResultsArray)
                        {
                            List <VmdkFileInfo> vmdkFileInfoList = new List <VmdkFileInfo>();
                            if (browserSearchResults.file != null)
                            {
                                foreach (VimApi.FileInfo fileInfo in browserSearchResults.file)
                                {
                                    if (fileInfo is VmDiskFileInfo && !dictionary.ContainsKey(fileInfo.path))
                                    {
                                        dictionary.Add(fileInfo.path, ((VmDiskFileInfo)fileInfo).thin);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(dictionary);
        }
コード例 #15
0
 public void MoveFilesByName(string srcFolder, string srcFile, string tgtFolder, bool force, VimClientlContext ctx)
 {
     new Task(this.VcService, this.VcService.Service.MoveDatastoreFile_Task(this._vimService.FileManager, this.GetVolumeName(this.Name) + srcFolder + "/" + srcFile, this.GetDatacenterAndProperties().ManagedObject, this.GetVolumeName(this.Name) + tgtFolder + "/" + srcFile, (ManagedObjectReference)null, force, force)).WaitForResult("MoveFile", ctx);
 }
コード例 #16
0
        public object[] WaitForValues(VimClientlContext rstate, string[] filterProps, string[] endWaitProps, object[][] expectedVals)
        {
            ILogger logger = ((VCService)this.VcService).Logger;

            if (logger != null)
            {
                logger.Verbose("WaitForValues begin", "Task");
            }
            string version = "";

            object[]           vals1 = new object[endWaitProps.Length];
            object[]           vals2 = new object[filterProps.Length];
            PropertyFilterSpec spec  = new PropertyFilterSpec();

            spec.objectSet = new ObjectSpec[1]
            {
                new ObjectSpec()
            };
            spec.objectSet[0].obj = this._managedObject;
            spec.propSet          = new PropertySpec[1]
            {
                new PropertySpec()
            };
            spec.propSet[0].pathSet         = filterProps;
            spec.propSet[0].type            = this._managedObject.type;
            spec.objectSet[0].selectSet     = (SelectionSpec[])null;
            spec.objectSet[0].skip          = false;
            spec.objectSet[0].skipSpecified = true;
            ManagedObjectReference filter1 = this.VcService.Service.CreateFilter(this.VcService.PropertyCollector, spec, true);
            bool         flag          = false;
            ObjectUpdate objectUpdate1 = (ObjectUpdate)null;

            PropertyChange[] propertyChangeArray = (PropertyChange[])null;
            if (logger != null)
            {
                logger.Verbose("wait loop begin", "Task");
            }
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            long elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
            int  num = 0;

label_33:
            while (!flag)
            {
                if (rstate.IsVimClientStopping())
                {
                    throw new EsxAbortException();
                }
                if (stopwatch.ElapsedMilliseconds > (long)(rstate.TimeoutSec * 1000))
                {
                    throw new EsxException("WaitForValues: Operation timed out", true);
                }
                UpdateSet updateSet;
                try
                {
                    updateSet = this.VcService.Service.WaitForUpdates(this.VcService.PropertyCollector, version);
                }
                catch (WebException ex)
                {
                    if (ex.Status != WebExceptionStatus.Timeout)
                    {
                        throw;
                    }
                    else
                    {
                        continue;
                    }
                }
                version = updateSet.version;
                if (updateSet != null && updateSet.filterSet != null)
                {
                    foreach (PropertyFilterUpdate filter2 in updateSet.filterSet)
                    {
                        ObjectUpdate[] objectSet = filter2.objectSet;
                        if (objectSet != null)
                        {
                            objectUpdate1       = (ObjectUpdate)null;
                            propertyChangeArray = (PropertyChange[])null;
                            for (int index = 0; index < objectSet.Length; ++index)
                            {
                                ObjectUpdate objectUpdate2 = objectSet[index];
                                if (objectUpdate2.kind == ObjectUpdateKind.modify || objectUpdate2.kind == ObjectUpdateKind.enter || objectUpdate2.kind == ObjectUpdateKind.leave)
                                {
                                    foreach (PropertyChange change in objectUpdate2.changeSet)
                                    {
                                        this.UpdateValues(endWaitProps, vals1, change);
                                        this.UpdateValues(filterProps, vals2, change);
                                        if (change.name.Equals("info.progress") && change.val != null && (logger != null && stopwatch.ElapsedMilliseconds - elapsedMilliseconds > 60000L))
                                        {
                                            string s      = change.val.ToString();
                                            int    result = 0;
                                            if (int.TryParse(s, out result) && result > num)
                                            {
                                                logger.Verbose(string.Format("Task is {0}% complete", (object)s, (object)"Task"));
                                                elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
                                                num = result;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    int index1 = 0;
                    while (true)
                    {
                        if (index1 < vals1.Length && !flag)
                        {
                            for (int index2 = 0; index2 < expectedVals[index1].Length && !flag; ++index2)
                            {
                                flag = expectedVals[index1][index2].Equals(vals1[index1]) | flag;
                            }
                            ++index1;
                        }
                        else
                        {
                            goto label_33;
                        }
                    }
                }
            }
            if (logger != null)
            {
                logger.Verbose("wait end", "Task");
            }
            for (int index = 0; index < 2; ++index)
            {
                try
                {
                    this.VcService.Service.DestroyPropertyFilter(filter1);
                    break;
                }
                catch (Exception ex)
                {
                }
            }
            if (logger != null)
            {
                logger.Verbose("wait loop end", "Task");
            }
            return(vals2);
        }
コード例 #17
0
 protected virtual void _CreateVirtualDisks(IVimVm replicaVm, VmDiskInfo[] vmDiskInfo, VimClientlContext ctx)
 {
     replicaVm.CreateVirtualDisks(vmDiskInfo, ctx);
 }
コード例 #18
0
 public void MoveFilesByFullName(string source, string target, string targetFolderName, bool force, VimClientlContext ctx)
 {
     if (!this.IsFolderOnRootExist(targetFolderName, ctx))
     {
         this.CreateDirectory(targetFolderName);
     }
     new Task(this.VcService, this.VcService.Service.MoveDatastoreFile_Task(this._vimService.FileManager, source, this.GetDatacenterAndProperties().ManagedObject, target, (ManagedObjectReference)null, force, force)).WaitForResult("MoveFile", ctx);
 }