Jump to content
Welcome to our new Citrix community!
  • 0

Citrix Hypervisor Powershell SDK 8.2 for New-Xenbond fails

Ravi Anamaneni1709162046


How can I create new VLAN and Corresponding bond?

 $infoNetwork = New-XenNetwork -NameLabel "VLAN XXXX Tagged" -NameDescription "Management Network on VLAN XXXX" -OtherConfig @{VLAN='XXXX';automatic='false'} -PassThru


Above creates new network, but doesn't add VLAN Tag and I have to assign same bond for 2 additional VLANs as well.

  $Pifs_3 = Get-XenPIF | ?{$_.device -eq "eth2"}
  $Pifs_4 = Get-XenPIF | ?{$_.device -eq "eth3"}

  New-XenBond -PassThru -Network $infoNetwork -Members $Pifs_3,$Pifs_4 -Mode active_backup -Properties @{automatic='false'} -Async

Below error message appears:
New-XenBond : Cannot convert 'System.Object[]' to the type 'XenAPI.XenRef`1[XenAPI.PIF]' required by parameter 'Members'. Specified method is not supported.

Link to comment

2 answers to this question

Recommended Posts

  • 0

Thanks for pointing to right direction, below is the modified code, which gets the bond created for 2 NICs, and VLAN Tagging.

# Create NIC bond

$Bond01 = New-XenNetwork -NameLabel "Bond 0+1" -NameDescription "Management Network on VLAN A" -OtherConfig @{automatic='false'} -PassThru 
$Bond23 = New-XenNetwork -NameLabel "Bond 2+3" -NameDescription "Data Network on VLAN X/Y/Z" -OtherConfig @{automatic='false'} -PassThru
Get-XenHost | % { 
$HName = $_.name_label
$Pifs_0 = (Get-XenHost -Name $HName).PIFs | Get-XenPIF | ?{$_.device -eq "eth0"}
$Pifs_1 = (Get-XenHost -Name $HName).PIFs | Get-XenPIF | ?{$_.device -eq "eth1"}
$Pifs_2 = (Get-XenHost -Name $HName).PIFs | Get-XenPIF | ?{$_.device -eq "eth2"}
$Pifs_3 = (Get-XenHost -Name $HName).PIFs | Get-XenPIF | ?{$_.device -eq "eth3"}

New-XenBond -PassThru -Network $Bond01 -Members $Pifs_0,$Pifs_1 -Mode balance_slb
New-XenBond -PassThru -Network $Bond23 -Members $Pifs_2,$Pifs_3 -Mode active_backup } 


# Create VLAN Tagging
$VLAN1 = New-XenNetwork -NameLabel "VLAN X Tagged" -NameDescription "Data Network on VLAN X" -OtherConfig @{automatic='false'} -PassThru
$VLAN2 = New-XenNetwork -NameLabel "VLAN Y Tagged" -NameDescription "Data Network on VLAN Y" -OtherConfig @{automatic='false'} -PassThru
$VLAN3 = New-XenNetwork -NameLabel "VLAN Z Tagged" -NameDescription "Data Network on VLAN Z" -OtherConfig @{automatic='false'} -PassThru
Get-XenHost | % { 
$HName = $_.name_label
$TagPif1 = (Get-XenHost -Name $HName).PIFs | Get-XenPIF | ?{$_.device -eq "bond1"}

New-XenVLAN -PassThru -TaggedPIF $TagPif1 -Tag X -Network $VLAN1
New-XenVLAN -PassThru -TaggedPIF $TagPif1 -Tag Y -Network $VLAN2
New-XenVLAN -PassThru -TaggedPIF $TagPif1 -Tag Z -Network $VLAN3  }



Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...