X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=discover%2Fdevice-handler.c;h=82230154ba77d9a314f50d3a41fe184837197d40;hb=e3f78333a2a16760d6a497b84329c103208e921e;hp=4e1b3ca77fc0f447bfd0febfdf66db22c7121ed6;hpb=b9b5fa357e5921eb752e62f7146339007d9f767f;p=petitboot diff --git a/discover/device-handler.c b/discover/device-handler.c index 4e1b3ca..8223015 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -1356,7 +1356,7 @@ static void process_url_cb(struct load_url_result *result, void *data) mac = event_get_param(event, "mac"); char *url = talloc_asprintf(event, "file://%s", result->local); - event_set_param(event, "pxeconffile", url); + event_set_param(event, "pxeconffile-local", url); dev = discover_device_create(handler, mac, event->device); ctx = device_handler_discover_context_create(handler, dev); @@ -1792,6 +1792,20 @@ static int mount_device(struct discover_device *dev) rc = try_mount(device_path, dev->mount_path, fstype, MS_RDONLY | MS_SILENT, dev->ramdisk); + /* If mount fails clean up any snapshot and try again */ + if (rc && dev->ramdisk) { + pb_log("couldn't mount snapshot for %s: mount failed: %s\n", + device_path, strerror(errno)); + pb_log("falling back to actual device\n"); + + devmapper_destroy_snapshot(dev); + + device_path = get_device_path(dev); + pb_log("mounting device %s read-only\n", dev->device_path); + rc = try_mount(device_path, dev->mount_path, fstype, + MS_RDONLY | MS_SILENT, dev->ramdisk); + } + if (!rc) { dev->mounted = true; dev->mounted_rw = false; @@ -1803,9 +1817,6 @@ static int mount_device(struct discover_device *dev) pb_log("couldn't mount device %s: mount failed: %s\n", device_path, strerror(errno)); - /* If mount fails clean up any snapshot */ - devmapper_destroy_snapshot(dev); - pb_rmdir_recursive(mount_base(), dev->mount_path); err_free: talloc_free(dev->mount_path);