Revision 9ac99fda lib/cmdlib.py

b/lib/cmdlib.py
4436 4436
  def CheckPrereq(self):
4437 4437
    """Check prerequisites.
4438 4438

  
4439
    This checks that the instance name is a valid one.
4439
    This checks that the instance and node names are valid.
4440 4440

  
4441 4441
    """
4442 4442
    instance_name = self.cfg.ExpandInstanceName(self.op.instance_name)
......
4523 4523
                         " on node %s" % (instance.name, node))
4524 4524

  
4525 4525

  
4526
class LURemoveExport(NoHooksLU):
4527
  """Remove exports related to the named instance.
4528

  
4529
  """
4530
  _OP_REQP = ["instance_name"]
4531

  
4532
  def CheckPrereq(self):
4533
    """Check prerequisites.
4534
    """
4535
    pass
4536

  
4537
  def Exec(self, feedback_fn):
4538
    """Remove any export.
4539

  
4540
    """
4541
    instance_name = self.cfg.ExpandInstanceName(self.op.instance_name)
4542
    # If the instance was not found we'll try with the name that was passed in.
4543
    # This will only work if it was an FQDN, though.
4544
    fqdn_warn = False
4545
    if not instance_name:
4546
      fqdn_warn = True
4547
      instance_name = self.op.instance_name
4548

  
4549
    op = opcodes.OpQueryExports(nodes=[])
4550
    exportlist = self.proc.ChainOpCode(op)
4551
    found = False
4552
    for node in exportlist:
4553
      if instance_name in exportlist[node]:
4554
        found = True
4555
        if not rpc.call_export_remove(node, instance_name):
4556
          logger.Error("could not remove export for instance %s"
4557
                       " on node %s" % (instance_name, node))
4558

  
4559
    if fqdn_warn and not found:
4560
      feedback_fn("Export not found. If trying to remove an export belonging"
4561
                  " to a deleted instance please use its Fully Qualified"
4562
                  " Domain Name.")
4563

  
4564

  
4526 4565
class TagsLU(NoHooksLU):
4527 4566
  """Generic tags LU.
4528 4567

  

Also available in: Unified diff