Ask Your Question
0

nova console-log doesn't show the whole output

asked 2016-07-11 10:34:29 -0500

jlausuch gravatar image

I am creating 2 VMs with the following userdata in the first one:

#!/bin/sh
while true; do
 ssh -y -i /home/cirros/.ssh/id_rsa cirros@10.10.10.12 hostname
 sleep 1
done

10.10.10.12 is the IP of the second VM (fixed ips).

When I login to VM1 (via ip netns) I run the metadata manually like this:

$/run/cirros/datasource/data/user-data
Host '10.10.10.12' key accepted unconditionally.
(fingerprint md5 dc:c4:c2:f0:37:3c:f7:33:46:8c:d6:20:20:98:0c:95)
vm-test2

Host '10.10.10.12' key accepted unconditionally.
(fingerprint md5 dc:c4:c2:f0:37:3c:f7:33:46:8c:d6:20:20:98:0c:95)
vm-test2
...

Which is the output I want. However, when looking at nova console-log of the VM1 on the OpenStack controller:

$ nova console-log vm-test1
Host '10.10.10.12' key accepted unconditionally.
(fingerprint md5 dc:c4:c2:f0:37:3c:f7:33:46:8c:d6:20:20:98:0c:95)

Host '10.10.10.12' key accepted unconditionally.
(fingerprint md5 dc:c4:c2:f0:37:3c:f7:33:46:8c:d6:20:20:98:0c:95)
...

I see it attempts to ssh MV2 (and it doesn't complain) but it doesn't give the output that I expect vm-test2.

Any ideas why?

I am using Mitaka on Ubuntu 14.04.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2016-07-12 04:55:32 -0500

jlausuch gravatar image

updated 2016-07-12 04:55:49 -0500

It isn't a problem of OpenStack or Nova. It seems that Cirros' ssh client (Dropbear) doesn't place the output to stdout if not run directly by command line. It doesn't show anything if it's executed from other sources like Cron or in this case Userdata.

I found the explanation here: https://mplicka.cz/en/blog/reading-remote-output-from-ssh-client-when-run-in-cron-on-openwrt

In my case, just the reverse redirection made it work...

ssh -y -i /home/cirros/.ssh/id_rsa cirros@10.10.10.12 hostname </dev/zero

edit flag offensive delete link more
0

answered 2016-07-11 11:59:29 -0500

Redirect standard out to error, ie: ssh -y -i /home/cirros/.ssh/id_rsa cirros@10.10.10.12 hostname 1>2

edit flag offensive delete link more

Comments

It doesn't work either. I have tried some combinations like >&2&>&2&>&1. The funny thing is that if I add echo hello in the loop I can see "hello" in the console-log output...

jlausuch gravatar imagejlausuch ( 2016-07-11 14:29:28 -0500 )edit

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: 2016-07-11 10:34:29 -0500

Seen: 1,509 times

Last updated: Jul 12 '16