Virtualisation
Virtualisation
Delete multiple XenServer orphan SR’s
0When a Citrix XenServer, member of a Resource Pool, is reinstalled the local storage repositories (Local storage, DVD drive) are left in the resource pool as orphans. In XenCenter, below a Resource Pool, these SR’s are marked with a red bullet.
When there are a few of these orphaned SR, you can remove these with the console command:
xe sr-list uuid ( RO) : 9901ddd7-6c40-98cf-9ebd-ad381d651ec7 name-label ( RW): DVD drives name-description ( RW): Physical DVD drives host ( RO): <not in database> type ( RO): udev content-type ( RO): iso
Note uuid of the SR’s with:
host (RO): <not in database>
To delete this SR:
xe sr-forget uuid=
But what to do if there are to much of the orphaned SR’s ? The procedure above is very time-consuming.
Lets see if Powershell can help solve this problem. For XenServer, as for other Citrix products, are Powershell cmd-lets available. With the help from this Pdf I found the cmd-let to get the SR list.
The command let to get a list of all the SR’s is:
Get-XenServer:SR
I had to find out which property of the SR’s is one of the orphaned SR’s… It appears that an orphaned SR has no PBD’s assigned. Because this property is returned as an array I need a way to determine a way to check this. When an array is empty teh array count is “0″.
Get-XenServer:SR | where-object {$_.PBDs.count -eq 0}
Now we have al the UUID os the orpahned SR’s. To delete a SR in Powershell:
Invoke-XenServer:SR.Forget -SR
Combined in a script, with all the logic and cmd-lets check, will result in:
function checkForPSSnapins ()
{
Write-Host "-- Verifying PowerShell snapin..."
#Check if the snapin is installed AND registered properly.
if(Get-PSSnapin -Name "XenServerPSSnapIn" -Registered -ErrorAction SilentlyContinue){
#if the snapin is not loaded, load it.
if (!(Get-PSSnapin "XenServerPSSnapIn" -ErrorAction SilentlyContinue)) {
Write-Host "-- Loading XenServerPSSnapIn."
Add-PSSnapin XenServerPSSnapIn
}
}
else{
Write-Host "-- Citrix XenServerPSSnapIn is not installed/registered on this machine."
Write-Host "-- Download The XenServer SDK for PowerShell from: http://www.community.citrix.com/cdn/xs/sdks"
Write-Host "-- Script will now exit."
exit
}
}
$POOLMASTER = "FSX-DC1-001"
$USERNAME = "root"
$PASSWORD = "Password"
checkForPSSnapins
Clear-Host
$XS = Connect-XenServer -url http://$POOLMASTER -UserName $USERNAME -Password $PASSWORD
$objSRs = Get-XenServer:SR | Where-Object {$_.PBDs.count -eq 0} | sort-object -Property name_label
ForEach ($objSR in $objSRs)
{
Write-host $objSR.name_label " " $objSR.uuid
Invoke-XenServer:SR.Forget -SR $objSR.uuid
}
VMware vSphere PowerCLI Admin Guide
The vSphere PowerCLI Administration Guide provides information about using the VMware vSphere PowerCLI cmdlets set that ships with vSphere PowerCLI for managing, monitoring, automating, and handling life‐cycle operations for VMware vSphere components—virtual machines, datacenters, storage, networks, and so on.
10 Xendesktop misstakes
0Starting May, the Citrix Lead Architect for Worldwide Consulting Solutions Daniel Feller published a series of posts about the top 10 mistakes that can be done when implementing a desktop virtualization solution.
The last one was published earlier today, so here’s the complete list:
- Misconfiguration of storage
- Using VDI Defaults
- Not spending your cache wisely
- Not Optimizing the Desktop Image
- Managing the incoming storm
- Protection from Anti-Virus
- Improper Resource Allocation
- Lack of Application Virtualization Strategy
- Not considering the user profile
- Not calculating user bandwidth requirements
Update: Also as PDF:
XD - Top 10 Mistakes Identified When Doing Desktop Virtualization.pdf (647.7 KiB, 378 hits)