@@ -3403,13 +3403,15 @@ public void detachAndAttachConfigDriveISO(final Connect conn, final String vmNam
34033403 }
34043404 if (configdrive != null ) {
34053405 try {
3406+ s_logger .debug (String .format ("Detaching ConfigDrive ISO of the VM %s, at path %s" , vmName , configdrive .getDiskPath ()));
34063407 String result = attachOrDetachISO (conn , vmName , configdrive .getDiskPath (), false , CONFIG_DRIVE_ISO_DEVICE_ID );
34073408 if (result != null ) {
3408- s_logger .warn ("Detach ConfigDrive ISO with result : " + result );
3409+ s_logger .warn (String . format ( "Detach ConfigDrive ISO of the VM %s, at path %s with %s : " , vmName , configdrive . getDiskPath (), result ) );
34093410 }
3411+ s_logger .debug (String .format ("Attaching ConfigDrive ISO of the VM %s, at path %s" , vmName , configdrive .getDiskPath ()));
34103412 result = attachOrDetachISO (conn , vmName , configdrive .getDiskPath (), true , CONFIG_DRIVE_ISO_DEVICE_ID );
34113413 if (result != null ) {
3412- s_logger .warn ("Attach ConfigDrive ISO with result : " + result );
3414+ s_logger .warn (String . format ( "Attach ConfigDrive ISO of the VM %s, at path %s with %s : " , vmName , configdrive . getDiskPath (), result ) );
34133415 }
34143416 } catch (final LibvirtException | InternalErrorException | URISyntaxException e ) {
34153417 final String msg = "Detach and attach ConfigDrive ISO failed due to " + e .toString ();
@@ -3421,7 +3423,7 @@ public void detachAndAttachConfigDriveISO(final Connect conn, final String vmNam
34213423 public synchronized String attachOrDetachISO (final Connect conn , final String vmName , String isoPath , final boolean isAttach , final Integer diskSeq ) throws LibvirtException , URISyntaxException ,
34223424 InternalErrorException {
34233425 final DiskDef iso = new DiskDef ();
3424- if (isoPath != null && isAttach ) {
3426+ if (isAttach && StringUtils . isNotBlank ( isoPath ) && isoPath . lastIndexOf ( "/" ) > 0 ) {
34253427 final int index = isoPath .lastIndexOf ("/" );
34263428 final String path = isoPath .substring (0 , index );
34273429 final String name = isoPath .substring (index + 1 );
0 commit comments