[libvirt-users] remove cdrom after installing os on a guest

Markos Gogoulos mgogoulos at mist.io
Fri Jan 8 13:30:55 UTC 2016


Hi Andrei,

on mist.io we use a configuration like this:


<domain type='%s'>
  <name>%s</name>
  <memory>%s</memory>
  <vcpu>%s</vcpu>
  <os>
   <type arch='x86_64'>hvm</type>
    <boot dev='hd'/>
    <boot dev='cdrom'/>
  </os>
 <features>

...


basically instruct the hd as the first device to boot, so when hd is empty
the cdrom will boot and after an OS is installed it will boot from hd.

Hope this helps


On Fri, Jan 8, 2016 at 3:10 PM, Andrei Perietanu <
andrei.perietanu at klastelecom.com> wrote:

> Hi all,
> I have the following issue, and I hope someone know a way to handle it.
>
> I need to grammatically  need to create/install a guest OS using the
> libvirt API.
> Currently what I do:
>  1. create a xml with the vm configuration (this will include a path to
> the iso image)
>  2. connection.defineXML(<my_config>)
>  3. vm = connection.lookupByName(<domain_name>)
>  4. vm.create()
>
> This will create a new guest and boot the iso to install the OS. But after
> installation, when I restart, It again boots from the cdrom. So obviously I
> need remove the cdrom somehow.
>
> I could edit the xml and manually remove the cdrom, but the problem here
> is how do I know when to do that - i.e. how do I know if the OS has been
> installed or not?
>
> If I use virsh-install to create a guest with the same configuration,
> after the OS is installed, the cdrom is automatically removed form the
> guest configuration.
>
>
> Any help is greatly appreciated.
>
> Andrei
>
> The information transmitted is intended only for the person or entity to
> which it is addressed and may contain confidential and/or privileged
> material. Any review, retransmission, dissemination or other use of or
> taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. If you receive
> this in error please contact the sender and delete the material from any
> computer immediately. It is the policy of Klas  Limited to disavow the
> sending of offensive material and should you consider that the material
> contained in the message is offensive you should contact the sender
> immediately and also your I.T. Manager.
>
> Klas Telecom Inc., a Virginia Corporation with offices at 1101 30th St.
> NW, Washington, DC 20007.
>
> Klas Limited (Company Number 163303) trading as Klas Telecom, an Irish
> Limited Liability Company, with its registered office at Fourth Floor, One
> Kilmainham Square, Inchicore Road, Kilmainham, Dublin 8, Ireland.
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20160108/1dabdb72/attachment.htm>


More information about the libvirt-users mailing list