示例#1
0
 public NewDiskDialog(IXenConnection connection, SR sr)
     : this(connection, new List <VDI>())
 {
     TheSR       = sr;
     PickerUsage = SrPicker.SRPickerType.InstallFromTemplate;
     SrListBox.SetAffinity(null);
     SrListBox.selectSRorNone(TheSR);
 }
示例#2
0
        public NewDiskDialog(IXenConnection connection, SR sr)
            : base(connection ?? throw new ArgumentNullException(nameof(connection)))
        {
            InitializeComponent();

            NameTextBox.Text     = GetDefaultVDIName();
            SrListBox.Connection = connection;
            SrListBox.Usage      = SrPicker.SRPickerType.InstallFromTemplate;
            SrListBox.SetAffinity(null);
            SrListBox.selectSRorNone(sr);
            diskSpinner1.Populate();
        }
示例#3
0
        public NewDiskDialog(IXenConnection connection, VM vm, SrPicker.SRPickerType PickerUsage, VDI diskTemplate, Host affinity, bool canResize, long minSize, IEnumerable <VDI> vdiNamesInUse)
            : this(connection, vdiNamesInUse)
        {
            TheVM            = vm;
            DiskTemplate     = diskTemplate;
            CanResize        = canResize;
            MinSize          = minSize;
            this.PickerUsage = PickerUsage;
            SrListBox.SetAffinity(affinity);

            Pool pool_sr = Helpers.GetPoolOfOne(connection);

            if (pool_sr != null)
            {
                SrListBox.DefaultSR = connection.Resolve(pool_sr.default_SR); //if default sr resolves to null the first sr in the list will be selected
            }
            SrListBox.selectDefaultSROrAny();

            LoadValues();
        }
示例#4
0
        public NewDiskDialog(IXenConnection connection, VM vm, Host affinity,
                             SrPicker.SRPickerType pickerUsage = SrPicker.SRPickerType.VM, VDI diskTemplate = null,
                             bool canResize = true, long minSize = 0, IEnumerable <VDI> vdiNamesInUse = null)
            : base(connection ?? throw new ArgumentNullException(nameof(connection)))
        {
            InitializeComponent();

            TheVM          = vm;
            _VDINamesInUse = vdiNamesInUse ?? new List <VDI>();

            SrListBox.Connection = connection;
            SrListBox.Usage      = pickerUsage;
            SrListBox.SetAffinity(affinity);

            Pool pool_sr = Helpers.GetPoolOfOne(connection);

            if (pool_sr != null)
            {
                SrListBox.DefaultSR = connection.Resolve(pool_sr.default_SR); //if default sr resolves to null the first sr in the list will be selected
            }

            if (diskTemplate == null)
            {
                NameTextBox.Text = GetDefaultVDIName();
                SrListBox.selectDefaultSROrAny();
                diskSpinner1.Populate(minSize: minSize);
            }
            else
            {
                DiskTemplate            = diskTemplate;
                NameTextBox.Text        = DiskTemplate.Name();
                DescriptionTextBox.Text = DiskTemplate.Description();
                SrListBox.selectSRorDefaultorAny(connection.Resolve(DiskTemplate.SR));
                Text          = Messages.EDIT_DISK;
                OkButton.Text = Messages.OK;
                diskSpinner1.Populate(DiskTemplate.virtual_size, minSize);
            }

            diskSpinner1.CanResize = canResize;
        }