//---------------------------------------------------------------------------------------------------------------------

        /// <summary>Queries the cloud provider to get a list of the virtual disks (in OCCI: <i>storages</i>) defined on it.</summary>
        public override VirtualDisk[] FindVirtualDisks(bool detailed)
        {
            XmlNodeList nodes = GetResourceNodeList("/storage", "STORAGE_COLLECTION/STORAGE");

            if (nodes == null)
            {
                return(null);
            }

            List <OcciStorage> list = new List <OcciStorage>();

            foreach (XmlNode node in nodes)
            {
                XmlElement elem = node as XmlElement;
                if (elem == null)
                {
                    continue;
                }
                OcciStorage item = new OcciStorage(context);
                if (detailed)
                {
                    if (elem.HasAttribute("href"))
                    {
                        elem = GetResourceNode(String.Format("/storage/{0}", Regex.Replace(node.Attributes["href"].Value, "^.*/", String.Empty)));
                        OcciStorage.FromItemXml(item, this, elem);
                    }
                }
                else
                {
                    item = OcciStorage.FromListXml(context, this, elem);
                }
                list.Add(item);
            }
            return(list.ToArray());
        }
        //---------------------------------------------------------------------------------------------------------------------

        protected void Load(XmlElement elem)
        {
            RemoteId = (elem.HasAttribute("href") ? elem.Attributes["href"].Value : null);
            if (RemoteId != null)
            {
                RemoteId = Regex.Replace(RemoteId, "^.*/", String.Empty);
            }
            Name = (elem.HasAttribute("name") ? elem.Attributes["name"].Value : null);
            List <OcciStorage> storageList = new List <OcciStorage>();

            foreach (XmlNode node in elem)
            {
                XmlElement subElem = node as XmlElement;
                if (subElem == null)
                {
                    continue;
                }
                switch (subElem.Name)
                {
                case "USER":
                    if (subElem.HasAttribute("name"))
                    {
                        Owner = subElem.Attributes["name"].Value;
                    }
                    break;

                case "NAME":
                    Name = subElem.InnerXml;
                    break;

                case "INSTANCE_TYPE":
                    InstanceType = OcciInstanceType.FromListXml(context, Provider, subElem);
                    break;

                case "STATE":
                    StatusText = subElem.InnerXml;
                    State      = GetStateFromString(StatusText);
                    break;

                case "DISK":
                    storageList.Add(OcciStorage.FromComputeXml(context, this, subElem));
                    break;

                case "NIC":
                    Network = OcciNetwork.FromComputeXml(context, this, subElem);
                    break;

                case "CONTEXT":
                    foreach (XmlNode node2 in subElem)
                    {
                        XmlElement subElem2 = node2 as XmlElement;
                        if (subElem2 == null)
                        {
                            continue;
                        }
                        switch (subElem2.Name)
                        {
                        case "CIOP_USERNAME":
                            Username = subElem2.InnerText;
                            break;
                        }
                    }
                    break;
                }
            }

            switch (StatusText)
            {
            case "ACTIVE":
                // If the IP Address is not yet ready, the system is probably booting.
                if (Network != null && VirtualNetwork.IpAddress == null)
                {
                    StatusText = "PREPARING";
                }
                break;
            }

            Storages = storageList.ToArray();

            int diskErrorCount = 0;

            for (int i = 0; i < Storages.Length; i++)
            {
                OcciStorage storage = Storages[i];
                try {
                    if (storage.RemoteId != String.Empty)
                    {
                        XmlElement elem2 = (Provider as OcciCloudProvider).GetResourceNode(String.Format("/storage/{0}", storage.RemoteId));
                        OcciStorage.FromItemXml(storage, Provider, elem2);
                    }
                    if (storage.SavedAs != null)
                    {
                        context.AddDebug(3, "Found Disk " + storage.Id + " to be saved as " + storage.SavedAs);
                        XmlElement elem2 = (Provider as OcciCloudProvider).GetResourceNode(String.Format("/storage/{0}", storage.SavedAs));
                        storage.SavedAs = elem2["NAME"].InnerXml;
                    }
                } catch (Exception e) {
                    context.AddWarning(e.Message);
                    diskErrorCount++;
                }
            }

            if (diskErrorCount != 0)
            {
                context.AddWarning(String.Format("No information available for {0}", diskErrorCount == 1 ? "one storage" : diskErrorCount + " storages"));
            }
        }