[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] How to start a hvm with xen-api???


  • To: xen-api@xxxxxxxxxxxxxxxxxxx
  • From: André Bödecker <andre.boedecker@xxxxxx>
  • Date: Fri, 12 Oct 2007 11:32:30 +0200
  • Delivery-date: Fri, 12 Oct 2007 02:33:09 -0700
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>

Hi,

I'm trying to start a hvm with xen-api (xmlrpc) with a PHP script.
We are using Xen 3.1. To connect to the api I use the Zend Framework.

We are getting this error:
Had a bootloader specified, but no disks are bootable

This is my Sourcecode:

<?php
include_once('/home/ZendFramework/library/Zend/XmlRpc/Client.php');
echo "<pre>";
    $oClient = new Zend_XmlRpc_Client("https://xenent01.olb.de:9363/";);
$aSession_id = $oClient->call('session.login_with_password',array("user","pass"));
  $sSession_id = $aSession_id['Value'];

  $aVM_cfg = array(
      "name_label"=> "windows20",
      "user_version"=> 1,
      "is_a_template"=> false,
      "auto_power_on"=> false,
            "memory_static_min" => 512 * 1024 * 1024,
      "memory_static_max" => 512 * 1024 * 1024,
      "memory_dynamic_min" => 512 * 1024 * 1024,
      "memory_dynamic_max" => 512 * 1024 * 1024,
            "VCPUs_policy" => "credit",
      "VCPUs_params" => array(),
      "VCPUs_number" => 1,
            "actions_after_shutdown" => "destroy",
      "actions_after_reboot" => "restart",
      "actions_after_crash" => "restart",
            'PV_bootloader' => 'PV_bootloader',
      'PV_bootloader_args' => '',
            'PV_kernel' => '/usr/lib/xen/boot/hvmloader',
      'PV_ramdisk' => '',
      'PV_args' => '',
            "HVM_boot" => "hda",
      "platform_std_VGA" => false,
      "platform_serial" => "",
      "platform_localtime" => false,
      "platform_clock_offset" => false,
      "platform_enable_audio" => false,
      "PCI_bus"=> ""
  );

  $aVDI_cfg = array(
      "name_label" => "debian.vm",
      "name_description" => "",
      "virtual_size" => 4 * 1024 * 1024 * 1024,
      "type" => "system",
      "parent" => "",
      "SR_name" => "Local",
      "sharable" => False,
      "read_only" => False,
"other_config" => array("location" => "file:/xen/doms/windows/windows.img"),
  );       $aVBD_cfg = array(
      "VDI" => "",
      "VM" => "",
      "device" => "hda",
      "mode" => "RW",
      "type" => "disk",
      "driver" => "ioemu",
  );
      $aVIF_cfg = array(
      "name" => "debian_VIF",
      "type" => "paravirtualised",
      "device" => "",
      "network" => "",
      "MAC" => "",
      "MTU" => 1500,
  );
    $aConsole_cfg = array(
      "protocol" => "rfb",
      "other_config" => array("vncunused" => 1,"vncpasswd" => "backofen"),
  );
    # Get default SR
$aSR_id = $oClient->call('SR.get_by_name_label',array($sSession_id, $aVDI_cfg['SR_name']));
  print_r($aSR_id);
  $sSR_id = $aSR_id['Value'][0];
    # Get default network
  $aNet_id = $oClient->call('network.get_all',array($sSession_id,));
  print_r($aNet_id);
  $sNet_id = $aNet_id['Value'][0];
    # Create a new VM
  $aVM_id = $oClient->call('VM.create',array($sSession_id, $aVM_cfg));
  print_r($aVM_id);
  $sVM_id = $aVM_id['Value'];
  echo "$sVM_id <br>";
    # Create a new VDI
  $aVDI_cfg['SR'] = $sSR_id;
  $aVDI_id = $oClient->call('VDI.create',array($sSession_id, $aVDI_cfg));
  print_r($aVDI_id);
  $sVDI_id = $aVDI_id['Value'];
   echo "$sVDI_id <br>";
    # Create a new VBD
  $aVBD_cfg['VM'] = $sVM_id;
  $aVBD_cfg['VDI'] = $sVDI_id;
  $aVBD_id = $oClient->call('VBD.create',array($sSession_id, $aVBD_cfg));
  print_r($aVBD_id);
  $sVBD_id = $aVBD_id['Value'];
  echo "$sVBD_id <br>";
  /*
  # Create a new VIF
  $aVIF_cfg['VM'] = $sVM_id;
  $aVIF_cfg['network'] = $sNet_id;
  $aVIF_id = $oClient->call('VIF.create',array($sSession_id, $aVIF_cfg));
  print_r($aVIF_id);
  $sVIF_id = $aVIF_id['Value'];
  echo "$sVIF_id <br>";
  */
  # Create a new Console
  $aConsole_cfg['VM'] = $sVM_id;
$aConsole_id = $oClient->call('console.create',array($sSession_id, $aConsole_cfg));
  print_r($aConsole_id);
  $sConsole_id = $aConsole_id['Value'];
  echo "$sConsole_id <br>";
    # Start the VM
  print_r($oClient->call('VM.start',array($sSession_id,$sVM_id,false)));
 echo "</pre>";
?>


What is wrong? Can anybody help me?

André

--
Oldenburgische Landesbank AG

Vorsitzender des Aufsichtsrates: Dr. Andreas Georgi
Vorstand:  Dr. Jörg Bleckmann, Sprecher
         Dr. Stefan Friedmann
         Dr. Peter Schinzing
         Bernd Span
Sitz der Gesellschaft: Oldenburg (Oldb)
Registergericht: Oldenburg (Oldb)
HR-Nummer: HRB 3003


--
Oldenburgische Landesbank AG

Vorsitzender des Aufsichtsrates: Dr. Andreas Georgi
Vorstand:  Dr. Jörg Bleckmann, Sprecher
          Dr. Stefan Friedmann
          Dr. Peter Schinzing
          Bernd Span
Sitz der Gesellschaft: Oldenburg (Oldb)
Registergericht: Oldenburg (Oldb)
HR-Nummer: HRB 3003



_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.