PowerShell script exchange
Post Reply
moignon
Novice
Posts: 5
Liked: never
Joined: Feb 24, 2014 6:04 pm
Contact:

Issues with cmdlet Start-VBRQuickMigration

Post by moignon »

Hi everyone,

I'm trying to write a little script to migrate VM between two ESXi hosts. However, I'm running into error with following error:

Code: Select all

Start-VBRQuickMigration : Host 'esx-test-bc.xxxx.local' with type 'ESX' and parentId 'fe845ede-59b7-4555-b45a-4f8ee5
0f52a4' not found.
At C:\Users\moignon\Desktop\FromTemplates\sandbox.ps1:73 char:25
+     Start-VBRQuickMigration <<<<  -Entity $vmToMigrate -Server $hostEsxDest -Datastore $d -ForceVeeamQM
    + CategoryInfo          : NotSpecified: (:) [Start-VBRQuickMigration], Exception
    + FullyQualifiedErrorId : System.Exception,Veeam.Backup.PowerShell.Command.StartVBRQuickMigration
I don't know what I'm doing wrong, even if I write the command, it doesn't work. But through GUI, it's works perfectly.

Here is what I'm doing:

[*]First, I get my reference to ESXi source

Code: Select all

PS C:\Users\moignon\Desktop\FromTemplates> $hostEsxSrc = Get-VBRServer -Name "192.16.21.15"
PS C:\Users\moignon\Desktop\FromTemplates> $hostEsxSrc


Info               : 192.16.21.15
ParentId           : 00000000-0000-0000-0000-000000000000
Id                 : fe845ede-59b7-4555-b45a-4f8ee50f52a4
Name               : 192.16.21.15
RealName           : 192.16.21.15
Reference          : ha-host
Description        : Created by Powershell at 2/24/2014 6:56:45 PM.
IsUnavailable      : False
Type               : ESXi
ApiVersion         : V50
PhysHostId         : c1430ddf-12f9-4f94-960c-8a7e7da0bdd5
ProxyServicesCreds :
As we can see, it seems fine (even if I don't know what's represent "ParentId").

[*]Then, I get the reference of my VM:

Code: Select all

PS C:\Users\moignon\Desktop\FromTemplates> $vmToMigrate = Find-VBRViEntity -Server $hostEsxSrc -Name "VM-Test"
PS C:\Users\moignon\Desktop\FromTemplates> $vmToMigrate


ConnHost        : Veeam.Backup.Core.CHost
Type            : Vm
Reference       : 9
Id              : fe845ede-59b7-4555-b45a-4f8ee50f52a4_9
Name            : VM-Test
Path            : 192.16.21.15\VM-Test
VmHostName      : esx-test-bc.xxxx.local
VmFolderName    : vm
FaultTolerance  : False
GuestInfo       : Veeam.Backup.Model.CGuestInfo
Uuid            : 564d61f2-6fa7-f29f-4f93-a091433c03c0
PowerState      : PoweredOff
IsTemplate      : False
ProvisionedSize : 19489949324
UsedSize        : 2982151820
ConnHostId      : fe845ede-59b7-4555-b45a-4f8ee50f52a4
As we can see, it's seems okay too.

[*]Then, I get the reference to my Destination ESX:

Code: Select all

PS C:\Users\moignon\Desktop\FromTemplates> $hostEsxDest =  Get-VBRServer -Name "190.63.255.21"
PS C:\Users\moignon\Desktop\FromTemplates> $hostEsxDest


Info               : 190.63.255.21
ParentId           : 00000000-0000-0000-0000-000000000000
Id                 : 9ccffa75-3270-4467-8014-d8862d410d99
Name               : 190.63.255.21
RealName           : 190.63.255.21
Reference          : ha-host
Description        : Created by Powershell at 2/24/2014 7:13:41 PM.
IsUnavailable      : False
Type               : ESXi
ApiVersion         : V55
PhysHostId         : 51d7fbd4-d35a-4337-b6b4-e73123277c27
ProxyServicesCreds :
[*]Then, I get the reference to my destination datastore (optionnal but for showing that I can get both reference with objets $hostEsxDest AND $hostEsxSrc (the $vmtomigrate))

Code: Select all

PS C:\Users\moignon\Desktop\FromTemplates> $d = Find-VBRViDatastore -Server $hostEsxDest
PS C:\Users\moignon\Desktop\FromTemplates> $d


IsVSAN    : False
ConnHost  : Veeam.Backup.Core.CHost
Type      : Datastore
Reference : 52cbdff5-2b0ca385-31e3-b8ca3a69ec38
Capacity  : 891205713920
FreeSpace : 336815194112
Id        : 9ccffa75-3270-4467-8014-d8862d410d99_52cbdff5-2b0ca385-31e3-b8ca3a69ec38
Name      : datastore1
Path      :
[*]And Finally, I try to run the migration with this command and it fails:

Code: Select all

PS C:\Users\moignon\Desktop\FromTemplates> Start-VBRQuickMigration -Entity $vmToMigrate -Server $hostEsxDest -Datastore
$d -ForceVeeamQM
Start-VBRQuickMigration : Host 'esx-test-bc.xxxx.local' with type 'ESX' and parentId 'fe845ede-59b7-4555-b45a-4f8ee5
0f52a4' not found.
At line:1 char:24
+ Start-VBRQuickMigration <<<<  -Entity $vmToMigrate -Server $hostEsxDest -Datastore $d -ForceVeeamQM
    + CategoryInfo          : NotSpecified: (:) [Start-VBRQuickMigration], Exception
    + FullyQualifiedErrorId : System.Exception,Veeam.Backup.PowerShell.Command.StartVBRQuickMigration
Does somebody have the same issue ?

Am I adding the host correctly ? I used this syntax:
[Veeam.Backup.Core.CHost]$hostEsx = Add-VBRESXi -Name "$ip_host" -User $LOGIN -Password $PASSWORD

I also added in my host file the IP and hostname of my source server but it seems to be a DNS issues ?

Thank you for your help
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Issues with cmdlet Start-VBRQuickMigration

Post by veremin »

Strange behavior, indeed.

According to the error log, the $hostEsxDest variable refers to the host with the name 'esx-test-bc.xxxx.local' and parentId 'fe845ede-59b7-4555-b45a-4f8ee5-0f52a4', meanwhile, the host you've specified has different name and parentID. More interesting, the parentID seems to be the ID of the "source" host.
Am I adding the host correctly ?
You don't need to save the result to the variable; just use the corresponding cmdlets: Add-VBRESX or Add-VBRESXi.

Thanks.
moignon
Novice
Posts: 5
Liked: never
Joined: Feb 24, 2014 6:04 pm
Contact:

Re: Issues with cmdlet Start-VBRQuickMigration

Post by moignon »

Thank you Eremin for reading my post.
v.Eremin wrote: You don't need to save the result to the variable; just use the corresponding cmdlets: Add-VBRESX or Add-VBRESXi.
.
In fast, I've made a function that create the host if it's not exists:

Code: Select all


function VEEAMConnectToESXi([string]$ipESX, [string]$loginESXsource, [string]$passwordESXsourceUnsecure)
{
	#First step, trying to get ESXi host
	[Veeam.Backup.Core.CHost]$hostEsx = Get-VBRServer -Type "ESXi" -Name "$source_host"
	
	if ([Veeam.Backup.Core.CHost]$hostEsx -eq $null)
	{
		#If not found, we need to add it to VEEAM console
		[Veeam.Backup.Core.CHost]$hostEsx = Add-VBRESXi -Name "$source_host" -User $loginESXsource -Password $passwordESXsourceUnsecure
		if ([Veeam.Backup.Core.CHost]$hostEsx -eq $null) {
			throw "ERROR: Can't add server ${source_host} please check CSV file"
		}
	}
	return [Veeam.Backup.Core.CHost]$hostEsx
}
As you may notice with the error message, I will parse a csv file and first try to get all reference to see if all the migration process can be launch (in case of bad user input :twisted: ) that's why I use variable to save the different result.

Do you recommand to try this on 6.5 ?
nefes
Veeam Software
Posts: 643
Liked: 162 times
Joined: Dec 10, 2012 8:44 am
Full Name: Nikita Efes
Contact:

Re: Issues with cmdlet Start-VBRQuickMigration

Post by nefes »

Is there a chance that VCenter containing that ESXi server already added to Veeam B&R console?
moignon
Novice
Posts: 5
Liked: never
Joined: Feb 24, 2014 6:04 pm
Contact:

Re: Issues with cmdlet Start-VBRQuickMigration

Post by moignon »

Hi Nefes, there is not vCenter, these are ESXi hosts in standalone mode with this license: "Product: VMware vSphere 5 Standard Licensed for 2 physical CPUs (unlimited cores per CPU)"
One is in 5.5 the other in 5.0.
FYI, I've of course installed the patch 3 of Veeam.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Issues with cmdlet Start-VBRQuickMigration

Post by veremin »

Solely for the testing purpose you can try to avoid using the mentioned function and see whether it makes any difference.

If I were you, I would, probably, write simple script, similar to the following, and see how well it goes:

Code: Select all

Add-VBRESXi -Name "$source_host" -User $loginESXsource -Password $passwordESXsourceUnsecure
$hostEsxDest =  Get-VBRServer -Name "190.63.255.21" # try both: IP/DNS
$vmToMigrate = Find-VBRViEntity -Server $hostEsxSrc -Name "VM-Test"
Start-VBRQuickMigration -Entity $vmToMigrate -Server $hostEsxDest
I would try both adding ESX(I) host via IP and adding it via DNS name. Also, it might be worth trying to migrate VM to the host that has been already added to the backup console.

Thanks.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Issues with cmdlet Start-VBRQuickMigration

Post by veremin »

I have just checked this behavior with QA team, and there seems to be a bug related Start-VBRQuickMigration commandlet. The commandlet uses wrong method, unexpectedly looking for child host objects on the specified standalone host. As the result, this commandlet can only used in conjunction with with vCenter server, not with standalone hosts.

This was confirmed to be a bug, and, probably, will be fixed in the next product release.

Thanks.
moignon
Novice
Posts: 5
Liked: never
Joined: Feb 24, 2014 6:04 pm
Contact:

Re: Issues with cmdlet Start-VBRQuickMigration

Post by moignon »

Thank you for this investigation.

For your information, I ran the asked tests and of course there are failed:
If it can help, here is my scenario:

Code: Select all

test1:   $hostsrc: fqdn       $hostdst: fqdn 
test2:   $hostsrc: ip           $hostdst: fqdn 
test3:   $hostsrc: ip           $hostdst: ip
test4:   $hostsrc: fqdn       $hostdst: ip
With a script like this one:

Code: Select all

Add-VBRESXi -Name $hostsrc -User "root" -Password $passwordESXsourceUnsecure
Add-VBRESXi -Name $hostdst -User "root" -Password $passwordESXsourceUnsecure
$hostEsxSrc = Get-VBRServer -Name $hostsrc # try both: IP/DNS
$hostEsxDest = Get-VBRServer -Name $hostdst # try both: IP/DNS
$vmToMigrate = Find-VBRViEntity -Server $hostEsxSrc -Name "VM-Test-BriceCrunchant"
Start-VBRQuickMigration -Entity $vmToMigrate -Server $hostEsxDest

And the output

Code: Select all

Test1
src: dns   dst: dns  
PS C:\Users\moignon\Desktop\FromTemplates> .\sandbox2.ps1


Info               : esx-test-bc.xxxx.local
ParentId           : 00000000-0000-0000-0000-000000000000
Id                 : cb26e007-a846-41c6-bbe0-d4aa416bb782
Name               : esx-test-bc.xxxx.local
RealName           : esx-test-bc.xxxx.local
Reference          : ha-host
Description        : Created by Powershell at 2/25/2014 1:46:45 PM.
IsUnavailable      : False
Type               : ESXi
ApiVersion         : V50
PhysHostId         : 00000000-0000-0000-0000-000000000000
ProxyServicesCreds :

Info               : vmvisor-mgt.yyyy.labo.local
ParentId           : 00000000-0000-0000-0000-000000000000
Id                 : 12076bb4-7c67-47eb-96a9-17cd6988763a
Name               : vmvisor-mgt.yyyy.labo.local
RealName           : vmvisor-mgt.yyyy.labo.local
Reference          : ha-host
Description        : Created by Powershell at 2/25/2014 1:47:37 PM.
IsUnavailable      : False
Type               : ESXi
ApiVersion         : V55
PhysHostId         : 00000000-0000-0000-0000-000000000000
ProxyServicesCreds :

Start-VBRQuickMigration : Cannot validate argument on parameter 'Entity'. The argument is null. Supply a non-null argum
ent and try the command again.
At C:\Users\moignon\Desktop\FromTemplates\sandbox2.ps1:28 char:32
+ Start-VBRQuickMigration -Entity <<<<  $vmToMigrate -Server $hostEsxDest
    + CategoryInfo          : InvalidData: (:) [Start-VBRQuickMigration], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Command.StartVBRQuickMigration


	
Test 2
src: ip    dst: dns 
PS C:\Users\moignon\Desktop\FromTemplates> .\sandbox2.ps1


Info               : 192.16.21.15
ParentId           : 00000000-0000-0000-0000-000000000000
Id                 : fe845ede-59b7-4555-b45a-4f8ee50f52a4
Name               : 192.16.21.15
RealName           : 192.16.21.15
Reference          : ha-host
Description        : Created by Powershell at 2/25/2014 1:51:22 PM.
IsUnavailable      : False
Type               : ESXi
ApiVersion         : V50
PhysHostId         : 00000000-0000-0000-0000-000000000000
ProxyServicesCreds :

Info               : vmvisor-mgt.yyyy.labo.local
ParentId           : 00000000-0000-0000-0000-000000000000
Id                 : 12076bb4-7c67-47eb-96a9-17cd6988763a
Name               : vmvisor-mgt.yyyy.labo.local
RealName           : vmvisor-mgt.yyyy.labo.local
Reference          : ha-host
Description        : Created by Powershell at 2/25/2014 1:52:14 PM.
IsUnavailable      : False
Type               : ESXi
ApiVersion         : V55
PhysHostId         : 00000000-0000-0000-0000-000000000000
ProxyServicesCreds :

Start-VBRQuickMigration : Host 'esx-test-bc.xxxx.local' with type 'ESX' and parentId 'fe845ede-59b7-4555-b45a-4f8ee5
0f52a4' not found.
At C:\Users\moignon\Desktop\FromTemplates\sandbox2.ps1:28 char:24
+ Start-VBRQuickMigration <<<<  -Entity $vmToMigrate -Server $hostEsxDest
    + CategoryInfo          : NotSpecified: (:) [Start-VBRQuickMigration], Exception
    + FullyQualifiedErrorId : System.Exception,Veeam.Backup.PowerShell.Command.StartVBRQuickMigration


	
Test3
src: ip    dst: ip

PS C:\Users\moignon\Desktop\FromTemplates> .\sandbox2.ps1


Info               : 192.16.21.15
ParentId           : 00000000-0000-0000-0000-000000000000
Id                 : fe845ede-59b7-4555-b45a-4f8ee50f52a4
Name               : 192.16.21.15
RealName           : 192.16.21.15
Reference          : ha-host
Description        : Created by Powershell at 2/25/2014 1:54:41 PM.
IsUnavailable      : False
Type               : ESXi
ApiVersion         : V50
PhysHostId         : 00000000-0000-0000-0000-000000000000
ProxyServicesCreds :

Info               : 190.63.255.21
ParentId           : 00000000-0000-0000-0000-000000000000
Id                 : 9ccffa75-3270-4467-8014-d8862d410d99
Name               : 190.63.255.21
RealName           : 190.63.255.21
Reference          : ha-host
Description        : Created by Powershell at 2/25/2014 1:55:33 PM.
IsUnavailable      : False
Type               : ESXi
ApiVersion         : V55
PhysHostId         : 00000000-0000-0000-0000-000000000000
ProxyServicesCreds :

Start-VBRQuickMigration : Host 'esx-test-bc.xxxx.local' with type 'ESX' and parentId 'fe845ede-59b7-4555-b45a-4f8ee5
0f52a4' not found.
At C:\Users\moignon\Desktop\FromTemplates\sandbox2.ps1:28 char:24
+ Start-VBRQuickMigration <<<<  -Entity $vmToMigrate -Server $hostEsxDest
    + CategoryInfo          : NotSpecified: (:) [Start-VBRQuickMigration], Exception
    + FullyQualifiedErrorId : System.Exception,Veeam.Backup.PowerShell.Command.StartVBRQuickMigration
	
	
Test 4
- src: dns   dst: ip
PS C:\Users\moignon\Desktop\FromTemplates> .\sandbox2.ps1


Info               : esx-test-bc.xxxx.local
ParentId           : 00000000-0000-0000-0000-000000000000
Id                 : cb26e007-a846-41c6-bbe0-d4aa416bb782
Name               : esx-test-bc.xxxx.local
RealName           : esx-test-bc.xxxx.local
Reference          : ha-host
Description        : Created by Powershell at 2/25/2014 1:59:48 PM.
IsUnavailable      : False
Type               : ESXi
ApiVersion         : V50
PhysHostId         : 00000000-0000-0000-0000-000000000000
ProxyServicesCreds :

Info               : 190.63.255.21
ParentId           : 00000000-0000-0000-0000-000000000000
Id                 : 9ccffa75-3270-4467-8014-d8862d410d99
Name               : 190.63.255.21
RealName           : 190.63.255.21
Reference          : ha-host
Description        : Created by Powershell at 2/25/2014 2:00:41 PM.
IsUnavailable      : False
Type               : ESXi
ApiVersion         : V55
PhysHostId         : 00000000-0000-0000-0000-000000000000
ProxyServicesCreds :

Start-VBRQuickMigration : Host 'esx-test-bc.xxxx.local' with type 'ESX' and parentId 'cb26e007-a846-41c6-bbe0-d4aa41
6bb782' not found.
At C:\Users\moignon\Desktop\FromTemplates\sandbox2.ps1:28 char:24
+ Start-VBRQuickMigration <<<<  -Entity $vmToMigrate -Server $hostEsxDest
    + CategoryInfo          : NotSpecified: (:) [Start-VBRQuickMigration], Exception
    + FullyQualifiedErrorId : System.Exception,Veeam.Backup.PowerShell.Command.StartVBRQuickMigration

veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Issues with cmdlet Start-VBRQuickMigration

Post by veremin »

Yes, Start-VBRQuickMigration commandlet doesn't appear to work in case of standalone hosts. The issue is that method tries to finds child host objects on the specified standalone host, as if it were a vCenter server. Chances are, we will address it in the next product release.

Thanks.
moignon
Novice
Posts: 5
Liked: never
Joined: Feb 24, 2014 6:04 pm
Contact:

Re: Issues with cmdlet Start-VBRQuickMigration

Post by moignon »

Hum.. after looking at the documentation of v6.5, it seems there isn't equivalent cmdlet (even if the functionnality is available through GUI, just test, approved and liked, in particular the bottleneck information)
Do you confirm ? :(
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Issues with cmdlet Start-VBRQuickMigration

Post by veremin »

I took a brief look at VB&R 6.5 and it seems that the said commandlet wasn't present there. In other words, Start-VBRQuickMigration was introduced only in version 7 and, therefore, it still needs further polishing.

Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests