def Exec(self, feedback_fn):
    # If the instance is offline we shouldn't mark it as down, as that
    # resets the offline flag.
    if not self.op.no_remember and self.instance.admin_state in INSTANCE_ONLINE:
      self.instance = self.cfg.MarkInstanceDown(self.instance.uuid)

      if self.op.admin_state_source == constants.ADMIN_SOURCE:
        self.cfg.MarkInstanceDown(self.instance.uuid)
      elif self.op.admin_state_source == constants.USER_SOURCE:
        self.cfg.MarkInstanceUserDown(self.instance.uuid)

    if self.primary_offline:
      assert self.op.ignore_offline_nodes
      self.LogInfo("Primary node offline, marked instance as stopped")
    else:
      result = self.rpc.call_instance_shutdown(
        self.instance.primary_node,
        self.instance,
        self.op.timeout, self.op.reason)
      result.Raise("Could not shutdown instance '%s'" % self.instance.name)

      ShutdownInstanceDisks(self, self.instance)
Shutdown the instance.
dataset/ETHPy150Open ganeti/ganeti/lib/cmdlib/instance_operation.py/LUInstanceShutdown.Exec