From: Daniel Bowder <daniel@bowdernet.com>
To: pve-devel@lists.proxmox.com
Cc: Daniel Bowder <daniel@bowdernet.com>
Subject: [pve-devel] [PATCH 4/5] fix #3593: Added vm core pinning proxmox-widget-toolkit
Date: Wed, 8 Jun 2022 04:54:27 -0700 [thread overview]
Message-ID: <20220608115428.250668-5-daniel@bowdernet.com> (raw)
In-Reply-To: <20220608115428.250668-1-daniel@bowdernet.com>
Signed-off-by: Daniel Bowder <daniel@bowdernet.com>
---
The fourth patch adds a javascript type for CPUSet. This type can use a regex match to (mostly) ensure the user types a correct cpuset. There are some fringe cases where the CPUSet can pass the CPUSet_match, but then fail the checks in patch three. (e.g. 0,5-4 will pass, but is invalid). This is not a problem, because the user cannot save this invalid CPUSet per the checks in patch three.
src/Toolkit.js | 5 +++++
src/Utils.js | 2 ++
2 files changed, 7 insertions(+)
diff --git a/src/Toolkit.js b/src/Toolkit.js
index a1d291e..41673a6 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -121,6 +121,11 @@ Ext.apply(Ext.form.field.VTypes, {
},
HttpProxyText: gettext('Example') + ": http://username:password@host:port/",
+ CPUSet: function(v) {
+ return Proxmox.Utils.CPUSet_match.test(v);
+ },
+ CPUSetText: gettext('This is not a valid CPU Set. (e.g. 0,2-6,8)'),
+
DnsName: function(v) {
return Proxmox.Utils.DnsName_match.test(v);
},
diff --git a/src/Utils.js b/src/Utils.js
index 6a03057..8f1c839 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -1315,6 +1315,8 @@ utilities: {
me.DnsName_match = new RegExp("^" + DnsName_REGEXP + "$");
me.DnsName_or_Wildcard_match = new RegExp("^(?:\\*\\.)?" + DnsName_REGEXP + "$");
+ me.CPUSet_match = /^(?:(?:[0-9]+,)|(?:[0-9]+-[0-9]+,))*(?:(?:[0-9]+)$|(?:[0-9]+-[0-9]+)$)/;
+
me.HostPort_match = new RegExp("^(" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")(?::(\\d+))?$");
me.HostPortBrackets_match = new RegExp("^\\[(" + IPV6_REGEXP + "|" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")\\](?::(\\d+))?$");
me.IP6_dotnotation_match = new RegExp("^(" + IPV6_REGEXP + ")(?:\\.(\\d+))?$");
--
2.30.2
next prev parent reply other threads:[~2022-06-08 11:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 11:54 [pve-devel] [PATCH 0/5] fix #3593: Added vm core pinning Daniel Bowder
2022-06-08 11:54 ` [pve-devel] [PATCH 1/5] fix #3593: Added vm core pinning pve-docs Daniel Bowder
2022-06-08 14:20 ` Matthias Heiserer
2022-06-08 11:54 ` [pve-devel] [PATCH 2/5] fix #3593: Added vm core pinning pve-guest-common Daniel Bowder
2022-06-08 11:54 ` [pve-devel] [PATCH 3/5] fix #3593: Added vm core pinning qemu-server Daniel Bowder
2022-06-08 14:45 ` Matthias Heiserer
2022-06-08 11:54 ` Daniel Bowder [this message]
2022-06-08 11:54 ` [pve-devel] [PATCH 5/5] fix #3593: Added vm core pinning pve-manager Daniel Bowder
2022-06-08 14:39 ` Matthias Heiserer
2022-06-08 13:00 ` [pve-devel] [PATCH 0/5] fix #3593: Added vm core pinning Matthias Heiserer
2022-06-08 13:21 ` Daniel Bowder
2022-06-08 13:32 ` Matthias Heiserer
2022-06-08 13:43 ` Daniel Bowder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220608115428.250668-5-daniel@bowdernet.com \
--to=daniel@bowdernet.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox