Exemplo n.º 1
0
    def _closeup(self):
        if self.environment[ohostedcons.VMEnv.AUTOMATE_VM_SHUTDOWN]:
            self.logger.info(_('Shutting down the engine VM'))
            cli = self.environment[ohostedcons.VDSMEnv.VDS_CLI]
            try:
                cli.VM.shutdown(
                    vmID=self.environment[ohostedcons.VMEnv.VM_UUID])
            except ServerError as e:
                self.logger.debug(str(e))

        else:
            self.dialog.note(
                _('Please shutdown the VM allowing the system '
                  'to launch it as a monitored service.\n'
                  'The system will wait until the VM is down.'))
        waiter = tasks.VMDownWaiter(self.environment)
        if not waiter.wait():
            # The VM is down but not destroyed
            cli = self.environment[ohostedcons.VDSMEnv.VDS_CLI]
            try:
                cli.VM.destroy(
                    vmID=self.environment[ohostedcons.VMEnv.VM_UUID])
            except ServerError as e:
                self.logger.error(
                    _('Cannot destroy the Hosted Engine VM: {error}').format(
                        error=str(e)))
                raise RuntimeError(str(e))
Exemplo n.º 2
0
 def _closeup(self):
     # shutdown the vm if this is first host.
     if not self.environment[ohostedcons.CoreEnv.IS_ADDITIONAL_HOST]:
         self.dialog.note(
             _('Please shutdown the VM allowing the system to launch it '
               'as a monitored service.\n'
               'The system will wait until the VM is down.'))
         waiter = tasks.VMDownWaiter(self.environment)
         if not waiter.wait():
             # The VM is down but not destroyed
             status = self.environment[ohostedcons.VDSMEnv.VDS_CLI].destroy(
                 self.environment[ohostedcons.VMEnv.VM_UUID])
             self.logger.debug(status)
             if status['status']['code'] != 0:
                 self.logger.error(
                     _('Cannot destroy the Hosted Engine VM: ' +
                       status['status']['message']))
                 raise RuntimeError(status['status']['message'])
     self.logger.info(_('Enabling and starting HA services'))
     for service in (
             ohostedcons.Const.HA_AGENT_SERVICE,
             ohostedcons.Const.HA_BROCKER_SERVICE,
     ):
         self.services.startup(
             name=service,
             state=True,
         )
         self.services.state(
             name=service,
             state=True,
         )
Exemplo n.º 3
0
    def _misc_shutdown(self):
        self.logger.info(_('Shutting down the current engine VM'))
        cli = self.environment[ohostedcons.VDSMEnv.VDS_CLI]
        res = cli.shutdown(self.environment[ohostedcons.VMEnv.VM_UUID])
        self.logger.debug(res)

        waiter = tasks.VMDownWaiter(self.environment)
        if not waiter.wait():
            # The VM is down but not destroyed
            status = self.environment[ohostedcons.VDSMEnv.VDS_CLI].destroy(
                self.environment[ohostedcons.VMEnv.VM_UUID])
            self.logger.debug(status)
            if status['status']['code'] != 0:
                self.logger.error(
                    _('Cannot destroy the Hosted Engine VM: ' +
                      status['status']['message']))
                raise RuntimeError(status['status']['message'])
Exemplo n.º 4
0
    def _misc_shutdown(self):
        self.logger.info(_('Shutting down the current engine VM'))
        cli = self.environment[ohostedcons.VDSMEnv.VDS_CLI]
        try:
            cli.VM.shutdown(vmID=self.environment[ohostedcons.VMEnv.VM_UUID])
        except ServerError as e:
            self.logger.debug(str(e))

        waiter = tasks.VMDownWaiter(self.environment)
        if not waiter.wait():
            # The VM is down but not destroyed
            try:
                cli.VM.destroy(
                    vmID=self.environment[ohostedcons.VMEnv.VM_UUID])
            except ServerError as e:
                self.logger.error(
                    _('Cannot destroy the Hosted Engine VM: {error}').format(
                        error=str(e)))
                raise RuntimeError(str(e))
Exemplo n.º 5
0
 def _closeup(self):
     if self.environment[ohostedcons.VMEnv.AUTOMATE_VM_SHUTDOWN]:
         self.logger.info(_('Shutting down the engine VM'))
         cli = self.environment[ohostedcons.VDSMEnv.VDS_CLI]
         res = cli.shutdown(self.environment[ohostedcons.VMEnv.VM_UUID])
         self.logger.debug(res)
     else:
         self.dialog.note(
             _('Please shutdown the VM allowing the system '
               'to launch it as a monitored service.\n'
               'The system will wait until the VM is down.'))
     waiter = tasks.VMDownWaiter(self.environment)
     if not waiter.wait():
         # The VM is down but not destroyed
         status = self.environment[ohostedcons.VDSMEnv.VDS_CLI].destroy(
             self.environment[ohostedcons.VMEnv.VM_UUID])
         self.logger.debug(status)
         if status['status']['code'] != 0:
             self.logger.error(
                 _('Cannot destroy the Hosted Engine VM: ' +
                   status['status']['message']))
             raise RuntimeError(status['status']['message'])
 def _wait_vm_destroyed(self):
     waiter = tasks.VMDownWaiter(self.environment)
     return waiter.wait()