コード例 #1
0
        public void CreateNetwork()
        {
            NetworkAction networkAction = new NetworkAction(DatabaseManager.ConnectionFor(dbName), newNetwork, true);

            networkAction.Completed += networkAction_Completed;
            networkAction.RunAsync();
            AutoResetEvent.WaitOne();
            DatabaseManager.ConnectionFor(dbName).LoadCache(DatabaseManager.ConnectionFor(dbName).Session);
            Assert.AreEqual(networks + 1, DatabaseManager.ConnectionFor(dbName).Cache.Networks.Length);
        }
コード例 #2
0
        private void CreateNonBonded()
        {
            XenAPI.Network network = PopulateNewNetworkObj();
            PIF            nic     = pageNetworkDetails.SelectedHostNic;
            long           vlan    = pageNetworkDetails.VLAN;

            NetworkAction action = pageNetworkType.SelectedNetworkType == NetworkTypes.External
                                       ? new NetworkAction(xenConnection, network, nic, vlan)
                                       : new NetworkAction(xenConnection, network, true);

            action.RunAsync();
        }
コード例 #3
0
        public void CreateExternalNetwork()
        {
            Assert.True(DatabaseManager.ConnectionFor(dbName).Cache.PIFs.Length > 0);
            PIF           pif           = DatabaseManager.ConnectionFor(dbName).Cache.PIFs[0];
            NetworkAction networkAction = new NetworkAction(DatabaseManager.ConnectionFor(dbName), newNetwork, pif, 2);

            networkAction.Completed += networkAction_Completed;
            networkAction.RunAsync();
            AutoResetEvent.WaitOne();
            DatabaseManager.RefreshCacheFor(dbName);
            Assert.AreEqual(networks + 1, DatabaseManager.ConnectionFor(dbName).Cache.Networks.Length);
        }
コード例 #4
0
        public void DeleteNetwork()
        {
            CreateNetwork();
            Network network = FindCreatedNetwork();

            Assert.NotNull(network);
            NetworkAction networkAction = new NetworkAction(DatabaseManager.ConnectionFor(dbName), network, false);

            networkAction.Completed += networkAction_Completed;
            networkAction.RunAsync();
            AutoResetEvent.WaitOne();
            DatabaseManager.RefreshCacheFor(dbName);
            Assert.AreEqual(networks, DatabaseManager.ConnectionFor(dbName).Cache.Networks.Length);
        }
コード例 #5
0
        private void DoRemoveNetwork()
        {
            if (SelectedVif != null)
            {
                VM vm = XenObject as VM;

                var action = new DeleteVIFAction(SelectedVif);
                action.Completed += action_Completed;
                action.RunAsync();
            }
            else if (SelectedNetwork != null)
            {
                NetworkAction action = new NetworkAction(XenObject.Connection, SelectedNetwork, false);
                action.Completed += action_Completed;
                action.RunAsync();
            }
        }
コード例 #6
0
        private void DoRemoveNetwork()
        {
            Program.MainWindow.AllowHistorySwitch = true;

            if (SelectedVif != null)
            {
                VM vm = XenObject as VM;

                var action = new DeleteVIFAction(SelectedVif);
                action.Completed += action_Completed;
                action.RunAsync();
            }
            else if (SelectedNetwork != null)
            {
                NetworkAction action = new NetworkAction(XenObject.Connection, SelectedNetwork, false);
                action.Completed += action_Completed;
                action.RunAsync();
            }
        }
コード例 #7
0
ファイル: NewNetworkWizard.cs プロジェクト: ywwseu/xenadmin
        private void CreateNonBonded()
        {
            XenAPI.Network network = PopulateNewNetworkObj();

            PIF nic;

            if (pageNetworkDetails.CreateVlanOnSriovNetwork)
            {
                if (pageNetworkDetails.SelectedHostNic == null || !pageNetworkDetails.SelectedHostNic.IsSriovPhysicalPIF())
                {
                    return;
                }

                var sriovPhysicalPif = xenConnection.Resolve(pageNetworkDetails.SelectedHostNic.sriov_physical_PIF_of[0]);
                if (sriovPhysicalPif == null)
                {
                    return;
                }

                nic = xenConnection.Resolve(sriovPhysicalPif.logical_PIF);
                if (nic == null)
                {
                    return;
                }
            }
            else
            {
                nic = pageNetworkDetails.SelectedHostNic;
            }


            long vlan = pageNetworkDetails.VLAN;

            NetworkAction action = pageNetworkType.SelectedNetworkType == NetworkTypes.External
                                       ? new NetworkAction(xenConnection, network, nic, vlan)
                                       : new NetworkAction(xenConnection, network, true);

            action.RunAsync();
        }