Skip to content

MORPH-12933: Eliminate AbstractMarshaller warnings on SCVMM plugin load#177

Open
NimbleMike wants to merge 2 commits into
mainfrom
MORPH-12933
Open

MORPH-12933: Eliminate AbstractMarshaller warnings on SCVMM plugin load#177
NimbleMike wants to merge 2 commits into
mainfrom
MORPH-12933

Conversation

@NimbleMike

Copy link
Copy Markdown
Contributor

Root cause was determined by having Copilot instrument Morpheus Core and then loading the SCVMM plugin. Its analysis, and resolution, are detailed below.

Fix: Remove invalid ports field usage and stale virtualImage reference

Background

When loading the SCVMM plugin, the Morpheus marshaller (AbstractMarshaller.bindMapDomainCollection) logs a warning whenever it encounters a collection field on a domain class that has no associated GORM entity. The root cause is that ContainerType declares ports as a basic element collection of raw integers:

// ContainerType.groovy
static hasMany = [ports: Integer, containerPorts: ContainerTypePort, ...]

Because Integer is not a GORM domain class, domainField.getAssociatedEntity() returns null for ports. The marshaller cannot bind it and emits:

WARN AbstractMarshaller - unknown map collection domain entity: ports

The correct field for exposing port definitions is containerPorts, which maps to ContainerTypePort — a proper domain entity association that the marshaller can process. All affected workload types already had containerPorts entries; ports was redundant and never being persisted.


Changes

1. Removed ports = [22] / ports = [3389] from all workload type definitions

Every workload type that declared ports = [...] also had an equivalent containerPorts = [...] entry. The ports field was dead weight generating one warning per workload type processed per plugin load.

Files changed:

  • scvmm-workload-type-and-set.scribe — AlmaLinux 9, openSUSE 15.1, CentOS 9-stream, Debian 11/12, Rocky 8/9, Ubuntu 18.04/24.04
  • scvmm-ubuntu-16.scribe — Ubuntu 16.04
  • scvmm-ubuntu-20.scribe — Ubuntu 20.04
  • scvmm-ubuntu-22.scribe — Ubuntu 22.04
  • scvmm-windows-12.scribe — Windows 2012 R2 (ports = [3389])
  • scvmm-ubuntu-16-docker.scribe — Docker Ubuntu 16.04 (also had ports = ["22"] — a string instead of an integer)
  • scvmm-compute-types.scribe — Docker Ubuntu 22.04

2. Removed ports = [] from the generic scvmm-1_0 workload type

The base SCVMM workload type (scvmm-instance-type.scribe) declared ports = []. The empty list still causes the marshaller to enter the collection-binding code path and emit the warning. This workload type has no containerPorts either, which is intentional — it is a generic, OS-agnostic "bring your own VM" type with no assumed port. Removing the empty declaration is safe and matches the intent.

3. Fixed stale virtualImage code reference on docker-scvmm-ubuntu-22_04

The Docker Ubuntu 22.04 workload type in scvmm-compute-types.scribe referenced its virtual image via a hardcoded code map:

virtualImage = {
  code = "scvmm.image.morpheus.ubuntu.22.04.20250218.amd64"
}

That code string became stale when the Ubuntu 22.04 virtual image was updated (the current code is hyperv.image.morpheus.ubuntu.22.04.20260115.amd64). The marshaller could not resolve it in either the resource map or the database, leaving virtualImage unset on every plugin load:

WARN AbstractMarshaller - resource: workload-type:docker-scvmm-ubuntu-22_04 - field: virtualImage - unset

The fix replaces the hardcoded map with a Scribe resource reference, consistent with every other workload type in the plugin:

virtualImage = virtual-image.scvmm-image-morpheus-ubuntu-22_04

A resource reference binds by Scribe resource identifier at import time, so it remains correct regardless of future code renames.


Safety

  • No functional behaviour changes. ports was never successfully persisted — the marshaller silently skipped it on every run. Removing it produces identical runtime state.
  • containerPorts is unaffected. All port exposure for SSH (22) and RDP (3389) continues to work through the existing containerPorts entries, which reference ContainerTypePort domain objects correctly.
  • The virtualImage fix is additive. It restores an association that was silently missing. The Docker Ubuntu 22.04 compute type will now correctly have its virtual image set on plugin load.
  • No schema or migration required. All changes are to Scribe resource definitions processed at plugin load time.

@zachathpe

Copy link
Copy Markdown
  1. This is not the only entity with arrays of simple types. I think the issue here is that hasMany shouldn't be used for simple-type collections https://grails.apache.org/docs/latest/ref/Domain%20Classes/hasMany.html (Quick google search indicates that simple-type arrays should just be declared as singular non-association fields). It seems reasonable that this error was surfaced by my refactor of AbstractMarshaller, but your assessment that this path would never haved worked properly is also correct.

If this entity is owned by platform, we should take a bug to get the ports field removed or otherwise declared properly, though it does seem that containerPorts makes it redundant.

  1. I can't speak to how the scribe file is being used outside of AbstractMarshaller, where for reasons stated above, the removal of ports is a non-issue. If the field is required elsewhere, it may be possible to pass a bindConfig to bindModelMapToDomain that ignores the ports mapping. To be clear, I think the preference to remove the field if it isn't used anywhere and reduce future confusion is a better choice, if it will not cause issues.

@NimbleMike

Copy link
Copy Markdown
Contributor Author

If this entity is owned by platform, we should take a bug to get the ports field removed or otherwise declared properly, though it does seem that containerPorts makes it redundant.

Thanks for the feedback, Yea, that seems to be the case. Remove the ports and the warnings go away. I need to run some tests to make sure things continue to work after removal.

@NimbleMike NimbleMike marked this pull request as ready for review June 17, 2026 21:46
@NimbleMike

Copy link
Copy Markdown
Contributor Author

Have successfully created Docker clusters and individual instances using this plugin's changes. Opening up for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants