Exemplo n.º 1
0
 // Get the path counts from the Multipath Boot From SAN feature (see PR-1034 and CP-1696).
 // Returns true if the Host.other_config contains the multipathed and mpath-boot keys,
 // and the mpath-boot key is parseable. In this case, current and max will contain the result;
 // otherwise they will contain zero.
 public bool GetBootPathCounts(out int current, out int max)
 {
     current = max = 0;
     return(BoolKey(other_config, "multipathed") &&
            other_config.ContainsKey("mpath-boot") &&
            PBD.ParsePathCounts(other_config["mpath-boot"], out current, out max));
 }
Exemplo n.º 2
0
Arquivo: SR.cs Projeto: 00mjk/xenadmin
        private bool CheckMultipathString(String status)
        {
            int current;
            int max;

            if (!PBD.ParsePathCounts(status, out current, out max))
            {
                return(true);
            }

            return(current >= max);
        }
Exemplo n.º 3
0
Arquivo: SR.cs Projeto: 00mjk/xenadmin
        public Dictionary <PBD, String> GetMultiPathStatusLunPerSR()
        {
            Dictionary <PBD, String> result =
                new Dictionary <PBD, String>();


            if (Connection == null)
            {
                return(result);
            }

            foreach (PBD pbd in Connection.ResolveAll(PBDs))
            {
                if (!pbd.MultipathActive())
                {
                    continue;
                }

                String status = String.Empty;

                foreach (KeyValuePair <String, String> kvp in pbd.other_config)
                {
                    if (!kvp.Key.StartsWith(MPATH))
                    {
                        continue;
                    }

                    status = kvp.Value;
                    break;
                }

                int current;
                int max;
                if (!PBD.ParsePathCounts(status, out current, out max))
                {
                    continue;
                }

                result[pbd] = status;
            }

            return(result);
        }
Exemplo n.º 4
0
Arquivo: SR.cs Projeto: 00mjk/xenadmin
        public Dictionary <VM, Dictionary <VDI, String> > GetMultiPathStatusLunPerVDI()
        {
            Dictionary <VM, Dictionary <VDI, String> > result =
                new Dictionary <VM, Dictionary <VDI, String> >();

            if (Connection == null)
            {
                return(result);
            }

            foreach (PBD pbd in Connection.ResolveAll(PBDs))
            {
                if (!pbd.MultipathActive())
                {
                    continue;
                }

                foreach (KeyValuePair <String, String> kvp in pbd.other_config)
                {
                    if (!kvp.Key.StartsWith(MPATH))
                    {
                        continue;
                    }

                    int current;
                    int max;
                    if (!PBD.ParsePathCounts(kvp.Value, out current, out max))
                    {
                        continue;
                    }

                    String scsiIdKey = String.Format("scsi-{0}", kvp.Key.Substring(MPATH.Length + 1));
                    if (!sm_config.ContainsKey(scsiIdKey))
                    {
                        continue;
                    }

                    String vdiUUID = sm_config[scsiIdKey];
                    VDI    vdi     = null;

                    foreach (VDI candidate in Connection.ResolveAll(VDIs))
                    {
                        if (candidate.uuid != vdiUUID)
                        {
                            continue;
                        }

                        vdi = candidate;
                        break;
                    }

                    if (vdi == null)
                    {
                        continue;
                    }

                    foreach (VBD vbd in Connection.ResolveAll(vdi.VBDs))
                    {
                        VM vm = Connection.Resolve(vbd.VM);
                        if (vm == null)
                        {
                            continue;
                        }

                        if (vm.power_state != vm_power_state.Running)
                        {
                            continue;
                        }

                        if (!result.ContainsKey(vm))
                        {
                            result[vm] = new Dictionary <VDI, String>();
                        }

                        result[vm][vdi] = kvp.Value;
                    }
                }
            }

            return(result);
        }