Service Fabric Placement Policy in ApplicationManifest.xml

116 Views Asked by At

Need to know how to add Placement Policy in application manifest.xml

I have this PS script

New-ServiceFabricService -ApplicationName fabric:/$appName123 -ServiceName fabric:/$appName123/MyApp1 -ServiceTypeName $serviceTypeName -Stateless –PartitionSchemeSingleton –PlacementPolicy @(“AllowMultipleStatelessInstancesOnNode”) -InstanceCount 10 -ServicePackageActivationMode ExclusiveProcess

What will be the equivalent in ApplictionManifest.xml?

`

 <Service Name="App" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="Service" InstanceCount="[InstanceCount]">
        <SingletonPartition />
       // this tag
       <ServicePlacementPolicies>
          <ServicePlacementPolicy Type="AllowMultipleStatelessInstancesOnNode" />
        </ServicePlacementPolicies>

      </StatelessService>
    </Service>

`

get xml equivalent of powershell command


This I got from ChatGPT :). Yet to try this.

<ServiceManifestImport>
  <ServiceTypeName>MyServiceType</ServiceTypeName>
  <ServiceManifestRef ServiceManifestName="MyServiceManifest" ServiceManifestVersion="1.0.0" />
  <PlacementPolicy>
    <Policy Type="InvalidDomain" DomainName="MyPlacementPolicy" />
  </PlacementPolicy>
</ServiceManifestImport>
1

There are 1 best solutions below

0
Vinay Bhat On

To you app manifest/service manifest, could you please try updating the placement policy like this:

<ServicePlacementPolicy DomainName="fd:/placeholder" Type="AllowMultipleStatelessInstancesOnNode" />

Note the addition of a DomainName -- this is a placeholder and not used anywhere but needed for compatibility with ServicePlacementPolicy schema.

Please feel free to reach out to vibha microsoft com for any questions around the AllowMultipleStatelessInstancesOnNode placement policy.