api2.0 create VM

avk

Renowned Member
Apr 9, 2012
5
0
66
Hello i try run function

PHP:
public function createVM()        
{            
     $data = array(                
     'nodename' => 've1',               
     'vmid' => '103',                 
     'sockets' => '1',                
     'ostype' => 'l26',               
     'cores' => '1',                
     'memory' => '512',                
     'name' => 'TestMaches',                
     'ide0' => 'local:10,format=raw',                
     'ide2' => 'none,media=cdrom',                
     'net0' => 'e1000,bridge=vmbr1');                         
     $session = new Zend_Session_Namespace('ticket');            
     $url='https://'.$this->host.'/api2/json/nodes/ve1/qemu';            
     $ch = curl_init();              
     curl_setopt($ch, CURLOPT_URL,$url);             
     curl_setopt($ch, CURLOPT_PORT,$this->port);           
     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);             
     curl_setopt($ch, CURLOPT_TIMEOUT, 10);            
     curl_setopt($ch, CURLOPT_POST, 1);            
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);            
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);            
     curl_setopt($ch, CURLOPT_COOKIE, "PVEAuthCookie=$session->ticket");            
     curl_setopt($ch, CURLOPT_POSTFIELDS,$data);            
     $response = curl_exec($ch);             
     print($response);                   
     curl_close($ch); 
}
HTML:
{"data":null}

Why not create a VM?
Where can I find a log about it ?
 
Last edited: