예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectedItem"/> class.
 /// </summary>
 /// <param name="xenObject">The xen object that is selected.</param>
 /// <param name="connection">The connection of the xen object.</param>
 /// <param name="hostAncestor">The host ancestor of the xen object in the tree.</param>
 /// <param name="poolAncestor">The pool ancestor of the xen object in the tree.</param>
 public SelectedItem(IXenObject xenObject, IXenConnection connection, Host hostAncestor, Pool poolAncestor)
 {
     _xenObject = xenObject;
     _hostAncestor = hostAncestor;
     _poolAncestor = poolAncestor;
     _connection = connection;
 }
예제 #2
0
        public MessageAlert(XenAPI.Message m)
        {
            Message = m;
            uuid = m.uuid;
            _timestamp = m.timestamp;
            try
            {
                _priority = (int)m.priority;
            }
            catch (OverflowException)
            {
                _priority = DEFAULT_PRIORITY;
            }
            Connection = m.Connection;
            XenObject = Helpers.XenObjectFromMessage(m);

            // TODO: This would be better if there was some way of getting the actual host that the XenObject belongs to
            // Currently if the applies to object is not a host or pool and belongs to a slave it is filtered under the master.

            Host h = XenObject as Host;
            if (h == null)
                h = Helpers.GetMaster(m.Connection);

            if (h != null)
                HostUuid = h.uuid;
        }
 public ResidentHostIsSameAsSelectionFilter(IXenObject item, List<VM> preSelectedVMs)
     : base(item)
 {
     if (preSelectedVMs == null)
         throw new ArgumentNullException("Pre-selected VMs are null");
     this.preSelectedVMs = preSelectedVMs;
 }
 public SaveDataSourceStateAction(IXenConnection connection, IXenObject xmo, List<DataSourceItem> items, List<DesignedGraph> graphs)
     : base(connection, Messages.ACTION_SAVE_DATASOURCES, Messages.ACTION_SAVING_DATASOURCES, true)
 {
     DataSourceItems = items;
     XenObject = xmo;
     Graphs = graphs;
 }
예제 #5
0
 public WlbEnabledFilter(IXenObject item, List<VM> preSelectedVMs)
     : base(item)
 {
     if (preSelectedVMs == null)
         throw new ArgumentNullException("Pre-selected VMs are null");
     this.preSelectedVMs = preSelectedVMs;
 }
 public void CopyFrom(DelayLoadingOptionComboBoxItem toCopy)
 {
     xenObject = toCopy.xenObject;
     failureReason = toCopy.FailureReason;
     Enabled = toCopy.Enabled;
     PreferAsSelectedItem = toCopy.PreferAsSelectedItem;
 }
 public SaveDataSourceStateAction(IXenConnection connection, IXenObject xmo, List<DataSourceItem> items, List<DesignedGraph> graphs)
     : base(connection, "Saving DataSources", "Saving DataSources", true)
 {
     DataSourceItems = items;
     XenObject = xmo;
     Graphs = graphs;
 }
예제 #8
0
		public ExportApplianceWizard(IXenConnection con, SelectedItemCollection selection)
			: base(con)
		{
			InitializeComponent();

		    m_pageExportAppliance = new ExportAppliancePage();
            m_pageRbac = new RBACWarningPage();
		    m_pageExportSelectVMs = new ExportSelectVMsPage();
            m_pageExportEula = new ExportEulaPage();
		    m_pageExportOptions = new ExportOptionsPage();
		    m_pageTvmIp = new TvmIpPage();
            m_pageFinish = new ExportFinishPage();

			m_selectedObject = selection.FirstAsXenObject;

			if (selection.Count == 1 && (m_selectedObject is VM || m_selectedObject is VM_appliance))
				m_pageExportAppliance.ApplianceFileName = m_selectedObject.Name;

			m_pageExportAppliance.OvfModeOnly = m_selectedObject is VM_appliance;
			m_pageTvmIp.IsExportMode = true;
			m_pageFinish.SummaryRetreiver = GetSummary;
			m_pageExportSelectVMs.SelectedItems = selection;

            AddPages(m_pageExportAppliance, m_pageExportSelectVMs, m_pageFinish);
		}
예제 #9
0
        protected ReasoningFilter(IXenObject itemToFilterOn)
        {
            if (!(itemToFilterOn is Host) && !(itemToFilterOn is Pool))
                throw new ArgumentException("Target should be host or pool");

            ItemToFilterOn = itemToFilterOn;
        }
예제 #10
0
        protected SaveChangesAction(IXenObject obj, bool suppressHistory)
            : base(obj.Connection, Messages.ACTION_SAVE_CHANGES_TITLE, Messages.ACTION_SAVE_CHANGES_IN_PROGRESS, suppressHistory)
        {
            // This is lovely. We need to lock the server object (not the copy we have taken) before calling save changes.
            // We don't know the type so we use the MethodInfo object and MakeGenericMethod to do a resolve against the type
            // we have extracted from GetType(). The Resolve() call itself needs a XenRef which we make by calling the XenRef constructor that takes the
            // opaque ref as an argument and using the MakeGenericType call to give it the same type as the object...
            // ... _then_ we lock it.
            SetObject(obj);
            _xenObject = obj;
            if (obj.opaque_ref != null)  // creating a new object comes through here, but with obj.opaque_ref == null
            {
                System.Reflection.MethodInfo mi = typeof(IXenConnection).GetMethod("Resolve", BindingFlags.Public | BindingFlags.Instance);
                Type type = obj.GetType();
                object[] xenRefParam = new object[] {
                typeof(XenRef<>).MakeGenericType(type).GetConstructor(new Type[] {typeof(string)}).Invoke(new Object[] {obj.opaque_ref})
                };
                _serverXenObject = (IXenObject)mi.MakeGenericMethod(type).Invoke(obj.Connection, xenRefParam);

                if (_serverXenObject != null)
                {
                    // CA-35210: Removed this exception pending locking overhaul post MR in CA-38966
                    //if (_serverXenObject.Locked)
                    //    lockViolation = true;
                    _serverXenObject.Locked = true;
                }
            }
        }
예제 #11
0
		public ImportWizard(IXenConnection con, IXenObject xenObject, string filename, bool ovfModeOnly)
			: base(con)
		{
			InitializeComponent();

		    m_pageStorage = new ImportSelectStoragePage();
		    m_pageNetwork = new ImportSelectNetworkPage();
		    m_pageHost = new ImportSelectHostPage();
		    m_pageSecurity = new ImportSecurityPage();
		    m_pageEula = new ImportEulaPage();
		    m_pageOptions = new ImportOptionsPage();
		    m_pageFinish = new ImportFinishPage();
		    m_pageRbac = new RBACWarningPage();
		    m_pageTvmIp = new TvmIpPage();
		    m_pageVMconfig = new ImageVMConfigPage();
		    m_pageImportSource = new ImportSourcePage();
		    m_pageXvaStorage = new StoragePickerPage();
		    m_pageXvaNetwork = new NetworkPickerPage();
		    m_pageXvaHost = new GlobalSelectHost();
            lunPerVdiMappingPage = new LunPerVdiImportPage { Connection = con };

			m_selectedObject = xenObject;
            m_pageTvmIp.IsExportMode = false;
			m_pageFinish.SummaryRetreiver = GetSummary;
			m_pageXvaStorage.ImportVmCompleted += m_pageXvaStorage_ImportVmCompleted;

			if (!string.IsNullOrEmpty(filename))
				m_pageImportSource.SetFileName(filename);

			m_pageImportSource.OvfModeOnly = ovfModeOnly;
            AddPages(m_pageImportSource, m_pageHost, m_pageStorage, m_pageNetwork, m_pageFinish);
		}
예제 #12
0
        public void SetXenObjects(IXenObject orig, IXenObject clone)
        {
            if (!(clone is VDI))
                return;
            vdi = clone as VDI;

            Repopulate();
        }
예제 #13
0
 protected override void Execute(IXenObject xenObject)
 {
     using (PropertiesDialog dialog = new PropertiesDialog(xenObject))
     {
         dialog.EditDescription();
         dialog.ShowDialog(Parent);
     }
 }
예제 #14
0
        public SaveCustomFieldsAction(IXenObject xenObject, List<CustomField> customFields, bool suppressHistory)
            : base(xenObject.Connection, Messages.ACTION_SAVE_CUSTOM_FIELDS, string.Format(Messages.ACTION_SAVING_CUSTOM_FIELDS_FOR, xenObject), suppressHistory)
        {
            this.xenObject = xenObject;
            this.customFields = customFields;

            string type = xenObject.GetType().Name.ToLowerInvariant();
        }
예제 #15
0
 protected virtual void Execute(IXenObject xenObject)
 {
     using (PropertiesDialog dialog = new PropertiesDialog(xenObject))
     {
         dialog.EditName();
         dialog.ShowDialog(Parent);
     }
 }
예제 #16
0
        public LiveMigrateOptionsVmMapping(VmMapping vmMapping, IXenObject vm)
        {
            this.vmMapping = vmMapping;
            this.vm = vm as VM;

            if(vm==null)
                throw new NullReferenceException("VM passed to ctor was null");
        }
예제 #17
0
 public CreateDiskAction(IXenObject obj)
     : base(obj)
 {
     VDI disk = obj as VDI;
     if (disk != null)
         Title = string.Format(Messages.ACTION_VDI_CREATING_TITLE, disk.Name,
                               disk.Connection.Resolve<SR>(disk.SR).NameWithoutHost);
     Description = Messages.ACTION_VDI_CREATING;
 }
예제 #18
0
 public GpuRow(IXenObject xenObject, List<PGPU> pGpuList)
     : this()
 {
     this.xenObject = xenObject;
     pGpuLabel.Text = pGpuList[0].Name;
     RepopulateAllowedTypes(pGpuList[0]);
     Rebuild(pGpuList);
     SetupPage();
 }
        public CrossPoolMigrateCanMigrateFilter(IXenObject itemAddedToComboBox, List<VM> preSelectedVMs, WizardMode wizardMode)
            : base(itemAddedToComboBox)
        {
            _wizardMode = wizardMode;

            if (preSelectedVMs == null)
                throw new ArgumentNullException("Pre-selected VMs are null");
            this.preSelectedVMs = preSelectedVMs;
        }
예제 #20
0
        /// <summary>
        /// Calculates the nodes that should be visible in the main window tree view when the specified xen object is hidden.
        /// </summary>
        /// <param name="hiddenObject">The hidden object.</param>
        private ComparableList<IXenObject> CalculatePopulateWithHiddenObject(IXenObject hiddenObject)
        {
            VirtualTreeNode rootNode = MW(() => new MainWindowTreeBuilder(new FlickerFreeTreeView()).CreateNewRootNode(new NavigationPane().Search, NavigationPane.NavigationMode.Infrastructure));

            List<VirtualTreeNode> nodes = new List<VirtualTreeNode>(rootNode.Descendants);

            nodes.RemoveAll(n => hiddenObject.Equals(n.Tag));
            nodes.RemoveAll(n => new List<VirtualTreeNode>(n.Ancestors).Find(nn => hiddenObject.Equals(nn.Tag)) != null);
            return new ComparableList<IXenObject>(nodes.ConvertAll(n => (IXenObject)n.Tag));
        }
예제 #21
0
파일: GpuRow.cs 프로젝트: huizh/xenadmin
 public GpuRow(IXenObject xenObject, List<PGPU> pGpuList)
     : this()
 {
     this.xenObject = xenObject;
     pGpuLabel.Text = pGpuList[0].Name;
     RepopulateAllowedTypes(pGpuList[0]);
     vGpuCapability = !Helpers.FeatureForbidden(xenObject, Host.RestrictVgpu) && pGpuList[0].HasVGpu;
     Rebuild(pGpuList);
     SetupPage();
 }
예제 #22
0
 public ScriptingObject(WebBrowser2 Browser, IXenObject XenObject)
 {
     browser = Browser;
     connection = XenObject.Connection;
     if (connection != null)
     {
         connection.ConnectionResult += new EventHandler<ConnectionResultEventArgs>(connection_ConnectionResult);
     }
     SetObject(XenObject);
 }
예제 #23
0
파일: Tags.cs 프로젝트: huizh/xenadmin
        public static void AddTag(Session session, IXenObject o, String tag)
        {
            //Program.AssertOffEventThread();

            String[] tags = GetTags(o);
            if (tags != null && Array.IndexOf<String>(tags, tag) > -1)
                return;

            o.Do("add_tags", session, o.opaque_ref, tag);
        }
        public PerfmonDefinitionAction(IXenObject xo, List<PerfmonDefinition> perfmonDefinitions)
            : base(xo.Connection, Messages.ACTION_SAVE_ALERTS, string.Format(Messages.ACTION_SAVING_ALERTS_FOR, xo))
        {
            this.xo = xo;
            this.perfmonDefinitions = perfmonDefinitions;

            string type = xo.GetType().Name.ToLowerInvariant();
            ApiMethodsToRoleCheck.Add(type + ".remove_from_other_config", PerfmonDefinition.PERFMON_KEY_NAME);
            if (perfmonDefinitions != null && perfmonDefinitions.Count != 0)
                ApiMethodsToRoleCheck.Add(type + ".add_to_other_config", PerfmonDefinition.PERFMON_KEY_NAME);
        }
예제 #25
0
        public void SetXenObjects(IXenObject orig, IXenObject clone)
        {
            Trace.Assert(clone is VM);  // only VMs should show this page
            Trace.Assert(Helpers.ContainerCapability(clone.Connection));  // If no container capability, we shouldn't see this page

            vm = (VM)clone;

            Trace.Assert(vm.CanBeEnlightened);  // If the VM cannot be enlightened, we shouldn't see this page

            PopulatePage();
        }
예제 #26
0
        public void SetXenObjects(IXenObject orig, IXenObject clone)
        {
            CustomFieldsManager.CustomFieldsChanged -= CustomFields_CustomFieldsChanged;
            xenObject = clone;

            if (xenObject != null)
            {
                CustomFieldsManager.CustomFieldsChanged += CustomFields_CustomFieldsChanged;
                Rebuild(true);
            }
        }
예제 #27
0
        public HomeServerItem(IXenObject host, List<ReasoningFilter> filters)
            : base(host)
        {
            if(!(host is Host))
            {
                throw new ArgumentException("This class expects as IXenObject of type host");
            }

            this.filters = filters;
            LoadAndWait();
        }
예제 #28
0
        public void SetXenObjects(IXenObject orig, IXenObject clone)
        {
            network = clone as XenAPI.Network;
            if (network == null)
                return;

            // use the pif of the master to populate the controls. We use it later in the create_VLAN_from_PIF call in Network Action
            host = Helpers.GetMaster(network.Connection);
            
            Repopulate();
            EnableDisable();
        }
예제 #29
0
        public void SetXenObjects(IXenObject orig, IXenObject clone)
        {
            vm = clone as VM;
            if (vm == null)
                return;

            Host currentAffinity = vm.Connection.Resolve(vm.affinity);
            picker.SetAffinity(vm.Connection, currentAffinity,
                              vm.HasNoDisksAndNoLocalCD
                                  ? null
                                  : vm.GetStorageHost(false));
        }
예제 #30
0
        public void SetXenObjects(IXenObject orig, IXenObject clone)
        {
            pool = Helpers.GetPoolOfOne(clone.Connection);  // clone could be a pool or a host

            if (clone is Host)
                labelRubric.Text = Messages.SECURITYEDITPAGE_RUBRIC_HOST;  // the pool version is built into the page: this overrides it in the case of a host

            if (pool.ssl_legacy)
                radioButtonSSL.Checked = true;
            else
                radioButtonTLS.Checked = true;
            ShowHideWarning();
        }
 public void SetXenObjects(IXenObject orig, IXenObject clone)
 {
     throw new Exception("The method or operation is not implemented.");
 }
예제 #32
0
 public void SetXenObjects(IXenObject orig, IXenObject clone)
 {
     _clone = (VM_appliance)clone;
     Pool   = Helpers.GetPoolOfOne(_clone.Connection);
     //RefreshTab(null);
 }
예제 #33
0
 public CrossPoolMigrateVersionFilter(IXenObject itemAddedToComboBox)
     : base(itemAddedToComboBox)
 {
 }
예제 #34
0
 public static void Move(IXenObject ixmo, Folder target)
 {
     Move(null, ixmo, target);
 }
예제 #35
0
 public static void Unfolder(IXenObject ixmo)
 {
     Unfolder(null, ixmo);
 }
예제 #36
0
 public LicenseDataGridViewRow(IXenObject xenObject, ILicenseStatus status)
     : base(xenObject)
 {
     licenseStatus              = status;
     licenseStatus.ItemUpdated += licenseStatus_ItemUpdated;
 }
예제 #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Command"/> class.
 /// </summary>
 /// <param name="mainWindow">The application main window.</param>
 /// <param name="xenObject">The selection context for the Command.</param>
 protected Command(IMainWindow mainWindow, IXenObject xenObject)
     : this(mainWindow, new SelectedItem(xenObject))
 {
 }
예제 #38
0
 public bool FailureFoundFor(IXenObject xenObject)
 {
     ItemToFilterOn = xenObject;
     return(FailureFound);
 }
예제 #39
0
 public DRFailoverCommand(IMainWindow mainWindow, IXenObject selection)
     : base(mainWindow, selection)
 {
 }
예제 #40
0
        /// <summary>
        /// Call me, async update graph data set
        /// UpdaterThread Thread
        /// </summary>
        public void Update()
        {
            while (RunThread)
            {
                IXenObject xenObject = XenObject;
                Host       Host      = GetHost(xenObject);

                DateTime ServerWas = ServerNow(); // get time before updating so we dont miss any 5 second updates if getting the past data

                if (FirstTime)
                {
                    LoadingInitialData = true;
                    OnArchivesUpdated();
                    Get(ArchiveInterval.None, RrdsUri, RRD_Full_InspectCurrentNode, Host, xenObject);
                    LoadingInitialData = false;
                    OnArchivesUpdated();

                    LastFiveSecondCollection = ServerWas;
                    LastOneMinuteCollection  = ServerWas;
                    LastOneHourCollection    = ServerWas;
                    LastOneDayCollection     = ServerWas;
                    FirstTime = false;
                }

                if (ServerWas - LastFiveSecondCollection > FiveSeconds)
                {
                    GetUpdate(ArchiveInterval.FiveSecond, Host, xenObject);
                    LastFiveSecondCollection = ServerWas;
                    Archives[ArchiveInterval.FiveSecond].Load(SetsAdded);
                }
                if (ServerWas - LastOneMinuteCollection > OneMinute)
                {
                    GetUpdate(ArchiveInterval.OneMinute, Host, xenObject);
                    LastOneMinuteCollection = ServerWas;
                    Archives[ArchiveInterval.OneMinute].Load(SetsAdded);
                }
                if (ServerWas - LastOneHourCollection > OneHour)
                {
                    GetUpdate(ArchiveInterval.OneHour, Host, xenObject);
                    LastOneHourCollection = ServerWas;
                    Archives[ArchiveInterval.OneHour].Load(SetsAdded);
                }
                if (ServerWas - LastOneDayCollection > OneDay)
                {
                    GetUpdate(ArchiveInterval.OneDay, Host, xenObject);
                    LastOneDayCollection = ServerWas;
                    Archives[ArchiveInterval.OneDay].Load(SetsAdded);
                }

                lock (WaitUpdates)
                {
                    Monitor.Wait(WaitUpdates, SleepTime);
                }
                lock (UpdateMonitor)
                {
                    if (!ThreadRunning)
                    {
                        Monitor.Wait(UpdateMonitor);
                    }
                }
            }
        }
예제 #41
0
 /// <summary>
 /// UpdaterThread Thread
 /// </summary>
 private void GetUpdate(ArchiveInterval interval, Host host, IXenObject xo)
 {
     Get(interval, UpdateUri, RRD_Update_InspectCurrentNode, host, xo);
 }
 public TestCase(IXenObject ixo, List <VM> vms, bool failureExpected)
 {
     this.ixo             = ixo;
     this.vms             = vms;
     this.failureExpected = failureExpected;
 }
예제 #43
0
        /// <summary>
        /// UpdaterThread Thread
        /// </summary>
        private void RRD_Full_InspectCurrentNode(XmlReader reader, IXenObject xmo)
        {
            if (reader.NodeType == XmlNodeType.Element)
            {
                LastNode = reader.Name;
                if (LastNode == "row")
                {
                    CurrentTime += CurrentInterval * StepSize * TicksInOneSecond;
                    ValueCount   = 0;
                }
            }

            if (reader.NodeType == XmlNodeType.EndElement)
            {
                LastNode = reader.Name;
                if (LastNode == "rra")
                {
                    if (BailOut)
                    {
                        BailOut = false;
                        return;
                    }

                    ArchiveInterval i = GetArchiveIntervalFromFiveSecs(CurrentInterval);
                    if (i != ArchiveInterval.None)
                    {
                        Archives[i].CopyLoad(SetsAdded);
                    }

                    foreach (DataSet set in SetsAdded)
                    {
                        set.Points.Clear();
                    }
                    BailOut = false;
                }
            }

            if (reader.NodeType != XmlNodeType.Text)
            {
                return;
            }

            if (LastNode == "name")
            {
                string str = reader.ReadContentAsString();
                string id  = string.Format("{0}:{1}:{2}", xmo is Host ? "host" : "vm", Helpers.GetUuid(xmo), str);
                SetsAdded.Add(DataSet.Create(id, xmo, true, str));
            }
            else if (LastNode == "step")
            {
                string str = reader.ReadContentAsString();
                StepSize = long.Parse(str, CultureInfo.InvariantCulture);
            }
            else if (LastNode == "lastupdate")
            {
                string str = reader.ReadContentAsString();
                EndTime = long.Parse(str, CultureInfo.InvariantCulture);
            }
            else if (LastNode == "pdp_per_row")
            {
                string str = reader.ReadContentAsString();
                CurrentInterval = long.Parse(str, CultureInfo.InvariantCulture);

                long modInterval = EndTime % (StepSize * CurrentInterval);
                long stepCount   = CurrentInterval == 1 ? FiveSecondsInTenMinutes // 120 * 5 seconds in 10 minutes
                               : CurrentInterval == 12 ? MinutesInTwoHours        // 120 minutes in 2 hours
                               : CurrentInterval == 720 ? HoursInOneWeek          // 168 hours in a week
                               : DaysInOneYear;                                   // 366 days in a year

                CurrentTime = new DateTime((((EndTime - modInterval) - (StepSize * CurrentInterval * stepCount)) * TimeSpan.TicksPerSecond) + TimeUtil.TicksBefore1970).ToLocalTime().Ticks;
            }
            else if (LastNode == "cf")
            {
                string str = reader.ReadContentAsString();
                if (str != RrdCFAverage)
                {
                    BailOut = true;
                }
            }
            else if (LastNode == "v")
            {
                if (BailOut || SetsAdded.Count <= ValueCount)
                {
                    return;
                }

                DataSet set = SetsAdded[ValueCount];
                string  str = reader.ReadContentAsString();
                set.AddPoint(str, CurrentTime, SetsAdded);
                ValueCount++;
            }
        }
예제 #44
0
        private static Uri RrdsUri(Session session, Host host, ArchiveInterval interval, IXenObject xo)
        {
            string query =
                xo is Host?
                string.Format(RrdHostQuery, Uri.EscapeDataString(session.uuid)) :
                    xo is VM?
                    string.Format(RrdVmQuery, Uri.EscapeDataString(session.uuid), Helpers.GetUuid(xo)) :
                        "";

            return(BuildUri(host, xo is Host ? RrdHostPath : RrdVmPath, query));
        }
예제 #45
0
        /// <summary>
        /// Call me, async update graph data set
        /// UpdaterThread Thread
        /// </summary>
        private void Update()
        {
            while (RunThread)
            {
                IXenObject xenObject = XenObject;
                Host       Host      = GetHost(xenObject);

                DateTime ServerWas = ServerNow(); // get time before updating so we don't miss any 5 second updates if getting the past data

                if (FirstTime)
                {
                    // Restrict to at most 24 hours data if necessary
                    if (Helpers.FeatureForbidden(_xenObject, XenAPI.Host.RestrictPerformanceGraphs))
                    {
                        Archives[ArchiveInterval.OneHour].MaxPoints = 24;
                        Archives[ArchiveInterval.OneDay].MaxPoints  = 0;
                    }
                    else
                    {
                        Archives[ArchiveInterval.OneHour].MaxPoints = HoursInOneWeek;
                        Archives[ArchiveInterval.OneDay].MaxPoints  = DaysInOneYear;
                    }

                    foreach (DataArchive a in Archives.Values)
                    {
                        a.Sets.Clear();
                    }

                    LoadingInitialData = true;
                    OnArchivesUpdated();
                    Get(ArchiveInterval.None, RrdsUri, RRD_Full_InspectCurrentNode, Host, xenObject);
                    LoadingInitialData = false;
                    OnArchivesUpdated();

                    LastFiveSecondCollection = ServerWas;
                    LastOneMinuteCollection  = ServerWas;
                    LastOneHourCollection    = ServerWas;
                    LastOneDayCollection     = ServerWas;
                    FirstTime = false;
                }

                if (ServerWas - LastFiveSecondCollection > FiveSeconds)
                {
                    GetUpdate(ArchiveInterval.FiveSecond, Host, xenObject);
                    LastFiveSecondCollection = ServerWas;
                    Archives[ArchiveInterval.FiveSecond].Load(SetsAdded);
                }
                if (ServerWas - LastOneMinuteCollection > OneMinute)
                {
                    GetUpdate(ArchiveInterval.OneMinute, Host, xenObject);
                    LastOneMinuteCollection = ServerWas;
                    Archives[ArchiveInterval.OneMinute].Load(SetsAdded);
                }
                if (ServerWas - LastOneHourCollection > OneHour)
                {
                    GetUpdate(ArchiveInterval.OneHour, Host, xenObject);
                    LastOneHourCollection = ServerWas;
                    Archives[ArchiveInterval.OneHour].Load(SetsAdded);
                }
                if (ServerWas - LastOneDayCollection > OneDay)
                {
                    GetUpdate(ArchiveInterval.OneDay, Host, xenObject);
                    LastOneDayCollection = ServerWas;
                    Archives[ArchiveInterval.OneDay].Load(SetsAdded);
                }

                lock (WaitUpdates)
                {
                    Monitor.Wait(WaitUpdates, SleepTime);
                }
                lock (UpdateMonitor)
                {
                    if (!ThreadRunning)
                    {
                        Monitor.Wait(UpdateMonitor);
                    }
                }
            }
        }
 public void SetXenObjects(IXenObject orig, IXenObject clone)
 {
     host = clone as Host;
     UpdateMaintenanceWarning();
     Repopulate();
 }
예제 #47
0
 public void SetXenObjects(IXenObject orig, IXenObject clone)
 {
     throw new NotImplementedException();
 }
예제 #48
0
        /// <remarks>
        /// For Non-Windows VMs and for Windows VMs pre-Dundee:
        ///   - Memory, Disk and Network values are not available if XenServer Tools are not installed
        ///
        /// For Windows VMs on Dundee or higher:
        ///  - Memory value is not available if the Management agent is not installed;
        ///  - Disk and Network vlaues are not available if I/O drivers are not installed
        /// </remarks>
        protected bool CheckVMTools(IXenObject o, out GridItemBase item)
        {
            item = null;

            if (!checkTools)
            {
                return(false);
            }

            VM vm = o as VM;

            if (vm != null)
            {
                VM.VirtualisationStatus status = vm.virtualisation_status;
                if (vm.power_state != vm_power_state.Running ||
                    status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED | VM.VirtualisationStatus.MANAGEMENT_INSTALLED) ||
                    status.HasFlag(VM.VirtualisationStatus.UNKNOWN))
                {
                    return(false);
                }

                if (property == PropertyNames.memoryValue && status.HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED))
                {
                    return(false);
                }

                if ((property == PropertyNames.diskText || property == PropertyNames.networkText) && status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
                {
                    return(false);
                }

                string warningMessage;
                int    colSpan;

                /**
                 * if (property == PropertyNames.memoryValue && !status.HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED))
                 * {
                 *  if (vm.HasNewVirtualisationStates)
                 *  {
                 *      warningMessage = Messages.VIRTUALIZATION_STATE_VM_MANAGEMENT_AGENT_NOT_INSTALLED;
                 *      colSpan = 1;
                 *  }
                 *  else
                 *  {
                 *      warningMessage = vm.GetVirtualisationWarningMessages();
                 *      colSpan = 3;
                 *  }
                 *
                 *  if (InstallToolsCommand.CanExecute(vm))
                 *  {
                 *      item = new GridStringItem(warningMessage,
                 *                                HorizontalAlignment.Center,
                 *                                VerticalAlignment.Middle,
                 *                                false,
                 *                                false,
                 *                                QueryPanel.LinkBrush,
                 *                                Program.DefaultFontUnderline,
                 *                                QueryPanel.LinkBrush,
                 *                                Program.DefaultFontUnderline,
                 *                                colSpan,
                 *                                (sender, args) => new InstallToolsCommand(Program.MainWindow, vm).Execute(), null);
                 *  }
                 *  else
                 *  {
                 *      item = new GridStringItem(warningMessage,
                 *                                HorizontalAlignment.Center,
                 *                                VerticalAlignment.Middle,
                 *                                false,
                 *                                false,
                 *                                QueryPanel.TextBrush,
                 *                                Program.DefaultFont,
                 *                                colSpan);
                 *  }
                 * }
                 **/
                if (property == PropertyNames.diskText && vm.HasNewVirtualisationStates && !status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
                {
                    warningMessage = Messages.VIRTUALIZATION_STATE_VM_IO_NOT_OPTIMIZED;
                    colSpan        = 2;

                    if (InstallToolsCommand.CanExecute(vm))
                    {
                        item = new GridStringItem(warningMessage,
                                                  HorizontalAlignment.Center,
                                                  VerticalAlignment.Middle,
                                                  false,
                                                  false,
                                                  QueryPanel.LinkBrush,
                                                  Program.DefaultFontUnderline,
                                                  QueryPanel.LinkBrush,
                                                  Program.DefaultFontUnderline,
                                                  colSpan,
                                                  (sender, args) => new InstallToolsCommand(Program.MainWindow, vm).Execute(), null);
                    }
                    else
                    {
                        item = new GridStringItem(warningMessage,
                                                  HorizontalAlignment.Center,
                                                  VerticalAlignment.Middle,
                                                  false,
                                                  false,
                                                  QueryPanel.TextBrush,
                                                  Program.DefaultFont,
                                                  colSpan);
                    }
                }
                return(true);
            }

            Pool pool = o as Pool;

            if (pool != null && !pool.IsPoolFullyUpgraded)
            {
                if (property == PropertyNames.memoryValue)
                {
                    var master = pool.Connection.Resolve(pool.master);

                    item = new GridStringItem(string.Format(Messages.POOL_VERSIONS_LINK_TEXT, master.ProductVersionText),
                                              HorizontalAlignment.Center, VerticalAlignment.Middle, false, false,
                                              QueryPanel.LinkBrush, Program.DefaultFontUnderline, QueryPanel.LinkBrush,
                                              Program.DefaultFontUnderline, 3,
                                              (sender, args) => new RollingUpgradeCommand(Program.MainWindow).Execute(),
                                              null);
                }

                return(true);
            }

            return(false);
        }
예제 #49
0
 public static bool RowShouldBeExpanded(IXenObject xenObject)
 {
     return(xenObject is Pool && xenObject.Connection.Cache.Hosts.Length > 1 &&
            LicenseActivationRequest.CanActivate(xenObject as Pool));
 }
예제 #50
0
 public abstract GridItemBase GetGridItem(IXenObject o);
예제 #51
0
 public LicenseDataGridViewRow(IXenObject xenObject) : this(xenObject, new LicenseStatus(xenObject))
 {
 }
예제 #52
0
 public override object GetGroup(IXenObject o)
 {
     throw new NotImplementedException();
 }
예제 #53
0
        public static void Move(Session session, IXenObject ixmo, string target)
        {
            Folder folder = GetOrCreateFolder(ixmo.Connection, target);

            Move(session, ixmo, folder);
        }
 protected abstract DelayLoadingOptionComboBoxItem CreateDelayLoadingOptionComboBoxItem(IXenObject xenItem);
예제 #55
0
 private static String GetPathFromOtherConfig(IXenObject o)
 {
     return(GetFolderString(o) ?? "");
 }
 public void SetDefaultTarget(IXenObject xenObject)
 {
     m_selectedObject = xenObject;
 }
예제 #57
0
 public override void SetXenObjects(IXenObject orig, IXenObject clone)
 {
     _clone = (T)clone;
     Pool   = Helpers.GetPoolOfOne(_clone.Connection);
     RefreshTab(_clone);
 }
예제 #58
0
        protected override DelayLoadingOptionComboBoxItem CreateDelayLoadingOptionComboBoxItem(IXenObject xenItem)
        {
            var filters = new List <ReasoningFilter>
            {
                new ResidentHostIsSameAsSelectionFilter(xenItem, selectedVMs),
                new CrossPoolMigrateCanMigrateFilter(xenItem, selectedVMs, wizardMode),
                new WlbEnabledFilter(xenItem, selectedVMs)
            };

            return(new DelayLoadingOptionComboBoxItem(xenItem, filters));
        }
예제 #59
0
 /// <summary>
 /// Builds the context menu for the specified XenObject.
 /// </summary>
 /// <param name="xenObject">The xen object for which the context menu items are required.</param>
 /// <returns>The context menu items.</returns>
 public ToolStripItem[] Build(IXenObject xenObject)
 {
     return(Build(new SelectedItem(xenObject)));
 }
예제 #60
0
 public void SetXenObjects(IXenObject orig, IXenObject clone)
 {
     vm = clone as VM;
     Repopulate();
 }