Examples of MockVm


Examples of com.cloud.simulator.MockVm

    }

    @Override
    public CheckRouterAnswer checkRouter(CheckRouterCommand cmd) {
        String router_name = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
        MockVm vm = _mockVmDao.findByVmName(router_name);
        String args = vm.getBootargs();
        if (args.indexOf("router_pr=100") > 0) {
            s_logger.debug("Router priority is for MASTER");
            CheckRouterAnswer ans = new CheckRouterAnswer(cmd, "Status: MASTER & Bumped: NO", true);
            ans.setState(VirtualRouter.RedundantState.MASTER);
            return ans;
View Full Code Here

Examples of com.cloud.simulator.MockVm

    }

    @Override
    public Answer bumpPriority(BumpUpPriorityCommand cmd) {
        String router_name = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
        MockVm vm = _mockVmDao.findByVmName(router_name);
        String args = vm.getBootargs();
        if (args.indexOf("router_pr=100") > 0) {
            return new Answer(cmd, true, "Status: BACKUP & Bumped: YES");
        } else {
            return new Answer(cmd, true, "Status: MASTER & Bumped: YES");
        }
View Full Code Here

Examples of com.cloud.simulator.MockVm

    public StopAnswer stopVM(StopCommand cmd) {
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
        try {
            txn.start();
            String vmName = cmd.getVmName();
            MockVm vm = _mockVmDao.findByVmName(vmName);
            if (vm != null) {
                vm.setState(State.Stopped);
                _mockVmDao.update(vm.getId(), (MockVMVO) vm);
            }

            if (vmName.startsWith("s-")) {
                _mockAgentMgr.handleSystemVMStop(vm.getId());
            }
            txn.commit();
            return new StopAnswer(cmd, null, true);
        } catch (Exception ex) {
            txn.rollback();
View Full Code Here

Examples of com.cloud.simulator.MockVm

    @Override
    public RebootAnswer rebootVM(RebootCommand cmd) {
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
        try {
            txn.start();
            MockVm vm = _mockVmDao.findByVmName(cmd.getVmName());
            if (vm != null) {
                vm.setState(State.Running);
                _mockVmDao.update(vm.getId(), (MockVMVO) vm);
            }
            txn.commit();
            return new RebootAnswer(cmd, "Rebooted " + cmd.getVmName(), true);
        } catch (Exception ex) {
            txn.rollback();
View Full Code Here

Examples of com.cloud.simulator.MockVm

            if (volume != null) {
                _mockVolumeDao.remove(volume.getId());
            }

            if (cmd.getVmName() != null) {
                MockVm vm = _mockVMDao.findByVmName(cmd.getVmName());
                vm.setState(State.Expunging);
                if (vm != null) {
                    MockVMVO vmVo = _mockVMDao.createForUpdate(vm.getId());
                    _mockVMDao.update(vm.getId(), vmVo);
                }
            }
            txn.commit();
        } catch (Exception ex) {
            txn.rollback();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.