virtualmachine.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. {% extends 'base.html' %}
  2. {% load buttons %}
  3. {% load custom_links %}
  4. {% load static %}
  5. {% load helpers %}
  6. {% load plugins %}
  7. {% block header %}
  8. <div class="row noprint">
  9. <div class="col-sm-8 col-md-9">
  10. <ol class="breadcrumb">
  11. {% if virtualmachine.cluster %}
  12. <li><a href="{{ virtualmachine.cluster.get_absolute_url }}">{{ virtualmachine.cluster }}</a></li>
  13. {% endif %}
  14. <li>{{ virtualmachine }}</li>
  15. </ol>
  16. </div>
  17. <div class="col-sm-4 col-md-3">
  18. <form action="{% url 'virtualization:virtualmachine_list' %}" method="get">
  19. <div class="input-group">
  20. <input type="text" name="q" class="form-control" placeholder="Search virtual machines" />
  21. <span class="input-group-btn">
  22. <button type="submit" class="btn btn-primary">
  23. <span class="fa fa-search"></span>
  24. </button>
  25. </span>
  26. </div>
  27. </form>
  28. </div>
  29. </div>
  30. <div class="pull-right noprint">
  31. {% if perms.virtualization.add_vminterface %}
  32. <a href="{% url 'virtualization:vminterface_add' %}?virtual_machine={{ virtualmachine.pk }}&return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-primary">
  33. <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add Interfaces
  34. </a>
  35. {% endif %}
  36. {% plugin_buttons virtualmachine %}
  37. {% if perms.virtualization.add_virtualmachine %}
  38. {% clone_button virtualmachine %}
  39. {% endif %}
  40. {% if perms.virtualization.change_virtualmachine %}
  41. {% edit_button virtualmachine %}
  42. {% endif %}
  43. {% if perms.virtualization.delete_virtualmachine %}
  44. {% delete_button virtualmachine %}
  45. {% endif %}
  46. </div>
  47. <h1>{% block title %}{{ virtualmachine }}{% endblock %}</h1>
  48. {% include 'inc/created_updated.html' with obj=virtualmachine %}
  49. <div class="pull-right noprint">
  50. {% custom_links virtualmachine %}
  51. </div>
  52. <ul class="nav nav-tabs">
  53. <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
  54. <a href="{{ virtualmachine.get_absolute_url }}">Virtual Machine</a>
  55. </li>
  56. {% if perms.extras.view_configcontext %}
  57. <li role="presentation"{% if active_tab == 'config-context' %} class="active"{% endif %}>
  58. <a href="{% url 'virtualization:virtualmachine_configcontext' pk=virtualmachine.pk %}">Config Context</a>
  59. </li>
  60. {% endif %}
  61. {% if perms.extras.view_objectchange %}
  62. <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
  63. <a href="{% url 'virtualization:virtualmachine_changelog' pk=virtualmachine.pk %}">Change Log</a>
  64. </li>
  65. {% endif %}
  66. </ul>
  67. {% endblock %}
  68. {% block content %}
  69. <div class="row">
  70. <div class="col-md-6">
  71. <div class="panel panel-default">
  72. <div class="panel-heading">
  73. <strong>Virtual Machine</strong>
  74. </div>
  75. <table class="table table-hover panel-body attr-table">
  76. <tr>
  77. <td>Name</td>
  78. <td>{{ virtualmachine }}</td>
  79. </tr>
  80. <tr>
  81. <td>Status</td>
  82. <td>
  83. <span class="label label-{{ virtualmachine.get_status_class }}">{{ virtualmachine.get_status_display }}</span>
  84. </td>
  85. </tr>
  86. <tr>
  87. <td>Role</td>
  88. <td>
  89. {% if virtualmachine.role %}
  90. <a href="{% url 'virtualization:virtualmachine_list' %}?role={{ virtualmachine.role.slug }}">{{ virtualmachine.role }}</a>
  91. {% else %}
  92. <span class="text-muted">None</span>
  93. {% endif %}
  94. </td>
  95. </tr>
  96. <tr>
  97. <td>Platform</td>
  98. <td>
  99. {% if virtualmachine.platform %}
  100. <a href="{% url 'virtualization:virtualmachine_list' %}?platform={{ virtualmachine.platform.slug }}">{{ virtualmachine.platform }}</a>
  101. {% else %}
  102. <span class="text-muted">None</span>
  103. {% endif %}
  104. </td>
  105. </tr>
  106. <tr>
  107. <td>Tenant</td>
  108. <td>
  109. {% if virtualmachine.tenant %}
  110. {% if virtualmachine.tenant.group %}
  111. <a href="{{ virtualmachine.tenant.group.get_absolute_url }}">{{ virtualmachine.tenant.group }}</a>
  112. <i class="fa fa-angle-right"></i>
  113. {% endif %}
  114. <a href="{{ virtualmachine.tenant.get_absolute_url }}">{{ virtualmachine.tenant }}</a>
  115. {% else %}
  116. <span class="text-muted">None</span>
  117. {% endif %}
  118. </td>
  119. </tr>
  120. <tr>
  121. <td>Primary IPv4</td>
  122. <td>
  123. {% if virtualmachine.primary_ip4 %}
  124. <a href="{% url 'ipam:ipaddress' pk=virtualmachine.primary_ip4.pk %}">{{ virtualmachine.primary_ip4.address.ip }}</a>
  125. {% if virtualmachine.primary_ip4.nat_inside %}
  126. <span>(NAT for {{ virtualmachine.primary_ip4.nat_inside.address.ip }})</span>
  127. {% elif virtualmachine.primary_ip4.nat_outside %}
  128. <span>(NAT: {{ virtualmachine.primary_ip4.nat_outside.address.ip }})</span>
  129. {% endif %}
  130. {% else %}
  131. <span class="text-muted">&mdash;</span>
  132. {% endif %}
  133. </td>
  134. </tr>
  135. <tr>
  136. <td>Primary IPv6</td>
  137. <td>
  138. {% if virtualmachine.primary_ip6 %}
  139. <a href="{% url 'ipam:ipaddress' pk=virtualmachine.primary_ip6.pk %}">{{ virtualmachine.primary_ip6.address.ip }}</a>
  140. {% if virtualmachine.primary_ip6.nat_inside %}
  141. <span>(NAT for {{ virtualmachine.primary_ip6.nat_inside.address.ip }})</span>
  142. {% elif virtualmachine.primary_ip6.nat_outside %}
  143. <span>(NAT: {{ virtualmachine.primary_ip6.nat_outside.address.ip }})</span>
  144. {% endif %}
  145. {% else %}
  146. <span class="text-muted">&mdash;</span>
  147. {% endif %}
  148. </td>
  149. </tr>
  150. </table>
  151. </div>
  152. {% include 'inc/custom_fields_panel.html' with obj=virtualmachine %}
  153. {% include 'extras/inc/tags_panel.html' with tags=virtualmachine.tags.all url='virtualization:virtualmachine_list' %}
  154. <div class="panel panel-default">
  155. <div class="panel-heading">
  156. <strong>Comments</strong>
  157. </div>
  158. <div class="panel-body rendered-markdown">
  159. {% if virtualmachine.comments %}
  160. {{ virtualmachine.comments|render_markdown }}
  161. {% else %}
  162. <span class="text-muted">None</span>
  163. {% endif %}
  164. </div>
  165. </div>
  166. {% plugin_left_page virtualmachine %}
  167. </div>
  168. <div class="col-md-6">
  169. <div class="panel panel-default">
  170. <div class="panel-heading">
  171. <strong>Cluster</strong>
  172. </div>
  173. <table class="table table-hover panel-body attr-table">
  174. <tr>
  175. <td>Cluster</td>
  176. <td>
  177. {% if virtualmachine.cluster.group %}
  178. <a href="{{ virtualmachine.cluster.group.get_absolute_url }}">{{ virtualmachine.cluster.group }}</a>
  179. <i class="fa fa-angle-right"></i>
  180. {% endif %}
  181. <a href="{{ virtualmachine.cluster.get_absolute_url }}">{{ virtualmachine.cluster }}</a>
  182. </td>
  183. </tr>
  184. <tr>
  185. <td>Cluster Type</td>
  186. <td>{{ virtualmachine.cluster.type }}</td>
  187. </tr>
  188. </table>
  189. </div>
  190. <div class="panel panel-default">
  191. <div class="panel-heading">
  192. <strong>Resources</strong>
  193. </div>
  194. <table class="table table-hover panel-body attr-table">
  195. <tr>
  196. <td><i class="fa fa-tachometer"></i> Virtual CPUs</td>
  197. <td>{{ virtualmachine.vcpus|placeholder }}</td>
  198. </tr>
  199. <tr>
  200. <td><i class="fa fa-microchip"></i> Memory</td>
  201. <td>
  202. {% if virtualmachine.memory %}
  203. {{ virtualmachine.memory }} MB
  204. {% else %}
  205. <span class="text-muted">&mdash;</span>
  206. {% endif %}
  207. </td>
  208. </tr>
  209. <tr>
  210. <td><i class="fa fa-hdd-o"></i> Disk Space</td>
  211. <td>
  212. {% if virtualmachine.disk %}
  213. {{ virtualmachine.disk }} GB
  214. {% else %}
  215. <span class="text-muted">&mdash;</span>
  216. {% endif %}
  217. </td>
  218. </tr>
  219. </table>
  220. </div>
  221. {% if perms.secrets.view_secret %}
  222. <div class="panel panel-default">
  223. <div class="panel-heading">
  224. <strong>Secrets</strong>
  225. </div>
  226. {% include 'secrets/inc/assigned_secrets.html' %}
  227. {% if perms.secrets.add_secret %}
  228. <div class="panel-footer text-right noprint">
  229. <a href="{% url 'secrets:secret_add' %}?virtual_machine={{ virtualmachine.pk }}&return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-xs btn-primary">
  230. <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add secret
  231. </a>
  232. </div>
  233. {% endif %}
  234. </div>
  235. {% endif %}
  236. <div class="panel panel-default">
  237. <div class="panel-heading">
  238. <strong>Services</strong>
  239. </div>
  240. {% if services %}
  241. <table class="table table-hover panel-body">
  242. {% for service in services %}
  243. {% include 'ipam/inc/service.html' %}
  244. {% endfor %}
  245. </table>
  246. {% else %}
  247. <div class="panel-body text-muted">
  248. None
  249. </div>
  250. {% endif %}
  251. {% if perms.ipam.add_service %}
  252. <div class="panel-footer text-right noprint">
  253. <a href="{% url 'virtualization:virtualmachine_service_assign' virtualmachine=virtualmachine.pk %}" class="btn btn-xs btn-primary">
  254. <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Assign service
  255. </a>
  256. </div>
  257. {% endif %}
  258. </div>
  259. {% plugin_right_page virtualmachine %}
  260. </div>
  261. </div>
  262. <div class="row">
  263. <div class="col-md-12">
  264. {% plugin_full_width_page virtualmachine %}
  265. </div>
  266. </div>
  267. <div class="row">
  268. <div class="col-md-12">
  269. {% if perms.virtualization.change_vminterface or perms.virtualization.delete_vminterface %}
  270. <form method="post">
  271. {% csrf_token %}
  272. <input type="hidden" name="virtual_machine" value="{{ virtualmachine.pk }}" />
  273. {% endif %}
  274. <div class="panel panel-default">
  275. <div class="panel-heading">
  276. <strong>Interfaces</strong>
  277. <div class="col-md-2 pull-right noprint">
  278. <input class="form-control interface-filter" type="text" placeholder="Filter" title="RegEx-enabled" style="height: 23px" />
  279. </div>
  280. </div>
  281. <table id="interfaces_table" class="table table-hover table-headings panel-body component-list">
  282. <thead>
  283. <tr>
  284. {% if perms.virtualization.change_vminterface or perms.virtualization.delete_vminterface %}
  285. <th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
  286. {% endif %}
  287. <th>Name</th>
  288. <th>MAC Address</th>
  289. <th>MTU</th>
  290. <th>Mode</th>
  291. <th>Description</th>
  292. <th></th>
  293. </tr>
  294. </thead>
  295. <tbody>
  296. {% for iface in interfaces %}
  297. {% include 'virtualization/inc/vminterface.html' %}
  298. {% empty %}
  299. <tr>
  300. <td colspan="8" class="text-center text-muted">&mdash; No interfaces defined &mdash;</td>
  301. </tr>
  302. {% endfor %}
  303. </tbody>
  304. </table>
  305. {% if perms.virtualization.add_vminterface or perms.virtualization.delete_vminterface %}
  306. <div class="panel-footer noprint">
  307. {% if interfaces and perms.virtualization.change_vminterface %}
  308. <button type="submit" name="_rename" formaction="{% url 'virtualization:vminterface_bulk_rename' %}?return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-warning btn-xs">
  309. <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Rename
  310. </button>
  311. <button type="submit" name="_edit" formaction="{% url 'virtualization:vminterface_bulk_edit' %}?return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-warning btn-xs">
  312. <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit
  313. </button>
  314. {% endif %}
  315. {% if interfaces and perms.virtualization.delete_vminterface %}
  316. <button type="submit" name="_delete" formaction="{% url 'virtualization:vminterface_bulk_delete' %}?return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-danger btn-xs">
  317. <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete
  318. </button>
  319. {% endif %}
  320. {% if perms.virtualization.add_vminterface %}
  321. <div class="pull-right">
  322. <a href="{% url 'virtualization:vminterface_add' %}?virtual_machine={{ virtualmachine.pk }}&return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-primary btn-xs">
  323. <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add interfaces
  324. </a>
  325. </div>
  326. <div class="clearfix"></div>
  327. {% endif %}
  328. </div>
  329. {% endif %}
  330. </div>
  331. {% if perms.virtualization.delete_vminterface %}
  332. </form>
  333. {% endif %}
  334. </div>
  335. </div>
  336. {% include 'secrets/inc/private_key_modal.html' %}
  337. {% endblock %}
  338. {% block javascript %}
  339. <script src="{% static 'js/interface_toggles.js' %}?v{{ settings.VERSION }}"></script>
  340. <script src="{% static 'js/secrets.js' %}?v{{ settings.VERSION }}"></script>
  341. {% endblock %}