Forum Discussion
Ansh_Jain_36819
Nimbostratus
Dec 04, 2018Trying to add persistence profile in existing virtual server
I am trying to add persistence profile in an existing Virtual server but not able to do so. It is showing some errors.
Add-PSSnapIn iControlSnapIn
Initialize-F5.iControl -Hostname "hostname" -Username "username" -Password "password"
$virtual_name = New-Object iControl.CommonVirtualServerDefinition
$virtual_name.name="app035"
$virtual_name.address="0.0.0.0"
$virtual_name.port=80
$vir_server = New-Object iControl.LocalLBVirtualServerVirtualServerPersistence
$vir_server.default_profile = $false
$vir_server.profile_name="cookie"
(Get-F5.iControl).LocalLBVirtualServer.add_persistence_profile($virtual_name,$vir_server)
Error this time is -
Exception calling "add_persistence_profile" with "2" argument(s): "Exception caught in
LocalLB::urn:iControl:LocalLB/VirtualServer::add_persistence_profile()
Exception: Common::OperationFailed
primary_error_code : 16908342 (0x01020036)
secondary_error_code : 0
error_string : 01020036:3: The requested virtual server
(/Common/iControl.CommonVirtualServerDefinition) was not found."
At line:12 char:1
+ (Get-F5.iControl).LocalLBVirtualServer.add_persistence_profile($virtu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : SoapHeaderException
I am making some mistake not sure what exactly is that. Could someone please help me out with this ?
- Satoshi_Toyosa1Ret. Employee
I do not know PowerShell, but from the error message,
, I would say that the virtual does not exist. Check if exists.The requested virtual server (/Common/iControl.CommonVirtualServerDefinition) was not found
If that's not the case, I suspect the data format of the persistence profile(s). It must be given in array (
). For example, to perform the task equivalent to the following tmsh command (adding[]
persistence profile to the virtualcookie
😞vs
tmsh modify ltm virtual vs persist replace-all-with { cookie }
You need to PATCH the
endpoint with the data/mgmt/tm/ltm/virtual/vs
.{"persist":[ {"name":"cookie"} ]}
A curl call looks like this:
curl -sku : https:///mgmt/tm/ltm/virtual/vs \ -X PATCH -H "Content-type: application/json" \ -d '{"persist":[ {"name":"cookie"} ]}'
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects