Operation forbidden for read only access

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

 



I'm using libvirt's Java API bindingsa and i've opened a connection :
Connect conn=null;
        Connect conn1=null;
        Connect conn2=null;
        Domain testDomain1 = null;

        //connect to host vm
        try{
            conn = new Connect("qemu:///system", true);
            System.out.println("exception ONE:");
        } catch (LibvirtException e){
            System.out.println("exception ONE caught:"+e);
            System.out.println(e.getError());
        }
     //get the domain in host vm
        try {
            testDomain1 = conn.domainLookupByName("hda1");
            System.out.println("exception TWO:");
        } catch (LibvirtException ex) {
            System.out.println("exception TWO CAUGHT");
            //Logger.getLogger(Migrate.class.getName()).log(Level.SEVERE, null, ex);
        }

        //check if domain is running
        try{

            System.out.println("Domain:" + testDomain1.getName() + " id " +
                               testDomain1.getID() + " running " +
                               testDomain1.getOSType());
            System.out.println("exception THREE:");
        } catch (LibvirtException e1){
            System.out.println("exception THREE caught: "+e1);
            System.out.println(e1.getError());
        }
        /*try{
             conn1 = new Connect("qemu+ssh://root@xxxxxxxxxxxxx/system", true);
             //conn2 = new Connect("qemu+ssh://root@xxxxxxxxxxxxx/system", true);
             Domain migrate1;
             System.out.println("done with ssh");
             String uri="tcp://root@xxxxxxxxxxxxx:49166";
             migrate1 = testDomain1.migrate(conn1,1,null,"tcp://root@xxxxxxxxxxxxx",0);
             //int ret=testDomain1.migrateToURI("tcp://root@xxxxxxxxxxxxx:49155",1,null,0);
             System.out.println("exception FOUR:");
         }catch (LibvirtException e2){
            System.out.println("exception FOUR caught:"+e2);
            System.out.println(e2.getError());

    }*/
        try{
            testDomain1.destroy();
            System.out.println("Destroyed"+testDomain1);

        }
        catch(LibvirtException e4){
            System.out.println("exception FOUR caught: "+e4);
            System.out.println(e4.getError());
        }
The output I'm getting is:
exception ONE:
exception TWO:
Domain:test id 1 running linux
exception THREE:
libvir: Domain error : operation virDomainDestroy forbidden for read only access
exception FOUR caught: org.libvirt.LibvirtException: operation virDomainDestroy forbidden for read only access
level:VIR_ERR_ERROR
code:VIR_ERR_OPERATION_DENIED
domain:VIR_FROM_DOM
hasConn:false
hasDom:false
hasNet:false
message:operation virDomainDestroy forbidden for read only access
str1:operation %s forbidden for read only access
str2:virDomainDestroy
str3:null
int1:-1
int2:-1

BUILD SUCCESSFUL (total time: 23 minutes 38 seconds)

I've used qemu:///system but why is my operation being denied?

Thanks!
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]