public EthernetConfigDialog(VirtualEthernet device, Window parent)
            : base(Catalog.GetString ("Configure Ethernet"),
                                                                                  parent, DialogFlags.NoSeparator,
                                                                                  Stock.Cancel, ResponseType.Cancel,
                                                                                  Stock.Ok, ResponseType.Ok)
        {
            this.device = device;

            IconThemeUtils.SetWindowIcon (this);

            Glade.XML xml = new Glade.XML ("vmx-manager.glade", "ethernetConfigContent");
            xml.Autoconnect (this);

            VBox.Add (ethernetConfigContent);
            ethernetConfigContent.ShowAll ();

            Response += delegate (object o, ResponseArgs args) {
                if (args.ResponseId == ResponseType.Ok) {
                    Save ();
                }

                this.Destroy ();
            };

            ethernetTypeCombo.Changed += OnComboChanged;

            Load ();
        }
Exemple #2
0
 public VirtualEthernetArgs(VirtualEthernet device)
 {
     this.device = device;
 }
Exemple #3
0
        private void LoadEthernetDevices()
        {
            for (int i = 0; i < 10; i++) {
                string basekey = String.Format ("ethernet{0}.", i);

                if (this[basekey + "present"] != null) {
                    string connType = this[basekey + "connectionType"];
                    string address = this[basekey + "address"];
                    // string dev = this[basekey + "virtualDev"];

                    VirtualEthernet eth = new VirtualEthernet (Utility.ParseNetworkType (connType),
                                                               address,
                                                               OperatingSystem.SuggestedEthernetDeviceType);
                    ethernetDevices.Add (eth);
                }
            }
        }
Exemple #4
0
        public void RemoveEthernetDevice(VirtualEthernet eth)
        {
            int index = ethernetDevices.IndexOf (eth);

            if (index >= 0) {
                string basekey = String.Format ("ethernet{0}", index);

                ethernetDevices.Remove (eth);

                foreach (string key in new List<string> (dict.Keys)) {
                    if (key.StartsWith (basekey)) {
                        dict.Remove (key);
                    }
                }

                VirtualEthernetHandler handler = EthernetDeviceRemoved;
                if (handler != null) {
                    handler (this, new VirtualEthernetArgs (eth));
                }
            }
        }
Exemple #5
0
        public void AddEthernetDevice(VirtualEthernet eth)
        {
            ethernetDevices.Add (eth);

            VirtualEthernetHandler handler = EthernetDeviceAdded;
            if (handler != null) {
                handler (this, new VirtualEthernetArgs (eth));
            }
        }
Exemple #6
0
        private void OnAddEthernet(object o, EventArgs args)
        {
            VirtualEthernet ethernet = new VirtualEthernet (Utility.GetDefaultNetworkType (), null,
                                                            machine.OperatingSystem.SuggestedEthernetDeviceType);
            EthernetConfigDialog dialog = new EthernetConfigDialog (ethernet, this);
            dialog.Response += delegate (object b, ResponseArgs rargs) {
                if (rargs.ResponseId == ResponseType.Ok) {
                    machine.AddEthernetDevice (ethernet);
                }
            };

            dialog.Show ();
        }
        public VirtualMachine CreateDefaultMachine(string baseName)
        {
            for (int i = 0;; i++) {
                string name;

                if (i == 0) {
                    name = baseName;
                } else {
                    name = String.Format (Catalog.GetString ("{0} #{1}"), baseName, i);
                }

                if (GetMachine (name) == null && GetMachineByFileName (name) == null) {
                    VirtualMachine machine = CreateMachine (name);

                    // add one network interface
                     VirtualEthernet ethernet = new VirtualEthernet (Utility.GetDefaultNetworkType (), null,
                                                                     machine.OperatingSystem.SuggestedEthernetDeviceType);
                     machine.AddEthernetDevice (ethernet);

                    // add a default 6gb disk
                    VirtualHardDisk disk = new VirtualHardDisk (0, 0, DiskBusType.Ide, (long) 6 * 1024 * 1024 * 1024);
                    disk.HardDiskType = HardDiskType.SplitSparse;
                    machine.AddHardDisk (disk);

                    // add virtual cd devices for each physical one (up to two)
                    ushort numdevs = 0;
                    foreach (string dev in Utility.FindCdDrives ()) {
                        if (numdevs > 1)
                            break;

                        VirtualCdDrive drive = new VirtualCdDrive (dev, 1, numdevs++, DiskBusType.Ide,
                                                                   CdDeviceType.Raw);
                        machine.AddCdDrive (drive);
                    }

                    return machine;
                }
            }
        }