Пример #1
0
  private void getCloneDiskVersion(ArrayList svList, int root_id) {
    boolean isOk = view.initor.mdb.getCloneDiskList(hid, 0, root_id);
    if (!isOk) {
      SanBootView.log.warning(
          getClass().getName(),
          "Can't get clone disk info on [ " + hid + "/0" + "/" + root_id + " ]");
      return;
    }

    ArrayList cloneDiskList = view.initor.mdb.getCloneDiskList();
    int size = cloneDiskList.size();
    for (int i = 0; i < size; i++) {
      CloneDisk cloneDisk = (CloneDisk) cloneDiskList.get(i);
      CloneDiskWrapper cdWrapper = new CloneDiskWrapper(1);
      cdWrapper.cloneDisk = cloneDisk;
      svList.add(cdWrapper);

      this.getSnapAndViewFromVolInfo(svList, cloneDisk.getRoot_id(), cloneDisk.getTarget_id());
    }
  }
Пример #2
0
  @Override
  public void run() {
    int i, j, size, size1, vol_rootid;
    VolumeMap lv, tgt;
    VolumeMapWrapper volMapWrap;
    boolean isOk;
    ArrayList<Object> svList;
    BindofTgtWrapAndSnap binder;
    TargetWrapper tgtWrap;

    // 准备查询条件
    Vector lvList = view.initor.mdb.getRealLVListOnClntID(hid);
    size = lvList.size();
    String where = "";
    boolean isFirst = true;
    for (i = 0; i < size; i++) {
      lv = (VolumeMap) lvList.elementAt(i);
      if (lv.getVolDiskLabel().equals(ResourceCenter.SWAP_MP)) continue;

      // lv对应的tgt(VolumeMap)
      tgt = view.initor.mdb.getTgtOnVGname(lv.getVolDesc(), lv.getVolClntID());
      if (tgt != null) {
        vol_rootid = lv.getVol_rootid();
        isOk = view.initor.mdb.getCloneDiskList(hid, 0, vol_rootid);
        if (!isOk) {
          SanBootView.log.warning(
              getClass().getName(),
              "Can't get clone disk info on [ " + hid + "/0" + "/" + vol_rootid + " ]");
          continue;
        } else {
          ArrayList cloneDiskList = view.initor.mdb.getCloneDiskList();
          size1 = cloneDiskList.size();
          for (j = 0; j < size1; j++) {
            CloneDisk cloneDisk = (CloneDisk) cloneDiskList.get(j);
            if (isFirst) {
              where = BasicVDisk.BVDisk_Snap_Root_ID + "=" + cloneDisk.getRoot_id();
              isFirst = false;
            } else {
              where += " or " + BasicVDisk.BVDisk_Snap_Root_ID + "=" + cloneDisk.getRoot_id();
            }
          }
        }

        if (isFirst) {
          where = BasicVDisk.BVDisk_Snap_Root_ID + "=" + tgt.getVol_rootid();
          isFirst = false;
        } else {
          where += " or " + BasicVDisk.BVDisk_Snap_Root_ID + "=" + tgt.getVol_rootid();
        }
      } else {
        SanBootView.log.error(getClass().getName(), "Not found Tgt volmap: " + lv.getVolName());
        JOptionPane.showMessageDialog(
            pdiag,
            SanBootView.res.getString("MenuAndBtnCenter.error.notFoundTgtVolMap")
                + " "
                + lv.getVolName());
      }
    }

    isOk =
        view.initor.mdb.queryVSnapDB(
            "select * from " + ResourceCenter.VSnap_DB + " where " + where + ";");
    if (isOk) {
      for (i = 0; i < size; i++) {
        lv = (VolumeMap) lvList.elementAt(i);
        if (lv.getVolDiskLabel().equals(ResourceCenter.SWAP_MP)) continue;

        volMapWrap = new VolumeMapWrapper(1);
        volMapWrap.volMap = lv;

        // lv对应的tgt(VolumeMap)
        tgt = view.initor.mdb.getTgtOnVGname(lv.getVolDesc(), lv.getVolClntID());
        if (tgt != null) {
          tgtWrap = new TargetWrapper(lv.getVolDiskLabel(), tgt);
          SanBootView.log.debug(
              getClass().getName(), " tgt id: " + tgt.getVolTargetID() + "======\r\n");

          svList = new ArrayList<Object>();
          this.getSnapAndViewFromVolInfo(svList, tgt.getVol_rootid(), tgt.getVolTargetID());
          this.getCloneDiskVersion(svList, tgt.getVol_rootid());

          svList.add(0, volMapWrap); // volMapWrap本身也可以看成一种快照,而且是最新的
          binder = new BindofTgtWrapAndSnap(tgtWrap, svList);
          bindList.addElement(binder);
        }
      }
    } else {
      for (i = 0; i < size; i++) {
        lv = (VolumeMap) lvList.elementAt(i);
        if (lv.getVolDiskLabel().equals(ResourceCenter.SWAP_MP)) continue;

        volMapWrap = new VolumeMapWrapper(1);
        volMapWrap.volMap = lv;

        // lv对应的tgt(VolumeMap)
        tgt = view.initor.mdb.getTgtOnVGname(lv.getVolDesc(), lv.getVolClntID());
        if (tgt != null) {
          tgtWrap = new TargetWrapper(lv.getVolDiskLabel(), tgt);
          SanBootView.log.debug(getClass().getName(), " tgt id: " + tgt.getVolTargetID());

          svList = new ArrayList<Object>();
          svList.add(volMapWrap); // volMapWrap本身也可以看成一种快照,而且是最新的
          binder = new BindofTgtWrapAndSnap(tgtWrap, svList);
          bindList.addElement(binder);
        }
      }
    }

    try {
      SwingUtilities.invokeAndWait(close);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }