Попытка увидеть, какие теги безопасности NSX и группы безопасности применяются к виртуальной машине. - PullRequest
0 голосов
/ 11 февраля 2020

Модуль PowerNSX PowerShell не работает по какой-либо причине. Я отказался от этого и решил использовать API-вызовы, чтобы поговорить с менеджером NSX.

В идеале, я бы выбрал тег безопасности или группу и посмотрел, к каким виртуальным машинам он применяется.

вызов API https://10.x.x.x/api/2.0/services/securitytags/tag дает мне все теги безопасности в NSX и возвращает что-то вроде следующего:

objectId           : securitytag-71
objectTypeName     : SecurityTag
vsmUuid            : ***omitted***
nodeId             : ***omitted***
revision           : 1
type               : type
name               : ***omitted***
description        : 
clientHandle       : 
extendedAttributes : 
isUniversal        : false
universalRevision  : 0
isTemporal         : false
systemResource     : false
vmCount            : 1

Интересно, знает ли тег этот тег? сколько виртуальных машин применяется к нему из свойства vmCount ... должен быть способ вытащить имена тех виртуальных машин, к которым он применяется.

внутри vSphere, эти теги и групповые поля заполняются, но, используя модуль PowerCLI powershell для vmware, я не вижу возвращаемого свойства при выполнении следующих действий:

Get-VM -Name SERVERNAME | get-member

Name                    MemberType Definition                                                                                                      
----                    ---------- ----------                                                                                                      
ConvertToVersion        Method     T VersionedObjectInterop.ConvertToVersion[T]()                                                                  
Equals                  Method     bool Equals(System.Object obj)                                                                                  
GetClient               Method     VMware.VimAutomation.ViCore.Interop.V1.VIAutomation VIObjectCoreInterop.GetClient()                             
GetConnectionParameters Method     VMware.VimAutomation.ViCore.Interop.V1.VM.RemoteConsoleVMParams RemoteConsoleVMInterop.GetConnectionParameters()
GetHashCode             Method     int GetHashCode()                                                                                               
GetType                 Method     type GetType()                                                                                                  
IsConvertableTo         Method     bool VersionedObjectInterop.IsConvertableTo(type type)                                                          
LockUpdates             Method     void ExtensionData.LockUpdates()                                                                                
ObtainExportLease       Method     VMware.Vim.ManagedObjectReference ObtainExportLease.ObtainExportLease()                                         
ToString                Method     string ToString()                                                                                               
UnlockUpdates           Method     void ExtensionData.UnlockUpdates()                                                                              
CoresPerSocket          Property   int CoresPerSocket {get;}                                                                                       
CreateDate              Property   System.Nullable[datetime] CreateDate {get;}                                                                     
CustomFields            Property   System.Collections.Generic.IDictionary[string,string] CustomFields {get;}                                       
DatastoreIdList         Property   string[] DatastoreIdList {get;}                                                                                 
DrsAutomationLevel      Property   System.Nullable[VMware.VimAutomation.ViCore.Types.V1.Cluster.DrsAutomationLevel] DrsAutomationLevel {get;}      
ExtensionData           Property   System.Object ExtensionData {get;}                                                                              
Folder                  Property   VMware.VimAutomation.ViCore.Types.V1.Inventory.Folder Folder {get;}                                             
FolderId                Property   string FolderId {get;}                                                                                          
Guest                   Property   VMware.VimAutomation.ViCore.Types.V1.VM.Guest.VMGuest Guest {get;}                                              
GuestId                 Property   string GuestId {get;}                                                                                           
HAIsolationResponse     Property   System.Nullable[VMware.VimAutomation.ViCore.Types.V1.Cluster.HAIsolationResponse] HAIsolationResponse {get;}    
HardwareVersion         Property   string HardwareVersion {get;}                                                                                   
HARestartPriority       Property   System.Nullable[VMware.VimAutomation.ViCore.Types.V1.Cluster.HARestartPriority] HARestartPriority {get;}        
Id                      Property   string Id {get;}                                                                                                
MemoryGB                Property   decimal MemoryGB {get;}                                                                                         
MemoryMB                Property   decimal MemoryMB {get;}                                                                                         
Name                    Property   string Name {get;}                                                                                              
Notes                   Property   string Notes {get;}                                                                                             
NumCpu                  Property   int NumCpu {get;}                                                                                               
PersistentId            Property   string PersistentId {get;}                                                                                      
PowerState              Property   VMware.VimAutomation.ViCore.Types.V1.Inventory.PowerState PowerState {get;}                                     
ProvisionedSpaceGB      Property   decimal ProvisionedSpaceGB {get;}                                                                               
ResourcePool            Property   VMware.VimAutomation.ViCore.Types.V1.Inventory.ResourcePool ResourcePool {get;}                                 
ResourcePoolId          Property   string ResourcePoolId {get;}                                                                                    
Uid                     Property   string Uid {get;}                                                                                               
UsedSpaceGB             Property   decimal UsedSpaceGB {get;}                                                                                      
VApp                    Property   VMware.VimAutomation.ViCore.Types.V1.Inventory.VApp VApp {get;}                                                 
Version                 Property   VMware.VimAutomation.ViCore.Types.V1.VM.VMVersion Version {get;}                                                
VMHost                  Property   VMware.VimAutomation.ViCore.Types.V1.Inventory.VMHost VMHost {get;}                                             
VMHostId                Property   string VMHostId {get;}                                                                                          
VMResourceConfiguration Property   VMware.VimAutomation.ViCore.Types.V1.VM.VMResourceConfiguration VMResourceConfiguration {get;}                  
VMSwapfilePolicy        Property   System.Nullable[VMware.VimAutomation.ViCore.Types.V1.VMSwapfilePolicy] VMSwapfilePolicy {get;}

Я просто не используя правильный вызов NSX API для извлечения тегов, чтобы увидеть, где они применяются?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...