[ovirt-users] Start VM with cloud_init and ssh key using REST API
Juan Hernández
jhernand at redhat.com
Tue Apr 5 08:41:06 UTC 2016
On 04/05/2016 10:30 AM, Vishal Panchal wrote:
> Hello,
>
> I have already create vm and configure network properties using cloud
> init and REST API.But now I want to implement SSH feature.So I used
> following XML request but it give me bad request response.
>
> XML Request :
>
> <action>
> <vm>
> <initialization>
> <host_name>arpitttt</host_name>
> <authorized_keys>
> <authorized_key>
> <user>
> <user_name>root</user_name>
> </user>
> <key>ssh-rsa 75:7f:42:b6:ec:83:a4:30:a9:07:fc:41:39:d0:49
> root at vishal_local.localdomain</key>
> </authorized_key>
> </authorized_keys>
The element to set SSH authorized keys is "authorized_ssh_keys", and it
should contain a line per key:
<authorized_ssh_keys>ssh-rsa 75....</authorized_ssh_keys>
So your complete request should look like this:
<action>
<vm>
<initialization>
<host_name>arpitttt</host_name>
<authorized_ssh_keys>ssh-rsa
75:7f:42:b6:ec:83:a4:30:a9:07:fc:41:39:d0:49
root at vishal_local.localdomain</authorized_ssh_keys>
<regenerate_ssh_keys>true</regenerate_ssh_keys>
<dns_servers>8.8.8.8</dns_servers>
<nic_configurations>
<nic_configuration>
<name>eth1</name>
<boot_protocol>STATIC</boot_protocol>
<ip address="51.254.56.84" netmask="255.255.255.255"
gateway="149.202.85.254" />
<on_boot>true</on_boot>
</nic_configuration>
</nic_configurations>
<root_password>Vishal at 131</root_password>
<user_name>root</user_name>
</initialization>
</vm>
<use_cloud_init>true</use_cloud_init>
</action>
> <regenerate_ssh_keys>true</regenerate_ssh_keys>
> <dns_servers>8.8.8.8</dns_servers>
> <nic_configurations>
> <nic_configuration>
> <name>eth1</name>
> <boot_protocol>STATIC</boot_protocol>
> <ip address="51.254.56.84" netmask="255.255.255.255"
> gateway="149.202.85.254" />
> <on_boot>true</on_boot>
> </nic_configuration>
> </nic_configurations>
> <root_password>Vishal at 131</root_password>
> <user_name>root</user_name>
> </initialization>
> </vm>
> <use_cloud_init>true</use_cloud_init>
> </action>
>
>
> Regards,
> *Vishal Panchal*
> Software Developer
> *+918140283911*
> *
> *
> *<http:///sculptsoft.com>*
> * <https://www.facebook.com/SculptSoft> <https://www.linkedin.com/company/sculptsoft> <https://twitter.com/SculptSoft>*
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
--
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
More information about the Users
mailing list