On Wed, Nov 16, 2016 at 8:14 PM, Barak Yes, use cloud-init.

You can import the image directly as a template and then edit the template to add nics and cloud-init configuration.
(This way you can easily setup multipile preconfigured VMs from it. You don't have to use run-once for cloud-init).

> Does the image correspond to the qcow2 one downloadable from 
> http://cloud.centos.org/centos/7/atomic/images/

Yes.
>
> or does it contain any customization already related for deploying in oVirt itself?

No, its the exact same image.

HTH,
Barak Korren.


Ok,
I imported the atomic image as a template, then I added a nic to it and finally created a VM based on that template.
I specified to use "Cloud-Init/Sysprep" with parameters specified as in this image:
https://drive.google.com/file/d/0BwoPbcrMv8mvaGF5QWRKSjFJVWM/view?usp=sharing

Some notes:
1) hostname got acquired
2) time zone acquired
3) username and his password got acquired
(btw: he/she has already ability to do "sudo su -", probably embedded in the OS composition itself)
4) The network part is not so clear in my opinion
The line with the "Network" checkbox has an apparently drop down checkbox that is initially empty but shows nothing selecting the arrow
If I understand correctly one should manually write inside? I did so.
Initially I thought about the oVirt network and put "ovirtmgmt", but then I realized that it actually created an ifcfg-ovirmgmt file inside guest.....
So I retested using "eth0" (as in screenshot).
And it got the correct ip/netmask/gw ok, but NOT dns

-bash-4.2# cat /etc/sysconfig/network
NETWORKING=yes
NOZEROCONF=yes
-bash-4.2#

-bash-4.2# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
TYPE=Ethernet
PERSISTENT_DHCLIENT=yes
NETMASK=255.255.255.0
IPADDR=192.168.150.108
GATEWAY=192.168.150.254
-bash-4.2#

It has been configured with NetworkManager:
-bash-4.2# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2016-11-17 12:53:07 CET; 4min 33s ago
 Main PID: 724 (NetworkManager)
   Memory: 16.4M
   CGroup: /system.slice/NetworkManager.service
           └─724 /usr/sbin/NetworkManager --no-daemon

Nov 17 12:53:53 atomic NetworkManager[724]: <info>  NetworkManager state is ...G
Nov 17 12:53:53 atomic NetworkManager[724]: <info>  (eth0): device state cha...]
Nov 17 12:53:53 atomic NetworkManager[724]: <info>  (eth0): device state cha...]
Nov 17 12:53:53 atomic NetworkManager[724]: <info>  (eth0): device state cha...]
Nov 17 12:53:53 atomic NetworkManager[724]: <info>  (eth0): device state cha...]
Nov 17 12:53:53 atomic NetworkManager[724]: <info>  (eth0): device state cha...]
Nov 17 12:53:53 atomic NetworkManager[724]: <info>  NetworkManager state is ...L
Nov 17 12:53:53 atomic NetworkManager[724]: <info>  NetworkManager state is ...L
Nov 17 12:53:53 atomic NetworkManager[724]: <info>  Policy set 'System eth0'....
Nov 17 12:53:53 atomic NetworkManager[724]: <info>  (eth0): Activation: succ....
Hint: Some lines were ellipsized, use -l to show in full.
-bash-4.2#

I don't know if fault for DNS is a matter of cloud-init, oVirt or image composition....

resolv.conf file contains:

-bash-4.2# cat /etc/resolv.conf
# Generated by NetworkManager
search localdomain


# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
-bash-4.2#

I can do further checks.... the VM is alive

Cominq back to the network config for cloud-init....

The line "Select network above" is in my opinion not so intuitive in its usage

I understood this way

a) you select a Network (eth0) in my case
the first time you explicitly put a name, then when you further add other networks/nics, the dropdown is populated.....

b) when you have a nic selected (eth0 in my case), its configuration is shown in the lines below it
The first time you have to add it with the  "+" sign.
When you have more than a nic, every time you select a preconfigured one, you can see its current config in the lines below.....

Not better using multiple nic sections, instead of this dropdown/dynamically changing ones?
The typical user will had 1 interface anyway.
When you accomodate 2-3 sections I doubt ther will be many usacase for more, so that the size of the "New Virtual Machine" window shouldn't suffer too much.

I hope I was able to explain my point of view... ;-)

Gianluca