Search in sources :

Example 6 with OneUuidReturn

use of org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturn in project ovirt-engine by oVirt.

the class JsonRpcIIrsServer method moveImage.

@Override
public OneUuidReturn moveImage(String spUUID, String srcDomUUID, String dstDomUUID, String imgGUID, String vmGUID, int op, String postZero, Boolean discard, String force) {
    JsonRpcRequest request = new RequestBuilder("Image.move").withParameter("imageID", imgGUID).withParameter("storagepoolID", spUUID).withParameter("storagedomainID", srcDomUUID).withParameter("dstSdUUID", dstDomUUID).withParameter("operation", op).withParameter("postZero", postZero).withOptionalParameter("discard", discard).withParameter("force", force).build();
    Map<String, Object> response = new FutureMap(this.client, request).withResponseKey("uuid");
    return new OneUuidReturn(response);
}
Also used : JsonRpcRequest(org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest) RequestBuilder(org.ovirt.vdsm.jsonrpc.client.RequestBuilder) OneUuidReturn(org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturn)

Example 7 with OneUuidReturn

use of org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturn in project ovirt-engine by oVirt.

the class JsonRpcIIrsServer method syncImageData.

@Override
public OneUuidReturn syncImageData(String spUUID, String srcDomUUID, String imgGUID, String dstDomUUID, String syncType) {
    JsonRpcRequest request = new RequestBuilder("Image.syncData").withParameter("imageID", imgGUID).withParameter("storagepoolID", spUUID).withParameter("storagedomainID", srcDomUUID).withParameter("dstSdUUID", dstDomUUID).withParameter("syncType", syncType).build();
    Map<String, Object> response = new FutureMap(this.client, request).withResponseKey("uuid");
    return new OneUuidReturn(response);
}
Also used : JsonRpcRequest(org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest) RequestBuilder(org.ovirt.vdsm.jsonrpc.client.RequestBuilder) OneUuidReturn(org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturn)

Example 8 with OneUuidReturn

use of org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturn in project ovirt-engine by oVirt.

the class JsonRpcIIrsServer method prepareMerge.

@Override
public OneUuidReturn prepareMerge(String spUUID, Map<String, Object> subchainInfo) {
    JsonRpcRequest request = new RequestBuilder("StoragePool.prepareMerge").withParameter("storagepoolID", spUUID).withParameter("subchainInfo", subchainInfo).build();
    Map<String, Object> response = new FutureMap(this.client, request).withResponseKey("uuid");
    return new OneUuidReturn(response);
}
Also used : JsonRpcRequest(org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest) RequestBuilder(org.ovirt.vdsm.jsonrpc.client.RequestBuilder) OneUuidReturn(org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturn)

Example 9 with OneUuidReturn

use of org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturn in project ovirt-engine by oVirt.

the class MarshallingTestCase method testVolumeCreate.

@SuppressWarnings("unchecked")
@Test
public void testVolumeCreate() throws Exception {
    // Given
    String json = "{\"jsonrpc\": \"2.0\", \"id\": \"e8ea1fa9-d819-4c41-ae9c-b103a236fb29\", \"result\": {\"uuid\": \"4f84eef5-8f8b-4732-babd-0a860cf0d1b9\"}}";
    ObjectMapper mapper = new ObjectMapper();
    JsonRpcResponse response = JsonRpcResponse.fromJsonNode(mapper.readTree(json));
    Future<JsonRpcResponse> future = mock(Future.class);
    when(future.get()).thenReturn(response);
    JsonRpcClient client = mock(JsonRpcClient.class);
    JsonRpcRequest request = mock(JsonRpcRequest.class);
    when(client.call(request)).thenReturn(future);
    // When
    Map<String, Object> map = new FutureMap(client, request).withIgnoreResponseKey();
    // Then
    OneUuidReturn oneuuid = new OneUuidReturn(map);
    assertEquals("Done", oneuuid.getStatus().message);
    assertEquals(0, oneuuid.getStatus().code);
    assertEquals("4f84eef5-8f8b-4732-babd-0a860cf0d1b9", UUID.fromString(oneuuid.uuid).toString());
}
Also used : JsonRpcResponse(org.ovirt.vdsm.jsonrpc.client.JsonRpcResponse) JsonRpcRequest(org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest) OneUuidReturn(org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturn) JsonRpcClient(org.ovirt.vdsm.jsonrpc.client.JsonRpcClient) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) Test(org.junit.Test)

Example 10 with OneUuidReturn

use of org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturn in project ovirt-engine by oVirt.

the class JsonRpcVdsServer method createVG.

@Override
public OneUuidReturn createVG(String sdUUID, String[] deviceList, boolean force) {
    JsonRpcRequest request = new RequestBuilder("LVMVolumeGroup.create").withParameter("name", sdUUID).withParameter("devlist", new ArrayList<>(Arrays.asList(deviceList))).withParameter("force", force).build();
    Map<String, Object> response = new FutureMap(this.client, request).withResponseKey("uuid");
    return new OneUuidReturn(response);
}
Also used : JsonRpcRequest(org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest) RequestBuilder(org.ovirt.vdsm.jsonrpc.client.RequestBuilder) OneUuidReturn(org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturn)

Aggregations

OneUuidReturn (org.ovirt.engine.core.vdsbroker.irsbroker.OneUuidReturn)19 JsonRpcRequest (org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest)19 RequestBuilder (org.ovirt.vdsm.jsonrpc.client.RequestBuilder)18 ArrayList (java.util.ArrayList)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 Test (org.junit.Test)1 JsonRpcClient (org.ovirt.vdsm.jsonrpc.client.JsonRpcClient)1 JsonRpcResponse (org.ovirt.vdsm.jsonrpc.client.JsonRpcResponse)1