示例#1
0
    def test_deactivate_bootloader_for_nonexistent_instance(self):
        self._create_node()
        macs = [nic['address'] for nic in self.nic_info]
        macs.append(self.node_info['prov_mac_address'])
        macs.sort()
        image_info = {
                'deploy_kernel': [None, 'aaaa'],
                'deploy_ramdisk': [None, 'bbbb'],
                'kernel': [None, 'cccc'],
                'ramdisk': [None, 'dddd'],
            }
        self.instance['uuid'] = 'fake-uuid'
        pxe_path = pxe.get_pxe_config_file_path(self.instance)

        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'rmtree_without_raise')
        self.mox.StubOutWithMock(pxe, 'get_tftp_image_info')
        self.mox.StubOutWithMock(self.driver, '_collect_mac_addresses')

        pxe.get_tftp_image_info(self.instance).\
                AndRaise(exception.NovaException)
        bm_utils.unlink_without_raise(pxe_path)
        self.driver._collect_mac_addresses(self.context, self.node).\
                AndRaise(db_session.DBError)
        bm_utils.rmtree_without_raise(
                os.path.join(CONF.baremetal.tftp_root, 'fake-uuid'))
        self.mox.ReplayAll()

        self.driver.deactivate_bootloader(
            self.context, self.node, self.instance)
        self.mox.VerifyAll()
示例#2
0
    def test_unlink(self):
        self.mox.StubOutWithMock(os, "unlink")
        os.unlink("/fake/path")

        self.mox.ReplayAll()
        utils.unlink_without_raise("/fake/path")
        self.mox.VerifyAll()
示例#3
0
    def test_unlink_ENOENT(self):
        self.mox.StubOutWithMock(os, "unlink")
        os.unlink("/fake/path").AndRaise(OSError(errno.ENOENT))

        self.mox.ReplayAll()
        utils.unlink_without_raise("/fake/path")
        self.mox.VerifyAll()
示例#4
0
    def test_unlink(self):
        self.mox.StubOutWithMock(os, "unlink")
        os.unlink("/fake/path")

        self.mox.ReplayAll()
        utils.unlink_without_raise("/fake/path")
        self.mox.VerifyAll()
示例#5
0
    def test_exec_ipmitool(self):
        pw_file = '/tmp/password_file'

        self.mox.StubOutWithMock(ipmi, '_make_password_file')
        self.mox.StubOutWithMock(utils, 'execute')
        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        ipmi._make_password_file(self.ipmi.password).AndReturn(pw_file)
        args = [
            'ipmitool',
            '-I',
            'lanplus',
            '-H',
            self.ipmi.address,
            '-U',
            self.ipmi.user,
            '-f',
            pw_file,
            'A',
            'B',
            'C',
        ]
        utils.execute(*args, attempts=3).AndReturn(('', ''))
        bm_utils.unlink_without_raise(pw_file).AndReturn(None)
        self.mox.ReplayAll()

        self.ipmi._exec_ipmitool('A B C')
        self.mox.VerifyAll()
示例#6
0
文件: tilera.py 项目: gilmeir/nova
    def deactivate_bootloader(self, context, node, instance):
        """Delete Tilera bootloader images and config."""
        try:
            db.bm_node_update(
                context,
                node["id"],
                {"deploy_key": None, "image_path": None, "pxe_config_path": None, "root_mb": 0, "swap_mb": 0},
            )
        except exception.NodeNotFound:
            pass

        tilera_nfs_path = get_tilera_nfs_path(node["id"])

        if os.path.ismount(tilera_nfs_path):
            utils.execute("rpc.mountd", run_as_root=True)
            utils.execute("umount", "-f", tilera_nfs_path, run_as_root=True)

        try:
            image_info = get_tftp_image_info(instance)
        except exception.NovaException:
            pass
        else:
            for label in image_info.keys():
                (uuid, path) = image_info[label]
                bm_utils.unlink_without_raise(path)

        try:
            self._collect_mac_addresses(context, node)
        except db_exc.DBError:
            pass

        if os.path.exists(os.path.join(CONF.baremetal.tftp_root, instance["uuid"])):
            bm_utils.rmtree_without_raise(os.path.join(CONF.baremetal.tftp_root, instance["uuid"]))
示例#7
0
    def test_deactivate_bootloader_for_nonexistent_instance(self):
        self._create_node()
        self.instance['uuid'] = 'fake-uuid'
        pxe_path = pxe.get_pxe_config_file_path(self.instance)

        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'rmtree_without_raise')
        self.mox.StubOutWithMock(pxe, 'get_tftp_image_info')
        self.mox.StubOutWithMock(self.driver, '_collect_mac_addresses')

        extra_specs = dict(extra_specs={
            'baremetal:deploy_ramdisk_id': 'ignore',
            'baremetal:deploy_kernel_id': 'ignore'})
        pxe.get_tftp_image_info(self.instance, extra_specs).\
                AndRaise(exception.NovaException)
        bm_utils.unlink_without_raise(pxe_path)
        self.driver._collect_mac_addresses(self.context, self.node).\
                AndRaise(db_exc.DBError)
        bm_utils.rmtree_without_raise(
                os.path.join(CONF.baremetal.tftp_root, 'fake-uuid'))
        self.mox.ReplayAll()

        self.driver.deactivate_bootloader(
            self.context, self.node, self.instance)
        self.mox.VerifyAll()
示例#8
0
    def test_unlink_ENOENT(self):
        self.mox.StubOutWithMock(os, "unlink")
        os.unlink("/fake/path").AndRaise(OSError(errno.ENOENT))

        self.mox.ReplayAll()
        utils.unlink_without_raise("/fake/path")
        self.mox.VerifyAll()
示例#9
0
    def test_deactivate_bootloader_for_nonexistent_instance(self):
        self._create_node()
        self.instance['uuid'] = 'fake-uuid'
        pxe_path = pxe.get_pxe_config_file_path(self.instance)

        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'rmtree_without_raise')
        self.mox.StubOutWithMock(pxe, 'get_tftp_image_info')
        self.mox.StubOutWithMock(self.driver, '_collect_mac_addresses')

        extra_specs = dict(
            extra_specs={
                'baremetal:deploy_ramdisk_id': 'ignore',
                'baremetal:deploy_kernel_id': 'ignore'
            })
        pxe.get_tftp_image_info(self.instance, extra_specs).\
                AndRaise(exception.NovaException)
        bm_utils.unlink_without_raise(pxe_path)
        self.driver._collect_mac_addresses(self.context, self.node).\
                AndRaise(db_exc.DBError)
        bm_utils.rmtree_without_raise(
            os.path.join(CONF.baremetal.tftp_root, 'fake-uuid'))
        self.mox.ReplayAll()

        self.driver.deactivate_bootloader(self.context, self.node,
                                          self.instance)
        self.mox.VerifyAll()
示例#10
0
文件: test_pxe.py 项目: beride/nova
    def test_deactivate_bootloader_for_nonexistent_instance(self):
        self._create_node()
        macs = [nic['address'] for nic in self.nic_info]
        macs.append(self.node_info['prov_mac_address'])
        macs.sort()
        image_info = {
                'deploy_kernel': [None, 'aaaa'],
                'deploy_ramdisk': [None, 'bbbb'],
                'kernel': [None, 'cccc'],
                'ramdisk': [None, 'dddd'],
            }
        self.instance['uuid'] = 'fake-uuid'
        pxe_path = pxe.get_pxe_config_file_path(self.instance)

        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(pxe, 'get_tftp_image_info')
        self.mox.StubOutWithMock(self.driver, '_collect_mac_addresses')

        pxe.get_tftp_image_info(self.instance).\
                AndRaise(exception.NovaException)
        bm_utils.unlink_without_raise(pxe_path)
        self.driver._collect_mac_addresses(self.context, self.node).\
                AndRaise(exception.DBError)
        bm_utils.unlink_without_raise(
                os.path.join(CONF.baremetal.tftp_root, 'fake-uuid'))
        self.mox.ReplayAll()

        self.driver.deactivate_bootloader(
            self.context, self.node, self.instance)
        self.mox.VerifyAll()
示例#11
0
文件: test_ipmi.py 项目: nextsun/nova
    def test_exec_ipmitool(self):
        pw_file = "/tmp/password_file"

        self.mox.StubOutWithMock(ipmi, "_make_password_file")
        self.mox.StubOutWithMock(utils, "execute")
        self.mox.StubOutWithMock(bm_utils, "unlink_without_raise")
        ipmi._make_password_file(self.ipmi.password).AndReturn(pw_file)
        args = [
            "ipmitool",
            "-I",
            "lanplus",
            "-H",
            self.ipmi.address,
            "-U",
            self.ipmi.user,
            "-f",
            pw_file,
            "A",
            "B",
            "C",
        ]
        utils.execute(*args, attempts=3).AndReturn(("", ""))
        bm_utils.unlink_without_raise(pw_file).AndReturn(None)
        self.mox.ReplayAll()

        self.ipmi._exec_ipmitool("A B C")
        self.mox.VerifyAll()
示例#12
0
文件: ipmi.py 项目: AsherBond/nova
 def stop_console(self):
     console_pid = _get_console_pid(self.node_id)
     if console_pid:
         # Allow exitcode 99 (RC_UNAUTHORIZED)
         utils.execute('kill', '-TERM', str(console_pid),
                       run_as_root=True,
                       check_exit_code=[0, 99])
     bm_utils.unlink_without_raise(_get_console_pid_path(self.node_id))
示例#13
0
文件: ipmi.py 项目: blahRus/nova
 def stop_console(self):
     console_pid = _get_console_pid(self.node_id)
     if console_pid:
         # Allow exitcode 99 (RC_UNAUTHORIZED)
         utils.execute('kill', '-TERM', str(console_pid),
                       run_as_root=True,
                       check_exit_code=[0, 99])
     bm_utils.unlink_without_raise(_get_console_pid_path(self.node_id))
示例#14
0
文件: pxe.py 项目: gilmeir/nova
    def activate_bootloader(self, context, node, instance, network_info):
        """Configure PXE boot loader for an instance

        Kernel and ramdisk images are downloaded by cache_tftp_images,
        and stored in /tftpboot/{uuid}/

        This method writes the instances config file, and then creates
        symlinks for each MAC address in the instance.

        By default, the complete layout looks like this:

        /tftpboot/
            ./{uuid}/
                 kernel
                 ramdisk
                 deploy_kernel
                 deploy_ramdisk
                 config
            ./pxelinux.cfg/
                 {mac} -> ../{uuid}/config
        """
        flavor = objects.Flavor.get_by_id(context, instance["instance_type_id"])
        image_info = get_tftp_image_info(instance, flavor)
        (root_mb, swap_mb, ephemeral_mb) = get_partition_sizes(instance)
        pxe_config_file_path = get_pxe_config_file_path(instance)
        image_file_path = get_image_file_path(instance)

        deployment_key = bm_utils.random_alnum(32)
        deployment_iscsi_iqn = "iqn-%s" % instance["uuid"]
        db.bm_node_update(
            context,
            node["id"],
            {
                "deploy_key": deployment_key,
                "image_path": image_file_path,
                "pxe_config_path": pxe_config_file_path,
                "root_mb": root_mb,
                "swap_mb": swap_mb,
                "ephemeral_mb": ephemeral_mb,
            },
        )
        pxe_config = build_pxe_config(
            node["id"],
            deployment_key,
            deployment_iscsi_iqn,
            image_info["deploy_kernel"][1],
            image_info["deploy_ramdisk"][1],
            image_info["kernel"][1],
            image_info["ramdisk"][1],
            network_info,
        )
        bm_utils.write_to_file(pxe_config_file_path, pxe_config)

        macs = self._collect_mac_addresses(context, node)
        for mac in macs:
            mac_path = get_pxe_mac_path(mac)
            bm_utils.unlink_without_raise(mac_path)
            bm_utils.create_link_without_raise(pxe_config_file_path, mac_path)
示例#15
0
    def test_activate_and_deactivate_bootloader(self):
        self._create_node()
        instance_type = {
            'extra_specs': {
                'baremetal:deploy_kernel_id': 'eeee',
                'baremetal:deploy_ramdisk_id': 'ffff',
            }
        }
        self.instance['uuid'] = 'fake-uuid'

        self.mox.StubOutWithMock(self.driver.virtapi, 'instance_type_get')
        self.mox.StubOutWithMock(bm_utils, 'write_to_file')
        self.mox.StubOutWithMock(bm_utils, 'create_link_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'rmtree_without_raise')

        self.driver.virtapi.instance_type_get(
            self.context,
            self.instance['instance_type_id']).AndReturn(instance_type)

        # create the config file
        bm_utils.write_to_file(mox.StrContains('fake-uuid'),
                               mox.StrContains(CONF.baremetal.tftp_root))
        # unlink and link the 2 interfaces
        for i in range(2):
            bm_utils.unlink_without_raise(
                mox.Or(mox.StrContains('fake-uuid'),
                       mox.StrContains(CONF.baremetal.tftp_root)))
            bm_utils.create_link_without_raise(
                mox.StrContains('fake-uuid'),
                mox.StrContains(CONF.baremetal.tftp_root))
        # unlink all 2 interfaces, 4 images, and the config file
        for i in range(7):
            bm_utils.unlink_without_raise(
                mox.Or(mox.StrContains('fake-uuid'),
                       mox.StrContains(CONF.baremetal.tftp_root)))
        bm_utils.rmtree_without_raise(mox.StrContains('fake-uuid'))

        self.mox.ReplayAll()

        # activate and deactivate the bootloader
        # and check the deployment task_state in the database
        row = db.bm_node_get(self.context, 1)
        self.assertIsNone(row['deploy_key'])

        self.driver.activate_bootloader(self.context,
                                        self.node,
                                        self.instance,
                                        network_info=self.test_network_info)
        row = db.bm_node_get(self.context, 1)
        self.assertIsNotNone(row['deploy_key'])

        self.driver.deactivate_bootloader(self.context, self.node,
                                          self.instance)
        row = db.bm_node_get(self.context, 1)
        self.assertIsNone(row['deploy_key'])

        self.mox.VerifyAll()
示例#16
0
    def test_activate_and_deactivate_bootloader(self):
        self._create_node()
        flavor = {
            'extra_specs': {
                'baremetal:deploy_kernel_id': 'eeee',
                'baremetal:deploy_ramdisk_id': 'ffff',
                }
            }
        self.instance['uuid'] = 'fake-uuid'

        self.mox.StubOutWithMock(self.driver.virtapi, 'flavor_get')
        self.mox.StubOutWithMock(bm_utils, 'write_to_file')
        self.mox.StubOutWithMock(bm_utils, 'create_link_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'rmtree_without_raise')

        self.driver.virtapi.flavor_get(
            self.context, self.instance['instance_type_id']).AndReturn(
                flavor)

        # create the config file
        bm_utils.write_to_file(mox.StrContains('fake-uuid'),
                               mox.StrContains(CONF.baremetal.tftp_root))
        # unlink and link the 2 interfaces
        for i in range(2):
            bm_utils.unlink_without_raise(mox.Or(
                    mox.StrContains('fake-uuid'),
                    mox.StrContains(CONF.baremetal.tftp_root)))
            bm_utils.create_link_without_raise(
                    mox.StrContains('fake-uuid'),
                    mox.StrContains(CONF.baremetal.tftp_root))
        # unlink all 2 interfaces, 4 images, and the config file
        for i in range(7):
            bm_utils.unlink_without_raise(mox.Or(
                    mox.StrContains('fake-uuid'),
                    mox.StrContains(CONF.baremetal.tftp_root)))
        bm_utils.rmtree_without_raise(mox.StrContains('fake-uuid'))

        self.mox.ReplayAll()

        # activate and deactivate the bootloader
        # and check the deployment task_state in the database
        row = db.bm_node_get(self.context, 1)
        self.assertIsNone(row['deploy_key'])

        self.driver.activate_bootloader(self.context, self.node, self.instance,
                                        network_info=self.test_network_info)
        row = db.bm_node_get(self.context, 1)
        self.assertIsNotNone(row['deploy_key'])

        self.driver.deactivate_bootloader(self.context, self.node,
                                            self.instance)
        row = db.bm_node_get(self.context, 1)
        self.assertIsNone(row['deploy_key'])

        self.mox.VerifyAll()
示例#17
0
文件: pxe.py 项目: bopopescu/nova-26
    def activate_bootloader(self, context, node, instance, network_info):
        """Configure PXE boot loader for an instance

        Kernel and ramdisk images are downloaded by cache_tftp_images,
        and stored in /tftpboot/{uuid}/

        This method writes the instances config file, and then creates
        symlinks for each MAC address in the instance.

        By default, the complete layout looks like this:

        /tftpboot/
            ./{uuid}/
                 kernel
                 ramdisk
                 deploy_kernel
                 deploy_ramdisk
                 config
            ./pxelinux.cfg/
                 {mac} -> ../{uuid}/config
        """
        flavor = flavor_obj.Flavor.get_by_id(context,
                                             instance['instance_type_id'])
        image_info = get_tftp_image_info(instance, flavor)
        (root_mb, swap_mb, ephemeral_mb) = get_partition_sizes(instance)
        pxe_config_file_path = get_pxe_config_file_path(instance)
        image_file_path = get_image_file_path(instance)

        deployment_key = bm_utils.random_alnum(32)
        deployment_iscsi_iqn = "iqn-%s" % instance['uuid']
        db.bm_node_update(
            context, node['id'], {
                'deploy_key': deployment_key,
                'image_path': image_file_path,
                'pxe_config_path': pxe_config_file_path,
                'root_mb': root_mb,
                'swap_mb': swap_mb,
                'ephemeral_mb': ephemeral_mb
            })
        pxe_config = build_pxe_config(
            node['id'],
            deployment_key,
            deployment_iscsi_iqn,
            image_info['deploy_kernel'][1],
            image_info['deploy_ramdisk'][1],
            image_info['kernel'][1],
            image_info['ramdisk'][1],
            network_info,
        )
        bm_utils.write_to_file(pxe_config_file_path, pxe_config)

        macs = self._collect_mac_addresses(context, node)
        for mac in macs:
            mac_path = get_pxe_mac_path(mac)
            bm_utils.unlink_without_raise(mac_path)
            bm_utils.create_link_without_raise(pxe_config_file_path, mac_path)
示例#18
0
文件: pxe.py 项目: 674009287/nova
    def activate_bootloader(self, context, node, instance, network_info):
        """Configure PXE boot loader for an instance

        Kernel and ramdisk images are downloaded by cache_tftp_images,
        and stored in /tftpboot/{uuid}/

        This method writes the instances config file, and then creates
        symlinks for each MAC address in the instance.

        By default, the complete layout looks like this:

        /tftpboot/
            ./{uuid}/
                 kernel
                 ramdisk
                 deploy_kernel
                 deploy_ramdisk
                 config
            ./pxelinux.cfg/
                 {mac} -> ../{uuid}/config
        """
        instance_type = self.virtapi.flavor_get(
            context, instance['instance_type_id'])
        image_info = get_tftp_image_info(instance, instance_type)
        (root_mb, swap_mb, ephemeral_mb) = get_partition_sizes(instance)
        pxe_config_file_path = get_pxe_config_file_path(instance)
        image_file_path = get_image_file_path(instance)

        deployment_key = bm_utils.random_alnum(32)
        deployment_iscsi_iqn = "iqn-%s" % instance['uuid']
        db.bm_node_update(context, node['id'],
                {'deploy_key': deployment_key,
                 'image_path': image_file_path,
                 'pxe_config_path': pxe_config_file_path,
                 'root_mb': root_mb,
                 'swap_mb': swap_mb,
                 'ephemeral_mb': ephemeral_mb})
        pxe_config = build_pxe_config(
                    node['id'],
                    deployment_key,
                    deployment_iscsi_iqn,
                    image_info['deploy_kernel'][1],
                    image_info['deploy_ramdisk'][1],
                    image_info['kernel'][1],
                    image_info['ramdisk'][1],
                    network_info,
                )
        bm_utils.write_to_file(pxe_config_file_path, pxe_config)

        macs = self._collect_mac_addresses(context, node)
        for mac in macs:
            mac_path = get_pxe_mac_path(mac)
            bm_utils.unlink_without_raise(mac_path)
            bm_utils.create_link_without_raise(pxe_config_file_path, mac_path)
示例#19
0
    def test_destroy_images(self):
        self._create_node()
        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'rmtree_without_raise')

        bm_utils.unlink_without_raise(pxe.get_image_file_path(self.instance))
        bm_utils.rmtree_without_raise(pxe.get_image_dir_path(self.instance))
        self.mox.ReplayAll()

        self.driver.destroy_images(self.context, self.node, self.instance)
        self.mox.VerifyAll()
示例#20
0
    def test_destroy_images(self):
        self._create_node()
        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'rmtree_without_raise')

        bm_utils.unlink_without_raise(pxe.get_image_file_path(self.instance))
        bm_utils.rmtree_without_raise(pxe.get_image_dir_path(self.instance))
        self.mox.ReplayAll()

        self.driver.destroy_images(self.context, self.node, self.instance)
        self.mox.VerifyAll()
示例#21
0
文件: pxe.py 项目: ameade/nova
    def activate_bootloader(self, context, node, instance):
        """Configure PXE boot loader for an instance

        Kernel and ramdisk images are downloaded by cache_tftp_images,
        and stored in /tftpboot/{uuid}/

        This method writes the instances config file, and then creates
        symlinks for each MAC address in the instance.

        By default, the complete layout looks like this:

        /tftpboot/
            ./{uuid}/
                 kernel
                 ramdisk
                 deploy_kernel
                 deploy_ramdisk
                 config
            ./pxelinux.cfg/
                 {mac} -> ../{uuid}/config

        """
        image_info = get_tftp_image_info(instance)
        (root_mb, swap_mb) = get_partition_sizes(instance)
        pxe_config_file_path = get_pxe_config_file_path(instance)
        image_file_path = get_image_file_path(instance)

        deployment_key = bm_utils.random_alnum(32)
        deployment_iscsi_iqn = "iqn-%s" % instance['uuid']
        deployment_id = db.bm_deployment_create(
                            context,
                            deployment_key,
                            image_file_path,
                            pxe_config_file_path,
                            root_mb,
                            swap_mb
                        )
        pxe_config = build_pxe_config(
                    deployment_id,
                    deployment_key,
                    deployment_iscsi_iqn,
                    image_info['deploy_kernel'][1],
                    image_info['deploy_ramdisk'][1],
                    image_info['kernel'][1],
                    image_info['ramdisk'][1],
                )
        bm_utils.write_to_file(pxe_config_file_path, pxe_config)

        macs = self._collect_mac_addresses(context, node)
        for mac in macs:
            mac_path = get_pxe_mac_path(mac)
            bm_utils.unlink_without_raise(mac_path)
            bm_utils.create_link_without_raise(pxe_config_file_path, mac_path)
示例#22
0
    def test_console_pid_nan(self):
        fd, path = tempfile.mkstemp()
        with os.fdopen(fd, 'w') as f:
            f.write("hello world\n")

        self.mox.StubOutWithMock(ipmi, '_get_console_pid_path')
        ipmi._get_console_pid_path(self.ipmi.node_id).AndReturn(path)
        self.mox.ReplayAll()

        pid = ipmi._get_console_pid(self.ipmi.node_id)
        bm_utils.unlink_without_raise(path)
        self.mox.VerifyAll()
        self.assertTrue(pid is None)
示例#23
0
    def test_console_pid_nan(self):
        fd, path = tempfile.mkstemp()
        with os.fdopen(fd, 'w') as f:
            f.write("hello world\n")

        self.mox.StubOutWithMock(ipmi, '_get_console_pid_path')
        ipmi._get_console_pid_path(self.ipmi.node_id).AndReturn(path)
        self.mox.ReplayAll()

        pid = ipmi._get_console_pid(self.ipmi.node_id)
        bm_utils.unlink_without_raise(path)
        self.mox.VerifyAll()
        self.assertTrue(pid is None)
示例#24
0
文件: test_ipmi.py 项目: nextsun/nova
    def test_console_pid(self):
        fd, path = tempfile.mkstemp()
        with os.fdopen(fd, "w") as f:
            f.write("12345\n")

        self.mox.StubOutWithMock(ipmi, "_get_console_pid_path")
        ipmi._get_console_pid_path(self.ipmi.node_id).AndReturn(path)
        self.mox.ReplayAll()

        pid = ipmi._get_console_pid(self.ipmi.node_id)
        bm_utils.unlink_without_raise(path)
        self.mox.VerifyAll()
        self.assertEqual(pid, 12345)
示例#25
0
文件: test_pxe.py 项目: emagana/nova
    def test_activate_and_deactivate_bootloader(self):
        self._create_node()
        extra_specs = {
                'deploy_kernel_id': 'eeee',
                'deploy_ramdisk_id': 'ffff',
            }
        self.instance['extra_specs'] = extra_specs
        self.instance['uuid'] = 'fake-uuid'

        self.mox.StubOutWithMock(bm_utils, 'write_to_file')
        self.mox.StubOutWithMock(bm_utils, 'create_link_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'rmtree_without_raise')

        # create the config file
        bm_utils.write_to_file(mox.StrContains('fake-uuid'),
                               mox.StrContains(CONF.baremetal.tftp_root))
        # unlink and link the 3 interfaces
        for i in range(3):
            bm_utils.unlink_without_raise(mox.Or(
                    mox.StrContains('fake-uuid'),
                    mox.StrContains(CONF.baremetal.tftp_root)))
            bm_utils.create_link_without_raise(
                    mox.StrContains('fake-uuid'),
                    mox.StrContains(CONF.baremetal.tftp_root))
        # unlink all 3 interfaces, 4 images, and the config file
        for i in range(8):
            bm_utils.unlink_without_raise(mox.Or(
                    mox.StrContains('fake-uuid'),
                    mox.StrContains(CONF.baremetal.tftp_root)))
        bm_utils.rmtree_without_raise(mox.StrContains('fake-uuid'))

        self.mox.ReplayAll()

        # activate and deactivate the bootloader
        # and check the deployment task_state in the database
        row = db.bm_node_get(self.context, 1)
        self.assertTrue(row['deploy_key'] is None)

        self.driver.activate_bootloader(self.context, self.node,
                                            self.instance)
        row = db.bm_node_get(self.context, 1)
        self.assertTrue(row['deploy_key'] is not None)

        self.driver.deactivate_bootloader(self.context, self.node,
                                            self.instance)
        row = db.bm_node_get(self.context, 1)
        self.assertTrue(row['deploy_key'] is None)

        self.mox.VerifyAll()
示例#26
0
文件: test_pxe.py 项目: ameade/nova
    def test_deactivate_bootloader(self):
        self._create_node()
        macs = [nic['address'] for nic in self.nic_info]
        macs.append(self.node_info['prov_mac_address'])
        macs.sort()
        image_info = {
            'deploy_kernel': [None, 'aaaa'],
            'deploy_ramdisk': [None, 'bbbb'],
            'kernel': [None, 'cccc'],
            'ramdisk': [None, 'dddd'],
        }
        self.instance['uuid'] = 'fake-uuid'
        pxe_path = pxe.get_pxe_config_file_path(self.instance)

        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(pxe, 'get_tftp_image_info')
        self.mox.StubOutWithMock(self.driver, '_collect_mac_addresses')

        pxe.get_tftp_image_info(self.instance).AndReturn(image_info)
        for uuid, path in [image_info[label] for label in image_info]:
            bm_utils.unlink_without_raise(path)
        bm_utils.unlink_without_raise(pxe_path)
        self.driver._collect_mac_addresses(self.context, self.node).\
                AndReturn(macs)
        for mac in macs:
            bm_utils.unlink_without_raise(pxe.get_pxe_mac_path(mac))
        bm_utils.unlink_without_raise(
            os.path.join(CONF.baremetal.tftp_root, 'fake-uuid'))
        self.mox.ReplayAll()

        self.driver.deactivate_bootloader(self.context, self.node,
                                          self.instance)
        self.mox.VerifyAll()
示例#27
0
 def _exec_ipmitool(self, command):
     args = [
         'ipmitool', '-I', 'lanplus', '-H', self.address, '-U', self.user,
         '-f'
     ]
     pwfile = _make_password_file(self.password)
     try:
         args.append(pwfile)
         args.extend(command.split(" "))
         out, err = utils.execute(*args, attempts=3)
         LOG.debug(_("ipmitool stdout: '%(out)s', stderr: '%(err)s'"),
                   locals())
         return out, err
     finally:
         bm_utils.unlink_without_raise(pwfile)
示例#28
0
文件: pxe.py 项目: ameade/nova
    def activate_bootloader(self, context, node, instance):
        """Configure PXE boot loader for an instance

        Kernel and ramdisk images are downloaded by cache_tftp_images,
        and stored in /tftpboot/{uuid}/

        This method writes the instances config file, and then creates
        symlinks for each MAC address in the instance.

        By default, the complete layout looks like this:

        /tftpboot/
            ./{uuid}/
                 kernel
                 ramdisk
                 deploy_kernel
                 deploy_ramdisk
                 config
            ./pxelinux.cfg/
                 {mac} -> ../{uuid}/config

        """
        image_info = get_tftp_image_info(instance)
        (root_mb, swap_mb) = get_partition_sizes(instance)
        pxe_config_file_path = get_pxe_config_file_path(instance)
        image_file_path = get_image_file_path(instance)

        deployment_key = bm_utils.random_alnum(32)
        deployment_iscsi_iqn = "iqn-%s" % instance["uuid"]
        deployment_id = db.bm_deployment_create(
            context, deployment_key, image_file_path, pxe_config_file_path, root_mb, swap_mb
        )
        pxe_config = build_pxe_config(
            deployment_id,
            deployment_key,
            deployment_iscsi_iqn,
            image_info["deploy_kernel"][1],
            image_info["deploy_ramdisk"][1],
            image_info["kernel"][1],
            image_info["ramdisk"][1],
        )
        bm_utils.write_to_file(pxe_config_file_path, pxe_config)

        macs = self._collect_mac_addresses(context, node)
        for mac in macs:
            mac_path = get_pxe_mac_path(mac)
            bm_utils.unlink_without_raise(mac_path)
            bm_utils.create_link_without_raise(pxe_config_file_path, mac_path)
示例#29
0
文件: test_pxe.py 项目: gilmeir/nova
    def test_activate_and_deactivate_bootloader(self):
        self._create_node()
        flavor = objects.Flavor(
            context=self.context,
            extra_specs={"baremetal:deploy_kernel_id": "eeee", "baremetal:deploy_ramdisk_id": "ffff"},
        )
        self.instance["uuid"] = "fake-uuid"

        self.mox.StubOutWithMock(objects.Flavor, "get_by_id")
        self.mox.StubOutWithMock(bm_utils, "write_to_file")
        self.mox.StubOutWithMock(bm_utils, "create_link_without_raise")
        self.mox.StubOutWithMock(bm_utils, "unlink_without_raise")
        self.mox.StubOutWithMock(bm_utils, "rmtree_without_raise")

        objects.Flavor.get_by_id(self.context, self.instance["instance_type_id"]).AndReturn(flavor)

        # create the config file
        bm_utils.write_to_file(mox.StrContains("fake-uuid"), mox.StrContains(CONF.baremetal.tftp_root))
        # unlink and link the 2 interfaces
        for i in range(2):
            bm_utils.unlink_without_raise(
                mox.Or(mox.StrContains("fake-uuid"), mox.StrContains(CONF.baremetal.tftp_root))
            )
            bm_utils.create_link_without_raise(mox.StrContains("fake-uuid"), mox.StrContains(CONF.baremetal.tftp_root))
        # unlink all 2 interfaces, 4 images, and the config file
        for i in range(7):
            bm_utils.unlink_without_raise(
                mox.Or(mox.StrContains("fake-uuid"), mox.StrContains(CONF.baremetal.tftp_root))
            )
        bm_utils.rmtree_without_raise(mox.StrContains("fake-uuid"))

        self.mox.ReplayAll()

        # activate and deactivate the bootloader
        # and check the deployment task_state in the database
        row = db.bm_node_get(self.context, 1)
        self.assertIsNone(row["deploy_key"])

        self.driver.activate_bootloader(self.context, self.node, self.instance, network_info=self.test_network_info)
        row = db.bm_node_get(self.context, 1)
        self.assertIsNotNone(row["deploy_key"])

        self.driver.deactivate_bootloader(self.context, self.node, self.instance)
        row = db.bm_node_get(self.context, 1)
        self.assertIsNone(row["deploy_key"])

        self.mox.VerifyAll()
示例#30
0
    def test_activate_and_deactivate_bootloader(self):
        self._create_node()
        instance_type = {"extra_specs": {"baremetal:deploy_kernel_id": "eeee", "baremetal:deploy_ramdisk_id": "ffff"}}
        self.instance["uuid"] = "fake-uuid"

        self.mox.StubOutWithMock(self.driver.virtapi, "instance_type_get")
        self.mox.StubOutWithMock(bm_utils, "write_to_file")
        self.mox.StubOutWithMock(bm_utils, "create_link_without_raise")
        self.mox.StubOutWithMock(bm_utils, "unlink_without_raise")
        self.mox.StubOutWithMock(bm_utils, "rmtree_without_raise")

        self.driver.virtapi.instance_type_get(self.context, self.instance["instance_type_id"]).AndReturn(instance_type)

        # create the config file
        bm_utils.write_to_file(mox.StrContains("fake-uuid"), mox.StrContains(CONF.baremetal.tftp_root))
        # unlink and link the 3 interfaces
        for i in range(3):
            bm_utils.unlink_without_raise(
                mox.Or(mox.StrContains("fake-uuid"), mox.StrContains(CONF.baremetal.tftp_root))
            )
            bm_utils.create_link_without_raise(mox.StrContains("fake-uuid"), mox.StrContains(CONF.baremetal.tftp_root))
        # unlink all 3 interfaces, 4 images, and the config file
        for i in range(8):
            bm_utils.unlink_without_raise(
                mox.Or(mox.StrContains("fake-uuid"), mox.StrContains(CONF.baremetal.tftp_root))
            )
        bm_utils.rmtree_without_raise(mox.StrContains("fake-uuid"))

        self.mox.ReplayAll()

        # activate and deactivate the bootloader
        # and check the deployment task_state in the database
        row = db.bm_node_get(self.context, 1)
        self.assertTrue(row["deploy_key"] is None)

        self.driver.activate_bootloader(self.context, self.node, self.instance)
        row = db.bm_node_get(self.context, 1)
        self.assertTrue(row["deploy_key"] is not None)

        self.driver.deactivate_bootloader(self.context, self.node, self.instance)
        row = db.bm_node_get(self.context, 1)
        self.assertTrue(row["deploy_key"] is None)

        self.mox.VerifyAll()
示例#31
0
文件: test_pxe.py 项目: NetApp/nova
    def test_deactivate_bootloader_for_nonexistent_instance(self):
        self._create_node()
        self.instance["uuid"] = "fake-uuid"
        pxe_path = pxe.get_pxe_config_file_path(self.instance)

        self.mox.StubOutWithMock(bm_utils, "unlink_without_raise")
        self.mox.StubOutWithMock(bm_utils, "rmtree_without_raise")
        self.mox.StubOutWithMock(pxe, "get_tftp_image_info")
        self.mox.StubOutWithMock(self.driver, "_collect_mac_addresses")

        extra_specs = dict(extra_specs=dict(deploy_ramdisk_id="ignore", deploy_kernel_id="ignore"))
        pxe.get_tftp_image_info(self.instance, extra_specs).AndRaise(exception.NovaException)
        bm_utils.unlink_without_raise(pxe_path)
        self.driver._collect_mac_addresses(self.context, self.node).AndRaise(db_exc.DBError)
        bm_utils.rmtree_without_raise(os.path.join(CONF.baremetal.tftp_root, "fake-uuid"))
        self.mox.ReplayAll()

        self.driver.deactivate_bootloader(self.context, self.node, self.instance)
        self.mox.VerifyAll()
示例#32
0
文件: ipmi.py 项目: AsherBond/nova
 def _exec_ipmitool(self, command):
     args = ['ipmitool',
             '-I',
             'lanplus',
             '-H',
             self.address,
             '-U',
             self.user,
             '-f']
     pwfile = _make_password_file(self.password)
     try:
         args.append(pwfile)
         args.extend(command.split(" "))
         out, err = utils.execute(*args, attempts=3)
         LOG.debug("ipmitool stdout: '%(out)s', stderr: '%(err)s'",
                   {'out': out, 'err': err})
         return out, err
     finally:
         bm_utils.unlink_without_raise(pwfile)
示例#33
0
    def test_exec_ipmitool(self):
        pw_file = '/tmp/password_file'

        self.mox.StubOutWithMock(ipmi, '_make_password_file')
        self.mox.StubOutWithMock(utils, 'execute')
        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        ipmi._make_password_file(self.ipmi.password).AndReturn(pw_file)
        args = [
                'ipmitool',
                '-I', 'lanplus',
                '-H', self.ipmi.address,
                '-U', self.ipmi.user,
                '-f', pw_file,
                'A', 'B', 'C',
                ]
        utils.execute(*args, attempts=3).AndReturn(('', ''))
        bm_utils.unlink_without_raise(pw_file).AndReturn(None)
        self.mox.ReplayAll()

        self.ipmi._exec_ipmitool('A B C')
        self.mox.VerifyAll()
示例#34
0
文件: pxe.py 项目: StackOps/nova
    def deactivate_bootloader(self, context, node, instance):
        """Delete PXE bootloader images and config."""
        try:
            db.bm_node_update(context, node['id'],
                    {'deploy_key': None,
                     'image_path': None,
                     'pxe_config_path': None,
                     'root_mb': 0,
                     'swap_mb': 0})
        except exception.NodeNotFound:
            pass

        try:
            image_info = get_tftp_image_info(instance)
        except exception.NovaException:
            pass
        else:
            for label in image_info.keys():
                (uuid, path) = image_info[label]
                bm_utils.unlink_without_raise(path)

        bm_utils.unlink_without_raise(get_pxe_config_file_path(instance))
        try:
            macs = self._collect_mac_addresses(context, node)
        except db_session.DBError:
            pass
        else:
            for mac in macs:
                bm_utils.unlink_without_raise(get_pxe_mac_path(mac))

        bm_utils.rmtree_without_raise(
                os.path.join(CONF.baremetal.tftp_root, instance['uuid']))
示例#35
0
文件: pxe.py 项目: gilmeir/nova
    def deactivate_bootloader(self, context, node, instance):
        """Delete PXE bootloader images and config."""
        try:
            db.bm_node_update(
                context,
                node["id"],
                {"deploy_key": None, "image_path": None, "pxe_config_path": None, "root_mb": 0, "swap_mb": 0},
            )
        except exception.NodeNotFound:
            pass

        # NOTE(danms): the flavor extra_specs do not need to be
        # present/correct at deactivate time, so pass something empty
        # to avoid an extra lookup
        flavor = dict(extra_specs={"baremetal:deploy_ramdisk_id": "ignore", "baremetal:deploy_kernel_id": "ignore"})
        try:
            image_info = get_tftp_image_info(instance, flavor)
        except exception.NovaException:
            pass
        else:
            for label in image_info.keys():
                (uuid, path) = image_info[label]
                bm_utils.unlink_without_raise(path)

        bm_utils.unlink_without_raise(get_pxe_config_file_path(instance))
        try:
            macs = self._collect_mac_addresses(context, node)
        except db_exc.DBError:
            pass
        else:
            for mac in macs:
                bm_utils.unlink_without_raise(get_pxe_mac_path(mac))

        bm_utils.rmtree_without_raise(os.path.join(CONF.baremetal.tftp_root, instance["uuid"]))
示例#36
0
    def test_deactivate_bootloader(self):
        self._create_node()
        macs = [nic['address'] for nic in self.nic_info]
        macs.append(self.node_info['prov_mac_address'])
        macs.sort()
        image_info = {
                'deploy_kernel': [None, 'aaaa'],
                'deploy_ramdisk': [None, 'bbbb'],
                'kernel': [None, 'cccc'],
                'ramdisk': [None, 'dddd'],
            }
        self.instance['uuid'] = 'fake-uuid'
        pxe_path = pxe.get_pxe_config_file_path(self.instance)

        self.mox.StubOutWithMock(bm_utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(bm_utils, 'rmtree_without_raise')
        self.mox.StubOutWithMock(pxe, 'get_tftp_image_info')
        self.mox.StubOutWithMock(self.driver, '_collect_mac_addresses')

        pxe.get_tftp_image_info(self.instance).AndReturn(image_info)
        for uuid, path in [image_info[label] for label in image_info]:
            bm_utils.unlink_without_raise(path)
        bm_utils.unlink_without_raise(pxe_path)
        self.driver._collect_mac_addresses(self.context, self.node).\
                AndReturn(macs)
        for mac in macs:
            bm_utils.unlink_without_raise(pxe.get_pxe_mac_path(mac))
        bm_utils.rmtree_without_raise(
                os.path.join(CONF.baremetal.tftp_root, 'fake-uuid'))
        self.mox.ReplayAll()

        self.driver.deactivate_bootloader(
            self.context, self.node, self.instance)
        self.mox.VerifyAll()
示例#37
0
文件: tilera.py 项目: B-Rich/nova-1
    def deactivate_bootloader(self, context, node, instance):
        """Delete Tilera bootloader images and config."""
        try:
            db.bm_node_update(
                context, node['id'], {
                    'deploy_key': None,
                    'image_path': None,
                    'pxe_config_path': None,
                    'root_mb': 0,
                    'swap_mb': 0
                })
        except exception.NodeNotFound:
            pass

        tilera_nfs_path = get_tilera_nfs_path(node['id'])

        if os.path.ismount(tilera_nfs_path):
            utils.execute('rpc.mountd', run_as_root=True)
            utils.execute('umount', '-f', tilera_nfs_path, run_as_root=True)

        try:
            image_info = get_tftp_image_info(instance)
        except exception.NovaException:
            pass
        else:
            for label in image_info.keys():
                (uuid, path) = image_info[label]
                bm_utils.unlink_without_raise(path)

        try:
            self._collect_mac_addresses(context, node)
        except db_exc.DBError:
            pass

        if os.path.exists(
                os.path.join(CONF.baremetal.tftp_root, instance['uuid'])):
            bm_utils.rmtree_without_raise(
                os.path.join(CONF.baremetal.tftp_root, instance['uuid']))
示例#38
0
    def start_console(self):
        if not self.port:
            return
        args = []
        args.append(CONF.baremetal.terminal)
        if CONF.baremetal.terminal_cert_dir:
            args.append("-c")
            args.append(CONF.baremetal.terminal_cert_dir)
        else:
            args.append("-t")
        args.append("-p")
        args.append(str(self.port))
        args.append("--background=%s" % _get_console_pid_path(self.node_id))
        args.append("-s")

        try:
            pwfile = _make_password_file(self.password)
            ipmi_args = "/:%(uid)s:%(gid)s:HOME:ipmitool -H %(address)s" \
                    " -I lanplus -U %(user)s -f %(pwfile)s sol activate" \
                    % {'uid': os.getuid(),
                       'gid': os.getgid(),
                       'address': self.address,
                       'user': self.user,
                       'pwfile': pwfile,
                       }

            args.append(ipmi_args)
            # Run shellinaboxd without pipes. Otherwise utils.execute() waits
            # infinitely since shellinaboxd does not close passed fds.
            x = ["'" + arg.replace("'", "'\\''") + "'" for arg in args]
            x.append('</dev/null')
            x.append('>/dev/null')
            x.append('2>&1')
            utils.execute(' '.join(x), shell=True)
        finally:
            bm_utils.unlink_without_raise(pwfile)
示例#39
0
文件: ipmi.py 项目: AsherBond/nova
    def start_console(self):
        if not self.port:
            return
        args = []
        args.append(CONF.baremetal.terminal)
        if CONF.baremetal.terminal_cert_dir:
            args.append("-c")
            args.append(CONF.baremetal.terminal_cert_dir)
        else:
            args.append("-t")
        args.append("-p")
        args.append(str(self.port))
        args.append("--background=%s" % _get_console_pid_path(self.node_id))
        args.append("-s")

        try:
            pwfile = _make_password_file(self.password)
            ipmi_args = "/:%(uid)s:%(gid)s:HOME:ipmitool -H %(address)s" \
                    " -I lanplus -U %(user)s -f %(pwfile)s sol activate" \
                    % {'uid': os.getuid(),
                       'gid': os.getgid(),
                       'address': self.address,
                       'user': self.user,
                       'pwfile': pwfile,
                       }

            args.append(ipmi_args)
            # Run shellinaboxd without pipes. Otherwise utils.execute() waits
            # infinitely since shellinaboxd does not close passed fds.
            x = ["'" + arg.replace("'", "'\\''") + "'" for arg in args]
            x.append('</dev/null')
            x.append('>/dev/null')
            x.append('2>&1')
            utils.execute(' '.join(x), shell=True)
        finally:
            bm_utils.unlink_without_raise(pwfile)
示例#40
0
文件: pxe.py 项目: ameade/nova
    def deactivate_bootloader(self, context, node, instance):
        """Delete PXE bootloader images and config"""
        try:
            image_info = get_tftp_image_info(instance)
        except exception.NovaException:
            pass
        else:
            for label in image_info.keys():
                (uuid, path) = image_info[label]
                bm_utils.unlink_without_raise(path)

        bm_utils.unlink_without_raise(get_pxe_config_file_path(instance))
        try:
            macs = self._collect_mac_addresses(context, node)
        except exception.DBError:
            pass
        else:
            for mac in macs:
                bm_utils.unlink_without_raise(get_pxe_mac_path(mac))

        bm_utils.unlink_without_raise(os.path.join(CONF.baremetal.tftp_root, instance["uuid"]))
示例#41
0
文件: pxe.py 项目: ameade/nova
    def deactivate_bootloader(self, context, node, instance):
        """Delete PXE bootloader images and config"""
        try:
            image_info = get_tftp_image_info(instance)
        except exception.NovaException:
            pass
        else:
            for label in image_info.keys():
                (uuid, path) = image_info[label]
                bm_utils.unlink_without_raise(path)

        bm_utils.unlink_without_raise(get_pxe_config_file_path(instance))
        try:
            macs = self._collect_mac_addresses(context, node)
        except exception.DBError:
            pass
        else:
            for mac in macs:
                bm_utils.unlink_without_raise(get_pxe_mac_path(mac))

        bm_utils.unlink_without_raise(
                os.path.join(CONF.baremetal.tftp_root, instance['uuid']))
示例#42
0
文件: pxe.py 项目: scottchoi/nova
    def deactivate_bootloader(self, context, node, instance):
        """Delete PXE bootloader images and config."""
        try:
            db.bm_node_update(
                context, node['id'], {
                    'deploy_key': None,
                    'image_path': None,
                    'pxe_config_path': None,
                    'root_mb': 0,
                    'swap_mb': 0
                })
        except exception.NodeNotFound:
            pass

        # NOTE(danms): the instance_type extra_specs do not need to be
        # present/correct at deactivate time, so pass something empty
        # to avoid an extra lookup
        instance_type = dict(
            extra_specs={
                'baremetal:deploy_ramdisk_id': 'ignore',
                'baremetal:deploy_kernel_id': 'ignore'
            })
        try:
            image_info = get_tftp_image_info(instance, instance_type)
        except exception.NovaException:
            pass
        else:
            for label in image_info.keys():
                (uuid, path) = image_info[label]
                bm_utils.unlink_without_raise(path)

        bm_utils.unlink_without_raise(get_pxe_config_file_path(instance))
        try:
            macs = self._collect_mac_addresses(context, node)
        except db_exc.DBError:
            pass
        else:
            for mac in macs:
                bm_utils.unlink_without_raise(get_pxe_mac_path(mac))

        bm_utils.rmtree_without_raise(
            os.path.join(CONF.baremetal.tftp_root, instance['uuid']))
示例#43
0
文件: tilera.py 项目: CiscoAS/nova
 def destroy_images(self, context, node, instance):
     """Delete instance's image file."""
     bm_utils.unlink_without_raise(get_image_file_path(instance))
     bm_utils.rmtree_without_raise(get_image_dir_path(instance))
示例#44
0
文件: pxe.py 项目: scottchoi/nova
 def destroy_images(self, context, node, instance):
     """Delete instance's image file."""
     bm_utils.unlink_without_raise(get_image_file_path(instance))
     bm_utils.rmtree_without_raise(get_image_dir_path(instance))