Ask Your Question
0

How to restart a server within a heat template?

asked 2014-11-12 05:50:32 -0500

Shurik gravatar image

updated 2014-11-12 08:40:05 -0500

smaffulli gravatar image

I run create and assign volume to server via heat tempale

"server": {
    "type": "OS::Nova::Server", 
    "properties": {
       "image": {"get_param": "image_id"}, 
       "flavor": {"get_param": "instance_type"}, 
       "name": {"get_param": "instance_name"}
    }
 },
 "volume": {
   "type": "OS::Cinder::Volume",
   "properties": {
      "name": {"get_param": "volume_name"},
      "source_volid":{"get_param": "volume_id"}
   }
 },
 "volume_assign": {
    "depends_on": "volume",
    "type": "OS::Cinder::VolumeAttachment",
    "properties": {
       "instance_uuid": {"get_resource": "server"},
       "volume_id": {"get_resource": "volume"}
    }

When I login to server I don't see the attached volume. When I do the restart to this instance I can access to it.

My question is if I have any option to restart server( instance ) via template?

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2014-11-12 10:41:23 -0500

Shurik gravatar image

Do I have other way to ensure that when volume attached I will able to see it without reboot ?

edit flag offensive delete link more
1

answered 2016-07-18 02:56:26 -0500

Daniel Isla gravatar image

Hi,

If your devices are connected using PCI, you should issue a rescan of the PCI bus.

echo 1 > $(ls /sys/class/pci_bus/*/rescan)

You can use a cloud-init script to run this command automatically with the instance boot.

Regards, Daniel

edit flag offensive delete link more
1

answered 2014-11-12 07:10:44 -0500

zaneb gravatar image

updated 2014-11-12 07:13:09 -0500

There is not, unless you do it in a user data script or a software deployment. e.g. check if the volume is attached, and if not reboot - although it seems likely that there is a less drastic way to force the volume to be mounted.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-11-12 05:50:32 -0500

Seen: 767 times

Last updated: Jul 18 '16