private string GetCellText(int cellIndex) { switch (cellIndex) { case 0: return(VDI.Name); case 1: if (Helpers.BostonOrGreater(VDI.Connection)) { string name; if (VDI.sm_config.TryGetValue("displayname", out name)) { return(name); } return(string.Empty); } StorageLinkVolume volume = showStorageLink ? VDI.StorageLinkVolume(Program.StorageLinkConnections.GetCopy()) : null; return(volume == null ? string.Empty : volume.Name); case 2: return(VDI.Description); case 3: return(VDI.SizeText); case 4: return(VDI.VMsOfVDI); default: return(""); } }
public static Icons GetIconFor(StorageLinkVolume storageLinkVolume) { VDI vdi = storageLinkVolume.VDI(ConnectionsManager.XenConnectionsCopy); if (vdi != null) { return(GetIconFor(vdi)); } return(Icons.StorageLinkVolume); }
private VirtualTreeNode AddStorageLinkVolumeNode(StorageLinkVolume storageLinkVolume) { string name = storageLinkVolume.FriendlyName; VDI vdi = storageLinkVolume.VDI(ConnectionsManager.XenConnectionsCopy); if (vdi != null) { name = string.Format("{0} ({1})", vdi.Name, name); } return(AddNode(name, Images.GetIconFor(storageLinkVolume), false, storageLinkVolume)); }
private static ListViewItem CreateListViewItem(StorageLinkVolume vol) { var item = new ListViewItem(vol.Name) { Tag = vol, ImageIndex = (int)Images.GetIconFor(vol), Name = vol.opaque_ref, Checked = true }; item.SubItems.Add(Util.DiskSizeString(vol.Capacity * 1024L * 1024L)); return(item); }
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: if (Helpers.BostonOrGreater(VDI.Connection)) { string name; if (VDI.sm_config.TryGetValue("displayname", out name)) { return(name); } return(string.Empty); } StorageLinkVolume vol = VDI.StorageLinkVolume(Program.StorageLinkConnections.GetCopy()); return(vol == null ? string.Empty : vol.Name); case 5: return(VDI.SizeText); case 6: return(VBD.read_only ? Messages.YES : Messages.NO); case 7: return(GetPriorityString(VBD.IONice)); 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)); } }
private void CopyNode(VirtualTreeNode src, VirtualTreeNode dest) { StorageLinkVolume volume = src.Tag as StorageLinkVolume; dest.Text = src.Text; dest.Tag = src.Tag; dest.Name = src.Name; dest.ImageIndex = src.ImageIndex; dest.SelectedImageIndex = src.SelectedImageIndex; dest.ShowCheckBox = src.ShowCheckBox; dest.Checked = dest.ShowCheckBox && listView.Items.Find(src.Name, false).Length > 0; foreach (VirtualTreeNode n in src.Nodes) { if (NodeMatches(n)) { dest.Nodes.Add(new VirtualTreeNode(string.Empty)); CopyNode(n, dest.Nodes[dest.Nodes.Count - 1]); } } }
public static Icons GetIconFor(IXenObject o) { VM vm = o as VM; if (vm != null) { return(GetIconFor(vm)); } VM_appliance appl = o as VM_appliance; if (appl != null) { return(GetIconFor(appl)); } SR sr = o as SR; if (sr != null) { return(GetIconFor(sr)); } Host host = o as Host; if (host != null) { return(GetIconFor(host)); } Pool pool = o as Pool; if (pool != null) { return(GetIconFor(pool)); } XenAPI.Network network = o as XenAPI.Network; if (network != null) { return(GetIconFor(network)); } VDI vdi = o as VDI; if (vdi != null) { return(GetIconFor(vdi)); } VBD vbd = o as VBD; if (vbd != null) { return(GetIconFor(vbd)); } Folder folder = o as Folder; if (folder != null) { return(GetIconFor(folder)); } PIF pif = o as PIF; if (pif != null) { return(GetIconFor(pif)); } StorageLinkServer storageLinkServer = o as StorageLinkServer; if (storageLinkServer != null) { return(GetIconFor(storageLinkServer)); } StorageLinkSystem storageLinkSystem = o as StorageLinkSystem; if (storageLinkSystem != null) { return(GetIconFor(storageLinkSystem)); } StorageLinkPool storageLinkPool = o as StorageLinkPool; if (storageLinkPool != null) { return(GetIconFor(storageLinkPool)); } StorageLinkVolume storageLinkVolume = o as StorageLinkVolume; if (storageLinkVolume != null) { return(GetIconFor(storageLinkVolume)); } StorageLinkRepository storageLinkRepository = o as StorageLinkRepository; if (storageLinkRepository != null) { return(GetIconFor(storageLinkRepository)); } System.Diagnostics.Trace.Assert(false, "You asked for an icon for a type I don't recognise!"); return(Icons.XenCenter); }
public static Icons GetIconFor(StorageLinkVolume storageLinkVolume) { VDI vdi = storageLinkVolume.VDI(ConnectionsManager.XenConnectionsCopy); if (vdi != null) { return GetIconFor(vdi); } return Icons.StorageLinkVolume; }
private VirtualTreeNode AddStorageLinkVolumeNode(VirtualTreeNode parent, int index, StorageLinkVolume storageLinkVolume) { string name = storageLinkVolume.FriendlyName; VDI vdi = storageLinkVolume.VDI(ConnectionsManager.XenConnectionsCopy); if (vdi != null) { name = string.Format("{0} ({1})", vdi.Name, name); } return AddNode(parent, index, name, Images.GetIconFor(storageLinkVolume), false, storageLinkVolume); }
protected void SetAppliesTo(IXenObject xo) { if (xo == null) { return; } if (xo is Pool) { Pool pool = (Pool)xo; AppliesTo.Add(pool.opaque_ref); } else if (xo is Host) { Host host = (Host)xo; SetAppliesTo(Helpers.GetPoolOfOne(host.Connection)); AppliesTo.Add(host.opaque_ref); } else if (xo is VM) { VM vm = (VM)xo; SetAppliesTo(vm.Home()); AppliesTo.Add(vm.opaque_ref); } else if (xo is SR) { SR sr = (SR)xo; SetAppliesTo(sr.Home); AppliesTo.Add(sr.opaque_ref); } else if (xo is VDI) { VDI vdi = (VDI)xo; SetAppliesTo(vdi.Connection.Resolve(vdi.SR)); } else if (xo is StorageLinkServer) { AppliesTo.Add(xo.opaque_ref); } else if (xo is StorageLinkSystem) { StorageLinkSystem system = (StorageLinkSystem)xo; AppliesTo.Add(system.opaque_ref); SetAppliesTo(system.StorageLinkServer); } else if (xo is StorageLinkPool) { StorageLinkPool pool = (StorageLinkPool)xo; AppliesTo.Add(xo.opaque_ref); if (pool.Parent == null) { SetAppliesTo(pool.StorageLinkSystem); } else { SetAppliesTo(pool.Parent); } } else if (xo is StorageLinkVolume) { StorageLinkVolume volume = (StorageLinkVolume)xo; AppliesTo.Add(xo.opaque_ref); SetAppliesTo(volume.StorageLinkPool); } }
private static ListViewItem CreateListViewItem(StorageLinkVolume vol) { var item = new ListViewItem(vol.Name) { Tag = vol, ImageIndex = (int)Images.GetIconFor(vol), Name = vol.opaque_ref, Checked = true }; item.SubItems.Add(Util.DiskSizeString(vol.Capacity * 1024L * 1024L)); return item; }