[Users] Linux sysprep

René Koch (ovido) r.koch at ovido.at
Thu Aug 22 14:19:03 UTC 2013


On Thu, 2013-08-22 at 09:55 +0200, René Koch (ovido) wrote:
> On Wed, 2013-08-21 at 19:49 -0400, Greg Padgett wrote:
> > On 08/21/2013 07:25 AM, René Koch (ovido) wrote:
> > [snip]
> > > I'm just playing around with the payload feature but I can't access the
> > > cd/floppy in my vm.
> > > I adapted Yuriy's script
> > > (http://lists.ovirt.org/pipermail/users/2013-June/014907.html - which is
> > > working fine btw) to create payload xml content and write it with
> > > hooking.write_domxml(domxml).
> > >
> > > In vdsm.log I can see that my python script exits with status code 0 and
> > > that the content seems to be added to the vm definition:
> > >
> > > Thread-130844::DEBUG::2013-08-21
> > > 12:43:52,669::libvirtvm::1520::vm.Vm::(_run)
> > > vmId=`79dc3123-4584-4dd9-b0f0-c28ede13d672`::<?xml version="1.0"
> > > encoding="utf-8"?><domain type="kvm">
> > > 	<name>centos6</name>
> > > ....snip....
> > > 	</cpu>
> > > <payloads><payload type="cdrom"><file
> > > name="unattended.txt"><content>hostname:
> > > centos6</content></file></payload></payloads></domain>
> > >
> > >
> > > But in my vm I can't mount the cd drive:
> > > # mount /dev/sr0 /media
> > > mount: you must specify the filesystem type
> > >
> > > Is there a special filesystem I have to specify?
> > >
> > > Furthermore shouldn't I be able to see the payloads content added to
> > > this vm via REST-API? Because I can't.
> > >
> > > Maybe I'm doing some wrong?
> > >
> > >
> > > Thanks,
> > > René
> > 
> > That's a neat script.  I haven't used it--instead I just send xml to the 
> > rest api, something like this, which looks a lot like yours:
> > 
> > <vm id="6aec2d40-e36f-4b02-ab75-933d93f4cb8b" 
> > href="/api/vms/6aec2d40-e36f-4b02-ab75-933d93f4cb8b">
> >    <payloads>
> >      <payload type="cdrom">
> >        <file name="meta-data.txt"><content>some content</content>   </file>
> >      </payload>
> >    </payloads>
> > </vm>
> > 
> > To attach the payload via the rest api, note that you'd need to send a put 
> > request to /api/vms/<uuid> rather than pass the xml in the run/start 
> > action, because that's not yet supported.  Doing this, inside my vm I see:
> > 
> >    [root at cloud-init-test ~]# blkid
> >    /dev/sr1: UUID="2013-08-21-19-39-40-00" LABEL="CDROM" TYPE="iso9660"
> 


Hm, for some strange reason I can PUT the payloads XML to a specific vm
without any errors using REST-API, but it seems to never really update
the vm definition (when testing with GET payloads is missing again and
no cd in my vm). PUT for e.g. usb definitions is working fine (system is
oVirt 3.2).

Anyway, I don't have enough time at the moment to investigate this
further, so I use Yuriy's script (thanks!) and add the hostname via SKU
number. But will maybe play with vm payloads later again.

If anyone is interested in the scripts, feel free to use them:
https://github.com/ovido/ovirt-stuff/tree/master/sysprep_linux
(please note that these will only work for RHEL/CentOS/Fedora/other
clones)


Regards,
René



> 
> 
> > 
> > And I can mount it without any problems.  You can also check the qemu 
> > process listing on the host--for instance, mine shows:
> > 
> > /usr/bin/qemu-system-x86_64 [...] -drive 
> > file=/var/run/vdsm/payload/29e331f9-42df-46e1-aad1-88101b134606.fe53caf3339d55b2b37a893e19e9f10a.img
> > 
> > While the vm is running, you can check that file with `file` (should 
> > report ISO 9660), mount it on the host, etc.
> > 
> > HTH,
> > Greg
> > 
> 
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users




More information about the Users mailing list