Beispiel #1
0
        public void SetXenObjects(IXenObject orig, IXenObject clone)
        {
            _XenObject = clone;
            bool isVm   = _XenObject is VM;
            bool isHost = _XenObject is Host;
            bool isSr   = _XenObject is SR;

            cpuAlert.Show(isVm || isHost);
            netAlert.Show(isVm || isHost);
            diskAlert.Show(isVm);
            memoryAlert.Show(isHost);
            srAlert.Show(isSr);
            dom0MemoryAlert.Show(isHost && Helpers.CreedenceOrGreater(_XenObject.Connection));
            physicalUtilisationAlert.Show(isSr && ((SR)_XenObject).IsThinProvisioned);

            if (isHost)
            {
                Host         host    = (Host)_XenObject;
                Host_metrics metrics = host.Connection.Resolve(host.metrics);
                if (metrics != null)
                {
                    nudMemoryUsage.Maximum = metrics.memory_total / (1024 * 1024);
                }
            }

            Repopulate();
        }
        public void SetXenObjects(IXenObject orig, IXenObject clone)
        {
            _XenObject = clone;
            bool isVm   = _XenObject is VM;
            bool isHost = _XenObject is Host;
            bool isSr   = _XenObject is SR;

            cpuAlert.Show(isVm || isHost);
            netAlert.Show(isVm || isHost);
            diskAlert.Show(isVm);
            memoryAlert.Show(isHost && Helpers.ClearwaterOrGreater(_XenObject.Connection));
            srAlert.Show(isSr && Helpers.ClearwaterOrGreater(_XenObject.Connection));

            if (isHost)
            {
                Host         host    = (Host)_XenObject;
                Host_metrics metrics = host.Connection.Resolve(host.metrics);
                if (metrics != null)
                {
                    nudMemoryUsage.Maximum = metrics.memory_total / (1024 * 1024);
                }
            }

            Repopulate();
        }
        public void SetXenObjects(IXenObject orig, IXenObject clone)
        {
            _XenObject = clone;
            bool isVm   = _XenObject is VM;
            bool isHost = _XenObject is Host;
            bool isSr   = _XenObject is SR;

            cpuAlert.Show(isVm || isHost);
            netAlert.Show(isVm || isHost);
            diskAlert.Show(isVm);
            memoryAlert.Show(isHost);
            srAlert.Show(isSr);
            dom0MemoryAlert.Show(isHost && Helpers.CreedenceOrGreater(_XenObject.Connection));
            // Always hidden since thin provisioning was removed, because that was the only case
            // in which the calculation worked, but retaining it in case we use it again
            physicalUtilisationAlert.Show(false);

            if (isHost)
            {
                Host         host    = (Host)_XenObject;
                Host_metrics metrics = host.Connection.Resolve(host.metrics);
                if (metrics != null)
                {
                    nudMemoryUsage.Maximum = metrics.memory_total / (1024 * 1024);
                }
            }

            Repopulate();
        }