@@ -62,23 +62,23 @@ public Answer execute(ConvertInstanceCommand cmd, LibvirtComputingResource serve
6262 if (cmd .getCheckConversionSupport () && !serverResource .hostSupportsInstanceConversion ()) {
6363 String msg = String .format ("Cannot convert the instance %s from VMware as the virt-v2v binary is not found. " +
6464 "Please install virt-v2v%s on the host before attempting the instance conversion." , sourceInstanceName , serverResource .isUbuntuOrDebianHost ()? ", nbdkit" : "" );
65- logger .info (msg );
65+ logger .info (String . format ( "(%s) %s" , sourceInstanceName , msg ) );
6666 return new Answer (cmd , false , msg );
6767 }
6868
6969 if (!areSourceAndDestinationHypervisorsSupported (sourceHypervisorType , destinationHypervisorType )) {
7070 String err = destinationHypervisorType != Hypervisor .HypervisorType .KVM ?
7171 String .format ("The destination hypervisor type is %s, KVM was expected, cannot handle it" , destinationHypervisorType ) :
7272 String .format ("The source hypervisor type %s is not supported for KVM conversion" , sourceHypervisorType );
73- logger .error (err );
73+ logger .error (String . format ( "(%s) %s" , sourceInstanceName , err ) );
7474 return new Answer (cmd , false , err );
7575 }
7676
7777 final KVMStoragePoolManager storagePoolMgr = serverResource .getStoragePoolMgr ();
7878 KVMStoragePool temporaryStoragePool = getTemporaryStoragePool (conversionTemporaryLocation , storagePoolMgr );
7979
80- logger .info (String .format ("Attempting to convert the instance %s from %s to KVM" ,
81- sourceInstanceName , sourceHypervisorType ));
80+ logger .info (String .format ("(%s) Attempting to convert the instance %s from %s to KVM" ,
81+ sourceInstanceName , sourceInstanceName , sourceHypervisorType ));
8282 final String temporaryConvertPath = temporaryStoragePool .getLocalPath ();
8383
8484 String ovfTemplateDirOnConversionLocation ;
@@ -88,7 +88,7 @@ public Answer execute(ConvertInstanceCommand cmd, LibvirtComputingResource serve
8888 String exportInstanceOVAUrl = getExportInstanceOVAUrl (sourceInstance );
8989 if (StringUtils .isBlank (exportInstanceOVAUrl )) {
9090 String err = String .format ("Couldn't export OVA for the VM %s, due to empty url" , sourceInstanceName );
91- logger .error (err );
91+ logger .error (String . format ( "(%s) %s" , sourceInstanceName , err ) );
9292 return new Answer (cmd , false , err );
9393 }
9494
@@ -102,7 +102,7 @@ public Answer execute(ConvertInstanceCommand cmd, LibvirtComputingResource serve
102102 ovfExported = exportOVAFromVMOnVcenter (exportInstanceOVAUrl , sourceOVFDirPath , noOfThreads , sourceInstanceName , timeout );
103103 if (!ovfExported ) {
104104 String err = String .format ("Export OVA for the VM %s failed" , sourceInstanceName );
105- logger .error (err );
105+ logger .error (String . format ( "(%s) %s" , sourceInstanceName , err ) );
106106 return new Answer (cmd , false , err );
107107 }
108108 sourceOVFDirPath = String .format ("%s%s/" , sourceOVFDirPath , sourceInstanceName );
@@ -111,7 +111,9 @@ public Answer execute(ConvertInstanceCommand cmd, LibvirtComputingResource serve
111111 sourceOVFDirPath = String .format ("%s/%s/" , temporaryConvertPath , ovfTemplateDirOnConversionLocation );
112112 }
113113
114- logger .info (String .format ("Attempting to convert the OVF %s of the instance %s from %s to KVM" , ovfTemplateDirOnConversionLocation , sourceInstanceName , sourceHypervisorType ));
114+ logger .info (String .format ("(%s) Attempting to convert the OVF %s of the instance %s from %s to KVM" ,
115+ sourceInstanceName , ovfTemplateDirOnConversionLocation , sourceInstanceName , sourceHypervisorType ));
116+
115117 final String temporaryConvertUuid = UUID .randomUUID ().toString ();
116118 boolean verboseModeEnabled = serverResource .isConvertInstanceVerboseModeEnabled ();
117119
@@ -121,18 +123,18 @@ public Answer execute(ConvertInstanceCommand cmd, LibvirtComputingResource serve
121123 timeout , verboseModeEnabled , extraParams , serverResource );
122124 if (!result ) {
123125 String err = String .format (
124- "(%s) The virt-v2v conversion for the OVF %s failed. Please check the agent logs " +
126+ "The virt-v2v conversion for the OVF %s failed. Please check the agent logs " +
125127 "for the virt-v2v output. Please try on a different kvm host which " +
126128 "has a different virt-v2v version." ,
127- sourceInstanceName , ovfTemplateDirOnConversionLocation );
128- logger .error (err );
129+ ovfTemplateDirOnConversionLocation );
130+ logger .error (String . format ( "(%s) %s" , sourceInstanceName , err ) );
129131 return new Answer (cmd , false , err );
130132 }
131133 return new ConvertInstanceAnswer (cmd , temporaryConvertUuid );
132134 } catch (Exception e ) {
133135 String error = String .format ("Error converting instance %s from %s, due to: %s" ,
134136 sourceInstanceName , sourceHypervisorType , e .getMessage ());
135- logger .error (error , e );
137+ logger .error (String . format ( "(%s) %s" , sourceInstanceName , error ) , e );
136138 cleanupSecondaryStorage = true ;
137139 return new Answer (cmd , false , error );
138140 } finally {
@@ -183,7 +185,7 @@ private String getExportOVAUrlFromRemoteInstance(RemoteInstanceTO vmwareInstance
183185 String encodedUsername = encodeUsername (username );
184186 String encodedPassword = encodeUsername (password );
185187 if (StringUtils .isNotBlank (path )) {
186- logger .info ("VM path: {}" , path );
188+ logger .info ("({}) VM path: {}" , vm , path );
187189 return String .format ("vi://%s:%s@%s/%s/%s/%s" ,
188190 encodedUsername , encodedPassword , vcenter , datacenter , path , vm );
189191 }
0 commit comments