[Users] Fwd: Sample code for setting NIC - CloudInit

Moti Asayag masayag at redhat.com
Wed Feb 19 22:41:02 UTC 2014



----- Original Message -----
> From: "Tejesh M" <tejeshmk at gmail.com>
> To: "users at oVirt.org" <users at ovirt.org>
> Sent: Wednesday, February 19, 2014 3:24:40 PM
> Subject: [Users] Fwd: Sample code for setting NIC - CloudInit
> 
> Hi,
> 
> Can someone share me sample java code for assigning IP address for VM on eth0
> through Java SDK via CloudInit ?
> 

Hi Tejesh,

I've attached a sample code that sends the required request (as the output is demonstrated in debug mode).
Note that the code is jdk-7 compliant.
I haven't configured cloud-init and haven't tested it end-to-end.
Please try to test it on your environment and provide a feedback for it.

Thanks,
Moti

> Something Like this but in Java:
> <network_configuration>
>          <nics>
>            <nic>
>              <name>eth0</name>
>              <boot_protocol>STATIC</boot_protocol>
>              <network>
>                <ip address="192.168.2.11" netmask="255.255.0.0"
>                gateway="192.168.2.1" />
>              </network>
>              <on_boot>true</on_boot>
>            </nic>
>            <nic>
>              <name>eth1</name>
>              <boot_protocol>DHCP</boot_protocol>
>            </nic>
>            <nic>
>              <name>eth2</name>
>              <boot_protocol>NONE</boot_protocol>
>              <on_boot>true</on_boot>
>            </nic>
>          </nics>
>          <dns>
>            <servers>
>              <host>
>                <address>1.1.2.2</address>
>              </host>
>              <host>
>                <address>1.2.3.4</address>
>              </host>
>            </servers>
>            <search_domains>
>              <host>
>                <address>qa.lab</address>
>              </host>
>              <host>
>                <address> google.com </address>
>              </host>
>            </search_domains>
>          </dns>
>        </network_configuration>
> 
> 
> 
> --
> Thanks & Regards
> Tejesh
> 
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VmCloudInit.java
Type: text/x-java
Size: 4516 bytes
Desc: not available
URL: <http://lists.ovirt.org/pipermail/users/attachments/20140219/4d87864e/attachment-0001.bin>


More information about the Users mailing list