![](http://content.invisioncic.com/m329563/set_resources_3/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Konstantina Chremmou
-
Posts
22 -
Joined
-
Last visited
-
Days Won
1
Content Type
Forums
Articles
Labs
Videos
TechZone
Citrix Community Articles
Events
Profiles
Posts posted by Konstantina Chremmou
-
-
The command works using the -Name too, as long as the variable is passed in correctly:
PS> $vmName="myVM" PS> get-xenvm -name $vmName | select HVM_boot_params HVM_boot_params --------------- {[order, cd], [firmware, uefi]} PS> $HVMBootParams = @{ "firmware" = "bios";"order" = "n"} PS> set-xenvm -name $vmName -HVMBootParams $HVMBootParams PS> get-xenvm -name $vmName | select HVM_boot_params HVM_boot_params --------------- {[order, n], [firmware, bios]}
-
You're passing in the SR uuid to parameter -SR, however this needs a reference. You can obtain it as follows:
get-xenSR -uuid xxx | ConvertTo-XenRef
-
The command looks correct, but the syntax does not look PS compliant. The hash table should be declared as follows:
$HVMBootParams = @{ "firmware" = "uefi";"order" = "n"}
i.e. with semicolon separating the pairs and no commas within the keys.
Also, use $VMNAME for the name variable.
-
Get-Help does not work very well for the CH powershell module because the cmdlets use heavily dynamic parameters. We're planning to work around this issue soon.
-
A simpler way to write the above is
Get-XenHost -Name "hostname" | select -Expandproperty resident_VMs | Get-XenVM
However, you mentioned affinity to a home server. This is not the same as the server where the VM runs. Affinity is the server where we prefer the VM to run, but if there are no available resources, it may run on a different server. The above snippet returns the VMs currently running on a given server, but it doesn't mean that all these VMs have this server affinity or any affinity at all.
To query VMs with a certain server affinity:
Get-XenVM | where {$_.affinity -eq $h.opaque_ref}
-
If the VDI you want to remove is from a media drive:
$myVbd = Get-XenVM -name "MyVm" | select -ExpandProperty VBDs | Get-XenVBD | where {$_.type -eq [XenAPI.vbd_type]::CD} Invoke-XenVBD -XenAction Eject -Ref $myVbd.opaque_ref
-
Invoke-XenPool -Pool -$pool -XenAction DesignateNewMaster -XenHost $hostRef
-
This update is a livepatch, i.e. if live installation succeeds, the reboot will not be needed and XenCenter will skip it. If something has gone wrong and reboot is still needed there should be an indication in the Updates section of the server's General Tab, in which case you'll have to do it manually. Was there such an indication?
-
From the error message it looks like one or both of the queries have returned multiple objects and $Pifs_3 or $Pifs_4 is an array rather than a single PIF.
-
PCI info is exposed via the SDK/API (http://xapi-project.github.io/xen-api/classes/pci.html), but I think it's not exposed via the xe CLI (https://docs.citrix.com/en-us/citrix-hypervisor/command-line-interface.html). Using the PowerShell module, for example, you can obtain it via the cmdlet Get-XenPCI.
-
1
-
-
How did you switch the servers off? Did you do it via XenCenter/CLI or from outside it?
-
$platform = Get-XenVM -uuid xxxx | select -ExpandProperty platform $platform["cores-per-socket"]=yyy Set-XenVM -uuid xxxx -Platform $platform
All the Citrix Hypervisor SDK flavours as well as the CLI are API wrappers, which means there is practically nothing the one can achieve that the other cannot. For a generic overview of the powershell cmdlets, please install the module and type (as mentioned in the accompanying readme):
PS> Get-Help about_XenServer
-
To re-attach you need to work along the following lines:
$hostRef = (Get-XenHost).opaque_ref $deviceConfig = @{ "target"="192.168.x.x"; "port"="xxxx"; "targetIQN"="xxxxxx"; "SCSIid"="xxxxx" } $result = Invoke-XenSR -XenAction Probe -XenHost $hostRef -Type "lvmoiscsi" -DeviceConfig $deviceConfig -Ref OpaqueRef:NULL -PassThru $doc=[xml]$result $sr = Invoke-XenSR -XenAction Introduce -UuidParam $doc.SRlist.SR.UUID -NameLabel mySR -Type "lvmoiscsi" -Shared $true -Ref OpaqueRef:NULL -PassThru $pbd = New-XenPBD -XenHost $hostRef -SR $sr -DeviceConfig $deviceConfig -PassThru Invoke-xenPBD -XenAction Plug -PBD $pbd
Now, I'm not 100% sure how your test goes about it, but if your SR supports replication and the reattach is part of a DR task, you can do:
New-XenDRTask -Type "lvmoiscsi" -DeviceConfig $deviceConfig -PassThru
On a general note, the powershell cmdlets wrap the C# SDK used by XenCenter, which means most stuff XenCenter does can be achieved with powershell, but sometimes it's tricky to find the right cmdlets to use. It may be helpful to look at how XenCenter (https://github.com/xenserver/xenadmin) does things and try to replicate it with powershell.
-
1
-
-
The target/IQN should be in the DeviceConfig. Try this:
New-XenSR -NameLabel "mySR" -XenHost "hostname" -Type "lvmoiscsi" -Shared $true ` -DeviceConfig @{ "target"="192.168.x.x"; "port"="xxxx"; "targetIQN"="xxxxxx"; "SCSIid"="xxxxx" }
-
There are several new calls in the CR stream. For example, those added in 8.0 are listed at http://xapi-project.github.io/xen-api/releases/naples.html
The navigation map on the right of the above page has a comprehensive list of changes per release. For everything after the LTSR, please use the links from 7.2 onwards.
-
There are no API changes between 7.1 and 7.1 CU1/CU2 apart from some new error codes. The cmdlets are the same.
-
Please have a look at the sample script AutomatedTestCore.ps1 which is shipped within the XenServerSDK.zip under folder XenServerPowershell\samples (the script is also at https://github.com/xapi-project/xen-api-sdk/blob/master/powershell/autogen/samples/AutomatedTestCore.ps1 )
-
Hi IT-John,
Please note that this is not the right board for issues with package installation, for questions in this area please try the developers mailing list https://lists.xenserver.org/sympa/subscribe/xs-devel and/or this board https://discussions.citrix.com/forum/1344-miscellaneous/ instead.
-
This should work for you:
PS> Get-XenVM -Name vmName | select -ExpandProperty VBDs | Get-XenVBD | where {$_.type -eq "CD"} | Invoke-XenVBD -XenAction Insert -VDI (Get-XenVDI -Name "$BootISOName" | select -ExpandProperty opaque_ref)
-
1
-
-
This is not going to work because at the moment the -VDI parameter does not accept pipeline input, and additionally it is a reference, not a VDI object.
The most PS-like way I can think of writing your command is:
PS> Invoke-XenVBD -VBD (Get-XenVBD)[2] -XenAction Insert -VDI (Get-XenVDI -Name "$BootISOName" | select -ExpandProperty opaque_ref)
or
PS> (Get-XenVBD)[2] | Invoke-XenVBD -XenAction Insert -VDI (Get-XenVDI -Name "$BootISOName" | select -ExpandProperty opaque_ref)
-
The Insert action requires the VDI's reference, not the uuid. The following should work for you:
PS> Invoke-XenVBD -Uuid $vbd.uuid -XenAction Insert -VDI $cd.opaque_ref
Add disk to VM PowerShell script issue
in Storage
Posted
By the way, for questions on the XenServer PoSh module, this forum is better https://community.citrix.com/forums/forum/1118-xenserver-sdk/