• R/O
  • HTTP
  • SSH
  • HTTPS

image-creator: Commit

KVM host image creator.


Commit MetaInfo

Révisiond871eb2a6136d0068990ce2bcc0817aa012d4746 (tree)
l'heure2019-09-30 13:06:17
AuteurTatsuki Sugiura <sugi@nemu...>
CommiterTatsuki Sugiura

Message de Log

Add container definition JSON writer.

Change Summary

Modification

--- a/create-image
+++ b/create-image
@@ -3,6 +3,7 @@ require 'pp'
33 require 'shellwords'
44 require 'tmpdir'
55 require 'yaml'
6+require 'json'
67
78 class SyncDirDef
89 DEFAULT_EXCLUDE = %w[/proc/* /sys/* /dev/mqueue /dev/hugepages /run/* /var/lib/os-prober/mount /swap /dev/shm/* /var/lib/lxcfs/*]
@@ -164,14 +165,30 @@ class ImageCreator
164165 end
165166 end
166167
168+ def write_json
169+ jdef = []
170+ dirs.each_with_index do |dir, idx|
171+ jdef.push({
172+ "Description" => dir.path == '/' ? 'root' : dir.path[1..-1].tr('/', '-'),
173+ "Format" => "raw",
174+ "UserBucket" => {
175+ "S3Bucket" => "Change-to-your-buket-name",
176+ "S3Key" => "/src-disks/#{img_path_base}_#{idx}.img"
177+ }
178+ })
179+ end
180+ File.write "#{img_path_base}.json", JSON.pretty_generate(jdef)
181+ end
182+
183+
167184 def run
168185 create_disk
169186 create_fs
170187 sync_dirs
171188 fix_boot
189+ write_json
172190 puts "Image creation has been complated (#{name})"
173191 end
174-
175192 end
176193
177194 if $0 == __FILE__
Afficher sur ancien navigateur de dépôt.