Oved Ourfali has uploaded a new change for review.

Change subject: core: importing external VMs to the engine
......................................................................

core: importing external VMs to the engine

This patch adds the externally_managed field to the vm_static table,
which is used when importing existing VMs reported by the host, that
don't exist in the engine.

Change-Id: I6b933df39aaf6897a675aef0564d3fb4922f12e7
Signed-off-by: Oved Ourfali <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsEventListener.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/IVdsEventListener.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
M packaging/dbscripts/create_views.sql
A packaging/dbscripts/upgrade/03_03_0600_add_externally_managed_to_vm_static.sql
M packaging/dbscripts/vms_sp.sql
10 files changed, 97 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/69/17269/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsEventListener.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsEventListener.java
index 20e87f9..b352914 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsEventListener.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsEventListener.java
@@ -15,6 +15,7 @@
 import org.ovirt.engine.core.bll.job.ExecutionHandler;
 import org.ovirt.engine.core.bll.storage.StoragePoolStatusHandler;
 import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.action.AddVmFromScratchParameters;
 import org.ovirt.engine.core.common.action.FenceVdsActionParameters;
 import org.ovirt.engine.core.common.action.HostStoragePoolParametersBase;
 import org.ovirt.engine.core.common.action.MigrateVmToServerParameters;
@@ -309,6 +310,17 @@
     }
 
     @Override
+    public void addExternallyManagedVms(List<VmStatic> externalVmList) {
+        for (VmStatic currVm : externalVmList) {
+            AddVmFromScratchParameters params = new 
AddVmFromScratchParameters(currVm, null, null);
+            VdcReturnValueBase returnValue = 
Backend.getInstance().runInternalAction(VdcActionType.AddVmFromScratch, params, 
ExecutionHandler.createInternalJobContext());
+            if (!returnValue.getSucceeded()) {
+                log.debugFormat("Failed adding Externally managed VM {0}", 
params.getVm().getName());
+            }
+        }
+    }
+
+    @Override
     public void rerun(Guid vmId) {
         final IVdsAsyncCommand command = 
Backend.getInstance().getResourceManager().GetAsyncCommandForVm(vmId);
         if (command != null) {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/IVdsEventListener.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/IVdsEventListener.java
index 32127f0..cd1b424 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/IVdsEventListener.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/IVdsEventListener.java
@@ -1,5 +1,6 @@
 package org.ovirt.engine.core.common.businessentities;
 
+import java.util.List;
 import java.util.Map;
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.errors.VdcBllErrors;
@@ -57,4 +58,6 @@
     void runFailedAutoStartVM(Guid vmId);
 
     boolean restartVds(Guid vdsId);
+
+    void addExternallyManagedVms(List<VmStatic> externalVmList);
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
index fb1acaf..d8806e5 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
@@ -1531,4 +1531,11 @@
         vmDynamic.setLastWatchdogEvent(lastWatchdogEvent);
     }
 
+    public boolean isExternallyManaged() {
+        return this.vmStatic.isExternallyManaged();
+    }
+
+    public void setExternallyManaged(boolean externallyManaged) {
+        vmStatic.setExternallyManaged(externallyManaged);
+    }
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java
index bdcb9c4..d39fcef 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java
@@ -111,6 +111,8 @@
     @EditableField
     private boolean smartcardEnabled;
 
+    private boolean externallyManaged;
+
     @EditableOnVmStatusField
     @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE)
     private String isoPath = "";
@@ -749,4 +751,13 @@
     public void setCreatedByUserId(Guid createdByUserId) {
         this.createdByUserId = createdByUserId;
     }
+
+    public boolean isExternallyManaged() {
+        return externallyManaged;
+    }
+
+    public void setExternallyManaged(boolean externallyManaged) {
+        this.externallyManaged = externallyManaged;
+    }
+
 }
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java
index 18cc051..0c083c5 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java
@@ -238,7 +238,8 @@
                 .addValue("tunnel_migration", vm.getTunnelMigration())
                 .addValue("vnc_keyboard_layout", vm.getVncKeyboardLayout())
                 .addValue("is_run_and_pause", vm.isRunAndPause())
-                .addValue("created_by_user_id", vm.getCreatedByUserId()));
+                .addValue("created_by_user_id", vm.getCreatedByUserId())
+                .addValue("is_externally_managed", vm.isExternallyManaged()));
     }
 
     @Override
@@ -404,6 +405,7 @@
             entity.setLastWatchdogEvent(getLong(rs, "last_watchdog_event"));
             entity.setTrustedService(rs.getBoolean("trusted_service"));
             entity.setCreatedByUserId(getGuid(rs,"created_by_user_id"));
+            
entity.setExternallyManaged(rs.getBoolean("is_externally_managed"));
             return entity;
         }
     }
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java
index db40fb7..8734ef0 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java
@@ -87,7 +87,8 @@
                 .addValue("tunnel_migration", vm.getTunnelMigration())
                 .addValue("vnc_keyboard_layout", vm.getVncKeyboardLayout())
                 .addValue("is_run_and_pause", vm.isRunAndPause())
-                .addValue("created_by_user_id", vm.getCreatedByUserId());
+                .addValue("created_by_user_id", vm.getCreatedByUserId())
+                .addValue("is_externally_managed", vm.isExternallyManaged());
     }
 
     @Override
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
index c950df4..d9fbdf1 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
@@ -24,6 +24,7 @@
 import org.ovirt.engine.core.common.businessentities.DiskImage;
 import org.ovirt.engine.core.common.businessentities.DiskImageDynamic;
 import org.ovirt.engine.core.common.businessentities.Entities;
+import org.ovirt.engine.core.common.businessentities.OriginType;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.VM;
@@ -37,6 +38,7 @@
 import org.ovirt.engine.core.common.businessentities.VmExitStatus;
 import org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface;
 import org.ovirt.engine.core.common.businessentities.VmPauseStatus;
+import org.ovirt.engine.core.common.businessentities.VmStatic;
 import org.ovirt.engine.core.common.businessentities.VmStatistics;
 import org.ovirt.engine.core.common.businessentities.network.InterfaceStatus;
 import org.ovirt.engine.core.common.businessentities.network.Network;
@@ -104,6 +106,7 @@
     private final List<Guid> _vmsMovedToDown = new ArrayList<Guid>();
     private final List<Guid> _vmsToRemoveFromAsync = new ArrayList<Guid>();
     private final List<Guid> _succededToRunVms = new ArrayList<Guid>();
+    private final List<VmStatic> _externalVmsToAdd = new ArrayList();
     private boolean _saveVdsDynamic;
     private VDSStatus _firstStatus = VDSStatus.forValue(0);
     private boolean _saveVdsStatistics;
@@ -162,6 +165,7 @@
         updateAllInTransaction(_vmDiskImageDynamicToSave.values(), 
getDbFacade().getDiskImageDynamicDao());
         saveVmDevicesToDb();
         saveVmGuestAgentNetworkDevices();
+        
ResourceManager.getInstance().getEventListener().addExternallyManagedVms(_externalVmsToAdd);
     }
 
     private void saveVmGuestAgentNetworkDevices() {
@@ -962,6 +966,8 @@
 
             proceedDownVms();
 
+            processExternallyManagedVms();
+
             // update repository and check if there are any vm in cache that 
not
             // in vdsm
             updateRepository(running);
@@ -1448,6 +1454,33 @@
         }
     }
 
+    private void processExternallyManagedVms() {
+        _externalVmsToAdd.clear();
+        for (VmInternalData vmInternalData : _runningVms.values()) {
+            VM currentVmData = 
_vmDict.get(vmInternalData.getVmDynamic().getId());
+            if (currentVmData == null) {
+                if 
(getDbFacade().getVmDao().get(vmInternalData.getVmDynamic().getId()) == null) {
+                    Guid vmId = vmInternalData.getVmDynamic().getId();
+                    Map vmConfiguration = getVmInfo(vmId.toString())[0];
+                    VmStatic vmStatic = new VmStatic();
+                    
vmStatic.setOrigin(OriginType.valueOf(Config.<String>GetValue(ConfigValues.OriginType)));
+                    vmStatic.setId(vmId);
+                    vmStatic.setQuotaId(null);
+                    vmStatic.setCreationDate(new Date());
+                    vmStatic.setVdsGroupId(_vds.getVdsGroupId());
+                    String vmNameOnHost = (String) 
vmConfiguration.get(VdsProperties.vm_name);
+                    String vmName = "external-" + vmNameOnHost;
+                    vmStatic.setName(vmName);
+                    vmStatic.setNumOfSockets(Integer.parseInt((String) 
vmConfiguration.get(VdsProperties.num_of_cpus)));
+                    vmStatic.setMemSizeMb(Integer.parseInt((String) 
vmConfiguration.get(VdsProperties.mem_size_mb)));
+                    vmStatic.setExternallyManaged(true);
+                    _externalVmsToAdd.add(vmStatic);
+                    log.infoFormat("VDS::UpdateVmRunTimeInfo: Importing VM {0} 
as {1}, as it is running on the on Host, but does not exist in the engine.", 
vmNameOnHost, vmName);
+                }
+            }
+        }
+    }
+
     private void updateRepository(List<VM> running) {
         for (VmInternalData vmInternalData : _runningVms.values()) {
             VmDynamic runningVm = vmInternalData.getVmDynamic();
@@ -1770,12 +1803,6 @@
                 vmToUpdate.argvalue.updateRunTimeDynamicData(vmNewDynamicData, 
_vds.getId(), _vds.getName());
                 returnValue = true;
             }
-        } else {
-            // This should only happened when someone run a VM from command
-            // line.
-            if (Config.<Boolean> GetValue(ConfigValues.DebugTimerLogging)) {
-                log.info("VDS::UpdateVmRunTimeInfo Error: found VM on a VDS 
that is not in the database!");
-            }
         }
 
         return returnValue;
@@ -1953,5 +1980,16 @@
         auditLogable.addCustomValue("VmStatus", 
runningVm.getStatus().toString());
         AuditLogDirector.log(auditLogable, AuditLogType.VM_STATUS_RESTORED);
     }
-
+    /**
+     * gets VM full information for the given VM
+     *
+     * @param vmToUpdate
+     * @return
+     */
+    protected Map[] getVmInfo(String vmToUpdate) {
+        List<String> vms = new ArrayList<String>();
+        vms.add(vmToUpdate);
+        return (Map[]) (new FullListVdsCommand<FullListVDSCommandParameters>(
+                new FullListVDSCommandParameters(_vds, 
vms)).executeWithReturnValue());
+    }
 }
diff --git a/packaging/dbscripts/create_views.sql 
b/packaging/dbscripts/create_views.sql
index bcb295a..e532b81 100644
--- a/packaging/dbscripts/create_views.sql
+++ b/packaging/dbscripts/create_views.sql
@@ -563,7 +563,7 @@
                       vm_static.default_display_type as default_display_type, 
vm_static.priority as priority,vm_static.iso_path as iso_path, vm_static.origin 
as origin, vds_groups.compatibility_version as vds_group_compatibility_version,
                       vm_static.initrd_url as initrd_url, vm_static.kernel_url 
as kernel_url, vm_static.kernel_params as kernel_params, 
vm_dynamic.pause_status as pause_status, vm_dynamic.exit_message as 
exit_message, vm_dynamic.exit_status as exit_status,vm_static.migration_support 
as migration_support,vm_static.predefined_properties as 
predefined_properties,vm_static.userdefined_properties as 
userdefined_properties,vm_static.min_allocated_mem as min_allocated_mem,  
vm_dynamic.hash as hash, vm_static.cpu_pinning as cpu_pinning, 
vm_static.db_generation as db_generation, vm_static.host_cpu_flags as 
host_cpu_flags,
                       vm_static.tunnel_migration as tunnel_migration, 
vm_static.vnc_keyboard_layout as vnc_keyboard_layout, 
vm_static.is_run_and_pause as is_run_and_pause, vm_static.created_by_user_id as 
created_by_user_id,
-                      vm_dynamic.last_watchdog_event as last_watchdog_event, 
vm_dynamic.last_watchdog_action as last_watchdog_action
+                      vm_dynamic.last_watchdog_event as last_watchdog_event, 
vm_dynamic.last_watchdog_action as last_watchdog_action, 
vm_static.is_externally_managed as is_externally_managed
 FROM         vm_static INNER JOIN
 vm_dynamic ON vm_static.vm_guid = vm_dynamic.vm_guid INNER JOIN
 vm_static AS vm_templates ON vm_static.vmt_guid = vm_templates.vm_guid INNER 
JOIN
@@ -600,7 +600,7 @@
             vms.vds_group_compatibility_version, vms.initrd_url, 
vms.kernel_url, vms.kernel_params, vms.pause_status,
             vms.exit_status, vms.exit_message, vms.min_allocated_mem, 
storage_domain_static.id AS storage_id,
             vms.quota_id as quota_id, vms.quota_name as quota_name, 
vms.tunnel_migration as tunnel_migration,
-            vms.vnc_keyboard_layout as vnc_keyboard_layout, 
vms.is_run_and_pause as is_run_and_pause, vms.created_by_user_id as 
created_by_user_id
+            vms.vnc_keyboard_layout as vnc_keyboard_layout, 
vms.is_run_and_pause as is_run_and_pause, vms.created_by_user_id as 
created_by_user_id, vms.is_externally_managed as is_externally_managed
 FROM        vms LEFT OUTER JOIN
             tags_vm_map_view ON vms.vm_guid = tags_vm_map_view.vm_id LEFT 
OUTER JOIN
             vm_device ON vm_device.vm_id = vms.vm_guid LEFT OUTER JOIN
diff --git 
a/packaging/dbscripts/upgrade/03_03_0600_add_externally_managed_to_vm_static.sql
 
b/packaging/dbscripts/upgrade/03_03_0600_add_externally_managed_to_vm_static.sql
new file mode 100644
index 0000000..73a8e29
--- /dev/null
+++ 
b/packaging/dbscripts/upgrade/03_03_0600_add_externally_managed_to_vm_static.sql
@@ -0,0 +1,2 @@
+select fn_db_add_column('vm_static', 'is_externally_managed', 'boolean default 
false');
+
diff --git a/packaging/dbscripts/vms_sp.sql b/packaging/dbscripts/vms_sp.sql
index aedca76..2f74855 100644
--- a/packaging/dbscripts/vms_sp.sql
+++ b/packaging/dbscripts/vms_sp.sql
@@ -414,6 +414,7 @@
  v_auto_startup BOOLEAN,
  v_is_stateless BOOLEAN,
  v_is_smartcard_enabled BOOLEAN,
+ v_is_externally_managed BOOLEAN,
  v_is_delete_protected BOOLEAN,
  v_dedicated_vm_for_vds UUID ,
     v_fail_back BOOLEAN ,
@@ -441,8 +442,8 @@
 RETURNS VOID
    AS $procedure$
 BEGIN
-INSERT INTO vm_static(description, free_text_comment, mem_size_mb, os, 
vds_group_id, vm_guid, VM_NAME, 
vmt_guid,domain,creation_date,num_of_monitors,allow_console_reconnect,is_initialized,num_of_sockets,cpu_per_socket,usb_policy,
 time_zone,auto_startup,is_stateless,dedicated_vm_for_vds, fail_back, 
default_boot_sequence, vm_type, nice_level, 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,host_cpu_flags, tunnel_migration, 
vnc_keyboard_layout, is_run_and_pause, created_by_user_id)
-       VALUES(v_description, v_free_text_comment, v_mem_size_mb, v_os, 
v_vds_group_id, v_vm_guid, v_vm_name, v_vmt_guid, v_domain, v_creation_date, 
v_num_of_monitors, v_allow_console_reconnect, v_is_initialized, 
v_num_of_sockets, v_cpu_per_socket, v_usb_policy, v_time_zone, 
v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back, 
v_default_boot_sequence, v_vm_type, v_nice_level, 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_host_cpu_flags, 
v_tunnel_migration, v_vnc_keyboard_layout, v_is_run_and_pause, 
v_created_by_user_id);
+INSERT INTO vm_static(description, free_text_comment, mem_size_mb, os, 
vds_group_id, vm_guid, VM_NAME, 
vmt_guid,domain,creation_date,num_of_monitors,allow_console_reconnect,is_initialized,num_of_sockets,cpu_per_socket,usb_policy,
 time_zone,auto_startup,is_stateless,dedicated_vm_for_vds, fail_back, 
default_boot_sequence, vm_type, nice_level, 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_externally_managed, is_delete_protected,host_cpu_flags, tunnel_migration, 
vnc_keyboard_layout, is_run_and_pause, created_by_user_id)
+       VALUES(v_description, v_free_text_comment, v_mem_size_mb, v_os, 
v_vds_group_id, v_vm_guid, v_vm_name, v_vmt_guid, v_domain, v_creation_date, 
v_num_of_monitors, v_allow_console_reconnect, v_is_initialized, 
v_num_of_sockets, v_cpu_per_socket, v_usb_policy, v_time_zone, 
v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back, 
v_default_boot_sequence, v_vm_type, v_nice_level, 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_externally_managed, v_is_delete_protected,v_host_cpu_flags, 
v_tunnel_migration, v_vnc_keyboard_layout, v_is_run_and_pause, 
v_created_by_user_id);
 -- perform deletion from vm_ovf_generations to ensure that no record exists 
when performing insert to avoid PK violation.
 DELETE FROM vm_ovf_generations gen WHERE gen.vm_guid = v_vm_guid;
 INSERT INTO vm_ovf_generations(vm_guid, storage_pool_id) VALUES (v_vm_guid, 
(SELECT storage_pool_id FROM vds_groups vg WHERE vg.vds_group_id = 
v_vds_group_id));
@@ -531,6 +532,7 @@
  v_auto_startup BOOLEAN,
  v_is_stateless BOOLEAN,
  v_is_smartcard_enabled BOOLEAN,
+ v_is_externally_managed BOOLEAN,
  v_is_delete_protected BOOLEAN,
  v_dedicated_vm_for_vds UUID ,
     v_fail_back BOOLEAN ,
@@ -577,8 +579,9 @@
       kernel_params = v_kernel_params,migration_support = v_migration_support,
       predefined_properties = v_predefined_properties,userdefined_properties = 
v_userdefined_properties,
       min_allocated_mem = v_min_allocated_mem, quota_id = v_quota_id, 
cpu_pinning = v_cpu_pinning, is_smartcard_enabled = v_is_smartcard_enabled,
-      is_delete_protected = v_is_delete_protected, host_cpu_flags = 
v_host_cpu_flags, tunnel_migration = v_tunnel_migration,
-      vnc_keyboard_layout = v_vnc_keyboard_layout, is_run_and_pause = 
v_is_run_and_pause, created_by_user_id = v_created_by_user_id
+      is_externally_managed = v_is_externally_managed, is_delete_protected = 
v_is_delete_protected, host_cpu_flags = v_host_cpu_flags,
+      tunnel_migration = v_tunnel_migration, vnc_keyboard_layout = 
v_vnc_keyboard_layout, is_run_and_pause = v_is_run_and_pause,
+      created_by_user_id = v_created_by_user_id
       WHERE vm_guid = v_vm_guid
       AND   entity_type = 'VM';
 END; $procedure$
@@ -906,6 +909,7 @@
  v_auto_startup BOOLEAN,
  v_is_stateless BOOLEAN,
  v_is_smartcard_enabled BOOLEAN,
+ v_is_externally_managed BOOLEAN,
  v_is_delete_protected BOOLEAN,
  v_dedicated_vm_for_vds UUID ,
     v_fail_back BOOLEAN ,
@@ -931,8 +935,8 @@
 RETURNS VOID
    AS $procedure$
 BEGIN
-INSERT INTO vm_static(description, free_text_comment,  mem_size_mb, os, 
vds_group_id, vm_guid, VM_NAME, vmt_guid, num_of_monitors, 
allow_console_reconnect, is_initialized, num_of_sockets, cpu_per_socket, 
usb_policy, 
time_zone,auto_startup,is_stateless,dedicated_vm_for_vds,fail_back,vm_type,nice_level,default_boot_sequence,default_display_type,priority,iso_path,origin,initrd_url,kernel_url,kernel_params,migration_support,predefined_properties,userdefined_properties,min_allocated_mem,cpu_pinning,is_smartcard_enabled,is_delete_protected,host_cpu_flags,
 tunnel_migration, is_run_and_pause, created_by_user_id)
-       VALUES(v_description, v_free_text_comment, v_mem_size_mb, v_os, 
v_vds_group_id, v_vm_guid, v_vm_name, v_vmt_guid, v_num_of_monitors, 
v_num_of_monitors, v_is_initialized, v_num_of_sockets, v_cpu_per_socket, 
v_usb_policy, 
v_time_zone,v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back,v_vm_type,v_nice_level,v_default_boot_sequence,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,v_cpu_pinning,v_is_smartcard_enabled,v_is_delete_protected,v_host_cpu_flags,
 v_tunnel_migration, v_is_run_and_pause, v_created_by_user_id);
+INSERT INTO vm_static(description, free_text_comment,  mem_size_mb, os, 
vds_group_id, vm_guid, VM_NAME, vmt_guid, num_of_monitors, 
allow_console_reconnect, is_initialized, num_of_sockets, cpu_per_socket, 
usb_policy, 
time_zone,auto_startup,is_stateless,dedicated_vm_for_vds,fail_back,vm_type,nice_level,default_boot_sequence,default_display_type,priority,iso_path,origin,initrd_url,kernel_url,kernel_params,migration_support,predefined_properties,userdefined_properties,min_allocated_mem,cpu_pinning,is_smartcard_enabled,
 is_externally_managed, is_delete_protected,host_cpu_flags, tunnel_migration, 
is_run_and_pause, created_by_user_id)
+       VALUES(v_description, v_free_text_comment, v_mem_size_mb, v_os, 
v_vds_group_id, v_vm_guid, v_vm_name, v_vmt_guid, v_num_of_monitors, 
v_num_of_monitors, v_is_initialized, v_num_of_sockets, v_cpu_per_socket, 
v_usb_policy, 
v_time_zone,v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back,v_vm_type,v_nice_level,v_default_boot_sequence,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,v_cpu_pinning,v_is_smartcard_enabled,
 v_is_externally_managed, v_is_delete_protected,v_host_cpu_flags, 
v_tunnel_migration, v_is_run_and_pause, v_created_by_user_id);
 
       INSERT INTO vm_dynamic(vm_guid, status) VALUES(v_vm_guid, 0);
 


-- 
To view, visit http://gerrit.ovirt.org/17269
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6b933df39aaf6897a675aef0564d3fb4922f12e7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Oved Ourfali <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to