the default os_mount=initramfs, so download osimage to run qemu kvm.
Signed-off-by: Liu Yinsi liuyinsi@163.com --- sbin/download-rootfs | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-)
diff --git a/sbin/download-rootfs b/sbin/download-rootfs index 68a68039..d936dbe6 100755 --- a/sbin/download-rootfs +++ b/sbin/download-rootfs @@ -19,22 +19,35 @@ os_version=${3:-20.03} load_cci_defaults
rootfs_dir=/srv/os/${os}/${os_arch}/${os_version} +osimage_dir=/srv/initrd/osimage/${os}/${os_arch}/${os_version}
-download_os_rootfs() -{ - mkdir -p $rootfs_dir - cd $rootfs_dir +mkdir -p $rootfs_dir $osimage_dir
- download_url="http://api.compass-ci.openeuler.org:$%7BSRV_HTTP_OS_PORT%7D/os/$%7Bos%7D/$%7..." - wget $download_url +download_one() +{ + local download_url=$1 + wget $download_url + + [ "$?" -ne 0 ] && { + log_error "failed to download os rootfs: $download_url" + exit 1 + } +}
- [ "$?" -ne 0 ] && { - log_error "failed to download os rootfs: $download_url" - exit 1 - } +download_os_rootfs() +{ + cd $rootfs_dir + download_one "http://api.compass-ci.openeuler.org:$%7BSRV_HTTP_OS_PORT%7D/os/$%7Bos%7D/$%7..." + + gzip -dc ${os_version}.cgz | cpio -id + rm -rf ${os_version}.cgz +}
- gzip -dc ${os_version}.cgz | cpio -id - rm -rf ${os_version}.cgz +download_osimage() +{ + cd $osimage_dir + download_one "http://api.compass-ci.openeuler.org:$%7BSRV_HTTP_INITRD_PORT%7D/initrd/osima..." + download_one "http://api.compass-ci.openeuler.org:$%7BSRV_HTTP_INITRD_PORT%7D/initrd/deps/..." }
is_virtual() @@ -43,3 +56,4 @@ is_virtual() }
is_virtual || download_os_rootfs +is_virtual || download_osimage