zstackio / zstack

ZStack - the open-source IaaS software http://zstack.org (国内用户请至 http://zstack.io)
Apache License 2.0
1.3k stars 391 forks source link

Possible error on url_helper.py #236

Closed joubertredrat closed 8 years ago

joubertredrat commented 8 years ago

Hi guys,

I installed my Zstack from quick installation and used tutorial to flat network. my machines runs fine and I can connect on ttylinux, but problem is with another cloud images that use ssh keys to connect.

I'm using official Ubuntu and CentOS cloud image, but when I start VM after set network, have a error on url_helper.py and I think that because this I can't connect on my VMs.

vm1

vm2

λ ssh -i zstack3.pem root@192.168.5.198
The authenticity of host '192.168.5.198 (192.168.5.198)' can't be established.
ECDSA key fingerprint is e7:a1:08:ab:eb:b9:c3:8f:a1:26:0f:32:25:84:3f:1c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.5.198' (ECDSA) to the list of known hosts.
Permission denied (publickey).

I changed two times public and private keys and problem persist. All zstack services is running on CentOS 7. Note: Thanks for this Amazing project, for me is a perfect OpenStack alternative.

zxwing commented 8 years ago

Thanks for using ZStack. It seems your template was installed with cloud-init and was trying to connect to 169.254.169.254, which is the IP for AWS user data. ZStack's user data uses CloudStack style, you need to change the template to use CloudStack data source. For details, see http://zstack.org/blog/v1.0.html#userdata

joubertredrat commented 8 years ago

hi @zxwing Then I can't use official ubuntu or centos images on Zstack? for me it's strange, because I download image directly from ubuntu's site and I don't know how to edit cloud-init on image disk.

zxwing commented 8 years ago

Could you provide me a link to the image? If you use the official ISO, I am pretty sure there is no problem. If it's a pre-built .qcow2 image, maybe they have pre-installed the cloud-init, and the image is targeted to AWS EC2.

joubertredrat commented 8 years ago

Hi @zxwing

I'm using this images below.

https://uec-images.ubuntu.com/releases/14.04/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2

zxwing commented 8 years ago

@joubertredrat "The Ubuntu Cloud image can be run on your personal Ubuntu Cloud, or on public clouds that provide Ubuntu Certified Images." Those images are built for AWS's cloud-init version. I suggest you installing your images by ISO. We will release an image marketplace in middle of this year, then you can download ZStack's prebuilt images.

youyk commented 8 years ago

There is 1 simple way to work around this. You can manually mount the ubuntu image and change content in /etc/cloud/cloud.cfg to:

datasource_list:

After that, add the new modified image to ZStack. I didn't try with that, but it should be work.

Or you can completely disable the cloud-init script in that image.

joubertredrat commented 8 years ago

Hi guys, this is my results from test with @youyk's help.

1 - Ubuntu image already have CloudStack on datasource_list.

root@redrat-pc:~# cat /etc/cloud/cloud.cfg.d/90_dpkg.cfg
# to update this file, run dpkg-reconfigure cloud-init
datasource_list: [ NoCloud, ConfigDrive, OpenNebula, Azure, AltCloud, OVF, MAAS, GCE, OpenStack, CloudSigma, Ec2, CloudStack, SmartOS, None ]

2 - I changed like @youyk example, then now I have new error below.

vm2_1

VM now is trying to get information about new IP, in my case 192.168.5.191, but here, this IP is from my Virtual Router on L3 flat and when I connect it, I don't find any web service listening.

ssh root@192.168.5.191
root@192.168.5.191's password:
Last login: Sat Mar 19 21:42:20 2016 from 192.168.5.11
-bash-4.1# uname -a
Linux zstack-vr 2.6.32-504.12.2.el6.x86_64 #1 SMP Wed Mar 11 22:03:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
-bash-4.1# fuser 80/tcp
-bash-4.1# fuser 22/tcp
22/tcp:               1236  1448
-bash-4.1# /etc/init.d/zstack-appliancevm status
zstack appliance vm agent is running, pid is 1034
-bash-4.1# /etc/init.d/zstack-virtualrouter status
zstack virtual router agent is running, pid is 1075
-bash-4.1# netstat --listen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 *:domain                    *:*                         LISTEN
tcp        0      0 192.168.5.191:ssh           *:*                         LISTEN
tcp        0      0 *:watchme-7272              *:*                         LISTEN
tcp        0      0 *:7759                      *:*                         LISTEN
tcp        0      0 *:domain                    *:*                         LISTEN
udp        0      0 *:domain                    *:*
udp        0      0 *:bootps                    *:*
udp        0      0 192.168.5.191:ntp           *:*
udp        0      0 localhost:ntp               *:*
udp        0      0 *:ntp                       *:*
udp        0      0 *:domain                    *:*
udp        0      0 fe80::f829:77ff:febc:7a0:ntp *:*
udp        0      0 localhost:ntp               *:*
udp        0      0 *:ntp                       *:*
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ACC ]     STREAM     LISTENING     8473   @/var/run/hald/dbus-2tEIbVXfPb
unix  2      [ ACC ]     STREAM     LISTENING     6466   @/com/ubuntu/upstart
unix  2      [ ACC ]     STREAM     LISTENING     8346   /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     8436   /var/run/acpid.socket
unix  2      [ ACC ]     STREAM     LISTENING     8478   @/var/run/hald/dbus-MJWhrVPqG9

Now I have new questions for us to discuss.

1 - About datasource_list config, this Ubuntu image shouldn't be eligible to work on ZStack?

2 - Is correct to VM try to get informations from virtual router if don't have webserver running?

3 - I'm being noob? I don't know if I'm missing something.

youyk commented 8 years ago

@joubertredrat , I know what's wrong. Since 1.0, ZStack supports a new service provider, named Flat Network Service Provider, which support UserData service (like injecting ssh public key). The original ZStack virtual router service provider doesn't support that.

To use the new Flat Network Service Provider, you need to add "DHCP" and "Userdata" service when creating L3 Network (Please just refer the picture in http://zstack.org/cn/tutorials/flat-network-ui-no-vr.html#createL3Network) and don't select Virtual Router Service Provider.

In your current environment, you can directly delete the old L3 Network (after destroy current VMs), then create a new one, and try again. Please let us know what's going on.

joubertredrat commented 8 years ago

@youyk I will try here then, Can I help with documentation and tutorials on http://zstack.org/tutorials/ ?

Another question, Can I test with original Ubuntu image or I need to change like @zxwing saw?

youyk commented 8 years ago

@joubertredrat you are warmly welcome to do any contribution. The whole website is hosted in github and the source codes are here: https://github.com/zstackorg/zstackorg.github.io/tree/source . It is written by markdown. So if you can send pull request to the source branch, we can rebuild the whole website and push the output to master branch, which will be shown in http://zstack.org

BTW, just for you information, we are building a new website, which should be more easy to write posts, just like wordpress.

joubertredrat commented 8 years ago

Hi guys,

@youyk I maked changes on L3, now VM try to get metadata from gateway, as below.

vm3_1

My local network is 192.168.5.0/24 with 192.168.5.5 as gateway, on my L3 is flat l3 with IP range from 192.168.5.110 to 192.168.5.200 with 192.168.5.5 as gateway, 208.67.220.220 and 208.67.222.222 as DNS, DHCP and Userdata from Flat Network Service Provider. My Zstack is running on 192.168.5.100

youyk commented 8 years ago

Hi,

Please make sure UserData (provided by Flat Network Service Provider) service is selected in L3 Network Service.

On Mon, Mar 21, 2016 at 4:35 AM, Joubert RedRat notifications@github.com wrote:

Hi guys,

@youyk https://github.com/youyk I maked changes on L3, now VM try to get metadata from gateway, as below.

[image: vm3_1] https://cloud.githubusercontent.com/assets/1520407/13906957/f390a1ba-eec1-11e5-8c70-6072cae247b1.jpg

My local network is 192.168.5.0/24 with 192.168.5.5 as gateway.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/zstackorg/zstack/issues/236#issuecomment-199015433

Yongkang You

joubertredrat commented 8 years ago

Hi guys,

@youyk I defined this.

vm4_1

zxwing commented 8 years ago

@joubertredrat I guess you have not added any userdata to the VM. For the current version, if a VM has no userdata set, ZStack will not configure its metadata too(this will be fixed in the future version). So now please follow http://zstack.org/blog/v1.0.html to add some userdata to your VM then reboot it, you are supposed to see it works.

joubertredrat commented 8 years ago

Hi, I'm back

@zxwing have plans or roadmap for future version with this fix? Thanks.

youyk commented 8 years ago

@joubertredrat we have found the similar issue on CentOS 7 as well. But CentOS 6.7 VM image does work with same CloudInit setting. Could you help to check if CentOS 6.7 works in your environment?

We will fix this issue in ZStack 1.2 cycle (in April).

joubertredrat commented 8 years ago

Hi guys,

@youyk Okay, I will try on night (UTC -3) and report on here.

youyk commented 8 years ago

@joubertredrat we just built a CentOS6.7 image for you, which installed the correct cloud-init configuration. You can get it from http://download.zstack.org/templates/CentOS6.7-Cloud-init-100G.qcow2

youyk commented 8 years ago

We have fixed this issue. From ZStack 1.2, AWS UserData format is supported. All image (with cloud-init installed) will support ssh-key injection in ZStack by default.