def CheckPrereq(self):
    self.instance = self.cfg.GetInstanceInfo(self.op.instance_uuid)
    assert self.instance is not None, \
      "Cannot retrieve locked instance %s" % self.op.instance_name

    if self.op.force:
      self.LogWarning("Ignoring offline instance check")
    else:
      CheckInstanceState(self, self.instance, INSTANCE_ONLINE)

    self.primary_offline = \
      self.cfg.GetNodeInfo(self.instance.primary_node).offline

    if self.primary_offline and self.op.ignore_offline_nodes:
      self.LogWarning("Ignoring offline primary node")
    else:
      CheckNodeOnline(self, self.instance.primary_node)

    if self.op.admin_state_source == constants.USER_SOURCE:
      cluster = self.cfg.GetClusterInfo()

      result = self.rpc.call_instance_info(
        self.instance.primary_node,
        self.instance.name,
        self.instance.hypervisor,
        cluster.hvparams[self.instance.hypervisor])
      result.Raise("Error checking instance '%s'" % self.instance.name,
                   prereq=True)

      if not _IsInstanceUserDown(cluster,
                                 self.instance,
                                 result.payload):
        raise errors.OpPrereqError("Instance '%s' was not shutdown by the user"
                                   % self.instance.name)
show File Browser for opening or saving file.
dataset/ETHPy150Open ganeti/ganeti/lib/cmdlib/instance_operation.py/LUInstanceShutdown.CheckPrereq--crossover with--dataset/ETHPy150Open xraypy/xraylarch/plugins/wx/gui_utils.py/fileprompt