|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
import { RequestHandler } from 'express'; |
|
|
|
|
|
|
|
|
|
// import SERVER_PATHS from '../../consts/SERVER_PATHS';
|
|
|
|
|
import SERVER_PATHS from '../../consts/SERVER_PATHS'; |
|
|
|
|
|
|
|
|
|
import { dbQuery, sub } from '../../accessModule'; |
|
|
|
|
|
|
|
|
@ -12,24 +12,25 @@ export const createServer: RequestHandler = ({ body }, response) => { |
|
|
|
|
serverName, |
|
|
|
|
cpuCores, |
|
|
|
|
memory, |
|
|
|
|
virtualDisks: [{ storageSize, storageGroupUUID }], |
|
|
|
|
virtualDisks: [ |
|
|
|
|
{ storageSize = undefined, storageGroupUUID = undefined } = {}, |
|
|
|
|
] = [], |
|
|
|
|
installISOFileUUID, |
|
|
|
|
driverISOFileUUIDs, |
|
|
|
|
driverISOFileUUID = 'none', |
|
|
|
|
anvilUUID, |
|
|
|
|
optimizeForOS, |
|
|
|
|
} = body; |
|
|
|
|
|
|
|
|
|
console.dir(body, { depth: null }); |
|
|
|
|
|
|
|
|
|
const provisionServerJobData = ` |
|
|
|
|
server_name=${serverName} |
|
|
|
|
os=${optimizeForOS} |
|
|
|
|
cpu_cores=${cpuCores} |
|
|
|
|
ram=${memory} |
|
|
|
|
storage_group_uuid=${storageGroupUUID} |
|
|
|
|
storage_size=${storageSize} |
|
|
|
|
install_iso=${installISOFileUUID} |
|
|
|
|
driver_iso=${driverISOFileUUIDs}`;
|
|
|
|
|
const provisionServerJobData = `server_name=${serverName} |
|
|
|
|
os=${optimizeForOS} |
|
|
|
|
cpu_cores=${cpuCores} |
|
|
|
|
ram=${memory} |
|
|
|
|
storage_group_uuid=${storageGroupUUID} |
|
|
|
|
storage_size=${storageSize} |
|
|
|
|
install_iso=${installISOFileUUID} |
|
|
|
|
driver_iso=${driverISOFileUUID}`;
|
|
|
|
|
|
|
|
|
|
console.log(`provisionServerJobData: [${provisionServerJobData}]`); |
|
|
|
|
|
|
|
|
@ -58,19 +59,19 @@ export const createServer: RequestHandler = ({ body }, response) => { |
|
|
|
|
`provisionServerJobHostUUID from DB: [${provisionServerJobHostUUID}]`, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// sub('insert_or_update_jobs', {
|
|
|
|
|
// subParams: {
|
|
|
|
|
// file: __filename,
|
|
|
|
|
// line: 0,
|
|
|
|
|
// job_command: SERVER_PATHS.usr.sbin['anvil-provision-server'].self,
|
|
|
|
|
// job_data: provisionServerJobData,
|
|
|
|
|
// job_name: 'server:provision',
|
|
|
|
|
// job_title: 'job_0147',
|
|
|
|
|
// job_description: 'job_0148',
|
|
|
|
|
// job_progress: 0,
|
|
|
|
|
// job_host_uuid: provisionServerJobHostUUID,
|
|
|
|
|
// },
|
|
|
|
|
// });
|
|
|
|
|
sub('insert_or_update_jobs', { |
|
|
|
|
subParams: { |
|
|
|
|
file: __filename, |
|
|
|
|
line: 0, |
|
|
|
|
job_command: SERVER_PATHS.usr.sbin['anvil-provision-server'].self, |
|
|
|
|
job_data: provisionServerJobData, |
|
|
|
|
job_name: 'server:provision', |
|
|
|
|
job_title: 'job_0147', |
|
|
|
|
job_description: 'job_0148', |
|
|
|
|
job_progress: 0, |
|
|
|
|
job_host_uuid: provisionServerJobHostUUID, |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
response.status(202).send(); |
|
|
|
|