New Feature: Dynamic guest creation & destruction Date: Fri, 3 Feb 2012 11:03:27 +0530  |  Posted by: Anup Patel

I am very happy inform you all that dynamic or runtime guest creation & destruction is now supported by Xvisor. This feature is very very (extremely) important for data centre and server virtualization. Also, implementing Guest Migration or Virtual Motion (VMotion) depends on ability to create or destroy guest dynamically.

Dynamic Guest Creation:
For creating guest dynamically we have to do following logical steps from management terminal:

  1. Create a sub-tree with root node <new_guest_name> under /guest device tree path for the new guest. To do this step you can use "devtree" command to create the sub-tree from scratch or you can copy the sub-tree of an existing guest and modify it to get the sub-tree of new guest.
  2. Load images for the new guest. To do this we can load RAM (where flash of new guest is mapped) from flash of existing guest or from a file in a block device just like Uboot (to be supported in future).
  3. Create the guest instance using "guest create <new_guest_name>" command. This step will try to look for a sub-tree named <new_guest_name> under /guests device tree path. All the required resources will be allocated accordingly and emulators will be also probed.

Example:

  1. Start Xvisor on QEMU with some additional memory
    # qemu-system-arm -M realview-pb-a8 -display none -serial stdio -kernel xvisor_1guest_linux-3.0.4_qemu.img -m 256M
  2. Create sub-tree unde /guests for the new guest named guest1
    # devtree node copy /guests guest1 /guests/guest0
    # devtree attr set /guests/guest1/aspace/mem1 host_physical_addr physaddr 0x78000000
    # devtree attr set /guests/guest1/aspace/nor_flash host_physical_addr physaddr 0x71000000
  3. Load NOR flash of guest1 by copying contents for NOR flash of guest0
    # memory copy 0x71000000 0x70800000 0x800000
  4. Create the new guest guest1
    # guest create guest1
  5. Start the new guest guest1 and connect to its virtual serial port
    # guest kick 1; vserial bind guest1/uart0
(Note: Instead of Step 2. you can also manually create a guest device tree)
(Note: Instead of Step 3. you can also load NOR flash with files from a block device, but this will be added later)

Dynamic Guest Destruction (or Deletion):
For destroying a guest dynamically it very very simple. We just have to fire a command "guest destroy <guest_id>". This command will destroy the guest with target <guest_id> even if the guest is running.

Example:

  1. Start Xvisor on QEMU with some additional memory
    # qemu-system-arm -M realview-pb-a8 -display none -serial stdio -kernel xvisor_1guest_linux-3.0.4_qemu.img -m 256M
  2. Start guest0
    # guest kick 0
  3. Destroy guest0
    # guest destroy 0