Re: [ovirt-users] python floppy in RunOnce mode

2016-01-07 Thread Giulio Casella

Il 07/01/2016 11:25, Juan Hernández wrote:

[...]

The sysprep logic is only triggered once, the first time you start the
VM. So you will need to create it again, set the initialization data and
start it, basically repeat the steps that I suggested.


Yes, but the VMs belongs to a freshly created pool, never started before.


There were some bugs around this behaviour, some still not fixed in 3.5,
and it wasn't clear when the VM will use or not use sysprep, so we have
introduced a flag to explicitly force use of sysprep.

Please try to use this flag:

action = params.Action(use_sysprep=True)
vm.start(action)



Nice, use_sysprep=True did the trick!
I noticed also the flag use_cloud_init, I guess with same logic. I have 
to update my code accordingly.


Thank you again,
Giulio Casella


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


Re: [ovirt-users] python floppy in RunOnce mode

2014-12-27 Thread Juan Hernández
On 12/24/2014 11:11 AM, Giulio Casella wrote:
> I can see this behaviour in ovirt 3.5 environment 
> (ovirt-engine-3.5.0.1-1.el6) and in rhev 3.4 environment 
> (rhevm-3.4.3-1.2.el6ev).
> 
> I'm stuck, what I'm doing wrong? :-(
> 

I think that you are doing things correctly. Did you take into account
that the sysprep logic is triggered only the first time that the VM is
started? In later starts the sysprep logic is just ignored. Try to
remove the VM and create it again, then start it with a simple script.
I'm using this:

#!/usr/bin/env python

from ovirtsdk.api import API
from ovirtsdk.xml import params

api = API(
  url="https://ovirt.example.com/ovirt-engine/api";,
  username="admin@internal",
  password="**",
  ca_file="/etc/pki/ovirt-engine/ca.pem"
)

vm = api.vms.get(name="myvm")

initialization = params.Initialization()
vm.set_initialization(initialization)
vm.update()

action = params.Action()
vm.start(action)

api.disconnect()

This works correctly in my 3.5.0.1 environment.

If you don't want to create the VM again you can also change the
"is_initialized" flag in the database (this isn't currently possible
with the RESTAPI):

# psql --host=localhost --user=engine --password engine
Password for user engine: **
engine=> update vm_static set is_initialized = false where vm_name='myvm';
UPDATE 1
engine=> \q

(The database password is in
/etc/ovirt-engine/engine.conf.d/10-setup-database.conf).

> 
> 
> 
> Il 23/12/2014 10:16, Giulio Casella ha scritto:
>> Yes, the VM is windows 7:
>>
>> print myvm.get_os().get_type()
>>
>> shows "windows_7x64"
>>
>> Anyway I tried to force it, as you suggested, but with no luck...
>>
>>
>> Il 22/12/2014 17:52, Juan Hernández ha scritto:
>>> On 12/22/2014 01:21 PM, Giulio Casella wrote:
 Hi Juan,
 I tried to use builtin sysprep files, with no luck.
 Here is my code:

 myvm = api.vms.get(name="vmname")
 initialization = params.Initialization()
 myvm.set_initialization(initialization)
 myvm.update()
 myvm.start(params.Action())

 Virtual Machine starts, but there is no mounted floppy.
 VM is a freshly installed Windows 7 x86_64, with ovirt guest agent and
 no other software.

 Any ideas?

 Giulio

>>>
>>> Is the operating system of the set to one of the Windows variants? If it
>>> isn't set to a Windows variant then the Sysprep logic won't trigger. To
>>> make sure you can update the OS from the script:
>>>
>>> myvm = api.vms.get(name="vmname")
>>> initialization = params.Initialization()
>>> myvm.set_initialization(initialization)
>>> myvm.set_os(
>>>params.OperatingSystem(
>>>  type_="windows_7x64"
>>>)
>>> )
>>> myvm.update()
>>> myvm.start(params.Action())
>>>
 Il 24/10/2014 16:08, Giulio Casella ha scritto:
> Il 23/10/2014 20:59, Juan Hernandez ha scritto:
>> On 10/23/2014 09:40 AM, Giulio Casella wrote:
>>> Hi,
>>> I'm trying to boot a vm with non persistent floppy using python ovirt
>>> sdk (the "RunOnce" way in administrator portal), but guest OS
>>> can't see
>>> floppy drive. The ultimate goal is to deploy floppy with sysprep
>>> unattend.xml file for windows 7 pools of vm.
>>>
>>> Here is a snippet of code I use:
>>>
>>> -
>>> myvm = api.vms.get(name="vmname")
>>> content="This is file content!"
>>> f=params.File(name="foobar.txt",content=content)
>>> fs=params.Files()
>>> fs.add_file(f)
>>> payload=params.Payload()
>>> payload.set_type("floppy")
>>> payload.set_files(fs)
>>> payloads=params.Payloads()
>>> payloads.add_payload(payload)
>>> thevm=params.VM()
>>> thevm.set_payloads(payloads)
>>> action=params.Action(vm=thevm)
>>>
>>> myvm.start(action=action)
>>>
>>> xml = ParseHelper.toXml(action)
>>> print xml
>>> -
>>>
>>> As you can see, for debugging purpose, I print my xml action, and
>>> I get:
>>>
>>> -
>>> 
>>>
>>>
>>>
>>>
>>>
>>>foobar.txt
>>>This is file content
>>>
>>>
>>>
>>>
>>>
>>> 
>>> -
>>>
>>> in the admin portal I can see my vm in "RunOnce" state, but no
>>> floppy is
>>> present...
>>> In fact in the vm process command line
>>> (ps -ef | grep qemu-kvm | grep vmname) I can't see -drive option
>>> referring to floppy (I only see 2 "-drive" options, referring to vm
>>> system disk and to a correctly mounted cdrom ISO)
>>>
>>> What I'm doing wrong?
>>>
>>> (The engine is RHEV-M version 3.4.1-0.31.el6ev)

Re: [ovirt-users] python floppy in RunOnce mode

2014-12-24 Thread Giulio Casella
I can see this behaviour in ovirt 3.5 environment 
(ovirt-engine-3.5.0.1-1.el6) and in rhev 3.4 environment 
(rhevm-3.4.3-1.2.el6ev).


I'm stuck, what I'm doing wrong? :-(




Il 23/12/2014 10:16, Giulio Casella ha scritto:

Yes, the VM is windows 7:

print myvm.get_os().get_type()

shows "windows_7x64"

Anyway I tried to force it, as you suggested, but with no luck...


Il 22/12/2014 17:52, Juan Hernández ha scritto:

On 12/22/2014 01:21 PM, Giulio Casella wrote:

Hi Juan,
I tried to use builtin sysprep files, with no luck.
Here is my code:

myvm = api.vms.get(name="vmname")
initialization = params.Initialization()
myvm.set_initialization(initialization)
myvm.update()
myvm.start(params.Action())

Virtual Machine starts, but there is no mounted floppy.
VM is a freshly installed Windows 7 x86_64, with ovirt guest agent and
no other software.

Any ideas?

Giulio



Is the operating system of the set to one of the Windows variants? If it
isn't set to a Windows variant then the Sysprep logic won't trigger. To
make sure you can update the OS from the script:

myvm = api.vms.get(name="vmname")
initialization = params.Initialization()
myvm.set_initialization(initialization)
myvm.set_os(
   params.OperatingSystem(
 type_="windows_7x64"
   )
)
myvm.update()
myvm.start(params.Action())


Il 24/10/2014 16:08, Giulio Casella ha scritto:

Il 23/10/2014 20:59, Juan Hernandez ha scritto:

On 10/23/2014 09:40 AM, Giulio Casella wrote:

Hi,
I'm trying to boot a vm with non persistent floppy using python ovirt
sdk (the "RunOnce" way in administrator portal), but guest OS
can't see
floppy drive. The ultimate goal is to deploy floppy with sysprep
unattend.xml file for windows 7 pools of vm.

Here is a snippet of code I use:

-
myvm = api.vms.get(name="vmname")
content="This is file content!"
f=params.File(name="foobar.txt",content=content)
fs=params.Files()
fs.add_file(f)
payload=params.Payload()
payload.set_type("floppy")
payload.set_files(fs)
payloads=params.Payloads()
payloads.add_payload(payload)
thevm=params.VM()
thevm.set_payloads(payloads)
action=params.Action(vm=thevm)

myvm.start(action=action)

xml = ParseHelper.toXml(action)
print xml
-

As you can see, for debugging purpose, I print my xml action, and
I get:

-

   
   
   
   
   
   foobar.txt
   This is file content
   
   
   
   
   

-

in the admin portal I can see my vm in "RunOnce" state, but no
floppy is
present...
In fact in the vm process command line
(ps -ef | grep qemu-kvm | grep vmname) I can't see -drive option
referring to floppy (I only see 2 "-drive" options, referring to vm
system disk and to a correctly mounted cdrom ISO)

What I'm doing wrong?

(The engine is RHEV-M version 3.4.1-0.31.el6ev)



The problem is that using non persistent payloads isn't currently
supported, so basically your "payloads" element is silently
ignored. You
have currently two alternatives:

1. Use persistent payloads:

vm = vms.get(name="myvm")
vm.set_payloads(paylaods)
vm.update()
vm.start(params.Action())

You may also want to remove the payloads once the machine is
configured,
but this isn't strictly required, as Windows will not try to locate
the
sysprep floppy in subsequent boots. The only minor inconvenient is
that
the users of the VMs will see the floopy and its content attached.



Yes, this is exactly the workaround I'm currently using, and I have to
hide floppy via AD group policy (sysprep.inf contains administrator
password).


2. Use the builtin sysprep files (they are in
/usr/share/ovirt-engine/conf/sysprep):

vm = vms.get(name="myvm")
initialization = params.Initialization()
vm.set_initialization(initialization)
vm.update()
vm.start(params.Action())

This has the advantage that the sysprep floppy will be attached to the
VM only the first time it is booted. In subsequent boots it won't be
attached.



Great hint, I'll take a look into those syspreps to see if they fit for
my setup.


In 3.5 you will also be able to use sysprep support with your custom
file:

   vm = vms.get(name="myvm")
   initialization = params.Initialization(
 custom_script="The text of your sysprep file"
   )
   vm.set_initialization(initialization)
   vm.update()
   vm.start(params.Action())



Good new, eventually I'll wait for RHEV 3.5


Note that currently (in 3.4 and in 3.5) there is an issue with the
name
of the file generated by the built-in sysprep support: it will
always be
named "sysprep.inf", regardless of the operating system assigned to
the
VM. If you want to use recent versions of Windows it has to be named
"Unattend.xml", so you will need to change the Windows template befo

Re: [ovirt-users] python floppy in RunOnce mode

2014-12-23 Thread Giulio Casella

Yes, the VM is windows 7:

print myvm.get_os().get_type()

shows "windows_7x64"

Anyway I tried to force it, as you suggested, but with no luck...


Il 22/12/2014 17:52, Juan Hernández ha scritto:

On 12/22/2014 01:21 PM, Giulio Casella wrote:

Hi Juan,
I tried to use builtin sysprep files, with no luck.
Here is my code:

myvm = api.vms.get(name="vmname")
initialization = params.Initialization()
myvm.set_initialization(initialization)
myvm.update()
myvm.start(params.Action())

Virtual Machine starts, but there is no mounted floppy.
VM is a freshly installed Windows 7 x86_64, with ovirt guest agent and
no other software.

Any ideas?

Giulio



Is the operating system of the set to one of the Windows variants? If it
isn't set to a Windows variant then the Sysprep logic won't trigger. To
make sure you can update the OS from the script:

myvm = api.vms.get(name="vmname")
initialization = params.Initialization()
myvm.set_initialization(initialization)
myvm.set_os(
   params.OperatingSystem(
 type_="windows_7x64"
   )
)
myvm.update()
myvm.start(params.Action())


Il 24/10/2014 16:08, Giulio Casella ha scritto:

Il 23/10/2014 20:59, Juan Hernandez ha scritto:

On 10/23/2014 09:40 AM, Giulio Casella wrote:

Hi,
I'm trying to boot a vm with non persistent floppy using python ovirt
sdk (the "RunOnce" way in administrator portal), but guest OS can't see
floppy drive. The ultimate goal is to deploy floppy with sysprep
unattend.xml file for windows 7 pools of vm.

Here is a snippet of code I use:

-
myvm = api.vms.get(name="vmname")
content="This is file content!"
f=params.File(name="foobar.txt",content=content)
fs=params.Files()
fs.add_file(f)
payload=params.Payload()
payload.set_type("floppy")
payload.set_files(fs)
payloads=params.Payloads()
payloads.add_payload(payload)
thevm=params.VM()
thevm.set_payloads(payloads)
action=params.Action(vm=thevm)

myvm.start(action=action)

xml = ParseHelper.toXml(action)
print xml
-

As you can see, for debugging purpose, I print my xml action, and I get:

-

   
   
   
   
   
   foobar.txt
   This is file content
   
   
   
   
   

-

in the admin portal I can see my vm in "RunOnce" state, but no floppy is
present...
In fact in the vm process command line
(ps -ef | grep qemu-kvm | grep vmname) I can't see -drive option
referring to floppy (I only see 2 "-drive" options, referring to vm
system disk and to a correctly mounted cdrom ISO)

What I'm doing wrong?

(The engine is RHEV-M version 3.4.1-0.31.el6ev)



The problem is that using non persistent payloads isn't currently
supported, so basically your "payloads" element is silently ignored. You
have currently two alternatives:

1. Use persistent payloads:

vm = vms.get(name="myvm")
vm.set_payloads(paylaods)
vm.update()
vm.start(params.Action())

You may also want to remove the payloads once the machine is configured,
but this isn't strictly required, as Windows will not try to locate the
sysprep floppy in subsequent boots. The only minor inconvenient is that
the users of the VMs will see the floopy and its content attached.



Yes, this is exactly the workaround I'm currently using, and I have to
hide floppy via AD group policy (sysprep.inf contains administrator
password).


2. Use the builtin sysprep files (they are in
/usr/share/ovirt-engine/conf/sysprep):

vm = vms.get(name="myvm")
initialization = params.Initialization()
vm.set_initialization(initialization)
vm.update()
vm.start(params.Action())

This has the advantage that the sysprep floppy will be attached to the
VM only the first time it is booted. In subsequent boots it won't be
attached.



Great hint, I'll take a look into those syspreps to see if they fit for
my setup.


In 3.5 you will also be able to use sysprep support with your custom
file:

   vm = vms.get(name="myvm")
   initialization = params.Initialization(
 custom_script="The text of your sysprep file"
   )
   vm.set_initialization(initialization)
   vm.update()
   vm.start(params.Action())



Good new, eventually I'll wait for RHEV 3.5


Note that currently (in 3.4 and in 3.5) there is an issue with the name
of the file generated by the built-in sysprep support: it will always be
named "sysprep.inf", regardless of the operating system assigned to the
VM. If you want to use recent versions of Windows it has to be named
"Unattend.xml", so you will need to change the Windows template before
sealing it, adding the following registry entry:

HKEY-LOCAL-MACHINE -> SYSTEM -> Setup -> UnattendFile = sysprep.inf

There is a bug open to avoid this:

https://bugzilla.redhat.com/1145999

Note also that the bui

Re: [ovirt-users] python floppy in RunOnce mode

2014-12-22 Thread Juan Hernández
On 12/22/2014 01:21 PM, Giulio Casella wrote:
> Hi Juan,
> I tried to use builtin sysprep files, with no luck.
> Here is my code:
> 
> myvm = api.vms.get(name="vmname")
> initialization = params.Initialization()
> myvm.set_initialization(initialization)
> myvm.update()
> myvm.start(params.Action())
> 
> Virtual Machine starts, but there is no mounted floppy.
> VM is a freshly installed Windows 7 x86_64, with ovirt guest agent and 
> no other software.
> 
> Any ideas?
> 
> Giulio
> 

Is the operating system of the set to one of the Windows variants? If it
isn't set to a Windows variant then the Sysprep logic won't trigger. To
make sure you can update the OS from the script:

myvm = api.vms.get(name="vmname")
initialization = params.Initialization()
myvm.set_initialization(initialization)
myvm.set_os(
  params.OperatingSystem(
type_="windows_7x64"
  )
)
myvm.update()
myvm.start(params.Action())

> Il 24/10/2014 16:08, Giulio Casella ha scritto:
>> Il 23/10/2014 20:59, Juan Hernandez ha scritto:
>>> On 10/23/2014 09:40 AM, Giulio Casella wrote:
 Hi,
 I'm trying to boot a vm with non persistent floppy using python ovirt
 sdk (the "RunOnce" way in administrator portal), but guest OS can't see
 floppy drive. The ultimate goal is to deploy floppy with sysprep
 unattend.xml file for windows 7 pools of vm.

 Here is a snippet of code I use:

 -
 myvm = api.vms.get(name="vmname")
 content="This is file content!"
 f=params.File(name="foobar.txt",content=content)
 fs=params.Files()
 fs.add_file(f)
 payload=params.Payload()
 payload.set_type("floppy")
 payload.set_files(fs)
 payloads=params.Payloads()
 payloads.add_payload(payload)
 thevm=params.VM()
 thevm.set_payloads(payloads)
 action=params.Action(vm=thevm)

 myvm.start(action=action)

 xml = ParseHelper.toXml(action)
 print xml
 -

 As you can see, for debugging purpose, I print my xml action, and I get:

 -
 
   
   
   
   
   
   foobar.txt
   This is file content
   
   
   
   
   
 
 -

 in the admin portal I can see my vm in "RunOnce" state, but no floppy is
 present...
 In fact in the vm process command line
 (ps -ef | grep qemu-kvm | grep vmname) I can't see -drive option
 referring to floppy (I only see 2 "-drive" options, referring to vm
 system disk and to a correctly mounted cdrom ISO)

 What I'm doing wrong?

 (The engine is RHEV-M version 3.4.1-0.31.el6ev)

>>>
>>> The problem is that using non persistent payloads isn't currently
>>> supported, so basically your "payloads" element is silently ignored. You
>>> have currently two alternatives:
>>>
>>> 1. Use persistent payloads:
>>>
>>>vm = vms.get(name="myvm")
>>>vm.set_payloads(paylaods)
>>>vm.update()
>>>vm.start(params.Action())
>>>
>>> You may also want to remove the payloads once the machine is configured,
>>> but this isn't strictly required, as Windows will not try to locate the
>>> sysprep floppy in subsequent boots. The only minor inconvenient is that
>>> the users of the VMs will see the floopy and its content attached.
>>>
>>
>> Yes, this is exactly the workaround I'm currently using, and I have to
>> hide floppy via AD group policy (sysprep.inf contains administrator
>> password).
>>
>>> 2. Use the builtin sysprep files (they are in
>>> /usr/share/ovirt-engine/conf/sysprep):
>>>
>>>vm = vms.get(name="myvm")
>>>initialization = params.Initialization()
>>>vm.set_initialization(initialization)
>>>vm.update()
>>>vm.start(params.Action())
>>>
>>> This has the advantage that the sysprep floppy will be attached to the
>>> VM only the first time it is booted. In subsequent boots it won't be
>>> attached.
>>>
>>
>> Great hint, I'll take a look into those syspreps to see if they fit for
>> my setup.
>>
>>> In 3.5 you will also be able to use sysprep support with your custom
>>> file:
>>>
>>>   vm = vms.get(name="myvm")
>>>   initialization = params.Initialization(
>>> custom_script="The text of your sysprep file"
>>>   )
>>>   vm.set_initialization(initialization)
>>>   vm.update()
>>>   vm.start(params.Action())
>>>
>>
>> Good new, eventually I'll wait for RHEV 3.5
>>
>>> Note that currently (in 3.4 and in 3.5) there is an issue with the name
>>> of the file generated by the built-in sysprep support: it will always be
>>> named "sysprep.inf", regardless of the operating system assigned to the
>>> VM. If you want to use recent versions of Windows it has to be named
>>> "

Re: [ovirt-users] python floppy in RunOnce mode

2014-12-22 Thread Giulio Casella

Hi Juan,
I tried to use builtin sysprep files, with no luck.
Here is my code:

myvm = api.vms.get(name="vmname")
initialization = params.Initialization()
myvm.set_initialization(initialization)
myvm.update()
myvm.start(params.Action())

Virtual Machine starts, but there is no mounted floppy.
VM is a freshly installed Windows 7 x86_64, with ovirt guest agent and 
no other software.


Any ideas?

Giulio

Il 24/10/2014 16:08, Giulio Casella ha scritto:

Il 23/10/2014 20:59, Juan Hernandez ha scritto:

On 10/23/2014 09:40 AM, Giulio Casella wrote:

Hi,
I'm trying to boot a vm with non persistent floppy using python ovirt
sdk (the "RunOnce" way in administrator portal), but guest OS can't see
floppy drive. The ultimate goal is to deploy floppy with sysprep
unattend.xml file for windows 7 pools of vm.

Here is a snippet of code I use:

-
myvm = api.vms.get(name="vmname")
content="This is file content!"
f=params.File(name="foobar.txt",content=content)
fs=params.Files()
fs.add_file(f)
payload=params.Payload()
payload.set_type("floppy")
payload.set_files(fs)
payloads=params.Payloads()
payloads.add_payload(payload)
thevm=params.VM()
thevm.set_payloads(payloads)
action=params.Action(vm=thevm)

myvm.start(action=action)

xml = ParseHelper.toXml(action)
print xml
-

As you can see, for debugging purpose, I print my xml action, and I get:

-

  
  
  
  
  
  foobar.txt
  This is file content
  
  
  
  
  

-

in the admin portal I can see my vm in "RunOnce" state, but no floppy is
present...
In fact in the vm process command line
(ps -ef | grep qemu-kvm | grep vmname) I can't see -drive option
referring to floppy (I only see 2 "-drive" options, referring to vm
system disk and to a correctly mounted cdrom ISO)

What I'm doing wrong?

(The engine is RHEV-M version 3.4.1-0.31.el6ev)



The problem is that using non persistent payloads isn't currently
supported, so basically your "payloads" element is silently ignored. You
have currently two alternatives:

1. Use persistent payloads:

   vm = vms.get(name="myvm")
   vm.set_payloads(paylaods)
   vm.update()
   vm.start(params.Action())

You may also want to remove the payloads once the machine is configured,
but this isn't strictly required, as Windows will not try to locate the
sysprep floppy in subsequent boots. The only minor inconvenient is that
the users of the VMs will see the floopy and its content attached.



Yes, this is exactly the workaround I'm currently using, and I have to
hide floppy via AD group policy (sysprep.inf contains administrator
password).


2. Use the builtin sysprep files (they are in
/usr/share/ovirt-engine/conf/sysprep):

   vm = vms.get(name="myvm")
   initialization = params.Initialization()
   vm.set_initialization(initialization)
   vm.update()
   vm.start(params.Action())

This has the advantage that the sysprep floppy will be attached to the
VM only the first time it is booted. In subsequent boots it won't be
attached.



Great hint, I'll take a look into those syspreps to see if they fit for
my setup.


In 3.5 you will also be able to use sysprep support with your custom
file:

  vm = vms.get(name="myvm")
  initialization = params.Initialization(
custom_script="The text of your sysprep file"
  )
  vm.set_initialization(initialization)
  vm.update()
  vm.start(params.Action())



Good new, eventually I'll wait for RHEV 3.5


Note that currently (in 3.4 and in 3.5) there is an issue with the name
of the file generated by the built-in sysprep support: it will always be
named "sysprep.inf", regardless of the operating system assigned to the
VM. If you want to use recent versions of Windows it has to be named
"Unattend.xml", so you will need to change the Windows template before
sealing it, adding the following registry entry:

   HKEY-LOCAL-MACHINE -> SYSTEM -> Setup -> UnattendFile = sysprep.inf

There is a bug open to avoid this:

   https://bugzilla.redhat.com/1145999

Note also that the builtin sysprep support will only trigger if the VM
has been assigned a Windows operating system.



Yes, I knew. Do you know if is there a plan to change this behaviour
(e.g. generate filename according to guest O.S. standard)?

Many thanks,
Giulio

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


--
Giulio Casellagiulio at di.unimi.it
System and network manager
Computer Science Dept. - University of Milano
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] python floppy in RunOnce mode

2014-10-27 Thread Juan Hernandez
On 10/24/2014 04:08 PM, Giulio Casella wrote:
> Il 23/10/2014 20:59, Juan Hernandez ha scritto:
>> On 10/23/2014 09:40 AM, Giulio Casella wrote:
>>> Hi,
>>> I'm trying to boot a vm with non persistent floppy using python ovirt
>>> sdk (the "RunOnce" way in administrator portal), but guest OS can't see
>>> floppy drive. The ultimate goal is to deploy floppy with sysprep
>>> unattend.xml file for windows 7 pools of vm.
>>>
>>> Here is a snippet of code I use:
>>>
>>> -
>>> myvm = api.vms.get(name="vmname")
>>> content="This is file content!"
>>> f=params.File(name="foobar.txt",content=content)
>>> fs=params.Files()
>>> fs.add_file(f)
>>> payload=params.Payload()
>>> payload.set_type("floppy")
>>> payload.set_files(fs)
>>> payloads=params.Payloads()
>>> payloads.add_payload(payload)
>>> thevm=params.VM()
>>> thevm.set_payloads(payloads)
>>> action=params.Action(vm=thevm)
>>>
>>> myvm.start(action=action)
>>>
>>> xml = ParseHelper.toXml(action)
>>> print xml
>>> -
>>>
>>> As you can see, for debugging purpose, I print my xml action, and I get:
>>>
>>> -
>>> 
>>>   
>>>   
>>>   
>>>   
>>>   
>>>   foobar.txt
>>>   This is file content
>>>   
>>>   
>>>   
>>>   
>>>   
>>> 
>>> -
>>>
>>> in the admin portal I can see my vm in "RunOnce" state, but no floppy is
>>> present...
>>> In fact in the vm process command line
>>> (ps -ef | grep qemu-kvm | grep vmname) I can't see -drive option
>>> referring to floppy (I only see 2 "-drive" options, referring to vm
>>> system disk and to a correctly mounted cdrom ISO)
>>>
>>> What I'm doing wrong?
>>>
>>> (The engine is RHEV-M version 3.4.1-0.31.el6ev)
>>>
>>
>> The problem is that using non persistent payloads isn't currently
>> supported, so basically your "payloads" element is silently ignored. You
>> have currently two alternatives:
>>
>> 1. Use persistent payloads:
>>
>>vm = vms.get(name="myvm")
>>vm.set_payloads(paylaods)
>>vm.update()
>>vm.start(params.Action())
>>
>> You may also want to remove the payloads once the machine is configured,
>> but this isn't strictly required, as Windows will not try to locate the
>> sysprep floppy in subsequent boots. The only minor inconvenient is that
>> the users of the VMs will see the floopy and its content attached.
>>
> 
> Yes, this is exactly the workaround I'm currently using, and I have to 
> hide floppy via AD group policy (sysprep.inf contains administrator 
> password).
> 
>> 2. Use the builtin sysprep files (they are in
>> /usr/share/ovirt-engine/conf/sysprep):
>>
>>vm = vms.get(name="myvm")
>>initialization = params.Initialization()
>>vm.set_initialization(initialization)
>>vm.update()
>>vm.start(params.Action())
>>
>> This has the advantage that the sysprep floppy will be attached to the
>> VM only the first time it is booted. In subsequent boots it won't be
>> attached.
>>
> 
> Great hint, I'll take a look into those syspreps to see if they fit for 
> my setup.
> 
>> In 3.5 you will also be able to use sysprep support with your custom file:
>>
>>   vm = vms.get(name="myvm")
>>   initialization = params.Initialization(
>> custom_script="The text of your sysprep file"
>>   )
>>   vm.set_initialization(initialization)
>>   vm.update()
>>   vm.start(params.Action())
>>
> 
> Good new, eventually I'll wait for RHEV 3.5
> 
>> Note that currently (in 3.4 and in 3.5) there is an issue with the name
>> of the file generated by the built-in sysprep support: it will always be
>> named "sysprep.inf", regardless of the operating system assigned to the
>> VM. If you want to use recent versions of Windows it has to be named
>> "Unattend.xml", so you will need to change the Windows template before
>> sealing it, adding the following registry entry:
>>
>>HKEY-LOCAL-MACHINE -> SYSTEM -> Setup -> UnattendFile = sysprep.inf
>>
>> There is a bug open to avoid this:
>>
>>https://bugzilla.redhat.com/1145999
>>
>> Note also that the builtin sysprep support will only trigger if the VM
>> has been assigned a Windows operating system.
>>
> 
> Yes, I knew. Do you know if is there a plan to change this behaviour 
> (e.g. generate filename according to guest O.S. standard)?
> 

Bug 1145999 has target release 3.6. That means that the team responsible
for fixing has studied it and decided to fix it for version 3.6. Note
that this is just a plan, things may change depending on the workload
and urgency of other bugs. I'd suggest that you comment on the bug that
you are interested on this fix, so that it gets a bit more priority.

-- 
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. 

Re: [ovirt-users] python floppy in RunOnce mode

2014-10-24 Thread Giulio Casella

Il 23/10/2014 20:59, Juan Hernandez ha scritto:

On 10/23/2014 09:40 AM, Giulio Casella wrote:

Hi,
I'm trying to boot a vm with non persistent floppy using python ovirt
sdk (the "RunOnce" way in administrator portal), but guest OS can't see
floppy drive. The ultimate goal is to deploy floppy with sysprep
unattend.xml file for windows 7 pools of vm.

Here is a snippet of code I use:

-
myvm = api.vms.get(name="vmname")
content="This is file content!"
f=params.File(name="foobar.txt",content=content)
fs=params.Files()
fs.add_file(f)
payload=params.Payload()
payload.set_type("floppy")
payload.set_files(fs)
payloads=params.Payloads()
payloads.add_payload(payload)
thevm=params.VM()
thevm.set_payloads(payloads)
action=params.Action(vm=thevm)

myvm.start(action=action)

xml = ParseHelper.toXml(action)
print xml
-

As you can see, for debugging purpose, I print my xml action, and I get:

-

  
  
  
  
  
  foobar.txt
  This is file content
  
  
  
  
  

-

in the admin portal I can see my vm in "RunOnce" state, but no floppy is
present...
In fact in the vm process command line
(ps -ef | grep qemu-kvm | grep vmname) I can't see -drive option
referring to floppy (I only see 2 "-drive" options, referring to vm
system disk and to a correctly mounted cdrom ISO)

What I'm doing wrong?

(The engine is RHEV-M version 3.4.1-0.31.el6ev)



The problem is that using non persistent payloads isn't currently
supported, so basically your "payloads" element is silently ignored. You
have currently two alternatives:

1. Use persistent payloads:

   vm = vms.get(name="myvm")
   vm.set_payloads(paylaods)
   vm.update()
   vm.start(params.Action())

You may also want to remove the payloads once the machine is configured,
but this isn't strictly required, as Windows will not try to locate the
sysprep floppy in subsequent boots. The only minor inconvenient is that
the users of the VMs will see the floopy and its content attached.



Yes, this is exactly the workaround I'm currently using, and I have to 
hide floppy via AD group policy (sysprep.inf contains administrator 
password).



2. Use the builtin sysprep files (they are in
/usr/share/ovirt-engine/conf/sysprep):

   vm = vms.get(name="myvm")
   initialization = params.Initialization()
   vm.set_initialization(initialization)
   vm.update()
   vm.start(params.Action())

This has the advantage that the sysprep floppy will be attached to the
VM only the first time it is booted. In subsequent boots it won't be
attached.



Great hint, I'll take a look into those syspreps to see if they fit for 
my setup.



In 3.5 you will also be able to use sysprep support with your custom file:

  vm = vms.get(name="myvm")
  initialization = params.Initialization(
custom_script="The text of your sysprep file"
  )
  vm.set_initialization(initialization)
  vm.update()
  vm.start(params.Action())



Good new, eventually I'll wait for RHEV 3.5


Note that currently (in 3.4 and in 3.5) there is an issue with the name
of the file generated by the built-in sysprep support: it will always be
named "sysprep.inf", regardless of the operating system assigned to the
VM. If you want to use recent versions of Windows it has to be named
"Unattend.xml", so you will need to change the Windows template before
sealing it, adding the following registry entry:

   HKEY-LOCAL-MACHINE -> SYSTEM -> Setup -> UnattendFile = sysprep.inf

There is a bug open to avoid this:

   https://bugzilla.redhat.com/1145999

Note also that the builtin sysprep support will only trigger if the VM
has been assigned a Windows operating system.



Yes, I knew. Do you know if is there a plan to change this behaviour 
(e.g. generate filename according to guest O.S. standard)?


Many thanks,
Giulio

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


Re: [ovirt-users] python floppy in RunOnce mode

2014-10-23 Thread Juan Hernandez
On 10/23/2014 09:40 AM, Giulio Casella wrote:
> Hi,
> I'm trying to boot a vm with non persistent floppy using python ovirt 
> sdk (the "RunOnce" way in administrator portal), but guest OS can't see 
> floppy drive. The ultimate goal is to deploy floppy with sysprep 
> unattend.xml file for windows 7 pools of vm.
> 
> Here is a snippet of code I use:
> 
> -
> myvm = api.vms.get(name="vmname")
> content="This is file content!"
> f=params.File(name="foobar.txt",content=content)
> fs=params.Files()
> fs.add_file(f)
> payload=params.Payload()
> payload.set_type("floppy")
> payload.set_files(fs)
> payloads=params.Payloads()
> payloads.add_payload(payload)
> thevm=params.VM()
> thevm.set_payloads(payloads)
> action=params.Action(vm=thevm)
> 
> myvm.start(action=action)
> 
> xml = ParseHelper.toXml(action)
> print xml
> -
> 
> As you can see, for debugging purpose, I print my xml action, and I get:
> 
> -
> 
>  
>  
>  
>  
>  
>  foobar.txt
>  This is file content
>  
>  
>  
>  
>  
> 
> -
> 
> in the admin portal I can see my vm in "RunOnce" state, but no floppy is 
> present...
> In fact in the vm process command line
> (ps -ef | grep qemu-kvm | grep vmname) I can't see -drive option 
> referring to floppy (I only see 2 "-drive" options, referring to vm 
> system disk and to a correctly mounted cdrom ISO)
> 
> What I'm doing wrong?
> 
> (The engine is RHEV-M version 3.4.1-0.31.el6ev)
> 

The problem is that using non persistent payloads isn't currently
supported, so basically your "payloads" element is silently ignored. You
have currently two alternatives:

1. Use persistent payloads:

  vm = vms.get(name="myvm")
  vm.set_payloads(paylaods)
  vm.update()
  vm.start(params.Action())

You may also want to remove the payloads once the machine is configured,
but this isn't strictly required, as Windows will not try to locate the
sysprep floppy in subsequent boots. The only minor inconvenient is that
the users of the VMs will see the floopy and its content attached.

2. Use the builtin sysprep files (they are in
/usr/share/ovirt-engine/conf/sysprep):

  vm = vms.get(name="myvm")
  initialization = params.Initialization()
  vm.set_initialization(initialization)
  vm.update()
  vm.start(params.Action())

This has the advantage that the sysprep floppy will be attached to the
VM only the first time it is booted. In subsequent boots it won't be
attached.

In 3.5 you will also be able to use sysprep support with your custom file:

 vm = vms.get(name="myvm")
 initialization = params.Initialization(
   custom_script="The text of your sysprep file"
 )
 vm.set_initialization(initialization)
 vm.update()
 vm.start(params.Action())

Note that currently (in 3.4 and in 3.5) there is an issue with the name
of the file generated by the built-in sysprep support: it will always be
named "sysprep.inf", regardless of the operating system assigned to the
VM. If you want to use recent versions of Windows it has to be named
"Unattend.xml", so you will need to change the Windows template before
sealing it, adding the following registry entry:

  HKEY-LOCAL-MACHINE -> SYSTEM -> Setup -> UnattendFile = sysprep.inf

There is a bug open to avoid this:

  https://bugzilla.redhat.com/1145999

Note also that the builtin sysprep support will only trigger if the VM
has been assigned a Windows operating system.

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


[ovirt-users] python floppy in RunOnce mode

2014-10-23 Thread Giulio Casella

Hi,
I'm trying to boot a vm with non persistent floppy using python ovirt 
sdk (the "RunOnce" way in administrator portal), but guest OS can't see 
floppy drive. The ultimate goal is to deploy floppy with sysprep 
unattend.xml file for windows 7 pools of vm.


Here is a snippet of code I use:

-
myvm = api.vms.get(name="vmname")
content="This is file content!"
f=params.File(name="foobar.txt",content=content)
fs=params.Files()
fs.add_file(f)
payload=params.Payload()
payload.set_type("floppy")
payload.set_files(fs)
payloads=params.Payloads()
payloads.add_payload(payload)
thevm=params.VM()
thevm.set_payloads(payloads)
action=params.Action(vm=thevm)

myvm.start(action=action)

xml = ParseHelper.toXml(action)
print xml
-

As you can see, for debugging purpose, I print my xml action, and I get:

-






foobar.txt
This is file content






-

in the admin portal I can see my vm in "RunOnce" state, but no floppy is 
present...

In fact in the vm process command line
(ps -ef | grep qemu-kvm | grep vmname) I can't see -drive option 
referring to floppy (I only see 2 "-drive" options, referring to vm 
system disk and to a correctly mounted cdrom ISO)


What I'm doing wrong?

(The engine is RHEV-M version 3.4.1-0.31.el6ev)

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