I am getting error as User is not authorized to perform this action.I am using 
oVirt api to manually attach a disk and snapshot  to another virtual 
machine.This the code i used.The API i followed is

'<disk_attachment>
                           <active>true</active>
                           <bootable>false</bootable>
                                <interface>virtio</interface>
                        <disk id="a94106b7-d348-4088-aaa1-5dfc46dc094e">
                    <snapshot id="6ecbb953-c4fb-4294-9988-e7cd2bd9b038"/>
                    <description>My disk</description>
                         <format>cow</format>
                                <name>mydisk</name>
                                  
                       </disk>
                        </disk_attachment>


==============================
The php code i have tried is ...

public function attachSnapshotandActivateDisk( ) {


        $data = array();

        $xmlStr = '<disk_attachment>
                           <active>true</active>
                           <bootable>false</bootable>
                                <interface>virtio</interface>
                        <disk id="a94106b7-d348-4088-aaa1-5dfc46dc094e">
                    <snapshot id="6ecbb953-c4fb-4294-9988-e7cd2bd9b038"/>
                    <description>My disk</description>
                         <format>cow</format>
                                <name>mydisk</name>
                                  
                       </disk>
                        </disk_attachment>
                                     ';

        $curlParam = array(
            "url" => "vms/74a1a99f-87d1-4444-b394-f90e4f29f51f/diskattachments",
            "method" => "POST",
            "data" => $xmlStr
        );

        //         $text = print_r($curlParam, true);
        //echo "<script>console.log( 'curl 
Parameter".json_encode($text)."');</script>";

        $data = $this->processCurlRequest($curlParam, "vm-create");

        // if instance update failed
        if ($data['status'] != 'success') {
            Common::ovirtLog(array(
                "requestParam" => $curlParam,
                "responseParam" => $data,
            ));
        }

// show the output of print_r function as a string
        //  $text = print_r($data, true);
        echo $data['message'];
        die;
        echo "<script type='text/javascript'> console.log('checking the attach 
snapshot activate disk function diskid=" . json_encode($data) . "') </script>";


        //Detach the disk
        //  $this->detachSnapshotDisk() ; 

        return $data;
    }


Please help me.
_______________________________________________
Devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/[email protected]/message/GJ4ARMX7UNJ7EQVBX4O53FXXYMWXMAUD/

Reply via email to