[PATCH compass-ci] specifies the queue from which the VM obtains tasks

[why] specify the VM that need to consume the queues one job will added one queue, but one VM can consume job from multi queues. [how] to solve this problem, the scheduler should obtains which queues should be request. solution-1: register mac hostname and queues relation before: mac2host change to: mac2host and host2queues then scheduler can get queues based on mac solution-2: /boot.ipxe/mac/${mac}?queues=xxx,yyy our HW and PXE-VM use /tftpboot/boot.ipxe to send request, unable to specify parameter, so solution-1 may be better. Signed-off-by: Xiao Shenwei <xiaoshenwei96@163.com> --- providers/my-qemu.sh | 4 +++- providers/qemu.sh | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/providers/my-qemu.sh b/providers/my-qemu.sh index 954d3a0..f42a1fd 100755 --- a/providers/my-qemu.sh +++ b/providers/my-qemu.sh @@ -4,6 +4,8 @@ [[ $tbox_group ]] || tbox_group=vm-2p8g -export hostname=$tbox_group--$USER-$$ +export hostname=$tbox_group.$USER-$$ +# specify which queues will be request, use " " to separate more than 2 values +export queues="vm-2p8g~$USER vm-2p8g.aarch64" $CCI_SRC/providers/qemu.sh diff --git a/providers/qemu.sh b/providers/qemu.sh index d97fd85..7e4f074 100755 --- a/providers/qemu.sh +++ b/providers/qemu.sh @@ -9,6 +9,7 @@ load_cci_defaults : ${hostname:="vm-1p1g-1"} +: ${queues:="vm-1p1g.$(arch)"} # unicast prefix: x2, x6, xA, xE export mac=$(echo $hostname | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/0a-\1-\2-\3-\4-\5/') echo hostname: $hostname @@ -17,14 +18,23 @@ echo $mac > mac echo "arp -n | grep ${mac//-/:}" > ip.sh chmod +x ip.sh -curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/set_host_mac?hostname=${hostname}&mac=${mac}" +set_host_info() +{ + # use "," replace " " + queues=$(echo $queues | sed -r 's/ +/,/g') + curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/set_host_mac?hostname=${hostname}&mac=${mac}" + curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/set_host2queues?host=${hostname}&queues=${queues}" + +} +set_host_info -del_host_mac() +del_host_info() { curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/del_host_mac?mac=${mac}" > /dev/null 2>&1 + curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/del_host2queues?host=${hostname}" > /dev/null 2>&1 } -trap del_host_mac EXIT +trap del_host_info EXIT ( if [[ $hostname =~ ^(.*)-[0-9]+$ ]]; then @@ -33,7 +43,7 @@ trap del_host_mac EXIT tbox_group=$hostname fi - host=${tbox_group%%--*} + host=${tbox_group%.*} create_yaml_variables "$LKP_SRC/hosts/${host}" -- 2.23.0

On Tue, Nov 03, 2020 at 10:11:46AM +0800, Xiao Shenwei wrote:
[why] specify the VM that need to consume the queues one job will added one queue, but one VM can consume job from multi queues.
[how] to solve this problem, the scheduler should obtains which queues should be request. solution-1: register mac hostname and queues relation before: mac2host change to: mac2host and host2queues then scheduler can get queues based on mac solution-2: /boot.ipxe/mac/${mac}?queues=xxx,yyy our HW and PXE-VM use /tftpboot/boot.ipxe to send request, unable to specify parameter, so solution-1 may be better.
Signed-off-by: Xiao Shenwei <xiaoshenwei96@163.com> --- providers/my-qemu.sh | 4 +++- providers/qemu.sh | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/providers/my-qemu.sh b/providers/my-qemu.sh index 954d3a0..f42a1fd 100755 --- a/providers/my-qemu.sh +++ b/providers/my-qemu.sh @@ -4,6 +4,8 @@
[[ $tbox_group ]] || tbox_group=vm-2p8g -export hostname=$tbox_group--$USER-$$ +export hostname=$tbox_group.$USER-$$
+# specify which queues will be request, use " " to separate more than 2 values +export queues="vm-2p8g~$USER vm-2p8g.aarch64"
Please remove vm-2p8g.aarch64 -- it's against the purpose of 'my-qemu' -- it's no long MY qemu dedeciated for consuming MY jobs.
+ # use "," replace " " + queues=$(echo $queues | sed -r 's/ +/,/g')
bash can do the replace local api_queues=${queues// /,} Don't overwrite the original $queues.
+ curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/set_host_mac?hostname=${hostname}&mac=${mac}" + curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/set_host2queues?host=${hostname}&queues=${queues}"
${queues} => $api_queues Thanks, Fengguang

On Tue, Nov 03, 2020 at 12:04:45PM +0800, Wu Fengguang wrote:
On Tue, Nov 03, 2020 at 10:11:46AM +0800, Xiao Shenwei wrote:
[why] specify the VM that need to consume the queues one job will added one queue, but one VM can consume job from multi queues.
[how] to solve this problem, the scheduler should obtains which queues should be request. solution-1: register mac hostname and queues relation before: mac2host change to: mac2host and host2queues then scheduler can get queues based on mac solution-2: /boot.ipxe/mac/${mac}?queues=xxx,yyy our HW and PXE-VM use /tftpboot/boot.ipxe to send request, unable to specify parameter, so solution-1 may be better.
Signed-off-by: Xiao Shenwei <xiaoshenwei96@163.com> --- providers/my-qemu.sh | 4 +++- providers/qemu.sh | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/providers/my-qemu.sh b/providers/my-qemu.sh index 954d3a0..f42a1fd 100755 --- a/providers/my-qemu.sh +++ b/providers/my-qemu.sh @@ -4,6 +4,8 @@
[[ $tbox_group ]] || tbox_group=vm-2p8g -export hostname=$tbox_group--$USER-$$ +export hostname=$tbox_group.$USER-$$
+# specify which queues will be request, use " " to separate more than 2 values +export queues="vm-2p8g~$USER vm-2p8g.aarch64"
Please remove vm-2p8g.aarch64 -- it's against the purpose of 'my-qemu' -- it's no long MY qemu dedeciated for consuming MY jobs.
got it,
+ # use "," replace " " + queues=$(echo $queues | sed -r 's/ +/,/g')
bash can do the replace
local api_queues=${queues// /,}
use this way may cause: queues="a b c" echo ${queues// /,} a,b,,c Thanks, Shenwei
Don't overwrite the original $queues.
+ curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/set_host_mac?hostname=${hostname}&mac=${mac}" + curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/set_host2queues?host=${hostname}&queues=${queues}"
${queues} => $api_queues
Thanks, Fengguang

On Tue, Nov 03, 2020 at 10:11:46AM +0800, Xiao Shenwei wrote:
[why] specify the VM that need to consume the queues one job will added one queue, but one VM can consume job from multi queues.
[how] to solve this problem, the scheduler should obtains which queues should be request. solution-1: register mac hostname and queues relation before: mac2host change to: mac2host and host2queues then scheduler can get queues based on mac solution-2: /boot.ipxe/mac/${mac}?queues=xxx,yyy our HW and PXE-VM use /tftpboot/boot.ipxe to send request, unable to specify parameter, so solution-1 may be better.
Signed-off-by: Xiao Shenwei <xiaoshenwei96@163.com> --- providers/my-qemu.sh | 4 +++- providers/qemu.sh | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/providers/my-qemu.sh b/providers/my-qemu.sh index 954d3a0..f42a1fd 100755 --- a/providers/my-qemu.sh +++ b/providers/my-qemu.sh @@ -4,6 +4,8 @@
[[ $tbox_group ]] || tbox_group=vm-2p8g -export hostname=$tbox_group--$USER-$$ +export hostname=$tbox_group.$USER-$$ +# specify which queues will be request, use " " to separate more than 2 values +export queues="vm-2p8g~$USER vm-2p8g.aarch64"
$CCI_SRC/providers/qemu.sh diff --git a/providers/qemu.sh b/providers/qemu.sh index d97fd85..7e4f074 100755 --- a/providers/qemu.sh +++ b/providers/qemu.sh @@ -9,6 +9,7 @@ load_cci_defaults
: ${hostname:="vm-1p1g-1"} +: ${queues:="vm-1p1g.$(arch)"} # unicast prefix: x2, x6, xA, xE export mac=$(echo $hostname | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/0a-\1-\2-\3-\4-\5/') echo hostname: $hostname @@ -17,14 +18,23 @@ echo $mac > mac echo "arp -n | grep ${mac//-/:}" > ip.sh chmod +x ip.sh
-curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/set_host_mac?hostname=${hostname}&mac=${mac}" +set_host_info() +{ + # use "," replace " " + queues=$(echo $queues | sed -r 's/ +/,/g') + curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/set_host_mac?hostname=${hostname}&mac=${mac}" + curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/set_host2queues?host=${hostname}&queues=${queues}"
Better to keep the same written style with "set_host_mac" and "set_host2queues". Thanks, Xijian

+ queues=$(echo $queues | sed -r 's/ +/,/g') + curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/set_host_mac?hostname=${hostname}&mac=${mac}" + curl -X PUT "http://${SCHED_HOST:-172.17.0.1}:${SCHED_PORT:-3000}/set_host2queues?host=${hostname}&queues=${queues}"
Better to keep the same written style with "set_host_mac" and "set_host2queues".
latter will improve scheduler code Thanks, Shenwei
Thanks, Xijian
participants (3)
-
Wu Fengguang
-
Xiao Shenwei
-
Xu Xijian