Revision 1d4a4b26 lib/cmdlib/instance_storage.py

b/lib/cmdlib/instance_storage.py
1139 1139
  ignored.
1140 1140

  
1141 1141
  """
1142
  lu.cfg.MarkInstanceDisksInactive(instance.name)
1142 1143
  all_result = True
1143 1144
  disks = ExpandCheckDisks(instance, disks)
1144 1145

  
......
1205 1206
  # into any other network-connected state (Connected, SyncTarget,
1206 1207
  # SyncSource, etc.)
1207 1208

  
1209
  # mark instance disks as active before doing actual work, so watcher does
1210
  # not try to shut them down erroneously
1211
  lu.cfg.MarkInstanceDisksActive(iname)
1212

  
1208 1213
  # 1st pass, assemble on all nodes in secondary mode
1209 1214
  for idx, inst_disk in enumerate(disks):
1210 1215
    for node, node_disk in inst_disk.ComputeNodeTree(instance.primary_node):
......
1256 1261
  for disk in disks:
1257 1262
    lu.cfg.SetDiskID(disk, instance.primary_node)
1258 1263

  
1264
  if not disks_ok:
1265
    lu.cfg.MarkInstanceDisksInactive(iname)
1266

  
1259 1267
  return disks_ok, device_info
1260 1268

  
1261 1269

  
......
1460 1468
      if disk_abort:
1461 1469
        self.LogWarning("Disk syncing has not returned a good status; check"
1462 1470
                        " the instance")
1463
      if instance.admin_state != constants.ADMINST_UP:
1471
      if not instance.disks_active:
1464 1472
        _SafeShutdownInstanceDisks(self, instance, disks=[disk])
1465
    elif instance.admin_state != constants.ADMINST_UP:
1473
    elif not instance.disks_active:
1466 1474
      self.LogWarning("Not shutting down the disk even if the instance is"
1467 1475
                      " not supposed to be running because no wait for"
1468 1476
                      " sync mode was requested")
......
1650 1658

  
1651 1659
    if self.op.wait_for_sync:
1652 1660
      if not WaitForSync(self, self.instance):
1661
        self.cfg.MarkInstanceDisksInactive(self.instance.name)
1653 1662
        raise errors.OpExecError("Some disks of the instance are degraded!")
1654 1663

  
1655 1664
    return disks_info
......
2035 2044
    feedback_fn("Current seconary node: %s" %
2036 2045
                utils.CommaJoin(self.instance.secondary_nodes))
2037 2046

  
2038
    activate_disks = (self.instance.admin_state != constants.ADMINST_UP)
2047
    activate_disks = not self.instance.disks_active
2039 2048

  
2040 2049
    # Activate the instance disks if we're replacing them on a down instance
2041 2050
    if activate_disks:

Also available in: Unified diff