[et-mgmt-tools] [PATCH] virtinst adding in disk signature support
Joey Boggs
jboggs at redhat.com
Wed Sep 24 19:15:10 UTC 2008
Just to make sure, if I move that logic for "either sha1/md5 and not
None" into ImageParser right when I pull in the checksum data that would
that be sufficient?
Working on changing the other items
>> + </attribute>
>> + <text/>
>> + </element>
>> + </optional>
>> </element>
>> </oneOrMore>
>> </define>
>> diff -r 58a909b4f71c virt-image
>> --- a/virt-image Mon Sep 22 11:32:11 2008 -0400
>> +++ b/virt-image Wed Sep 24 13:56:34 2008 -0400
>> @@ -97,6 +97,8 @@
>> help=_("Number of vcpus to configure for your guest"))
>> parser.add_option("", "--check-cpu", action="store_true", dest="check_cpu",
>> help=_("Check that vcpus do not exceed physical CPUs and warn if they do."))
>> + parser.add_option("", "--checksum-ignore", action="store_true", dest="checksum_ignore",
>> + help=_("Ignore unmatching checksum values for disk signatures."))
>>
>> # network options
>> parser.add_option("-m", "--mac", type="string",
>> @@ -188,6 +190,10 @@
>> # now let's get some of the common questions out of the way
>> get_name(options.name, image.name, guest)
>> get_memory(options.memory, image.domain.memory, guest)
>> +
>> + if not options.checksum_ignore:
>> + cli.check_disk_signature(image,guest)
>> +
>> cli.get_uuid(options.uuid, guest)
>> get_vcpus(options.vcpus, image.domain.vcpu, options.check_cpu,
>> guest, conn)
>> diff -r 58a909b4f71c virtinst/ImageParser.py
>> --- a/virtinst/ImageParser.py Mon Sep 22 11:32:11 2008 -0400
>> +++ b/virtinst/ImageParser.py Wed Sep 24 13:56:34 2008 -0400
>> @@ -213,7 +213,8 @@
>> self.format = xpathString(node, "@format", Disk.FORMAT_RAW)
>> self.size = xpathString(node, "@size")
>> self.use = xpathString(node, "@use", Disk.USE_SYSTEM)
>> -
>> + self.checksum = xpathString(node, "checksum")
>> + self.checksumtype = xpathString(node, "checksum/@type")
>> formats = [Disk.FORMAT_RAW, Disk.FORMAT_QCOW, Disk.FORMAT_QCOW2, Disk.FORMAT_VMDK, Disk.FORMAT_ISO]
>> validate (formats.count(self.format) > 0,
>> _("The format for disk %s must be one of %s") %
>> diff -r 58a909b4f71c virtinst/cli.py
>> --- a/virtinst/cli.py Mon Sep 22 11:32:11 2008 -0400
>> +++ b/virtinst/cli.py Wed Sep 24 13:56:34 2008 -0400
>> @@ -352,6 +352,27 @@
>> if sound:
>> guest.sound_devs.append(VirtualAudio(model="es1370"))
>>
>> +def check_disk_signature(image,guest):
>> + i = 0
>> + disks = {}
>> + for k in image.storage.keys():
>> + disks[i] = image.storage[k]
>> + if disks[i].checksumtype == "sha1" or disks[i].checksumtype == "md5" and not None:
>>
>
> I'd rather not silently ignore any values that aren't in the
> white list of supported hash types. Probably at the image
> parser level, when we set checksumtype, we can raise an
> exception if the type is not supported.
>
>
More information about the et-mgmt-tools
mailing list