-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: Replace all illegal chars in disk aliases #408
Conversation
When importing a VM, aliases are generated for all imported disks. To comply with oVirt naming convention for disk aliases, we need to replace all illegal characters that may appear in imported disk names. Change-Id: I4f54a3fd8e31799d8ca33d2f4413e82f452ebabd Bug-Url: https://bugzilla.redhat.com/1904962 Signed-off-by: Shmuel Melamud <smelamud@redhat.com>
@@ -75,6 +75,7 @@ | |||
|
|||
private static final Pattern VMWARE_DISK_NAME_PATTERN = Pattern.compile("\\[.*?\\] .*/(.*).vmdk"); | |||
private static final Pattern DISK_NAME_PATTERN = Pattern.compile(".*/([^.]+).*"); | |||
private static final Pattern DISK_ALIAS_ILLEGAL_CHARS_PATTERN = Pattern.compile("[^\\w.-]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you allow only word chars? numeric is impossible? can you tell what exactly is illegal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\w
includes latin letters, digits and underscore. Also period (.
) and hyphen (-
) are allowed. These are characters that we allow for disk alias in WebAdmin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\w
includes latin letters, digits and underscore. Also period (.
) and hyphen (-
) are allowed. These are characters that we allow for disk alias in WebAdmin.
OK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\w
includes latin letters, digits and underscore. Also period (.
) and hyphen (-
) are allowed. These are characters that we allow for disk alias in WebAdmin.
so can we reuse the pattern that is used by the webadmin?
@@ -75,6 +75,7 @@ | |||
|
|||
private static final Pattern VMWARE_DISK_NAME_PATTERN = Pattern.compile("\\[.*?\\] .*/(.*).vmdk"); | |||
private static final Pattern DISK_NAME_PATTERN = Pattern.compile(".*/([^.]+).*"); | |||
private static final Pattern DISK_ALIAS_ILLEGAL_CHARS_PATTERN = Pattern.compile("[^\\w.-]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\w
includes latin letters, digits and underscore. Also period (.
) and hyphen (-
) are allowed. These are characters that we allow for disk alias in WebAdmin.
so can we reuse the pattern that is used by the webadmin?
...rc/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmFromExternalProviderCommand.java
Show resolved
Hide resolved
Verified. |
Change-Id: I5e8a6a974b80ab29841f2a9e1158157895f3245e Signed-off-by: Shmuel Melamud <smelamud@redhat.com>
Change-Id: Ib64f9d8228c28b1a4479d0e9ed4d27b06836a4c7 Signed-off-by: Shmuel Melamud <smelamud@redhat.com>
/ost |
When importing a VM, aliases are generated for all imported disks. To
comply with oVirt naming convention for disk aliases, we need to replace
all illegal characters that may appear in imported disk names.
Change-Id: I4f54a3fd8e31799d8ca33d2f4413e82f452ebabd
Bug-Url: https://bugzilla.redhat.com/1904962
Signed-off-by: Shmuel Melamud smelamud@redhat.com