protected override void Run() { if (_vbdMode != _vbd.mode) { VBD.set_mode(Session, _vbd.opaque_ref, _vbdMode); } if (_priority != _vbd.GetIoNice()) { _vbd.SetIoNice(_priority); VBD.set_qos_algorithm_params(Session, _vbd.opaque_ref, _vbd.qos_algorithm_params); } if (!_changeDevicePosition) { return; } if (_other != null) { // We're going to have to do a swap SetUserDevice(Session, VM, _other, _vbd.userdevice, false); SetUserDevice(Session, VM, _vbd, _devicePosition, true); if (VM.power_state == vm_power_state.Running && _other.allowed_operations.Contains(vbd_operations.plug)) { VBD.plug(Session, _other.opaque_ref); } } else { SetUserDevice(Session, VM, _vbd, _devicePosition, false); } }
private object CellValue(int col) { switch (col) { case 0: return(VBD.userdevice); case 1: return(VDI.Name()); case 2: return(VDI.Description()); case 3: return(SR.Name()); case 4: string name; return(VDI.sm_config.TryGetValue("displayname", out name) ? name : ""); case 5: return(VDI.SizeText()); case 6: return(VBD.IsReadOnly() ? Messages.YES : Messages.NO); case 7: return(GetPriorityString(VBD.GetIoNice())); case 8: return(VBD.currently_attached ? Messages.YES : Messages.NO); case 9: return(VBD.device == "" ? Messages.STORAGE_PANEL_UNKNOWN : string.Format("/dev/{0}", VBD.device)); default: throw new ArgumentException(String.Format("Invalid column number {0} in VBDRenderer.CellValue()", col)); } }