Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: register: Add --persist-uuid ......................................................................
register: Add --persist-uuid
This patch adds --persist-uuid option for cases where the machine duplicates UUID.
Change-Id: I5926b635201662db53956dbac18b9a2981d6e645 Signed-off-by: Douglas Schilling Landgraf dougsland@redhat.com --- M lib/vdsm/tool/register.py 1 file changed, 28 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/44431/1
diff --git a/lib/vdsm/tool/register.py b/lib/vdsm/tool/register.py index df56671..ad5436d 100644 --- a/lib/vdsm/tool/register.py +++ b/lib/vdsm/tool/register.py @@ -40,7 +40,7 @@ fingerprint=None, ssh_port=None, ssh_user=None, check_fqdn=True, vdsm_port=None, node_address=None, - node_name=None): + persist_uuid=None, node_name=None): """ Attributes:
@@ -55,6 +55,8 @@ vdsm_port - VDSM listen port node_address - Specify node address or FQDN node_name - Specify node name + persist_uuid - Persist the UUID provided, useful for machines + that duplicates UUID """ self.logger = self._set_logger() self.logger.debug("=======================================") @@ -109,6 +111,10 @@ else: self.vdsm_port = vdsm_port self.logger.debug("VDSM Port: {sp}".format(sp=self.vdsm_port)) + + self.persist_uuid = persist_uuid + self.logger.debug("Persist uuid: {uuid_provided}".format( + uuid_provided=self.persist_uuid))
self.ca_dir = "/etc/pki/ovirt-engine/" self.ca_engine = "{d}{f}".format(d=self.ca_dir, f="ca.pem") @@ -246,12 +252,24 @@ Determine host UUID and if there is no existing /etc/vdsm/vdsm.id it will genereate UUID and save/persist in /etc/vdsm/vdsm.id """ - self.uuid = getHostUUID(legacy=False) + + if self.persist_uuid: + self.uuid = self.persist_uuid + else: + self.uuid = getHostUUID(legacy=False) + self.url_reg += "&uniqueId={u}".format(u=self.uuid)
self.logger.debug("Registration via: {u}".format(u=self.url_reg))
__VDSM_ID = "/etc/vdsm/vdsm.id" + + if self.persist_uuid and os.path.exists(__VDSM_ID): + if utils.isOvirtNode(): + from ovirt.node.utils.fs import Config + Config().unpersist(__VDSM_ID) + os.unlink(__VDSM_ID) + if not os.path.exists(__VDSM_ID): with open(__VDSM_ID, 'w') as f: f.write(self.uuid) @@ -433,6 +451,12 @@ " If not provided, will be used the default 54321", )
+ parser.add_argument( + '--persist-uuid', + help="Specify the UUID to be used. This option is useful for machines " + "that provides duplicate UUID." + ) + # Using [1:] to remove the 'register' option from arguments # and avoid vdsm-tool recognize it as an unknown option args = parser.parse_args(args=args[1:]) @@ -445,7 +469,8 @@ ssh_user=args.ssh_user, ssh_port=args.ssh_port, fingerprint=args.fingerprint, - check_fqdn=args.check_fqdn) + check_fqdn=args.check_fqdn, + persist_uuid=args.persist_uuid)
try: reg.handshake()
automation@ovirt.org has posted comments on this change.
Change subject: register: Add --persist-uuid ......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Douglas Schilling Landgraf has posted comments on this change.
Change subject: register: Add --persist-uuid ......................................................................
Patch Set 1: Verified+1
Dan Kenigsberg has posted comments on this change.
Change subject: register: Add --persist-uuid ......................................................................
Patch Set 1: Code-Review-1
(1 comment)
https://gerrit.ovirt.org/#/c/44431/1/lib/vdsm/tool/register.py File lib/vdsm/tool/register.py:
Line 275: f.write(self.uuid) Line 276: Line 277: if utils.isOvirtNode(): Line 278: from ovirt.node.utils.fs import Config Line 279: Config().persist(__VDSM_ID) we persist the uuid anyway, so the name of the new argument is misleading.
--persist-uuid should mean "I would like to write VDSM_ID onto the filesystem".
in this patch you are adding something like
--vdsm-uuid - override the default vdsm uuid. this may be useful if dmidecode returns an unconfigured host id. Line 280: Line 281: self.logger.info("Host UUID: {u}".format(u=self.uuid)) Line 282: Line 283: def download_ca(self):
automation@ovirt.org has posted comments on this change.
Change subject: register: Add --vdsm-uuid ......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Douglas Schilling Landgraf has posted comments on this change.
Change subject: register: Add --vdsm-uuid ......................................................................
Patch Set 2: Verified+1
automation@ovirt.org has posted comments on this change.
Change subject: register: Add --vdsm-uuid option ......................................................................
Patch Set 3:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Dan Kenigsberg has posted comments on this change.
Change subject: register: Add --vdsm-uuid option ......................................................................
Patch Set 3: Code-Review-1
(1 comment)
https://gerrit.ovirt.org/#/c/44431/3/lib/vdsm/tool/register.py File lib/vdsm/tool/register.py:
Line 451: ) Line 452: Line 453: parser.add_argument( Line 454: '--vdsm-uuid', Line 455: help="Enforce VDSM UUID.", "Enforce" is very vague.
How about using (here and elsewhere) something along lthe lines of
"provide host uuid to be used instead vdsm.utils' default. useful for hosts with blank or buggy dmi" Line 456: ) Line 457: Line 458: # Using [1:] to remove the 'register' option from arguments Line 459: # and avoid vdsm-tool recognize it as an unknown option
automation@ovirt.org has posted comments on this change.
Change subject: register: Add --vdsm-uuid ......................................................................
Patch Set 4:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Douglas Schilling Landgraf has posted comments on this change.
Change subject: register: Add --vdsm-uuid ......................................................................
Patch Set 4: Verified+1
Fabian Deutsch has posted comments on this change.
Change subject: register: Add --vdsm-uuid ......................................................................
Patch Set 4: Code-Review+1
Dan Kenigsberg has posted comments on this change.
Change subject: register: Add --vdsm-uuid ......................................................................
Patch Set 4: Code-Review+2
Dan Kenigsberg has submitted this change and it was merged.
Change subject: register: Add --vdsm-uuid ......................................................................
register: Add --vdsm-uuid
This patch adds --vdsm-uuid option to user provide host UUID to be used instead vdsm.utils. Useful for hosts with blank or buggy DMI.
Change-Id: I5926b635201662db53956dbac18b9a2981d6e645 Signed-off-by: Douglas Schilling Landgraf dougsland@redhat.com Reviewed-on: https://gerrit.ovirt.org/44431 Continuous-Integration: Jenkins CI Reviewed-by: Fabian Deutsch fabiand@redhat.com Reviewed-by: Dan Kenigsberg danken@redhat.com --- M lib/vdsm/tool/register.py 1 file changed, 28 insertions(+), 3 deletions(-)
Approvals: Fabian Deutsch: Looks good to me, but someone else must approve Douglas Schilling Landgraf: Verified Jenkins CI: Passed CI tests Dan Kenigsberg: Looks good to me, approved
automation@ovirt.org has posted comments on this change.
Change subject: register: Add --vdsm-uuid ......................................................................
Patch Set 5:
* Update tracker::IGNORE, no Bug-Url found * Set MODIFIED::IGNORE, no Bug-Url found.
vdsm-patches@lists.fedorahosted.org