NFV Director
===
###### tags: `Data Center` `QCT`
## APIs for Integration
- [Integration Telemetry with MIQ](https://hackmd.io/@derailment/telemetry-miq)
- [MIQ API testing](https://hackmd.io/ywoy83Q7Qa2TqjSV-h72iQ)
- [NFVD Server](https://hackmd.io/@derailment/nfvd-server)
- [NFVD Switch](https://hackmd.io/@derailment/nfvd-switch)
## Agent Auto-Deployment
- [RHEL 7.6](https://hackmd.io/@derailment/rhel)
- [Ansible](https://hackmd.io/@derailment/ansible)
## MySQL Workbench
- [How to reverse engineer a database?](https://dataedo.com/kb/tools/mysql-workbench/how-to-reverse-engineer-database)
## PostgreSQL
* ```psql <database>```
:::info
\h:查看SQL命令的解释,比如\h select。
\?:查看psql命令列表。
\l:列出所有数据库。
\c [database_name]:连接其他数据库。
\d:列出当前数据库的所有表格。
\d [table_name]:列出某一张表格的结构。
\du:列出所有用户。
\e:打开文本编辑器。
\conninfo:列出当前数据库和连接的信息。
:::
* phpPgAdmin
Access the website at http://localhost:50080 (```root```/```smartvm```).
```
docker run -tid -e PHP_PG_ADMIN_SERVER_DEFAULT_DB="vmdb_development" -e PHP_PG_ADMIN_SERVER_HOST="10.103.3.74" -p 50080:80 dockage/phppgadmin
```
## Commands
* [Git](https://hackmd.io/@derailment/git)
* vim
```
:set shiftwidth=4
```
* ```lsof -i```
:::info
-i Selects the listing of files any of whose Internet address matches the address specified in i. If no address is specified, this option selects the listing of all Internet and x.25 (HP-UX) network files.
:::
* [top](http://dannysun-unknown.blogspot.com/2017/06/linuxtopcpu.html)
* 按 c 鍵切換只顯示程式名稱或整個連參數的命令行
* ```ps -ef | egrep 'ruby|MIQ'```
:::info
-e select all processes.
-f do full-format listing.
:::
* ```find -regex '.*[Worker|Handler]\.log'```
* ```egrep -H '[[:digit:]]' test.log```
* ```find -regex '.*\.log' -exec egrep -H '\.log' {} \;```
:::info
```-exec```
All following arguments to find are taken to be arguments to the command until an argument consisting of ```;``` is encountered. the string ```{}``` is replaced by the current file name being processed.
```-print True```
Print the full file name on the standard output.
```-regex pattern```
**Whole file path** matches regular expression pattern.
:::
## Environment
- [MIQ 官方開發者文件](http://manageiq.org/docs/guides/README)
- [How to develop with Docker?](https://hackmd.io/@lMKh2Y4NTaeox4NyBrwy3Q/SJY7sdp9N/%2FWtaNxvXfSKmneO_40UkxLg?type=book)
- QIM
Access the application at http://localhost:3000 (The default username is ```admin``` with password ```smartvm```).
```
git clone https://git.rd2.qct.io/ytw/manageiq.git
git submodule init
git submodule update
# Installs dependencies, config, prepares database, etc
bin/setup
# Starts the ManageIQ EVM Application in the background
bundle exec rake evm:start
```
- [RubyMine](https://github.com/ManageIQ/guides/blob/master/developer_setup/ruby_mine_setup.md)
- [Open Source License Request](https://www.jetbrains.com/shop/eform/opensource?product=ALL)
- VSCode
```
# manageiq/.vscode/settings.json
{
"ruby.codeCompletion": "rcodetools",
"ruby.intellisense": "rubyLocate",
"ruby.locate": {
"include": "**/*.rb",
"exclude": "{**/@(test|spec|tmp|.*),**/@(test|spec|tmp|.*)/**,**/*_spec.rb}"
}
}
```
```
# manageiq/.vscode/launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Local file",
"type": "Ruby",
"request": "launch",
"program": "${file}"
},
{
"name": "Rails server",
"type": "Ruby",
"request": "launch",
"program": "${workspaceRoot}/bin/rails",
"args": [
"server"
]
},
{
"name": "Rake evm:start",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/bin/rake",
"useBundler": false,
"args": ["evm:start"]
},
{
"name": "Ruby - evm_server",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/lib/workers/bin/evm_server.rb",
"env": {
"MIQ_SPAWN_WORKERS": "TRUE",
"UNSET_PROCESS_TITLE": "TRUE",
"ENABLE_WORKER_LOG": "TRUE"
},
"showDebuggerOutput": true
},
{
"name": "Ruby - s_worker - RefreshWorker",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/lib/workers/bin/run_single_worker.rb",
"env": {
"MIQ_SPAWN_WORKERS": "TRUE",
"UNSET_PROCESS_TITLE": "TRUE",
"ENABLE_WORKER_LOG": "TRUE"
},
"showDebuggerOutput": true,
// "program": "/usr/local/rvm/rubies/ruby-2.5.5/bin/ruby /root/miq/manageiq/lib/workers/bin/evm_server.rb",
"args": [
// "--guid", "5b766737-0990-4ebc-9697-aa208a6f6863",
// "--heartbeat",
"--ems-id", "1",
"--force",
"ManageIQ::Providers::Redfish::PhysicalInfraManager::RefreshWorker"
]
},
{
"name": "Ruby - s_worker - MiqUiWorker",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/lib/workers/bin/run_single_worker.rb",
"env": {
"MIQ_SPAWN_WORKERS": "TRUE",
"UNSET_PROCESS_TITLE": "TRUE",
"ENABLE_WORKER_LOG": "TRUE"
},
"showDebuggerOutput": true,
// "program": "/usr/local/rvm/rubies/ruby-2.5.5/bin/ruby /root/miq/manageiq/lib/workers/bin/evm_server.rb",
"args": [
// "--guid", "5b766737-0990-4ebc-9697-aa208a6f6863",
// "--heartbeat",
"--ems-id", "1",
"--force",
"MiqUiWorker"
]
}
]
}
```
## Learning Resource
- [Ruby Note](https://hackmd.io/@derailment/ruby)
## Glossary
* MIQ
* Enterprise Virtualization Manager (EVM)
- [Data Center](https://hackmd.io/_sVIu6gVShesG0ZkDY1YNw?view)
- [Hardware Management](https://hackmd.io/@derailment/hw)
- [Linux System Programming](https://hackmd.io/@derailment/linux)