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

Tejesh M tejeshmk at gmail.com
Mon Feb 24 08:30:42 UTC 2014


Thanks. It worked.


On Fri, Feb 21, 2014 at 4:25 PM, Juan Hernandez <jhernand at redhat.com> wrote:

> On 02/21/2014 08:13 AM, Tejesh M wrote:
> >
> > When i try to execute with the ovirt sdk 3.3.3 and do operations on
> > RHEV-M 3.3, it fails with below error
> >
>
> This happens because the oVirt SDK is compiled with Java 7, and you are
> probably using Java 6.
>
> I suggest to switch to Java 7, unless there is a very good reason to
> stick to Java 6. Java 6 "end of life" was declared by Oracle on Feb 1023.
>
> However, the OpenJDK community still support Java 6, so if you really
> need it please tell us, and we can try to make a version of the oVirt
> SDK compatible with Java 6.
>
> > Exception in thread "main" java.lang.UnsupportedClassVersionError:
> > org/ovirt/engine/sdk/Api
> >     at rhvm.callAPI(rhvm.java:238)
> >     at rhvm.main(rhvm.java:278)
> >
> >
> > On Fri, Feb 21, 2014 at 12:19 AM, Juan Hernandez <jhernand at redhat.com
> > <mailto:jhernand at redhat.com>> wrote:
> >
> >     On 02/20/2014 05:56 PM, Tejesh M wrote:
> >     > Ok. Will it take long time for that sdk to release?
> >     >
> >
> >     No, it should be released soon.
> >
> >     Meanwhile you may want to use the latest ovirt 3.3 Java SDK, it is
> >     almost identical to the RHEV-M Jaa SDK.
> >
> >     If you are using maven these are the coordinates of the artifact:
> >
> >     <dependency>
> >         <groupId>org.ovirt.engine.sdk</groupId>
> >         <artifactId>ovirt-engine-sdk-java</artifactId>
> >         <version>3.3.3.0</version>
> >     </dependency>
> >
> >     If you aren't using maven you can still download the .jar file from
> >     here:
> >
> >
> http://search.maven.org/#artifactdetails|org.ovirt.engine.sdk|ovirt-engine-sdk-java|3.3.3.0|jar
> >
> >     > On 20 Feb 2014 04:11, "Moti Asayag" <masayag at redhat.com
> >     <mailto:masayag at redhat.com>
> >     > <mailto:masayag at redhat.com <mailto:masayag at redhat.com>>> wrote:
> >     >
> >     >
> >     >
> >     >     ----- Original Message -----
> >     >     > From: "Tejesh M" <tejeshmk at gmail.com
> >     <mailto:tejeshmk at gmail.com> <mailto:tejeshmk at gmail.com
> >     <mailto:tejeshmk at gmail.com>>>
> >     >     > To: "users at oVirt.org" <users at ovirt.org
> >     <mailto:users at ovirt.org> <mailto:users at ovirt.org
> >     <mailto: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 <http://google.com>
> >     <http://google.com> </address>
> >     >     >              </host>
> >     >     >            </search_domains>
> >     >     >          </dns>
> >     >     >        </network_configuration>
> >     >     >
> >     >     >
>
> --
> 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.
>



-- 
Thanks & Regards
Tejesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20140224/5d7e0406/attachment-0001.html>


More information about the Users mailing list