Microsoft Virtualization Discussions

Invoke-NaSsh or Start-NaNdmpcopy and character encoding

mark_schuren
4,386 Views

Hi,

 

I'm struggling with automating ndmpcopy in a Powershell script.

It works, but only with English (ASCII) characters.

 

Example code:

 

#prepare

import-module dataontap
$cred= (Get-Credential)         # provided root password
$controller = Connect-NaController ucnlabfiler07 -Credential $cred

$srcdir = "/vol/volroot/home/gut"

$dstdir = "/vol/volroot/home/restore"

 

#both directories already exist on same controller, just for testing

 

#start ndmpcopy

$copy = Start-NaNdmpCopy -SrcController $controller.Address -SrcPath $srcdir -DstController $controller.Address -DstPath $dstdir -SrcCredential $cred -DstCredential $cred -SrcAuthType Md5 -DstAuthType Md5

 

# After some time, fetch the result

 

Get-NaNdmpCopy

 

Id State SrcPath DstPath BackupBytesProcessed BackupBytesRemain
-- ----- ------- ------- -------------------- -----------------
1 SUCCESS /vol/volroot/home/gut /vol/volroot/home/restore/ 23 KB 0

 

So, it's generally working fine.

 

Same also works by invoking ndmpcopy through SSH

 

Invoke-NaSsh -Command "ndmpcopy $($srcdir) $($dstdir)"

 

Ndmpcopy: Starting copy [ 4 ] ...
Ndmpcopy: ucnlabfiler07: Notify: Connection established
Ndmpcopy: ucnlabfiler07: Notify: Connection established
Ndmpcopy: ucnlabfiler07: Connect: Authentication successful
Ndmpcopy: ucnlabfiler07: Connect: Authentication successful
Ndmpcopy: ucnlabfiler07: Log: DUMP: creating "/vol/volroot/../snapshot_for_backup.48841" snapshot.
Ndmpcopy: ucnlabfiler07: Log: DUMP: Using subtree dump
Ndmpcopy: ucnlabfiler07: Log: DUMP: Date of this level 0 dump: Sun May 3 12:17:43 2015.
Ndmpcopy: ucnlabfiler07: Log: DUMP: Date of last level 0 dump: the epoch.
Ndmpcopy: ucnlabfiler07: Log: DUMP: Dumping /vol/volroot/home/gut to NDMP connection
Ndmpcopy: ucnlabfiler07: Log: DUMP: mapping (Pass I)[regular files]
Ndmpcopy: ucnlabfiler07: Log: DUMP: mapping (Pass II)[directories]
Ndmpcopy: ucnlabfiler07: Log: DUMP: estimated 5 KB.
Ndmpcopy: ucnlabfiler07: Log: DUMP: dumping (Pass III) [directories]
Ndmpcopy: ucnlabfiler07: Log: DUMP: dumping (Pass IV) [regular files]
Ndmpcopy: ucnlabfiler07: Log: ACL_START is '16384'
Ndmpcopy: ucnlabfiler07: Log: DUMP: dumping (Pass V) [ACLs]
Ndmpcopy: ucnlabfiler07: Log: RESTORE: Sun May 3 12:17:46 2015: Begin level 0 restore
Ndmpcopy: ucnlabfiler07: Log: RESTORE: Sun May 3 12:17:46 2015: Reading directories from the backup
Ndmpcopy: ucnlabfiler07: Log: RESTORE: Sun May 3 12:17:47 2015: Creating files and directories.
Ndmpcopy: ucnlabfiler07: Log: DUMP: 23 KB
Ndmpcopy: ucnlabfiler07: Log: RESTORE: Sun May 3 12:17:47 2015: Writing data to files.
Ndmpcopy: ucnlabfiler07: Log: RESTORE: Sun May 3 12:17:47 2015: Restoring NT ACLs.
Ndmpcopy: ucnlabfiler07: Log: DUMP: DUMP IS DONE
Ndmpcopy: ucnlabfiler07: Log: RESTORE: RESTORE IS DONE
Ndmpcopy: ucnlabfiler07: Log: DUMP: Deleting "/vol/volroot/../snapshot_for_backup.48841" snapshot.
Ndmpcopy: ucnlabfiler07: Notify: restore successful
Ndmpcopy: ucnlabfiler07: Log: DUMP_DATE is '5725615559'
Ndmpcopy: ucnlabfiler07: Notify: dump successful
Ndmpcopy: Transfer successful [ 0 hours, 0 minutes, 9 seconds ]
Ndmpcopy: Done

 

 

However, as soon as one of my source or destination path components contains non-English characters, both approaches break:

 

$srcdir = "/vol/volroot/home/blöd"

$dstdir = "/vol/volroot/home/restore"

 

$copy = Start-NaNdmpCopy -SrcController $controller.Address -SrcPath $srcdir -DstController $controller.Address -DstPath $dstdir -SrcCredential $cred -DstCredential $cred -SrcAuthType Md5 -DstAuthType Md5

#wait a moment

$result = Get-NaNdmpCopy

 

$result

 

Id State SrcPath DstPath BackupBytesProcessed BackupBytesRemain
-- ----- ------- ------- -------------------- -----------------
2 FAILED /vol/volroot/home/blöd /vol/volroot/home/restore/ 0 0

 

$result.LogMessages

 

[10.230.1.7] Log Message: LogType=2, MessageId=1, Message=DATA: Operation terminated: backup configuration failure (2) on RPC error: ERROR: BAD ENV OP (for /vol/volroot/home/bl\0366d)

 

Same happens with SSH invocation:

 

PS C:\Users\mark> Invoke-NaSsh -Name $controller.Address -Credential $cred -Command "ndmpcopy $($srcdir) $($dstdir)"
Ndmpcopy: Starting copy [ 5 ] ...
Ndmpcopy: ucnlabfiler07: Notify: Connection established
Ndmpcopy: ucnlabfiler07: Notify: Connection established
Ndmpcopy: ucnlabfiler07: Connect: Authentication successful
Ndmpcopy: ucnlabfiler07: Connect: Authentication successful
Ndmpcopy: ucnlabfiler07: Log: DATA: Operation terminated: backup configuration failure (2) on RPC error: ERROR: BAD ENV OP (for /vol/volroot/home/bl\0366d)
Ndmpcopy: ucnlabfiler07: Connection halted: HALT: Internal error!
Ndmpcopy: ucnlabfiler07: Log: RESTORE: Error: Read Socket received EOF.
Ndmpcopy: Notify: Transfer failed
Ndmpcopy: Done

 

Other cmdlets like Read-NaDirectory or New-NaDirectory accept (and return) the umlaut:

 

Read-NaDirectory /vol/volroot/home/blöd

 

Name Type Size Created Modified Owner Group Perm Empty
---- ---- ---- ------- -------- ----- ----- ---- -----
. directory 4 KB 03.05.2015 03.05.2015 0 1 777 False
.. directory 4 KB 24.03.2012 03.05.2015 0 0 1777 False
hässlich.txt file 59 KB 03.05.2015 03.05.2015 0 1 777

 

I just can't get ndmpcopy to work with umlauts Smiley Mad

 

My (root) volume language on the filer is de.UTF-8. My Powershell host is a German Windows 8.1.

 

I can successfully run the ndmpcopy command (including umlauts in path names) from a PuTTY session to the same controller. But cannot using PoSh.

 

I alread played with

 

$OutputEncoding =[System.Text.Encoding]::UTF8

 

$OutputEncoding =[System.Text.Encoding]::Default

 

but the Invoke-Na* cmdlets seem to ignore it.

 

It's driving me crazy - I'm out of ideas.

 

Can anyone point me to the right direction?

1 REPLY 1

mark_schuren
3,439 Views

This was fixed in Netapp Powershell Toolkit 4.0.0.

 

However - same error now came back in toolkit 4.1.0.

 

😞

Public