def create_ufs_dir(pathname): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """Create a basic directory at the mountpoint specified. Input: pathname Return: 0 if the directory is created TI module error code if the create fails """ status = ti.ti_create_target({ TI_ATTR_TARGET_TYPE: TI_TARGET_TYPE_DC_UFS, TI_ATTR_DC_UFS_DEST: pathname }) if status: dc_log = logging.getLogger(DC_LOGGER_NAME) dc_log.error("Unable to create directory " + pathname) return status
def create_zfs_fs(zfs_dataset): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """Create a zfs dataset with the specified name. The pool must already exist. Input: dataset name Return: 0 if the dataset is created transfer module error code if unable to create the dataset """ zfs_dataset_lst = zfs_dataset.split('/', 1) pool = zfs_dataset_lst[0] pathname = zfs_dataset_lst[1] status = ti.ti_create_target({ TI_ATTR_TARGET_TYPE: TI_TARGET_TYPE_ZFS_FS, TI_ATTR_ZFS_FS_POOL_NAME: pool, TI_ATTR_ZFS_FS_NUM: 1, TI_ATTR_ZFS_FS_NAMES: [pathname] }) if status: dc_log = logging.getLogger(DC_LOGGER_NAME) dc_log.error("Unable to create the zfs dataset %s. " % pathname) dc_log.error("You may want to check that the pool %s exists." % pool) return status
BOOT_ARCHIVE_SIZE = \ int(round((BOOT_ARCHIVE_SIZE * OVERHEAD) + (PADDING * 1024))) if (BA_BYTES_PER_INODE == 0): BA_BYTES_PER_INODE = get_boot_archive_nbpi(BOOT_ARCHIVE_SIZE * 1024, BA_BUILD) print "Creating boot archive with padded size of %d MB..." % ( (BOOT_ARCHIVE_SIZE / 1024)) # Create the file for the boot archive and mount it signal.signal(signal.SIGINT, create_target_intr_handler) STATUS = ti_create_target({ TI_ATTR_TARGET_TYPE: TI_TARGET_TYPE_DC_RAMDISK, TI_ATTR_DC_RAMDISK_DEST: BA_LOFI_MNT_PT, TI_ATTR_DC_RAMDISK_FS_TYPE: TI_DC_RAMDISK_FS_TYPE_UFS, TI_ATTR_DC_RAMDISK_SIZE: BOOT_ARCHIVE_SIZE, TI_ATTR_DC_RAMDISK_BYTES_PER_INODE: BA_BYTES_PER_INODE, TI_ATTR_DC_RAMDISK_BOOTARCH_NAME: BA_ARCHFILE }) signal.signal(signal.SIGINT, signal.SIG_DFL) if (STATUS != 0): release_archive() raise Exception, ( sys.argv[0] + ": Unable to create boot archive: ti_create_target returned: " + os.strerror(STATUS)) if IS_SPARC: ETC_SYSTEM = open(BA_BUILD + "/etc/system", "a+") ETC_SYSTEM.write("set root_is_ramdisk=1\n") ETC_SYSTEM.write("set ramdisk_size=" + str(BOOT_ARCHIVE_SIZE) + "\n")