weizhouapache commented on PR #7061:
URL: https://github.com/apache/cloudstack/pull/7061#issuecomment-1372376990
> > lots of refactoring. I am not sure if the code is good or not. Maybe
others can check.
> > @stephankruggg can you point out the key point of your change ?
>
> @weizhouapache, when assigning a VM to another account
(`assignVirtualMachine API`), if a network error happens during the process, no
rollback is executed; thus, leaving the DB in an inconsistent state. This PR
fixes this by processing all steps to change the ownership of a VM inside the
transaction.
>
> The refactoring is intended to make the code more testable, readable, and
easier to maintain.
@stephankruggg
thanks.
it seems the key block is
```
Transaction.execute(new TransactionCallbackNoReturn() {
@Override
public void doInTransactionWithoutResult(TransactionStatus
status) {
executeStepsToChangeOwnershipOfVm(cmd, caller, oldAccount,
newAccount, vm, offering, volumes, template, domainId);
}
});
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]