Laszlo Hornyak has posted comments on this change.
Change subject: engine: watchdog - restapi support
......................................................................
Patch Set 32: (10 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddWatchdogCommand.java
Line 29: watchdogDevice.setAddress(StringUtils.EMPTY);
Line 30: watchdogDevice.setSpecParams(getSpecParams());
Line 31: getVmDeviceDao().save(watchdogDevice);
Line 32: setSucceeded(true);
Line 33: setActionReturnValue(watchdogDevice);
Done
Line 34: }
Line 35:
Line 36: @Override
Line 37: protected boolean canDoAction() {
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateWatchdogCommand.java
Line 18: getWatchdogs();
Line 19: VmDevice watchdogDevice = watchdogs.get(0); // there must be
only one
Line 20: watchdogDevice.setSpecParams(getSpecParams());
Line 21: getVmDeviceDao().update(watchdogDevice);
Line 22: setActionReturnValue(watchdogDevice);
Done
Line 23: setSucceeded(true);
Line 24: }
Line 25:
Line 26: protected boolean canDoAction() {
....................................................
File
backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
Line 2203: <!-- also rel="snapshots" links, see Snapshots below -->
Line 2204: <!-- also rel="users" links, see Users above -->
Line 2205:
Line 2206: <xs:element ref="reported_devices" minOccurs="0"
maxOccurs="1"/>
Line 2207: <xs:element name="watchdogs" minOccurs="0" maxOccurs="1"/>
Done
Line 2208: </xs:sequence>
Line 2209: </xs:extension>
Line 2210: </xs:complexContent>
Line 2211: </xs:complexType>
Line 2415: </xs:sequence>
Line 2416: </xs:extension>
Line 2417: </xs:complexContent>
Line 2418: </xs:complexType>
Line 2419:
whitespace? or what do you mean?
Line 2420: <xs:element name="watchdog" type="WatchDog"/>
Line 2421:
Line 2422: <xs:element name="watchdogs" type="WatchDogs"/>
Line 2423:
....................................................
File
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendCapabilitiesResource.java
Line 215: addReportedDeviceTypes(version, ReportedDeviceType.values());
Line 216: addIpVersions(version, IpVersion.values());
Line 217: addCpuModes(version, CpuMode.values());
Line 218: addWatchdogActions(version, WatchdogAction.values());
Line 219: addWatchdogModels(version, WatchdogModel.values());
Done
Line 220:
Line 221: version.setFeatures(featuresHelper.getFeatures(v));
Line 222:
Line 223: if (current == null && VersionHelper.equals(v,
getCurrentVersion())) {
Line 241: }
Line 242: }
Line 243:
Line 244: private void addWatchdogModels(VersionCaps version,
WatchdogModel[] values) {
Line 245: if (VersionUtils.greaterOrEqual(version, VERSION_3_2)) {
Done
Line 246: version.setWatchdogModels(new WatchdogModels());
Line 247: for (WatchdogModel watchdogModel : values) {
Line 248:
version.getWatchdogModels().getWatchdogModels().add(watchdogModel.value());
Line 249: }
....................................................
File
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplateResource.java
Line 133: }
Line 134:
Line 135: @Path("watchdogs")
Line 136: @Override
Line 137: public DevicesResource<WatchDog, WatchDogs>
getWatchdogsResource() {
Done
Line 138: return inject(new BackendWatchdogsResource(guid,
Line 139: VdcQueryType.GetWatchdog,
Line 140: new IdQueryParameters(guid)));
Line 141: }
....................................................
File
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendWatchdogsResource.java
Line 83:
getEntity(org.ovirt.engine.core.common.businessentities.VM.class,
VdcQueryType.GetVmByVmId, queryParams, id.toString());
Line 84: return true;
Line 85: } catch (WebFaultException e) {
Line 86: return false;
Line 87: }
Done
Line 88: }
Line 89:
Line 90: @Override
Line 91: protected ParametersProvider<WatchDog, VmWatchdog>
getUpdateParametersProvider() {
....................................................
File
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/WatchdogModel.java
Line 1: package org.ovirt.engine.api.restapi.types;
Line 2:
Line 3: public enum WatchdogModel {
Line 4: i6300esb,
Line 5: ib700;
Done
Line 6: public String value () {
Line 7: return this.name().toLowerCase();
Line 8: }
....................................................
File
backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/WatchdogMapperTest.java
Line 18: entity.setId(new Guid());
Line 19: WatchDog model = WatchdogMapper.map(entity, null);
Line 20: Assert.assertNotNull(model);
Line 21: Assert.assertEquals(model.getAction(), "reset");
Line 22: Assert.assertEquals(model.getModel(), "i6300esb");
I used the names because this is what we have to get and give. If someone
modifies the enum constants, this test will break and I think that is good.
Line 23: }
Line 24:
Line 25: @Test
Line 26: public void mapWatchdog() {
--
To view, visit http://gerrit.ovirt.org/13060
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ief5b20ecf2221faf900cadfeafe4c71607a9eca3
Gerrit-PatchSet: 32
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Laszlo Hornyak <[email protected]>
Gerrit-Reviewer: Doron Fediuck <[email protected]>
Gerrit-Reviewer: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Laszlo Hornyak <[email protected]>
Gerrit-Reviewer: Michael Pasternak <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches