[ovirt-users] RHEVM3.3 java SDK on RHEV3.6

2016-11-06 Thread Tejesh M
Hi All,

I'm facing an issue in invoking Cloudinit while customization in RHEV 3.6
using RHEV Java SDK 3.6.

Below link says we need to explicitly call *use_cloud_init=True*, but i'm
not sure how to pass this value as parameter while creating VM.

http://users.ovirt.narkive.com/BGUkanAk/ovirt-users-cloud-init-not-apply-when-v-create-from-api


*My Code:*
String password = "password"; //"password"

String templateName = "centos6.7-final";
String clusterName = "Default";
String vmName = "testVM3";

//Prepare the data to create the VM from the template:
org.ovirt.engine.sdk.entities.Template templateData = new Template();
templateData.setName(templateName);
org.ovirt.engine.sdk.entities.Cluster clusterData = new Cluster();
clusterData.setName(clusterName);
org.ovirt.engine.sdk.entities.VM vmDataForCreate = new VM();
vmDataForCreate.setName(vmName);
vmDataForCreate.setCluster(clusterData);
vmDataForCreate.setTemplate(templateData);

api.getVMs().add(vmDataForCreate);
String state;
for (;;) {
 state = api.getVMs().get(vmName).getStatus().getState();
if ("down".equals(state)) {
  break;
}
Thread.sleep(1000);
}
System.out.println("System Status:"+state);
org.ovirt.engine.sdk.entities.User userData = new User();
userData.setUserName("root");
userData.setPassword(password);
Users usersData = new Users();
usersData.getUsers().add(userData);
CloudInit cloudData = new CloudInit();


cloudData.setUsers(usersData);
Host hostData = new Host();
hostData.setAddress(vmName);
cloudData.setHost(hostData);

org.ovirt.engine.sdk.entities.NetworkConfiguration networkConfiguration=new
NetworkConfiguration();

networkConfiguration.setNics(new Nics());

Nics nics = networkConfiguration.getNics();
nics.getNics().add(createNic("eth0", "STATIC",
createNetwork("192.168.1.102", "255.255.0.0", "192.168.2.1"), true));

networkConfiguration.setNics(nics);

cloudData.setNetworkConfiguration(networkConfiguration);

Initialization initData = new Initialization();

initData.setCloudInit(cloudData);

VM vmDataForStart = new VM();
vmDataForStart.setInitialization(initData);
Action actionData = new Action();

actionData.setVm(vmDataForStart);

// Send the request to start the VM to the server:
api.getVMs().get(vmName).start(actionData);

-- 
Thanks & Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Cloud-init for Windows

2014-04-08 Thread Tejesh M
Hi,

When i tried the above solution, i face few challanges:

1. I'm able to add VMPayload via CURL, but not via JavaSDK.
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.



On Tue, Apr 8, 2014 at 12:32 PM, Omer Frenkel ofren...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: Itamar Heim ih...@redhat.com
  Cc: users@oVirt.org users@ovirt.org
  Sent: Monday, April 7, 2014 4:59:16 PM
  Subject: Re: [Users] Cloud-init for Windows
 
  Hi,
 
  I tried as you suggested, but floppy is not getting attached it seems.
 below
  is the code
 
 
 
  Steps followed:
 
  I. Create windows VM
  II. installed host agent
  III. To seal a Windows virtual machine with sysprep
 
 
  1. In the Windows virtual machine to be used as a template, open a
  command line terminal and type regedit .
  2. The Registry Editor window displays. On the left pane, expand
  HKEY_LOCAL_MACHINE → SYSTEM → SETUP .
  3. On the main window, right click to add a new string value using
 New →
  String Value . Right click on the string value file and select
 Modify .
  When the Edit String dialog box displays, fill in the provided text
  boxes:
 
 
  * Value name: UnattendFile
  * Value data: a:\sysprep.xml
  4. Launch sysprep from C:\Windows\System32\sysprep\sysprep.exe
 
 
  * Under System Cleanup Action , select Enter System
  Out-of-Box-Experience (OOBE) .
  * Tick the Generalize checkbox if you need to change the
 computer's
  system identification number (SID).
  * Under Shutdown Options , select Shutdown .
 
 
  Click OK . The virtual machine will now go through the sealing process
 and
  shut down automatically.
 
 
 
 
 
 
 
  IV.
 
 
  org.ovirt.engine.sdk.decorators.VM vm1 = api.getVMs().get(vmName);
  Payloads payloads = new Payloads();
  Payload payload = new Payload();
  payload.setType(floppy);
  Files payloadFiles = new Files();
  File payloadFile = new File();
  payloadFile.setName(sysprep.xml);
  payloadFile.setContent(?xml version=\1.0\ encoding=\utf-8\?
 unattend
  xmlns=\urn:schemas-microsoft-com:unattend\ FILE CONTENT
 /unattend);
  payloadFiles.getFiles().add(payloadFile);
  payload.setFiles(payloadFiles);
  vm1.setPayloads(payloads);
  Action action = new Action();
  vm1.start(action);
 
 

 i guess you need to use CDATA tags in order to pass xml content.
 im not sure about CLI, but if you use curl it should look like this:
 (credit to James W. Mills for providing this info)

 1)  Create a payload file - Mine looked like this (payload.dat):

 vm
   payloads
 payload type='floppy'
 files
   file
 namesysprep.inf/name
 content![CDATA[
 THE RAW SYSPREP XML
 ]]
 /content
 typeBASE64/type
   /file
   /files
 /payload
   /payloads
 /vm

 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.

 2) Upload the payload into the VM:

 # 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

 The URL is simply the full path of the VM, which I obtained by parsing
 api/vms

 3)  Boot the machine - Assuming the sysprep information is correct, all
 the sysprep settings will be applied.

 
  On Thu, Mar 27, 2014 at 3:52 PM, Itamar Heim  ih...@redhat.com  wrote:
 
 
  On 03/27/2014 06:18 AM, Tejesh M wrote:
 
 
  Can you guide me on sysprep with sample code  sysprep file?
 
 
  just launch a windows VM, look at the generated sysprep file we pass to
 the
  VM via the floppy disk.
  then pass it as a payload as-is.
  then try to change what you want.
 
 
 
 
  On Thu, Mar 27, 2014 at 3:16 PM, Itamar Heim  ih...@redhat.com
  mailto: ih...@redhat.com  wrote:
 
  On 03/27/2014 05:33 AM, Tejesh M wrote:
 
  Hi All,
 
  I was doing google to see if i can set Hostname,Password  IP
  details
  for Windows server from RHEV-M. I got to know that we can create VM
  Payload  send that to Windows VM (installed with Cloud-init)
 
  Refer this link
  http://www.cloudbase.it/cloud- __init-for-windows-instances/#
 __comment-9411
   http://www.cloudbase.it/ cloud-init-for-windows-
 instances/#comment-9411 
 
  Cloud-init expects Meta-data  User-Data file to be sent either via
  Config Drive or via HTTP. I'm trying to achive this via ConfigDrive
  (created using VM Payload).
 
 
  note you can also just pass the full sysprep file as a payload
  yourself via the API, and set all these items in it.
 
 
  But i'm wondering what should be the format of this two files
  (Meta-data
   User-data). Have any1 tried this? If yes, would request to share
  sample for both the files with setting Hostname, Password  IP
  details

Re: [Users] Cloud-init for Windows

2014-04-08 Thread Tejesh M
resolved the first issue.. Now i'm able to add Payload via JavaSDK also.
need help on the 2 issue.


On Tue, Apr 8, 2014 at 4:36 PM, Tejesh M tejes...@gmail.com wrote:

 Hi,

 When i tried the above solution, i face few challanges:

 1. I'm able to add VMPayload via CURL, but not via JavaSDK.
 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.



 On Tue, Apr 8, 2014 at 12:32 PM, Omer Frenkel ofren...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: Itamar Heim ih...@redhat.com
  Cc: users@oVirt.org users@ovirt.org
  Sent: Monday, April 7, 2014 4:59:16 PM
  Subject: Re: [Users] Cloud-init for Windows
 
  Hi,
 
  I tried as you suggested, but floppy is not getting attached it seems.
 below
  is the code
 
 
 
  Steps followed:
 
  I. Create windows VM
  II. installed host agent
  III. To seal a Windows virtual machine with sysprep
 
 
  1. In the Windows virtual machine to be used as a template, open a
  command line terminal and type regedit .
  2. The Registry Editor window displays. On the left pane, expand
  HKEY_LOCAL_MACHINE → SYSTEM → SETUP .
  3. On the main window, right click to add a new string value using
 New →
  String Value . Right click on the string value file and select
 Modify .
  When the Edit String dialog box displays, fill in the provided text
  boxes:
 
 
  * Value name: UnattendFile
  * Value data: a:\sysprep.xml
  4. Launch sysprep from C:\Windows\System32\sysprep\sysprep.exe
 
 
  * Under System Cleanup Action , select Enter System
  Out-of-Box-Experience (OOBE) .
  * Tick the Generalize checkbox if you need to change the
 computer's
  system identification number (SID).
  * Under Shutdown Options , select Shutdown .
 
 
  Click OK . The virtual machine will now go through the sealing process
 and
  shut down automatically.
 
 
 
 
 
 
 
  IV.
 
 
  org.ovirt.engine.sdk.decorators.VM vm1 = api.getVMs().get(vmName);
  Payloads payloads = new Payloads();
  Payload payload = new Payload();
  payload.setType(floppy);
  Files payloadFiles = new Files();
  File payloadFile = new File();
  payloadFile.setName(sysprep.xml);
  payloadFile.setContent(?xml version=\1.0\ encoding=\utf-8\?
 unattend
  xmlns=\urn:schemas-microsoft-com:unattend\ FILE CONTENT
 /unattend);
  payloadFiles.getFiles().add(payloadFile);
  payload.setFiles(payloadFiles);
  vm1.setPayloads(payloads);
  Action action = new Action();
  vm1.start(action);
 
 

 i guess you need to use CDATA tags in order to pass xml content.
 im not sure about CLI, but if you use curl it should look like this:
 (credit to James W. Mills for providing this info)

 1)  Create a payload file - Mine looked like this (payload.dat):

 vm
   payloads
 payload type='floppy'
 files
   file
 namesysprep.inf/name
 content![CDATA[
 THE RAW SYSPREP XML
 ]]
 /content
 typeBASE64/type
   /file
   /files
 /payload
   /payloads
 /vm

 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.

 2) Upload the payload into the VM:

 # 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

 The URL is simply the full path of the VM, which I obtained by parsing
 api/vms

 3)  Boot the machine - Assuming the sysprep information is correct, all
 the sysprep settings will be applied.

 
  On Thu, Mar 27, 2014 at 3:52 PM, Itamar Heim  ih...@redhat.com 
 wrote:
 
 
  On 03/27/2014 06:18 AM, Tejesh M wrote:
 
 
  Can you guide me on sysprep with sample code  sysprep file?
 
 
  just launch a windows VM, look at the generated sysprep file we pass to
 the
  VM via the floppy disk.
  then pass it as a payload as-is.
  then try to change what you want.
 
 
 
 
  On Thu, Mar 27, 2014 at 3:16 PM, Itamar Heim  ih...@redhat.com
  mailto: ih...@redhat.com  wrote:
 
  On 03/27/2014 05:33 AM, Tejesh M wrote:
 
  Hi All,
 
  I was doing google to see if i can set Hostname,Password  IP
  details
  for Windows server from RHEV-M. I got to know that we can create VM
  Payload  send that to Windows VM (installed with Cloud-init)
 
  Refer this link
  http://www.cloudbase.it/cloud- __init-for-windows-instances/#
 __comment-9411
   http://www.cloudbase.it/ cloud-init-for-windows-
 instances/#comment-9411 
 
  Cloud-init expects Meta-data  User-Data file to be sent either via
  Config Drive or via HTTP. I'm trying to achive this via ConfigDrive
  (created using VM Payload).
 
 
  note you can also just pass the full sysprep file as a payload
  yourself via the API, and set all these items in it.
 
 
  But i'm wondering what should

Re: [Users] Cloud-init for Windows

2014-04-07 Thread Tejesh M
Hi,

I tried as you suggested, but floppy is not getting attached it seems.
below is the code



*Steps followed:*

I. Create windows VM
II. installed host agent
III. *To seal a Windows virtual machine with sysprep*

   1. In the Windows virtual machine to be used as a template, open a
   command line terminal and type *regedit*.
   2. The *Registry Editor* window displays. On the left pane, expand
   *HKEY_LOCAL_MACHINE* → *SYSTEM* → *SETUP*.
   3. On the main window, right click to add a new string value using
*New*→ *String
   Value*. Right click on the string value file and select *Modify*. When
   the *Edit String* dialog box displays, fill in the provided text boxes:
  - Value name: UnattendFile
  - Value data: a:\sysprep.xml
   4. Launch sysprep from C:\Windows\System32\sysprep\sysprep.exe
  - Under *System Cleanup Action*, select *Enter System
  Out-of-Box-Experience (OOBE)*.
  - Tick the *Generalize* checkbox if you need to change the computer's
  system identification number (SID).
  - Under *Shutdown Options*, select *Shutdown*.

Click *OK*. The virtual machine will now go through the sealing process and
shut down automatically.



IV.


  org.ovirt.engine.sdk.decorators.VM vm1 =  api.getVMs().get(vmName);
  Payloads payloads = new Payloads();
  Payload payload = new Payload();
  payload.setType(floppy);

  Files payloadFiles = new Files();
  File payloadFile = new File();
  payloadFile.setName(sysprep.xml);
  payloadFile.setContent(?xml version=\1.0\ encoding=\utf-8\?
unattend xmlns=\urn:schemas-microsoft-com:unattend\ *FILE CONTENT *
/unattend);
  payloadFiles.getFiles().add(payloadFile);
  payload.setFiles(payloadFiles);
  vm1.setPayloads(payloads);
  Action action = new Action();
  vm1.start(action);



On Thu, Mar 27, 2014 at 3:52 PM, Itamar Heim ih...@redhat.com wrote:

 On 03/27/2014 06:18 AM, Tejesh M wrote:

 Can you guide me on sysprep with sample code  sysprep file?


 just launch a windows VM, look at the generated sysprep file we pass to
 the VM via the floppy disk.
 then pass it as a payload as-is.
 then try to change what you want.


 On Thu, Mar 27, 2014 at 3:16 PM, Itamar Heim ih...@redhat.com
 mailto:ih...@redhat.com wrote:

 On 03/27/2014 05:33 AM, Tejesh M wrote:

 Hi All,

 I was doing google to see if i can set Hostname,Password  IP
 details
 for Windows server from RHEV-M. I got to know that we can create
 VM
 Payload  send that to Windows VM (installed with Cloud-init)

 Refer this link
 http://www.cloudbase.it/cloud-__init-for-windows-instances/#
 __comment-9411
 http://www.cloudbase.it/cloud-init-for-windows-
 instances/#comment-9411

 Cloud-init expects Meta-data  User-Data file to be sent either
 via
 Config Drive or via HTTP. I'm trying to achive this via
 ConfigDrive
 (created using VM Payload).


 note you can also just pass the full sysprep file as a payload
 yourself via the API, and set all these items in it.


 But i'm wondering what should be the format of this two files
 (Meta-data
  User-data). Have any1  tried this? If yes, would request to
 share
 sample for both the files with setting Hostname, Password  IP
 details.


 just launch a linux VM and check the file we create?


 Java code:

 org.ovirt.engine.sdk.__decorators.VM vm1 =
   api.getVMs().get(vmName);
 Payloads payloads = new Payloads();
 Payload payload = new Payload();
 payload.setType(cdrom);

 Files payloadFiles = new Files();
 File payloadFile = new File();
 payloadFile.setName(meta-__data.txt);
 payloadFile.setContent(__hostname:+vmName);
 payloadFiles.getFiles().add(__payloadFile);
 payload.setFiles(payloadFiles)__;
 vm1.setPayloads(payloads);
 Action action = new Action();
 vm1.start(action);

 --
 Thanks  Regards
 Tejesh





 --
 Thanks  Regards
 Tejesh





-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[Users] Cloud-init for Windows

2014-03-27 Thread Tejesh M
Hi All,

I was doing google to see if i can set Hostname,Password  IP details for
Windows server from RHEV-M. I got to know that we can create VM Payload 
send that to Windows VM (installed with Cloud-init)

Refer this link
http://www.cloudbase.it/cloud-init-for-windows-instances/#comment-9411

Cloud-init expects Meta-data  User-Data file to be sent either via Config
Drive or via HTTP. I'm trying to achive this via ConfigDrive (created using
VM Payload).

But i'm wondering what should be the format of this two files (Meta-data 
User-data). Have any1  tried this? If yes, would request to share sample
for both the files with setting Hostname, Password  IP details.

Java code:

  org.ovirt.engine.sdk.decorators.VM vm1 =  api.getVMs().get(vmName);
  Payloads payloads = new Payloads();
  Payload payload = new Payload();
  payload.setType(cdrom);

  Files payloadFiles = new Files();
  File payloadFile = new File();
  payloadFile.setName(meta-data.txt);
  payloadFile.setContent(hostname:+vmName);
  payloadFiles.getFiles().add(payloadFile);
  payload.setFiles(payloadFiles);
  vm1.setPayloads(payloads);
  Action action = new Action();
  vm1.start(action);

-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Cloud-init for Windows

2014-03-27 Thread Tejesh M
Can you guide me on sysprep with sample code  sysprep file?


On Thu, Mar 27, 2014 at 3:16 PM, Itamar Heim ih...@redhat.com wrote:

 On 03/27/2014 05:33 AM, Tejesh M wrote:

 Hi All,

 I was doing google to see if i can set Hostname,Password  IP details
 for Windows server from RHEV-M. I got to know that we can create VM
 Payload  send that to Windows VM (installed with Cloud-init)

 Refer this link
 http://www.cloudbase.it/cloud-init-for-windows-instances/#comment-9411

 Cloud-init expects Meta-data  User-Data file to be sent either via
 Config Drive or via HTTP. I'm trying to achive this via ConfigDrive
 (created using VM Payload).


 note you can also just pass the full sysprep file as a payload yourself
 via the API, and set all these items in it.


 But i'm wondering what should be the format of this two files (Meta-data
  User-data). Have any1  tried this? If yes, would request to share
 sample for both the files with setting Hostname, Password  IP details.


 just launch a linux VM and check the file we create?


 Java code:

org.ovirt.engine.sdk.decorators.VM vm1 =  api.getVMs().get(vmName);
Payloads payloads = new Payloads();
Payload payload = new Payload();
payload.setType(cdrom);

Files payloadFiles = new Files();
File payloadFile = new File();
payloadFile.setName(meta-data.txt);
payloadFile.setContent(hostname:+vmName);
payloadFiles.getFiles().add(payloadFile);
payload.setFiles(payloadFiles);
vm1.setPayloads(payloads);
Action action = new Action();
vm1.start(action);

 --
 Thanks  Regards
 Tejesh





-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[Users] Clone VM from another VM - API

2014-03-18 Thread Tejesh M
Hi

Is that possible to Clone a VM from another VM without taking a Snapshot
through Java SDK?

-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[Users] Attach floppy as [sysprep] to VM - API

2014-03-17 Thread Tejesh M
Hi,

I want to attach floppy as [sysprep] to windows VM in the Run once via API.
can you help?

I want to do sysprep on windows 2008
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Delete Detach Logical Network

2014-03-13 Thread Tejesh M
Thanks Moti.


On Tue, Mar 11, 2014 at 4:27 PM, Moti Asayag masa...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: Moti Asayag masa...@redhat.com
  Cc: users@oVirt.org users@ovirt.org
  Sent: Tuesday, March 11, 2014 8:53:15 AM
  Subject: Re: Delete  Detach Logical Network
 
  Managed to delete network which is attached to Bond with below code:
 
  HostNIC nic =
  api.getHosts().get(rhevhost).getHostNics().get(bond1.1231);
  nic.delete();
 
 
  But not able to delete the same when attached to ethernet:
 
  HostNIC nic =
 api.getHosts().get(rhevhost).getHostNics().get(eth1.1187);
  nic.delete();
 
  i want to unmap the logical network which is mapped to eth1.
 

 For this specific case I'd suggest using the attached example.

  *Result*:
  code  : 400
  reason: Bad Request
  detail: Invalid Bonding definition
 
 
 
 
 
  On Mon, Mar 10, 2014 at 6:54 PM, Moti Asayag masa...@redhat.com wrote:
 
  
  
   - Original Message -
From: Tejesh M tejes...@gmail.com
To: Moti Asayag masa...@redhat.com, users@oVirt.org 
   users@ovirt.org
Sent: Monday, March 10, 2014 1:22:08 PM
Subject: Delete  Detach Logical Network
   
Hi,
   
I'm able to delete the logical network but this logical network after
deletion shows as unmanaged network in Setup Host Networks against
 the
hostnic.
   
I tried with this code to detach the logical network.
   
*Code 1:*
HostNIC nic =
 api.getHosts().get(rhevhost).getHostNics().get(eth1);
Action action = new Action();
action.setNetwork(api.getNetworks().get(nw_name));
action.setDetach(true);
action.setCheckConnectivity(false);
nic.detach(action);
   
*Returns*:
code  : 409
reason: Conflict
detail: Network Interface is not attached to Logical Network.
   
  
   I can guess by the error message that the logical network 'rhevhost' is
   vlan,
   so the proper interface should be the vlan device.
  
  
*Code 2:*
HostNIC nic =
   api.getHosts().get(rhevhost).getHostNics().get(eth1.1345);
Action action = new Action();
action.setNetwork(api.getNetworks().get(nw_name));
action.setDetach(true);
action.setCheckConnectivity(false);
nic.detach(action);
   
*Returns*:
code  : 409
reason: Conflict
detail: Cannot edit Network while Host is Active, change the Host to
Maintenance mode and try again.
   
  
   This is the 3.0 api which required the host to be in maintenance for
   network
   operations on the host. You could use setup networks instead which is
 the
   recommended api and doesn't require the host to be in maintenance.
  
   you can modify the example from [1] and set null for the network name
 you
   wish to detach from the specific interface.
  
   Try by replacing only lines 28-41 with:
   HostNIC nic = nicsByNames.get(eth1.1345);
   nic.setNetwork(null);
  
   [1]
  
 https://motiasayag.wordpress.com/2014/02/24/invoke-setup-networks-from-the-java-sdk/
  
   
--
Thanks  Regards
Tejesh
   
  
 
 
 
  --
  Thanks  Regards
  Tejesh
 




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Delete Detach Logical Network

2014-03-11 Thread Tejesh M
Managed to delete network which is attached to Bond with below code:

HostNIC nic =
api.getHosts().get(rhevhost).getHostNics().get(bond1.1231);
nic.delete();


But not able to delete the same when attached to ethernet:

HostNIC nic = api.getHosts().get(rhevhost).getHostNics().get(eth1.1187);
nic.delete();

i want to unmap the logical network which is mapped to eth1.

*Result*:
code  : 400
reason: Bad Request
detail: Invalid Bonding definition





On Mon, Mar 10, 2014 at 6:54 PM, Moti Asayag masa...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: Moti Asayag masa...@redhat.com, users@oVirt.org 
 users@ovirt.org
  Sent: Monday, March 10, 2014 1:22:08 PM
  Subject: Delete  Detach Logical Network
 
  Hi,
 
  I'm able to delete the logical network but this logical network after
  deletion shows as unmanaged network in Setup Host Networks against the
  hostnic.
 
  I tried with this code to detach the logical network.
 
  *Code 1:*
  HostNIC nic = api.getHosts().get(rhevhost).getHostNics().get(eth1);
  Action action = new Action();
  action.setNetwork(api.getNetworks().get(nw_name));
  action.setDetach(true);
  action.setCheckConnectivity(false);
  nic.detach(action);
 
  *Returns*:
  code  : 409
  reason: Conflict
  detail: Network Interface is not attached to Logical Network.
 

 I can guess by the error message that the logical network 'rhevhost' is
 vlan,
 so the proper interface should be the vlan device.


  *Code 2:*
  HostNIC nic =
 api.getHosts().get(rhevhost).getHostNics().get(eth1.1345);
  Action action = new Action();
  action.setNetwork(api.getNetworks().get(nw_name));
  action.setDetach(true);
  action.setCheckConnectivity(false);
  nic.detach(action);
 
  *Returns*:
  code  : 409
  reason: Conflict
  detail: Cannot edit Network while Host is Active, change the Host to
  Maintenance mode and try again.
 

 This is the 3.0 api which required the host to be in maintenance for
 network
 operations on the host. You could use setup networks instead which is the
 recommended api and doesn't require the host to be in maintenance.

 you can modify the example from [1] and set null for the network name you
 wish to detach from the specific interface.

 Try by replacing only lines 28-41 with:
 HostNIC nic = nicsByNames.get(eth1.1345);
 nic.setNetwork(null);

 [1]
 https://motiasayag.wordpress.com/2014/02/24/invoke-setup-networks-from-the-java-sdk/

 
  --
  Thanks  Regards
  Tejesh
 




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[Users] Delete Detach Logical Network

2014-03-10 Thread Tejesh M
Hi,

I'm able to delete the logical network but this logical network after
deletion shows as unmanaged network in Setup Host Networks against the
hostnic.

I tried with this code to detach the logical network.

*Code 1:*
HostNIC nic = api.getHosts().get(rhevhost).getHostNics().get(eth1);
Action action = new Action();
action.setNetwork(api.getNetworks().get(nw_name));
action.setDetach(true);
action.setCheckConnectivity(false);
nic.detach(action);

*Returns*:
code  : 409
reason: Conflict
detail: Network Interface is not attached to Logical Network.

*Code 2:*
HostNIC nic = api.getHosts().get(rhevhost).getHostNics().get(eth1.1345);
Action action = new Action();
action.setNetwork(api.getNetworks().get(nw_name));
action.setDetach(true);
action.setCheckConnectivity(false);
nic.detach(action);

*Returns*:
code  : 409
reason: Conflict
detail: Cannot edit Network while Host is Active, change the Host to
Maintenance mode and try again.


-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Delete Detach Logical Network

2014-03-10 Thread Tejesh M
Hi Moti,

rhevhost is the Host name  logical network is sent as variable nw_name,
in the code 1.


On Mon, Mar 10, 2014 at 6:54 PM, Moti Asayag masa...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: Moti Asayag masa...@redhat.com, users@oVirt.org 
 users@ovirt.org
  Sent: Monday, March 10, 2014 1:22:08 PM
  Subject: Delete  Detach Logical Network
 
  Hi,
 
  I'm able to delete the logical network but this logical network after
  deletion shows as unmanaged network in Setup Host Networks against the
  hostnic.
 
  I tried with this code to detach the logical network.
 
  *Code 1:*
  HostNIC nic = api.getHosts().get(rhevhost).getHostNics().get(eth1);
  Action action = new Action();
  action.setNetwork(api.getNetworks().get(nw_name));
  action.setDetach(true);
  action.setCheckConnectivity(false);
  nic.detach(action);
 
  *Returns*:
  code  : 409
  reason: Conflict
  detail: Network Interface is not attached to Logical Network.
 

 I can guess by the error message that the logical network 'rhevhost' is
 vlan,
 so the proper interface should be the vlan device.


  *Code 2:*
  HostNIC nic =
 api.getHosts().get(rhevhost).getHostNics().get(eth1.1345);
  Action action = new Action();
  action.setNetwork(api.getNetworks().get(nw_name));
  action.setDetach(true);
  action.setCheckConnectivity(false);
  nic.detach(action);
 
  *Returns*:
  code  : 409
  reason: Conflict
  detail: Cannot edit Network while Host is Active, change the Host to
  Maintenance mode and try again.
 

 This is the 3.0 api which required the host to be in maintenance for
 network
 operations on the host. You could use setup networks instead which is the
 recommended api and doesn't require the host to be in maintenance.

 you can modify the example from [1] and set null for the network name you
 wish to detach from the specific interface.

 Try by replacing only lines 28-41 with:
 HostNIC nic = nicsByNames.get(eth1.1345);
 nic.setNetwork(null);

 [1]
 https://motiasayag.wordpress.com/2014/02/24/invoke-setup-networks-from-the-java-sdk/

 
  --
  Thanks  Regards
  Tejesh
 




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[Users] Clone a Template using API

2014-03-05 Thread Tejesh M
Hi,

While creating VM from Template via Web Admin portal, the default
provisioning is Clone. But while doing the same via API its is doing Thin
provisioning. Can someone share there view.


  org.ovirt.engine.sdk.entities.Template templateData = new Template();
  templateData.setName(templateName);
  org.ovirt.engine.sdk.entities.Cluster clusterData = new Cluster();
  clusterData.setName(clusterName);
  org.ovirt.engine.sdk.entities.VM vmDataForCreate = new VM();
  vmDataForCreate.setName(vmName);
  vmDataForCreate.setCluster(clusterData);
  vmDataForCreate.setTemplate(templateData);
 api.getVMs().add(vmDataForCreate);

-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[Users] Ubuntu 13.04 cloud-init issue

2014-03-05 Thread Tejesh M
Hi,

I have deployed guest ubuntu 13.04  installed cloud-init 0.7.2 on it. But
it seems it has a bug setting Network address

auto lo eth0 (this line is missing)
iface eth0 inet *none*
 address 172.29.250.13
 netmask 255.255.255.0
 gateway 172.29.250.1

so it is not brining up the eth0

I tried this through API

Kindly help for work around.

-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Clone a Template using API

2014-03-05 Thread Tejesh M
Thanks Moti.


On Wed, Mar 5, 2014 at 7:06 PM, Moti Asayag masa...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: users@oVirt.org users@ovirt.org, Moti Asayag 
 masa...@redhat.com
  Sent: Wednesday, March 5, 2014 1:01:18 PM
  Subject: Clone a Template using API
 
  Hi,
 
  While creating VM from Template via Web Admin portal, the default
  provisioning is Clone. But while doing the same via API its is doing Thin
  provisioning. Can someone share there view.
 
 
org.ovirt.engine.sdk.entities.Template templateData = new Template();
templateData.setName(templateName);
org.ovirt.engine.sdk.entities.Cluster clusterData = new
 Cluster();
clusterData.setName(clusterName);
org.ovirt.engine.sdk.entities.VM vmDataForCreate = new VM();


 Try with those lines:

 Disks disks = new Disks();
 disks.setClone(true);
 vm.setDisks(disks);

 Adding Omer to confirm.

vmDataForCreate.setName(vmName);
vmDataForCreate.setCluster(clusterData);
vmDataForCreate.setTemplate(templateData);
   api.getVMs().add(vmDataForCreate);
 
  --
  Thanks  Regards
  Tejesh
 




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[Users] Increase core or socker for vCPU

2014-03-04 Thread Tejesh M
Hi,

I have a basic doubt, while increasing vCPU for a VM in RHEV-M, do we need
to increase core or sockets?  For instance, if someone asks for 2vCPU then
should i make it 2 socket x 1 core or 1 socket x 2 core..

I do understand that it depends on application too to choose. but i'm
asking in general.

Sorry, if its not relevant to this forum.

Thanks
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Creating Logical Network issue - API

2014-03-03 Thread Tejesh M
Thanks, I'm able to create logical network  attached the same to host.

Now I tried to change the network for a VM nic from rhevm to VLAN1189, but
it is not working. any suggestion?


api.getVMs().get(vmName).getNics().get(nic1).setNetwork(api.getNetworks().get(VLAN1189));
  api.getVMs().get(vmName).getNics().get(nic1).update();




On Mon, Feb 24, 2014 at 5:23 PM, Moti Asayag masa...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: Moti Asayag masa...@redhat.com
  Cc: users@oVirt.org users@ovirt.org
  Sent: Monday, February 24, 2014 1:18:53 PM
  Subject: Re: [Users] Creating Logical Network issue - API
 
  The example updates the existing Network (i.e. if the Logical Network is
  already mapped to eth1). But what i'm looking for is how to map Logical
  Network ApiNetWork to eth1, please refer screenshot.
 

 Please check the last example named AddNetworkToNic from

 https://motiasayag.wordpress.com/2014/02/24/network-configuration-using-ovirt-engine-java-sdk/

 It should achieve what you're aiming for.

 
  On Mon, Feb 24, 2014 at 4:11 PM, Moti Asayag masa...@redhat.com wrote:
 
   - Original Message -
From: Tejesh M tejes...@gmail.com
To: Moti Asayag masa...@redhat.com
Cc: users@oVirt.org users@ovirt.org
Sent: Monday, February 24, 2014 11:59:42 AM
Subject: Re: [Users] Creating Logical Network issue - API
   
While setting Logical Network, it fails with below error:
code  : 400
reason: Bad Request
detail: Previous network name is required.
  
   See an example in the following post:
  
  
  
 https://motiasayag.wordpress.com/2014/02/24/network-configuration-using-ovirt-engine-java-sdk/
  
   
Code:
  String nw_name=ApiNetWork;
  org.ovirt.engine.sdk.decorators.Host hst =
api.getHosts().get(rhevhost);
   
   
 hst.getHostNics().get(eth1).setNetwork(api.getNetworks().get(nw_name));
  //hst.getHostNics().get(eth1).setCheckConnectivity(true);
   
 //hst.getHostNics().get(eth1).setOverrideConfiguration(true);
  hst.getHostNics().get(eth1).update();
   
   
   
On Mon, Feb 24, 2014 at 2:30 PM, Tejesh M tejes...@gmail.com
 wrote:
   
 Can you tel me how do i assign Logical Network(s) to one of the
   Physical
 Nic on the Host.


 On Fri, Feb 21, 2014 at 1:37 PM, Moti Asayag masa...@redhat.com
   wrote:

 h

 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: users@oVirt.org users@ovirt.org
  Sent: Thursday, February 20, 2014 11:48:56 AM
  Subject: [Users] Creating Logical Network issue - API
 
  Hi ,
 
  I'm trying to create Logical Network and assign it to cluster 
   want to
 bond
  this to one of the Network Interface on Host. so that i can
 isolate
   my
 VM
  from other networks.
 
  The issue is even if i set Cluster while creating Logical
 Network,
   it
 is not
  setting the cluster. In Web Admin it is in unset state.
 
  Also, let me know how do i bind this Logical network on Host
   Interface.
 
  Java code:
 
  Network nw1=new Network();
  VLAN vlan = new VLAN();
  vlan.setId(2000);
  nw1.setVlan(vlan);
  IP ip = new IP();
  ip.setAddress(192.168.1.151);
  ip.setGateway(192.168.1.1);
  ip.setNetmask(255.255.255.0);

 Note that the stated IP above will not be used to set the address
 on
   the
 host itself.
 In order to do so you should use either the 'setup networks' api
 on
 host's nics level.
 (Alternately, you can send POST request to /hosts/{host:id}/nics
 which
 utilize the
 former api (it is a bit simpler than using the setup networks
 api).

 Should look like:
 Host host = api.getHosts().get(host_name);
 Action action = new Action();
 action.setCheckConnectivity(true); //required for rollback in
   case of
 configuration failure
 action.setHostNics(...); // should contain the target
   configuration
 host.getHostNics().setupnetworks(action);

 where the action should contain the entire desired network
   configuration.

 You can find various python-sdk example for setup networks on my
 blog
   [1]
 I'll post few examples using the java sdk earlier next week.

 [1] https://motiasayag.wordpress.com/

  nw1.setIp(ip);
  nw1.setName(apiNetwork);
 
  nw1.setDataCenter(api.getDataCenters().get(testDC));
  nw1.setCluster(api.getClusters().get(testCluster));
 
  org.ovirt.engine.sdk.decorators.Network nw2 =
 api.getNetworks().add(nw1);
 
  --
  Thanks  Regards
  Tejesh
 
  ___
  Users mailing list
  Users@ovirt.org
  http://lists.ovirt.org/mailman/listinfo/users
 




 --
 Thanks  Regards
 Tejesh

Re: [Users] Creating Logical Network issue - API

2014-03-03 Thread Tejesh M
Ok got it..
I just observed that my setup network is not getting saved, after attaching
my logical network to host nic.


On Mon, Mar 3, 2014 at 7:34 PM, Moti Asayag masa...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: Moti Asayag masa...@redhat.com
  Cc: users@oVirt.org users@ovirt.org
  Sent: Monday, March 3, 2014 3:46:14 PM
  Subject: Re: [Users] Creating Logical Network issue - API
 
  Thanks, I'm able to create logical network  attached the same to host.
 
  Now I tried to change the network for a VM nic from rhevm to VLAN1189,
 but
  it is not working. any suggestion?
 
 
 
 api.getVMs().get(vmName).getNics().get(nic1).setNetwork(api.getNetworks().get(VLAN1189));
api.getVMs().get(vmName).getNics().get(nic1).update();
 

 This snippet is wrong: You attempt to modify a newly fetched
 vnic than the one that was just modified in the first line.

 I'd try:
  VMNIC vnic = api.getVMs().get(vmName).getNics().get(nic1);
  vnic.setNetwork(api.getNetworks().get(VLAN1189));
  vnic.update();

 If this doesn't work - keep reading :-)

 There has been a recent bug in this regards [1].

 You can by pass it by nullifying the vnic-profile value until getting the
 next stable version (or using the 3.4 rc build).

 You can read more about the vnic profile and see python examples here [2]

 [1] https://bugzilla.redhat.com/show_bug.cgi?id=1047887
 Bug 1047887 - Update vnic_profile fails for VM vnic

 [2] https://motiasayag.wordpress.com/2014/02/02/vnic-profiles/

 
 
 
  On Mon, Feb 24, 2014 at 5:23 PM, Moti Asayag masa...@redhat.com wrote:
 
  
  
   - Original Message -
From: Tejesh M tejes...@gmail.com
To: Moti Asayag masa...@redhat.com
Cc: users@oVirt.org users@ovirt.org
Sent: Monday, February 24, 2014 1:18:53 PM
Subject: Re: [Users] Creating Logical Network issue - API
   
The example updates the existing Network (i.e. if the Logical
 Network is
already mapped to eth1). But what i'm looking for is how to map
 Logical
Network ApiNetWork to eth1, please refer screenshot.
   
  
   Please check the last example named AddNetworkToNic from
  
  
 https://motiasayag.wordpress.com/2014/02/24/network-configuration-using-ovirt-engine-java-sdk/
  
   It should achieve what you're aiming for.
  
   
On Mon, Feb 24, 2014 at 4:11 PM, Moti Asayag masa...@redhat.com
 wrote:
   
 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: Moti Asayag masa...@redhat.com
  Cc: users@oVirt.org users@ovirt.org
  Sent: Monday, February 24, 2014 11:59:42 AM
  Subject: Re: [Users] Creating Logical Network issue - API
 
  While setting Logical Network, it fails with below error:
  code  : 400
  reason: Bad Request
  detail: Previous network name is required.

 See an example in the following post:



  
 https://motiasayag.wordpress.com/2014/02/24/network-configuration-using-ovirt-engine-java-sdk/

 
  Code:
String nw_name=ApiNetWork;
org.ovirt.engine.sdk.decorators.Host hst =
  api.getHosts().get(rhevhost);
 
 
  
 hst.getHostNics().get(eth1).setNetwork(api.getNetworks().get(nw_name));
 
 //hst.getHostNics().get(eth1).setCheckConnectivity(true);
 
   //hst.getHostNics().get(eth1).setOverrideConfiguration(true);
hst.getHostNics().get(eth1).update();
 
 
 
  On Mon, Feb 24, 2014 at 2:30 PM, Tejesh M tejes...@gmail.com
   wrote:
 
   Can you tel me how do i assign Logical Network(s) to one of the
 Physical
   Nic on the Host.
  
  
   On Fri, Feb 21, 2014 at 1:37 PM, Moti Asayag 
 masa...@redhat.com
 wrote:
  
   h
  
   - Original Message -
From: Tejesh M tejes...@gmail.com
To: users@oVirt.org users@ovirt.org
Sent: Thursday, February 20, 2014 11:48:56 AM
Subject: [Users] Creating Logical Network issue - API
   
Hi ,
   
I'm trying to create Logical Network and assign it to
 cluster 
 want to
   bond
this to one of the Network Interface on Host. so that i can
   isolate
 my
   VM
from other networks.
   
The issue is even if i set Cluster while creating Logical
   Network,
 it
   is not
setting the cluster. In Web Admin it is in unset state.
   
Also, let me know how do i bind this Logical network on Host
 Interface.
   
Java code:
   
Network nw1=new Network();
VLAN vlan = new VLAN();
vlan.setId(2000);
nw1.setVlan(vlan);
IP ip = new IP();
ip.setAddress(192.168.1.151);
ip.setGateway(192.168.1.1);
ip.setNetmask(255.255.255.0);
  
   Note that the stated IP above will not be used to set the
 address
   on
 the
   host itself.
   In order to do so you should use either the 'setup networks

Re: [Users] Creating Logical Network issue - API

2014-03-03 Thread Tejesh M
Thanks alot.


On Mon, Mar 3, 2014 at 8:14 PM, Moti Asayag masa...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: Moti Asayag masa...@redhat.com
  Cc: users@oVirt.org users@ovirt.org
  Sent: Monday, March 3, 2014 4:36:32 PM
  Subject: Re: [Users] Creating Logical Network issue - API
 
  Ok got it..
  I just observed that my setup network is not getting saved, after
 attaching
  my logical network to host nic.
 

 Let me refer you to yet another post [1]:

 You should add the following at the end of your setup-networks action:

 api.getHosts().get(your-host).commitnetconfig(new Action());

 [1]
 https://motiasayag.wordpress.com/2013/04/08/it-is-not-over-till-moti-sings/


 
  On Mon, Mar 3, 2014 at 7:34 PM, Moti Asayag masa...@redhat.com wrote:
 
  
  
   - Original Message -
From: Tejesh M tejes...@gmail.com
To: Moti Asayag masa...@redhat.com
Cc: users@oVirt.org users@ovirt.org
Sent: Monday, March 3, 2014 3:46:14 PM
Subject: Re: [Users] Creating Logical Network issue - API
   
Thanks, I'm able to create logical network  attached the same to
 host.
   
Now I tried to change the network for a VM nic from rhevm to
 VLAN1189,
   but
it is not working. any suggestion?
   
   
   
  
 api.getVMs().get(vmName).getNics().get(nic1).setNetwork(api.getNetworks().get(VLAN1189));
  api.getVMs().get(vmName).getNics().get(nic1).update();
   
  
   This snippet is wrong: You attempt to modify a newly fetched
   vnic than the one that was just modified in the first line.
  
   I'd try:
VMNIC vnic = api.getVMs().get(vmName).getNics().get(nic1);
vnic.setNetwork(api.getNetworks().get(VLAN1189));
vnic.update();
  
   If this doesn't work - keep reading :-)
  
   There has been a recent bug in this regards [1].
  
   You can by pass it by nullifying the vnic-profile value until getting
 the
   next stable version (or using the 3.4 rc build).
  
   You can read more about the vnic profile and see python examples here
 [2]
  
   [1] https://bugzilla.redhat.com/show_bug.cgi?id=1047887
   Bug 1047887 - Update vnic_profile fails for VM vnic
  
   [2] https://motiasayag.wordpress.com/2014/02/02/vnic-profiles/
  
   
   
   
On Mon, Feb 24, 2014 at 5:23 PM, Moti Asayag masa...@redhat.com
 wrote:
   


 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: Moti Asayag masa...@redhat.com
  Cc: users@oVirt.org users@ovirt.org
  Sent: Monday, February 24, 2014 1:18:53 PM
  Subject: Re: [Users] Creating Logical Network issue - API
 
  The example updates the existing Network (i.e. if the Logical
   Network is
  already mapped to eth1). But what i'm looking for is how to map
   Logical
  Network ApiNetWork to eth1, please refer screenshot.
 

 Please check the last example named AddNetworkToNic from


  
 https://motiasayag.wordpress.com/2014/02/24/network-configuration-using-ovirt-engine-java-sdk/

 It should achieve what you're aiming for.

 
  On Mon, Feb 24, 2014 at 4:11 PM, Moti Asayag masa...@redhat.com
 
   wrote:
 
   - Original Message -
From: Tejesh M tejes...@gmail.com
To: Moti Asayag masa...@redhat.com
Cc: users@oVirt.org users@ovirt.org
Sent: Monday, February 24, 2014 11:59:42 AM
Subject: Re: [Users] Creating Logical Network issue - API
   
While setting Logical Network, it fails with below error:
code  : 400
reason: Bad Request
detail: Previous network name is required.
  
   See an example in the following post:
  
  
  

  
 https://motiasayag.wordpress.com/2014/02/24/network-configuration-using-ovirt-engine-java-sdk/
  
   
Code:
  String nw_name=ApiNetWork;
  org.ovirt.engine.sdk.decorators.Host hst =
api.getHosts().get(rhevhost);
   
   

  
 hst.getHostNics().get(eth1).setNetwork(api.getNetworks().get(nw_name));
   
   //hst.getHostNics().get(eth1).setCheckConnectivity(true);
   
 //hst.getHostNics().get(eth1).setOverrideConfiguration(true);
  hst.getHostNics().get(eth1).update();
   
   
   
On Mon, Feb 24, 2014 at 2:30 PM, Tejesh M 
 tejes...@gmail.com
 wrote:
   
 Can you tel me how do i assign Logical Network(s) to one
 of the
   Physical
 Nic on the Host.


 On Fri, Feb 21, 2014 at 1:37 PM, Moti Asayag 
   masa...@redhat.com
   wrote:

 h

 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: users@oVirt.org users@ovirt.org
  Sent: Thursday, February 20, 2014 11:48:56 AM
  Subject: [Users] Creating Logical Network issue - API
 
  Hi ,
 
  I'm trying to create Logical Network and assign it to
   cluster

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

2014-02-24 Thread Tejesh M
Thanks. It worked.


On Fri, Feb 21, 2014 at 4:25 PM, Juan Hernandez jhern...@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 jhern...@redhat.com
  mailto:jhern...@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
  groupIdorg.ovirt.engine.sdk/groupId
  artifactIdovirt-engine-sdk-java/artifactId
  version3.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 masa...@redhat.com
  mailto:masa...@redhat.com
   mailto:masa...@redhat.com mailto:masa...@redhat.com wrote:
  
  
  
   - Original Message -
From: Tejesh M tejes...@gmail.com
  mailto:tejes...@gmail.com mailto:tejes...@gmail.com
  mailto:tejes...@gmail.com
To: users@oVirt.org users@ovirt.org
  mailto:users@ovirt.org mailto:users@ovirt.org
  mailto:users@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
 nameeth0/name
 boot_protocolSTATIC/boot_protocol
 network
   ip address=192.168.2.11
 netmask=255.255.0.0
   gateway=192.168.2.1 /
 /network
 on_boottrue/on_boot
   /nic
   nic
 nameeth1/name
 boot_protocolDHCP/boot_protocol
   /nic
   nic
 nameeth2/name
 boot_protocolNONE/boot_protocol
 on_boottrue/on_boot
   /nic
 /nics
 dns
   servers
 host
   address1.1.2.2/address
 /host
 host
   address1.2.3.4/address
 /host
   /servers
   search_domains
 host
   addressqa.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
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Creating Logical Network issue - API

2014-02-24 Thread Tejesh M
Can you tel me how do i assign Logical Network(s) to one of the Physical
Nic on the Host.


On Fri, Feb 21, 2014 at 1:37 PM, Moti Asayag masa...@redhat.com wrote:

 h

 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: users@oVirt.org users@ovirt.org
  Sent: Thursday, February 20, 2014 11:48:56 AM
  Subject: [Users] Creating Logical Network issue - API
 
  Hi ,
 
  I'm trying to create Logical Network and assign it to cluster  want to
 bond
  this to one of the Network Interface on Host. so that i can isolate my VM
  from other networks.
 
  The issue is even if i set Cluster while creating Logical Network, it is
 not
  setting the cluster. In Web Admin it is in unset state.
 
  Also, let me know how do i bind this Logical network on Host Interface.
 
  Java code:
 
  Network nw1=new Network();
  VLAN vlan = new VLAN();
  vlan.setId(2000);
  nw1.setVlan(vlan);
  IP ip = new IP();
  ip.setAddress(192.168.1.151);
  ip.setGateway(192.168.1.1);
  ip.setNetmask(255.255.255.0);

 Note that the stated IP above will not be used to set the address on the
 host itself.
 In order to do so you should use either the 'setup networks' api on host's
 nics level.
 (Alternately, you can send POST request to /hosts/{host:id}/nics which
 utilize the
 former api (it is a bit simpler than using the setup networks api).

 Should look like:
 Host host = api.getHosts().get(host_name);
 Action action = new Action();
 action.setCheckConnectivity(true); //required for rollback in case of
 configuration failure
 action.setHostNics(...); // should contain the target configuration
 host.getHostNics().setupnetworks(action);

 where the action should contain the entire desired network configuration.

 You can find various python-sdk example for setup networks on my blog [1]
 I'll post few examples using the java sdk earlier next week.

 [1] https://motiasayag.wordpress.com/

  nw1.setIp(ip);
  nw1.setName(apiNetwork);
 
  nw1.setDataCenter(api.getDataCenters().get(testDC));
  nw1.setCluster(api.getClusters().get(testCluster));
 
  org.ovirt.engine.sdk.decorators.Network nw2 = api.getNetworks().add(nw1);
 
  --
  Thanks  Regards
  Tejesh
 
  ___
  Users mailing list
  Users@ovirt.org
  http://lists.ovirt.org/mailman/listinfo/users
 




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Creating Logical Network issue - API

2014-02-24 Thread Tejesh M
While setting Logical Network, it fails with below error:
code  : 400
reason: Bad Request
detail: Previous network name is required.

Code:
  String nw_name=ApiNetWork;
  org.ovirt.engine.sdk.decorators.Host hst =
api.getHosts().get(rhevhost);

hst.getHostNics().get(eth1).setNetwork(api.getNetworks().get(nw_name));
  //hst.getHostNics().get(eth1).setCheckConnectivity(true);
  //hst.getHostNics().get(eth1).setOverrideConfiguration(true);
  hst.getHostNics().get(eth1).update();



On Mon, Feb 24, 2014 at 2:30 PM, Tejesh M tejes...@gmail.com wrote:

 Can you tel me how do i assign Logical Network(s) to one of the Physical
 Nic on the Host.


 On Fri, Feb 21, 2014 at 1:37 PM, Moti Asayag masa...@redhat.com wrote:

 h

 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: users@oVirt.org users@ovirt.org
  Sent: Thursday, February 20, 2014 11:48:56 AM
  Subject: [Users] Creating Logical Network issue - API
 
  Hi ,
 
  I'm trying to create Logical Network and assign it to cluster  want to
 bond
  this to one of the Network Interface on Host. so that i can isolate my
 VM
  from other networks.
 
  The issue is even if i set Cluster while creating Logical Network, it
 is not
  setting the cluster. In Web Admin it is in unset state.
 
  Also, let me know how do i bind this Logical network on Host Interface.
 
  Java code:
 
  Network nw1=new Network();
  VLAN vlan = new VLAN();
  vlan.setId(2000);
  nw1.setVlan(vlan);
  IP ip = new IP();
  ip.setAddress(192.168.1.151);
  ip.setGateway(192.168.1.1);
  ip.setNetmask(255.255.255.0);

 Note that the stated IP above will not be used to set the address on the
 host itself.
 In order to do so you should use either the 'setup networks' api on
 host's nics level.
 (Alternately, you can send POST request to /hosts/{host:id}/nics which
 utilize the
 former api (it is a bit simpler than using the setup networks api).

 Should look like:
 Host host = api.getHosts().get(host_name);
 Action action = new Action();
 action.setCheckConnectivity(true); //required for rollback in case of
 configuration failure
 action.setHostNics(...); // should contain the target configuration
 host.getHostNics().setupnetworks(action);

 where the action should contain the entire desired network configuration.

 You can find various python-sdk example for setup networks on my blog [1]
 I'll post few examples using the java sdk earlier next week.

 [1] https://motiasayag.wordpress.com/

  nw1.setIp(ip);
  nw1.setName(apiNetwork);
 
  nw1.setDataCenter(api.getDataCenters().get(testDC));
  nw1.setCluster(api.getClusters().get(testCluster));
 
  org.ovirt.engine.sdk.decorators.Network nw2 =
 api.getNetworks().add(nw1);
 
  --
  Thanks  Regards
  Tejesh
 
  ___
  Users mailing list
  Users@ovirt.org
  http://lists.ovirt.org/mailman/listinfo/users
 




 --
 Thanks  Regards
 Tejesh




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Creating Logical Network issue - API

2014-02-24 Thread Tejesh M
Thanks alot.. Will try and let you know the feedback.


On Mon, Feb 24, 2014 at 5:23 PM, Moti Asayag masa...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: Moti Asayag masa...@redhat.com
  Cc: users@oVirt.org users@ovirt.org
  Sent: Monday, February 24, 2014 1:18:53 PM
  Subject: Re: [Users] Creating Logical Network issue - API
 
  The example updates the existing Network (i.e. if the Logical Network is
  already mapped to eth1). But what i'm looking for is how to map Logical
  Network ApiNetWork to eth1, please refer screenshot.
 

 Please check the last example named AddNetworkToNic from

 https://motiasayag.wordpress.com/2014/02/24/network-configuration-using-ovirt-engine-java-sdk/

 It should achieve what you're aiming for.

 
  On Mon, Feb 24, 2014 at 4:11 PM, Moti Asayag masa...@redhat.com wrote:
 
   - Original Message -
From: Tejesh M tejes...@gmail.com
To: Moti Asayag masa...@redhat.com
Cc: users@oVirt.org users@ovirt.org
Sent: Monday, February 24, 2014 11:59:42 AM
Subject: Re: [Users] Creating Logical Network issue - API
   
While setting Logical Network, it fails with below error:
code  : 400
reason: Bad Request
detail: Previous network name is required.
  
   See an example in the following post:
  
  
  
 https://motiasayag.wordpress.com/2014/02/24/network-configuration-using-ovirt-engine-java-sdk/
  
   
Code:
  String nw_name=ApiNetWork;
  org.ovirt.engine.sdk.decorators.Host hst =
api.getHosts().get(rhevhost);
   
   
 hst.getHostNics().get(eth1).setNetwork(api.getNetworks().get(nw_name));
  //hst.getHostNics().get(eth1).setCheckConnectivity(true);
   
 //hst.getHostNics().get(eth1).setOverrideConfiguration(true);
  hst.getHostNics().get(eth1).update();
   
   
   
On Mon, Feb 24, 2014 at 2:30 PM, Tejesh M tejes...@gmail.com
 wrote:
   
 Can you tel me how do i assign Logical Network(s) to one of the
   Physical
 Nic on the Host.


 On Fri, Feb 21, 2014 at 1:37 PM, Moti Asayag masa...@redhat.com
   wrote:

 h

 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: users@oVirt.org users@ovirt.org
  Sent: Thursday, February 20, 2014 11:48:56 AM
  Subject: [Users] Creating Logical Network issue - API
 
  Hi ,
 
  I'm trying to create Logical Network and assign it to cluster 
   want to
 bond
  this to one of the Network Interface on Host. so that i can
 isolate
   my
 VM
  from other networks.
 
  The issue is even if i set Cluster while creating Logical
 Network,
   it
 is not
  setting the cluster. In Web Admin it is in unset state.
 
  Also, let me know how do i bind this Logical network on Host
   Interface.
 
  Java code:
 
  Network nw1=new Network();
  VLAN vlan = new VLAN();
  vlan.setId(2000);
  nw1.setVlan(vlan);
  IP ip = new IP();
  ip.setAddress(192.168.1.151);
  ip.setGateway(192.168.1.1);
  ip.setNetmask(255.255.255.0);

 Note that the stated IP above will not be used to set the address
 on
   the
 host itself.
 In order to do so you should use either the 'setup networks' api
 on
 host's nics level.
 (Alternately, you can send POST request to /hosts/{host:id}/nics
 which
 utilize the
 former api (it is a bit simpler than using the setup networks
 api).

 Should look like:
 Host host = api.getHosts().get(host_name);
 Action action = new Action();
 action.setCheckConnectivity(true); //required for rollback in
   case of
 configuration failure
 action.setHostNics(...); // should contain the target
   configuration
 host.getHostNics().setupnetworks(action);

 where the action should contain the entire desired network
   configuration.

 You can find various python-sdk example for setup networks on my
 blog
   [1]
 I'll post few examples using the java sdk earlier next week.

 [1] https://motiasayag.wordpress.com/

  nw1.setIp(ip);
  nw1.setName(apiNetwork);
 
  nw1.setDataCenter(api.getDataCenters().get(testDC));
  nw1.setCluster(api.getClusters().get(testCluster));
 
  org.ovirt.engine.sdk.decorators.Network nw2 =
 api.getNetworks().add(nw1);
 
  --
  Thanks  Regards
  Tejesh
 
  ___
  Users mailing list
  Users@ovirt.org
  http://lists.ovirt.org/mailman/listinfo/users
 




 --
 Thanks  Regards
 Tejesh

   
   
   
--
Thanks  Regards
Tejesh
   
  
 
 
 
  --
  Thanks  Regards
  Tejesh
 




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Creating Logical Network issue - API

2014-02-21 Thread Tejesh M
Thanks, can you post sample on Assigning Multiple Logical Network to
Physical Network in Java?

I have create the Logical Network and attached to Cluster. Now i want to
Assign or Map this to Physical Network?

Also, How to Bond Two Physical NICs and Map or Assign Multiple Logical
Networks.


On Fri, Feb 21, 2014 at 1:37 PM, Moti Asayag masa...@redhat.com wrote:

 h

 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: users@oVirt.org users@ovirt.org
  Sent: Thursday, February 20, 2014 11:48:56 AM
  Subject: [Users] Creating Logical Network issue - API
 
  Hi ,
 
  I'm trying to create Logical Network and assign it to cluster  want to
 bond
  this to one of the Network Interface on Host. so that i can isolate my VM
  from other networks.
 
  The issue is even if i set Cluster while creating Logical Network, it is
 not
  setting the cluster. In Web Admin it is in unset state.
 
  Also, let me know how do i bind this Logical network on Host Interface.
 
  Java code:
 
  Network nw1=new Network();
  VLAN vlan = new VLAN();
  vlan.setId(2000);
  nw1.setVlan(vlan);
  IP ip = new IP();
  ip.setAddress(192.168.1.151);
  ip.setGateway(192.168.1.1);
  ip.setNetmask(255.255.255.0);

 Note that the stated IP above will not be used to set the address on the
 host itself.
 In order to do so you should use either the 'setup networks' api on host's
 nics level.
 (Alternately, you can send POST request to /hosts/{host:id}/nics which
 utilize the
 former api (it is a bit simpler than using the setup networks api).

 Should look like:
 Host host = api.getHosts().get(host_name);
 Action action = new Action();
 action.setCheckConnectivity(true); //required for rollback in case of
 configuration failure
 action.setHostNics(...); // should contain the target configuration
 host.getHostNics().setupnetworks(action);

 where the action should contain the entire desired network configuration.

 You can find various python-sdk example for setup networks on my blog [1]
 I'll post few examples using the java sdk earlier next week.

 [1] https://motiasayag.wordpress.com/

  nw1.setIp(ip);
  nw1.setName(apiNetwork);
 
  nw1.setDataCenter(api.getDataCenters().get(testDC));
  nw1.setCluster(api.getClusters().get(testCluster));
 
  org.ovirt.engine.sdk.decorators.Network nw2 = api.getNetworks().add(nw1);
 
  --
  Thanks  Regards
  Tejesh
 
  ___
  Users mailing list
  Users@ovirt.org
  http://lists.ovirt.org/mailman/listinfo/users
 




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


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

2014-02-20 Thread Tejesh M
I wrote this code to assign IP address to VM interface eth0, but not luck.
Also, have attached debug log.

*Java Code:*
  org.ovirt.engine.sdk.entities.User userData = new User();
  userData.setUserName(root);
  userData.setPassword(password);
  Users usersData = new Users();
  usersData.getUsers().add(userData);
  CloudInit cloudData = new CloudInit();


  cloudData.setUsers(usersData);
  Host hostData = new Host();
  hostData.setAddress(vmName);
  cloudData.setHost(hostData);

  org.ovirt.engine.sdk.entities.CloudInit.Network
networkConfiguration=new org.ovirt.engine.sdk.entities.CloudInit.Network();

  DNS dns = new DNS();
  dns.setServers(createServersList(1.1.2.2, 1.2.3.4));
  dns.setSearchDomains(createServersList(google.com));
  networkConfiguration.setDns(dns);
  networkConfiguration.setNics(new Nics());

  Nics nics = networkConfiguration.getNics();
  nics.getNics().add(createNic(eth0, STATIC,
createNetwork(192.168.1.102, 255.255.0.0, 192.168.2.1), true));

  networkConfiguration.setNics(nics);

  cloudData.setNetwork(networkConfiguration);

  Initialization initData = new Initialization();

  initData.setCloudInit(cloudData);

  VM vmDataForStart = new VM();
  vmDataForStart.setInitialization(initData);
  Action actionData = new Action();
  actionData.setVm(vmDataForStart);

  // Send the request to start the VM to the server:
  api.getVMs().get(vmName).start(actionData);






On Thu, Feb 20, 2014 at 1:39 PM, Moti Asayag masa...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: Moti Asayag masa...@redhat.com
  Cc: users@oVirt.org users@ovirt.org
  Sent: Thursday, February 20, 2014 8:52:52 AM
  Subject: Re: [Users] Fwd: Sample code for setting NIC - CloudInit
 
  I'm not getting below class:
 
  import org.ovirt.engine.sdk.entities.*NetworkConfiguration*;

 Which version of ovirt-engine-sdk-java are you using ?

 I used ovirt-engine-sdk-java-3.4.0.1-1, added to my project's pom.xml:

 dependency
 groupIdorg.ovirt.engine.sdk/groupId
 artifactIdovirt-engine-sdk-java/artifactId
 version3.4.0.1-1/version
 typejar/type
 scopecompile/scope
 /dependency

 
 
  On Thu, Feb 20, 2014 at 4:11 AM, Moti Asayag masa...@redhat.com wrote:
 
  
  
   - Original Message -
From: Tejesh M tejes...@gmail.com
To: users@oVirt.org users@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
 nameeth0/name
 boot_protocolSTATIC/boot_protocol
 network
   ip address=192.168.2.11 netmask=255.255.0.0
   gateway=192.168.2.1 /
 /network
 on_boottrue/on_boot
   /nic
   nic
 nameeth1/name
 boot_protocolDHCP/boot_protocol
   /nic
   nic
 nameeth2/name
 boot_protocolNONE/boot_protocol
 on_boottrue/on_boot
   /nic
 /nics
 dns
   servers
 host
   address1.1.2.2/address
 /host
 host
   address1.2.3.4/address
 /host
   /servers
   search_domains
 host
   addressqa.lab/address
 /host
 host
   address google.com /address
 /host
   /search_domains
 /dns
   /network_configuration
   
   
   
--
Thanks  Regards
Tejesh
   
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users
   
  
 
 
 
  --
  Thanks  Regards
  Tejesh
 




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[Users] Creating Logical Network issue - API

2014-02-20 Thread Tejesh M
Hi ,

I'm trying to create Logical Network and assign it to cluster  want to
bond this to one of the Network Interface on Host. so that i can isolate my
VM from other networks.

The issue is even if i set Cluster while creating Logical Network, it is
not setting the cluster. In Web Admin it is in unset state.

Also, let me know how do i bind this Logical network on Host Interface.

*Java code:*

Network nw1=new Network();
  VLAN vlan = new VLAN();
  vlan.setId(2000);
  nw1.setVlan(vlan);
  IP ip = new IP();
  ip.setAddress(192.168.1.151);
  ip.setGateway(192.168.1.1);
  ip.setNetmask(255.255.255.0);
  nw1.setIp(ip);
  nw1.setName(apiNetwork);

  nw1.setDataCenter(api.getDataCenters().get(testDC));
  nw1.setCluster(api.getClusters().get(testCluster));

  org.ovirt.engine.sdk.decorators.Network nw2 =
api.getNetworks().add(nw1);

-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


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

2014-02-20 Thread Tejesh M
I'm using rhevm 3.3 java sdk,which doesn't have NetworkConfiguration class.
On 20 Feb 2014 20:58, Juan Hernandez jhern...@redhat.com wrote:

 On 02/20/2014 10:40 AM, Tejesh M wrote:
  I wrote this code to assign IP address to VM interface eth0, but not
  luck. Also, have attached debug log.
 

 I'm attaching a complete examaple of how to do this. However, I think
 that setting the DNS information doesn't currently work. Apparently
 cloud-init is expecting a network configuration containing the DNS
 settings inside the network interface, something like this:

 iface eth0 inet static
   dns-nameservers 1.1.2.2 1.2.3.4
   dns-search google.com
   address 192.168.1.102
   netmask 255.255.0.0
   gateway 192.168.2.1
 auto eth0

 But we actually pass them outside of the network interface, like this:

 dns-nameservers 1.1.2.2 1.2.3.4
 dns-search google.com
 iface eth0 inet static
   address 192.168.1.102
   netmask 255.255.0.0
   gateway 192.168.2.1
 auto eth0

 I need to check it.

  _*Java Code:*_
org.ovirt.engine.sdk.entities.User userData = new User();
userData.setUserName(root);
userData.setPassword(password);
Users usersData = new Users();
usersData.getUsers().add(userData);
CloudInit cloudData = new CloudInit();
 
 
cloudData.setUsers(usersData);
Host hostData = new Host();
hostData.setAddress(vmName);
cloudData.setHost(hostData);
 
org.ovirt.engine.sdk.entities.CloudInit.Network
  networkConfiguration=new
 org.ovirt.engine.sdk.entities.CloudInit.Network();
 
DNS dns = new DNS();
dns.setServers(createServersList(1.1.2.2, 1.2.3.4));
dns.setSearchDomains(createServersList(google.com
  http://google.com));
networkConfiguration.setDns(dns);
networkConfiguration.setNics(new Nics());
 
Nics nics = networkConfiguration.getNics();
nics.getNics().add(createNic(eth0, STATIC,
  createNetwork(192.168.1.102, 255.255.0.0, 192.168.2.1), true));
 
networkConfiguration.setNics(nics);
 
cloudData.setNetwork(networkConfiguration);
 
Initialization initData = new Initialization();
 
initData.setCloudInit(cloudData);
 
VM vmDataForStart = new VM();
vmDataForStart.setInitialization(initData);
Action actionData = new Action();
actionData.setVm(vmDataForStart);
 
// Send the request to start the VM to the server:
api.getVMs().get(vmName).start(actionData);
 
 
 
 
 
 
  On Thu, Feb 20, 2014 at 1:39 PM, Moti Asayag masa...@redhat.com
  mailto:masa...@redhat.com wrote:
 
 
 
  - Original Message -
   From: Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com
   To: Moti Asayag masa...@redhat.com mailto:masa...@redhat.com
   Cc: users@oVirt.org users@ovirt.org mailto:users@ovirt.org
   Sent: Thursday, February 20, 2014 8:52:52 AM
   Subject: Re: [Users] Fwd: Sample code for setting NIC - CloudInit
  
   I'm not getting below class:
  
   import org.ovirt.engine.sdk.entities.*NetworkConfiguration*;
 
  Which version of ovirt-engine-sdk-java are you using ?
 
  I used ovirt-engine-sdk-java-3.4.0.1-1, added to my project's
 pom.xml:
 
  dependency
  groupIdorg.ovirt.engine.sdk/groupId
  artifactIdovirt-engine-sdk-java/artifactId
  version3.4.0.1-1/version
  typejar/type
  scopecompile/scope
  /dependency
 
  
  
   On Thu, Feb 20, 2014 at 4:11 AM, Moti Asayag masa...@redhat.com
  mailto:masa...@redhat.com wrote:
  
   
   
- Original Message -
 From: Tejesh M tejes...@gmail.com mailto:
 tejes...@gmail.com
 To: users@oVirt.org users@ovirt.org mailto:users@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
  nameeth0/name
  boot_protocolSTATIC/boot_protocol
  network
ip address=192.168.2.11 netmask

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

2014-02-20 Thread Tejesh M
Also, any workaround to assign ip?
On 20 Feb 2014 04:11, Moti Asayag masa...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: users@oVirt.org users@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
   nameeth0/name
   boot_protocolSTATIC/boot_protocol
   network
 ip address=192.168.2.11 netmask=255.255.0.0
 gateway=192.168.2.1 /
   /network
   on_boottrue/on_boot
 /nic
 nic
   nameeth1/name
   boot_protocolDHCP/boot_protocol
 /nic
 nic
   nameeth2/name
   boot_protocolNONE/boot_protocol
   on_boottrue/on_boot
 /nic
   /nics
   dns
 servers
   host
 address1.1.2.2/address
   /host
   host
 address1.2.3.4/address
   /host
 /servers
 search_domains
   host
 addressqa.lab/address
   /host
   host
 address google.com /address
   /host
 /search_domains
   /dns
 /network_configuration
 
 
 
  --
  Thanks  Regards
  Tejesh
 
  ___
  Users mailing list
  Users@ovirt.org
  http://lists.ovirt.org/mailman/listinfo/users
 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


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

2014-02-20 Thread Tejesh M
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

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 jhern...@redhat.comwrote:

 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
 groupIdorg.ovirt.engine.sdk/groupId
 artifactIdovirt-engine-sdk-java/artifactId
 version3.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 masa...@redhat.com
  mailto:masa...@redhat.com wrote:
 
 
 
  - Original Message -
   From: Tejesh M tejes...@gmail.com mailto:tejes...@gmail.com
   To: users@oVirt.org users@ovirt.org mailto:users@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
nameeth0/name
boot_protocolSTATIC/boot_protocol
network
  ip address=192.168.2.11 netmask=255.255.0.0
  gateway=192.168.2.1 /
/network
on_boottrue/on_boot
  /nic
  nic
nameeth1/name
boot_protocolDHCP/boot_protocol
  /nic
  nic
nameeth2/name
boot_protocolNONE/boot_protocol
on_boottrue/on_boot
  /nic
/nics
dns
  servers
host
  address1.1.2.2/address
/host
host
  address1.2.3.4/address
/host
  /servers
  search_domains
host
  addressqa.lab/address
/host
host
  address google.com http://google.com /address
/host
  /search_domains
/dns
  /network_configuration
  
  
  
   --
   Thanks  Regards
   Tejesh
  
   ___
   Users mailing list
   Users@ovirt.org mailto:Users@ovirt.org
   http://lists.ovirt.org/mailman/listinfo/users
  
 
 
 
  ___
  Users mailing list
  Users@ovirt.org
  http://lists.ovirt.org/mailman/listinfo/users
 


 --
 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
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


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

2014-02-19 Thread Tejesh M
Hi,

Can someone share me sample java code for assigning IP address for VM on
eth0 through Java SDK via CloudInit ?

*Something Like this but in Java:*

network_configuration
 nics
   nic
 nameeth0/name
 boot_protocolSTATIC/boot_protocol
 network
   ip address=192.168.2.11 netmask=255.255.0.0
gateway=192.168.2.1 /
 /network
 on_boottrue/on_boot
   /nic
   nic
 nameeth1/name
 boot_protocolDHCP/boot_protocol
   /nic
   nic
 nameeth2/name
 boot_protocolNONE/boot_protocol
 on_boottrue/on_boot
   /nic
 /nics
 dns
   servers
 host
   address1.1.2.2/address
 /host
 host
   address1.2.3.4/address
 /host
   /servers
   search_domains
 host
   addressqa.lab/address
 /host
 host
   addressgoogle.com/address
 /host
   /search_domains
 /dns
   /network_configuration




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


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

2014-02-19 Thread Tejesh M
I'm not getting below class:

import org.ovirt.engine.sdk.entities.*NetworkConfiguration*;


On Thu, Feb 20, 2014 at 4:11 AM, Moti Asayag masa...@redhat.com wrote:



 - Original Message -
  From: Tejesh M tejes...@gmail.com
  To: users@oVirt.org users@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
   nameeth0/name
   boot_protocolSTATIC/boot_protocol
   network
 ip address=192.168.2.11 netmask=255.255.0.0
 gateway=192.168.2.1 /
   /network
   on_boottrue/on_boot
 /nic
 nic
   nameeth1/name
   boot_protocolDHCP/boot_protocol
 /nic
 nic
   nameeth2/name
   boot_protocolNONE/boot_protocol
   on_boottrue/on_boot
 /nic
   /nics
   dns
 servers
   host
 address1.1.2.2/address
   /host
   host
 address1.2.3.4/address
   /host
 /servers
 search_domains
   host
 addressqa.lab/address
   /host
   host
 address google.com /address
   /host
 /search_domains
   /dns
 /network_configuration
 
 
 
  --
  Thanks  Regards
  Tejesh
 
  ___
  Users mailing list
  Users@ovirt.org
  http://lists.ovirt.org/mailman/listinfo/users
 




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK

2014-02-18 Thread Tejesh M
I tried sysprep through web admin, but it shows only Domain name and
alternate username  password. There is no option to reset Administrator
Password.


On Tue, Feb 18, 2014 at 1:01 PM, Itamar Heim ih...@redhat.com wrote:

 On 02/18/2014 07:27 AM, Tejesh M wrote:

 Oh did silly mistake.. didn't check above 8 characters. Its working.

 I want to set Adminstrator Password for windows through API.
 does cloud-init supports windows sysprep? or I need to install some
 other component?


 you can use windows sysprep, which ovirt supports.
 but that's not cloud-init.
 iirc, there is some cloud-init compatibility package for windows





 On Mon, Feb 17, 2014 at 7:42 PM, Shahar Havivi shah...@redhat.com
 mailto:shah...@redhat.com wrote:

 On 17.02.14 18:25, Tejesh M wrote:
   Thanks.. thats solved the issue. but now when i try to login with
 password
   i set through API using cloud-init. OS (RHEL 6) is asking me to
 assign new
   password  what ever i give weak or strong password, it is not
 accepting.
 try more then 8 characters with upper lower numbers and symbols :)
  
  
  
  
   On Mon, Feb 17, 2014 at 11:50 AM, Itamar Heim ih...@redhat.com
 mailto:ih...@redhat.com wrote:
  
On 02/17/2014 08:16 AM, Tejesh M wrote:
   
It's cloud-init-0.6.3-0.12.bzr532.el6.noarch.rpm installed on
 guest.
   
   
you need at least 0.7.2 iirc, its available in .el6.5
   
   
   
On Fri, Feb 14, 2014 at 9:18 PM, Itamar Heim ih...@redhat.com
 mailto:ih...@redhat.com
mailto:ih...@redhat.com mailto:ih...@redhat.com wrote:
   
On 02/14/2014 03:07 PM, Tejesh M wrote:
   
Thanks, now i could see the cloud-init option in Run
 Once.. I did
selected Other Linux instead of exact Linux flavor.
 And sorry,
instead
of Reply All, i clicked on Reply and sent that mail.
   
   
shahar - any reason 'other linux' doesn't have cloud-init?
 sounds
liek a bug?
Tejesh - which version of cloud-init in the guest?
   
   
   
   
--
Thanks  Regards
Tejesh
   
   
   
  
 
  --
  Thanks  Regards
  Tejesh




 --
 Thanks  Regards
 Tejesh





-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK

2014-02-18 Thread Tejesh M
Yes, I tried that, it asks for Domain Name and Username  Password for that
domain to join. But no option to reset the Admin password.


On Tue, Feb 18, 2014 at 5:20 PM, Shahar Havivi shah...@redhat.com wrote:

 On 18.02.14 17:08, Tejesh M wrote:
  I tried sysprep through web admin, but it shows only Domain name and
  alternate username  password. There is no option to reset Administrator
  Password.
 Please try via the Run-Once,
 You need to attach Floppy in Boot Options and set it to [Sysprep]
 Then you will see the credentials under the Initial Run.

 
 
  On Tue, Feb 18, 2014 at 1:01 PM, Itamar Heim ih...@redhat.com wrote:
 
   On 02/18/2014 07:27 AM, Tejesh M wrote:
  
   Oh did silly mistake.. didn't check above 8 characters. Its working.
  
   I want to set Adminstrator Password for windows through API.
   does cloud-init supports windows sysprep? or I need to install some
   other component?
  
  
   you can use windows sysprep, which ovirt supports.
   but that's not cloud-init.
   iirc, there is some cloud-init compatibility package for windows
  
  
  
  
  
   On Mon, Feb 17, 2014 at 7:42 PM, Shahar Havivi shah...@redhat.com
   mailto:shah...@redhat.com wrote:
  
   On 17.02.14 18:25, Tejesh M wrote:
 Thanks.. thats solved the issue. but now when i try to login
 with
   password
 i set through API using cloud-init. OS (RHEL 6) is asking me to
   assign new
 password  what ever i give weak or strong password, it is not
   accepting.
   try more then 8 characters with upper lower numbers and symbols :)




 On Mon, Feb 17, 2014 at 11:50 AM, Itamar Heim 
 ih...@redhat.com
   mailto:ih...@redhat.com wrote:

  On 02/17/2014 08:16 AM, Tejesh M wrote:
 
  It's cloud-init-0.6.3-0.12.bzr532.el6.noarch.rpm installed
 on
   guest.
 
 
  you need at least 0.7.2 iirc, its available in .el6.5
 
 
 
  On Fri, Feb 14, 2014 at 9:18 PM, Itamar Heim 
 ih...@redhat.com
   mailto:ih...@redhat.com
  mailto:ih...@redhat.com mailto:ih...@redhat.com wrote:
 
  On 02/14/2014 03:07 PM, Tejesh M wrote:
 
  Thanks, now i could see the cloud-init option in Run
   Once.. I did
  selected Other Linux instead of exact Linux
 flavor.
   And sorry,
  instead
  of Reply All, i clicked on Reply and sent that mail.
 
 
  shahar - any reason 'other linux' doesn't have
 cloud-init?
   sounds
  liek a bug?
  Tejesh - which version of cloud-init in the guest?
 
 
 
 
  --
  Thanks  Regards
  Tejesh
 
 
 

   
--
Thanks  Regards
Tejesh
  
  
  
  
   --
   Thanks  Regards
   Tejesh
  
  
  
 
 
  --
  Thanks  Regards
  Tejesh




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK

2014-02-18 Thread Tejesh M
I want to assign random password for Administrator  IP address through
API, as we did for Linux OS using Cloud-init.


On Tue, Feb 18, 2014 at 5:45 PM, Shahar Havivi shah...@redhat.com wrote:

 On 18.02.14 17:27, Tejesh M wrote:
  Yes, I tried that, it asks for Domain Name and Username  Password for
 that
  domain to join. But no option to reset the Admin password.
 What do you mean by reset?
 Do you want to have no admin password?

 
 
  On Tue, Feb 18, 2014 at 5:20 PM, Shahar Havivi shah...@redhat.com
 wrote:
 
   On 18.02.14 17:08, Tejesh M wrote:
I tried sysprep through web admin, but it shows only Domain name and
alternate username  password. There is no option to reset
 Administrator
Password.
   Please try via the Run-Once,
   You need to attach Floppy in Boot Options and set it to [Sysprep]
   Then you will see the credentials under the Initial Run.
  
   
   
On Tue, Feb 18, 2014 at 1:01 PM, Itamar Heim ih...@redhat.com
 wrote:
   
 On 02/18/2014 07:27 AM, Tejesh M wrote:

 Oh did silly mistake.. didn't check above 8 characters. Its
 working.

 I want to set Adminstrator Password for windows through API.
 does cloud-init supports windows sysprep? or I need to install
 some
 other component?


 you can use windows sysprep, which ovirt supports.
 but that's not cloud-init.
 iirc, there is some cloud-init compatibility package for windows





 On Mon, Feb 17, 2014 at 7:42 PM, Shahar Havivi 
 shah...@redhat.com
 mailto:shah...@redhat.com wrote:

 On 17.02.14 18:25, Tejesh M wrote:
   Thanks.. thats solved the issue. but now when i try to
 login
   with
 password
   i set through API using cloud-init. OS (RHEL 6) is asking
 me to
 assign new
   password  what ever i give weak or strong password, it is
 not
 accepting.
 try more then 8 characters with upper lower numbers and
 symbols :)
  
  
  
  
   On Mon, Feb 17, 2014 at 11:50 AM, Itamar Heim 
   ih...@redhat.com
 mailto:ih...@redhat.com wrote:
  
On 02/17/2014 08:16 AM, Tejesh M wrote:
   
It's cloud-init-0.6.3-0.12.bzr532.el6.noarch.rpm
 installed
   on
 guest.
   
   
you need at least 0.7.2 iirc, its available in .el6.5
   
   
   
On Fri, Feb 14, 2014 at 9:18 PM, Itamar Heim 
   ih...@redhat.com
 mailto:ih...@redhat.com
mailto:ih...@redhat.com mailto:ih...@redhat.com
 wrote:
   
On 02/14/2014 03:07 PM, Tejesh M wrote:
   
Thanks, now i could see the cloud-init option
 in Run
 Once.. I did
selected Other Linux instead of exact Linux
   flavor.
 And sorry,
instead
of Reply All, i clicked on Reply and sent that
 mail.
   
   
shahar - any reason 'other linux' doesn't have
   cloud-init?
 sounds
liek a bug?
Tejesh - which version of cloud-init in the guest?
   
   
   
   
--
Thanks  Regards
Tejesh
   
   
   
  
 
  --
  Thanks  Regards
  Tejesh




 --
 Thanks  Regards
 Tejesh



   
   
--
Thanks  Regards
Tejesh
  
 
 
 
  --
  Thanks  Regards
  Tejesh




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[Users] Unable to Remove Template, if VM exists.

2014-02-18 Thread Tejesh M
Hi All,

I'm not able to Delete Template, if the VM is exists which is deployed from
that Template. How can i delete Template leaving the VM as is?

Thanks  Regards,
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Unable to Remove Template, if VM exists.

2014-02-18 Thread Tejesh M
Tried google and got the answer
http://lists.ovirt.org/pipermail/users/2013-March/013576.html


On Wed, Feb 19, 2014 at 11:52 AM, Tejesh M tejes...@gmail.com wrote:

 Hi All,

 I'm not able to Delete Template, if the VM is exists which is deployed
 from that Template. How can i delete Template leaving the VM as is?

 Thanks  Regards,
 Tejesh




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Unable to Remove Template, if VM exists.

2014-02-18 Thread Tejesh M
Thanks alot.


On Wed, Feb 19, 2014 at 12:04 PM, Karli Sjöberg karli.sjob...@slu.sewrote:

 On Wed, 2014-02-19 at 11:52 +0530, Tejesh M wrote:
  Hi All,
 
 
  I'm not able to Delete Template, if the VM is exists which is deployed
  from that Template. How can i delete Template leaving the VM as is?
 
 
  Thanks  Regards,
 
  Tejesh
 

 In case you aren´t aware, oVirt actually does that for a very good
 reason. This way you can create _1_ template, then create _1000_ VM's,
 and they´ll only take up the space of that single template, and then
 build up on the changes that are new for each VM.

 If you want to be able to still delete a template, I suggest you choose
 to provision new VM's cloned from that template, instead of thin.
 You can however just rename it to something else like
 deprecated_template01 and leave it like that.

 Otherwise your only option is to create a new disk for that VM, start it
 up from a Live-CD and dd the operating disk over onto the new, then
 delete the old disk, perhaps rename the new disk from _Disk2 to
 _Disk1 instead and remember to mark it Bootable. Repeat this process
 for every VM that is thin provisioned from this template and then you
 can finally delete the template.



 --

 Med Vänliga Hälsningar


 ---
 Karli Sjöberg
 Swedish University of Agricultural Sciences Box 7079 (Visiting Address
 Kronåsvägen 8)
 S-750 07 Uppsala, Sweden
 Phone:  +46-(0)18-67 15 66
 karli.sjob...@slu.se




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK

2014-02-17 Thread Tejesh M
Thanks.. thats solved the issue. but now when i try to login with password
i set through API using cloud-init. OS (RHEL 6) is asking me to assign new
password  what ever i give weak or strong password, it is not accepting.




On Mon, Feb 17, 2014 at 11:50 AM, Itamar Heim ih...@redhat.com wrote:

 On 02/17/2014 08:16 AM, Tejesh M wrote:

 It's cloud-init-0.6.3-0.12.bzr532.el6.noarch.rpm installed on guest.


 you need at least 0.7.2 iirc, its available in .el6.5



 On Fri, Feb 14, 2014 at 9:18 PM, Itamar Heim ih...@redhat.com
 mailto:ih...@redhat.com wrote:

 On 02/14/2014 03:07 PM, Tejesh M wrote:

 Thanks, now i could see the cloud-init option in Run Once.. I did
 selected Other Linux instead of exact Linux flavor. And sorry,
 instead
 of Reply All, i clicked on Reply and sent that mail.


 shahar - any reason 'other linux' doesn't have cloud-init? sounds
 liek a bug?
 Tejesh - which version of cloud-init in the guest?




 --
 Thanks  Regards
 Tejesh





-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK

2014-02-17 Thread Tejesh M
Oh did silly mistake.. didn't check above 8 characters. Its working.

I want to set Adminstrator Password for windows through API.
does cloud-init supports windows sysprep? or I need to install some other
component?




On Mon, Feb 17, 2014 at 7:42 PM, Shahar Havivi shah...@redhat.com wrote:

 On 17.02.14 18:25, Tejesh M wrote:
  Thanks.. thats solved the issue. but now when i try to login with
 password
  i set through API using cloud-init. OS (RHEL 6) is asking me to assign
 new
  password  what ever i give weak or strong password, it is not accepting.
 try more then 8 characters with upper lower numbers and symbols :)
 
 
 
 
  On Mon, Feb 17, 2014 at 11:50 AM, Itamar Heim ih...@redhat.com wrote:
 
   On 02/17/2014 08:16 AM, Tejesh M wrote:
  
   It's cloud-init-0.6.3-0.12.bzr532.el6.noarch.rpm installed on guest.
  
  
   you need at least 0.7.2 iirc, its available in .el6.5
  
  
  
   On Fri, Feb 14, 2014 at 9:18 PM, Itamar Heim ih...@redhat.com
   mailto:ih...@redhat.com wrote:
  
   On 02/14/2014 03:07 PM, Tejesh M wrote:
  
   Thanks, now i could see the cloud-init option in Run Once.. I
 did
   selected Other Linux instead of exact Linux flavor. And
 sorry,
   instead
   of Reply All, i clicked on Reply and sent that mail.
  
  
   shahar - any reason 'other linux' doesn't have cloud-init? sounds
   liek a bug?
   Tejesh - which version of cloud-init in the guest?
  
  
  
  
   --
   Thanks  Regards
   Tejesh
  
  
  
 
 
  --
  Thanks  Regards
  Tejesh




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK

2014-02-16 Thread Tejesh M
It's cloud-init-0.6.3-0.12.bzr532.el6.noarch.rpm installed on guest.


On Fri, Feb 14, 2014 at 9:18 PM, Itamar Heim ih...@redhat.com wrote:

 On 02/14/2014 03:07 PM, Tejesh M wrote:

 Thanks, now i could see the cloud-init option in Run Once.. I did
 selected Other Linux instead of exact Linux flavor. And sorry, instead
 of Reply All, i clicked on Reply and sent that mail.


 shahar - any reason 'other linux' doesn't have cloud-init? sounds liek a
 bug?
 Tejesh - which version of cloud-init in the guest?




-- 
Thanks  Regards
Tejesh
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK

2014-02-14 Thread Tejesh M
In the two screenshots which i shared earlier, in that No Cloud-Init
2.png is Run Once screenshot, it has only 4 options,

i. Boot Options
ii. Host
iii. Display Protocol
iv. Custom Properties

After selecting VM, when i click Run Once, that screen is getting appears
as in screenshot, no option for cloud-init.

Do i need to update the RHEV-M?


On Fri, Feb 14, 2014 at 3:06 PM, Juan Hernandez jhern...@redhat.com wrote:

 On 02/14/2014 10:30 AM, Tejesh M wrote:
  Hi,
 
  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?
 
  Thanks  Regards,
  Tejesh
 

 You are using the Run and New options, but you have to use the Run
 Once option. There, in Run Once is where we have cloud-init support
 in 3.3.

 
  On Thu, Feb 13, 2014 at 9:50 PM, Juan Hernandez jhern...@redhat.com
  mailto:jhern...@redhat.com wrote:
 
  On 02/13/2014 05:15 PM, Tejesh M wrote:
   Actually, i want to automate the vm provisioning through java sdk.
 and
   this urgent requirement.  Is it possible to automate setting
 hostname,
   root password n nic info by any means in 3.3? Also in windows
   administration password as similar to linux.. kindly help as im
 new to
   this..
  
 
  Yes, setting the hostname, root password and NIC info is possible in
  3.3, using cloud-init and the Java SDK. I tested this with 3.3 and it
  works correctly.
 
  As you are having problems I suggest to try it manually, from the
 GUI,
  if it doesn't work then please report the details, so that we can
  diagnose and fix it.
 
  Once it works manually from the GUI, we can see why it doesn't work
 with
  the SDK, but we will need the output generated when running in debug
  mode.
 
   On 13 Feb 2014 20:32, Juan Hernandez jhern...@redhat.com
  mailto:jhern...@redhat.com
   mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote:
  
   On 02/13/2014 03:59 PM, Shahar Havivi wrote:
On 13.02.14 20:17, Tejesh M wrote:
1. The Version is RHEV-M 3.3  Cloud-init is
cloud-init-0.6.3-0.12.bzr532.el6.noarch
   
2. In Webadmin, i don't find any option to set Cloud-init
  data's.
   I checked
under New VM-Initial Run.. Am i looking at the right place?
How to enable cloud-init support in engine?
You will not found it since you are working in 3.3 and this
   feature presented
in 3.4.
In 3.3 you can try to set the Cloud-Init via the Run-Once
  button.
   
  
   In 3.3 you need first to create the VM. Once it is created
  select it,
   click the Run Once button, then click on the plus sign next
 to
   Initial Run, check the Cloud-Init box, and populate the
 fields
   you want.
  
   
I have installed cloud-init package in RHEV-M  also in
  Template.
   
Please suggest.
   
   
On Thu, Feb 13, 2014 at 7:31 PM, Juan Hernandez
   jhern...@redhat.com mailto:jhern...@redhat.com
  mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote:
   
On 02/13/2014 02:39 PM, Tejesh M wrote:
Hi All,
   
Thanks alot.
   
I have created one VM with minimal installation 
 installed
   cloud-init
package. And, converted that VM into Template. Then
 executed
   the code
given in
   
  
  http://lists.ovirt.org/pipermail/users/2014-February/021302.html ,
 but
no luck, the code is not setting root password.
   
   
What version of the engine are you running? I may not have
 the
   required
cloud-init support.
   
Try to run the application in debug mode:
   
  Api api = new Api(
https://whatever/api;,
user@domain,
password,
null,
null,
null,
null,
true,
null,
true  // - This is to enable debug mode
  );
   
It will send to the log the actual XML documents sent to
 the
   server. We
can use it to see if the request is generated correctly.
   
It may also happen that cloud-init support isn't working
   correctly. To
verify this try to use the cloud-init support manually from
   webadmin.
Does it work from there?
   
Also, there is no option to set *Hostname *for the VM.
   
   
To set the host name you need to add

Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK

2014-02-14 Thread Tejesh M
CDROM is attached, but it is mounting the default iso from ISO Domain.


On Fri, Feb 14, 2014 at 6:54 PM, Juan Hernandez jhern...@redhat.com wrote:

 On 02/14/2014 02:07 PM, Tejesh M wrote:
  Thanks, now i could see the cloud-init option in Run Once.. I did
  selected Other Linux instead of exact Linux flavor. And sorry, instead
  of Reply All, i clicked on Reply and sent that mail.
 
  Now, when i start VM from Run Once with Cloud-init options like Hostname
   Root Password, in the startup screen of VM, it show the error as
  attached screenshot.
 
 

 The messages in that screen shot mean that cloud-init is trying to
 locate its configuration via the network instead of inside the CDROM. So
 this probably means that the CDROM isn't attached correctly to the VM.
 Please try to find the options of the qemu-kvm command as I described in
 a previous mail.

 
 
  On Fri, Feb 14, 2014 at 5:09 PM, Juan Hernandez jhern...@redhat.com
  mailto:jhern...@redhat.com wrote:
 
  On 02/14/2014 12:27 PM, Tejesh M wrote:
   Here is the list:
  
   [root@rhevm ~]# rpm -qa 'rhevm*'
  
   rhevm-lib-3.3.0-0.46.el6ev.noarch
   rhevm-setup-3.3.0-0.46.el6ev.noarch
   rhevm-spice-client-x86-msi-3.3-8.el6_5.noarch
   rhevm-branding-rhev-3.3.0-1.5.el6ev.noarch
   rhevm-restapi-3.3.0-0.46.el6ev.noarch
   rhevm-3.3.0-0.46.el6ev.noarch
   rhevm-sdk-java-javadoc-1.0.0.29-0.1.el6ev.noarch
   rhevm-image-uploader-3.3.1-2.el6ev.noarch
   rhevm-setup-plugins-3.3.0-4.el6ev.noarch
   rhevm-cli-3.3.0.13-1.el6ev.noarch
   rhevm-log-collector-3.3.1-5.el6ev.noarch
   rhevm-dependencies-3.3.5-1.el6ev.noarch
   rhevm-spice-client-x64-msi-3.3-8.el6_5.noarch
   rhevm-tools-3.3.0-0.46.el6ev.noarch
   rhevm-sdk-python-3.3.0.21-1.el6ev.noarch
   rhevm-iso-uploader-3.3.0-2.el6ev.noarch
   rhevm-websocket-proxy-3.3.0-0.46.el6ev.noarch
   rhevm-backend-3.3.0-0.46.el6ev.noarch
   rhevm-spice-client-x64-cab-3.3-8.el6_5.noarch
   rhevm-userportal-3.3.0-0.46.el6ev.noarch
   rhevm-dwh-3.3.0-29.el6ev.noarch
   rhevm-dbscripts-3.3.0-0.46.el6ev.noarch
   rhevm-reports-3.3.0-28.el6ev.noarch
   rhevm-sdk-java-1.0.0.29-0.1.el6ev.noarch
   rhevm-doc-3.3.0-3.el6eng.noarch
   rhevm-webadmin-portal-3.3.0-0.46.el6ev.noarch
   rhevm-spice-client-x86-cab-3.3-8.el6_5.noarch
  
 
  Ok, you are using RHEV-M 3.3, that is correct, it has support for
  cloud-init. The only reason I can think of that prevents using the
  cloud-init options in 3.3 is that the operating system isn't defined
 as
  a Linux variant. Select the VM, click the Edit button and make
 sure to
  select a Linux operating system in the Operating System list. The
  closer to the actual operating system the better. Then try again
  Run Once.
 
  To avoid making this for every VM you create, you should do the
 change
  in the template as well.
 
  By the way, please reply to the list, there may be other people
  interested in your same issue.
 
  --
  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
 
 
  ___
  Users mailing list
  Users@ovirt.org
  http://lists.ovirt.org/mailman/listinfo/users
 


 --
 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
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK

2014-02-14 Thread Tejesh M
Tried with disabling the ISO Domain, still it is check for network instead
of mount the CDROM

and my RHEV version is RHEV-H 6.5-20140121.0.el6ev


On Fri, Feb 14, 2014 at 7:29 PM, Juan Hernandez jhern...@redhat.com wrote:

 On 02/14/2014 02:48 PM, Tejesh M wrote:
  CDROM is attached, but it is mounting the default iso from ISO Domain.
 

 Do you have that default CDROM explicitly attached to the VM? If so then
 you need to detach it. To be absolutely sure that there isn't any CDROMs
 from the ISO domain attached to the VM you can just put the ISO domain
 in maintenance, just for testing this.

 What version of the hypervisor are you using?

 
  On Fri, Feb 14, 2014 at 6:54 PM, Juan Hernandez jhern...@redhat.com
  mailto:jhern...@redhat.com wrote:
 
  On 02/14/2014 02:07 PM, Tejesh M wrote:
   Thanks, now i could see the cloud-init option in Run Once.. I did
   selected Other Linux instead of exact Linux flavor. And sorry,
  instead
   of Reply All, i clicked on Reply and sent that mail.
  
   Now, when i start VM from Run Once with Cloud-init options like
  Hostname
Root Password, in the startup screen of VM, it show the error as
   attached screenshot.
  
  
 
  The messages in that screen shot mean that cloud-init is trying to
  locate its configuration via the network instead of inside the
 CDROM. So
  this probably means that the CDROM isn't attached correctly to the
 VM.
  Please try to find the options of the qemu-kvm command as I
 described in
  a previous mail.
 
  
  
   On Fri, Feb 14, 2014 at 5:09 PM, Juan Hernandez
  jhern...@redhat.com mailto:jhern...@redhat.com
   mailto:jhern...@redhat.com mailto:jhern...@redhat.com wrote:
  
   On 02/14/2014 12:27 PM, Tejesh M wrote:
Here is the list:
   
[root@rhevm ~]# rpm -qa 'rhevm*'
   
rhevm-lib-3.3.0-0.46.el6ev.noarch
rhevm-setup-3.3.0-0.46.el6ev.noarch
rhevm-spice-client-x86-msi-3.3-8.el6_5.noarch
rhevm-branding-rhev-3.3.0-1.5.el6ev.noarch
rhevm-restapi-3.3.0-0.46.el6ev.noarch
rhevm-3.3.0-0.46.el6ev.noarch
rhevm-sdk-java-javadoc-1.0.0.29-0.1.el6ev.noarch
rhevm-image-uploader-3.3.1-2.el6ev.noarch
rhevm-setup-plugins-3.3.0-4.el6ev.noarch
rhevm-cli-3.3.0.13-1.el6ev.noarch
rhevm-log-collector-3.3.1-5.el6ev.noarch
rhevm-dependencies-3.3.5-1.el6ev.noarch
rhevm-spice-client-x64-msi-3.3-8.el6_5.noarch
rhevm-tools-3.3.0-0.46.el6ev.noarch
rhevm-sdk-python-3.3.0.21-1.el6ev.noarch
rhevm-iso-uploader-3.3.0-2.el6ev.noarch
rhevm-websocket-proxy-3.3.0-0.46.el6ev.noarch
rhevm-backend-3.3.0-0.46.el6ev.noarch
rhevm-spice-client-x64-cab-3.3-8.el6_5.noarch
rhevm-userportal-3.3.0-0.46.el6ev.noarch
rhevm-dwh-3.3.0-29.el6ev.noarch
rhevm-dbscripts-3.3.0-0.46.el6ev.noarch
rhevm-reports-3.3.0-28.el6ev.noarch
rhevm-sdk-java-1.0.0.29-0.1.el6ev.noarch
rhevm-doc-3.3.0-3.el6eng.noarch
rhevm-webadmin-portal-3.3.0-0.46.el6ev.noarch
rhevm-spice-client-x86-cab-3.3-8.el6_5.noarch
   
  
   Ok, you are using RHEV-M 3.3, that is correct, it has support
 for
   cloud-init. The only reason I can think of that prevents using
 the
   cloud-init options in 3.3 is that the operating system isn't
  defined as
   a Linux variant. Select the VM, click the Edit button and
  make sure to
   select a Linux operating system in the Operating System
  list. The
   closer to the actual operating system the better. Then try
 again
   Run Once.
  
   To avoid making this for every VM you create, you should do
  the change
   in the template as well.
  
   By the way, please reply to the list, there may be other people
   interested in your same issue.
  

 --
 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
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK

2014-02-13 Thread Tejesh M
1. The Version is RHEV-M 3.3  Cloud-init is
cloud-init-0.6.3-0.12.bzr532.el6.noarch

2. In Webadmin, i don't find any option to set Cloud-init data's. I checked
under New VM-Initial Run.. Am i looking at the right place?
How to enable cloud-init support in engine?

I have installed cloud-init package in RHEV-M  also in Template.

Please suggest.


On Thu, Feb 13, 2014 at 7:31 PM, Juan Hernandez jhern...@redhat.com wrote:

 On 02/13/2014 02:39 PM, Tejesh M wrote:
  Hi All,
 
  Thanks alot.
 
  I have created one VM with minimal installation  installed cloud-init
  package. And, converted that VM into Template. Then executed the code
  given in
  http://lists.ovirt.org/pipermail/users/2014-February/021302.html , but
  no luck, the code is not setting root password.
 

 What version of the engine are you running? I may not have the required
 cloud-init support.

 Try to run the application in debug mode:

   Api api = new Api(
 https://whatever/api;,
 user@domain,
 password,
 null,
 null,
 null,
 null,
 true,
 null,
 true  // - This is to enable debug mode
   );

 It will send to the log the actual XML documents sent to the server. We
 can use it to see if the request is generated correctly.

 It may also happen that cloud-init support isn't working correctly. To
 verify this try to use the cloud-init support manually from webadmin.
 Does it work from there?

  Also, there is no option to set *Hostname *for the VM.
 

 To set the host name you need to add something like this:

   Host hostData = new Host();
   hostData.setAddress(the.host.name);
   cloudData.setHost(hostData);

 
 
  _*Code:*_
 
  /*Begin Customize VM*/
  // Generate the random password, using whatever mechanism you
// prefer:
String password = cJql3P9XLQG4drCYVG/6Q/;
 
// You need to know the name of the template, the cluster and
// the VM you are going to create:
String templateName = rhel2_temp;
String clusterName = testCluster;
String vmName = myvm;
 
// Prepare the data to create the VM from the template:
org.ovirt.engine.sdk.entities.Template templateData = new
  Template();
templateData.setName(templateName);
org.ovirt.engine.sdk.entities.Cluster clusterData = new
 Cluster();
clusterData.setName(clusterName);
org.ovirt.engine.sdk.entities.VM vmDataForCreate = new VM();
vmDataForCreate.setName(vmName);
vmDataForCreate.setCluster(clusterData);
vmDataForCreate.setTemplate(templateData);
 
// Send the request to create the VM to the server:
api.getVMs().add(vmDataForCreate);
String state;
// White till the VM is down (it will be locked for a while):
for (;;) {
   state = api.getVMs().get(vmName).getStatus().getState();
  if (down.equals(state)) {
break;
  }
  Thread.sleep(1000);
}
System.out.println(System Status:+state);
// Populate parameters for the action to start the VM with
  cloud-init:
org.ovirt.engine.sdk.entities.User userData = new User();
userData.setUserName(root);
userData.setPassword(password);
Users usersData = new Users();
usersData.getUsers().add(userData);
CloudInit cloudData = new CloudInit();
cloudData.setUsers(usersData);
 
Initialization initData = new Initialization();
initData.setCloudInit(cloudData);
VM vmDataForStart = new VM();
vmDataForStart.setInitialization(initData);
Action actionData = new Action();
actionData.setVm(vmDataForStart);
 
// Send the request to start the VM to the server:
api.getVMs().get(vmName).start(actionData);
System.out.println(After :
  +api.getVMs().get(vmName).getStatus());
/*End Customize VM*/
 
 
 
  Thanks  Regards,
  Tejesh
 
 
 
  On Thu, Feb 13, 2014 at 2:26 PM, Juan Hernandez jhern...@redhat.com
  mailto:jhern...@redhat.com wrote:
 
  On 02/13/2014 09:29 AM, Shahar Havivi wrote:
   On 13.02.14 00:59, Oved Ourfalli wrote:
  
  
   - Original Message -
   From: Shahar Havivi shah...@redhat.com
  mailto:shah...@redhat.com
   To: users@ovirt.org mailto:users@ovirt.org
   Cc: Juan Antonio Hernandez Fernandez jhern...@redhat.com
  mailto:jhern...@redhat.com, rhevm-...@lists.fedorahosted.org
  mailto:rhevm-...@lists.fedorahosted.org, Tejesh M
   tejes...@gmail.com mailto:tejes...@gmail.com
   Sent: Wednesday, February 12, 2014 11:22:20 PM
   Subject: Re: [Users] [rhevm-api] Assign IP address to VM using
  Java SDK
  
   On 12.02.14

Re: [Users] [rhevm-api] Assign IP address to VM using Java SDK

2014-02-13 Thread Tejesh M
Actually, i want to automate the vm provisioning through java sdk. and this
urgent requirement.  Is it possible to automate setting hostname, root
password n nic info by any means in 3.3? Also in windows administration
password as similar to linux.. kindly help as im new to this..
On 13 Feb 2014 20:32, Juan Hernandez jhern...@redhat.com wrote:

 On 02/13/2014 03:59 PM, Shahar Havivi wrote:
  On 13.02.14 20:17, Tejesh M wrote:
  1. The Version is RHEV-M 3.3  Cloud-init is
  cloud-init-0.6.3-0.12.bzr532.el6.noarch
 
  2. In Webadmin, i don't find any option to set Cloud-init data's. I
 checked
  under New VM-Initial Run.. Am i looking at the right place?
  How to enable cloud-init support in engine?
  You will not found it since you are working in 3.3 and this feature
 presented
  in 3.4.
  In 3.3 you can try to set the Cloud-Init via the Run-Once button.
 

 In 3.3 you need first to create the VM. Once it is created select it,
 click the Run Once button, then click on the plus sign next to
 Initial Run, check the Cloud-Init box, and populate the fields you
 want.

 
  I have installed cloud-init package in RHEV-M  also in Template.
 
  Please suggest.
 
 
  On Thu, Feb 13, 2014 at 7:31 PM, Juan Hernandez jhern...@redhat.com
 wrote:
 
  On 02/13/2014 02:39 PM, Tejesh M wrote:
  Hi All,
 
  Thanks alot.
 
  I have created one VM with minimal installation  installed cloud-init
  package. And, converted that VM into Template. Then executed the code
  given in
  http://lists.ovirt.org/pipermail/users/2014-February/021302.html ,
 but
  no luck, the code is not setting root password.
 
 
  What version of the engine are you running? I may not have the required
  cloud-init support.
 
  Try to run the application in debug mode:
 
Api api = new Api(
  https://whatever/api;,
  user@domain,
  password,
  null,
  null,
  null,
  null,
  true,
  null,
  true  // - This is to enable debug mode
);
 
  It will send to the log the actual XML documents sent to the server. We
  can use it to see if the request is generated correctly.
 
  It may also happen that cloud-init support isn't working correctly. To
  verify this try to use the cloud-init support manually from webadmin.
  Does it work from there?
 
  Also, there is no option to set *Hostname *for the VM.
 
 
  To set the host name you need to add something like this:
 
Host hostData = new Host();
hostData.setAddress(the.host.name);
cloudData.setHost(hostData);
 
 
 
  _*Code:*_
 
  /*Begin Customize VM*/
  // Generate the random password, using whatever mechanism you
// prefer:
String password = cJql3P9XLQG4drCYVG/6Q/;
 
// You need to know the name of the template, the cluster
 and
// the VM you are going to create:
String templateName = rhel2_temp;
String clusterName = testCluster;
String vmName = myvm;
 
// Prepare the data to create the VM from the template:
org.ovirt.engine.sdk.entities.Template templateData = new
  Template();
templateData.setName(templateName);
org.ovirt.engine.sdk.entities.Cluster clusterData = new
  Cluster();
clusterData.setName(clusterName);
org.ovirt.engine.sdk.entities.VM vmDataForCreate = new VM();
vmDataForCreate.setName(vmName);
vmDataForCreate.setCluster(clusterData);
vmDataForCreate.setTemplate(templateData);
 
// Send the request to create the VM to the server:
api.getVMs().add(vmDataForCreate);
String state;
// White till the VM is down (it will be locked for a
 while):
for (;;) {
   state = api.getVMs().get(vmName).getStatus().getState();
  if (down.equals(state)) {
break;
  }
  Thread.sleep(1000);
}
System.out.println(System Status:+state);
// Populate parameters for the action to start the VM with
  cloud-init:
org.ovirt.engine.sdk.entities.User userData = new User();
userData.setUserName(root);
userData.setPassword(password);
Users usersData = new Users();
usersData.getUsers().add(userData);
CloudInit cloudData = new CloudInit();
cloudData.setUsers(usersData);
 
Initialization initData = new Initialization();
initData.setCloudInit(cloudData);
VM vmDataForStart = new VM();
vmDataForStart.setInitialization(initData);
Action actionData = new Action();
actionData.setVm(vmDataForStart);
 
// Send the request to start the VM to the server:
api.getVMs().get(vmName).start(actionData);
System.out.println(After :
  +api.getVMs().get(vmName).getStatus