On Fri, Jan 08, 2016 at 01:10:03PM +0000, Andrei Perietanu 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>)
1. you can do vm = connection.defineXML(<my_config>)
but that's just a detail
4. vm.create()
2. You can set:
<on_reboot>destroy</on_reboot>
That will destroy your guest after it reboots. Then you can start it
with new configuration. Don't forget to change the on_reboot in the new
config.
3. You can do defineXML() without that cdrom and then do createXML()
with the temporary config (with cdrom). Then after the guest is
destroyed, you can just start it and it will automatically use the
configuration without cdrom.
This won't fix your problem, it's just another way to use multiple
configs, it will work even if something goes wrong around that reboot.
4. You can subscribe to the restart event and upon that event being
fired, you just eject media from the cdrom.
5. You can set <boot order='x'/> for the disk and the cdrom, with the
disk having x = 1 and the cdrom having x = 2 (or the older way with
<boot dev='hd'/><boot dev='cdrom'/> ) that way it will boot
from
the hd if it is bootable and fallback to the cdrom when it is not.
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(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-users