Exemple #1
0
        protected override void Run()
        {
            foreach (var pif in Connection.ResolveAll(network.PIFs))
            {
                PIF.set_disallow_unplug(Session, pif.opaque_ref, true);
            }
            var cluster = new Cluster(); // this Cluster object is only used for getting the default values for token_timeout and token_timeout_coefficient

            Cluster.pool_create(Session, network.opaque_ref, "corosync", cluster.token_timeout, cluster.token_timeout_coefficient);
            Description = string.Format(Messages.ENABLED_CLUSTERING_ON_POOL, Pool.Name());
        }
        protected override void Run()
        {
            var existingCluster = Connection.Cache.Clusters.FirstOrDefault();

            if (existingCluster != null)
            {
                Cluster.pool_destroy(Session, existingCluster.opaque_ref);
                var clusterHosts = Connection.ResolveAll(existingCluster.cluster_hosts);

                foreach (var clusterHost in clusterHosts)
                {
                    PIF.set_disallow_unplug(Session, clusterHost.PIF.opaque_ref, false);
                }
            }
            Description = string.Format(Messages.DISABLED_CLUSTERING_ON_POOL, Pool.Name());
        }
Exemple #3
0
        protected override void Run()
        {
            var existingCluster = Connection.Cache.Clusters.FirstOrDefault();

            if (existingCluster != null)
            {
                Cluster.pool_destroy(Session, existingCluster.opaque_ref);
                var network = Connection.Resolve(existingCluster.network);

                if (network != null)
                {
                    foreach (var pif in Connection.ResolveAll(network.PIFs))
                    {
                        PIF.set_disallow_unplug(Session, pif.opaque_ref, false);
                    }
                }
            }
            Description = string.Format(Messages.DISABLED_CLUSTERING_ON_POOL, Pool.Name());
        }
        /// <summary>
        /// Enable clustering on the host (if the network is used by clustering), after the management interface has been changed;
        /// After enabling clustering we also plug back all the GFS2 SRs that we unplugged
        /// </summary>
        private void EnableClustering(PIF pif, List <PBD> gfs2Pbds)
        {
            var isUsedByClustering = Connection.Cache.Clusters.Any(cluster => cluster.network.opaque_ref == pif.network.opaque_ref);

            if (!isUsedByClustering)
            {
                return;
            }

            var host = Connection.Resolve(pif.host);

            if (host == null)
            {
                return;
            }

            var clusterHost = Connection.Cache.Cluster_hosts.FirstOrDefault(c => c.host.opaque_ref == host.opaque_ref);

            if (clusterHost == null)
            {
                return;
            }

            Description = string.Format(Messages.ENABLING_CLUSTERING_ON_POOL, host.Name());
            log.Debug(Description);
            PIF.set_disallow_unplug(Session, pif.opaque_ref, true);
            Cluster_host.enable(Session, clusterHost.opaque_ref);

            // plug the GFS2 SRs
            foreach (var pbd in gfs2Pbds.Where(pbd => !pbd.currently_attached))
            {
                var sr = Connection.Resolve(pbd.SR);
                if (sr != null)
                {
                    Description = string.Format(Messages.ACTION_SR_ATTACHING_TITLE, sr.Name(), host.Name());
                }
                PBD.plug(Session, pbd.opaque_ref);
            }
        }