@@ -72,6 +72,7 @@ class BaremetalV2GatewayAgentPlugin(kvmagent.KvmAgent):
7272 DEFAULT_PXE_PATH = os .path .join (PXELINUX_CFG_DIR , 'default' )
7373 GRUB_CFG_DIR = os .path .join (TFTPBOOT_DIR , 'EFI/centos/' )
7474 GRUB_CFG_PATH = os .path .join (GRUB_CFG_DIR , 'grub.cfg' )
75+ KS_ERR_LOG_PATH = os .path .join (TFTPBOOT_DIR , 'ks.errlogs/' )
7576 X86_64_BOOTIMG_DIR = os .path .join (TFTPBOOT_DIR , 'x86_64' )
7677 AARCH64_BOOTIMG_DIR = os .path .join (TFTPBOOT_DIR , 'aarch64' )
7778
@@ -179,6 +180,9 @@ def _ensure_env(self, network_obj):
179180 if not os .path .exists (self .BM_IMGS_DIR ):
180181 linux .mkdir (self .BM_IMGS_DIR )
181182
183+ if not os .path .exists (self .KS_ERR_LOG_PATH ):
184+ linux .mkdir (self .KS_ERR_LOG_PATH )
185+
182186 # download pxe images from management node
183187 # static repo url like: http://10.10.0.1:8080/zstack/static/zstack-repo/x86_64/c76
184188 bmtempdir = tempfile .mkdtemp ()
@@ -283,17 +287,16 @@ def _prepare_tftp(self):
283287 with open (self .MAPFILE_PATH , 'w' ) as f :
284288 f .write (map_file )
285289
286- if not os .path .exists (self .TFTPD_SYSTEMD_SERVICE_PATH ):
287- template_systemd_service = self ._load_template (
288- 'tftp_systemd_service' )
289- systemd_service = template_systemd_service .render (
290- bm_gateway_tftpd_mapfile = self .MAPFILE_PATH ,
291- bm_gateway_tftpboot_dir = self .TFTPBOOT_DIR )
292- with open (self .TFTPD_SYSTEMD_SERVICE_PATH , 'w' ) as f :
293- f .write (systemd_service )
290+ template_systemd_service = self ._load_template (
291+ 'tftp_systemd_service' )
292+ systemd_service = template_systemd_service .render (
293+ bm_gateway_tftpd_mapfile = self .MAPFILE_PATH ,
294+ bm_gateway_tftpboot_dir = self .TFTPBOOT_DIR )
295+ with open (self .TFTPD_SYSTEMD_SERVICE_PATH , 'w' ) as f :
296+ f .write (systemd_service )
294297
295298 cmd = ('systemctl daemon-reload && '
296- 'systemctl start zstack-baremetal-tftpd' )
299+ 'systemctl restart zstack-baremetal-tftpd' )
297300 shell .call (cmd )
298301
299302 def _destroy_tftp (self ):
@@ -916,7 +919,8 @@ def _create_import_data_config(self, volume_driver, cmd):
916919 chassis_address = cmd .chassisInfo .address ,
917920 chassis_port = cmd .chassisInfo .port ,
918921 api_id = cmd .threadContext .api ,
919- task_name = cmd .threadContext ["task-name" ]
922+ task_name = cmd .threadContext ["task-name" ],
923+ provision_mac = instance_obj .provision_mac
920924 )
921925
922926 with open (ks_config_path , 'w' ) as f :
0 commit comments