示例#1
0
            public VMUsbRow(VUSB vusb)
            {
                _vusb = vusb;
                _vusb.PropertyChanged += Vusb_PropertyChanged;

                Cells.AddRange(locationCell,
                               descriptionCell,
                               attachedCell);
                UpdateDetails();
            }
示例#2
0
 private void SetVm()
 {
     if (_pusb != null)
     {
         USB_group usbgroup = _pusb.Connection.Resolve(_pusb.USB_group);
         VUSB      vusb     = (usbgroup != null && usbgroup.VUSBs != null && usbgroup.VUSBs.Count > 0) ? _pusb.Connection.Resolve(usbgroup.VUSBs[0]) : null;
         _vm = vusb == null ? null : _pusb.Connection.Resolve(vusb.VM);
         if (_vm != null)
         {
             _vm.PropertyChanged += Vm_PropertyChanged;
         }
     }
 }
示例#3
0
        protected override void Run()
        {
            if (!VM.UsingUpstreamQemu())
            {
                Dictionary <string, string> platform = VM.platform == null ?
                                                       new Dictionary <string, string>() :
                                                       new Dictionary <string, string>(VM.platform);
                platform["device-model"] = "qemu-upstream-compat";
                VM.set_platform(Session, VM.opaque_ref, platform);
            }

            XenRef <VUSB> vusbRef = VUSB.create(Session, VM.opaque_ref, _pusb.USB_group, null);

            Description = Messages.ACTION_VUSB_CREATED;
        }
 protected override void Run()
 {
     try
     {
         if ((_vusb.currently_attached) &&
             XenAPI.VUSB.get_allowed_operations(Session, _vusb.opaque_ref).Contains(XenAPI.vusb_operations.unplug))
         {
             RelatedTask = VUSB.async_unplug(Session, _vusb.opaque_ref);
             PollToCompletion(0, 50);
         }
     }
     finally
     {
         PercentComplete = 50;
         RelatedTask     = VUSB.async_destroy(Session, _vusb.opaque_ref);
         PollToCompletion(51, 100);
     }
     Description = Messages.ACTION_VUSB_DELETED;
 }
 public DeleteVUSBAction(VUSB vusb, VM vm) :
     base(vusb.Connection, String.Format(Messages.ACTION_VUSB_DELETING, vusb.Name(), vm.Name()))
 {
     _vusb = vusb;
 }