Examples of OvfCreateImportSpecResult


Examples of com.vmware.vim25.OvfCreateImportSpecResult

                                   newVmName,
                                   rp.getName(),
                                   host.getName(),
                                   datastore.getName()));
       
        OvfCreateImportSpecResult ovfImportResult = null;
        HttpNfcLease httpNfcLease = null;       

        /* create import spec */
        ovfImportResult =
            conn_.getServiceInstance().getOvfManager().createImportSpec
            (ovfDescriptor, rp, datastore, importSpecParams);

        /* import execution */
        try {
            httpNfcLease =
                rp.importVApp(ovfImportResult.getImportSpec(), vmFolder, host);
        } catch (Exception e) {
            logger_.warning("importVapp failed.");
            throw e;
        }

View Full Code Here

Examples of com.vmware.vim25.OvfCreateImportSpecResult

        importSpecParams.setDiskProvisioning(diskOption); // diskOption: thin, thick, etc
        //importSpecParams.setPropertyMapping(null);

        String ovfDescriptor = HttpNfcLeaseMO.readOvfContent(ovfFilePath);
        VmwareContext context = host.getContext();
        OvfCreateImportSpecResult ovfImportResult = context.getService().createImportSpec(
                context.getServiceContent().getOvfManager(), ovfDescriptor, morRp,
                dsMo.getMor(), importSpecParams);

        if(ovfImportResult == null) {
            String msg = "createImportSpec() failed. ovfFilePath: " + ovfFilePath + ", vmName: "
                    + vmName + ", diskOption: " + diskOption;
            s_logger.error(msg);
            throw new Exception(msg);
        }

        DatacenterMO dcMo = new DatacenterMO(context, host.getHyperHostDatacenter());
        ManagedObjectReference morLease = context.getService().importVApp(morRp,
                ovfImportResult.getImportSpec(), dcMo.getVmFolder(), morHost);
        if(morLease == null) {
            String msg = "importVApp() failed. ovfFilePath: " + ovfFilePath + ", vmName: "
                    + vmName + ", diskOption: " + diskOption;
            s_logger.error(msg);
            throw new Exception(msg);
        }
        boolean importSuccess = true;
        final HttpNfcLeaseMO leaseMo = new HttpNfcLeaseMO(context, morLease);
        HttpNfcLeaseState state = leaseMo.waitState(
                new HttpNfcLeaseState[] { HttpNfcLeaseState.READY, HttpNfcLeaseState.ERROR });
        try {
            if(state == HttpNfcLeaseState.READY) {
                final long totalBytes = HttpNfcLeaseMO.calcTotalBytes(ovfImportResult);
                File ovfFile = new File(ovfFilePath);

                HttpNfcLeaseInfo httpNfcLeaseInfo = leaseMo.getLeaseInfo();
                List<HttpNfcLeaseDeviceUrl> deviceUrls = httpNfcLeaseInfo.getDeviceUrl();
                long bytesAlreadyWritten = 0;

                final HttpNfcLeaseMO.ProgressReporter progressReporter = leaseMo.createProgressReporter();
                try {
                    for (HttpNfcLeaseDeviceUrl deviceUrl : deviceUrls) {
                        String deviceKey = deviceUrl.getImportKey();
                        for (OvfFileItem ovfFileItem : ovfImportResult.getFileItem()) {
                            if (deviceKey.equals(ovfFileItem.getDeviceId())) {
                                String absoluteFile = ovfFile.getParent() + File.separator + ovfFileItem.getPath();
                                String urlToPost = deviceUrl.getUrl();
                                urlToPost = resolveHostNameInUrl(dcMo, urlToPost);
View Full Code Here

Examples of com.vmware.vim25.OvfCreateImportSpecResult

        importSpecParams.setDiskProvisioning(diskOption); // diskOption: thin, thick, etc
        //importSpecParams.setPropertyMapping(null);

        String ovfDescriptor = HttpNfcLeaseMO.readOvfContent(ovfFilePath);
        VmwareContext context = host.getContext();
        OvfCreateImportSpecResult ovfImportResult =
                context.getService().createImportSpec(context.getServiceContent().getOvfManager(), ovfDescriptor, morRp, dsMo.getMor(), importSpecParams);

        if (ovfImportResult == null) {
            String msg = "createImportSpec() failed. ovfFilePath: " + ovfFilePath + ", vmName: " + vmName + ", diskOption: " + diskOption;
            s_logger.error(msg);
            throw new Exception(msg);
        }

        if(!ovfImportResult.getError().isEmpty()) {
            for (LocalizedMethodFault fault : ovfImportResult.getError()) {
                s_logger.error("createImportSpec error: " + fault.getLocalizedMessage());
            }
            throw new CloudException("Failed to create an import spec from " + ovfFilePath + ". Check log for details.");
        }

        if (!ovfImportResult.getWarning().isEmpty()) {
            for (LocalizedMethodFault fault : ovfImportResult.getError()) {
                s_logger.warn("createImportSpec warning: " + fault.getLocalizedMessage());
            }
        }

        DatacenterMO dcMo = new DatacenterMO(context, host.getHyperHostDatacenter());
        ManagedObjectReference morLease = context.getService().importVApp(morRp, ovfImportResult.getImportSpec(), dcMo.getVmFolder(), morHost);
        if (morLease == null) {
            String msg = "importVApp() failed. ovfFilePath: " + ovfFilePath + ", vmName: " + vmName + ", diskOption: " + diskOption;
            s_logger.error(msg);
            throw new Exception(msg);
        }
        boolean importSuccess = true;
        final HttpNfcLeaseMO leaseMo = new HttpNfcLeaseMO(context, morLease);
        HttpNfcLeaseState state = leaseMo.waitState(new HttpNfcLeaseState[] {HttpNfcLeaseState.READY, HttpNfcLeaseState.ERROR});
        try {
            if (state == HttpNfcLeaseState.READY) {
                final long totalBytes = HttpNfcLeaseMO.calcTotalBytes(ovfImportResult);
                File ovfFile = new File(ovfFilePath);

                HttpNfcLeaseInfo httpNfcLeaseInfo = leaseMo.getLeaseInfo();
                List<HttpNfcLeaseDeviceUrl> deviceUrls = httpNfcLeaseInfo.getDeviceUrl();
                long bytesAlreadyWritten = 0;

                final HttpNfcLeaseMO.ProgressReporter progressReporter = leaseMo.createProgressReporter();
                try {
                    for (HttpNfcLeaseDeviceUrl deviceUrl : deviceUrls) {
                        String deviceKey = deviceUrl.getImportKey();
                        for (OvfFileItem ovfFileItem : ovfImportResult.getFileItem()) {
                            if (deviceKey.equals(ovfFileItem.getDeviceId())) {
                                String absoluteFile = ovfFile.getParent() + File.separator + ovfFileItem.getPath();
                                String urlToPost = deviceUrl.getUrl();
                                urlToPost = resolveHostNameInUrl(dcMo, urlToPost);
View Full Code Here

Examples of com.vmware.vim25.OvfCreateImportSpecResult

        importSpecParams.setDiskProvisioning(diskOption); // diskOption: thin, thick, etc
        //importSpecParams.setPropertyMapping(null);

        String ovfDescriptor = HttpNfcLeaseMO.readOvfContent(ovfFilePath);
        VmwareContext context = host.getContext();
        OvfCreateImportSpecResult ovfImportResult = context.getService().createImportSpec(
                context.getServiceContent().getOvfManager(), ovfDescriptor, morRp,
                dsMo.getMor(), importSpecParams);

        if(ovfImportResult == null) {
            String msg = "createImportSpec() failed. ovfFilePath: " + ovfFilePath + ", vmName: "
                    + vmName + ", diskOption: " + diskOption;
            s_logger.error(msg);
            throw new Exception(msg);
        }

        DatacenterMO dcMo = new DatacenterMO(context, host.getHyperHostDatacenter());
        ManagedObjectReference morLease = context.getService().importVApp(morRp,
                ovfImportResult.getImportSpec(), dcMo.getVmFolder(), morHost);
        if(morLease == null) {
            String msg = "importVApp() failed. ovfFilePath: " + ovfFilePath + ", vmName: "
                    + vmName + ", diskOption: " + diskOption;
            s_logger.error(msg);
            throw new Exception(msg);
        }
        boolean importSuccess = true;
        final HttpNfcLeaseMO leaseMo = new HttpNfcLeaseMO(context, morLease);
        HttpNfcLeaseState state = leaseMo.waitState(
                new HttpNfcLeaseState[] { HttpNfcLeaseState.READY, HttpNfcLeaseState.ERROR });
        try {
            if(state == HttpNfcLeaseState.READY) {
                final long totalBytes = HttpNfcLeaseMO.calcTotalBytes(ovfImportResult);
                File ovfFile = new File(ovfFilePath);

                HttpNfcLeaseInfo httpNfcLeaseInfo = leaseMo.getLeaseInfo();
                List<HttpNfcLeaseDeviceUrl> deviceUrls = httpNfcLeaseInfo.getDeviceUrl();
                long bytesAlreadyWritten = 0;

                final HttpNfcLeaseMO.ProgressReporter progressReporter = leaseMo.createProgressReporter();
                try {
                    for (HttpNfcLeaseDeviceUrl deviceUrl : deviceUrls) {
                        String deviceKey = deviceUrl.getImportKey();
                        for (OvfFileItem ovfFileItem : ovfImportResult.getFileItem()) {
                            if (deviceKey.equals(ovfFileItem.getDeviceId())) {
                                String absoluteFile = ovfFile.getParent() + File.separator + ovfFileItem.getPath();
                                String urlToPost = deviceUrl.getUrl();
                                urlToPost = resolveHostNameInUrl(dcMo, urlToPost);
View Full Code Here

Examples of com.vmware.vim25.OvfCreateImportSpecResult

    importSpecParams.setNetworkMapping(new OvfNetworkMapping[] { networkMapping });
*/   
    importSpecParams.setPropertyMapping(null);
   
    String ovfDescriptor = readOvfContent("C:\\research\\vmware\\winxpsp3-ovf\\winxpsp3-ovf.ovf");
    OvfCreateImportSpecResult ovfImportResult = cb.getServiceConnection3().getService().createImportSpec(
      morOvf, ovfDescriptor, morRp, morDs, importSpecParams);
   
    if(ovfImportResult != null) {
      long totalBytes = addTotalBytes(ovfImportResult);
     
      ManagedObjectReference morLease = cb.getServiceConnection3().getService().importVApp(morRp,
        ovfImportResult.getImportSpec(), morVmFolder, morHost);
     
      HttpNfcLeaseState state;
      for(;;) {
        state = (HttpNfcLeaseState)cb.getServiceUtil3().getDynamicProperty(morLease, "state");
        if(state == HttpNfcLeaseState.ready || state == HttpNfcLeaseState.error)
          break;
      }
     
      if(state == HttpNfcLeaseState.ready) {
        HttpNfcLeaseInfo httpNfcLeaseInfo = (HttpNfcLeaseInfo)cb.getServiceUtil3().getDynamicProperty(morLease, "info");
            HttpNfcLeaseDeviceUrl[] deviceUrls = httpNfcLeaseInfo.getDeviceUrl()
            long bytesAlreadyWritten = 0
            for (HttpNfcLeaseDeviceUrl deviceUrl : deviceUrls) {
             
              String deviceKey = deviceUrl.getImportKey()
              for (OvfFileItem ovfFileItem : ovfImportResult.getFileItem()) { 
                if (deviceKey.equals(ovfFileItem.getDeviceId())) { 
                  System.out.println("Import key==OvfFileItem device id: " + deviceKey);
                  System.out.println("device URL: " + deviceUrl.getUrl());
                 
                  String absoluteFile = "C:\\research\\vmware\\winxpsp3-ovf\\" + ovfFileItem.getPath();
View Full Code Here

Examples of com.vmware.vim25.OvfCreateImportSpecResult

        importSpecParams.setDiskProvisioning(diskOption); // diskOption: thin, thick, etc
        //importSpecParams.setPropertyMapping(null);

        String ovfDescriptor = HttpNfcLeaseMO.readOvfContent(ovfFilePath);
        VmwareContext context = host.getContext();
        OvfCreateImportSpecResult ovfImportResult = context.getService().createImportSpec(
                context.getServiceContent().getOvfManager(), ovfDescriptor, morRp,
                dsMo.getMor(), importSpecParams);

        if(ovfImportResult == null) {
            String msg = "createImportSpec() failed. ovfFilePath: " + ovfFilePath + ", vmName: "
                    + vmName + ", diskOption: " + diskOption;
            s_logger.error(msg);
            throw new Exception(msg);
        }

        if(!ovfImportResult.getError().isEmpty()) {
            for (LocalizedMethodFault fault : ovfImportResult.getError()) {
                s_logger.error("createImportSpec error: " + fault.getLocalizedMessage());
            }
            throw new CloudException("Failed to create an import spec from " + ovfFilePath + ". Check log for details.");
        }

        if (!ovfImportResult.getWarning().isEmpty()) {
            for (LocalizedMethodFault fault : ovfImportResult.getError()) {
                s_logger.warn("createImportSpec warning: " + fault.getLocalizedMessage());
            }
        }

        DatacenterMO dcMo = new DatacenterMO(context, host.getHyperHostDatacenter());
        ManagedObjectReference morLease = context.getService().importVApp(morRp,
                ovfImportResult.getImportSpec(), dcMo.getVmFolder(), morHost);
        if(morLease == null) {
            String msg = "importVApp() failed. ovfFilePath: " + ovfFilePath + ", vmName: "
                    + vmName + ", diskOption: " + diskOption;
            s_logger.error(msg);
            throw new Exception(msg);
        }
        boolean importSuccess = true;
        final HttpNfcLeaseMO leaseMo = new HttpNfcLeaseMO(context, morLease);
        HttpNfcLeaseState state = leaseMo.waitState(
                new HttpNfcLeaseState[] { HttpNfcLeaseState.READY, HttpNfcLeaseState.ERROR });
        try {
            if(state == HttpNfcLeaseState.READY) {
                final long totalBytes = HttpNfcLeaseMO.calcTotalBytes(ovfImportResult);
                File ovfFile = new File(ovfFilePath);

                HttpNfcLeaseInfo httpNfcLeaseInfo = leaseMo.getLeaseInfo();
                List<HttpNfcLeaseDeviceUrl> deviceUrls = httpNfcLeaseInfo.getDeviceUrl();
                long bytesAlreadyWritten = 0;

                final HttpNfcLeaseMO.ProgressReporter progressReporter = leaseMo.createProgressReporter();
                try {
                    for (HttpNfcLeaseDeviceUrl deviceUrl : deviceUrls) {
                        String deviceKey = deviceUrl.getImportKey();
                        for (OvfFileItem ovfFileItem : ovfImportResult.getFileItem()) {
                            if (deviceKey.equals(ovfFileItem.getDeviceId())) {
                                String absoluteFile = ovfFile.getParent() + File.separator + ovfFileItem.getPath();
                                String urlToPost = deviceUrl.getUrl();
                                urlToPost = resolveHostNameInUrl(dcMo, urlToPost);
View Full Code Here

Examples of com.vmware.vim25.OvfCreateImportSpecResult

    importSpecParams.setDiskProvisioning(diskOption); // diskOption: thin, thick, etc
    importSpecParams.setPropertyMapping(null);
   
    String ovfDescriptor = HttpNfcLeaseMO.readOvfContent(ovfFilePath);
    VmwareContext context = host.getContext();
    OvfCreateImportSpecResult ovfImportResult = context.getService().createImportSpec(
      context.getServiceContent().getOvfManager(), ovfDescriptor, morRp,
      dsMo.getMor(), importSpecParams);
   
    if(ovfImportResult == null) {
      String msg = "createImportSpec() failed. ovfFilePath: " + ovfFilePath + ", vmName: "
        + vmName + ", diskOption: " + diskOption;
      s_logger.error(msg);
      throw new Exception(msg);
    }
   
    DatacenterMO dcMo = new DatacenterMO(context, host.getHyperHostDatacenter());
    ManagedObjectReference morLease = context.getService().importVApp(morRp,
      ovfImportResult.getImportSpec(), dcMo.getVmFolder(), morHost);
    if(morLease == null) {
      String msg = "importVApp() failed. ovfFilePath: " + ovfFilePath + ", vmName: "
        + vmName + ", diskOption: " + diskOption;
      s_logger.error(msg);
      throw new Exception(msg);
    }
    final HttpNfcLeaseMO leaseMo = new HttpNfcLeaseMO(context, morLease);
    HttpNfcLeaseState state = leaseMo.waitState(
      new HttpNfcLeaseState[] { HttpNfcLeaseState.ready, HttpNfcLeaseState.error });
    try {
      if(state == HttpNfcLeaseState.ready) {
        final long totalBytes = HttpNfcLeaseMO.calcTotalBytes(ovfImportResult);
        File ovfFile = new File(ovfFilePath);
       
        HttpNfcLeaseInfo httpNfcLeaseInfo = leaseMo.getLeaseInfo();
            HttpNfcLeaseDeviceUrl[] deviceUrls = httpNfcLeaseInfo.getDeviceUrl()
            long bytesAlreadyWritten = 0;
           
            final HttpNfcLeaseMO.ProgressReporter progressReporter = leaseMo.createProgressReporter();
            try {
              for (HttpNfcLeaseDeviceUrl deviceUrl : deviceUrls) {
                String deviceKey = deviceUrl.getImportKey()
                for (OvfFileItem ovfFileItem : ovfImportResult.getFileItem()) {
                  if (deviceKey.equals(ovfFileItem.getDeviceId())) { 
                    String absoluteFile = ovfFile.getParent() + File.separator + ovfFileItem.getPath();
                    String urlToPost = deviceUrl.getUrl();
                    urlToPost = resolveHostNameInUrl(dcMo, urlToPost);
                   
View Full Code Here

Examples of com.vmware.vim25.OvfCreateImportSpecResult

    importSpecParams.setDiskProvisioning(diskOption); // diskOption: thin, thick, etc
    importSpecParams.setPropertyMapping(null);
   
    String ovfDescriptor = HttpNfcLeaseMO.readOvfContent(ovfFilePath);
    VmwareContext context = host.getContext();
    OvfCreateImportSpecResult ovfImportResult = context.getService().createImportSpec(
      context.getServiceContent().getOvfManager(), ovfDescriptor, morRp,
      dsMo.getMor(), importSpecParams);
   
    if(ovfImportResult == null) {
      String msg = "createImportSpec() failed. ovfFilePath: " + ovfFilePath + ", vmName: "
        + vmName + ", diskOption: " + diskOption;
      s_logger.error(msg);
      throw new Exception(msg);
    }
   
    DatacenterMO dcMo = new DatacenterMO(context, host.getHyperHostDatacenter());
    ManagedObjectReference morLease = context.getService().importVApp(morRp,
      ovfImportResult.getImportSpec(), dcMo.getVmFolder(), morHost);
    if(morLease == null) {
      String msg = "importVApp() failed. ovfFilePath: " + ovfFilePath + ", vmName: "
        + vmName + ", diskOption: " + diskOption;
      s_logger.error(msg);
      throw new Exception(msg);
    }
        boolean importSuccess = true;
    final HttpNfcLeaseMO leaseMo = new HttpNfcLeaseMO(context, morLease);
    HttpNfcLeaseState state = leaseMo.waitState(
      new HttpNfcLeaseState[] { HttpNfcLeaseState.ready, HttpNfcLeaseState.error });
    try {
      if(state == HttpNfcLeaseState.ready) {
        final long totalBytes = HttpNfcLeaseMO.calcTotalBytes(ovfImportResult);
        File ovfFile = new File(ovfFilePath);
       
        HttpNfcLeaseInfo httpNfcLeaseInfo = leaseMo.getLeaseInfo();
            HttpNfcLeaseDeviceUrl[] deviceUrls = httpNfcLeaseInfo.getDeviceUrl()
            long bytesAlreadyWritten = 0;
           
            final HttpNfcLeaseMO.ProgressReporter progressReporter = leaseMo.createProgressReporter();
            try {
              for (HttpNfcLeaseDeviceUrl deviceUrl : deviceUrls) {
                String deviceKey = deviceUrl.getImportKey()
                for (OvfFileItem ovfFileItem : ovfImportResult.getFileItem()) {
                  if (deviceKey.equals(ovfFileItem.getDeviceId())) { 
                    String absoluteFile = ovfFile.getParent() + File.separator + ovfFileItem.getPath();
                    String urlToPost = deviceUrl.getUrl();
                    urlToPost = resolveHostNameInUrl(dcMo, urlToPost);
                   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.