Exemple #1
0
        private void MoveButton_Click(object sender, EventArgs e)
        {
            if (!tableLayoutPanelSrPicker.Enabled || CloneRadioButton.Checked)
            {
                new VMCloneAction(TheVM, NameTextBox.Text, DescriptionTextBox.Text).RunAsync();
                Close();
                return;
            }

            if (srPicker1.SR == null)
            {
                return;
            }
            //TODO  this
            //bool sameSr = true;
            //XenObject<SR> vm_sr = null;
            //foreach (XenObject<VBD> vbd in TheVM.Connection.ResolveAll(TheVM.VBDs))
            //{
            //    if (vbd.type != vbd_type.Disk)
            //        continue;

            //    XenObject<VDI> vdi = TheVM.Connection.Resolve(vbd.VDI);
            //    if (vdi == null)
            //        continue;

            //    XenObject<SR> sr = TheVM.Connection.Resolve(vdi.SR);
            //    if(sr == null)
            //        continue;

            //    if (vm_sr == null)
            //    {
            //        vm_sr = sr;
            //        continue;
            //    }

            //    if (vm_sr.opaque_ref != sr.opaque_ref)
            //    {
            //        sameSr = false;
            //        break;
            //    }
            //}


            //if (sameSr && vm_sr != null && srPicker1.SR.opaque_ref == vm_sr.opaque_ref) // if we dont change the sr use clone
            //{
            //    action = new VmAction(TheVM.Connection, TheVM, TheVM.GetStorageHost(TheVM.Connection), NameTextBox.Text);
            //}
            //else
            //{

            var action = new VMCopyAction(TheVM, TheVM.GetStorageHost(false), srPicker1.SR, NameTextBox.Text, DescriptionTextBox.Text);

            //}
            action.RunAsync();
            Close();
        }
Exemple #2
0
        private void MoveButton_Click(object sender, EventArgs e)
        {
            if (!tableLayoutPanelSrPicker.Enabled || CloneRadioButton.Checked)
            {
                new VMCloneAction(_vm, NameTextBox.Text, DescriptionTextBox.Text).RunAsync();
                Close();
                return;
            }

            if (srPicker1.SR == null)
            {
                return;
            }

            var action = new VMCopyAction(_vm, _vm.GetStorageHost(false), srPicker1.SR, NameTextBox.Text, DescriptionTextBox.Text);

            action.RunAsync();
            Close();
        }