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

[libvirt] Operation forbidden for read only access



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 10 129 54 254/system", true);
             //conn2 = new Connect("qemu+ssh://root 10 129 54 254/system", true);
             Domain migrate1;
             System.out.println("done with ssh");
             String uri="tcp://root 10 129 54 254:49166";
             migrate1 = testDomain1.migrate(conn1,1,null,"tcp://root 10 129 54 254",0);
             //int ret=testDomain1.migrateToURI("tcp://root 10 129 54 254: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!

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