<div dir="ltr"><div><div><div>Hi,<br><br></div>There is no option in "Initial Run" to set root password & other stuff. Have attached screenshots & debug output. Is there any configuration needs to be done? or any cloud-init service needs to be started? How do integrate cloud-init with RHEV-M?<br>
<br></div>Thanks & Regards,<br></div>Tejesh<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 13, 2014 at 9:50 PM, Juan Hernandez <span dir="ltr"><<a href="mailto:jhernand@redhat.com" target="_blank">jhernand@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 02/13/2014 05:15 PM, Tejesh M wrote:<br>
> Actually, i want to automate the vm provisioning through java sdk. and<br>
> this urgent requirement. Is it possible to automate setting hostname,<br>
> root password n nic info by any means in 3.3? Also in windows<br>
> administration password as similar to linux.. kindly help as im new to<br>
> this..<br>
><br>
<br>
Yes, setting the hostname, root password and NIC info is possible in<br>
3.3, using cloud-init and the Java SDK. I tested this with 3.3 and it<br>
works correctly.<br>
<br>
As you are having problems I suggest to try it manually, from the GUI,<br>
if it doesn't work then please report the details, so that we can<br>
diagnose and fix it.<br>
<br>
Once it works manually from the GUI, we can see why it doesn't work with<br>
the SDK, but we will need the output generated when running in debug mode.<br>
<br>
> On 13 Feb 2014 20:32, "Juan Hernandez" <<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a><br>
> <mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>>> wrote:<br>
><br>
> On 02/13/2014 03:59 PM, Shahar Havivi wrote:<br>
> > On 13.02.14 20:17, Tejesh M wrote:<br>
> >> 1. The Version is RHEV-M 3.3 & Cloud-init is<br>
> >> cloud-init-0.6.3-0.12.bzr532.el6.noarch<br>
> >><br>
> >> 2. In Webadmin, i don't find any option to set Cloud-init data's.<br>
> I checked<br>
> >> under New VM->Initial Run.. Am i looking at the right place?<br>
> >> How to enable cloud-init support in engine?<br>
> > You will not found it since you are working in 3.3 and this<br>
> feature presented<br>
> > in 3.4.<br>
> > In 3.3 you can try to set the Cloud-Init via the Run-Once button.<br>
> ><br>
><br>
> In 3.3 you need first to create the VM. Once it is created select it,<br>
> click the "Run Once" button, then click on the plus sign next to<br>
> "Initial Run", check the "Cloud-Init" box, and populate the fields<br>
> you want.<br>
><br>
> >><br>
> >> I have installed cloud-init package in RHEV-M & also in Template.<br>
> >><br>
> >> Please suggest.<br>
> >><br>
> >><br>
> >> On Thu, Feb 13, 2014 at 7:31 PM, Juan Hernandez<br>
> <<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> <mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>>> wrote:<br>
> >><br>
> >>> On 02/13/2014 02:39 PM, Tejesh M wrote:<br>
> >>>> Hi All,<br>
> >>>><br>
> >>>> Thanks alot.<br>
> >>>><br>
> >>>> I have created one VM with minimal installation & installed<br>
> cloud-init<br>
> >>>> package. And, converted that VM into Template. Then executed<br>
> the code<br>
> >>>> given in<br>
> >>>><br>
> <a href="http://lists.ovirt.org/pipermail/users/2014-February/021302.html" target="_blank">http://lists.ovirt.org/pipermail/users/2014-February/021302.html</a> , but<br>
> >>>> no luck, the code is not setting root password.<br>
> >>>><br>
> >>><br>
> >>> What version of the engine are you running? I may not have the<br>
> required<br>
> >>> cloud-init support.<br>
> >>><br>
> >>> Try to run the application in debug mode:<br>
> >>><br>
> >>> Api api = new Api(<br>
> >>> "<a href="https://whatever/api" target="_blank">https://whatever/api</a>",<br>
> >>> "user@domain",<br>
> >>> "password",<br>
> >>> null,<br>
> >>> null,<br>
> >>> null,<br>
> >>> null,<br>
> >>> true,<br>
> >>> null,<br>
> >>> true // <- This is to enable debug mode<br>
> >>> );<br>
> >>><br>
> >>> It will send to the log the actual XML documents sent to the<br>
> server. We<br>
> >>> can use it to see if the request is generated correctly.<br>
> >>><br>
> >>> It may also happen that cloud-init support isn't working<br>
> correctly. To<br>
> >>> verify this try to use the cloud-init support manually from<br>
> webadmin.<br>
> >>> Does it work from there?<br>
> >>><br>
> >>>> Also, there is no option to set *Hostname *for the VM.<br>
> >>>><br>
> >>><br>
> >>> To set the host name you need to add something like this:<br>
> >>><br>
> >>> Host hostData = new Host();<br>
> >>> hostData.setAddress("<a href="http://the.host.name" target="_blank">the.host.name</a> <<a href="http://the.host.name" target="_blank">http://the.host.name</a>>");<br>
> >>> cloudData.setHost(hostData);<br>
> >>><br>
> >>>><br>
> >>>><br>
> >>>> _*Code:*_<br>
> >>>><br>
> >>>> /*********************Begin Customize<br>
> VM*********************/<br>
> >>>> // Generate the random password, using whatever<br>
> mechanism you<br>
> >>>> // prefer:<br>
> >>>> String password = "cJql3P9XLQG4drCYVG/6Q/";<br>
> >>>><br>
> >>>> // You need to know the name of the template, the<br>
> cluster and<br>
> >>>> // the VM you are going to create:<br>
> >>>> String templateName = "rhel2_temp";<br>
> >>>> String clusterName = "testCluster";<br>
> >>>> String vmName = "myvm";<br>
> >>>><br>
> >>>> // Prepare the data to create the VM from the template:<br>
> >>>> org.ovirt.engine.sdk.entities.Template templateData = new<br>
> >>>> Template();<br>
> >>>> templateData.setName(templateName);<br>
> >>>> org.ovirt.engine.sdk.entities.Cluster clusterData = new<br>
> >>> Cluster();<br>
> >>>> clusterData.setName(clusterName);<br>
> >>>> org.ovirt.engine.sdk.entities.VM vmDataForCreate =<br>
> new VM();<br>
> >>>> vmDataForCreate.setName(vmName);<br>
> >>>> vmDataForCreate.setCluster(clusterData);<br>
> >>>> vmDataForCreate.setTemplate(templateData);<br>
> >>>><br>
> >>>> // Send the request to create the VM to the server:<br>
> >>>> api.getVMs().add(vmDataForCreate);<br>
> >>>> String state;<br>
> >>>> // White till the VM is down (it will be locked for a<br>
> while):<br>
> >>>> for (;;) {<br>
> >>>> state =<br>
> api.getVMs().get(vmName).getStatus().getState();<br>
> >>>> if ("down".equals(state)) {<br>
> >>>> break;<br>
> >>>> }<br>
> >>>> Thread.sleep(1000);<br>
> >>>> }<br>
> >>>> System.out.println("System Status:"+state);<br>
> >>>> // Populate parameters for the action to start the VM<br>
> with<br>
> >>>> cloud-init:<br>
> >>>> org.ovirt.engine.sdk.entities.User userData = new User();<br>
> >>>> userData.setUserName("root");<br>
> >>>> userData.setPassword(password);<br>
> >>>> Users usersData = new Users();<br>
> >>>> usersData.getUsers().add(userData);<br>
> >>>> CloudInit cloudData = new CloudInit();<br>
> >>>> cloudData.setUsers(usersData);<br>
> >>>><br>
> >>>> Initialization initData = new Initialization();<br>
> >>>> initData.setCloudInit(cloudData);<br>
> >>>> VM vmDataForStart = new VM();<br>
> >>>> vmDataForStart.setInitialization(initData);<br>
> >>>> Action actionData = new Action();<br>
> >>>> actionData.setVm(vmDataForStart);<br>
> >>>><br>
> >>>> // Send the request to start the VM to the server:<br>
> >>>> api.getVMs().get(vmName).start(actionData);<br>
> >>>> System.out.println("After :<br>
> >>>> "+api.getVMs().get(vmName).getStatus());<br>
> >>>> /*********************End Customize<br>
> VM*********************/<br>
> >>>><br>
> >>>><br>
> >>>><br>
> >>>> Thanks & Regards,<br>
> >>>> Tejesh<br>
> >>>><br>
> >>>><br>
> >>>><br>
> >>>> On Thu, Feb 13, 2014 at 2:26 PM, Juan Hernandez<br>
> <<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> <mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>><br>
> >>>> <mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> <mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>>>> wrote:<br>
> >>>><br>
> >>>> On 02/13/2014 09:29 AM, Shahar Havivi wrote:<br>
> >>>> > On 13.02.14 00:59, Oved Ourfalli wrote:<br>
> >>>> >><br>
> >>>> >><br>
> >>>> >> ----- Original Message -----<br>
> >>>> >>> From: "Shahar Havivi" <<a href="mailto:shaharh@redhat.com">shaharh@redhat.com</a><br>
> <mailto:<a href="mailto:shaharh@redhat.com">shaharh@redhat.com</a>><br>
> >>>> <mailto:<a href="mailto:shaharh@redhat.com">shaharh@redhat.com</a> <mailto:<a href="mailto:shaharh@redhat.com">shaharh@redhat.com</a>>>><br>
> >>>> >>> To: <a href="mailto:users@ovirt.org">users@ovirt.org</a> <mailto:<a href="mailto:users@ovirt.org">users@ovirt.org</a>><br>
> <mailto:<a href="mailto:users@ovirt.org">users@ovirt.org</a> <mailto:<a href="mailto:users@ovirt.org">users@ovirt.org</a>>><br>
> >>>> >>> Cc: "Juan Antonio Hernandez Fernandez"<br>
> <<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> <mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>><br>
> >>>> <mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> <mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>>>>,<br>
> <a href="mailto:rhevm-api@lists.fedorahosted.org">rhevm-api@lists.fedorahosted.org</a><br>
> <mailto:<a href="mailto:rhevm-api@lists.fedorahosted.org">rhevm-api@lists.fedorahosted.org</a>><br>
> >>>> <mailto:<a href="mailto:rhevm-api@lists.fedorahosted.org">rhevm-api@lists.fedorahosted.org</a><br>
> <mailto:<a href="mailto:rhevm-api@lists.fedorahosted.org">rhevm-api@lists.fedorahosted.org</a>>>, "Tejesh M"<br>
> >>>> >>> <<a href="mailto:tejeshmk@gmail.com">tejeshmk@gmail.com</a> <mailto:<a href="mailto:tejeshmk@gmail.com">tejeshmk@gmail.com</a>><br>
> <mailto:<a href="mailto:tejeshmk@gmail.com">tejeshmk@gmail.com</a> <mailto:<a href="mailto:tejeshmk@gmail.com">tejeshmk@gmail.com</a>>>><br>
> >>>> >>> Sent: Wednesday, February 12, 2014 11:22:20 PM<br>
> >>>> >>> Subject: Re: [Users] [rhevm-api] Assign IP address to<br>
> VM using<br>
> >>>> Java SDK<br>
> >>>> >>><br>
> >>>> >>> On 12.02.14 22:55, Itamar Heim wrote:<br>
> >>>> >>>> On 02/12/2014 03:14 PM, Tejesh M wrote:<br>
> >>>> >>>>> Hi,<br>
> >>>> >>>>><br>
> >>>> >>>>> Can anyone share sample code on how to assign IP<br>
> address to<br>
> >>>> guest os &<br>
> >>>> >>>>> changing the root password while creating VM from<br>
> Template<br>
> >>>> using Java SDK?<br>
> >>>> >>> Hi Tejesh,<br>
> >>>> >>> You should start here:<br>
> >>>> >>> <a href="http://www.ovirt.org/Api" target="_blank">http://www.ovirt.org/Api</a><br>
> >>>> >>> This link will explain the basics for fetching VM via<br>
> the API<br>
> >>>> using HTTP via<br>
> >>>> >>> curl command line.<br>
> >>>> >>><br>
> >>>> >>> Every VM have a collection of networks and manipulating<br>
> them can<br>
> >>>> be seeing<br>
> >>>> >>> here with the REST API examples:<br>
> >>>> >>><br>
> <a href="http://www.ovirt.org/Features/Design/Network/SetupNetworks#REST" target="_blank">http://www.ovirt.org/Features/Design/Network/SetupNetworks#REST</a><br>
> >>>> >>> the section for you is "Attaching a network to a NIC"<br>
> under the<br>
> >>> REST<br>
> >>>> >>> category.<br>
> >>>> >>><br>
> >>>> >>> Shahar Havivi.<br>
> >>>> >>><br>
> >>>> >><br>
> >>>> >> Actually it looks like Tejesh is referring to the Guests<br>
> and not<br>
> >>>> the hosts, so you can use cloud-init in order to do that.<br>
> >>>> >> See more in<br>
> "<a href="http://www.ovirt.org/Features/Cloud-Init_Integration" target="_blank">http://www.ovirt.org/Features/Cloud-Init_Integration</a><br>
> >>> ".<br>
> >>>> >> If the VM's operating system is defined as some kind of<br>
> Linux,<br>
> >>>> then you'll be able to set some stuff using cloud-init,<br>
> either via<br>
> >>>> the Run-Once Dialog, or in the regular VM properties dialog.<br>
> >>>> >><br>
> >>>> >> Omer - we have REST API support for cloud-init, right?<br>
> >>>> > Yes, more on that can be found here:<br>
> >>>> > <a href="http://www.ovirt.org/Features/vm-init-persistent" target="_blank">http://www.ovirt.org/Features/vm-init-persistent</a><br>
> >>>> >><br>
> >>>><br>
> >>>> Tajesh, you have a detailed example of how to set the<br>
> password in the<br>
> >>>> following message:<br>
> >>>><br>
> >>>><br>
> <a href="http://lists.ovirt.org/pipermail/users/2014-February/021302.html" target="_blank">http://lists.ovirt.org/pipermail/users/2014-February/021302.html</a><br>
> >>>><br>
> >>>> Setting the IP address is similar.<br>
> >>>><br>
> >>><br>
> >>> --<br>
> >>> Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3,<br>
> planta<br>
> >>> 3ºD, 28016 Madrid, Spain<br>
> >>> Inscrita en el Reg. Mercantil de Madrid - C.I.F. B82657941 - Red<br>
> Hat S.L.<br>
> >>><br>
> >><br>
> >><br>
> >><br>
> >> --<br>
> >> Thanks & Regards<br>
> >> Tejesh<br>
> > _______________________________________________<br>
> > Users mailing list<br>
> > <a href="mailto:Users@ovirt.org">Users@ovirt.org</a> <mailto:<a href="mailto:Users@ovirt.org">Users@ovirt.org</a>><br>
> > <a href="http://lists.ovirt.org/mailman/listinfo/users" target="_blank">http://lists.ovirt.org/mailman/listinfo/users</a><br>
> ><br>
><br>
><br>
> --<br>
> Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta<br>
> 3ºD, 28016 Madrid, Spain<br>
> Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat<br>
> S.L.<br>
><br>
><br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@ovirt.org">Users@ovirt.org</a><br>
> <a href="http://lists.ovirt.org/mailman/listinfo/users" target="_blank">http://lists.ovirt.org/mailman/listinfo/users</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta<br>
3ºD, 28016 Madrid, Spain<br>
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div>Thanks & Regards</div>
<div>Tejesh</div>
</div>