On Friday, August 08, 2014 06:22:29 AM Martin Perina wrote:
----- Original Message -----
> From: "力波 王" <wlbleaboy(a)126.com>
> To: "Martin Perina" <mperina(a)redhat.com>
> Cc: "Oved Ourfali" <oourfali(a)redhat.com>, devel(a)ovirt.org
> Sent: Friday, August 8, 2014 11:40:35 AM
> Subject: Re: [ovirt-devel] add a ***Command for a button
>
> Hi, Oved:
> Get the new error :
> Error while executing action: A Request to the Server failed: This
> application is out of date, please click the refresh button on your
> browser. ( The client cannot accept BackupInfo )
Can you please post stacktrace of the execption?
Odds are they just build the backend and deployed it, in this particular case
the frontend also needs to be recompiled (and since that takes a long time it
is not something people like to do). So I suggest they also recompile the
frontend when they deploy in this case. To speed up compiling you can specify
which browsers to compile for. Here is the command I normally use:
make clean install-dev PREFIX=$HOME/ovirt-engine BUILD_UT=0 BUILD_GWT=1
DEV_EXTRA_BUILD_FLAGS_GWT_DEFAULTS="-D gwt.userAgent=gecko1_8,safari"
So I build without running the unit tests and I only compile for FF and
Chrome. If you don't use the GWT debugger, you can only compile for the
browser of your choice (For GWT debugger you need to compile at least 2
browsers, not sure why).
Once you have compiled the frontend with the changes, the exception should go
away.
> In the public VdcReturnValueBase executeAction()
> actionAllowed is false
>
> 在 8/8/14, 16:52, "Martin Perina" <mperina(a)redhat.com> 写入:
> >Hi
> >
> >----- Original Message -----
> >
> >> From: "力波 王" <wlbleaboy(a)126.com>
> >> To: "Oved Ourfali" <oourfali(a)redhat.com>
> >> Cc: devel(a)ovirt.org
> >> Sent: Friday, August 8, 2014 10:34:38 AM
> >> Subject: Re: [ovirt-devel] add a ***Command for a button
> >>
> >> hi, Oved:
> >> I don’t know how to add a VdcAction,
> >>
> >> Is this could work:
> >> public enum VdcActionType {
> >> Unknown(0, QuotaDependency.NONE),
> >> Backup(9000, QuotaDependency.NONE),
> >
> >Yes
> >
> >> I don’t know whether is it need a ActionGroup.
> >
> >You may not need to set ActionGroup for this
> >
> >More info about oVirt Command architecture you can found at [1].
> >
> >Martin Perina
> >
> >[1]
http://www.ovirt.org/Backend_modules_bll
> >
> >> 发件人: Oved Ourfali < oourfali(a)redhat.com >
> >> 日期: Fri, 8 Aug 2014 04:20:58 -0400 (EDT)
> >> 至: 力波 王 < wlbleaboy(a)126.com >
> >> 抄送: < devel(a)ovirt.org >
> >> 主题: Re: [ovirt-devel] add a ***Command for a button
> >>
> >>
> >>
> >> Hi
> >>
> >> Didn't do a too deep code review, but from a first glance
> >> You need to add a new VdcActionType that is called BackupInfo, and use
> >>
> >>that
> >>
> >> when you call RunAction.
> >>
> >> Hope it helps,
> >> Oved
> >> On Aug 8, 2014 11:11 AM, =?UTF-8?B?5Yqb5rOiIOeOiw==?= <
> >>
> >>wlbleaboy(a)126.com >
> >>
> >> wrote:
> >>
> >> Hi, everyone:
> >> I added a button on the Template Tab, in the client side, It’s OK,
> >>
> >> Added the button’s callback like this:
> >> =======================================================================
> >> private void backup()
> >> {
> >> BackupInfoParameters param = new BackupInfoParameters();
> >> Frontend.RunAction(VdcActionType.Unknown, param, new
> >> IFrontendActionAsyncCallback() {
> >> @Override
> >> public void executed(FrontendActionAsyncResult result) {
> >>
> >> }
> >> });
> >> }
> >> =======================================================================
> >>
> >> The BackupInfoCommand.java is :
> >> =======================================================================
> >> package org.ovirt.engine.core.bll;
> >>
> >> import org.ovirt.engine.core.bll.utils.PermissionSubject;
> >> import org.ovirt.engine.core.common.action.BackupInfoParameters;
> >>
> >>
> >> import java.io.IOException;
> >> import java.util.Collections;
> >> import java.util.List;
> >>
> >> /**
> >> * Created by leaboy on 8/7/14.
> >> */
> >> public class BackupInfoCommand <T extends BackupInfoParameters>
extends
> >> CommandBase<T>{
> >> public BackupInfoCommand(T parameters){
> >> super(parameters);
> >> }
> >>
> >> @Override
> >> public List<PermissionSubject> getPermissionCheckSubjects() {
> >> return Collections.emptyList();
> >> }
> >>
> >> @Override
> >> protected boolean canDoAction() {
> >> return true;
> >> }
> >>
> >>
> >> @Override
> >> protected void executeCommand() {
> >> int a;
> >> a = 1;
> >> try{
> >> Runtime.getRuntime().exec("touch /tmp/tmp.txt");
> >> }catch (IOException e){
> >> e.printStackTrace();
> >> }
> >>
> >> }
> >> }
> >> =======================================================================
> >>
> >> And the BackupInfoParameters.java is:
> >> =======================================================================
> >> package org.ovirt.engine.core.common.action;
> >>
> >> /**
> >> * Created by leaboy on 8/7/14.
> >> */
> >> public class BackupInfoParameters extends VdcActionParametersBase
> >>
> >>implements
> >>
> >> java.io.Serializable{
> >> private static final long serialVersionUID = -1363077467684414051L;
> >> private VdcActionType _actionType;
> >>
> >> //public BackupInfoParameters(){}
> >>
> >> public BackupInfoParameters(){_actionType = VdcActionType.Unknown;}
> >>
> >> public VdcActionType getActionType() {
> >> return _actionType;
> >> }
> >> }
> >> =======================================================================
> >>
> >> Built the code success, but when I clicked the button, got a dialog
> >>
> >>with the
> >>
> >> error info:
> >>
> >> Error while executing action: A Request to the Server failed with the
> >> following Status Code: 500
> >>
> >> I debug it , find the error is raised at :
> >>
> >> protected VdcReturnValueBase evaluateCorrelationId(CommandBase<?>
> >> commandBase) {
> >> VdcReturnValueBase returnValue = null;
> >>
> >> // Evaluate and set the correlationId on the parameters, fails on
> >>
> >>invalid
> >>
> >> correlation id
> >> returnValue =
> >> ExecutionHandler.evaluateCorrelationId(commandBase.getParameters());
> >> if (returnValue != null) {
> >> log.warnFormat("CanDoAction of action {0} failed. Reasons: {1}",
> >> commandBase.getActionType(),
> >> StringUtils.join(returnValue.getCanDoActionMessages(), ','));
> >>
> >> }
> >> // Set the correlation-id on the command
> >>
> >>commandBase.setCorrelationId(commandBase.getParameters().getCorrelationI
> >>d
> >>());
> >>
> >> return returnValue;
> >> }
> >> _______________________________________________ Devel mailing list
> >> Devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel
> >>
> >> _______________________________________________
> >> Devel mailing list
> >> Devel(a)ovirt.org
> >>
http://lists.ovirt.org/mailman/listinfo/devel
_______________________________________________
Devel mailing list
Devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel