don't add templates to inventory
This commit is contained in:
@@ -116,7 +116,7 @@ func (c *CronTask) AddVmToInventory(vmObject *mo.VirtualMachine, vc *vcenter.Vce
|
||||
|
||||
if vmObject.Name == "DBRaaS_testVMTemplate" {
|
||||
c.Logger.Debug("Found problematic VM")
|
||||
prettyPrint(vmObject)
|
||||
//prettyPrint(vmObject)
|
||||
}
|
||||
|
||||
srmPlaceholder = "FALSE" // Default assumption
|
||||
@@ -124,11 +124,22 @@ func (c *CronTask) AddVmToInventory(vmObject *mo.VirtualMachine, vc *vcenter.Vce
|
||||
|
||||
// calculate VM properties we want to store
|
||||
if vmObject.Config != nil {
|
||||
if vmObject.Config.Template {
|
||||
c.Logger.Debug("Not adding templates to inventory")
|
||||
return nil
|
||||
} else {
|
||||
isTemplate = "FALSE"
|
||||
}
|
||||
|
||||
numRam = vmObject.Config.Hardware.MemoryMB
|
||||
numVcpus = vmObject.Config.Hardware.NumCPU
|
||||
|
||||
// Calculate creation date
|
||||
if vmObject.Config.CreateDate.IsZero() {
|
||||
c.Logger.Debug("Creation date not available for this VM")
|
||||
} else {
|
||||
creationTS = vmObject.Config.CreateDate.Unix()
|
||||
}
|
||||
|
||||
// Calculate disk size
|
||||
var totalDiskBytes int64
|
||||
@@ -157,12 +168,6 @@ func (c *CronTask) AddVmToInventory(vmObject *mo.VirtualMachine, vc *vcenter.Vce
|
||||
srmPlaceholder = "TRUE"
|
||||
}
|
||||
|
||||
if vmObject.Config.Template {
|
||||
isTemplate = "TRUE"
|
||||
} else {
|
||||
isTemplate = "FALSE"
|
||||
}
|
||||
|
||||
// Retrieve the full folder path of the VM
|
||||
folderPath, err = vc.GetVMFolderPath(*vmObject)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user