Shahar Havivi has uploaded a new change for review. Change subject: VmInit 2 ......................................................................
VmInit 2 Change-Id: I3e9d9d62129c1632449613c5f097a951b73de8d4 Signed-off-by: Shahar Havivi <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInit.java D backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInitFile.java R backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInitNetwork.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitDAODbFacadeImpl.java D backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitFileDAO.java D backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitFileDAODbFacadeImpl.java D backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitInterfaceDAO.java D backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitInterfaceDAODbFacadeImpl.java M packaging/dbscripts/create_views.sql M packaging/dbscripts/upgrade/03_04_0105_add_vm_init_table.sql M packaging/dbscripts/vms_sp.sql 11 files changed, 59 insertions(+), 480 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/56/22256/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInit.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInit.java index d2fa010..0a62dcb 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInit.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInit.java @@ -1,9 +1,6 @@ package org.ovirt.engine.core.common.businessentities; import java.io.Serializable; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; import org.ovirt.engine.core.compat.Guid; @@ -12,23 +9,19 @@ private Guid id; private String hostname; private String domain; + private String timeZone; private String authorizedKeys; private Boolean regenerateKeys; - private List<String> dnsServers; - private List<String> dnsSearch; - private List<VmInitInterface> interfaces; + private String dnsServers; + private String dnsSearch; + private String networks; - private String timeZone; + private String winKey; private String rootPassword; - - private List<VmInitFile> files; - private String custromScript; public VmInit() { - files = new ArrayList<VmInitFile>(); - interfaces = new ArrayList<VmInitInterface>(); } public void setCustromScript(String custromScript) { @@ -67,62 +60,20 @@ return regenerateKeys; } - public void setDnsServers(List<String> dnsServers) { + public void setDnsServers(String dnsServers) { this.dnsServers = dnsServers; } - public List<String> getDnsServers() { + public String getDnsServers() { return dnsServers; } - public void setDnsSearch(List<String> dnsSearch) { + public void setDnsSearch(String dnsSearch) { this.dnsSearch = dnsSearch; } - public List<String> getDnsSearch() { + public String getDnsSearch() { return dnsSearch; - } - - public String getFlatDnsSearch() { - return listToString(dnsSearch); - } - - public void setFlatDnsSerarch(String dnsSearchString) { - dnsSearch = stringToList(dnsSearchString); - } - - public String getFlatDnsServers() { - return listToString(dnsServers); - } - - public void setFlatDnsServers(String dnsServersString) { - dnsServers = stringToList(dnsServersString); - } - - private List<String> stringToList(String str) { - List<String> list = new ArrayList<String>(); - for (String i : str.split(";")) { - list.add(i); - } - return list; - } - - private String listToString(List<String> list) { - StringBuilder sb = new StringBuilder(); - for (Iterator<String> iterator = list.iterator(); iterator.hasNext();) { - sb.append(iterator.next()); - if (iterator.hasNext()) { - sb.append(","); - } - } - return sb.toString(); - } - - public void setInterfaces(List<VmInitInterface> interfaces) { - this.interfaces = interfaces; - } - public List<VmInitInterface> getInterfaces() { - return interfaces; } public void setTimeZone(String timeZone) { @@ -139,13 +90,6 @@ return rootPassword; } - public void setFiels(List<VmInitFile> files) { - this.files = files; - } - public List<VmInitFile> getFiles() { - return files; - } - @Override public Guid getId() { return id; @@ -155,4 +99,20 @@ public void setId(Guid id) { this.id = id; } + + public String getNetworks() { + return networks; + } + + public void setNetworks(String networks) { + this.networks = networks; + } + + public String getWinKey() { + return winKey; + } + + public void setWinKey(String winKey) { + this.winKey = winKey; + } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInitFile.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInitFile.java deleted file mode 100644 index d81009e..0000000 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInitFile.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.ovirt.engine.core.common.businessentities; - -import java.io.Serializable; - -import org.ovirt.engine.core.compat.Guid; - -public class VmInitFile implements Serializable, BusinessEntity<Guid> { - - private static final long serialVersionUID = 1L; - public static enum FileType { - BASE64, - PLAINTEXT, - } - - private Guid id; - private FileType type; - private String content; - private String path; - - public void setFileType(FileType type) { - this.type = type; - } - public FileType getFileType() { - return type; - } - - public void setContent(String content) { - this.content = content; - } - public String getContent() { - return content; - } - - public void setPath(String path) { - this.path = path; - } - public String getPath() { - return path; - } - - public Guid getId() { - return id; - } - - public void setId(Guid id) { - this.id = id; - } -} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInitInterface.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInitNetwork.java similarity index 79% rename from backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInitInterface.java rename to backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInitNetwork.java index 61a8479..588d832 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInitInterface.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmInitNetwork.java @@ -2,22 +2,26 @@ import java.io.Serializable; +import org.ovirt.engine.core.common.businessentities.network.NetworkBootProtocol; import org.ovirt.engine.core.compat.Guid; -public class VmInitInterface implements Serializable, BusinessEntity<Guid> { +public class VmInitNetwork implements Serializable, BusinessEntity<Guid> { private static final long serialVersionUID = 1257388375049806155L; private Boolean startOnBoot; private String name; - private BootProtocol bootProtocol; + private NetworkBootProtocol bootProtocol; private String ip; private String netmask; private String gateway; private Guid id; - public static enum BootProtocol { - DHCP, - STATIC, - NONE + + public Guid getId() { + return id; + } + + public void setId(Guid id) { + this.id = id; } public void setStartOnBoot(Boolean startOnBoot) { @@ -26,22 +30,16 @@ public Boolean getStartOnBoot() { return startOnBoot; } - public Guid getId() { - return id; - } - public void setId(Guid id) { - this.id = id; - } public String getName() { return name; } public void setName(String name) { this.name = name; } - public BootProtocol getBootProtocol() { + public NetworkBootProtocol getBootProtocol() { return bootProtocol; } - public void setBootProtocol(BootProtocol bootProtocol) { + public void setBootProtocol(NetworkBootProtocol bootProtocol) { this.bootProtocol = bootProtocol; } public String getIp() { diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitDAODbFacadeImpl.java index 45d1253..324f351 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitDAODbFacadeImpl.java @@ -6,10 +6,7 @@ import org.apache.commons.lang.NotImplementedException; import org.ovirt.engine.core.common.businessentities.VmInit; -import org.ovirt.engine.core.common.businessentities.VmInitFile; -import org.ovirt.engine.core.common.businessentities.VmInitInterface; import org.ovirt.engine.core.compat.Guid; -import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; @@ -20,8 +17,6 @@ VmInit vmInit = getCallsHandler().executeRead("GetVmInitByVmId", VMInitRowMapper.instance, getIdParamterSource(id)); - vmInit.setFiels(DbFacade.getInstance().getVmInitFileDao().getAllByVmId(id)); - vmInit.setInterfaces(DbFacade.getInstance().getVmInitInterfaceDao().getAllByVmId(id)); return vmInit; } @@ -33,30 +28,16 @@ @Override public void save(VmInit entity) { getCallsHandler().executeModification("InsertVmInit", getFullParameterSource(entity)); - for (VmInitFile file: entity.getFiles()) { - DbFacade.getInstance().getVmInitFileDao().save(file); - } - for (VmInitInterface iface: entity.getInterfaces()) { - DbFacade.getInstance().getVmInitInterfaceDao().save(iface); - } } @Override public void update(VmInit entity) { getCallsHandler().executeModification("UpdateVmInit", getFullParameterSource(entity)); - for (VmInitFile file: entity.getFiles()) { - DbFacade.getInstance().getVmInitFileDao().update(file); - } - for (VmInitInterface iface: entity.getInterfaces()) { - DbFacade.getInstance().getVmInitInterfaceDao().update(iface); - } } @Override public void remove(Guid id) { getCallsHandler().executeModification("DeleteVmInit", getIdParamterSource(id)); - DbFacade.getInstance().getVmInitFileDao().remove(id); - DbFacade.getInstance().getVmInitInterfaceDao().remove(id); } private MapSqlParameterSource getIdParamterSource(Guid id) { @@ -75,6 +56,9 @@ .addValue("dns_servers", vmInit.getDnsServers()) .addValue("dns_search", vmInit.getDnsSearch()) .addValue("time_zone", vmInit.getTimeZone()) + .addValue("networks", vmInit.getTimeZone()) + .addValue("password", vmInit.getTimeZone()) + .addValue("winkey", vmInit.getTimeZone()) .addValue("custom_script", vmInit.getCustromScript()); } @@ -91,9 +75,12 @@ entity.setAuthorizedKeys(rs.getString("authorized_keys")); entity.setRegenerateKeys(rs.getBoolean("regenerate_keys")); entity.setTimeZone(rs.getString("time_zone")); - entity.setCustromScript(rs.getString("custom_script")); + entity.setTimeZone(rs.getString("networks")); + entity.setTimeZone(rs.getString("password")); + entity.setTimeZone(rs.getString("winkey")); entity.setHostname(rs.getString("dns_servers")); entity.setHostname(rs.getString("dns_search_domains")); + entity.setCustromScript(rs.getString("custom_script")); return entity; } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitFileDAO.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitFileDAO.java deleted file mode 100644 index 09a46f8..0000000 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitFileDAO.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.ovirt.engine.core.dao; - -import java.util.List; - -import org.ovirt.engine.core.common.businessentities.VmInitFile; -import org.ovirt.engine.core.compat.Guid; - -public interface VmInitFileDAO extends GenericDao<VmInitFile, Guid> { - List<VmInitFile> getAllByVmId(Guid vmId); -} - diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitFileDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitFileDAODbFacadeImpl.java deleted file mode 100644 index ff78073..0000000 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitFileDAODbFacadeImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.ovirt.engine.core.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.apache.commons.lang.NotImplementedException; -import org.ovirt.engine.core.common.businessentities.VmInitFile; -import org.ovirt.engine.core.common.businessentities.VmInitFile.FileType; -import org.ovirt.engine.core.compat.Guid; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; - -public class VmInitFileDAODbFacadeImpl extends BaseDAODbFacade implements VmInitFileDAO { - - @Override - public VmInitFile get(Guid id) { - throw new NotImplementedException(); - } - - @Override - public List<VmInitFile> getAll() { - throw new NotImplementedException(); - } - - @Override - public void save(VmInitFile entity) { - getCallsHandler().executeModification("InsertVmInitFile", getFullParameterSourceVmInitFile(entity)); - } - - @Override - public void update(VmInitFile entity) { - getCallsHandler().executeModification("UpdateVmInitFile", getFullParameterSourceVmInitFile(entity)); - } - - @Override - public void remove(Guid id) { - getCallsHandler().executeModification("DeleteVmInitFile", getIdParamterSource(id)); - } - - public List<VmInitFile> getAllByVmId(Guid vmId) - { - return getCallsHandler().executeReadList("GetVmInitFileByVmId", - VMInitFileRowMapper.instance, - getIdParamterSource(vmId)); - } - - private MapSqlParameterSource getIdParamterSource(Guid id) { - return getCustomMapSqlParameterSource() - .addValue("vm_id", id); - } - - private MapSqlParameterSource getFullParameterSourceVmInitFile(VmInitFile vmInitFile) { - return getCustomMapSqlParameterSource() - .addValue("vm_id", vmInitFile.getId()) - .addValue("path", vmInitFile.getPath()) - .addValue("file_type", vmInitFile.getFileType()) - .addValue("content", vmInitFile.getContent()); - } - - private static class VMInitFileRowMapper implements RowMapper<VmInitFile> { - public static final VMInitFileRowMapper instance = new VMInitFileRowMapper(); - - @Override - public VmInitFile mapRow(ResultSet rs, int rowNum) throws SQLException { - final VmInitFile entity = new VmInitFile(); - - entity.setId(getGuidDefaultEmpty(rs, "vm_id")); - entity.setPath(rs.getString("path")); - entity.setFileType(FileType.valueOf(rs.getString("file_type"))); - entity.setContent(rs.getString("content")); - - return entity; - } - } -} diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitInterfaceDAO.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitInterfaceDAO.java deleted file mode 100644 index 94305ad..0000000 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitInterfaceDAO.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.ovirt.engine.core.dao; - -import java.util.List; - -import org.ovirt.engine.core.common.businessentities.VmInitInterface; -import org.ovirt.engine.core.compat.Guid; - -public interface VmInitInterfaceDAO extends GenericDao<VmInitInterface, Guid> { - List<VmInitInterface> getAllByVmId(Guid vmId); -} - diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitInterfaceDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitInterfaceDAODbFacadeImpl.java deleted file mode 100644 index fd23f48..0000000 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmInitInterfaceDAODbFacadeImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.ovirt.engine.core.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.apache.commons.lang.NotImplementedException; -import org.ovirt.engine.core.common.businessentities.VmInitInterface; -import org.ovirt.engine.core.common.businessentities.VmInitInterface.BootProtocol; -import org.ovirt.engine.core.compat.Guid; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; - -public class VmInitInterfaceDAODbFacadeImpl extends BaseDAODbFacade implements VmInitInterfaceDAO { - - @Override - public VmInitInterface get(Guid id) { - throw new NotImplementedException(); - } - - @Override - public List<VmInitInterface> getAll() { - throw new NotImplementedException(); - } - - @Override - public void save(VmInitInterface entity) { - getCallsHandler().executeModification("InsertVmInitInterface", getFullParameterSourceVmInitInterface(entity)); - } - - @Override - public void update(VmInitInterface entity) { - getCallsHandler().executeModification("UpdateVmInitInterface", getFullParameterSourceVmInitInterface(entity)); - } - - @Override - public void remove(Guid id) { - getCallsHandler().executeModification("DeleteVmInitInterface", getIdParamterSource(id)); - } - - public List<VmInitInterface> getAllByVmId(Guid vmId) - { - return getCallsHandler().executeReadList("GetVmInitFileByVmId", - VmInitInterfaceRowMapper.instance, - getIdParamterSource(vmId)); - } - - private MapSqlParameterSource getIdParamterSource(Guid id) { - return getCustomMapSqlParameterSource() - .addValue("vm_id", id); - } - - private MapSqlParameterSource getFullParameterSourceVmInitInterface(VmInitInterface vmInitIface) { - return getCustomMapSqlParameterSource() - .addValue("vm_id", vmInitIface.getId()) - .addValue("name", vmInitIface.getName()) - .addValue("boot_protocol", vmInitIface.getBootProtocol()) - .addValue("ip", vmInitIface.getIp()) - .addValue("netmask", vmInitIface.getNetmask()) - .addValue("gateway", vmInitIface.getGateway()) - .addValue("start_on_boot", vmInitIface.getStartOnBoot()); - } - - private static class VmInitInterfaceRowMapper implements RowMapper<VmInitInterface> { - public static final VmInitInterfaceRowMapper instance = new VmInitInterfaceRowMapper(); - - @Override - public VmInitInterface mapRow(ResultSet rs, int rowNum) throws SQLException { - final VmInitInterface entity = new VmInitInterface(); - - entity.setId(getGuidDefaultEmpty(rs, "vm_id")); - entity.setName(rs.getString("name")); - entity.setBootProtocol(BootProtocol.valueOf(rs.getString("boot_protocol"))); - entity.setIp(rs.getString("ip")); - entity.setNetmask(rs.getString("netmask")); - entity.setGateway(rs.getString("gateway")); - entity.setStartOnBoot(rs.getBoolean("start_on_boot")); - - return entity; - } - } -} diff --git a/packaging/dbscripts/create_views.sql b/packaging/dbscripts/create_views.sql index 692cb91..ebcc883 100644 --- a/packaging/dbscripts/create_views.sql +++ b/packaging/dbscripts/create_views.sql @@ -1639,13 +1639,3 @@ vds_static.vds_name AS server_name FROM gluster_server_hooks INNER JOIN vds_static ON gluster_server_hooks.server_id = vds_static.vds_id; - -CREATE OR REPLACE VIEW vm_init_view -AS -SELECT vm_init.*, - vm_init_interface.name as interface_name, vm_init_interface.name, vm_init_interface.boot_protocol, vm_init_interface.ip, - vm_init_interface.netmask, vm_init_interface.gateway, vm_init_interface.start_on_boot, - vm_init_file.path, vm_init_file.content, vm_init_file.file_type -FROM vm_init -RIGHT JOIN vm_init_interface on vm_init.vm_id = vm_init_interface.vm_id -RIGHT JOIN vm_init_file on vm_init_file.vm_id = vm_init_interface.vm_id diff --git a/packaging/dbscripts/upgrade/03_04_0105_add_vm_init_table.sql b/packaging/dbscripts/upgrade/03_04_0105_add_vm_init_table.sql index 4176c17..235cb68 100644 --- a/packaging/dbscripts/upgrade/03_04_0105_add_vm_init_table.sql +++ b/packaging/dbscripts/upgrade/03_04_0105_add_vm_init_table.sql @@ -12,32 +12,8 @@ time_zone VARCHAR(40), dns_servers TEXT, dns_search_domains TEXT, + networks TEXT, + password TEXT, + winkey VARCHAR(30), custom_script TEXT -) WITH OIDS; - --- ---------------------------------------------------------------------- --- Add table "vm_init_interface" --- ---------------------------------------------------------------------- - -CREATE TABLE vm_init_interface -( - vm_id UUID NOT NULL, - name VARCHAR[256], - boot_protocol VARCHAR[16], - ip VARCHAR[256], - netmask VARCHAR[256], - gateway VARCHAR[256], - start_on_boot BOOLEAN DEFAULT false -) WITH OIDS; - --- ---------------------------------------------------------------------- --- Add table "vm_init_file" --- ---------------------------------------------------------------------- - -CREATE TABLE vm_init_file -( - vm_id UUID NOT NULL, - path TEXT, - file_type VARCHAR(32), - content TEXT ) WITH OIDS; diff --git a/packaging/dbscripts/vms_sp.sql b/packaging/dbscripts/vms_sp.sql index 09dcbb6..f62fa86 100644 --- a/packaging/dbscripts/vms_sp.sql +++ b/packaging/dbscripts/vms_sp.sql @@ -1125,6 +1125,9 @@ v_time_zone VARCHAR(40), v_dns_servers TEXT, v_dns_search_domains TEXT, + v_networks TEXT, + v_password TEXT, + v_winkey VARCHAR(30), v_custom_script TEXT) RETURNS VOID @@ -1132,7 +1135,8 @@ BEGIN UPDATE vm_init SET host_name=v_host_name, domain=v_domain, authorized_keys=v_authorized_keys, regenerate_key=v_regenerate_keys, - time_zone=v_time_zone, dns_servers=v_dns_servers, dns_search_domains=v_dns_search_domains, custom_script=v_custom_script + time_zone=v_time_zone, dns_servers=v_dns_servers, dns_search_domains=v_dns_search_domains, + networks=v_networks, password=v_password, winkey=v_winkey, custom_script=v_custom_script WHERE vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; @@ -1142,10 +1146,6 @@ RETURNS VOID AS $procedure$ BEGIN - DELETE FROM vm_init_file - WHERE vm_id = v_vm_id; - DELETE FROM vm_init_interface - WHERE vm_id = v_vm_id; DELETE FROM vm_init WHERE vm_id = v_vm_id; @@ -1162,121 +1162,17 @@ v_time_zone VARCHAR(40), v_dns_servers TEXT, v_dns_search_domains TEXT, + v_networks TEXT, + v_password TEXT, + v_winkey VARCHAR(30), v_custom_script TEXT) RETURNS VOID AS $procedure$ BEGIN -INSERT INTO vm_init(vm_id, host_name, domain, authorized_keys, regenerate_keys, time_zone, dns_servers, dns_search_domains, custom_script) - VALUES(v_vm_id, v_host_name, v_domain, v_authorized_keys, v_regenerate_keys, v_time_zone, v_dns_servers, v_dns_search_domains, v_custom_script); +INSERT INTO vm_init(vm_id, host_name, domain, authorized_keys, regenerate_keys, time_zone, dns_servers, dns_search_domains, + networks, password, winkey, custom_script) + VALUES(v_vm_id, v_host_name, v_domain, v_authorized_keys, v_regenerate_keys, v_time_zone, v_dns_servers, v_dns_search_domains, + v_networks, v_password, v_winkey, v_custom_script) END; $procedure$ LANGUAGE plpgsql; - ---------------------- --- vm_init_file ---------------------- -Create or replace FUNCTION GetVmInitFileByVmId( - v_vm_id UUID) -RETURNS VOID - AS $procedure$ -BEGIN - select * from vm_init_file - WHERE vm_id = v_vm_id; -END; $procedure$ -LANGUAGE plpgsql; - -Create or replace FUNCTION UpdateVmInitFile( - v_vm_id UUID, - v_path TEXT, - v_file_type VARCHAR(32), - v_content TEXT) -RETURNS VOID - AS $procedure$ -BEGIN - UPDATE vm_init_file - SET path=v_path, content=v_content, file_type=v_file_type - WHERE vm_id = v_vm_id; -END; $procedure$ -LANGUAGE plpgsql; - - -Create or replace FUNCTION DeleteVmInitFile(v_vm_id UUID) -RETURNS VOID - AS $procedure$ -BEGIN - DELETE FROM vm_init_file - WHERE vm_id = v_vm_id; -END; $procedure$ -LANGUAGE plpgsql; - - -Create or replace FUNCTION InsertVmInitFile( - v_vm_id UUID, - v_path TEXT, - v_file_type VARCHAR(32), - v_content TEXT) -RETURNS VOID - AS $procedure$ -BEGIN -INSERT INTO vm_init_file(vm_id, path, file_type, content) - VALUES(v_vm_id, v_path, v_file_type, v_content); -END; $procedure$ -LANGUAGE plpgsql; - - ---------------------- --- vm_init_interface ---------------------- -Create or replace FUNCTION GetVmInitInterfaceByVmId( - v_vm_id UUID) -RETURNS VOID - AS $procedure$ -BEGIN - select * from vm_init_interface - WHERE vm_id = v_vm_id; -END; $procedure$ -LANGUAGE plpgsql; - -Create or replace FUNCTION UpdateVmInitInterface( - v_vm_id UUID, - v_name VARCHAR[256], - v_boot_protocol VARCHAR[16], - v_ip VARCHAR[256], - v_netmask VARCHAR[256], - v_gateway VARCHAR[256], - v_start_on_boot BOOLEAN) -RETURNS VOID - AS $procedure$ -BEGIN - UPDATE vm_init_interface - SET name=v_name, boot_protocol=v_boot_protocol, ip=v_ip, netmask=v_netmask, gateway=v_gateway, start_on_boot=v_start_on_boot - WHERE vm_id = v_vm_id; -END; $procedure$ -LANGUAGE plpgsql; - - -Create or replace FUNCTION DeleteVmInitInterface(v_vm_id UUID) -RETURNS VOID - AS $procedure$ -BEGIN - DELETE FROM vm_init_interface - WHERE vm_id = v_vm_id; -END; $procedure$ -LANGUAGE plpgsql; - - -Create or replace FUNCTION InsertVmInitInterface( - v_vm_id UUID, - v_name VARCHAR[256], - v_boot_protocol VARCHAR[16], - v_ip VARCHAR[256], - v_netmask VARCHAR[256], - v_gateway VARCHAR[256], - v_start_on_boot BOOLEAN) -RETURNS VOID - AS $procedure$ -BEGIN -INSERT INTO vm_init_file(vm_id, name, boot_protocol, ip, netmask, gateway, start_on_boot) - VALUES(v_vm_id, v_name, v_boot_protocol, v_ip, v_netmask, v_gateway, v_start_on_boot); -END; $procedure$ -LANGUAGE plpgsql; -- To view, visit http://gerrit.ovirt.org/22256 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3e9d9d62129c1632449613c5f097a951b73de8d4 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Shahar Havivi <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
