Quantcast
Channel: VMware Communities : Popular Discussions - vCloud Director PowerCLI
Viewing all articles
Browse latest Browse all 13334

The VCD - vCenter Glue - Linking VMs and Events

$
0
0


Hi All

 

I have sucessfully talked to the vCenter running our Blades and hosting vCLoud, and vCloud itself

 

I can see VMs from both sides.

 

1. What i am looking for is the glue that allows you to link the vCD VM to the underlying one.

Why ? So i can get the OS name for the vm, the CI VM interface does not return this.

[Found Linking your vCloud Director VMs and vSphere VMs | VMware PowerCLI Blog - VMware Blogs however the "$vsphereVMView= Get-View –RelatedObject $VM.ExtensionData" returns a $null object]

There are also references to examples like ' Get-CIVM -Name ‘MyVM’ | Get-CIView | Get-View ' this works to the Get-CIView level but not the Get-View level, it is like functionality was broken or changed from v5.1 to v5.5. I am using v5.5

2. I assume with this link then events can be grabbed for a vm ?

(the reason being i found no Get-CIEvent and when passing the vCD VM info to this Get-Event -vm vcdtoken this does not work)

 

3. Also is there a camlett for vCD events ? (i did not see one)

 

4. I am guessing multple opens are needed to reference objects ? e.g.

   Connect-CIServer & COnnect-VIServer (even though the CIServer should have some internal object to the underlying vCenter ?)

[YES}

 

Many thanks

 

NB: For 1. I did which is fairly ugly but worked, i.e. relying on the naming convention, however there has to be a better way, it is documented as working for v5

 

Function ConvertCIVM-ToVM {     <#         .SYNOPSIS             Converts a vCloud VM into a vCenter VM Object        .DESCRIPTION             Converts a vCloud VM into a vCenter VM Object   This is the single object form        .PARAMETER  CIVM             One or more vCloud VMs         .EXAMPLE             PS C:\> Get-CIVM -Name 'xxxx' | ConvertCIVM-ToVM     #>     [CmdletBinding()]     Param (         [Parameter(Mandatory=$true)]         [Object]$CIVM     )     process {         If ((-not $DefaultCIServers) -or (-not $DefaultVIServer)){             Write-Host -ForegroundColor Red "You will need to be connected to both the CIServer and VIServer for this cmdlet to work"             Return         }   # Build name - do the easy way   $items = $CIVM.Id.Split(':')    $vm = $CIVM.Name + ' (' + $items[3] + ')';    return Get-VM -Server $global:DefaultVIServer -Name $vm    } 
}

Viewing all articles
Browse latest Browse all 13334

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>