<div dir="ltr">resolved the first issue.. Now i'm able to add Payload via JavaSDK also. need help on the 2 issue.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 8, 2014 at 4:36 PM, Tejesh M <span dir="ltr"><<a href="mailto:tejeshmk@gmail.com" target="_blank">tejeshmk@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi,<br><br></div>When i tried the above solution, i face few challanges:<br><br></div>1. I'm able to add VMPayload via CURL, but not via JavaSDK.<br>
</div>2. When i add VMPayload via CURL, sysprep fails with this message "windows could not parse or process the unattend answer file [a:\sysprep.inf] for pass [oobeSystem]. A component or setting specified in the answer file does not exist."<br>
<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 8, 2014 at 12:32 PM, Omer Frenkel <span dir="ltr"><<a href="mailto:ofrenkel@redhat.com" target="_blank">ofrenkel@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
----- Original Message -----<br>
> From: "Tejesh M" <<a href="mailto:tejeshmk@gmail.com" target="_blank">tejeshmk@gmail.com</a>><br>
> To: "Itamar Heim" <<a href="mailto:iheim@redhat.com" target="_blank">iheim@redhat.com</a>><br>
> Cc: "users@oVirt.org" <<a href="mailto:users@ovirt.org" target="_blank">users@ovirt.org</a>><br>
> Sent: Monday, April 7, 2014 4:59:16 PM<br>
> Subject: Re: [Users] Cloud-init for Windows<br>
><br>
> Hi,<br>
><br>
> I tried as you suggested, but floppy is not getting attached it seems. below<br>
> is the code<br>
><br>
><br>
><br>
> Steps followed:<br>
><br>
> I. Create windows VM<br>
> II. installed host agent<br>
> III. To seal a Windows virtual machine with sysprep<br>
><br>
><br>
> 1. In the Windows virtual machine to be used as a template, open a<br>
> command line terminal and type regedit .<br>
> 2. The Registry Editor window displays. On the left pane, expand<br>
> HKEY_LOCAL_MACHINE → SYSTEM → SETUP .<br>
> 3. On the main window, right click to add a new string value using New →<br>
> String Value . Right click on the string value file and select Modify .<br>
> When the Edit String dialog box displays, fill in the provided text<br>
> boxes:<br>
><br>
><br>
> * Value name: UnattendFile<br>
> * Value data: a:\sysprep.xml<br>
> 4. Launch sysprep from C:\Windows\System32\sysprep\sysprep.exe<br>
><br>
><br>
> * Under System Cleanup Action , select Enter System<br>
> Out-of-Box-Experience (OOBE) .<br>
> * Tick the Generalize checkbox if you need to change the computer's<br>
> system identification number (SID).<br>
> * Under Shutdown Options , select Shutdown .<br>
><br>
><br>
> Click OK . The virtual machine will now go through the sealing process and<br>
> shut down automatically.<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> IV.<br>
><br>
><br>
> org.ovirt.engine.sdk.decorators.VM vm1 = api.getVMs().get(vmName);<br>
> Payloads payloads = new Payloads();<br>
> Payload payload = new Payload();<br>
> payload.setType("floppy");<br>
> Files payloadFiles = new Files();<br>
> File payloadFile = new File();<br>
> payloadFile.setName("sysprep.xml");<br>
> payloadFile.setContent("<?xml version=\"1.0\" encoding=\"utf-8\"?> <unattend<br>
> xmlns=\"urn:schemas-microsoft-com:unattend\"> FILE CONTENT "</unattend>");<br>
> payloadFiles.getFiles().add(payloadFile);<br>
> payload.setFiles(payloadFiles);<br>
> vm1.setPayloads(payloads);<br>
> Action action = new Action();<br>
> vm1.start(action);<br>
><br>
><br>
<br>
i guess you need to use CDATA tags in order to pass xml content.<br>
im not sure about CLI, but if you use curl it should look like this:<br>
(credit to James W. Mills for providing this info)<br>
<br>
1) Create a payload file - Mine looked like this (payload.dat):<br>
<br>
<vm><br>
<payloads><br>
<payload type='floppy'><br>
<files><br>
<file><br>
<name>sysprep.inf</name><br>
<content><![CDATA[<br>
<THE RAW SYSPREP XML><br>
]]><br>
</content><br>
<type>BASE64</type><br>
</file><br>
</files><br>
</payload><br>
</payloads><br>
</vm><br>
<br>
Where I have "<THE RAW SYSPREP XML>", I just dumped a full sysprep XML file. Just make sure it is in between the CDATA tags so it is escaped properly.<br>
<br>
2) Upload the payload into the VM:<br>
<br>
# curl -X PUT -H "Accept: application/xml" -H "Content-Type: application/xml" -k -u admin@internal:<pass> -d @payload.dat https://<server>/api/vms/<vm-id><br>
<br>
The URL is simply the full path of the VM, which I obtained by parsing "api/vms"<br>
<br>
3) Boot the machine - Assuming the sysprep information is correct, all the sysprep settings will be applied.<br>
<br>
><br>
> On Thu, Mar 27, 2014 at 3:52 PM, Itamar Heim < <a href="mailto:iheim@redhat.com" target="_blank">iheim@redhat.com</a> > wrote:<br>
><br>
><br>
> On 03/27/2014 06:18 AM, Tejesh M wrote:<br>
><br>
><br>
> Can you guide me on sysprep with sample code & sysprep file?<br>
><br>
><br>
> just launch a windows VM, look at the generated sysprep file we pass to the<br>
> VM via the floppy disk.<br>
> then pass it as a payload as-is.<br>
> then try to change what you want.<br>
><br>
><br>
><br>
><br>
> On Thu, Mar 27, 2014 at 3:16 PM, Itamar Heim < <a href="mailto:iheim@redhat.com" target="_blank">iheim@redhat.com</a><br>
> <mailto: <a href="mailto:iheim@redhat.com" target="_blank">iheim@redhat.com</a> >> wrote:<br>
><br>
> On 03/27/2014 05:33 AM, Tejesh M wrote:<br>
><br>
> Hi All,<br>
><br>
> I was doing google to see if i can set Hostname,Password & IP<br>
> details<br>
> for Windows server from RHEV-M. I got to know that we can create VM<br>
> Payload & send that to Windows VM (installed with Cloud-init)<br>
><br>
> Refer this link<br>
> <a href="http://www.cloudbase.it/cloud-" target="_blank">http://www.cloudbase.it/cloud-</a> __init-for-windows-instances/# __comment-9411<br>
> < <a href="http://www.cloudbase.it/" target="_blank">http://www.cloudbase.it/</a> cloud-init-for-windows- instances/#comment-9411 ><br>
><br>
> Cloud-init expects Meta-data & User-Data file to be sent either via<br>
> Config Drive or via HTTP. I'm trying to achive this via ConfigDrive<br>
> (created using VM Payload).<br>
><br>
><br>
> note you can also just pass the full sysprep file as a payload<br>
> yourself via the API, and set all these items in it.<br>
><br>
><br>
> But i'm wondering what should be the format of this two files<br>
> (Meta-data<br>
> & User-data). Have any1 tried this? If yes, would request to share<br>
> sample for both the files with setting Hostname, Password & IP<br>
> details.<br>
><br>
><br>
> just launch a linux VM and check the file we create?<br>
><br>
><br>
> Java code:<br>
><br>
> org.ovirt.engine.sdk.__ decorators.VM vm1 =<br>
> api.getVMs().get(vmName);<br>
> Payloads payloads = new Payloads();<br>
> Payload payload = new Payload();<br>
> payload.setType("cdrom");<br>
><br>
> Files payloadFiles = new Files();<br>
> File payloadFile = new File();<br>
> payloadFile.setName("meta-__ data.txt");<br>
> payloadFile.setContent("__ hostname:"+vmName);<br>
> payloadFiles.getFiles().add(__ payloadFile);<br>
> payload.setFiles(payloadFiles) __;<br>
> vm1.setPayloads(payloads);<br>
> Action action = new Action();<br>
> vm1.start(action);<br>
><br>
> --<br>
> Thanks & Regards<br>
> Tejesh<br>
><br>
><br>
><br>
><br>
<span><font color="#888888">><br>
> --<br>
> Thanks & Regards<br>
> Tejesh<br>
><br>
><br>
><br>
><br>
> --<br>
> Thanks & Regards<br>
> Tejesh<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@ovirt.org" target="_blank">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>
><span class="HOEnZb"><font color="#888888"><br>
</font></span></font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div>Thanks & Regards</div>
<div>Tejesh</div>
</font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div>Thanks & Regards</div>
<div>Tejesh</div>
</div>