openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #13109
Re: File injection support
On 06/12/2012 04:07 PM, Fredric Morenius wrote:
> From: Scott Moser [mailto:ssmoser2@xxxxxxxxx] On Behalf Of Scott Moser
> Sent: den 11 juni 2012 23:16
>
>> ...Without digging around on older versions of OS's and their included kernel/udev/kpartx.... i'd have to say that from your message above, and my testing that running 'kpartx' is no longer necessary. That can reasonably be expected to be created by >the kernel or some other plumbing bits automatically...
>
> I just now tested to remove the kpartx invocation from /nova/virt/disk/mount.py, like this:
>
> diff --git a/nova/virt/disk/mount.py b/nova/virt/disk/mount.py
> index 11959b2..4d9527b 100644
> --- a/nova/virt/disk/mount.py
> +++ b/nova/virt/disk/mount.py
> @@ -61,25 +61,9 @@ class Mount(object):
> if self.partition == -1:
> self.error = _('partition search unsupported with %s') % self.mode
> elif self.partition:
> - map_path = '/dev/mapper/%sp%s' % (os.path.basename(self.device),
> - self.partition)
> - assert(not os.path.exists(map_path))
> -
> - # Note kpartx can output warnings to stderr and succeed
> - # Also it can output failures to stderr and "succeed"
> - # So we just go on the existence of the mapped device
> - _out, err = utils.trycmd('kpartx', '-a', self.device,
> - run_as_root=True, discard_warnings=True)
> -
> - # Note kpartx does nothing when presented with a raw image,
> - # so given we only use it when we expect a partitioned image, fail
> - if not os.path.exists(map_path):
> - if not err:
> - err = _('partition %s not found') % self.partition
> - self.error = _('Failed to map partitions: %s') % err
> - else:
> - self.mapped_device = map_path
> - self.mapped = True
> + #qemu-nbd already has mapped the partition for mounting
> + self.mapped_device = '%sp%s' % (self.device, self.partition)
> + self.mapped = True
Looks good. That should also support raw through the /dev/loop%s devices.
It might be safer to fallback to kpartx if not exists ...
'%sp%s' % (self.device, self.partition)
That would support kernels before 3.2
I'd also add a comment in the code, that nbd must be mounted with param
max_part=16 or whatever.
cheers,
Pádraig.
Follow ups
References
-
File injection support
From: Nicolae Paladi, 2012-05-29
-
Re: File injection support
From: Pádraig Brady, 2012-05-29
-
Re: File injection support
From: Fredric Morenius, 2012-05-30
-
Re: File injection support
From: Pádraig Brady, 2012-05-30
-
Re: File injection support
From: Fredric Morenius, 2012-06-08
-
Re: File injection support
From: Pádraig Brady, 2012-06-08
-
Re: File injection support
From: Scott Moser, 2012-06-08
-
Re: File injection support
From: Pádraig Brady, 2012-06-08
-
Re: File injection support
From: Vishvananda Ishaya, 2012-06-10
-
Re: File injection support
From: Fredric Morenius, 2012-06-11
-
Re: File injection support
From: Scott Moser, 2012-06-11
-
Re: File injection support
From: Fredric Morenius, 2012-06-12