mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-02 08:56:07 +00:00
fix(networks): the XML editor does not overwrite a change made meanwhile
The network and filter XML editors defined what they sent as a whole, so a page opened before another admin's change (a QoS limit, a filter rule) saved over it and the change was gone without a word. The editor now sends a digest of the definition it showed, and a definition changed since is refused with a reload hint.
This commit is contained in:
parent
534782fdda
commit
d00f7d8841
16 changed files with 151 additions and 98 deletions
Binary file not shown.
|
|
@ -70,7 +70,7 @@ msgstr "Geçersiz anahtar"
|
|||
#: instances/templates/allinstances_index_nongrouped.html:6
|
||||
#: instances/templates/create_instance_w2.html:42
|
||||
#: interfaces/templates/interface.html:119 networks/templates/network.html:145
|
||||
#: networks/templates/network.html:372 nwfilters/templates/nwfilters.html:29
|
||||
#: networks/templates/network.html:373 nwfilters/templates/nwfilters.html:29
|
||||
#: storages/templates/storage.html:123 virtsecrets/forms.py:25
|
||||
#: virtsecrets/forms.py:27
|
||||
msgid "Name"
|
||||
|
|
@ -304,10 +304,10 @@ msgstr "Burada oturumunuz açık kalır; diğer oturumlarınız kapanır."
|
|||
#: interfaces/templates/create_iface_block.html:147
|
||||
#: networks/templates/add_network_qos.html:35
|
||||
#: networks/templates/create_net_block.html:126
|
||||
#: networks/templates/network.html:377 networks/templates/network.html:404
|
||||
#: networks/templates/network.html:443
|
||||
#: networks/templates/network.html:378 networks/templates/network.html:405
|
||||
#: networks/templates/network.html:444
|
||||
#: nwfilters/templates/create_nwfilter_block.html:33
|
||||
#: nwfilters/templates/nwfilter.html:178 nwfilters/templates/nwfilters.html:93
|
||||
#: nwfilters/templates/nwfilter.html:179 nwfilters/templates/nwfilters.html:93
|
||||
#: operations/templates/operations/job.html:31
|
||||
#: operations/templatetags/operations.py:83
|
||||
#: storages/templates/create_stg_block.html:183
|
||||
|
|
@ -2091,9 +2091,9 @@ msgstr "hiçbiri"
|
|||
#: instances/templates/instances/settings_tab.html:653
|
||||
#: instances/templates/instances/settings_tab.html:907
|
||||
#: networks/templates/add_network_qos.html:36
|
||||
#: networks/templates/network.html:336 networks/templates/network.html:378
|
||||
#: networks/templates/network.html:405 networks/templates/network.html:444
|
||||
#: nwfilters/templates/nwfilter.html:153 templates/common/form.html:28
|
||||
#: networks/templates/network.html:337 networks/templates/network.html:379
|
||||
#: networks/templates/network.html:406 networks/templates/network.html:445
|
||||
#: nwfilters/templates/nwfilter.html:154 templates/common/form.html:28
|
||||
msgid "Save"
|
||||
msgstr "Kaydet"
|
||||
|
||||
|
|
@ -2626,10 +2626,10 @@ msgstr "Bağlan"
|
|||
#: interfaces/templates/create_iface_block.html:20
|
||||
#: networks/templates/add_network_qos.html:8
|
||||
#: networks/templates/create_net_block.html:20
|
||||
#: networks/templates/network.html:353 networks/templates/network.html:391
|
||||
#: networks/templates/network.html:417
|
||||
#: networks/templates/network.html:354 networks/templates/network.html:392
|
||||
#: networks/templates/network.html:418
|
||||
#: nwfilters/templates/create_nwfilter_block.html:17
|
||||
#: nwfilters/templates/nwfilter.html:165 nwfilters/templates/nwfilters.html:85
|
||||
#: nwfilters/templates/nwfilter.html:166 nwfilters/templates/nwfilters.html:85
|
||||
#: storages/templates/create_stg_block.html:21
|
||||
#: storages/templates/create_stg_vol_block.html:16
|
||||
#: storages/templates/create_stg_vol_block.html:54
|
||||
|
|
@ -3623,7 +3623,7 @@ msgstr "Bul"
|
|||
|
||||
#: instances/templates/allinstances.html:104
|
||||
#: interfaces/templates/interface.html:101 networks/templates/network.html:143
|
||||
#: networks/templates/network.html:199 networks/templates/network.html:363
|
||||
#: networks/templates/network.html:199 networks/templates/network.html:364
|
||||
#: nodedevs/templates/nodedevs.html:32
|
||||
msgid "Address"
|
||||
msgstr "Adres"
|
||||
|
|
@ -5330,12 +5330,12 @@ msgid "Migration route"
|
|||
msgstr "Taşıma yolu"
|
||||
|
||||
#: instances/templates/instances/settings_tab.html:526
|
||||
#: networks/templates/network.html:395
|
||||
#: networks/templates/network.html:396
|
||||
msgid "From"
|
||||
msgstr "Başlangıç"
|
||||
|
||||
#: instances/templates/instances/settings_tab.html:531
|
||||
#: networks/templates/network.html:399
|
||||
#: networks/templates/network.html:400
|
||||
msgid "To"
|
||||
msgstr "Bitiş"
|
||||
|
||||
|
|
@ -7063,7 +7063,7 @@ msgid "Bandwidth limit of eth%(nic)s"
|
|||
msgstr "eth%(nic)s bant genişliği sınırı"
|
||||
|
||||
#: networks/templates/add_network_qos.html:13
|
||||
#: networks/templates/network.html:282 networks/templates/network.html:421
|
||||
#: networks/templates/network.html:282 networks/templates/network.html:422
|
||||
#: nwfilters/templates/nwfilter.html:97
|
||||
msgid "Direction"
|
||||
msgstr "Yön"
|
||||
|
|
@ -7077,17 +7077,17 @@ msgid "Outbound: from the VM"
|
|||
msgstr "Giden: sanal makineden"
|
||||
|
||||
#: networks/templates/add_network_qos.html:20
|
||||
#: networks/templates/network.html:429
|
||||
#: networks/templates/network.html:430
|
||||
msgid "Average (KiB/s)"
|
||||
msgstr "Ortalama (KiB/s)"
|
||||
|
||||
#: networks/templates/add_network_qos.html:24
|
||||
#: networks/templates/network.html:433
|
||||
#: networks/templates/network.html:434
|
||||
msgid "Peak (KiB/s)"
|
||||
msgstr "Tepe (KiB/s)"
|
||||
|
||||
#: networks/templates/add_network_qos.html:28
|
||||
#: networks/templates/network.html:437
|
||||
#: networks/templates/network.html:438
|
||||
msgid "Burst (KiB)"
|
||||
msgstr "Ani yük (KiB)"
|
||||
|
||||
|
|
@ -7276,11 +7276,11 @@ msgstr ""
|
|||
msgid "Stop the network to change its range"
|
||||
msgstr "Aralığını değiştirmek için ağı durdurun"
|
||||
|
||||
#: networks/templates/network.html:89 networks/templates/network.html:390
|
||||
#: networks/templates/network.html:89 networks/templates/network.html:391
|
||||
msgid "DHCP range"
|
||||
msgstr "DHCP aralığı"
|
||||
|
||||
#: networks/templates/network.html:95 networks/templates/network.html:357
|
||||
#: networks/templates/network.html:95 networks/templates/network.html:358
|
||||
msgid "Subnet"
|
||||
msgstr "Alt ağ"
|
||||
|
||||
|
|
@ -7437,35 +7437,35 @@ msgstr ""
|
|||
"Kayıtlı tanım: çalışan bir ağ, değişikliği durdurulup yeniden başlatıldığında"
|
||||
" alır."
|
||||
|
||||
#: networks/templates/network.html:334
|
||||
#: networks/templates/network.html:335
|
||||
msgid "Network XML"
|
||||
msgstr "Ağ XML'i"
|
||||
|
||||
#: networks/templates/network.html:352
|
||||
#: networks/templates/network.html:353
|
||||
msgid "Fixed address"
|
||||
msgstr "Sabit adres"
|
||||
|
||||
#: networks/templates/network.html:367
|
||||
#: networks/templates/network.html:368
|
||||
msgid "MAC (IPv4) or DUID (IPv6)"
|
||||
msgstr "MAC (IPv4) veya DUID (IPv6)"
|
||||
|
||||
#: networks/templates/network.html:369
|
||||
#: networks/templates/network.html:370
|
||||
msgid "The VM's network card; without it, the VM is known by its name."
|
||||
msgstr "Sanal makinenin ağ kartı; o olmadan sanal makine adıyla tanınır."
|
||||
|
||||
#: networks/templates/network.html:416
|
||||
#: networks/templates/network.html:417
|
||||
msgid "Bandwidth limit"
|
||||
msgstr "Bant genişliği sınırı"
|
||||
|
||||
#: networks/templates/network.html:424
|
||||
#: networks/templates/network.html:425
|
||||
msgid "Inbound: to the VMs"
|
||||
msgstr "Gelen: sanal makinelere"
|
||||
|
||||
#: networks/templates/network.html:425
|
||||
#: networks/templates/network.html:426
|
||||
msgid "Outbound: from the VMs"
|
||||
msgstr "Giden: sanal makinelerden"
|
||||
|
||||
#: networks/templates/network.html:440
|
||||
#: networks/templates/network.html:441
|
||||
msgid "Linux applies a peak to inbound traffic only."
|
||||
msgstr "Linux tepe değerini yalnızca gelen trafiğe uygular."
|
||||
|
||||
|
|
@ -7669,7 +7669,7 @@ msgid "libvirt's filter format"
|
|||
msgstr "libvirt'in filtre biçimi"
|
||||
|
||||
#: nwfilters/templates/create_nwfilter_block.html:25
|
||||
#: nwfilters/templates/nwfilter.html:151
|
||||
#: nwfilters/templates/nwfilter.html:152
|
||||
msgid "Filter XML"
|
||||
msgstr "Filtre XML'i"
|
||||
|
||||
|
|
@ -7741,8 +7741,8 @@ msgstr "Başka bir filtreye başvurmuyor."
|
|||
msgid "Rules"
|
||||
msgstr "Kurallar"
|
||||
|
||||
#: nwfilters/templates/nwfilter.html:88 nwfilters/templates/nwfilter.html:164
|
||||
#: nwfilters/templates/nwfilter.html:179
|
||||
#: nwfilters/templates/nwfilter.html:88 nwfilters/templates/nwfilter.html:165
|
||||
#: nwfilters/templates/nwfilter.html:180
|
||||
msgid "Add rule"
|
||||
msgstr "Kural ekle"
|
||||
|
||||
|
|
@ -7803,7 +7803,7 @@ msgstr ""
|
|||
"Değişiklik hemen, filtreyi kullanan çalışan sanal makinelere de uygulanır; "
|
||||
"filtrenin adı ve UUID'si korunur."
|
||||
|
||||
#: nwfilters/templates/nwfilter.html:169
|
||||
#: nwfilters/templates/nwfilter.html:170
|
||||
msgid ""
|
||||
"One rule: in is traffic to the VM, out from it; a lower priority applies "
|
||||
"first (500 if none is given)."
|
||||
|
|
@ -7811,11 +7811,11 @@ msgstr ""
|
|||
"Tek kural: in sanal makineye gelen, out ondan çıkan trafiktir; düşük öncelik "
|
||||
"önce uygulanır (verilmezse 500)."
|
||||
|
||||
#: nwfilters/templates/nwfilter.html:170
|
||||
#: nwfilters/templates/nwfilter.html:171
|
||||
msgid "The protocols and their attributes"
|
||||
msgstr "Protokoller ve öznitelikleri"
|
||||
|
||||
#: nwfilters/templates/nwfilter.html:173
|
||||
#: nwfilters/templates/nwfilter.html:174
|
||||
msgid "Rule XML"
|
||||
msgstr "Kural XML'i"
|
||||
|
||||
|
|
@ -9922,10 +9922,15 @@ msgstr "Yön gelen ya da giden olmalı"
|
|||
|
||||
#: vrtManager/network.py:493
|
||||
#, python-format
|
||||
msgid "Network %(net)s was changed meanwhile; reload the page"
|
||||
msgstr "%(net)s ağı bu arada değişti; sayfayı yeniden yükleyin"
|
||||
|
||||
#: vrtManager/network.py:496
|
||||
#, python-format
|
||||
msgid "The XML must define network %(net)s"
|
||||
msgstr "XML, %(net)s ağını tanımlamalıdır"
|
||||
|
||||
#: vrtManager/network.py:495
|
||||
#: vrtManager/network.py:498
|
||||
msgid "The XML must keep the network's UUID"
|
||||
msgstr "XML, ağın UUID değerini korumalıdır"
|
||||
|
||||
|
|
@ -9998,7 +10003,7 @@ msgstr "Üreticiye özgü"
|
|||
msgid "USB device %(bus)s/%(device)s (%(product)s)"
|
||||
msgstr "USB aygıtı %(bus)s/%(device)s (%(product)s)"
|
||||
|
||||
#: vrtManager/nodedevs.py:103 vrtManager/util.py:91
|
||||
#: vrtManager/nodedevs.py:103 vrtManager/util.py:98
|
||||
#, python-format
|
||||
msgid "The XML is not valid: %(err)s"
|
||||
msgstr "XML geçerli değil: %(err)s"
|
||||
|
|
@ -10147,14 +10152,19 @@ msgstr "Filtre değişti; sayfayı yeniden yükleyip tekrar deneyin"
|
|||
|
||||
#: vrtManager/nwfilters.py:169
|
||||
#, python-format
|
||||
msgid "Filter %(name)s was changed meanwhile; reload the page"
|
||||
msgstr "%(name)s filtresi bu arada değişti; sayfayı yeniden yükleyin"
|
||||
|
||||
#: vrtManager/nwfilters.py:172
|
||||
#, python-format
|
||||
msgid "The XML must define filter %(name)s"
|
||||
msgstr "XML, %(name)s filtresini tanımlamalıdır"
|
||||
|
||||
#: vrtManager/nwfilters.py:171
|
||||
#: vrtManager/nwfilters.py:174
|
||||
msgid "The XML must keep the filter's UUID"
|
||||
msgstr "XML, filtrenin UUID değerini korumalıdır"
|
||||
|
||||
#: vrtManager/nwfilters.py:183
|
||||
#: vrtManager/nwfilters.py:186
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Filter %(name)s cannot be referenced: it is this one, referenced already or "
|
||||
|
|
@ -10163,7 +10173,7 @@ msgstr ""
|
|||
"%(name)s filtresine başvurulamaz: bu filtrenin kendisi, zaten başvurulmuş "
|
||||
"veya sunucuda yok"
|
||||
|
||||
#: vrtManager/nwfilters.py:193
|
||||
#: vrtManager/nwfilters.py:196
|
||||
msgid "Enter one <rule> element"
|
||||
msgstr "Tek bir <rule> öğesi girin"
|
||||
|
||||
|
|
@ -10199,11 +10209,11 @@ msgstr ""
|
|||
"Çalışan %(vms)s sanal makineleri %(name)s birimini kullanıyor; kopyalamak "
|
||||
"için onları kapatın"
|
||||
|
||||
#: vrtManager/util.py:93
|
||||
#: vrtManager/util.py:100
|
||||
msgid "The XML may not declare a DTD"
|
||||
msgstr "XML bir DTD bildiremez"
|
||||
|
||||
#: vrtManager/util.py:139
|
||||
#: vrtManager/util.py:146
|
||||
#, python-format
|
||||
msgid "MAC address must be of the format AA:BB:CC:DD:EE:FF, was %(mac)s"
|
||||
msgstr "MAC adresi AA:BB:CC:DD:EE:FF biçiminde olmalı; girilen: %(mac)s"
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -67,7 +67,7 @@ msgstr "无效的密钥"
|
|||
#: instances/templates/allinstances_index_nongrouped.html:6
|
||||
#: instances/templates/create_instance_w2.html:42
|
||||
#: interfaces/templates/interface.html:119 networks/templates/network.html:145
|
||||
#: networks/templates/network.html:372 nwfilters/templates/nwfilters.html:29
|
||||
#: networks/templates/network.html:373 nwfilters/templates/nwfilters.html:29
|
||||
#: storages/templates/storage.html:123 virtsecrets/forms.py:25
|
||||
#: virtsecrets/forms.py:27
|
||||
msgid "Name"
|
||||
|
|
@ -299,10 +299,10 @@ msgstr "您在此处保持登录;您的其他会话将结束。"
|
|||
#: interfaces/templates/create_iface_block.html:147
|
||||
#: networks/templates/add_network_qos.html:35
|
||||
#: networks/templates/create_net_block.html:126
|
||||
#: networks/templates/network.html:377 networks/templates/network.html:404
|
||||
#: networks/templates/network.html:443
|
||||
#: networks/templates/network.html:378 networks/templates/network.html:405
|
||||
#: networks/templates/network.html:444
|
||||
#: nwfilters/templates/create_nwfilter_block.html:33
|
||||
#: nwfilters/templates/nwfilter.html:178 nwfilters/templates/nwfilters.html:93
|
||||
#: nwfilters/templates/nwfilter.html:179 nwfilters/templates/nwfilters.html:93
|
||||
#: operations/templates/operations/job.html:31
|
||||
#: operations/templatetags/operations.py:83
|
||||
#: storages/templates/create_stg_block.html:183
|
||||
|
|
@ -2013,9 +2013,9 @@ msgstr "无"
|
|||
#: instances/templates/instances/settings_tab.html:653
|
||||
#: instances/templates/instances/settings_tab.html:907
|
||||
#: networks/templates/add_network_qos.html:36
|
||||
#: networks/templates/network.html:336 networks/templates/network.html:378
|
||||
#: networks/templates/network.html:405 networks/templates/network.html:444
|
||||
#: nwfilters/templates/nwfilter.html:153 templates/common/form.html:28
|
||||
#: networks/templates/network.html:337 networks/templates/network.html:379
|
||||
#: networks/templates/network.html:406 networks/templates/network.html:445
|
||||
#: nwfilters/templates/nwfilter.html:154 templates/common/form.html:28
|
||||
msgid "Save"
|
||||
msgstr "保存"
|
||||
|
||||
|
|
@ -2535,10 +2535,10 @@ msgstr "连接"
|
|||
#: interfaces/templates/create_iface_block.html:20
|
||||
#: networks/templates/add_network_qos.html:8
|
||||
#: networks/templates/create_net_block.html:20
|
||||
#: networks/templates/network.html:353 networks/templates/network.html:391
|
||||
#: networks/templates/network.html:417
|
||||
#: networks/templates/network.html:354 networks/templates/network.html:392
|
||||
#: networks/templates/network.html:418
|
||||
#: nwfilters/templates/create_nwfilter_block.html:17
|
||||
#: nwfilters/templates/nwfilter.html:165 nwfilters/templates/nwfilters.html:85
|
||||
#: nwfilters/templates/nwfilter.html:166 nwfilters/templates/nwfilters.html:85
|
||||
#: storages/templates/create_stg_block.html:21
|
||||
#: storages/templates/create_stg_vol_block.html:16
|
||||
#: storages/templates/create_stg_vol_block.html:54
|
||||
|
|
@ -3472,7 +3472,7 @@ msgstr "查找"
|
|||
|
||||
#: instances/templates/allinstances.html:104
|
||||
#: interfaces/templates/interface.html:101 networks/templates/network.html:143
|
||||
#: networks/templates/network.html:199 networks/templates/network.html:363
|
||||
#: networks/templates/network.html:199 networks/templates/network.html:364
|
||||
#: nodedevs/templates/nodedevs.html:32
|
||||
msgid "Address"
|
||||
msgstr "地址"
|
||||
|
|
@ -5076,12 +5076,12 @@ msgid "Migration route"
|
|||
msgstr "迁移路径"
|
||||
|
||||
#: instances/templates/instances/settings_tab.html:526
|
||||
#: networks/templates/network.html:395
|
||||
#: networks/templates/network.html:396
|
||||
msgid "From"
|
||||
msgstr "源"
|
||||
|
||||
#: instances/templates/instances/settings_tab.html:531
|
||||
#: networks/templates/network.html:399
|
||||
#: networks/templates/network.html:400
|
||||
msgid "To"
|
||||
msgstr "目标"
|
||||
|
||||
|
|
@ -6673,7 +6673,7 @@ msgid "Bandwidth limit of eth%(nic)s"
|
|||
msgstr "eth%(nic)s 的带宽限制"
|
||||
|
||||
#: networks/templates/add_network_qos.html:13
|
||||
#: networks/templates/network.html:282 networks/templates/network.html:421
|
||||
#: networks/templates/network.html:282 networks/templates/network.html:422
|
||||
#: nwfilters/templates/nwfilter.html:97
|
||||
msgid "Direction"
|
||||
msgstr "方向"
|
||||
|
|
@ -6687,17 +6687,17 @@ msgid "Outbound: from the VM"
|
|||
msgstr "出站:来自虚拟机"
|
||||
|
||||
#: networks/templates/add_network_qos.html:20
|
||||
#: networks/templates/network.html:429
|
||||
#: networks/templates/network.html:430
|
||||
msgid "Average (KiB/s)"
|
||||
msgstr "平均(KiB/s)"
|
||||
|
||||
#: networks/templates/add_network_qos.html:24
|
||||
#: networks/templates/network.html:433
|
||||
#: networks/templates/network.html:434
|
||||
msgid "Peak (KiB/s)"
|
||||
msgstr "峰值(KiB/s)"
|
||||
|
||||
#: networks/templates/add_network_qos.html:28
|
||||
#: networks/templates/network.html:437
|
||||
#: networks/templates/network.html:438
|
||||
msgid "Burst (KiB)"
|
||||
msgstr "突发(KiB)"
|
||||
|
||||
|
|
@ -6873,11 +6873,11 @@ msgstr "此网络上的虚拟机从外部网络获取地址:libvirt 不分配
|
|||
msgid "Stop the network to change its range"
|
||||
msgstr "停止网络后才能更改其范围"
|
||||
|
||||
#: networks/templates/network.html:89 networks/templates/network.html:390
|
||||
#: networks/templates/network.html:89 networks/templates/network.html:391
|
||||
msgid "DHCP range"
|
||||
msgstr "DHCP 范围"
|
||||
|
||||
#: networks/templates/network.html:95 networks/templates/network.html:357
|
||||
#: networks/templates/network.html:95 networks/templates/network.html:358
|
||||
msgid "Subnet"
|
||||
msgstr "子网"
|
||||
|
||||
|
|
@ -7025,35 +7025,35 @@ msgid ""
|
|||
" started again."
|
||||
msgstr "已保存的定义:运行中的网络需停止并重新启动后才应用更改。"
|
||||
|
||||
#: networks/templates/network.html:334
|
||||
#: networks/templates/network.html:335
|
||||
msgid "Network XML"
|
||||
msgstr "网络 XML"
|
||||
|
||||
#: networks/templates/network.html:352
|
||||
#: networks/templates/network.html:353
|
||||
msgid "Fixed address"
|
||||
msgstr "固定地址"
|
||||
|
||||
#: networks/templates/network.html:367
|
||||
#: networks/templates/network.html:368
|
||||
msgid "MAC (IPv4) or DUID (IPv6)"
|
||||
msgstr "MAC(IPv4)或 DUID(IPv6)"
|
||||
|
||||
#: networks/templates/network.html:369
|
||||
#: networks/templates/network.html:370
|
||||
msgid "The VM's network card; without it, the VM is known by its name."
|
||||
msgstr "虚拟机的网卡;不填写时,按虚拟机名称识别。"
|
||||
|
||||
#: networks/templates/network.html:416
|
||||
#: networks/templates/network.html:417
|
||||
msgid "Bandwidth limit"
|
||||
msgstr "带宽限制"
|
||||
|
||||
#: networks/templates/network.html:424
|
||||
#: networks/templates/network.html:425
|
||||
msgid "Inbound: to the VMs"
|
||||
msgstr "入站:发往虚拟机"
|
||||
|
||||
#: networks/templates/network.html:425
|
||||
#: networks/templates/network.html:426
|
||||
msgid "Outbound: from the VMs"
|
||||
msgstr "出站:来自虚拟机"
|
||||
|
||||
#: networks/templates/network.html:440
|
||||
#: networks/templates/network.html:441
|
||||
msgid "Linux applies a peak to inbound traffic only."
|
||||
msgstr "Linux 仅对入站流量应用峰值。"
|
||||
|
||||
|
|
@ -7239,7 +7239,7 @@ msgid "libvirt's filter format"
|
|||
msgstr "libvirt 的过滤器格式"
|
||||
|
||||
#: nwfilters/templates/create_nwfilter_block.html:25
|
||||
#: nwfilters/templates/nwfilter.html:151
|
||||
#: nwfilters/templates/nwfilter.html:152
|
||||
msgid "Filter XML"
|
||||
msgstr "过滤器 XML"
|
||||
|
||||
|
|
@ -7309,8 +7309,8 @@ msgstr "未引用其他过滤器。"
|
|||
msgid "Rules"
|
||||
msgstr "规则"
|
||||
|
||||
#: nwfilters/templates/nwfilter.html:88 nwfilters/templates/nwfilter.html:164
|
||||
#: nwfilters/templates/nwfilter.html:179
|
||||
#: nwfilters/templates/nwfilter.html:88 nwfilters/templates/nwfilter.html:165
|
||||
#: nwfilters/templates/nwfilter.html:180
|
||||
msgid "Add rule"
|
||||
msgstr "添加规则"
|
||||
|
||||
|
|
@ -7369,17 +7369,17 @@ msgid ""
|
|||
"keeps the filter's name and UUID."
|
||||
msgstr "更改立即生效,也作用于使用该过滤器的运行中虚拟机;过滤器的名称和 UUID 保持不变。"
|
||||
|
||||
#: nwfilters/templates/nwfilter.html:169
|
||||
#: nwfilters/templates/nwfilter.html:170
|
||||
msgid ""
|
||||
"One rule: in is traffic to the VM, out from it; a lower priority applies "
|
||||
"first (500 if none is given)."
|
||||
msgstr "一条规则:in 表示发往虚拟机的流量,out 表示来自虚拟机的流量;优先级数值越低越先应用(未指定时为 500)。"
|
||||
|
||||
#: nwfilters/templates/nwfilter.html:170
|
||||
#: nwfilters/templates/nwfilter.html:171
|
||||
msgid "The protocols and their attributes"
|
||||
msgstr "协议及其属性"
|
||||
|
||||
#: nwfilters/templates/nwfilter.html:173
|
||||
#: nwfilters/templates/nwfilter.html:174
|
||||
msgid "Rule XML"
|
||||
msgstr "规则 XML"
|
||||
|
||||
|
|
@ -9340,10 +9340,15 @@ msgstr "方向必须是入站或出站"
|
|||
|
||||
#: vrtManager/network.py:493
|
||||
#, python-format
|
||||
msgid "Network %(net)s was changed meanwhile; reload the page"
|
||||
msgstr "网络 %(net)s 在此期间已更改;请重新加载页面"
|
||||
|
||||
#: vrtManager/network.py:496
|
||||
#, python-format
|
||||
msgid "The XML must define network %(net)s"
|
||||
msgstr "XML 必须定义网络 %(net)s"
|
||||
|
||||
#: vrtManager/network.py:495
|
||||
#: vrtManager/network.py:498
|
||||
msgid "The XML must keep the network's UUID"
|
||||
msgstr "XML 必须保留网络的 UUID"
|
||||
|
||||
|
|
@ -9416,7 +9421,7 @@ msgstr "厂商自定义"
|
|||
msgid "USB device %(bus)s/%(device)s (%(product)s)"
|
||||
msgstr "USB 设备 %(bus)s/%(device)s (%(product)s)"
|
||||
|
||||
#: vrtManager/nodedevs.py:103 vrtManager/util.py:91
|
||||
#: vrtManager/nodedevs.py:103 vrtManager/util.py:98
|
||||
#, python-format
|
||||
msgid "The XML is not valid: %(err)s"
|
||||
msgstr "XML 无效:%(err)s"
|
||||
|
|
@ -9556,21 +9561,26 @@ msgstr "过滤器已更改;请重新加载页面后重试"
|
|||
|
||||
#: vrtManager/nwfilters.py:169
|
||||
#, python-format
|
||||
msgid "Filter %(name)s was changed meanwhile; reload the page"
|
||||
msgstr "过滤器 %(name)s 在此期间已更改;请重新加载页面"
|
||||
|
||||
#: vrtManager/nwfilters.py:172
|
||||
#, python-format
|
||||
msgid "The XML must define filter %(name)s"
|
||||
msgstr "XML 必须定义过滤器 %(name)s"
|
||||
|
||||
#: vrtManager/nwfilters.py:171
|
||||
#: vrtManager/nwfilters.py:174
|
||||
msgid "The XML must keep the filter's UUID"
|
||||
msgstr "XML 必须保留过滤器的 UUID"
|
||||
|
||||
#: vrtManager/nwfilters.py:183
|
||||
#: vrtManager/nwfilters.py:186
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Filter %(name)s cannot be referenced: it is this one, referenced already or "
|
||||
"not on the host"
|
||||
msgstr "无法引用过滤器 %(name)s:它就是本过滤器、已被引用或不在主机上"
|
||||
|
||||
#: vrtManager/nwfilters.py:193
|
||||
#: vrtManager/nwfilters.py:196
|
||||
msgid "Enter one <rule> element"
|
||||
msgstr "请输入一个 <rule> 元素"
|
||||
|
||||
|
|
@ -9598,11 +9608,11 @@ msgstr "卷 %(name)s 正在使用中:它是虚拟机的磁盘、后备文件
|
|||
msgid "The running VMs %(vms)s use volume %(name)s; shut them down to copy it"
|
||||
msgstr "正在运行的虚拟机 %(vms)s 使用卷 %(name)s;请先将其关闭再复制"
|
||||
|
||||
#: vrtManager/util.py:93
|
||||
#: vrtManager/util.py:100
|
||||
msgid "The XML may not declare a DTD"
|
||||
msgstr "XML 不能声明 DTD"
|
||||
|
||||
#: vrtManager/util.py:139
|
||||
#: vrtManager/util.py:146
|
||||
#, python-format
|
||||
msgid "MAC address must be of the format AA:BB:CC:DD:EE:FF, was %(mac)s"
|
||||
msgstr "MAC 地址的格式必须为 AA:BB:CC:DD:EE:FF,实际为 %(mac)s"
|
||||
|
|
|
|||
|
|
@ -331,6 +331,7 @@
|
|||
<form method="post" class="accordion-body" aria-label="{% trans "Change the network's XML" %}">{% csrf_token %}
|
||||
<p class="small text-body-secondary">{% trans "The saved definition: a running network takes a change when it is stopped and started again." %}</p>
|
||||
<input type="hidden" name="edit_xml">
|
||||
<input type="hidden" name="seen" value="{{ seen }}">
|
||||
<div class="xmlheight mb-3"><textarea id="edit_editor" aria-label="{% trans "Network XML" %}">{{ xml }}</textarea></div>
|
||||
<div class="d-flex justify-content-end">
|
||||
<button type="submit" class="btn btn-primary" name="edit_network">{% trans "Save" %}</button>
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class NetworkRowTests(TestCase):
|
|||
self.post({"delete_fixed_address": "", "original": "192.0.2.31", "ip_index": "0"})
|
||||
self.post({"set_qos": "", "qos_direction": "inbound", "qos_average": "100"})
|
||||
self.post({"unset_qos": "", "qos_direction": "inbound"})
|
||||
self.post({"edit_network": "", "edit_xml": xml})
|
||||
self.post({"edit_network": "", "edit_xml": xml, "seen": self.client.get(self.url).context["seen"]})
|
||||
self.post({"stop": ""})
|
||||
self.post({"delete": ""})
|
||||
self.assertEqual(rows(), [
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from django.utils.translation import gettext_lazy as _
|
|||
from libvirt import libvirtError
|
||||
from logs.audit import audit, failed
|
||||
from vrtManager.network import network_size, wvmNetwork, wvmNetworks
|
||||
from vrtManager.util import OperationError
|
||||
from vrtManager.util import OperationError, digest
|
||||
|
||||
from networks.forms import AddNetPool
|
||||
|
||||
|
|
@ -192,7 +192,7 @@ def network(request, compute_id, pool):
|
|||
if edit_xml:
|
||||
try:
|
||||
with audit(request, compute, subject, "change XML"):
|
||||
conn.edit_network(edit_xml)
|
||||
conn.edit_network(edit_xml, request.POST.get("seen", ""))
|
||||
except (libvirtError, OperationError) as err:
|
||||
messages.error(request, err)
|
||||
return HttpResponseRedirect(here)
|
||||
|
|
@ -279,6 +279,7 @@ def network(request, compute_id, pool):
|
|||
for vm in vms:
|
||||
vm["id"] = vm_ids.get(vm["name"])
|
||||
xml = conn.saved_xml
|
||||
seen = digest(xml)
|
||||
except libvirtError as lib_err:
|
||||
messages.error(request, lib_err)
|
||||
return HttpResponseRedirect(reverse("networks", args=[compute_id]))
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@
|
|||
<form method="post" class="accordion-body" aria-label="{% trans "Change the filter's XML" %}">{% csrf_token %}
|
||||
<p class="small text-body-secondary">{% trans "A change applies at once, also to the running VMs that use the filter; it keeps the filter's name and UUID." %}</p>
|
||||
<input type="hidden" name="edit_xml">
|
||||
<input type="hidden" name="seen" value="{{ seen }}">
|
||||
<div class="xmlheight mb-3"><textarea id="edit_editor" aria-label="{% trans "Filter XML" %}">{{ xml }}</textarea></div>
|
||||
<div class="d-flex justify-content-end">
|
||||
<button type="submit" class="btn btn-primary" name="edit_nwfilter">{% trans "Save" %}</button>
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class FilterRowTests(TestCase):
|
|||
self.assertEqual(rows(), [("Network filter web: delete: Filter web is used by VM web-1", False)])
|
||||
|
||||
def test_filter_page_actions(self):
|
||||
self.client.post(self.url, {"edit_nwfilter": "", "edit_xml": XML})
|
||||
self.client.post(self.url, {"edit_nwfilter": "", "edit_xml": XML, "seen": self.client.get(self.url).context["seen"]})
|
||||
self.client.post(self.url, {"add_nwfilter_rule": "",
|
||||
"nwfilterrule_xml": "<rule action='accept' direction='in' priority='500'><all/></rule>"})
|
||||
tree = etree.fromstring(XML)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ class FilterRedefineTests(TestCase):
|
|||
page = html.fromstring(self.client.get(self.url).content)
|
||||
edited = page.get_element_by_id("edit_editor").text
|
||||
self.assertIn(UUID, edited)
|
||||
tree, _ = self.defined({"edit_nwfilter": "", "edit_xml": edited})
|
||||
seen = page.xpath("//input[@name='seen']/@value")[0]
|
||||
tree, _ = self.defined({"edit_nwfilter": "", "edit_xml": edited, "seen": seen})
|
||||
self.assertEqual(tree.findtext("uuid"), UUID)
|
||||
|
||||
def test_one_change_a_post(self):
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ def nwfilter(request, compute_id, nwfltr):
|
|||
try:
|
||||
if "edit_nwfilter" in post:
|
||||
with audit(request, compute, subject, "change XML"):
|
||||
nwfilter.edit(post.get("edit_xml", ""))
|
||||
nwfilter.edit(post.get("edit_xml", ""), post.get("seen", ""))
|
||||
elif "add_nwfilter_rule" in post:
|
||||
with audit(request, compute, subject, "add rule"):
|
||||
nwfilter.add_rule(post.get("nwfilterrule_xml", ""))
|
||||
|
|
@ -89,6 +89,7 @@ def nwfilter(request, compute_id, nwfltr):
|
|||
name = nwfilter.get_name()
|
||||
uuid = nwfilter.get_uuid()
|
||||
xml = nwfilter.get_xml()
|
||||
seen = util.digest(xml)
|
||||
chain = nwfilter.tree.get("chain")
|
||||
priority = nwfilter.tree.get("priority")
|
||||
rules = nwfilter.get_rules()
|
||||
|
|
|
|||
|
|
@ -485,9 +485,12 @@ class wvmNetwork(wvmConnect):
|
|||
limit.getparent().remove(limit)
|
||||
self._define(tree)
|
||||
|
||||
def edit_network(self, new_xml):
|
||||
def edit_network(self, new_xml, seen):
|
||||
"""Defines this network anew from new_xml: of the same name and, if it
|
||||
names one, the same UUID, not another network."""
|
||||
names one, the same UUID, not another network; seen is the digest of
|
||||
the saved definition the editor showed."""
|
||||
if seen != util.digest(self.saved_xml):
|
||||
raise util.OperationError(gettext_noop("Network %(net)s was changed meanwhile; reload the page"), net=self.net.name())
|
||||
tree = util.parse_xml(new_xml)
|
||||
if tree.tag != "network" or tree.findtext("name") != self.net.name():
|
||||
raise util.OperationError(gettext_noop("The XML must define network %(net)s"), net=self.net.name())
|
||||
|
|
|
|||
|
|
@ -161,9 +161,12 @@ class wvmNWFilter(wvmNWFilters):
|
|||
self._define(tree)
|
||||
return elements[index]
|
||||
|
||||
def edit(self, xml):
|
||||
def edit(self, xml, seen):
|
||||
"""Define the filter anew from the XML entered: the same filter, of
|
||||
its name and UUID."""
|
||||
its name and UUID; seen is the digest of the XML (get_xml) the editor
|
||||
showed."""
|
||||
if seen != util.digest(self.get_xml()):
|
||||
raise util.OperationError(gettext_noop("Filter %(name)s was changed meanwhile; reload the page"), name=self.get_name())
|
||||
tree = util.parse_xml(xml)
|
||||
if tree.tag != "filter" or tree.get("name") != self.get_name():
|
||||
raise util.OperationError(gettext_noop("The XML must define filter %(name)s"), name=self.get_name())
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ from lxml import etree
|
|||
from vrtManager.network import network_size, wvmNetwork, wvmNetworks
|
||||
from vrtManager.tests.driver import without_inactive_flag
|
||||
from vrtManager.tests.fakes import DUID, lease
|
||||
from vrtManager.util import OperationError
|
||||
from vrtManager.util import OperationError, digest
|
||||
|
||||
NODE = """<node>
|
||||
<network><name>lab</name><bridge name='virbr9'/>
|
||||
|
|
@ -155,12 +155,13 @@ class NetworkChangeTests(SimpleTestCase):
|
|||
xml = ('<!DOCTYPE network [<!ENTITY name SYSTEM "file:///etc/hostname">]>'
|
||||
"<network><name>&name;</name></network>")
|
||||
with self.assertRaisesRegex(OperationError, "may not declare a DTD"):
|
||||
net.edit_network(xml)
|
||||
net.edit_network(xml, digest(net.saved_xml))
|
||||
|
||||
def test_the_xml_editor_takes_an_encoding_declaration(self):
|
||||
self.conn.networkLookupByName("lab").destroy()
|
||||
net = self.network()
|
||||
net.edit_network('<?xml version="1.0" encoding="UTF-8"?>\n' + net.saved_xml.replace("virbr9", "virbr6"))
|
||||
net.edit_network('<?xml version="1.0" encoding="UTF-8"?>\n' + net.saved_xml.replace("virbr9", "virbr6"),
|
||||
digest(net.saved_xml))
|
||||
self.assertEqual(self.saved().xpath("bridge/@name"), ["virbr6"])
|
||||
|
||||
def test_a_fixed_address_is_of_the_subnet_and_its_own(self):
|
||||
|
|
@ -180,10 +181,21 @@ class NetworkChangeTests(SimpleTestCase):
|
|||
(xml.replace(net.net.UUIDString(), "11111111-2222-3333-4444-555555555555"), "keep the network's UUID"),
|
||||
("<network>", "not valid")):
|
||||
with self.subTest(why=why), self.assertRaisesRegex(OperationError, why):
|
||||
net.edit_network(other)
|
||||
net.edit_network(xml.replace("virbr9", "virbr7"))
|
||||
net.edit_network(other, digest(xml))
|
||||
net.edit_network(xml.replace("virbr9", "virbr7"), digest(xml))
|
||||
self.assertEqual(self.saved().xpath("bridge/@name"), ["virbr7"])
|
||||
|
||||
def test_the_xml_editor_does_not_undo_a_change_made_meanwhile(self):
|
||||
# another admin set a limit after this editor showed the definition
|
||||
self.conn.networkLookupByName("lab").destroy()
|
||||
net = self.network()
|
||||
shown = net.saved_xml
|
||||
net.set_qos("inbound", 100, 200, 300)
|
||||
with self.assertRaisesRegex(OperationError, "Network lab was changed meanwhile"):
|
||||
net.edit_network(shown.replace("virbr9", "virbr7"), digest(shown))
|
||||
self.assertEqual((self.saved().xpath("bridge/@name"), self.saved().xpath("bandwidth/inbound/@average")),
|
||||
(["virbr9"], ["100"]))
|
||||
|
||||
def test_a_network_that_does_not_start_is_undefined(self):
|
||||
gateway, mask, dhcp = network_size("192.0.2.0/24", True)
|
||||
with patch.object(libvirt.virNetwork, "create", side_effect=libvirt.libvirtError("in use by virbr0")):
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import libvirt
|
|||
from django.test import SimpleTestCase
|
||||
from lxml import etree
|
||||
from vrtManager.nwfilters import wvmNWFilter, wvmNWFilters
|
||||
from vrtManager.util import OperationError
|
||||
from vrtManager.util import OperationError, digest
|
||||
|
||||
UUID = "6d1f7a10-0000-4000-8000-00000000c0de"
|
||||
WEB = (f"<filter name='web' chain='root'><uuid>{UUID}</uuid>"
|
||||
|
|
@ -132,9 +132,12 @@ class IdentityTests(SimpleTestCase):
|
|||
(WEB.replace(f"<uuid>{UUID}</uuid>", ""), "keep the filter's UUID"),
|
||||
(WEB.replace(UUID, "11111111-2222-3333-4444-555555555555"), "keep the filter's UUID")):
|
||||
with self.subTest(why=why), self.assertRaisesRegex(OperationError, why):
|
||||
conn.edit(xml)
|
||||
conn.edit(xml, digest(conn.get_xml()))
|
||||
conn.wvm.nwfilterDefineXML.assert_not_called()
|
||||
conn.edit(WEB.replace("priority='500'", "priority='400'"))
|
||||
# an editor that showed the filter as it was before another change
|
||||
with self.assertRaisesRegex(OperationError, "Filter web was changed meanwhile"):
|
||||
conn.edit(WEB, digest(WEB.replace("priority='500'", "priority='300'")))
|
||||
conn.edit(WEB.replace("priority='500'", "priority='400'"), digest(conn.get_xml()))
|
||||
conn.wvm.nwfilterDefineXML.assert_called_once()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from django.utils.translation import gettext_noop
|
||||
import hashlib
|
||||
import ipaddress
|
||||
import secrets
|
||||
import re
|
||||
|
|
@ -30,6 +31,12 @@ def render(text, values, translate):
|
|||
return text % {key: shown(value) for key, value in values.items()} if values else text
|
||||
|
||||
|
||||
def digest(text):
|
||||
"""A fingerprint of a definition: a page sends back the one of the
|
||||
definition it showed, and a change made meanwhile is not overwritten."""
|
||||
return hashlib.sha256(text.encode()).hexdigest()
|
||||
|
||||
|
||||
class OperationError(libvirt.libvirtError):
|
||||
"""An error with WebVirtCloud's own message (see message()). Its args are
|
||||
the English message, for logs and the audit log; str() is the message in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue