WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] Start a hvm with PHP using xen-api

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] Start a hvm with PHP using xen-api
From: André Bödecker <andre.boedecker@xxxxxx>
Date: Wed, 31 Oct 2007 10:12:25 +0100
Delivery-date: Wed, 31 Oct 2007 02:13:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Organization: Oldenburgische Landesbank AG
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.10 (Windows/20070221)
Hi,

I'm still trying to start a hvm with a PHP script using the xen-api.

When i fill the pv_kernel i get this error (the path to the Kernel is the right one): (2, 'Invalid kernel', "elf_xen_note_check: ERROR: Not a Xen-ELF image: No ELF notes or '__xen_guest' section found.\n")

When pv_kernel is empty i get this error:
Disk isn't accessible

Can anybody help me?


This is my PHP script:

<?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("xxx","xxx"));
   $sSession_id = $aSession_id['Value'];

   $aVM_cfg = array(
       "name_label"=> "windows01",
       "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" => "",
       "VCPUs_number" => 1,
"actions_after_shutdown" => "destroy",
       "actions_after_reboot" => "restart",
       "actions_after_crash" => "restart",
'PV_bootloader' => '',
       'PV_bootloader_args' => '',
'PV_kernel' => '/usr/lib/xen/boot/hvmloader',
       'PV_args' => '',
       'PV_ramdisk' => '',
"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" => "windows.vm",
       "name_description" => "",
       "uri" => "file:/xenlocal/xen/doms/windows/windows.img",
       "virtual_size" => 0,
       "sector_size" => 0,
       "type" => "system",
       "parent" => "",
       "SR_name" => "Local",
       "sharable" => False,
       "read_only" => False,
"other_config" => array("location" => "file:/xenlocal/xen/doms/windows/windows.img"), ); $aVBD_cfg = array(
       "VDI" => "",
       "VM" => "",
       "device" => "hda",
       "mode" => "RW",
       "type" => "disk",
       "driver" => "ioemu",
       "bootable" => True,
   );
$aVIF_cfg = array(
       "name" => "windows_VIF",
       "type" => "ioemu",
       "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>";
?>



--
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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] Start a hvm with PHP using xen-api, André Bödecker <=