Here’s one way:

heat_template_version: 2013-05-23
parameters:
  image:
    type: string
    default: TestVM
  flavor:
    type: string
    default: m1.micro
  network:
    type: string
    default: cirros_net2

resources:
  serv_1:
    type: OS::Nova::Server
    properties:
      image: { get_param: image }
      flavor: { get_param: flavor }
      networks:
        - network: {get_param: network}
      scheduler_hints: {different_host: {get_resource: serv_2}}
   serv_2:
    type: OS::Nova::Server
    properties:
      image: { get_param: image }
      flavor: { get_param: flavor }
      networks:
        - network: {get_param: network}
      scheduler_hints: {different_host: {get_resource: serv_1}}

Note: In order to the above mentioned scheduler hints to work, the following 
scheduler filter should be enabled for nova scheduler
          SameHostFilter and
          DifferentHostFilter

There’s another way of doing it using OS::Nova::ServerGroup, but it’s available 
only since Juno.

-
Dimitri

From: Daniel Comnea <[email protected]<mailto:[email protected]>>
Reply-To: "OpenStack Development Mailing List (not for usage questions)" 
<[email protected]<mailto:[email protected]>>
Date: Sunday 24 May 2015 12:24
To: "OpenStack Development Mailing List (not for usage questions)" 
<[email protected]<mailto:[email protected]>>
Subject: Re: [openstack-dev] [heat][nova]: anti-affinity policy via heat in 
IceHouse?

Thanks Kevin !

Would you have an example?

Much appreciated,
Dani


On Sun, May 24, 2015 at 12:28 AM, Fox, Kevin M 
<[email protected]<mailto:[email protected]>> wrote:
It works with heat. You can use a scheduler hint on the instance and the server 
group resource to make a new one.

Thanks,
Kevin

________________________________
From: Daniel Comnea
Sent: Saturday, May 23, 2015 3:17:11 PM
To: OpenStack Development Mailing List (not for usage questions)
Subject: [openstack-dev] [heat][nova]: anti-affinity policy via heat in 
IceHouse?

Hi,

I'm aware of the anti-affinity policy which you can create via nova cli and 
associated instances with it.
I'm also aware of the default policies in nova.conf

by creating instances via HEAT is any alternatives to create instances part of 
anti-affinity group?

Thx,
Dani

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: 
[email protected]?subject:unsubscribe<http://[email protected]?subject:unsubscribe>
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: [email protected]?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to