Package com.vmware.aurora.global

Examples of com.vmware.aurora.global.DiskSize


            fileMap.put(fileInfo.getKey(), fileInfo);
         }
      }

      sizeDetail = new HashMap<DeviceId, DiskSize>();
      size = new DiskSize(0);

      if (fileLayout.getSnapshot() == null) {
         logger.info("missing snapshot layout in " + vm);
         return;
      }
      // search for the snapshot's files
      for (SnapshotLayout snapshotLayout : fileLayout.getSnapshot()) {
         if (getMoRef().equals(snapshotLayout.getKey())) {
            // loop through each disk and count the last diskunit in the chain only
            // because the previous ones are shared with the other snapshots so don't double counting
            VirtualDevice[] devices = getConfig().getHardware().getDevice();
            for(DiskLayout disk : snapshotLayout.getDisk()) {
               VirtualDisk vdisk = (VirtualDisk)findDevice(devices, disk.getKey());
               String diskMode = ((VirtualDisk.FlatVer2BackingInfo)vdisk.getBacking()).getDiskMode();
               // independent disks are not included in snapshot
               if (!diskMode.equals(DiskMode.independent_nonpersistent.name()) &&
                   !diskMode.equals(DiskMode.independent_persistent.name())) {
                  DiskUnit[] diskUnits = disk.getChain();
                  int[] fileKeys = diskUnits[diskUnits.length - 1].getFileKey();

                  // count the total of each file's size
                  long total = 0;
                  for (int fileKey : fileKeys) {
                     FileInfo fileInfo = fileMap.get(fileKey);
                     if (fileInfo != null) {
                        total += fileInfo.getSize();
                     }
                  }

                  // add up
                  size.add(total);
                  DeviceId deviceId =
                        new DeviceId(findDevice(devices, vdisk.getControllerKey()), vdisk);
                  sizeDetail.put(deviceId, new DiskSize(total));
               }
            }

            // add vmsn file size which is always on data storage
            FileInfo fileInfo = fileMap.get(snapshotLayout.getDataKey());
            if (fileInfo != null) {
               size.add(fileInfo.getSize());
               vmsnFileSize = new DiskSize(fileInfo.getSize());
            }
            return;
         }
      }
      // no matching file layout for this snapshot?
View Full Code Here


      return size;
   }

   @Override
   public DiskSize getSizeOnData(DiskSchema diskSchema) {
      DiskSize dataSize = new DiskSize(0);
      Map<DeviceId, DiskSize> sizeDetail = getSizeDetail();
      for (DiskSpec diskSpec : diskSchema.getDiskSpecs()) {
         // only the snapshot of the archive disk is on backup storage since V1.0
         if (!diskSpec.getDiskType().equals(DiskType.Archive)) {
            DiskSize size = sizeDetail.get(diskSpec.getDeviceId());
            if (size != null) {
               dataSize.add(size);
            }
         }
      }
View Full Code Here

   protected synchronized void updateRuntime(ManagedObject mo) throws Exception {
      VirtualMachine vm = (VirtualMachine)mo;
      this.runtime = checkReady(vm.getRuntime());
      Summary summary = checkReady(vm.getSummary());
      StorageSummary storageSummary = checkReady(summary.getStorage());
      storageUsage = new DiskSize(storageSummary.getUnshared());
      storageCommitted = new DiskSize(storageSummary.getCommitted());
      /* XXX Layout needs to be updated in both update() and updateRuntime()
       * as it contains both configuration & runtime data.
       */
      this.layoutEx = checkReady(vm.getLayoutEx());
      /**
 
View Full Code Here

         }

         VirtualMachine vm = getManagedObject();
         Summary summary = checkReady(vm.getSummary());
         StorageSummary storageSummary = checkReady(summary.getStorage());
         storageUsage = new DiskSize(storageSummary.getUnshared());
         storageCommitted = new DiskSize(storageSummary.getCommitted());
         layoutEx = checkReady(vm.getLayoutEx());
      }
   }
View Full Code Here

   public DiskSize getDiskCapacity(DeviceId deviceId) {
      VirtualDevice device = getVirtualDevice(deviceId);
      if (device instanceof VirtualDisk) {
         return DiskSize.sizeFromKiB(((VirtualDisk) device).getCapacityInKB());
      } else {
         return new DiskSize(0);
      }
   }
View Full Code Here

TOP

Related Classes of com.vmware.aurora.global.DiskSize

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.