CLOUDSTACK-6199: Hide action events for Vm/Volume commands when the resources have display flag=0.

Introduce generic BaseAsync(Vm/Volume)Cmd to make get the flag value for logging action events.
Rename the db field as display rather than display_event in keeping with the convention
This commit is contained in:
Nitin Mehta 2014-03-05 16:40:44 -08:00
parent 38c0dd87a9
commit 830328b63d
30 changed files with 176 additions and 56 deletions

View File

@ -94,4 +94,6 @@ public interface VolumeApiService {
*
*/
String extractVolume(ExtractVolumeCmd cmd);
boolean isDisplayResourceEnabled(Long id);
}

View File

@ -469,4 +469,10 @@ public interface UserVmService {
*/
String getVmUserData(long vmId);
/**
* determin whether the uservm should be visible to the end user
* @return value of the display flag
*/
public boolean isDisplayResourceEnabled(Long vmId);
}

View File

@ -0,0 +1,30 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api;
/**
* A generic class for implementing methods common to all async vm commands
*/
public abstract class BaseAsyncVMCmd extends BaseAsyncCmd {
@Override
public boolean isDisplayResourceEnabled(){
return _userVmService.isDisplayResourceEnabled(getId());
}
public abstract Long getId();
}

View File

@ -0,0 +1,30 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api;
/**
* A generic class for implementing methods common to all async volume commands
*/
public abstract class BaseAsyncVolumeCmd extends BaseAsyncCmd {
@Override
public boolean isDisplayResourceEnabled(){
return _volumeService.isDisplayResourceEnabled(getId());
}
public abstract Long getId();
}

View File

@ -389,6 +389,16 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd {
return accountId;
}
@Override
public boolean isDisplayResourceEnabled(){
Boolean display = getDisplayVm();
if(display == null){
return true;
} else {
return display;
}
}
@Override
public String getEventType() {
return EventTypes.EVENT_VM_CREATE;

View File

@ -18,13 +18,13 @@ package org.apache.cloudstack.api.command.user.vm;
import java.util.List;
import org.apache.cloudstack.api.BaseAsyncVMCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserVmResponse;
@ -41,7 +41,7 @@ import com.cloud.uservm.UserVm;
responseObject = UserVmResponse.class,
requestHasSensitiveInfo = false,
responseHasSensitiveInfo = true)
public class DestroyVMCmd extends BaseAsyncCmd {
public class DestroyVMCmd extends BaseAsyncVMCmd {
public static final Logger s_logger = Logger.getLogger(DestroyVMCmd.class.getName());
private static final String s_name = "destroyvirtualmachineresponse";

View File

@ -16,13 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
import org.apache.cloudstack.api.BaseAsyncVMCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserVmResponse;
@ -36,7 +36,7 @@ import com.cloud.uservm.UserVm;
@APICommand(name = "rebootVirtualMachine", description = "Reboots a virtual machine.", responseObject = UserVmResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class RebootVMCmd extends BaseAsyncCmd {
public class RebootVMCmd extends BaseAsyncVMCmd {
public static final Logger s_logger = Logger.getLogger(RebootVMCmd.class.getName());
private static final String s_name = "rebootvirtualmachineresponse";

View File

@ -16,13 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
import org.apache.cloudstack.api.BaseAsyncVMCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserVmResponse;
@ -37,7 +37,7 @@ import com.cloud.uservm.UserVm;
@APICommand(name = "resetPasswordForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the password for virtual machine. "
+ "The virtual machine must be in a \"Stopped\" state and the template must already " + "support this feature for this command to take effect. [async]",
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class ResetVMPasswordCmd extends BaseAsyncCmd {
public class ResetVMPasswordCmd extends BaseAsyncVMCmd {
public static final Logger s_logger = Logger.getLogger(ResetVMPasswordCmd.class.getName());
private static final String s_name = "resetpasswordforvirtualmachineresponse";

View File

@ -17,13 +17,13 @@
package org.apache.cloudstack.api.command.user.vm;
import org.apache.cloudstack.api.BaseAsyncVMCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
@ -40,7 +40,7 @@ import com.cloud.uservm.UserVm;
@APICommand(name = "resetSSHKeyForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the SSH Key for virtual machine. "
+ "The virtual machine must be in a \"Stopped\" state. [async]",
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class ResetVMSSHKeyCmd extends BaseAsyncCmd {
public class ResetVMSSHKeyCmd extends BaseAsyncVMCmd {
public static final Logger s_logger = Logger.getLogger(ResetVMSSHKeyCmd.class.getName());

View File

@ -16,12 +16,12 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
import org.apache.cloudstack.api.BaseAsyncVMCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.TemplateResponse;
@ -42,7 +42,7 @@ import com.cloud.uservm.UserVm;
since = "3.0.0",
requestHasSensitiveInfo = false,
responseHasSensitiveInfo = true)
public class RestoreVMCmd extends BaseAsyncCmd {
public class RestoreVMCmd extends BaseAsyncVMCmd {
public static final Logger s_logger = Logger.getLogger(RestoreVMCmd.class);
private static final String s_name = "restorevmresponse";
@ -101,4 +101,10 @@ public class RestoreVMCmd extends BaseAsyncCmd {
public Long getTemplateId() {
return templateId;
}
// TODO - Remove vmid param and make it "id" in 5.0 so that we dont have two getters
@Override
public Long getId() {
return getVmId();
}
}

View File

@ -26,7 +26,7 @@ import org.apache.cloudstack.api.ACL;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncVMCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
@ -45,7 +45,7 @@ import com.cloud.uservm.UserVm;
@APICommand(name = "scaleVirtualMachine", description = "Scales the virtual machine to a new service offering.", responseObject = SuccessResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ScaleVMCmd extends BaseAsyncCmd {
public class ScaleVMCmd extends BaseAsyncVMCmd {
public static final Logger s_logger = Logger.getLogger(ScaleVMCmd.class.getName());
private static final String s_name = "scalevirtualmachineresponse";

View File

@ -16,13 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
import org.apache.cloudstack.api.BaseAsyncVMCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.HostResponse;
@ -42,7 +42,7 @@ import com.cloud.utils.exception.ExecutionException;
@APICommand(name = "startVirtualMachine", responseObject = UserVmResponse.class, description = "Starts a virtual machine.",
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class StartVMCmd extends BaseAsyncCmd {
public class StartVMCmd extends BaseAsyncVMCmd {
public static final Logger s_logger = Logger.getLogger(StartVMCmd.class.getName());
private static final String s_name = "startvirtualmachineresponse";

View File

@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
import org.apache.cloudstack.api.BaseAsyncVMCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ACL;
@ -23,7 +24,6 @@ import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserVmResponse;
@ -36,7 +36,7 @@ import com.cloud.uservm.UserVm;
@APICommand(name = "stopVirtualMachine", responseObject = UserVmResponse.class, description = "Stops a virtual machine.",
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class StopVMCmd extends BaseAsyncCmd {
public class StopVMCmd extends BaseAsyncVMCmd {
public static final Logger s_logger = Logger.getLogger(StopVMCmd.class.getName());
private static final String s_name = "stopvirtualmachineresponse";

View File

@ -108,6 +108,11 @@ public class UpgradeVMCmd extends BaseCmd {
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
}
@Override
public boolean isDisplayResourceEnabled(){
return _userVmService.isDisplayResourceEnabled(getId());
}
@Override
public void execute() throws ResourceAllocationException {
CallContext.current().setEventDetails("Vm Id: " + getId());

View File

@ -16,13 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.volume;
import org.apache.cloudstack.api.BaseAsyncVolumeCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserVmResponse;
@ -35,7 +35,7 @@ import com.cloud.user.Account;
@APICommand(name = "attachVolume", description = "Attaches a disk volume to a virtual machine.", responseObject = VolumeResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AttachVolumeCmd extends BaseAsyncCmd {
public class AttachVolumeCmd extends BaseAsyncVolumeCmd {
public static final Logger s_logger = Logger.getLogger(AttachVolumeCmd.class.getName());
private static final String s_name = "attachvolumeresponse";
@ -107,15 +107,6 @@ public class AttachVolumeCmd extends BaseAsyncCmd {
return EventTypes.EVENT_VOLUME_ATTACH;
}
@Override
public boolean isDisplayResourceEnabled(){
Volume volume = _responseGenerator.findVolumeById(getId());
if (volume == null) {
return true; // bad id given, parent this command to true so ERROR events are tracked
}
return volume.isDisplayVolume();
}
@Override
public String getEventDescription() {
return "attaching volume: " + getId() + " to vm: " + getVirtualMachineId();

View File

@ -152,10 +152,6 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd {
}
public Boolean getDisplayVolume() {
if(displayVolume == null){
return true;
}
return displayVolume;
}
@ -197,7 +193,12 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd {
@Override
public boolean isDisplayResourceEnabled(){
return getDisplayVolume();
Boolean display = getDisplayVolume();
if(display == null){
return true;
} else {
return display;
}
}
@Override
@ -220,7 +221,6 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd {
@Override
public void execute() {
CallContext.current().setEventDetails("Volume Id: " + getEntityId() + ((getSnapshotId() == null) ? "" : " from snapshot: " + getSnapshotId()));
CallContext.current().setEventDisplayEnabled(getDisplayVolume());
Volume volume = _volumeService.createVolume(this);
if (volume != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(volume);

View File

@ -76,6 +76,11 @@ public class DeleteVolumeCmd extends BaseCmd {
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
}
@Override
public boolean isDisplayResourceEnabled(){
return _volumeService.isDisplayResourceEnabled(getId());
}
@Override
public void execute() throws ConcurrentOperationException {
CallContext.current().setEventDetails("Volume Id: " + getId());

View File

@ -16,13 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.volume;
import org.apache.cloudstack.api.BaseAsyncVolumeCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserVmResponse;
@ -36,7 +36,7 @@ import com.cloud.uservm.UserVm;
@APICommand(name = "detachVolume", description = "Detaches a disk volume from a virtual machine.", responseObject = VolumeResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DetachVolumeCmd extends BaseAsyncCmd {
public class DetachVolumeCmd extends BaseAsyncVolumeCmd {
public static final Logger s_logger = Logger.getLogger(DetachVolumeCmd.class.getName());
private static final String s_name = "detachvolumeresponse";

View File

@ -16,13 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.volume;
import org.apache.cloudstack.api.BaseAsyncVolumeCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ExtractResponse;
@ -38,7 +38,7 @@ import com.cloud.user.Account;
@APICommand(name = "extractVolume", description = "Extracts volume", responseObject = ExtractResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ExtractVolumeCmd extends BaseAsyncCmd {
public class ExtractVolumeCmd extends BaseAsyncVolumeCmd {
public static final Logger s_logger = Logger.getLogger(ExtractVolumeCmd.class.getName());
private static final String s_name = "extractvolumeresponse";

View File

@ -19,7 +19,7 @@ package org.apache.cloudstack.api.command.user.volume;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncVolumeCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.StoragePoolResponse;
@ -31,7 +31,7 @@ import com.cloud.user.Account;
@APICommand(name = "migrateVolume", description = "Migrate volume", responseObject = VolumeResponse.class, since = "3.0.0",
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class MigrateVolumeCmd extends BaseAsyncCmd {
public class MigrateVolumeCmd extends BaseAsyncVolumeCmd {
private static final String s_name = "migratevolumeresponse";
/////////////////////////////////////////////////////
@ -58,10 +58,16 @@ public class MigrateVolumeCmd extends BaseAsyncCmd {
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
// TODO remove this in 5.0 and use id as param instead.
public Long getVolumeId() {
return volumeId;
}
@Override
public Long getId() {
return getVolumeId();
}
public Long getStoragePoolId() {
return storageId;
}

View File

@ -20,7 +20,7 @@ import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncVolumeCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DiskOfferingResponse;
@ -38,7 +38,7 @@ import com.cloud.user.Account;
@APICommand(name = "resizeVolume", description = "Resizes a volume", responseObject = VolumeResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class ResizeVolumeCmd extends BaseAsyncCmd {
public class ResizeVolumeCmd extends BaseAsyncVolumeCmd {
public static final Logger s_logger = Logger.getLogger(ResizeVolumeCmd.class.getName());
private static final String s_name = "resizevolumeresponse";
@ -67,10 +67,16 @@ public class ResizeVolumeCmd extends BaseAsyncCmd {
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
//TODO use the method getId() instead of this one.
public Long getEntityId() {
return id;
}
@Override
public Long getId() {
return getEntityId();
}
public Long getSize() {
return size;
}

View File

@ -122,6 +122,11 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd {
return volume.getAccountId();
}
@Override
public boolean isDisplayResourceEnabled(){
return _volumeService.isDisplayResourceEnabled(getId());
}
@Override
public String getEventType() {
return EventTypes.EVENT_VOLUME_UPDATE;

View File

@ -78,8 +78,8 @@ public class EventVO implements Event {
@Column(name = "archived")
private boolean archived;
@Column(name = "display_event", updatable = true, nullable = false)
protected boolean isDisplayEventEnabled = true;
@Column(name = "display", updatable = true, nullable = false)
protected boolean display = true;
@Transient
private int totalSize;
@ -214,12 +214,12 @@ public class EventVO implements Event {
this.archived = archived;
}
public boolean isDisplayEventEnabled() {
return isDisplayEventEnabled;
public boolean isDisplay() {
return display;
}
public void setDisplayEventEnabled(boolean displayEventEnabled) {
isDisplayEventEnabled = displayEventEnabled;
public void setDisplay(boolean display) {
this.display = display;
}
@Override

View File

@ -479,7 +479,6 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
CallContext ctx = CallContext.current();
Long callerUserId = ctx.getCallingUserId();
Account caller = ctx.getCallingAccount();
ctx.setEventDisplayEnabled(cmdObj.isDisplayResourceEnabled());
// Queue command based on Cmd super class:
// BaseCmd: cmd is dispatched to ApiDispatcher, executed, serialized and returned.

View File

@ -504,7 +504,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
sb.and("state", sb.entity().getState(), SearchCriteria.Op.NEQ);
sb.and("startId", sb.entity().getStartId(), SearchCriteria.Op.EQ);
sb.and("createDate", sb.entity().getCreateDate(), SearchCriteria.Op.BETWEEN);
sb.and("displayEvent", sb.entity().getDisplayEvent(), SearchCriteria.Op.EQ);
sb.and("displayEvent", sb.entity().getDisplay(), SearchCriteria.Op.EQ);
sb.and("archived", sb.entity().getArchived(), SearchCriteria.Op.EQ);
SearchCriteria<EventJoinVO> sc = sb.create();

View File

@ -108,8 +108,8 @@ public class EventJoinVO extends BaseViewVO implements ControlledViewEntity {
@Column(name = "archived")
private boolean archived;
@Column(name = "display_event")
protected boolean displayEvent = true;
@Column(name = "display")
protected boolean display = true;
public EventJoinVO() {
}
@ -222,8 +222,8 @@ public class EventJoinVO extends BaseViewVO implements ControlledViewEntity {
return archived;
}
public boolean getDisplayEvent() {
return displayEvent;
public boolean getDisplay() {
return display;
}
@Override

View File

@ -159,7 +159,7 @@ public class ActionEventUtils {
event.setType(type);
event.setState(state);
event.setDescription(description);
event.setDisplayEventEnabled(eventDisplayEnabled);
event.setDisplay(eventDisplayEnabled);
if (domainId != null) {
event.setDomainId(domainId);

View File

@ -1820,6 +1820,15 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
return extractUrl;
}
@Override
public boolean isDisplayResourceEnabled(Long id) {
Volume volume = _volumeDao.findById(id);
if (volume == null) {
return true; // bad id given, default to true
}
return volume.isDisplayVolume();
}
private String getFormatForPool(StoragePool pool) {
ClusterVO cluster = ApiDBUtils.findClusterById(pool.getClusterId());

View File

@ -4811,4 +4811,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
_accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, true, vm);
return vm.getUserData();
}
@Override
public boolean isDisplayResourceEnabled(Long vmId) {
UserVm vm = _vmDao.findById(vmId);
if (vm != null) {
return vm.isDisplayVm();
}
return true; // no info then default to true
}
}

View File

@ -543,7 +543,7 @@ ALTER TABLE `cloud`.`s2s_vpn_gateway` ADD COLUMN `display` tinyint(1) NOT NULL D
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (225, UUID(), 9, 'FreeBSD 10 (32-bit)');
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (226, UUID(), 9, 'FreeBSD 10 (64-bit)');
ALTER TABLE `cloud`.`event` ADD COLUMN `display_event` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
ALTER TABLE `cloud`.`event` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user';
DROP VIEW IF EXISTS `cloud`.`event_view`;
CREATE VIEW `cloud`.`event_view` AS
@ -560,7 +560,7 @@ CREATE VIEW `cloud`.`event_view` AS
eve.uuid start_uuid,
event.user_id,
event.archived,
event.display_event,
event.display,
user.username user_name,
account.id account_id,
account.uuid account_uuid,