3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
18 from ironic.drivers.modules import ipmitool
19 from ironic.conductor import utils as manager_utils
20 from ironic.common import exception
21 from ironic.common import boot_devices
23 from .nokia_hw import NokiaIronicVirtMediaHW
25 class HW17(NokiaIronicVirtMediaHW):
26 def __init__(self, log):
27 super(HW17, self).__init__(log)
29 def get_disk_attachment_status(self, task):
30 # Check NFS Service Status
31 (out, err) = ipmitool.send_raw(task, '0x3c 0x03')
32 self.log.debug("get_disk_attachment_status: NFS service status: error:%r, output:%r" %(err, out))
42 def attach_virtual_cd(self, image_filename, driver_info, task):
44 # Stop virtual device and Clear NFS configuration
45 ipmitool.send_raw(task, '0x3c 0x0')
46 # Set NFS Configurations
48 ipmitool.send_raw(task, '0x3c 0x01 0x00 %s 0x00' %(self.hex_convert(driver_info['provisioning_server'])))
49 # Set NFS Mount Root path
50 ipmitool.send_raw(task, '0x3c 0x01 0x01 %s 0x00' %(self.hex_convert(self.remote_share)))
52 ipmitool.send_raw(task, '0x3c 0x01 0x02 %s 0x00' %(self.hex_convert(image_filename)))
54 ipmitool.send_raw(task, '0x3c 0x02 0x01')
58 return self.check_and_wait_for_cd_mounting(image_filename, task, driver_info)
60 def detach_virtual_cd(self, driver_info, task):
61 """Detaches virtual cdrom on the node.
63 :param task: an ironic task object.
65 # Stop virtual device and Clear NFS configuration
66 self.log.debug("detach_virtual_cd")
67 ipmitool.send_raw(task, '0x3c 0x00')
69 def set_boot_device(self, task):
70 manager_utils.node_set_boot_device(task, boot_devices.FLOPPY, persistent=True)