1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 17:06:09 +00:00

fix(networks): a fixed address has a host name, a host address and is changed as shown

dnsmasq skips a fixed address whose name is not a host name ("bad DHCP
host name"): the VM got no fixed address while the page said it was set.
A name now has only letters, digits, '.', '_' and '-', as the dialog
already asks.

An IPv4 fixed address or DHCP range end may no longer be the subnet's
network or broadcast address.

The edit dialog sends the entry's MAC or DUID and name as the page showed
them; an entry another admin changed meanwhile is refused instead of being
changed back.
This commit is contained in:
catborise 2026-11-12 12:51:37 +03:00
parent e264104e85
commit a78d92e7aa
9 changed files with 202 additions and 142 deletions

Binary file not shown.

View file

@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-12 06:17+0000\n"
"POT-Creation-Date: 2026-11-12 09:51+0000\n"
"PO-Revision-Date: 2020-11-04 12:00+0000\n"
"Last-Translator: catborise <muhammetalisag@gmail.com>, 2020\n"
"Language-Team: Turkish (https://www.transifex.com/catborise/teams/110663/tr/)\n"
@ -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:370 nwfilters/templates/nwfilters.html:29
#: networks/templates/network.html:372 nwfilters/templates/nwfilters.html:29
#: storages/templates/storage.html:123 virtsecrets/forms.py:25
#: virtsecrets/forms.py:27
msgid "Name"
@ -304,8 +304,8 @@ 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:375 networks/templates/network.html:402
#: networks/templates/network.html:441
#: networks/templates/network.html:377 networks/templates/network.html:404
#: networks/templates/network.html:443
#: nwfilters/templates/create_nwfilter_block.html:33
#: nwfilters/templates/nwfilter.html:178 nwfilters/templates/nwfilters.html:93
#: operations/templates/operations/job.html:31
@ -1907,12 +1907,12 @@ msgstr ""
"sanal makinenin root parolasını ve SSH anahtarını bununla ayarlar; boş: bu "
"sunucuda ayarlanamazlar"
#: computes/models.py:176
#: computes/models.py:179
#, python-format
msgid "This host is already added as %(name)s"
msgstr "Bu sunucu zaten %(name)s olarak ekli"
#: computes/models.py:179
#: computes/models.py:182
#, python-format
msgid ""
"The panel cannot reach the host to tell that its VMs are there: %(error)s"
@ -1920,7 +1920,7 @@ msgstr ""
"Panel sunucuya ulaşamadığı için VM'lerinin orada olduğunu doğrulayamıyor: "
"%(error)s"
#: computes/models.py:186
#: computes/models.py:189
msgid ""
"The host its VMs are on is not known yet: change the connection when the "
"panel has reached the host at its current one"
@ -1928,7 +1928,7 @@ msgstr ""
"VM'lerinin bulunduğu sunucu henüz bilinmiyor: bağlantıyı, panel sunucuya "
"mevcut bağlantısından ulaştıktan sonra değiştirin"
#: computes/models.py:189
#: computes/models.py:192
msgid "This is another host than the one its VMs are on: add it as a new host"
msgstr ""
"Bu, VM'lerinin bulunduğu sunucudan başka bir sunucu: yeni bir sunucu olarak "
@ -2091,8 +2091,8 @@ 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:376
#: networks/templates/network.html:403 networks/templates/network.html:442
#: 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
msgid "Save"
msgstr "Kaydet"
@ -2437,17 +2437,17 @@ msgstr ""
"Sunucudaki /etc/default/webvirt-gstfsd içindeki GSTFSD_KEY değerinin 64 "
"onaltılık karakterini girin"
#: computes/views.py:108
#: computes/views.py:122
#, python-format
msgid "The host did not answer within %(seconds)s seconds"
msgstr "Sunucu %(seconds)s saniye içinde yanıt vermedi"
#: computes/views.py:196
#: computes/views.py:210
#, python-format
msgid "The host was saved, but the panel cannot connect to it: %(error)s"
msgstr "Sunucu kaydedildi, ancak panel ona bağlanamıyor: %(error)s"
#: computes/views.py:252
#: computes/views.py:266
#, python-format
msgid ""
"Its VMs keep running on the host and leave the panel; their owners are kept "
@ -2626,8 +2626,8 @@ 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:351 networks/templates/network.html:389
#: networks/templates/network.html:415
#: networks/templates/network.html:353 networks/templates/network.html:391
#: networks/templates/network.html:417
#: nwfilters/templates/create_nwfilter_block.html:17
#: nwfilters/templates/nwfilter.html:165 nwfilters/templates/nwfilters.html:85
#: storages/templates/create_stg_block.html:21
@ -3609,7 +3609,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:361
#: networks/templates/network.html:199 networks/templates/network.html:363
#: nodedevs/templates/nodedevs.html:32
msgid "Address"
msgstr "Adres"
@ -5316,12 +5316,12 @@ msgid "Migration route"
msgstr "Taşıma yolu"
#: instances/templates/instances/settings_tab.html:526
#: networks/templates/network.html:393
#: networks/templates/network.html:395
msgid "From"
msgstr "Başlangıç"
#: instances/templates/instances/settings_tab.html:531
#: networks/templates/network.html:397
#: networks/templates/network.html:399
msgid "To"
msgstr "Bitiş"
@ -6489,11 +6489,11 @@ msgstr ""
msgid "Select a network interface and a QoS direction"
msgstr "Bir ağ arabirimi ve bir QoS yönü seçin"
#: instances/views.py:2244 vrtManager/network.py:454
#: instances/views.py:2244 vrtManager/network.py:463
msgid "QoS rates must be whole numbers"
msgstr "QoS hızları tam sayı olmalıdır"
#: instances/views.py:2251 networks/views.py:229
#: instances/views.py:2251 networks/views.py:230
#, python-format
msgid "%(qos_dir)s QoS is set"
msgstr "%(qos_dir)s QoS ayarlandı"
@ -6506,7 +6506,7 @@ msgstr ""
"%(qos_dir)s QoS ayarlandı. Çalışan bir sanal makine, kapatılıp açıldıktan "
"sonra bunu alır."
#: instances/views.py:2278 networks/views.py:255
#: instances/views.py:2278 networks/views.py:256
#, python-format
msgid "%(qos_dir)s QoS is deleted"
msgstr "%(qos_dir)s QoS silindi"
@ -7045,7 +7045,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:419
#: networks/templates/network.html:282 networks/templates/network.html:421
#: nwfilters/templates/nwfilter.html:97
msgid "Direction"
msgstr "Yön"
@ -7059,17 +7059,17 @@ msgid "Outbound: from the VM"
msgstr "Giden: sanal makineden"
#: networks/templates/add_network_qos.html:20
#: networks/templates/network.html:427
#: networks/templates/network.html:429
msgid "Average (KiB/s)"
msgstr "Ortalama (KiB/s)"
#: networks/templates/add_network_qos.html:24
#: networks/templates/network.html:431
#: networks/templates/network.html:433
msgid "Peak (KiB/s)"
msgstr "Tepe (KiB/s)"
#: networks/templates/add_network_qos.html:28
#: networks/templates/network.html:435
#: networks/templates/network.html:437
msgid "Burst (KiB)"
msgstr "Ani yük (KiB)"
@ -7258,11 +7258,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:388
#: networks/templates/network.html:89 networks/templates/network.html:390
msgid "DHCP range"
msgstr "DHCP aralığı"
#: networks/templates/network.html:95 networks/templates/network.html:355
#: networks/templates/network.html:95 networks/templates/network.html:357
msgid "Subnet"
msgstr "Alt ağ"
@ -7423,31 +7423,31 @@ msgstr ""
msgid "Network XML"
msgstr "Ağ XML'i"
#: networks/templates/network.html:350
#: networks/templates/network.html:352
msgid "Fixed address"
msgstr "Sabit adres"
#: networks/templates/network.html:365
#: networks/templates/network.html:367
msgid "MAC (IPv4) or DUID (IPv6)"
msgstr "MAC (IPv4) veya DUID (IPv6)"
#: networks/templates/network.html:367
#: networks/templates/network.html:369
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:414
#: networks/templates/network.html:416
msgid "Bandwidth limit"
msgstr "Bant genişliği sınırı"
#: networks/templates/network.html:422
#: networks/templates/network.html:424
msgid "Inbound: to the VMs"
msgstr "Gelen: sanal makinelere"
#: networks/templates/network.html:423
#: networks/templates/network.html:425
msgid "Outbound: from the VMs"
msgstr "Giden: sanal makinelerden"
#: networks/templates/network.html:438
#: networks/templates/network.html:440
msgid "Linux applies a peak to inbound traffic only."
msgstr "Linux tepe değerini yalnızca gelen trafiğe uygular."
@ -7505,35 +7505,35 @@ msgstr "SR-IOV"
msgid "VMs get a virtual function of the host's network card."
msgstr "Sanal makineler sunucunun ağ kartının bir sanal işlevini alır."
#: networks/views.py:166
#: networks/views.py:167
msgid "The fixed address is unchanged"
msgstr "Sabit adres değişmedi"
#: networks/views.py:168
#: networks/views.py:169
#, python-format
msgid "The fixed address %(address)s is set"
msgstr "%(address)s sabit adresi ayarlandı"
#: networks/views.py:177
#: networks/views.py:178
#, python-format
msgid "The fixed address %(address)s is deleted"
msgstr "%(address)s sabit adresi silindi"
#: networks/views.py:185
#: networks/views.py:186
msgid "The DHCP range is changed"
msgstr "DHCP aralığı değiştirildi"
#: networks/views.py:202
#: networks/views.py:203
msgid "Network XML is changed. Stop and start network to activate new config."
msgstr ""
"Ağ XML'i değiştirildi. Yeni yapılandırmayı etkinleştirmek için ağı durdurup "
"başlatın."
#: networks/views.py:207
#: networks/views.py:208
msgid "Network XML is changed."
msgstr "Ağ XML i değiştirildi."
#: networks/views.py:222
#: networks/views.py:223
#, python-format
msgid ""
"%(qos_dir)s QoS is updated. Network XML is changed. Stop and start network to"
@ -7542,7 +7542,7 @@ msgstr ""
"%(qos_dir)s QoS is updated.Ağ XML i değiştirildi. \\ Aktifleştirmek için "
"durdurun ve yeniden başlatın."
#: networks/views.py:247
#: networks/views.py:248
#, python-format
msgid ""
"%(qos_dir)s QoS is deleted. Network XML is changed. Stop and start network to"
@ -9750,7 +9750,7 @@ msgstr ""
"%(iface)s köprüsünün adresleri ve birden fazla üyesi var: önce adresleri "
"sunucuda üyelerden birine verin"
#: vrtManager/network.py:299
#: vrtManager/network.py:300
#, python-format
msgid ""
"Network %(net)s is in use by the running VMs %(vms)s; shut them down or "
@ -9759,7 +9759,7 @@ msgstr ""
"%(net)s ağı çalışan %(vms)s sanal makineleri tarafından kullanılıyor; önce "
"onları kapatın veya ağ kartlarını kaldırın"
#: vrtManager/network.py:305
#: vrtManager/network.py:306
#, python-format
msgid ""
"VMs %(vms)s use network %(net)s and would no longer start; remove their "
@ -9768,7 +9768,7 @@ msgstr ""
"%(vms)s sanal makineleri %(net)s ağını kullanıyor ve artık başlamaz; önce ağ "
"kartlarını kaldırın"
#: vrtManager/network.py:314
#: vrtManager/network.py:315
#, python-format
msgid ""
"Network %(net)s runs with other addresses than it has saved; stop and start "
@ -9777,108 +9777,117 @@ msgstr ""
"%(net)s ağı kayıtlı olandan farklı adreslerle çalışıyor; önce durdurup "
"başlatın"
#: vrtManager/network.py:334
#: vrtManager/network.py:335
#, python-format
msgid "Network %(net)s has no such address"
msgstr "%(net)s ağında böyle bir adres yok"
#: vrtManager/network.py:339
#: vrtManager/network.py:340
#, python-format
msgid "The range start %(address)s is not in %(subnet)s"
msgstr "Aralık başlangıcı %(address)s, %(subnet)s içinde değil"
#: vrtManager/network.py:340
#: vrtManager/network.py:341
#, python-format
msgid "The range start %(address)s is not in the network"
msgstr "Aralık başlangıcı %(address)s ağın içinde değil"
#: vrtManager/network.py:341
#: vrtManager/network.py:342
#, python-format
msgid "The range end %(address)s is not in %(subnet)s"
msgstr "Aralık sonu %(address)s, %(subnet)s içinde değil"
#: vrtManager/network.py:342
#: vrtManager/network.py:343
#, python-format
msgid "The range end %(address)s is not in the network"
msgstr "Aralık sonu %(address)s ağın içinde değil"
#: vrtManager/network.py:343
#: vrtManager/network.py:344
#, python-format
msgid "The fixed address %(address)s is not in %(subnet)s"
msgstr "Sabit adres %(address)s, %(subnet)s içinde değil"
#: vrtManager/network.py:344
#: vrtManager/network.py:345
#, python-format
msgid "The fixed address %(address)s is not in the network"
msgstr "Sabit adres %(address)s ağın içinde değil"
#: vrtManager/network.py:353
#: vrtManager/network.py:354
#, python-format
msgid "%(address)s is not an IP address"
msgstr "%(address)s bir IP adresi değil"
#: vrtManager/network.py:358
#: vrtManager/network.py:359
#, python-format
msgid "%(address)s is the host's own address on the network"
msgstr "%(address)s sunucunun bu ağdaki kendi adresi"
#: vrtManager/network.py:364
#: vrtManager/network.py:362
#, python-format
msgid "%(address)s is not a host address of %(subnet)s"
msgstr "%(address)s, %(subnet)s ağında bir makine adresi değil"
#: vrtManager/network.py:368
#, python-format
msgid "Stop network %(net)s to change its DHCP range"
msgstr "DHCP aralığını değiştirmek için %(net)s ağını durdurun"
#: vrtManager/network.py:368
#: vrtManager/network.py:372
#, python-format
msgid "This address of network %(net)s has no DHCP range"
msgstr "%(net)s ağının bu adresinin DHCP aralığı yok"
#: vrtManager/network.py:372
#: vrtManager/network.py:376
#, python-format
msgid "The range starts at %(start)s, after its end %(end)s"
msgstr ""
"Aralık, sonu olan %(end)s adresinden sonra, %(start)s adresinde başlıyor"
#: vrtManager/network.py:374
#: vrtManager/network.py:378
#, python-format
msgid "The range takes in %(address)s, the host's own address"
msgstr "Aralık, sunucunun kendi adresi olan %(address)s adresini içeriyor"
#: vrtManager/network.py:383
#: vrtManager/network.py:387
#, python-format
msgid "Network %(net)s has no fixed address %(address)s"
msgstr "%(net)s ağında %(address)s sabit adresi yok"
#: vrtManager/network.py:405
#, python-format
msgid "The fixed address %(original)s is gone meanwhile; reload the page"
msgstr ""
"%(original)s sabit adresi bu arada kaldırılmış; sayfayı yeniden yükleyin"
msgid "The name %(name)s may have only letters, digits, '.', '_' and '-'"
msgstr "%(name)s adında yalnızca harf, rakam, '.', '_' ve '-' olabilir"
#: vrtManager/network.py:410
#: vrtManager/network.py:414
#, python-format
msgid "The fixed address %(original)s has changed meanwhile; reload the page"
msgstr "%(original)s sabit adresi bu arada değişti; sayfayı yeniden yükleyin"
#: vrtManager/network.py:419
#, python-format
msgid "%(address)s is another entry's fixed address"
msgstr "%(address)s başka bir kaydın sabit adresi"
#: vrtManager/network.py:412
#: vrtManager/network.py:421
#, python-format
msgid "%(mac_duid)s has another fixed address, %(other)s"
msgstr "%(mac_duid)s için başka bir sabit adres var: %(other)s"
#: vrtManager/network.py:414
#: vrtManager/network.py:423
#, python-format
msgid "The name %(name)s has another fixed address, %(other)s"
msgstr "%(name)s adı için başka bir sabit adres var: %(other)s"
#: vrtManager/network.py:450
#: vrtManager/network.py:459
msgid "Direction must be inbound or outbound"
msgstr "Yön gelen ya da giden olmalı"
#: vrtManager/network.py:477
#: vrtManager/network.py:486
#, python-format
msgid "The XML must define network %(net)s"
msgstr "XML, %(net)s ağını tanımlamalıdır"
#: vrtManager/network.py:479
#: vrtManager/network.py:488
msgid "The XML must keep the network's UUID"
msgstr "XML, ağın UUID değerini korumalıdır"

Binary file not shown.

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-12 06:17+0000\n"
"POT-Creation-Date: 2026-11-12 09:51+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
@ -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:370 nwfilters/templates/nwfilters.html:29
#: networks/templates/network.html:372 nwfilters/templates/nwfilters.html:29
#: storages/templates/storage.html:123 virtsecrets/forms.py:25
#: virtsecrets/forms.py:27
msgid "Name"
@ -299,8 +299,8 @@ 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:375 networks/templates/network.html:402
#: networks/templates/network.html:441
#: networks/templates/network.html:377 networks/templates/network.html:404
#: networks/templates/network.html:443
#: nwfilters/templates/create_nwfilter_block.html:33
#: nwfilters/templates/nwfilter.html:178 nwfilters/templates/nwfilters.html:93
#: operations/templates/operations/job.html:31
@ -1847,24 +1847,24 @@ msgstr ""
"主机 /etc/default/webvirt-gstfsd 中的 GSTFSD_KEY:面板用它为已关机的虚拟机设置 root 密码和 SSH "
"密钥;留空:无法在此设置"
#: computes/models.py:176
#: computes/models.py:179
#, python-format
msgid "This host is already added as %(name)s"
msgstr "此主机已作为 %(name)s 添加"
#: computes/models.py:179
#: computes/models.py:182
#, python-format
msgid ""
"The panel cannot reach the host to tell that its VMs are there: %(error)s"
msgstr "面板无法连接该主机,因此无法确认其虚拟机在那里:%(error)s"
#: computes/models.py:186
#: computes/models.py:189
msgid ""
"The host its VMs are on is not known yet: change the connection when the "
"panel has reached the host at its current one"
msgstr "其虚拟机所在的主机尚不明确:请在面板通过当前连接访问到该主机后再更改连接"
#: computes/models.py:189
#: computes/models.py:192
msgid "This is another host than the one its VMs are on: add it as a new host"
msgstr "这不是其虚拟机所在的主机:请将其添加为新主机"
@ -2013,8 +2013,8 @@ 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:376
#: networks/templates/network.html:403 networks/templates/network.html:442
#: 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
msgid "Save"
msgstr "保存"
@ -2351,17 +2351,17 @@ msgid ""
"/etc/default/webvirt-gstfsd"
msgstr "请输入主机 /etc/default/webvirt-gstfsd 中 GSTFSD_KEY 的 64 个十六进制字符"
#: computes/views.py:108
#: computes/views.py:122
#, python-format
msgid "The host did not answer within %(seconds)s seconds"
msgstr "主机未在 %(seconds)s 秒内响应"
#: computes/views.py:196
#: computes/views.py:210
#, python-format
msgid "The host was saved, but the panel cannot connect to it: %(error)s"
msgstr "主机已保存,但面板无法连接到它:%(error)s"
#: computes/views.py:252
#: computes/views.py:266
#, python-format
msgid ""
"Its VMs keep running on the host and leave the panel; their owners are kept "
@ -2535,8 +2535,8 @@ 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:351 networks/templates/network.html:389
#: networks/templates/network.html:415
#: networks/templates/network.html:353 networks/templates/network.html:391
#: networks/templates/network.html:417
#: nwfilters/templates/create_nwfilter_block.html:17
#: nwfilters/templates/nwfilter.html:165 nwfilters/templates/nwfilters.html:85
#: storages/templates/create_stg_block.html:21
@ -3458,7 +3458,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:361
#: networks/templates/network.html:199 networks/templates/network.html:363
#: nodedevs/templates/nodedevs.html:32
msgid "Address"
msgstr "地址"
@ -5062,12 +5062,12 @@ msgid "Migration route"
msgstr "迁移路径"
#: instances/templates/instances/settings_tab.html:526
#: networks/templates/network.html:393
#: networks/templates/network.html:395
msgid "From"
msgstr "源"
#: instances/templates/instances/settings_tab.html:531
#: networks/templates/network.html:397
#: networks/templates/network.html:399
msgid "To"
msgstr "目标"
@ -6126,11 +6126,11 @@ msgstr "已请求移除 PCI 设备 %(address)s:客户机尚未释放它;在
msgid "Select a network interface and a QoS direction"
msgstr "请选择网络接口和 QoS 方向"
#: instances/views.py:2244 vrtManager/network.py:454
#: instances/views.py:2244 vrtManager/network.py:463
msgid "QoS rates must be whole numbers"
msgstr "QoS 速率必须为整数"
#: instances/views.py:2251 networks/views.py:229
#: instances/views.py:2251 networks/views.py:230
#, python-format
msgid "%(qos_dir)s QoS is set"
msgstr "%(qos_dir)s QoS 已设置"
@ -6141,7 +6141,7 @@ msgid ""
"%(qos_dir)s QoS is set. A running VM gets it after it is powered off and on."
msgstr "%(qos_dir)s QoS 已设置。运行中的虚拟机需关机再开机后才能生效。"
#: instances/views.py:2278 networks/views.py:255
#: instances/views.py:2278 networks/views.py:256
#, python-format
msgid "%(qos_dir)s QoS is deleted"
msgstr "%(qos_dir)s QoS 已删除"
@ -6655,7 +6655,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:419
#: networks/templates/network.html:282 networks/templates/network.html:421
#: nwfilters/templates/nwfilter.html:97
msgid "Direction"
msgstr "方向"
@ -6669,17 +6669,17 @@ msgid "Outbound: from the VM"
msgstr "出站:来自虚拟机"
#: networks/templates/add_network_qos.html:20
#: networks/templates/network.html:427
#: networks/templates/network.html:429
msgid "Average (KiB/s)"
msgstr "平均(KiB/s)"
#: networks/templates/add_network_qos.html:24
#: networks/templates/network.html:431
#: networks/templates/network.html:433
msgid "Peak (KiB/s)"
msgstr "峰值(KiB/s)"
#: networks/templates/add_network_qos.html:28
#: networks/templates/network.html:435
#: networks/templates/network.html:437
msgid "Burst (KiB)"
msgstr "突发(KiB)"
@ -6855,11 +6855,11 @@ msgstr "此网络上的虚拟机从外部网络获取地址:libvirt 不分配
msgid "Stop the network to change its range"
msgstr "停止网络后才能更改其范围"
#: networks/templates/network.html:89 networks/templates/network.html:388
#: networks/templates/network.html:89 networks/templates/network.html:390
msgid "DHCP range"
msgstr "DHCP 范围"
#: networks/templates/network.html:95 networks/templates/network.html:355
#: networks/templates/network.html:95 networks/templates/network.html:357
msgid "Subnet"
msgstr "子网"
@ -7011,31 +7011,31 @@ msgstr "已保存的定义:运行中的网络需停止并重新启动后才应
msgid "Network XML"
msgstr "网络 XML"
#: networks/templates/network.html:350
#: networks/templates/network.html:352
msgid "Fixed address"
msgstr "固定地址"
#: networks/templates/network.html:365
#: networks/templates/network.html:367
msgid "MAC (IPv4) or DUID (IPv6)"
msgstr "MAC(IPv4)或 DUID(IPv6)"
#: networks/templates/network.html:367
#: networks/templates/network.html:369
msgid "The VM's network card; without it, the VM is known by its name."
msgstr "虚拟机的网卡;不填写时,按虚拟机名称识别。"
#: networks/templates/network.html:414
#: networks/templates/network.html:416
msgid "Bandwidth limit"
msgstr "带宽限制"
#: networks/templates/network.html:422
#: networks/templates/network.html:424
msgid "Inbound: to the VMs"
msgstr "入站:发往虚拟机"
#: networks/templates/network.html:423
#: networks/templates/network.html:425
msgid "Outbound: from the VMs"
msgstr "出站:来自虚拟机"
#: networks/templates/network.html:438
#: networks/templates/network.html:440
msgid "Linux applies a peak to inbound traffic only."
msgstr "Linux 仅对入站流量应用峰值。"
@ -7086,40 +7086,40 @@ msgstr "SR-IOV"
msgid "VMs get a virtual function of the host's network card."
msgstr "虚拟机获得主机网卡的一个虚拟功能。"
#: networks/views.py:166
#: networks/views.py:167
msgid "The fixed address is unchanged"
msgstr "固定地址未更改"
#: networks/views.py:168
#: networks/views.py:169
#, python-format
msgid "The fixed address %(address)s is set"
msgstr "已设置固定地址 %(address)s"
#: networks/views.py:177
#: networks/views.py:178
#, python-format
msgid "The fixed address %(address)s is deleted"
msgstr "已删除固定地址 %(address)s"
#: networks/views.py:185
#: networks/views.py:186
msgid "The DHCP range is changed"
msgstr "DHCP 范围已更改"
#: networks/views.py:202
#: networks/views.py:203
msgid "Network XML is changed. Stop and start network to activate new config."
msgstr "网络 XML 已更改。请停止并启动网络以应用新配置。"
#: networks/views.py:207
#: networks/views.py:208
msgid "Network XML is changed."
msgstr "网络 XML 已更改。"
#: networks/views.py:222
#: networks/views.py:223
#, python-format
msgid ""
"%(qos_dir)s QoS is updated. Network XML is changed. Stop and start network to"
" activate new config"
msgstr "%(qos_dir)s QoS 已更新。网络 XML 已更改。请停止并启动网络以应用新配置"
#: networks/views.py:247
#: networks/views.py:248
#, python-format
msgid ""
"%(qos_dir)s QoS is deleted. Network XML is changed. Stop and start network to"
@ -9177,127 +9177,137 @@ msgid ""
" of them on the host first"
msgstr "网桥 %(iface)s 有地址和多个成员:请先在主机上把地址分配给其中一个成员"
#: vrtManager/network.py:299
#: vrtManager/network.py:300
#, python-format
msgid ""
"Network %(net)s is in use by the running VMs %(vms)s; shut them down or "
"remove their network cards first"
msgstr "网络 %(net)s 正被运行中的虚拟机 %(vms)s 使用;请先关闭它们或移除其网卡"
#: vrtManager/network.py:305
#: vrtManager/network.py:306
#, python-format
msgid ""
"VMs %(vms)s use network %(net)s and would no longer start; remove their "
"network cards first"
msgstr "虚拟机 %(vms)s 使用网络 %(net)s,将无法再启动;请先移除其网卡"
#: vrtManager/network.py:314
#: vrtManager/network.py:315
#, python-format
msgid ""
"Network %(net)s runs with other addresses than it has saved; stop and start "
"it first"
msgstr "网络 %(net)s 运行时的地址与其保存的地址不同;请先停止再启动它"
#: vrtManager/network.py:334
#: vrtManager/network.py:335
#, python-format
msgid "Network %(net)s has no such address"
msgstr "网络 %(net)s 没有此地址"
#: vrtManager/network.py:339
#: vrtManager/network.py:340
#, python-format
msgid "The range start %(address)s is not in %(subnet)s"
msgstr "范围起始 %(address)s 不在 %(subnet)s 中"
#: vrtManager/network.py:340
#: vrtManager/network.py:341
#, python-format
msgid "The range start %(address)s is not in the network"
msgstr "范围起始 %(address)s 不在网络中"
#: vrtManager/network.py:341
#: vrtManager/network.py:342
#, python-format
msgid "The range end %(address)s is not in %(subnet)s"
msgstr "范围结束 %(address)s 不在 %(subnet)s 中"
#: vrtManager/network.py:342
#: vrtManager/network.py:343
#, python-format
msgid "The range end %(address)s is not in the network"
msgstr "范围结束 %(address)s 不在网络中"
#: vrtManager/network.py:343
#: vrtManager/network.py:344
#, python-format
msgid "The fixed address %(address)s is not in %(subnet)s"
msgstr "固定地址 %(address)s 不在 %(subnet)s 中"
#: vrtManager/network.py:344
#: vrtManager/network.py:345
#, python-format
msgid "The fixed address %(address)s is not in the network"
msgstr "固定地址 %(address)s 不在网络中"
#: vrtManager/network.py:353
#: vrtManager/network.py:354
#, python-format
msgid "%(address)s is not an IP address"
msgstr "%(address)s 不是 IP 地址"
#: vrtManager/network.py:358
#: vrtManager/network.py:359
#, python-format
msgid "%(address)s is the host's own address on the network"
msgstr "%(address)s 是主机自己在该网络上的地址"
#: vrtManager/network.py:364
#: vrtManager/network.py:362
#, python-format
msgid "%(address)s is not a host address of %(subnet)s"
msgstr "%(address)s 不是 %(subnet)s 中的主机地址"
#: vrtManager/network.py:368
#, python-format
msgid "Stop network %(net)s to change its DHCP range"
msgstr "请停止网络 %(net)s 后再更改其 DHCP 范围"
#: vrtManager/network.py:368
#: vrtManager/network.py:372
#, python-format
msgid "This address of network %(net)s has no DHCP range"
msgstr "网络 %(net)s 的此地址没有 DHCP 范围"
#: vrtManager/network.py:372
#: vrtManager/network.py:376
#, python-format
msgid "The range starts at %(start)s, after its end %(end)s"
msgstr "范围起始 %(start)s 在其结束 %(end)s 之后"
#: vrtManager/network.py:374
#: vrtManager/network.py:378
#, python-format
msgid "The range takes in %(address)s, the host's own address"
msgstr "范围包含主机自己的地址 %(address)s"
#: vrtManager/network.py:383
#: vrtManager/network.py:387
#, python-format
msgid "Network %(net)s has no fixed address %(address)s"
msgstr "网络 %(net)s 没有固定地址 %(address)s"
#: vrtManager/network.py:405
#, python-format
msgid "The fixed address %(original)s is gone meanwhile; reload the page"
msgstr "固定地址 %(original)s 已不存在;请重新加载页面"
msgid "The name %(name)s may have only letters, digits, '.', '_' and '-'"
msgstr "名称 %(name)s 只能包含字母、数字、'.'、'_' 和 '-'"
#: vrtManager/network.py:410
#: vrtManager/network.py:414
#, python-format
msgid "The fixed address %(original)s has changed meanwhile; reload the page"
msgstr "固定地址 %(original)s 在此期间已更改;请重新加载页面"
#: vrtManager/network.py:419
#, python-format
msgid "%(address)s is another entry's fixed address"
msgstr "%(address)s 是另一条目的固定地址"
#: vrtManager/network.py:412
#: vrtManager/network.py:421
#, python-format
msgid "%(mac_duid)s has another fixed address, %(other)s"
msgstr "%(mac_duid)s 已有另一个固定地址 %(other)s"
#: vrtManager/network.py:414
#: vrtManager/network.py:423
#, python-format
msgid "The name %(name)s has another fixed address, %(other)s"
msgstr "名称 %(name)s 已有另一个固定地址 %(other)s"
#: vrtManager/network.py:450
#: vrtManager/network.py:459
msgid "Direction must be inbound or outbound"
msgstr "方向必须是入站或出站"
#: vrtManager/network.py:477
#: vrtManager/network.py:486
#, python-format
msgid "The XML must define network %(net)s"
msgstr "XML 必须定义网络 %(net)s"
#: vrtManager/network.py:479
#: vrtManager/network.py:488
msgid "The XML must keep the network's UUID"
msgstr "XML 必须保留网络的 UUID"

View file

@ -346,6 +346,8 @@
<div class="modal-dialog">
<form method="post" class="modal-content">{% csrf_token %}
<input type="hidden" name="original">
<input type="hidden" name="original_id">
<input type="hidden" name="original_name">
<div class="modal-header">
<h5 class="modal-title" id="FixedAddressLabel">{% trans "Fixed address" %}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{% trans "Close" %}"></button>

View file

@ -159,8 +159,9 @@ def network(request, compute_id, pool):
mac_duid = request.POST.get("mac") or request.POST.get("id", "")
try:
with audit(request, compute, subject, f"set fixed address {address}") as entry:
seen = (request.POST.get("original_id", "").lower(), request.POST.get("original_name", ""))
changed = conn.modify_fixed_address(ip_index, request.POST.get("original", ""),
request.POST.get("name", ""), address, mac_duid)
request.POST.get("name", ""), address, mac_duid, seen)
entry.skip = changed is False # nothing was done
if changed is False:
messages.info(request, _("The fixed address is unchanged"))

View file

@ -17,6 +17,9 @@ function fillFrom(dialogId, fill) {
}
fillFrom("FixedAddress", function (form, data) {
form.elements.original.value = data.original || "";
// the entry as shown: a change made meanwhile is not undone
form.elements.original_id.value = data.original ? data.mac : "";
form.elements.original_name.value = data.original ? data.name : "";
form.elements.address.value = data.address || "";
form.elements.mac.value = data.mac || "";
form.elements.name.value = data.name || "";

View file

@ -1,6 +1,7 @@
from django.utils.translation import gettext_noop
import copy
import ipaddress
import re
from datetime import datetime, timezone
from functools import cached_property
@ -356,6 +357,9 @@ class wvmNetwork(wvmConnect):
raise util.OperationError(outside, address=address, subnet=ip["subnet"])
if address == ipaddress.ip_address(ip["address"]):
raise util.OperationError(gettext_noop("%(address)s is the host's own address on the network"), address=address)
subnet = ip["subnet"]
if subnet.version == 4 and subnet.prefixlen < 31 and address in (subnet.network_address, subnet.broadcast_address):
raise util.OperationError(gettext_noop("%(address)s is not a host address of %(subnet)s"), address=address, subnet=subnet)
return address
def modify_dhcp_range(self, index, range_start, range_end):
@ -385,14 +389,17 @@ class wvmNetwork(wvmConnect):
self.update(VIR_NETWORK_UPDATE_COMMAND_DELETE, VIR_NETWORK_SECTION_IP_DHCP_HOST,
etree.tostring(host, with_tail=False).decode(), index)
def modify_fixed_address(self, index, original, name, address, mac_duid):
def modify_fixed_address(self, index, original, name, address, mac_duid, seen=None):
"""Adds a fixed address, or changes the one that had the address
original, keeping what the page does not show of it (a client id, a
lease time). The address must be of the subnet, not the host's, and
neither it, the MAC (IPv4) or DUID (IPv6) nor the name another entry's.
A change deletes the entry and adds it anew, put back if that fails:
libvirt's own change finds an entry by any of its MAC, address or name,
another entry's too, and an IPv6 one never by its DUID. Returns False
another entry's too, and an IPv6 one never by its DUID. seen: the
entry's MAC or DUID and name as the page showed them, refused when
another change has made them different meanwhile. A new name must be
a host name: dnsmasq drops an entry with another one. Returns False
when nothing changes."""
_tree, ip, info = self._ip(index)
address = self._checked_address(info, address, "fixed address")
@ -401,8 +408,11 @@ class wvmNetwork(wvmConnect):
old = None
if original:
old = next((h for h in hosts if h.get("ip") == original), None)
if old is None:
raise util.OperationError(gettext_noop("The fixed address %(original)s is gone meanwhile; reload the page"), original=original)
if old is None or (seen is not None and seen != ((old.get("mac") or old.get("id") or "").lower(), old.get("name", ""))):
raise util.OperationError(gettext_noop("The fixed address %(original)s has changed meanwhile; reload the page"), original=original)
# a new name must be one dnsmasq takes; one set outside the panel stays as it is
if name and (old is None or name != old.get("name")) and not re.fullmatch(r"[A-Za-z0-9_.-]+", name):
raise util.OperationError(gettext_noop("The name %(name)s may have only letters, digits, '.', '_' and '-'"), name=name)
for other in hosts:
if other is old:
continue

View file

@ -111,10 +111,34 @@ class NetworkChangeTests(SimpleTestCase):
self.assertEqual([dict(h.attrib) for h in saved.xpath("ip/dhcp/host")], [{"id": "00:01:00:01:aa:bb", "ip": "2001:db8:5::11"}])
def test_an_entry_gone_meanwhile_is_not_added_anew(self):
with self.assertRaisesRegex(OperationError, "is gone meanwhile"):
with self.assertRaisesRegex(OperationError, "has changed meanwhile"):
self.network().modify_fixed_address(1, "192.0.2.99", "x", "192.0.2.40", "")
self.assertEqual(self.saved().xpath("ip[2]/dhcp/host/@ip"), ["192.0.2.30", "192.0.2.31"])
def test_an_entry_changed_meanwhile_is_not_changed_back(self):
# another admin gave 192.0.2.31 a name after this page showed it without one
net = self.network()
with self.assertRaisesRegex(OperationError, "192.0.2.31 has changed meanwhile"):
net.modify_fixed_address(1, "192.0.2.31", "db", "192.0.2.31", "52:54:00:00:00:32", ("52:54:00:00:00:31", "web"))
net.modify_fixed_address(1, "192.0.2.31", "db", "192.0.2.31", "52:54:00:00:00:32", ("52:54:00:00:00:31", ""))
self.assertEqual(self.saved().xpath("ip[2]/dhcp/host[@ip='192.0.2.31']/@mac"), ["52:54:00:00:00:32"])
def test_a_name_dnsmasq_would_drop_is_refused(self):
# dnsmasq skips an entry whose name is not a host name: the VM would get no fixed address
with self.assertRaisesRegex(OperationError, "may have only letters"):
self.network().modify_fixed_address(1, "", "vm one", "192.0.2.40", "52:54:00:00:00:40")
self.network().modify_fixed_address(1, "", "vm_1.lab", "192.0.2.40", "52:54:00:00:00:40")
self.assertEqual(self.saved().xpath("ip[2]/dhcp/host[@ip='192.0.2.40']/@name"), ["vm_1.lab"])
def test_a_name_set_outside_the_panel_stays_editable(self):
# dnsmasq may take an internationalized name the panel would not give
conn = self.conn.networkLookupByName("lab")
conn.destroy()
self.conn.networkDefineXML(conn.XMLDesc(0).replace(
"<host name='paul'", "<host mac='52:54:00:00:00:41' name='vm.münchen' ip='192.0.2.41'/><host name='paul'"))
self.network().modify_fixed_address(1, "192.0.2.41", "vm.münchen", "192.0.2.42", "52:54:00:00:00:41")
self.assertEqual(self.saved().xpath("ip[2]/dhcp/host[@mac='52:54:00:00:00:41']/@ip"), ["192.0.2.42"])
def test_a_running_network_saved_with_other_addresses_is_not_changed_live(self):
# parentIndex would name another <ip> of the running network
net = self.network()
@ -142,7 +166,8 @@ class NetworkChangeTests(SimpleTestCase):
def test_a_fixed_address_is_of_the_subnet_and_its_own(self):
net = self.network()
for address, why in (("198.51.100.5", "is not in 192.0.2.0/24"), ("192.0.2.1", "the host's own address"),
("192.0.2.31", "another entry's fixed address"), ("x", "is not an IP address")):
("192.0.2.31", "another entry's fixed address"), ("x", "is not an IP address"),
("192.0.2.0", "not a host address of 192.0.2.0/24"), ("192.0.2.255", "not a host address")):
with self.subTest(address=address), self.assertRaisesRegex(OperationError, why):
net.modify_fixed_address(1, "192.0.2.30", "paul", address, "")
self.assertIs(net.modify_fixed_address(1, "192.0.2.30", "paul", "192.0.2.30", ""), False)