- echo "DROP PROCEDURE IF EXISTS UpdateSwitchPort;
- delimiter //
- CREATE PROCEDURE UpdateSwitchPort() MODIFIES SQL DATA SQL SECURITY INVOKER
- COMMENT 'Load the openflow switch ports from of_ports_pci_correspondece into resoureces_port and ports'
- BEGIN
- #DELETES switch_port entry before writing, because if not it fails for key constrains
- UPDATE ports
- RIGHT JOIN resources_port as RP on ports.uuid=RP.port_id
- INNER JOIN resources_port as RP2 on RP2.id=RP.root_id
- INNER JOIN numas on RP.numa_id=numas.id
- INNER JOIN hosts on numas.host_id=hosts.uuid
- INNER JOIN of_ports_pci_correspondence as PC on hosts.ip_name=PC.ip_name and RP2.pci=PC.pci
- SET ports.switch_port=null, ports.switch_dpid=null, RP.switch_port=null, RP.switch_dpid=null;
- #write switch_port into resources_port and ports
- UPDATE ports
- RIGHT JOIN resources_port as RP on ports.uuid=RP.port_id
- INNER JOIN resources_port as RP2 on RP2.id=RP.root_id
- INNER JOIN numas on RP.numa_id=numas.id
- INNER JOIN hosts on numas.host_id=hosts.uuid
- INNER JOIN of_ports_pci_correspondence as PC on hosts.ip_name=PC.ip_name and RP2.pci=PC.pci
- SET ports.switch_port=PC.switch_port, ports.switch_dpid=PC.switch_dpid, RP.switch_port=PC.switch_port, RP.switch_dpid=PC.switch_dpid;
- END//
- delimiter ;" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1
- echo "INSERT INTO \`schema_version\` (\`version_int\`, \`version\`, \`openvim_ver\`, \`comments\`, \`date\`)
- VALUES (2, '0.2', '0.2.03', 'update Procedure UpdateSwitchPort', '2015-05-06');" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1
+ sql "DROP PROCEDURE IF EXISTS UpdateSwitchPort;
+ delimiter //
+ CREATE PROCEDURE UpdateSwitchPort() MODIFIES SQL DATA SQL SECURITY INVOKER
+ COMMENT 'Load the openflow switch ports from of_ports_pci_correspondece into resoureces_port and ports'
+ BEGIN
+ #DELETES switch_port entry before writing, because if not it fails for key constrains
+ UPDATE ports
+ RIGHT JOIN resources_port as RP on ports.uuid=RP.port_id
+ INNER JOIN resources_port as RP2 on RP2.id=RP.root_id
+ INNER JOIN numas on RP.numa_id=numas.id
+ INNER JOIN hosts on numas.host_id=hosts.uuid
+ INNER JOIN of_ports_pci_correspondence as PC on hosts.ip_name=PC.ip_name and RP2.pci=PC.pci
+ SET ports.switch_port=null, ports.switch_dpid=null, RP.switch_port=null, RP.switch_dpid=null;
+ #write switch_port into resources_port and ports
+ UPDATE ports
+ RIGHT JOIN resources_port as RP on ports.uuid=RP.port_id
+ INNER JOIN resources_port as RP2 on RP2.id=RP.root_id
+ INNER JOIN numas on RP.numa_id=numas.id
+ INNER JOIN hosts on numas.host_id=hosts.uuid
+ INNER JOIN of_ports_pci_correspondence as PC on hosts.ip_name=PC.ip_name and RP2.pci=PC.pci
+ SET ports.switch_port=PC.switch_port, ports.switch_dpid=PC.switch_dpid, RP.switch_port=PC.switch_port, "\
+ "RP.switch_dpid=PC.switch_dpid;
+ END//
+ delimiter ;"
+ sql "INSERT INTO \`schema_version\` (\`version_int\`, \`version\`, \`openvim_ver\`, \`comments\`, \`date\`) "\
+ "VALUES (2, '0.2', '0.2.03', 'update Procedure UpdateSwitchPort', '2015-05-06');"