On Sat, Nov 13, 2021 at 9:47 PM Thomas Simmons <twsnnva@gmail.com> wrote:
Hello,
I exported all of the VMs on my 4.3.10 cluster to OVAs and while a few have imported into my new 4.4.9 cluster just fine, most are failing to import with the error below being logged in my engine.log.

Caused by: org.postgresql.util.PSQLException: ERROR: insert or update on table "vm_static" violates foreign key constraint "fk_vm_static_lease_sd_id_storage_domain_static_id"

I haven't been able to find much about this error. Google only has a few hits, but it looks like there was a similar issue in 4.2.x that was resolved in one of the 4.3 RCs.

https://bugzilla.redhat.com/show_bug.cgi?id=1641703

Any advise to get these VMs imported is appreciated.

More log output:
PL/pgSQL function insertvmstatic(character varying,text,integer,integer,integer,integer,uuid,uuid,character varying,uuid,timestamp with time zone,integer,boolean,boolean,integer,integer,integer,integer,character varying,boolean,boolean,boolean,boolean,character varying,text,integer,integer,integer,integer,integer,integer,character varying,integer,character varying,character varying,character varying,integer,character varying,character varying,integer,uuid,character varying,boolean,boolean,character varying,boolean,uuid,uuid,uuid,uuid,character varying,integer,integer,smallint,character varying,boolean,boolean,boolean,uuid,boolean,boolean,boolean,character varying,integer,character varying,uuid,uuid,character varying,character varying,character varying,uuid,uuid,boolean,boolean,boolean,character varying,boolean) line 8 at SQL statement
        at org.springframework@5.0.4.RELEASE//org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
        at org.springframework@5.0.4.RELEASE//org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
        at org.springframework@5.0.4.RELEASE//org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1402)
        at org.springframework@5.0.4.RELEASE//org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1065)
        at org.springframework@5.0.4.RELEASE//org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1104)
        at org.springframework@5.0.4.RELEASE//org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:414)
        at org.springframework@5.0.4.RELEASE//org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:374)
        at org.springframework@5.0.4.RELEASE//org.springframework.jdbc.core.simple.SimpleJdbcCall.execute(SimpleJdbcCall.java:198)
        at org.ovirt.engine.core.dal//org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeImpl(SimpleJdbcCallsHandler.java:135)
        at org.ovirt.engine.core.dal//org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeImpl(SimpleJdbcCallsHandler.java:130)
        at org.ovirt.engine.core.dal//org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeModification(SimpleJdbcCallsHandler.java:76)
        at org.ovirt.engine.core.dal//org.ovirt.engine.core.dao.DefaultGenericDao.save(DefaultGenericDao.java:93)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.exportimport.ImportVmCommandBase.addVmStatic(ImportVmCommandBase.java:628)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.exportimport.ImportVmFromExternalProviderCommand.addVmStatic(ImportVmFromExternalProviderCommand.java:309)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.exportimport.ImportVmCommandBase.lambda$addVmToDb$8(ImportVmCommandBase.java:560)
        at org.ovirt.engine.core.utils//org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction(TransactionSupport.java:181)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.exportimport.ImportVmCommandBase.addVmToDb(ImportVmCommandBase.java:559)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.exportimport.ImportVmFromExternalProviderCommand.addVmToDb(ImportVmFromExternalProviderCommand.java:391)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.exportimport.ImportVmCommandBase.executeVmCommand(ImportVmCommandBase.java:511)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.VmCommand.executeCommand(VmCommand.java:178)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.CommandBase.executeWithoutTransaction(CommandBase.java:1174)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.CommandBase.executeActionInTransactionScope(CommandBase.java:1332)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:2010)
        at org.ovirt.engine.core.utils//org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInSuppressed(TransactionSupport.java:140)
        at org.ovirt.engine.core.utils//org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope(TransactionSupport.java:79)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.CommandBase.execute(CommandBase.java:1392)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.CommandBase.executeAction(CommandBase.java:424)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.PrevalidatingMultipleActionsRunner.executeValidatedCommand(PrevalidatingMultipleActionsRunner.java:204)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.PrevalidatingMultipleActionsRunner.runCommands(PrevalidatingMultipleActionsRunner.java:176)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.PrevalidatingMultipleActionsRunner.lambda$invokeCommands$3(PrevalidatingMultipleActionsRunner.java:182)
        at org.ovirt.engine.core.utils//org.ovirt.engine.core.utils.threadpool.ThreadPoolUtil$InternalWrapperRunnable.run(ThreadPoolUtil.java:96)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
        at org.glassfish.javax.enterprise.concurrent//org.glassfish.enterprise.concurrent.ManagedThreadFactoryImpl$ManagedThread.run(ManagedThreadFactoryImpl.java:227)
Caused by: org.postgresql.util.PSQLException: ERROR: insert or update on table "vm_static" violates foreign key constraint "fk_vm_static_lease_sd_id_storage_domain_static_id"
  Detail: Key (lease_sd_id)=(2b7747b4-c55f-40ea-b619-37dfe273505b) is not present in table "storage_domain_static".
  Where: SQL statement "INSERT INTO vm_static(description,
                      free_text_comment,
                      mem_size_mb,
                      max_memory_size_mb,
                      num_of_io_threads,
                      os,
                      cluster_id,
                      vm_guid,
                      vm_name,
                      vmt_guid,
                      creation_date,
                      num_of_monitors,
                      allow_console_reconnect,
                      is_initialized,
                      num_of_sockets,
                      cpu_per_socket,
                      threads_per_cpu,
                      usb_policy,
                      time_zone,
                      auto_startup,
                      is_stateless,
                      default_boot_sequence,
                      vm_type,
                      nice_level,
                      cpu_shares,
                      default_display_type,
                      priority,
                      iso_path,
                      origin,
                      initrd_url,
                      kernel_url,
                      kernel_params,
                      migration_support,
                      predefined_properties,
                      userdefined_properties,
                      min_allocated_mem,
                      entity_type,
                      quota_id,
                      cpu_pinning,
                      is_smartcard_enabled,
                      is_delete_protected,
                      sso_method,
                      host_cpu_flags,
                      tunnel_migration,
                      vnc_keyboard_layout,
                      is_run_and_pause,
                      created_by_user_id,
                      instance_type_id,
                      image_type_id,
                      original_template_id,
                      original_template_name,
                      migration_downtime,
                      template_version_number,
                      serial_number_policy,
                      custom_serial_number,
                      is_boot_menu_enabled,
                      is_spice_file_transfer_enabled,
                      is_spice_copy_paste_enabled,
                      cpu_profile_id,
                      is_auto_converge,
                      is_migrate_compressed,
                      is_migrate_encrypted,
                      custom_emulated_machine,
                      bios_type,
                      custom_cpu_name,
                      small_icon_id,
                      large_icon_id,
                      console_disconnect_action,
                      resume_behavior,
                      custom_compatibility_version,
                      migration_policy_id,
                      lease_sd_id,
                      multi_queues_enabled,
                      virtio_scsi_multi_queues_enabled,
                      use_tsc_frequency,
                      namespace,
                      balloon_enabled)
    VALUES(v_description,
           v_free_text_comment,
           v_mem_size_mb,
           v_max_memory_size_mb,
           v_num_of_io_threads,
           v_os,
           v_cluster_id,
           v_vm_guid,
           v_vm_name,
           v_vmt_guid,
           v_creation_date,
           v_num_of_monitors,
           v_allow_console_reconnect,
           v_is_initialized,
           v_num_of_sockets,
           v_cpu_per_socket,
           v_threads_per_cpu,
           v_usb_policy,
           v_time_zone,
           v_auto_startup,
           v_is_stateless,
           v_default_boot_sequence,
           v_vm_type,
           v_nice_level,
           v_cpu_shares,
           v_default_display_type,
           v_priority,
           v_iso_path,
           v_origin,
           v_initrd_url,
           v_kernel_url,
           v_kernel_params,
           v_migration_support,
           v_predefined_properties,
           v_userdefined_properties,
           v_min_allocated_mem,
           'VM',
           v_quota_id,
           v_cpu_pinning,
           v_is_smartcard_enabled,
           v_is_delete_protected,
           v_sso_method,
           v_host_cpu_flags,
           v_tunnel_migration,
           v_vnc_keyboard_layout,
           v_is_run_and_pause,
           v_created_by_user_id,
           v_instance_type_id,
           v_image_type_id,
           v_original_template_id,
           v_original_template_name,
           v_migration_downtime,
           v_template_version_number,
           v_serial_number_policy,
           v_custom_serial_number,
           v_is_boot_menu_enabled,
           v_is_spice_file_transfer_enabled,
           v_is_spice_copy_paste_enabled,
           v_cpu_profile_id,
           v_is_auto_converge,
           v_is_migrate_compressed,
           v_is_migrate_encrypted,
           v_custom_emulated_machine,
           v_bios_type,
           v_custom_cpu_name,
           v_small_icon_id,
           v_large_icon_id,
           v_console_disconnect_action,
           v_resume_behavior,
           v_custom_compatibility_version,
           v_migration_policy_id,
           v_lease_sd_id,
           v_multi_queues_enabled,
           v_virtio_scsi_multi_queues_enabled,
           v_use_tsc_frequency,
           v_namespace,
           v_balloon_enabled)"
PL/pgSQL function insertvmstatic(character varying,text,integer,integer,integer,integer,uuid,uuid,character varying,uuid,timestamp with time zone,integer,boolean,boolean,integer,integer,integer,integer,character varying,boolean,boolean,boolean,boolean,character varying,text,integer,integer,integer,integer,integer,integer,character varying,integer,character varying,character varying,character varying,integer,character varying,character varying,integer,uuid,character varying,boolean,boolean,character varying,boolean,uuid,uuid,uuid,uuid,character varying,integer,integer,smallint,character varying,boolean,boolean,boolean,uuid,boolean,boolean,boolean,character varying,integer,character varying,uuid,uuid,character varying,character varying,character varying,uuid,uuid,boolean,boolean,boolean,character varying,boolean) line 8 at SQL statement
        at org.postgresql@42.2.3//org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
        at org.postgresql@42.2.3//org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
        at org.postgresql@42.2.3//org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
        at org.postgresql@42.2.3//org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
        at org.postgresql@42.2.3//org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
        at org.postgresql@42.2.3//org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:150)
        at org.postgresql@42.2.3//org.postgresql.jdbc.PgCallableStatement.executeWithFlags(PgCallableStatement.java:77)
        at org.postgresql@42.2.3//org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:139)
        at org.jboss.ironjacamar.jdbcadapters@1.4.27.Final//org.jboss.jca.adapters.jdbc.CachedPreparedStatement.execute(CachedPreparedStatement.java:303)
        at org.jboss.ironjacamar.jdbcadapters@1.4.27.Final//org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.execute(WrappedPreparedStatement.java:442)
        at org.springframework@5.0.4.RELEASE//org.springframework.jdbc.core.JdbcTemplate.lambda$call$4(JdbcTemplate.java:1105)
        at org.springframework@5.0.4.RELEASE//org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1050)
        ... 33 more

2021-11-13 14:20:28,037-05 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (EE-ManagedThreadFactory-engine-Thread-138751) [31ca7e84-c55d-4ba8-8653-399cea8c0be1] EVENT_ID: IMPORTEXPORT_IMPORT_VM_FAILED(1,153), Failed to import Vm lightning to Data Center DC, Cluster oVirt1
2021-11-13 14:20:28,050-05 INFO  [org.ovirt.engine.core.bll.exportimport.ImportVmFromOvaCommand] (EE-ManagedThreadFactory-engine-Thread-138751) [31ca7e84-c55d-4ba8-8653-399cea8c0be1] Lock freed to object 'EngineLock:{exclusiveLocks='[lightning=VM_NAME, f94ee127-330c-4a76-893b-009d4d9166b2=VM]', sharedLocks=''}'
2021-11-13 14:20:28,670-05 INFO  [org.ovirt.engine.core.bll.SerialChildCommandsExecutionCallback] (EE-ManagedScheduledExecutorService-engineScheduledThreadPool-Thread-68) [31ca7e84-c55d-4ba8-8653-399cea8c0be1] Command 'ImportVmFromOva' id: '5c567c44-e3fb-4080-b2ac-0812c3668dc0' execution didn't complete, not proceeding to perform the next operation
2021-11-13 14:20:28,670-05 INFO  [org.ovirt.engine.core.bll.SerialChildCommandsExecutionCallback] (EE-ManagedScheduledExecutorService-engineScheduledThreadPool-Thread-68) [31ca7e84-c55d-4ba8-8653-399cea8c0be1] Command 'ImportVmFromOva' id: '5c567c44-e3fb-4080-b2ac-0812c3668dc0' child commands '[]' executions were completed, status 'FAILED'
2021-11-13 14:20:29,695-05 ERROR [org.ovirt.engine.core.bll.exportimport.ImportVmFromOvaCommand] (EE-ManagedScheduledExecutorService-engineScheduledThreadPool-Thread-60) [31ca7e84-c55d-4ba8-8653-399cea8c0be1] Ending command 'org.ovirt.engine.core.bll.exportimport.ImportVmFromOvaCommand' with failure.
2021-11-13 14:20:29,731-05 INFO  [org.ovirt.engine.core.bll.storage.disk.image.RemoveAllVmImagesCommand] (EE-ManagedScheduledExecutorService-engineScheduledThreadPool-Thread-60) [2728db3e] Running command: RemoveAllVmImagesCommand internal: true. Entities affected :  ID: f94ee127-330c-4a76-893b-009d4d9166b2 Type: VM
2021-11-13 14:20:29,733-05 WARN  [org.ovirt.engine.core.bll.lock.InMemoryLockManager] (EE-ManagedScheduledExecutorService-engineScheduledThreadPool-Thread-60) [2728db3e] Trying to release exclusive lock which does not exist, lock key: 'lightningVM_NAME'
2021-11-13 14:20:29,733-05 WARN  [org.ovirt.engine.core.bll.lock.InMemoryLockManager] (EE-ManagedScheduledExecutorService-engineScheduledThreadPool-Thread-60) [2728db3e] Trying to release exclusive lock which does not exist, lock key: 'f94ee127-330c-4a76-893b-009d4d9166b2VM'
2021-11-13 14:20:29,733-05 INFO  [org.ovirt.engine.core.bll.exportimport.ImportVmFromOvaCommand] (EE-ManagedScheduledExecutorService-engineScheduledThreadPool-Thread-60) [2728db3e] Lock freed to object 'EngineLock:{exclusiveLocks='[lightning=VM_NAME, f94ee127-330c-4a76-893b-009d4d9166b2=VM]', sharedLocks=''}'
2021-11-13 14:20:29,757-05 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (EE-ManagedScheduledExecutorService-engineScheduledThreadPool-Thread-60) [2728db3e] EVENT_ID: IMPORTEXPORT_IMPORT_VM_FAILED(1,153), Failed to import Vm lightning to Data Center DC, Cluster oVirt1

Hi Thomas,
Thanks for the report. I opened - Bug 2023368.
For a workaround, it might work to modify manually the storage ID for the lease in the OVF within the OVA file:
<LeaseDomainId>ID</LeaseDomainId> 
Removing it might do or changing the ID to the ID of an existing storage domain.

Regards,
Liran.
_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-leave@ovirt.org
Privacy Statement: https://www.ovirt.org/privacy-policy.html
oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/CQHIP32K2KRWCBDPHZOC3YES4XWIMG6E/