PHP API cannot Clone VM (qemu)

RLCPascal

New Member
Nov 27, 2013
2
0
1
Hello,
i hope you understand my problem. Sry for my english, I am from Germany.

I would like to develope a API for Hosting qemu VM´s.

Status from all VM´s from the github example works perfect. But to clone a VM to another it doesent work. Proxmoxx api doesnt send an error or notice. I only get "array(1) { [0]=> bool(false) }" looks like false :D. The VM didnt created. But i cannot see whats wrong. Proxmoxx only say this.
my php code
PHP:
if ($pve2->constructor_success()) {
 
   
    if ($pve2->login()) {
        //clone VM6 (Testsystem)
if(isset($_GET["reinstall"]) && $_GET["reinstall"] != "")
{
    $vmid = $_GET["reinstall"];
    if($vmid == "108")
    {
        
        $parameters = array ();
$parameters["newid"] = 108;
$parameters["node"] = "srv01";
$parameters["vmid"] = 106;
$parameters["full"] = true;
$parameters["storage"] = "local";
$parameters["format"] = 1;



        $status[] = $pve2->post("/nodes/srv01/qemu/108/clone",$parameters);
        var_dump($status);exit;
        
        
    }
    
    
    
}
why it doesent work? I hope anyone understand my problem and can help me.

Greetings from Germany
 
I am sure this API call returns an error message, because format must be one of 'raw', qcow' or 'vmdk'.
 
I am sure this API call returns an error message, because format must be one of 'raw', qcow' or 'vmdk'.
Now i have changed the format from 1 to "vmdk" but get the same output: "array(1) { [0]=> bool(false) }"
PHP:
if ($pve2->constructor_success()) {
 
   
    if ($pve2->login()) {
        //clone VM6 (Testsystem)
if(isset($_GET["reinstall"]) && $_GET["reinstall"] != "")
{
    $vmid = $_GET["reinstall"];
    if($vmid == "108")
    {
        
        $parameters = array ();
$parameters["newid"] = 108;
$parameters["node"] = "srv01";
$parameters["vmid"] = 106;
$parameters["full"] = true;
$parameters["storage"] = "local";
$parameters["format"] = "vmdk"; //changed from 1 to "vmdk"



        $status[] = $pve2->post("/nodes/srv01/qemu/108/clone",$parameters);
        var_dump($status);exit;
        
        
    }
    
    
    
}
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!