[PVE-User] With cloud-init some bug?

lyt_yudi lyt_yudi at icloud.com
Fri Mar 23 09:36:37 CET 2018


> 在 2018年3月23日,下午3:21,Wolfgang Bumiller <w.bumiller at proxmox.com> 写道:
> 
> On Fri, Mar 23, 2018 at 02:28:12PM +0800, lyt_yudi wrote:
>> 1. Use --sshkey  issue:
>> # qm set 111 --sshkey ~/.ssh/id_rsa.pub 
>> 400 Parameter verification failed.
>> sshkeys: invalid format - invalid urlencoded string: /root/.ssh/id_rsa.pub
>> 
>> qm set 111 --sshkey /root/.ssh/id_rsa.pub <vmid> [OPTIONS]
> 
> The hook reading the file is in pve-common, so you need to update that.

Up-to: 5.0-30 fix it.

> 
>> 2. Can't setup static ip address for vm's by cloud-init
>> Test not passed:
>> CentOS-6(CentOS-6-x86_64-GenericCloud.qcow2)
>> CentOS-7(CentOS-7-x86_64-GenericCloud.qcow2)
>> 
>> Debian-9(debian-9-openstack-amd64.qcow2)
>> only dhcp? configuration static mode is still used in DHCP!
>> 
>> Test passed:
>> Ubuntu-16.04(xenial-server-cloudimg-amd64-disk1.img)
>> Ubuntu-18.04(bionic-server-cloudimg-amd64.img)
>> 
>> Can’t use the static ip for some Linux OS, is it the reason why the cloud-init version is too low?
> 
> Possible. It also depends on how cloud-init is configured in these
> images. They may not have the nocloud data sources enabled.
> Try setting `citype: configdrive2`, that one should have existed longer.
will be try ...

but, use the dhcp mode , it’s had enable it, so maybe not for this reason!

[root at centos7-01 ~]# uname -a    
Linux centos7-01.test.cn 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root at centos7-01 ~]# cloud-init modules --mode final
Cloud-init v. 0.7.9 running 'modules:final' at Fri, 23 Mar 2018 08:27:47 +0000. Up 1939.19 seconds.
Cloud-init v. 0.7.9 finished at Fri, 23 Mar 2018 08:27:48 +0000. Datasource DataSourceNoCloud [seed=/dev/sr0][dsmode=net].  Up 1939.67 seconds
[root at centos7-01 ~]# mount /dev/sr0 /mnt/    
mount: /dev/sr0 is write-protected, mounting read-only
[root at centos7-01 ~]# cat /mnt/network-config 
version: 1
config:
    - type: physical
      name: eth0
      mac_address: 16:37:4B:30:0F:E6
      subnets:
      - type: dhcp4
    - type: nameserver
      address:
      - 114.114.114.114
      search:
      - test.cn

Use the static ip mode, the conf content is:
[root at centos7-01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
GATEWAY=192.168.0.254
HWADDR=16:37:4B:30:0F:E6
IPADDR=192.168.0.58/24
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

[root at centos7-01 ~]# cat /mnt/network-config 
version: 1
config:
    - type: physical
      name: eth0
      mac_address: 16:37:4B:30:0F:E6
      subnets:
      - type: static
        address: 192.168.0.58/24
        gateway: 192.168.0.254
    - type: nameserver
      address:
      - 114.114.114.114
      search:
      - test.cn


>> must be with cloudinit >= 17.1?
> 
> 0.7.9 from debian stretch should also work, older ones _may_ work with
> the configdrive2 type. I haven't tested older versions lately, but given
> that configdrive2 was the first one we had back when Alexandre started
> the original implementation it sure is worth a try.

another, will try to upgrade cloud-init >= 17.1

Thanks.






More information about the pve-user mailing list